} //------------------------------------------------------------------------------------------------ if ($_POST['customer_id'] != "" && $_POST['customer_id'] != reserved_words::get_all()) { $customer_record = get_customer_details($_POST['customer_id']); display_customer_summary($customer_record); echo "<br>"; } //------------------------------------------------------------------------------------------------ $result = get_transactions(); if (db_num_rows($result) == 0) { display_note(tr("The selected customer has no transactions for the given dates."), 0, 2); end_page(); exit; } //------------------------------------------------------------------------------------------------ print_hidden_script(10); start_table("{$table_style} width='80%'"); $th = array(tr("Type"), tr("#"), tr("Order"), tr("Reference"), tr("Date"), tr("Due Date"), tr("Customer"), tr("Branch"), tr("Currency"), tr("Debit"), tr("Credit"), "", "", "", ""); if ($_POST['customer_id'] != reserved_words::get_all()) { unset($th[6], $th[8]); } table_header($th); $j = 1; $k = 0; //row colour counter $over_due = false; while ($myrow = db_fetch($result)) { if ($myrow['OverDue'] == 1) { start_row("class='overduebg'"); $over_due = true; } else {
} page($_SESSION['page_title'], false, false, "", $js); //----------------------------------------------------------------------------- if (isset($_GET['AddedID'])) { $credit_no = $_GET['AddedID']; $trans_type = 11; print_hidden_script(11); display_notification_centered(tr("Credit Note has been processed")); display_note(get_customer_trans_view_str($trans_type, $credit_no, tr("View This Credit Note")), 0, 0); display_note(print_document_link($credit_no, tr("Print This Credit Note"), true, 11), 1); display_note(get_gl_view_str($trans_type, $credit_no, tr("View the GL Journal Entries for this Credit Note")), 1); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $credit_no = $_GET['UpdatedID']; $trans_type = 11; print_hidden_script(11); display_notification_centered(tr("Credit Note has been updated")); display_note(get_customer_trans_view_str($trans_type, $credit_no, tr("View This Credit Note")), 0, 0); display_note(print_document_link($credit_no, tr("Print This Credit Note"), true, 11), 1); display_note(get_gl_view_str($trans_type, $credit_no, tr("View the GL Journal Entries for this Credit Note")), 1); display_footer_exit(); } //----------------------------------------------------------------------------- function can_process() { if (!is_date($_POST['CreditDate'])) { display_error(tr("The entered date is invalid.")); set_focus('CreditDate'); return false; } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) { display_error(tr("The entered date is not in fiscal year."));
} else { $data_after = date2sql($_POST['OrdersAfterDate']); $date_before = date2sql($_POST['OrdersToDate']); $sql .= " AND purch_orders.ord_date >= '{$data_after}'"; $sql .= " AND purch_orders.ord_date <= '{$date_before}'"; if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) { $sql .= " AND purch_orders.into_stock_location = '" . $_POST['StockLocation'] . "' "; } if (isset($selected_stock_item)) { $sql .= " AND purch_order_details.item_code='" . $selected_stock_item . "' "; } } //end not order number selected $sql .= " GROUP BY purch_orders.order_no"; $result = db_query($sql, "No orders were returned"); print_hidden_script(18); start_table("{$table_style} colspan=7 width=80%"); if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all()) { $th = array(tr("#"), tr("Reference"), tr("Supplier"), tr("Location"), tr("Supplier's Reference"), tr("Order Date"), tr("Currency"), tr("Order Total"), ""); } else { $th = array(tr("#"), tr("Reference"), tr("Supplier"), tr("Supplier's Reference"), tr("Order Date"), tr("Currency"), tr("Order Total"), ""); } table_header($th); $j = 1; $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); $date = sql2date($myrow["ord_date"]); label_cell(get_trans_view_str(systypes::po(), $myrow["order_no"])); label_cell($myrow["reference"]);
function handle_search() { global $table_style; if (check_valid_entries() == true) { $db_info = get_systype_db_info($_POST['filterType']); if ($db_info == null) { return; } $table_name = $db_info[0]; $type_name = $db_info[1]; $trans_no_name = $db_info[2]; $trans_ref = $db_info[3]; $sql = "SELECT DISTINCT {$trans_no_name} "; if ($trans_ref) { $sql .= " ,{$trans_ref} "; } $sql .= " FROM {$table_name}\n\t\t\tWHERE {$trans_no_name} >= " . $_POST['FromTransNo'] . "\n\t\t\tAND {$trans_no_name} <= " . $_POST['ToTransNo']; if ($type_name != null) { $sql .= " AND {$type_name} = " . $_POST['filterType']; } $sql .= " ORDER BY {$trans_no_name}"; $result = db_query($sql, "could not query transactions on {$table_name}"); if (db_num_rows($result) == 0) { echo tr("There are no transactions for the given parameters."); return; } $print_type = $_POST['filterType']; $print_out = $print_type == 10 || $print_type == 11 || $print_type == systypes::cust_dispatch() || $print_type == systypes::po() || $print_type == systypes::sales_order(); if ($print_out) { print_hidden_script($print_type); if ($trans_ref) { $th = array(tr("#"), tr("Reference"), tr("View"), tr("Print"), tr("GL")); } else { $th = array(tr("#"), tr("View"), tr("Print"), tr("GL")); } } else { if ($trans_ref) { $th = array(tr("#"), tr("Reference"), tr("View"), tr("GL")); } else { $th = array(tr("#"), tr("View"), tr("GL")); } } start_table($table_style); table_header($th); $k = 0; while ($line = db_fetch($result)) { alt_table_row_color($k); label_cell($line[$trans_no_name]); if ($trans_ref) { label_cell($line[$trans_ref]); } label_cell(get_trans_view_str($_POST['filterType'], $line[$trans_no_name], tr("View"))); if ($print_out) { label_cell(print_document_link($line[$trans_no_name], tr("Print"), true, $print_type)); } label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], tr("View GL"))); end_row(); } end_table(); } }
} if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) { $sql .= " AND sales_orders.from_stk_loc = '" . $_POST['StockLocation'] . "' "; } if ($_POST['order_view_mode'] == 'OutstandingOnly') { $sql .= " AND sales_order_details.qty_sent < sales_order_details.quantity"; } elseif ($_POST['order_view_mode'] == 'InvoiceTemplates' || $_POST['order_view_mode'] == 'DeliveryTemplates') { $sql .= " AND sales_orders.type=1"; } $sql .= " GROUP BY sales_orders.order_no, sales_orders.debtor_no, sales_orders.branch_code,\n\t\tsales_orders.customer_ref, sales_orders.ord_date, sales_orders.deliver_to"; } //end not order number selected $result = db_query($sql, "No orders were returned"); //----------------------------------------------------------------------------------- if ($result) { print_hidden_script(30); /*show a table of the orders returned by the sql */ start_table("{$table_style} colspan=6 width=95%"); $th = array(tr("Order #"), tr("Customer"), tr("Branch"), tr("Cust Order #"), tr("Order Date"), tr("Required By"), tr("Delivery To"), tr("Order Total"), tr("Currency"), ""); if ($_POST['order_view_mode'] == 'InvoiceTemplates' || $_POST['order_view_mode'] == 'DeliveryTemplates') { $th[3] = tr('Description'); } elseif ($_POST['order_view_mode'] != 'OutstandingOnly') { $th[9] = tr('Tmpl'); $th[] = ''; $th[] = ''; $th[] = ''; } table_header($th); start_form(); $j = 1; $k = 0;
processing_start(); } page($_SESSION['page_title'], false, false, "", $js); if (isset($_GET['AddedID'])) { $dispatch_no = $_GET['AddedID']; print_hidden_script(13); display_notification(tr("Dispatch processed:") . ' ' . $_GET['AddedID'], true); display_note(get_customer_trans_view_str(13, $dispatch_no, tr("View this dispatch")), 0, 1); display_note(print_document_link($dispatch_no, tr("Print this delivery"), true, 13)); display_note(get_gl_view_str(13, $dispatch_no, tr("View the GL Journal Entries for this Dispatch")), 1); hyperlink_params("{$path_to_root}/sales/customer_invoice.php", tr("Invoice This Delivery"), "DeliveryNumber={$dispatch_no}"); hyperlink_params("{$path_to_root}/sales/inquiry/sales_orders_view.php", tr("Select Another Order For Dispatch"), "OutstandingOnly=1"); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $delivery_no = $_GET['UpdatedID']; print_hidden_script(13); display_notification_centered(sprintf(tr('Delivery Note # %d has been updated.'), $delivery_no)); display_note(get_trans_view_str(13, $delivery_no, tr("View this delivery"))); echo '<br>'; display_note(print_document_link($delivery_no, tr("Print this delivery"), true, 13)); hyperlink_params($path_to_root . "/sales/customer_invoice.php", tr("Confirm Delivery and Invoice"), "DeliveryNumber={$delivery_no}"); hyperlink_params($path_to_root . "/sales/inquiry/sales_deliveries_view.php", tr("Select A Different Delivery"), "OutstandingOnly=1"); display_footer_exit(); } //----------------------------------------------------------------------------- if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) { $ord = new Cart(30, $_GET['OrderNumber'], true); /*read in all the selected order into the Items cart */ if ($ord->count_items() == 0) { hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php", tr("Select a different sales order to delivery"), "OutstandingOnly=1"); die("<br><b>" . tr("This order has no items. There is nothing to delivery.") . "</b>");