aboutsummaryrefslogtreecommitdiff
path: root/makeinvoices.php
diff options
context:
space:
mode:
Diffstat (limited to 'makeinvoices.php')
-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 {