= '$date_after' AND ".TB_PREF."supp_trans.tran_date <= '$date_to'"; if ($_POST['supplier_id'] != reserved_words::get_all()) $sql .= " AND ".TB_PREF."supp_trans.supplier_id = '" . $_POST['supplier_id'] . "'"; if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) { if (($_POST['filterType'] == '1')) { $sql .= " AND (".TB_PREF."supp_trans.type = 20 OR ".TB_PREF."supp_trans.type = 2)"; } elseif (($_POST['filterType'] == '2')) { $sql .= " AND ".TB_PREF."supp_trans.type = 20 "; } elseif ($_POST['filterType'] == '3') { $sql .= " AND (".TB_PREF."supp_trans.type = 22 OR ".TB_PREF."supp_trans.type = 1) "; } elseif (($_POST['filterType'] == '4') || ($_POST['filterType'] == '5')) { $sql .= " AND ".TB_PREF."supp_trans.type = 21 "; } if (($_POST['filterType'] == '2') || ($_POST['filterType'] == '5')) { $today = date2sql(Today()); $sql .= " AND ".TB_PREF."supp_trans.due_date < '$today' "; } } $sql .= " ORDER BY ".TB_PREF."supp_trans.tran_date"; return db_query($sql,"No supplier transactions were returned"); } //------------------------------------------------------------------------------------------------ div_start('totals_tbl'); if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != reserved_words::get_all())) { $supplier_record = get_supplier_details($_POST['supplier_id']); display_supplier_summary($supplier_record); } div_end(); //------------------------------------------------------------------------------------------------ $result = get_transactions(); if(get_post('Refresh Inquiry')) { $Ajax->activate('trans_tbl'); $Ajax->activate('totals_tbl'); } //------------------------------------------------------------------------------------------------ /*show a table of the transactions returned by the sql */ div_start('trans_tbl'); if (db_num_rows($result) == 0) { display_note(_("There are no transactions to display for the given dates."), 1, 1); } else { start_table("$table_style width=80%"); if ($_POST['supplier_id'] == reserved_words::get_all()) $th = array(_("Type"), _("#"), _("Reference"), _("Supplier"), _("Supplier's Reference"), _("Date"), _("Due Date"), _("Currency"), _("Debit"), _("Credit"), ""); else $th = array(_("Type"), _("#"), _("Reference"), _("Supplier's Reference"), _("Date"), _("Due Date"), _("Debit"), _("Credit"), ""); table_header($th); $j = 1; $k = 0; //row colour counter $over_due = false; while ($myrow = db_fetch($result)) { if ($myrow['OverDue'] == 1 && $myrow['Settled'] == 0) { start_row("class='overduebg'"); $over_due = true; } else { alt_table_row_color($k); } $date = sql2date($myrow["tran_date"]); $duedate = ((($myrow["type"]== 20) || ($myrow["type"]== 21))?sql2date($myrow["due_date"]):""); label_cell(systypes::name($myrow["type"])); label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"])); label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"], $myrow["reference"])); if ($_POST['supplier_id'] == reserved_words::get_all()) label_cell($myrow["supp_name"]); label_cell($myrow["supp_reference"]); label_cell($date); label_cell($duedate); if ($_POST['supplier_id'] == reserved_words::get_all()) label_cell($myrow["curr_code"]); if ($myrow["TotalAmount"] >= 0) label_cell(""); amount_cell(abs($myrow["TotalAmount"])); if ($myrow["TotalAmount"] < 0) label_cell(""); label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"])); end_row(); $j++; If ($j == 12) { $j=1; table_header($th); } //end of page full new headings if } //end of while loop end_table(1); if ($over_due) display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'"); } div_end(); end_page(); ?>