X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fcustomer_invoice.php;h=ee15814a7e33eafc26d11ca39d6d7cf2be7bfb49;hb=f36a75347f4940099744e978acb5f043785a4fea;hp=560ea687c582334bba89c7bde5a0acb015346d4c;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index 560ea687..ee15814a 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -110,6 +110,7 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) } else { $src = array($_GET['DeliveryNumber']); } + /*read in all the selected deliveries into the Items cart */ $dn = new Cart(ST_CUSTDELIVERY, $src, true); @@ -119,12 +120,6 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) die ("
" . _("There are no delivered items with a quantity left to invoice. There is nothing left to invoice.") . ""); } - $dn->trans_type = ST_SALESINVOICE; - $dn->src_docs = $dn->trans_no; - $dn->trans_no = 0; - $dn->reference = $Refs->get_next(ST_SALESINVOICE); - $dn->due_date = get_invoice_duedate($dn->payment, $dn->document_date); - $_SESSION['Items'] = $dn; copy_from_cart(); @@ -152,7 +147,7 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) end_page(); exit; -} elseif (!check_quantities()) { +} elseif (!isset($_POST['process_invoice']) && !check_quantities()) { display_error(_("Selected quantity cannot be less than quantity credited nor more than quantity not invoiced yet.")); } if (isset($_POST['Update'])) { @@ -328,6 +323,16 @@ if (isset($_POST['process_invoice']) && check_data()) { } } +if(list_updated('payment')) { + $order = &$_SESSION['Items']; + $order->payment = get_post('payment'); + $order->payment_terms = get_payment_terms($order->payment); + $order->due_date = get_invoice_duedate($order->payment, $order->document_date); + if ($order->payment_terms['cash_sale']) { + $_POST['Location'] = $order->Location = $order->pos['pos_location']; + $order->location_name = $order->pos['location_name']; + } +} // find delivery spans for batch invoice display $dspans = array(); $lastdn = ''; $spanlen=1; @@ -367,7 +372,6 @@ if ($dim > 0) label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(_("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); if ($_SESSION['Items']->pos['credit_sale'] || $_SESSION['Items']->pos['cash_sale']) { - // editable payment type $paymcat = !$_SESSION['Items']->pos['cash_sale'] ? PM_CREDIT : (!$_SESSION['Items']->pos['credit_sale'] ? PM_CASH : PM_ANY); label_cells(_("Payment terms:"), sale_payment_list('payment', $paymcat),