From: Joe Hunt Date: Fri, 28 Mar 2008 15:23:54 +0000 (+0000) Subject: Added print document options in inquiries. X-Git-Tag: v2.4.2~19^2~2130 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=7d866f768b8be95c82ab0664721da9ca09c7604f Added print document options in inquiries. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ca67337f..97335f37 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,14 @@ Legend: ! -> Note $ -> Affected files +28-Mar-2008 Joe Hunt ++ Added print document options in inquiries. +$ /sales/inquiry/customer_inquiry.php + /sales/inquiry/sales_orders_view.php + /sales/inquiry/sales_deliveries_view.php + /purchasing/inquiry/po_search.php + /purchasing/inquiry/po_search_completed.php + 28-Mar-2008 Joe Hunt # Fixed a minor bug in customers_db.inc (should include type == 2 - Bank Deposits) $ /sales/includes/db/customers_db.inc diff --git a/company/0/images/102.jpg b/company/0/images/102.jpg index 479662ea..ba8e7daa 100644 Binary files a/company/0/images/102.jpg and b/company/0/images/102.jpg differ diff --git a/company/0/images/103.jpg b/company/0/images/103.jpg index adbd56b2..d43108b9 100644 Binary files a/company/0/images/103.jpg and b/company/0/images/103.jpg differ diff --git a/company/0/images/104.jpg b/company/0/images/104.jpg index 13e29496..ba8e7daa 100644 Binary files a/company/0/images/104.jpg and b/company/0/images/104.jpg differ diff --git a/company/0/images/logo_frontaccounting.jpg b/company/0/images/logo_frontaccounting.jpg index 130a31dd..7c129ded 100644 Binary files a/company/0/images/logo_frontaccounting.jpg and b/company/0/images/logo_frontaccounting.jpg differ diff --git a/company/0/images/logo_frontaccounting.png b/company/0/images/logo_frontaccounting.png index 85150e2b..f1ad7558 100644 Binary files a/company/0/images/logo_frontaccounting.png and b/company/0/images/logo_frontaccounting.png differ diff --git a/purchasing/inquiry/po_search.php b/purchasing/inquiry/po_search.php index 7b2e867c..4c65b5b0 100644 --- a/purchasing/inquiry/po_search.php +++ b/purchasing/inquiry/po_search.php @@ -5,6 +5,7 @@ $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); include($path_to_root . "/purchasing/includes/purchasing_ui.inc"); +include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) @@ -50,8 +51,8 @@ if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "" ($_POST['SelectStockFromList'] != $all_items)) { $selected_stock_item = $_POST['SelectStockFromList']; -} -else +} +else { unset($selected_stock_item); } @@ -71,11 +72,11 @@ $sql = "SELECT ".TB_PREF."purch_orders.order_no, ".TB_PREF."suppliers.supp_name, AND ".TB_PREF."locations.loc_code = ".TB_PREF."purch_orders.into_stock_location AND (".TB_PREF."purch_order_details.quantity_ordered > ".TB_PREF."purch_order_details.quantity_received) "; -if (isset($order_number) && $order_number != "") +if (isset($order_number) && $order_number != "") { $sql .= "AND ".TB_PREF."purch_orders.reference LIKE '%". $order_number . "%'"; -} -else +} +else { $data_after = date2sql($_POST['OrdersAfterDate']); @@ -84,12 +85,12 @@ else $sql .= " AND ".TB_PREF."purch_orders.ord_date >= '$data_after'"; $sql .= " AND ".TB_PREF."purch_orders.ord_date <= '$data_before'"; - if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != $all_items) + if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != $all_items) { $sql .= " AND ".TB_PREF."purch_orders.into_stock_location = '". $_POST['StockLocation'] . "' "; } - if (isset($selected_stock_item)) + if (isset($selected_stock_item)) { $sql .= " AND ".TB_PREF."purch_order_details.item_code='". $selected_stock_item ."' "; } @@ -99,31 +100,33 @@ $sql .= " GROUP BY ".TB_PREF."purch_orders.order_no"; $result = db_query($sql,"No orders were returned"); +print_hidden_script(18); + /*show a table of the orders returned by the sql */ start_table("$table_style colspan=7 width=80%"); if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == $all_items) $th = array(_("#"), _("Reference"), _("Supplier"), _("Location"), - _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),''); -else + _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),"","",""); +else $th = array(_("#"), _("Reference"), _("Supplier"), - _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),''); + _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),"","",""); table_header($th); $j = 1; $k = 0; //row colour counter $overdue_items = false; -while ($myrow = db_fetch($result)) +while ($myrow = db_fetch($result)) { if ($myrow["OverDue"] == 1) { start_row("class='overduebg'"); $overdue_items = true; - } - else + } + else { alt_table_row_color($k); } @@ -143,6 +146,7 @@ while ($myrow = db_fetch($result)) label_cell($myrow["curr_code"]); amount_cell($myrow["OrderValue"]); label_cell("" . _("Edit") . ""); + label_cell(print_document_link($myrow['order_no'], _("Print"))); label_cell("" . _("Receive") . ""); end_row(); diff --git a/purchasing/inquiry/po_search_completed.php b/purchasing/inquiry/po_search_completed.php index 0df563a2..8c18824a 100644 --- a/purchasing/inquiry/po_search_completed.php +++ b/purchasing/inquiry/po_search_completed.php @@ -5,6 +5,7 @@ $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); include($path_to_root . "/purchasing/includes/purchasing_ui.inc"); +include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); @@ -49,8 +50,8 @@ if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "" ($_POST['SelectStockFromList'] != reserved_words::get_all())) { $selected_stock_item = $_POST['SelectStockFromList']; -} -else +} +else { unset($selected_stock_item); } @@ -66,11 +67,11 @@ $sql = "SELECT ".TB_PREF."purch_orders.order_no, ".TB_PREF."suppliers.supp_name, AND ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id AND ".TB_PREF."locations.loc_code = ".TB_PREF."purch_orders.into_stock_location "; -if (isset($order_number) && $order_number != "") +if (isset($order_number) && $order_number != "") { $sql .= "AND ".TB_PREF."purch_orders.reference LIKE '%". $order_number . "%'"; -} -else +} +else { $data_after = date2sql($_POST['OrdersAfterDate']); @@ -79,11 +80,11 @@ else $sql .= " AND ".TB_PREF."purch_orders.ord_date >= '$data_after'"; $sql .= " AND ".TB_PREF."purch_orders.ord_date <= '$date_before'"; - if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) + if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) { $sql .= " AND ".TB_PREF."purch_orders.into_stock_location = '". $_POST['StockLocation'] . "' "; } - if (isset($selected_stock_item)) + if (isset($selected_stock_item)) { $sql .= " AND ".TB_PREF."purch_order_details.item_code='". $selected_stock_item ."' "; } @@ -94,20 +95,22 @@ $sql .= " GROUP BY ".TB_PREF."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(_("#"), _("Reference"), _("Supplier"), _("Location"), - _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total")); -else - $th = array(_("#"), _("Reference"), _("Supplier"), - _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total")); + _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),""); +else + $th = array(_("#"), _("Reference"), _("Supplier"), + _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),""); table_header($th); $j = 1; $k = 0; //row colour counter -while ($myrow = db_fetch($result)) +while ($myrow = db_fetch($result)) { alt_table_row_color($k); @@ -123,6 +126,7 @@ while ($myrow = db_fetch($result)) label_cell($date); label_cell($myrow["curr_code"]); amount_cell($myrow["OrderValue"]); + label_cell(print_document_link($myrow['order_no'], _("Print"))); end_row(); $j++; diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index 57725f38..db68dfdd 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -64,11 +64,11 @@ function display_customer_summary($customer_record) $nowdue = "1-" . $past1 . " " . _('Days'); $pastdue1 = $past1 + 1 . "-" . $past2 . " " . _('Days'); $pastdue2 = _('Over') . " " . $past2 . " " . _('Days'); - + start_table("width=80% $table_style"); $th = array(_("Currency"), _("Terms"), _("Current"), $nowdue, $pastdue1, $pastdue2, _("Total Balance")); - table_header($th); + table_header($th); start_row(); label_cell($customer_record["curr_code"]); @@ -107,28 +107,28 @@ function get_transactions() if ($_POST['filterType'] != reserved_words::get_all()) { - if ($_POST['filterType'] == '1') + if ($_POST['filterType'] == '1') { $sql .= " AND (".TB_PREF."debtor_trans.type = 10 OR ".TB_PREF."debtor_trans.type = 1) "; - } - elseif ($_POST['filterType'] == '2') + } + elseif ($_POST['filterType'] == '2') { $sql .= " AND (".TB_PREF."debtor_trans.type = 10) "; - } - elseif ($_POST['filterType'] == '3') + } + elseif ($_POST['filterType'] == '3') { $sql .= " AND (".TB_PREF."debtor_trans.type = " . systypes::cust_payment() . " OR ".TB_PREF."debtor_trans.type = 2) "; - } - elseif ($_POST['filterType'] == '4') + } + elseif ($_POST['filterType'] == '4') { $sql .= " AND ".TB_PREF."debtor_trans.type = 11 "; } - elseif ($_POST['filterType'] == '5') + elseif ($_POST['filterType'] == '5') { $sql .= " AND ".TB_PREF."debtor_trans.type = 13 "; } - if ($_POST['filterType'] == '2') + if ($_POST['filterType'] == '2') { $today = date2sql(Today()); $sql .= " AND ".TB_PREF."debtor_trans.due_date < '$today' @@ -138,7 +138,7 @@ function get_transactions() } } - $sql .= " ORDER BY ".TB_PREF."debtor_trans.tran_date DESC, + $sql .= " ORDER BY ".TB_PREF."debtor_trans.tran_date DESC, ".TB_PREF."debtor_trans.type,".TB_PREF."debtor_trans.trans_no "; return db_query($sql,"No transactions were returned"); @@ -166,11 +166,11 @@ if (db_num_rows($result) == 0) //------------------------------------------------------------------------------------------------ +print_hidden_script(10); start_table("$table_style width='80%'"); $th = array(_("Type"), _("#"), _("Order"), _("Reference"), _("Date"), _("Due Date"), - _("Customer"), _("Branch"), _("Currency"), _("Debit"), _("Credit"), "", "","" - /*,"" print */); + _("Customer"), _("Branch"), _("Currency"), _("Debit"), _("Credit"), "", "","",""); if ($_POST['customer_id'] != reserved_words::get_all()) { unset($th[6], $th[8]); @@ -182,14 +182,14 @@ table_header($th); $j = 1; $k = 0; //row colour counter $over_due = false; -while ($myrow = db_fetch($result)) +while ($myrow = db_fetch($result)) { if ($myrow['OverDue'] == 1) { start_row("class='overduebg'"); $over_due = true; - } + } else alt_table_row_color($k); @@ -205,18 +205,18 @@ while ($myrow = db_fetch($result)) if ($myrow["TotalAmount"] - $myrow["Allocated"] > 0) $credit_me_str = "" . _("Credit This") . ""; $edit_page= $path_to_root.'/sales/customer_invoice.php?ModifyInvoice=' - . $myrow['trans_no']; + . $myrow['trans_no']; break; case 11: if ($myrow['order_']==0) // free-hand credit note $edit_page= $path_to_root.'/sales/credit_note_entry.php?ModifyCredit=' - . $myrow['trans_no']; + . $myrow['trans_no']; else // credit invoice $edit_page= $path_to_root.'/sales/customer_credit_invoice.php?ModifyCredit=' - . $myrow['trans_no']; + . $myrow['trans_no']; break; - + case 13: $edit_page= $path_to_root.'/sales/customer_delivery.php?ModifyDelivery=' . $myrow['trans_no']; break; @@ -231,11 +231,8 @@ while ($myrow = db_fetch($result)) $gl_trans_str = get_gl_view_str_cell($myrow["type"], $myrow["trans_no"]); -// $print_str = "" . _("Print") . ""; - - $branch_name = ""; - if ($myrow["branch_code"] > 0) + if ($myrow["branch_code"] > 0) { $branch_name = get_branch_name($myrow["branch_code"]); } @@ -255,24 +252,21 @@ while ($myrow = db_fetch($result)) if ($_POST['customer_id'] == reserved_words::get_all()) label_cell($myrow["CustCurrCode"]); display_debit_or_credit_cells( - $myrow['type']==11 || $myrow['type']==12 ? + $myrow['type']==11 || $myrow['type']==12 || $myrow['type']==2 ? -$myrow["TotalAmount"] : $myrow["TotalAmount"]); echo $gl_trans_str; - label_cell($edit_page=='' ? '' : "" . _('Edit') . ''); -// label_cell(print_document_link($myrow['trans_no'], _("Print"))); - + label_cell($edit_page=='' ? '' : "" . _('Edit') . ''); + if ($myrow['type'] == 10 || $myrow['type'] == 11) + label_cell(print_document_link($myrow['trans_no'], _("Print"), true, $myrow['type'])); + else + label_cell(""); + if ($credit_me_str != "") label_cell($credit_me_str, "nowrap"); else label_cell(''); - -// if ($myrow["type"] == 10) -// label_cell($print_str, 'nowrap'); -// else -// label_cell(''); - end_row(); $j++; @@ -287,7 +281,7 @@ end_table(1); if ($over_due) display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'"); - + end_page(); ?> diff --git a/sales/inquiry/sales_deliveries_view.php b/sales/inquiry/sales_deliveries_view.php index 2a0b017d..ab2add93 100644 --- a/sales/inquiry/sales_deliveries_view.php +++ b/sales/inquiry/sales_deliveries_view.php @@ -5,6 +5,7 @@ $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); include($path_to_root . "/sales/includes/sales_ui.inc"); +include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) @@ -12,12 +13,12 @@ if ($use_popup_windows) if ($use_date_picker) $js .= get_js_date_picker(); -if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true)) +if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true)) { $_POST['OutstandingOnly'] = true; page(_("Search Not Invoiced Deliveries"), false, false, "", $js); -} -else +} +else { $_POST['OutstandingOnly'] = false; page(_("Search All Deliveries"), false, false, "", $js); @@ -26,44 +27,56 @@ else if (isset($_GET['selected_customer'])) { $selected_customer = $_GET['selected_customer']; -} +} elseif (isset($_POST['selected_customer'])) { $selected_customer = $_POST['selected_customer']; } else $selected_customer = -1; - -if (isset($_POST['BatchInvoice'])) { -// checking batch integrity +if (isset($_POST['BatchInvoice'])) +{ + + // checking batch integrity $del_count = 0; - foreach($_SESSION['Batch'] as $delivery) { - $checkbox = 'Sel_'.$delivery['trans']; - if (check_value($checkbox)) { - if (!$del_count) { - $del_customer = $delivery['cust']; - $del_branch = $delivery['branch']; - } else { - if ($del_customer!=$delivery['cust'] || $del_branch != $delivery['branch']) { - $del_count=0; break; - } - } - $selected[] = $delivery['trans']; - $del_count++; - } + foreach($_SESSION['Batch'] as $delivery) + { + $checkbox = 'Sel_'.$delivery['trans']; + if (check_value($checkbox)) + { + if (!$del_count) + { + $del_customer = $delivery['cust']; + $del_branch = $delivery['branch']; + } + else + { + if ($del_customer!=$delivery['cust'] || $del_branch != $delivery['branch']) + { + $del_count=0; + break; + } + } + $selected[] = $delivery['trans']; + $del_count++; + } } - if (!$del_count) { - display_error(_('For batch invoicing you should + if (!$del_count) + { + display_error(_('For batch invoicing you should select at least one delivery. All items must be dispatched to the same customer branch.')); - } else { - $_SESSION['DeliveryBatch'] = $selected; - meta_forward($path_to_root . '/sales/customer_invoice.php','BatchInvoice=Yes'); + } + else + { + $_SESSION['DeliveryBatch'] = $selected; + meta_forward($path_to_root . '/sales/customer_invoice.php','BatchInvoice=Yes'); } } //----------------------------------------------------------------------------------- +print_hidden_script(13); start_form(false, false, $_SERVER['PHP_SELF'] ."?OutstandingOnly=" . $_POST['OutstandingOnly'] .SID); @@ -91,8 +104,8 @@ if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "" ($_POST['SelectStockFromList'] != reserved_words::get_all())) { $selected_stock_item = $_POST['SelectStockFromList']; -} -else +} +else { unset($selected_stock_item); } @@ -127,17 +140,17 @@ $sql .=" FROM " .TB_PREF."sales_orders.order_no = ".TB_PREF."debtor_trans.order_ AND " .TB_PREF."debtor_trans.debtor_no = ".TB_PREF."debtors_master.debtor_no AND ".TB_PREF."debtor_trans.type = 13 - AND ".TB_PREF."debtor_trans_details.debtor_trans_no = ".TB_PREF."debtor_trans.trans_no - AND ".TB_PREF."debtor_trans_details.debtor_trans_type = ".TB_PREF."debtor_trans.type + AND ".TB_PREF."debtor_trans_details.debtor_trans_no = ".TB_PREF."debtor_trans.trans_no + AND ".TB_PREF."debtor_trans_details.debtor_trans_type = ".TB_PREF."debtor_trans.type AND ".TB_PREF."debtor_trans.branch_code = ".TB_PREF."cust_branch.branch_code AND ".TB_PREF."debtor_trans.debtor_no = ".TB_PREF."cust_branch.debtor_no "; //figure out the sql required from the inputs available -if (isset($_POST['DeliveryNumber']) && $_POST['DeliveryNumber'] != "") +if (isset($_POST['DeliveryNumber']) && $_POST['DeliveryNumber'] != "") { $sql .= " AND ".TB_PREF."debtor_trans.trans_no LIKE '%". $_POST['DeliveryNumber'] ."' GROUP BY ".TB_PREF."debtor_trans.trans_no"; -} -else +} +else { $date_after = date2sql($_POST['DeliveryAfterDate']); @@ -158,7 +171,7 @@ else if ($_POST['OutstandingOnly'] == true) { $sql .= " AND ".TB_PREF."debtor_trans_details.qty_done < ".TB_PREF."debtor_trans_details.quantity "; } - + $sql .= " GROUP BY ".TB_PREF."debtor_trans.trans_no "; // .TB_PREF."debtor_trans.debtor_no, " // .TB_PREF."debtor_trans.branch_code, " @@ -170,30 +183,30 @@ else $result = db_query($sql,"No deliveries were returned"); //----------------------------------------------------------------------------------- -if (isset($_SESSION['Batch'])) { - foreach($_SESSION['Batch'] as $trans=>$del) unset($_SESSION['Batch'][$trans]); +if (isset($_SESSION['Batch'])) +{ + foreach($_SESSION['Batch'] as $trans=>$del) + unset($_SESSION['Batch'][$trans]); unset($_SESSION['Batch']); } -if ($result) +if ($result) { - /*show a table of the deliveries returned by the sql */ start_table("$table_style colspan=7 width=95%"); $th = array(_("Delivery #"), _("Customer"), _("Branch"), _("Reference"), _("Delivery Date"), - _("Due By"), _("Delivery Total"), _("Currency"), - submit('BatchInvoice','Batch Inv', false), - "", ""); + _("Due By"), _("Delivery Total"), _("Currency"), submit('BatchInvoice','Batch Inv', false), + "", "", ""); table_header($th); $j = 1; $k = 0; //row colour counter $overdue_items = false; - while ($myrow = db_fetch($result)) - { + while ($myrow = db_fetch($result)) + { $_SESSION['Batch'][] = array('trans'=>$myrow["trans_no"], 'cust'=>$myrow["name"],'branch'=>$myrow["br_name"] ); - + $view_page = get_customer_trans_view_str(13, $myrow["trans_no"]); $formated_del_date = sql2date($myrow["tran_date"]); $formated_due_date = sql2date($myrow["due_date"]); @@ -205,8 +218,8 @@ if ($result) { start_row("class='overduebg'"); $overdue_items = true; - } - else + } + else { alt_table_row_color($k); } @@ -223,11 +236,12 @@ if ($result) check_cells(null,'Sel_'. $myrow['trans_no'],0,false); else label_cell(""); - if ($_POST['OutstandingOnly'] == true || $not_closed) + if ($_POST['OutstandingOnly'] == true || $not_closed) { $modify_page = $path_to_root . "/sales/customer_delivery.php?" . SID . "ModifyDelivery=" . $myrow["trans_no"]; $invoice_page = $path_to_root . "/sales/customer_invoice.php?" . SID . "DeliveryNumber=" .$myrow["trans_no"]; label_cell("" . _("Edit") . ""); + label_cell(print_document_link($myrow['trans_no'], _("Print"))); label_cell($not_closed ? "" . _("Invoice") . "" : ''); @@ -236,6 +250,7 @@ if ($result) { label_cell(""); label_cell(""); + label_cell(""); } end_row();; diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index b5af5158..6ad10c1d 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -5,6 +5,7 @@ $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); include($path_to_root . "/sales/includes/sales_ui.inc"); +include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) @@ -12,17 +13,17 @@ if ($use_popup_windows) if ($use_date_picker) $js .= get_js_date_picker(); -if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true)) +if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true)) { $_POST['order_view_mode'] = 'OutstandingOnly'; $_SESSION['page_title'] = _("Search Outstanding Sales Orders"); -} -elseif (isset($_GET['InvoiceTemplates']) && ($_GET['InvoiceTemplates'] == true)) +} +elseif (isset($_GET['InvoiceTemplates']) && ($_GET['InvoiceTemplates'] == true)) { $_POST['order_view_mode'] = 'InvoiceTemplates'; $_SESSION['page_title'] = _("Search Template for Invoicing"); -} -elseif (isset($_GET['DeliveryTemplates']) && ($_GET['DeliveryTemplates'] == true)) +} +elseif (isset($_GET['DeliveryTemplates']) && ($_GET['DeliveryTemplates'] == true)) { $_POST['order_view_mode'] = 'DeliveryTemplates'; $_SESSION['page_title'] = _("Select Template for Delivery"); @@ -38,29 +39,29 @@ page($_SESSION['page_title'], false, false, "", $js); if (isset($_GET['selected_customer'])) { $selected_customer = $_GET['selected_customer']; -} +} elseif (isset($_POST['selected_customer'])) { $selected_customer = $_POST['selected_customer']; } else $selected_customer = -1; - + //----------------------------------------------------------------------------------- /* $action = $_SERVER['PHP_SELF']; if ($_POST['order_view_mode']=='OutstandingOnly') { - $action .= "?OutstandingOnly=" . $_POST['order_view_mode']$_PO; + $action .= "?OutstandingOnly=" . $_POST['order_view_mode']$_PO; } elseif ($_POST['order_view_mode']=='InvoiceTemplates') { - $action .= "?InvoiceTemplates=" . $_POST['InvoiceTemplates']; + $action .= "?InvoiceTemplates=" . $_POST['InvoiceTemplates']; } elseif ($_POST['order_view_mode']=='DeliveryTemplates') { - $action .= "?DeliveryTemplates=" . $_POST['InvoiceTemplates']; + $action .= "?DeliveryTemplates=" . $_POST['InvoiceTemplates']; } */ start_form(false, false, $_SERVER['PHP_SELF'] .SID); @@ -68,10 +69,10 @@ start_form(false, false, $_SERVER['PHP_SELF'] .SID); start_table("class='tablestyle_noborder'"); start_row(); ref_cells(_("#:"), 'OrderNumber'); -if ($_POST['order_view_mode']!='DeliveryTemplates' && $_POST['order_view_mode']!='InvoiceTemplates') +if ($_POST['order_view_mode'] != 'DeliveryTemplates' && $_POST['order_view_mode'] != 'InvoiceTemplates') { - date_cells(_("from:"), 'OrdersAfterDate', null, -30); - date_cells(_("to:"), 'OrdersToDate', null, 1); + date_cells(_("from:"), 'OrdersAfterDate', null, -30); + date_cells(_("to:"), 'OrdersToDate', null, 1); } locations_list_cells(_("Location:"), 'StockLocation', null, true); @@ -92,17 +93,18 @@ if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "" ($_POST['SelectStockFromList'] != reserved_words::get_all())) { $selected_stock_item = $_POST['SelectStockFromList']; -} -else +} +else { unset($selected_stock_item); } //--------------------------------------------------------------------------------------------- -if (isset($_POST['ChangeTmpl']) && $_POST['ChangeTmpl']!=0) { - $sql = "UPDATE ".TB_PREF."sales_orders SET type = !type WHERE order_no=".$_POST['ChangeTmpl']; +if (isset($_POST['ChangeTmpl']) && $_POST['ChangeTmpl'] != 0) +{ + $sql = "UPDATE ".TB_PREF."sales_orders SET type = !type WHERE order_no=".$_POST['ChangeTmpl']; - db_query($sql, "Can't change sales order type"); + db_query($sql, "Can't change sales order type"); } //--------------------------------------------------------------------------------------------- @@ -117,7 +119,7 @@ $sql .= " Sum(".TB_PREF."sales_order_details.unit_price*".TB_PREF."sales_order_d $sql .= TB_PREF."sales_orders.comments, "; //else $sql .= TB_PREF."sales_orders.customer_ref"; - + $sql .= " FROM ".TB_PREF."sales_orders, ".TB_PREF."sales_order_details, ".TB_PREF."debtors_master, ".TB_PREF."cust_branch WHERE ".TB_PREF."sales_orders.order_no = ".TB_PREF."sales_order_details.order_no AND ".TB_PREF."sales_orders.debtor_no = ".TB_PREF."debtors_master.debtor_no @@ -125,20 +127,20 @@ $sql .= " FROM ".TB_PREF."sales_orders, ".TB_PREF."sales_order_details, ".TB_PRE AND ".TB_PREF."debtors_master.debtor_no = ".TB_PREF."cust_branch.debtor_no "; //figure out the sql required from the inputs available -if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "") +if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "") { $sql .= " AND ".TB_PREF."sales_orders.order_no LIKE '%". $_POST['OrderNumber'] ."' GROUP BY ".TB_PREF."sales_orders.order_no"; -} -else +} +else { - if ($_POST['order_view_mode']!='DeliveryTemplates' && $_POST['order_view_mode']!='InvoiceTemplates') - { - $date_after = date2sql($_POST['OrdersAfterDate']); - $date_before = date2sql($_POST['OrdersToDate']); - - $sql .= " AND ".TB_PREF."sales_orders.ord_date >= '$date_after'"; - $sql .= " AND ".TB_PREF."sales_orders.ord_date <= '$date_before'"; - } + if ($_POST['order_view_mode']!='DeliveryTemplates' && $_POST['order_view_mode']!='InvoiceTemplates') + { + $date_after = date2sql($_POST['OrdersAfterDate']); + $date_before = date2sql($_POST['OrdersToDate']); + + $sql .= " AND ".TB_PREF."sales_orders.ord_date >= '$date_after'"; + $sql .= " AND ".TB_PREF."sales_orders.ord_date <= '$date_before'"; + } if ($selected_customer != -1) $sql .= " AND ".TB_PREF."sales_orders.debtor_no='" . $selected_customer . "'"; @@ -162,14 +164,15 @@ $result = db_query($sql,"No orders were returned"); //----------------------------------------------------------------------------------- -if ($result) +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(_("Order #"), _("Customer"), _("Branch"), _("Cust Order #"), _("Order Date"), - _("Required By"), _("Delivery To"), _("Order Total"), _("Currency"), _("Tmpl"),""); + _("Required By"), _("Delivery To"), _("Order Total"), _("Currency"), _("Tmpl"),"", ""); if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') { @@ -177,12 +180,12 @@ if ($result) } table_header($th); -start_form(); + start_form(); $j = 1; $k = 0; //row colour counter $overdue_items = false; - while ($myrow = db_fetch($result)) + while ($myrow = db_fetch($result)) { $view_page = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_no"]); @@ -195,8 +198,8 @@ start_form(); { start_row("class='overduebg'"); $overdue_items = true; - } - else + } + else { alt_table_row_color($k); } @@ -204,16 +207,16 @@ start_form(); label_cell($view_page); label_cell($myrow["name"]); label_cell($myrow["br_name"]); - if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') - label_cell($myrow["comments"]); - else - label_cell($myrow["customer_ref"]); + if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates') + label_cell($myrow["comments"]); + else + label_cell($myrow["customer_ref"]); label_cell($formated_order_date); label_cell($formated_del_date); label_cell($myrow["deliver_to"]); amount_cell($myrow["OrderValue"]); label_cell($myrow["curr_code"]); - if ($_POST['order_view_mode']=='OutstandingOnly'/* || $not_closed*/) + if ($_POST['order_view_mode']=='OutstandingOnly'/* || $not_closed*/) { $delivery_note = $path_to_root . "/sales/customer_delivery.php?" . SID . "OrderNumber=" .$myrow["order_no"]; label_cell("" . _("Dispatch") . ""); @@ -230,12 +233,13 @@ start_form(); } else { - echo ""; + echo ""; - $modify_page = $path_to_root . "/sales/sales_order_entry.php?" . SID . "ModifyOrderNumber=" . $myrow["order_no"]; - label_cell("" . _("Edit") . ""); + $modify_page = $path_to_root . "/sales/sales_order_entry.php?" . SID . "ModifyOrderNumber=" . $myrow["order_no"]; + label_cell("" . _("Edit") . ""); + label_cell(print_document_link($myrow['order_no'], _("Print"))); } end_row();; @@ -248,8 +252,8 @@ start_form(); //end of page full new headings if } //end of while loop - hidden('ChangeTmpl', 0); -end_form(); + hidden('ChangeTmpl', 0); + end_form(); end_table(); if ($overdue_items)