Small update on invoices

This commit is contained in:
Pinga 2023-12-02 12:53:39 +02:00
parent 54c84943a0
commit 5c767e7982

View file

@ -65,8 +65,14 @@ try {
$insertStmt->execute();
$invoiceNumber = $pdo->lastInsertId();
$currentDateFormatted = date("Ymd"); // This will format the date as 'YYYYMMDD'
$currentDateFormatted = date("Ymd");
$invoiceIdFormatted = "I" . $invoiceNumber . "-" . $currentDateFormatted;
$updateQuery = "UPDATE invoices SET invoice_number = :invoiceIdFormatted WHERE id = :invoiceNumber";
$stmt = $pdo->prepare($updateQuery);
$stmt->bindParam(':invoiceIdFormatted', $invoiceIdFormatted, PDO::PARAM_STR);
$stmt->bindParam(':invoiceNumber', $invoiceNumber, PDO::PARAM_INT);
$stmt->execute();
$issueDate = date("Y-m-d");
$dueDate = date("Y-m-d", strtotime("+30 days"));