First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
include "db.php";
|
||||
include "table.php";
|
||||
|
||||
|
||||
$query = "SELECT * FROM invoice_payments WHERE payment_date = '2017-06-18'";
|
||||
$results = db_query($query);
|
||||
|
||||
$entries = array();
|
||||
$invoices = array();
|
||||
|
||||
while ($row = db_fetch_assoc($results)) {
|
||||
$snum = $row['school_num'];
|
||||
$s = db_query("SELECT * FROM schools WHERE record_num = $snum");
|
||||
$school = db_fetch_assoc($s);
|
||||
$row['school_name'] = $school['school_name'];
|
||||
$row['currency'] = 'CAD';
|
||||
if ($school['country'] == 'USA') $row['currency'] = 'USD';
|
||||
$entries[] = $row;
|
||||
|
||||
$inum = $row['invoice_num'] - 500;
|
||||
$i = db_query("SELECT * FROM invoice_header WHERE school_num = $snum AND record_num = $inum");
|
||||
$invoice = db_fetch_assoc($i);
|
||||
$invoices[$inum + 500] = $invoice;
|
||||
}
|
||||
|
||||
db_close($_DB);
|
||||
$_DB = db_connect("polarbear2",$db_uname,$db_pass);
|
||||
db_query("USE schoolappointments");
|
||||
|
||||
$payments = new Table("invoice_payments");
|
||||
|
||||
|
||||
for ($i = 0; $i < count($entries); $i++) {
|
||||
$row = $entries[$i];
|
||||
extract($row);
|
||||
$invoice = $invoices[$invoice_num];
|
||||
|
||||
// printf("%6d %-40s %3s %4d %7.2f\n",$school_num,$school_name,$currency,$invoice_num,$amount);
|
||||
|
||||
$note = $school_name;
|
||||
$application = "Hot Lunches";
|
||||
$invoice_subtotal = $invoice['subtotal'];
|
||||
$invoice_gst = $invoice['gst'];
|
||||
$invoice_total = $invoice['total'];
|
||||
$entered = time();
|
||||
$payment_date = date("Y-m-d",$entered);
|
||||
$amount = $invoice_total;
|
||||
$group_with_next = 'N';
|
||||
$batch_num = 0;
|
||||
$company = 'EZS Software';
|
||||
|
||||
$query = $payments->BuildInsert();
|
||||
db_query($query);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user