commit_transaction();
}
+
+
function compute_input_name($row, $field) {
$row_id = $row['id'];
return "detail[$row_id][$field]";
{
$id = $row['debtor_no']."_".$row['branch_code'];
$name = "chgpck" .$id;
- $value = $row['type'] ? 1:0;
- //$value = onpick($row['debtor_no'], $row['branch_code']);
+ $value = $row['quantity_to_pick'] > 0 ? 1:0;
// save also in hidden field for testing during 'Update'
-
return checkbox(null, $name, $value, true,
- _('Set this order for picking'))
- . hidden('last['.$id.']', $value, false);
+ _('Pick all possible item for this branch.'))
+ . hidden('pick['.$id.']', $value, false);
}
function get_order_details_extra($customer_id, $location, $item_like) {
--- /dev/null
+<?php
+
+function process_picking_flag() {
+ $id = find_submit('_chgpck', false);
+ if ($id != -1 && isset($_POST['pick'])) {
+ $id = str_replace("_update", "", $id);
+ change_pck_flag($id, isset($_POST['pick'][$id]));
+ }
+}
+
+function change_pck_flag($id, $value=null)
+{
+display_warning("value $value");
+ if($value === null) $value = true;
+display_warning("value $value");
+ global $Ajax;
+
+ $picker = new Picker();
+
+ // insert or remove pick order form pick table initial_quantity
+ if(!$value) {
+ $picker->insertAllForBranch($id);
+ }
+ else {
+ $picker->deleteAllForBranch($id);
+ }
+ $Ajax->activate('order_line_view');
+}
+
+
+class Picker {
+ function insertAllForBranch($id) {
+ list($debtor_no, $branch_code) = $this->branchForId($id);
+ display_warning("inserting for $id");
+
+ }
+
+ function deleteAllForBranch($id) {
+ display_warning("inserting for $id");
+ list($debtor_no, $branch_code) = $this->branchForId($id);
+ }
+
+ function branchForId($id) {
+ return explode('_', $id);
+ }
+
+
+
+}
+
+
include_once("includes/order_lines.inc");
include_once("includes/splitter.inc");
include_once("includes/bulk_updater.inc");
+include_once("includes/picking.inc");
$page_security = 'SA_ORDERLINEX_EDIT';
add_access_extensions();
split_order_details();
bulk_update_order_details();
+process_picking_flag();
+
$js = "";
if ($use_popup_windows)
//---------------------------------------------------------------------------------------------
+div_start('order_line_view');
start_form();
start_table(TABLESTYLE_NOBORDER);
_("comment 2 ") => 'skip',
_("Q to Pick") => array('ord' => '', 'type' => 'qty'),
_("A to Pick") => array('ord' => '', 'type' => 'amount'),
-//_("Pick").'<input type="checkbox"/ onClick="toggleAllPick()"' => array('insert'=>true, 'fun'=>'pick_checkbox'),
+_("Pick")=> array('insert'=>true, 'fun'=>'pick_checkbox'),
);
}
submit_center_first('Update', _("Update"), '', 'default', false);
submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
- end_form();
- end_page();
+end_form();
+div_end();
+end_page();
?>
<style>
span.tooltip{ display:none;}