From b708311d256bbf057b0d6ad2fba4d75642c5a095 Mon Sep 17 00:00:00 2001 From: arf20 Date: Tue, 9 Apr 2024 03:02:35 +0200 Subject: [PATCH] Small fixes, add manual makeinvoice date --- config.php.example | 2 +- makeinvoices.php | 24 +++++++++++++++++------- manageusers.php | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/config.php.example b/config.php.example index c083592..b476a5d 100644 --- a/config.php.example +++ b/config.php.example @@ -40,6 +40,6 @@ function new_mail() { $mailer->isHTML(false); } -newmail(); +new_mail(); ?> 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); diff --git a/manageusers.php b/manageusers.php index b0e7705..7d4044d 100644 --- a/manageusers.php +++ b/manageusers.php @@ -15,7 +15,7 @@ require_once "config.php"; // Get users -$sql = "SELECT id, username, email, verifycode, status, type, regdate FROM users"; +$sql = "SELECT id, username, password, email, verifycode, status, type, regdate FROM users"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt);