27 lines
625 B
PHP
27 lines
625 B
PHP
<?php
|
|
|
|
include "db.php";
|
|
include "table.php";
|
|
|
|
date_default_timezone_set("Canada/Pacific");
|
|
|
|
$query = "SELECT count(*) AS number, SUM(total) AS total FROM invoice_header WHERE status = 'Open'";
|
|
$results = db_query($query);
|
|
$row = db_fetch_assoc($results);
|
|
|
|
extract($row);
|
|
// echo("Num Invoices: $number\n");
|
|
// echo("Invoices Total: $".number_format($total,2)."\n");
|
|
|
|
$entry = array();
|
|
$entry['process_date'] = date("Y-m-d",time());
|
|
$entry['invoice_count'] = $number;
|
|
$entry['invoice_total'] = $total;
|
|
|
|
$table = new Table('invoice_total_log');
|
|
$query = $table->BuildInsert($entry);
|
|
// echo("$query\n");
|
|
db_query($query);
|
|
|
|
?>
|