# # # # # # # # # # require "../settings.php"; require "../libs/ext.lib.php"; if (div_isset("DEBT_AGE", "mon")) { $OUTPUT = printAgeAge(); } else { $OUTPUT = printAgeInv(); } require "../template.php"; # Age analysis by date function printAgeInv() { # Set up table to display in $printCust = "\n <h3>Debtors Age Analysis</h3>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><th>Acc no.</th><th>Customer</th><th>Contact Name</th><th>Tel No.</th><th>Current</th><th>30 days</th><th>60 days</th><th>90 days</th><th>120 days</th><th>Total Outstanding</th></tr>"; # Connect to database db_connect(); # Query server $i = 0; $sql = "SELECT * FROM customers ORDER BY accno ASC"; $custRslt = db_exec($sql) or errDie("Unable to retrieve Customers from database."); if (pg_numrows($custRslt) < 1) { return "<li>There are no Customers in Cubit.";
function excel() { $OUTPUT = clean_html(printAgeInv($_POST, FALSE)); require_lib("xls"); StreamXLS("Debtors Age Analysis", $OUTPUT); }