aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2025-11-06 23:37:25 +0100
committerarf20 <aruizfernandez05@gmail.com>2025-11-06 23:37:25 +0100
commit0a65cdab3453a50008803d3bbb3b69860787fca1 (patch)
treeb0b9c55b589e6d7b655fec072290f17b5ce55760
parentf6229b2d405856173ce96d0be87e22e18c553f88 (diff)
downloadarfnet2-cstims-0a65cdab3453a50008803d3bbb3b69860787fca1.tar.gz
arfnet2-cstims-0a65cdab3453a50008803d3bbb3b69860787fca1.zip
Don't send invoices for 0€
-rw-r--r--makeinvoices.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/makeinvoices.php b/makeinvoices.php
index f4f02e8..f9ef030 100644
--- a/makeinvoices.php
+++ b/makeinvoices.php
@@ -145,14 +145,19 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") {
foreach ($clients as $client) {
$ret = generate_pdf($client, array_filter($dueorders, function($e) { global $client; return $e["client"] == $client["id"]; }));
+ $param_amount = $ret[1];
+
+ if ($param_amount == 0.0)
+ continue;
+
$sql = "INSERT INTO invoices (client, `desc`, amount, pdf) VALUES (?, ?, ?, ?)";
$stmt = mysqli_prepare($link, $sql);
mysqli_stmt_bind_param($stmt, "ssss", $param_client, $param_desc, $param_amount, $param_pdf);
$param_client = $client["id"];
$param_desc = "Monthly invoice";
- $param_amount = $ret[1];
$param_pdf = $ret[0];
+
if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) {
echo "SQL error.";
} else {