Update of /cvsroot/frontaccounting/frontaccount/sales/inquiry
In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv30757/sales/inquiry
Modified Files:
Tag: unstable
customer_inquiry.php sales_deliveries_view.php
sales_orders_view.php
Log Message:
Added print document options in inquiries.
Index: sales_orders_view.php
===================================================================
RCS file: /cvsroot/frontaccounting/frontaccount/sales/inquiry/sales_orders_view.php,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -d -r1.2.2.2 -r1.2.2.3
*** sales_orders_view.php 7 Mar 2008 21:07:12 -0000 1.2.2.2
--- sales_orders_view.php 28 Mar 2008 15:23:54 -0000 1.2.2.3
***************
*** 6,9 ****
--- 6,10 ----
include($path_to_root . "/sales/includes/sales_ui.inc");
+ include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
***************
*** 13,27 ****
$js .= get_js_date_picker();
! 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))
{
$_POST['order_view_mode'] = 'InvoiceTemplates';
$_SESSION['page_title'] = _("Search Template for Invoicing");
! }
! elseif (isset($_GET['DeliveryTemplates']) && ($_GET['DeliveryTemplates'] == true))
{
$_POST['order_view_mode'] = 'DeliveryTemplates';
--- 14,28 ----
$js .= get_js_date_picker();
! 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))
{
$_POST['order_view_mode'] = 'InvoiceTemplates';
$_SESSION['page_title'] = _("Search Template for Invoicing");
! }
! elseif (isset($_GET['DeliveryTemplates']) && ($_GET['DeliveryTemplates'] == true))
{
$_POST['order_view_mode'] = 'DeliveryTemplates';
***************
*** 39,43 ****
{
$selected_customer = $_GET['selected_customer'];
! }
elseif (isset($_POST['selected_customer']))
{
--- 40,44 ----
{
$selected_customer = $_GET['selected_customer'];
! }
elseif (isset($_POST['selected_customer']))
{
***************
*** 46,50 ****
else
$selected_customer = -1;
!
//-----------------------------------------------------------------------------------
/*
--- 47,51 ----
else
$selected_customer = -1;
!
//-----------------------------------------------------------------------------------
/*
***************
*** 53,65 ****
if ($_POST['order_view_mode']=='OutstandingOnly')
{
! $action .= "?OutstandingOnly=" . $_POST['order_view_mode']$_PO;
}
elseif ($_POST['order_view_mode']=='InvoiceTemplates')
{
! $action .= "?InvoiceTemplates=" . $_POST['InvoiceTemplates'];
}
elseif ($_POST['order_view_mode']=='DeliveryTemplates')
{
! $action .= "?DeliveryTemplates=" . $_POST['InvoiceTemplates'];
}
*/
--- 54,66 ----
if ($_POST['order_view_mode']=='OutstandingOnly')
{
! $action .= "?OutstandingOnly=" . $_POST['order_view_mode']$_PO;
}
elseif ($_POST['order_view_mode']=='InvoiceTemplates')
{
! $action .= "?InvoiceTemplates=" . $_POST['InvoiceTemplates'];
}
elseif ($_POST['order_view_mode']=='DeliveryTemplates')
{
! $action .= "?DeliveryTemplates=" . $_POST['InvoiceTemplates'];
}
*/
***************
*** 69,76 ****
start_row();
ref_cells(_("#:"), 'OrderNumber');
! if ($_POST['order_view_mode']!='DeliveryTemplates' && $_POST['order_view_mode']!='InvoiceTemplates')
{
! date_cells(_("from:"), 'OrdersAfterDate', null, -30);
! date_cells(_("to:"), 'OrdersToDate', null, 1);
}
locations_list_cells(_("Location:"), 'StockLocation', null, true);
--- 70,77 ----
start_row();
ref_cells(_("#:"), 'OrderNumber');
! if ($_POST['order_view_mode'] != 'DeliveryTemplates' && $_POST['order_view_mode'] != 'InvoiceTemplates')
{
! date_cells(_("from:"), 'OrdersAfterDate', null, -30);
! date_cells(_("to:"), 'OrdersToDate', null, 1);
}
locations_list_cells(_("Location:"), 'StockLocation', null, true);
***************
*** 93,98 ****
{
$selected_stock_item = $_POST['SelectStockFromList'];
! }
! else
{
unset($selected_stock_item);
--- 94,99 ----
{
$selected_stock_item = $_POST['SelectStockFromList'];
! }
! else
{
unset($selected_stock_item);
***************
*** 100,107 ****
//---------------------------------------------------------------------------------------------
! 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");
}
//---------------------------------------------------------------------------------------------
--- 101,109 ----
//---------------------------------------------------------------------------------------------
! 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");
}
//---------------------------------------------------------------------------------------------
***************
*** 118,122 ****
//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
--- 120,124 ----
//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
***************
*** 126,143 ****
//figure out the sql required from the inputs available
! 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
{
! 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 . "'";
--- 128,145 ----
//figure out the sql required from the inputs available
! 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
{
! 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 . "'";
***************
*** 163,168 ****
//-----------------------------------------------------------------------------------
! if ($result)
{
/*show a table of the orders returned by the sql */
--- 165,171 ----
//-----------------------------------------------------------------------------------
! if ($result)
{
+ print_hidden_script(30);
/*show a table of the orders returned by the sql */
***************
*** 170,174 ****
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"),"");
if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates')
--- 173,177 ----
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"),"", "");
if($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates')
***************
*** 178,187 ****
table_header($th);
! start_form();
$j = 1;
$k = 0; //row colour counter
$overdue_items = false;
! while ($myrow = db_fetch($result))
{
--- 181,190 ----
table_header($th);
! start_form();
$j = 1;
$k = 0; //row colour counter
$overdue_items = false;
! while ($myrow = db_fetch($result))
{
***************
*** 196,201 ****
start_row("class='overduebg'");
$overdue_items = true;
! }
! else
{
alt_table_row_color($k);
--- 199,204 ----
start_row("class='overduebg'");
$overdue_items = true;
! }
! else
{
alt_table_row_color($k);
***************
*** 205,212 ****
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"]);
label_cell($formated_order_date);
label_cell($formated_del_date);
--- 208,215 ----
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"]);
label_cell($formated_order_date);
label_cell($formated_del_date);
***************
*** 214,218 ****
amount_cell($myrow["OrderValue"]);
label_cell($myrow["curr_code"]);
! if ($_POST['order_view_mode']=='OutstandingOnly'/* || $not_closed*/)
{
$delivery_note = $path_to_root . "/sales/customer_delivery.php?" . SID . "OrderNumber=" .$myrow["order_no"];
--- 217,221 ----
amount_cell($myrow["OrderValue"]);
label_cell($myrow["curr_code"]);
! if ($_POST['order_view_mode']=='OutstandingOnly'/* || $not_closed*/)
{
$delivery_note = $path_to_root . "/sales/customer_delivery.php?" . SID . "OrderNumber=" .$myrow["order_no"];
***************
*** 231,240 ****
else
{
! echo "<td><input ".($myrow["type"]==1 ? 'checked' : '')." type='checkbox' name='chgtpl" .$myrow["order_no"]. "' value='1'
! onclick='forms[1].ChangeTmpl.value= this.name.substr(6);
! this.form.submit();' ></td>";
! $modify_page = $path_to_root . "/sales/sales_order_entry.php?" . SID . "ModifyOrderNumber=" . $myrow["order_no"];
! label_cell("<a href='$modify_page'>" . _("Edit") . "</a>");
}
end_row();;
--- 234,244 ----
else
{
! echo "<td><input ".($myrow["type"]==1 ? 'checked' : '')." type='checkbox' name='chgtpl" .$myrow["order_no"]. "' value='1'
! onclick='forms[1].ChangeTmpl.value= this.name.substr(6);
! this.form.submit();' ></td>";
! $modify_page = $path_to_root . "/sales/sales_order_entry.php?" . SID . "ModifyOrderNumber=" . $myrow["order_no"];
! label_cell("<a href='$modify_page'>" . _("Edit") . "</a>");
! label_cell(print_document_link($myrow['order_no'], _("Print")));
}
end_row();;
***************
*** 249,254 ****
}
//end of while loop
! hidden('ChangeTmpl', 0);
! end_form();
end_table();
--- 253,258 ----
}
//end of while loop
! hidden('ChangeTmpl', 0);
! end_form();
end_table();
Index: customer_inquiry.php
===================================================================
RCS file: /cvsroot/frontaccounting/frontaccount/sales/inquiry/customer_inquiry.php,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -C2 -d -r1.2.2.3 -r1.2.2.4
*** customer_inquiry.php 7 Mar 2008 21:07:12 -0000 1.2.2.3
--- customer_inquiry.php 28 Mar 2008 15:23:53 -0000 1.2.2.4
***************
*** 65,73 ****
$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);
start_row();
--- 65,73 ----
$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);
start_row();
***************
*** 108,133 ****
if ($_POST['filterType'] != reserved_words::get_all())
{
! if ($_POST['filterType'] == '1')
{
$sql .= " AND (".TB_PREF."debtor_trans.type = 10 OR ".TB_PREF."debtor_trans.type = 1) ";
! }
! elseif ($_POST['filterType'] == '2')
{
$sql .= " AND (".TB_PREF."debtor_trans.type = 10) ";
! }
! 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')
{
$sql .= " AND ".TB_PREF."debtor_trans.type = 11 ";
}
! elseif ($_POST['filterType'] == '5')
{
$sql .= " AND ".TB_PREF."debtor_trans.type = 13 ";
}
! if ($_POST['filterType'] == '2')
{
$today = date2sql(Today());
--- 108,133 ----
if ($_POST['filterType'] != reserved_words::get_all())
{
! if ($_POST['filterType'] == '1')
{
$sql .= " AND (".TB_PREF."debtor_trans.type = 10 OR ".TB_PREF."debtor_trans.type = 1) ";
! }
! elseif ($_POST['filterType'] == '2')
{
$sql .= " AND (".TB_PREF."debtor_trans.type = 10) ";
! }
! 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')
{
$sql .= " AND ".TB_PREF."debtor_trans.type = 11 ";
}
! elseif ($_POST['filterType'] == '5')
{
$sql .= " AND ".TB_PREF."debtor_trans.type = 13 ";
}
! if ($_POST['filterType'] == '2')
{
$today = date2sql(Today());
***************
*** 139,143 ****
}
! $sql .= " ORDER BY ".TB_PREF."debtor_trans.tran_date DESC,
".TB_PREF."debtor_trans.type,".TB_PREF."debtor_trans.trans_no ";
--- 139,143 ----
}
! $sql .= " ORDER BY ".TB_PREF."debtor_trans.tran_date DESC,
".TB_PREF."debtor_trans.type,".TB_PREF."debtor_trans.trans_no ";
***************
*** 167,175 ****
//------------------------------------------------------------------------------------------------
start_table("$table_style width='80%'");
$th = array(_("Type"), _("#"), _("Order"), _("Reference"), _("Date"), _("Due Date"),
! _("Customer"), _("Branch"), _("Currency"), _("Debit"), _("Credit"), "", "",""
! /*,"" print */);
if ($_POST['customer_id'] != reserved_words::get_all()) {
--- 167,175 ----
//------------------------------------------------------------------------------------------------
+ print_hidden_script(10);
start_table("$table_style width='80%'");
$th = array(_("Type"), _("#"), _("Order"), _("Reference"), _("Date"), _("Due Date"),
! _("Customer"), _("Branch"), _("Currency"), _("Debit"), _("Credit"), "", "","","");
if ($_POST['customer_id'] != reserved_words::get_all()) {
***************
*** 183,187 ****
$k = 0; //row colour counter
$over_due = false;
! while ($myrow = db_fetch($result))
{
--- 183,187 ----
$k = 0; //row colour counter
$over_due = false;
! while ($myrow = db_fetch($result))
{
***************
*** 190,194 ****
start_row("class='overduebg'");
$over_due = true;
! }
else
alt_table_row_color($k);
--- 190,194 ----
start_row("class='overduebg'");
$over_due = true;
! }
else
alt_table_row_color($k);
***************
*** 206,210 ****
$credit_me_str = "<a href='$path_to_root/sales/customer_credit_invoice.php?InvoiceNumber=" . $myrow["trans_no"] . "'>" . _("Credit This") . "</a>";
$edit_page= $path_to_root.'/sales/customer_invoice.php?ModifyInvoice='
! . $myrow['trans_no'];
break;
--- 206,210 ----
$credit_me_str = "<a href='$path_to_root/sales/customer_credit_invoice.php?InvoiceNumber=" . $myrow["trans_no"] . "'>" . _("Credit This") . "</a>";
$edit_page= $path_to_root.'/sales/customer_invoice.php?ModifyInvoice='
! . $myrow['trans_no'];
break;
***************
*** 212,221 ****
if ($myrow['order_']==0) // free-hand credit note
$edit_page= $path_to_root.'/sales/credit_note_entry.php?ModifyCredit='
! . $myrow['trans_no'];
else // credit invoice
$edit_page= $path_to_root.'/sales/customer_credit_invoice.php?ModifyCredit='
! . $myrow['trans_no'];
break;
!
case 13:
$edit_page= $path_to_root.'/sales/customer_delivery.php?ModifyDelivery='
--- 212,221 ----
if ($myrow['order_']==0) // free-hand credit note
$edit_page= $path_to_root.'/sales/credit_note_entry.php?ModifyCredit='
! . $myrow['trans_no'];
else // credit invoice
$edit_page= $path_to_root.'/sales/customer_credit_invoice.php?ModifyCredit='
! . $myrow['trans_no'];
break;
!
case 13:
$edit_page= $path_to_root.'/sales/customer_delivery.php?ModifyDelivery='
***************
*** 232,240 ****
$gl_trans_str = get_gl_view_str_cell($myrow["type"], $myrow["trans_no"]);
- // $print_str = "<a href='$path_to_root/reporting/print_invoice.php?InvoiceNumber=" . $myrow["trans_no"] . "'>" . _("Print") . "</a>";
-
-
$branch_name = "";
! if ($myrow["branch_code"] > 0)
{
$branch_name = get_branch_name($myrow["branch_code"]);
--- 232,237 ----
$gl_trans_str = get_gl_view_str_cell($myrow["type"], $myrow["trans_no"]);
$branch_name = "";
! if ($myrow["branch_code"] > 0)
{
$branch_name = get_branch_name($myrow["branch_code"]);
***************
*** 256,277 ****
label_cell($myrow["CustCurrCode"]);
display_debit_or_credit_cells(
! $myrow['type']==11 || $myrow['type']==12 ?
-$myrow["TotalAmount"] : $myrow["TotalAmount"]);
echo $gl_trans_str;
! label_cell($edit_page=='' ? '' : "<a href='$edit_page'>" . _('Edit') . '</a>');
! // label_cell(print_document_link($myrow['trans_no'], _("Print")));
!
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();
--- 253,271 ----
label_cell($myrow["CustCurrCode"]);
display_debit_or_credit_cells(
! $myrow['type']==11 || $myrow['type']==12 || $myrow['type']==2 ?
-$myrow["TotalAmount"] : $myrow["TotalAmount"]);
echo $gl_trans_str;
! label_cell($edit_page=='' ? '' : "<a href='$edit_page'>" . _('Edit') . '</a>');
! 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('');
end_row();
***************
*** 288,292 ****
if ($over_due)
display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'");
!
end_page();
--- 282,286 ----
if ($over_due)
display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'");
!
end_page();
Index: sales_deliveries_view.php
===================================================================
RCS file: /cvsroot/frontaccounting/frontaccount/sales/inquiry/Attic/sales_deliveries_view.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** sales_deliveries_view.php 7 Mar 2008 21:07:12 -0000 1.1.2.3
--- sales_deliveries_view.php 28 Mar 2008 15:23:54 -0000 1.1.2.4
***************
*** 6,9 ****
--- 6,10 ----
include($path_to_root . "/sales/includes/sales_ui.inc");
+ include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
***************
*** 13,22 ****
$js .= get_js_date_picker();
! if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true))
{
$_POST['OutstandingOnly'] = true;
page(_("Search Not Invoiced Deliveries"), false, false, "", $js);
! }
! else
{
$_POST['OutstandingOnly'] = false;
--- 14,23 ----
$js .= get_js_date_picker();
! if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true))
{
$_POST['OutstandingOnly'] = true;
page(_("Search Not Invoiced Deliveries"), false, false, "", $js);
! }
! else
{
$_POST['OutstandingOnly'] = false;
***************
*** 27,31 ****
{
$selected_customer = $_GET['selected_customer'];
! }
elseif (isset($_POST['selected_customer']))
{
--- 28,32 ----
{
$selected_customer = $_GET['selected_customer'];
! }
elseif (isset($_POST['selected_customer']))
{
***************
*** 34,68 ****
else
$selected_customer = -1;
-
- 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++;
! }
}
! 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');
}
}
//-----------------------------------------------------------------------------------
start_form(false, false, $_SERVER['PHP_SELF'] ."?OutstandingOnly=" . $_POST['OutstandingOnly'] .SID);
--- 35,81 ----
else
$selected_customer = -1;
! 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++;
! }
}
! 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');
}
}
//-----------------------------------------------------------------------------------
+ print_hidden_script(13);
start_form(false, false, $_SERVER['PHP_SELF'] ."?OutstandingOnly=" . $_POST['OutstandingOnly'] .SID);
***************
*** 92,97 ****
{
$selected_stock_item = $_POST['SelectStockFromList'];
! }
! else
{
unset($selected_stock_item);
--- 105,110 ----
{
$selected_stock_item = $_POST['SelectStockFromList'];
! }
! else
{
unset($selected_stock_item);
***************
*** 128,142 ****
.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.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'] != "")
{
$sql .= " AND ".TB_PREF."debtor_trans.trans_no LIKE '%". $_POST['DeliveryNumber'] ."' GROUP BY ".TB_PREF."debtor_trans.trans_no";
! }
! else
{
--- 141,155 ----
.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.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'] != "")
{
$sql .= " AND ".TB_PREF."debtor_trans.trans_no LIKE '%". $_POST['DeliveryNumber'] ."' GROUP BY ".TB_PREF."debtor_trans.trans_no";
! }
! else
{
***************
*** 159,163 ****
$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, "
--- 172,176 ----
$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, "
***************
*** 171,188 ****
//-----------------------------------------------------------------------------------
! if (isset($_SESSION['Batch'])) {
! foreach($_SESSION['Batch'] as $trans=>$del) unset($_SESSION['Batch'][$trans]);
unset($_SESSION['Batch']);
}
! 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),
! "", "");
table_header($th);
--- 184,201 ----
//-----------------------------------------------------------------------------------
! if (isset($_SESSION['Batch']))
! {
! foreach($_SESSION['Batch'] as $trans=>$del)
! unset($_SESSION['Batch'][$trans]);
unset($_SESSION['Batch']);
}
! 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),
! "", "", "");
table_header($th);
***************
*** 190,198 ****
$k = 0; //row colour counter
$overdue_items = false;
! 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"]);
--- 203,211 ----
$k = 0; //row colour counter
$overdue_items = false;
! 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"]);
***************
*** 206,211 ****
start_row("class='overduebg'");
$overdue_items = true;
! }
! else
{
alt_table_row_color($k);
--- 219,224 ----
start_row("class='overduebg'");
$overdue_items = true;
! }
! else
{
alt_table_row_color($k);
***************
*** 224,232 ****
else
label_cell("");
! 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("<a href='$modify_page'>" . _("Edit") . "</a>");
label_cell($not_closed ? "<a href='$invoice_page'>" . _("Invoice") . "</a>" : '');
--- 237,246 ----
else
label_cell("");
! 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("<a href='$modify_page'>" . _("Edit") . "</a>");
+ label_cell(print_document_link($myrow['trans_no'], _("Print")));
label_cell($not_closed ? "<a href='$invoice_page'>" . _("Invoice") . "</a>" : '');
***************
*** 237,240 ****
--- 251,255 ----
label_cell("");
label_cell("");
+ label_cell("");
}
end_row();;
|