From: Maxime Bourget Date: Fri, 3 May 2013 20:59:26 +0000 (+0100) Subject: Add Clear/Reset quantity button to sales order delivery (handy when doing partial... X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=fe8591bd876e859f1943192035d1cde4b5d8f9bc;p=textcart.git Add Clear/Reset quantity button to sales order delivery (handy when doing partial delivery of a big order). --- diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index eb78f62..90905a2 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -323,7 +323,7 @@ if (isset($_POST['process_delivery']) && check_data() && check_qoh()) { } } -if (isset($_POST['Update']) || isset($_POST['_Location_update'])) { +if (isset($_POST['Update']) || isset($_POST['_Location_update']) || isset($_POST['qty'])) { $Ajax->activate('Items'); } //------------------------------------------------------------------------------ @@ -440,6 +440,10 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) { if ($ln_itm->quantity==$ln_itm->qty_done) { continue; //this line is fully delivered } + if(isset($_POST['_Location_update']) || isset($_POST['clear_quantity']) || isset($_POST['reset_quantity'])) { + // reset quantity + $ln_itm->qty_dispatched = $ln_itm->quantity-$ln_itm->qty_done; + } // if it's a non-stock item (eg. service) don't show qoh $show_qoh = true; if ($SysPrefs->allow_negative_stock() || !has_stock_holding($ln_itm->mb_flag) || @@ -470,6 +474,10 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) { label_cell($ln_itm->units); qty_cell($ln_itm->qty_done, false, $dec); + if(isset($_POST['clear_quantity'])) { + $ln_itm->qty_dispatched = 0; + } + $_POST['Line'.$line]=$ln_itm->qty_dispatched; /// clear post so value displayed in the fiel is the 'new' quantity small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id, $dec), null, null, $dec); $display_discount_percent = percent_format($ln_itm->discount_percent*100) . "%"; @@ -521,9 +529,15 @@ textarea_row(_("Memo"), 'Comments', null, 50, 4); end_table(1); div_end(); submit_center_first('Update', _("Update"), - _('Refresh document page'), true); + _('Refresh document page'), true); +if(isset($_POST['clear_quantity'])) { + submit('reset_quantity', _('Reset quantity'), true, _('Refresh document page')); +} +else { + submit('clear_quantity', _('Clear quantity'), true, _('Refresh document page')); +} submit_center_last('process_delivery', _("Process Dispatch"), - _('Check entered data and save document'), 'default'); + _('Check entered data and save document'), 'default'); end_form();