From b708311d256bbf057b0d6ad2fba4d75642c5a095 Mon Sep 17 00:00:00 2001 From: arf20 Date: Tue, 9 Apr 2024 03:02:35 +0200 Subject: Small fixes, add manual makeinvoice date --- makeinvoices.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'makeinvoices.php') diff --git a/makeinvoices.php b/makeinvoices.php index 84a00ad..e20b0e5 100644 --- a/makeinvoices.php +++ b/makeinvoices.php @@ -1,6 +1,16 @@ fetch_all(MYSQLI_ASSOC); -$fdom = new DateTime('first day of this month'); -$ldom = new DateTime('last day of this month'); +$fdom = new DateTime(date("Y-m-01", $computedateunix)); +$ldom = new DateTime(date("Y-m-t", $computedateunix)); function send_invoice_mail($ret, $email, $desc) { global $mailer; @@ -95,7 +105,7 @@ function send_invoice_mail($ret, $email, $desc) { $mailer->Body = "Customer,\n\nThis is a notice that a invoice has been generated on ".date("l, F j, Y")."\n" ."for the amount of ".number_format($ret[1], 2, '.', '')." € with description\n\n" .$desc."\n\n" - ."You may pay it in any of the payments methodes listed on our site,\nalways include the invoice ID in the payment concept." + ."You may pay it in any of the payments methods listed on our site,\nalways include the invoice ID in the payment concept." ."\n\n--\nARFNET Client, Service, Ticket and Invoice Management System\nhttps://arf20.com"; $mailer->AddStringAttachment($ret[0], "invoice_".$ret[2].".pdf"); @@ -183,7 +193,7 @@ function getclientbyid($id) { function generate_pdf($client, $dueorders, $desc = null, $manualqty = null) { - global $link, $fdom, $ldom; + global $link, $fdom, $ldom, $computedateunix; // get next invoice id $sql = "SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = 'invoices'"; $stmt = mysqli_prepare($link, $sql); @@ -225,8 +235,8 @@ function generate_pdf($client, $dueorders, $desc = null, $manualqty = null) { $txt = "Invoice ID: $nextid\n" - ."Invoice date: ".date("l, F j, Y\n") - ."Due date: ".date("l, F j, Y\n\n"); + ."Invoice date: ".date("l, F j, Y\n", $computedateunix) + ."Due date: ".date("l, F j, Y\n\n", $computedateunix); $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('helvetica', 'B', 20); -- cgit v1.2.3