0) { display_error(_("The production date cannot be before the release date of the work order.")); set_focus('date_'); return false; } // if unassembling we need to check the qoh if (($_POST['ProductionType'] == 0) && !sys_prefs::allow_negative_stock()) { $wo_details = get_work_order($_POST['selected_id']); $qoh = get_qoh_on_date($wo_details["stock_id"], $wo_details["loc_code"], $date_); if (-$_POST['quantity'] + $qoh < 0) { display_error(_("The unassembling cannot be processed because there is insufficient stock.")); set_focus('quantity'); return false; } } return true; } //-------------------------------------------------------------------------------------------------- if (isset($_POST['Process']) || (isset($_POST['ProcessAndClose']) && can_process() == true)) { $close_wo = 0; if (isset($_POST['ProcessAndClose']) && ($_POST['ProcessAndClose']!="")) $close_wo = 1; // if unassembling, negate quantity if ($_POST['ProductionType'] == 0) $_POST['quantity'] = -$_POST['quantity']; $id = work_order_produce($_POST['selected_id'], $_POST['ref'], $_POST['quantity'], $_POST['date_'], $_POST['memo_'], $close_wo); meta_forward($_SERVER['PHP_SELF'], "AddedID=$id"); } //------------------------------------------------------------------------------------- display_wo_details($_POST['selected_id']); //------------------------------------------------------------------------------------- start_form(); hidden('selected_id', $_POST['selected_id']); //hidden('WOReqQuantity', $_POST['WOReqQuantity']); if (!isset($_POST['quantity']) || $_POST['quantity'] == '') { $_POST['quantity'] = max($wo_details["units_reqd"] - $wo_details["units_issued"], 0); } start_table(); ref_row(_("Reference:"), 'ref', '', references::get_next(29)); if (!isset($_POST['ProductionType'])) $_POST['ProductionType'] = 1; yesno_list_row(_("Type:"), 'ProductionType', $_POST['ProductionType'], _("Produce Finished Items"), _("Return Items to Work Order")); small_qty_row(_("Quantity:"), 'quantity', null, null, null, get_qty_dec($wo_details["stock_id"])); date_row(_("Date:"), 'date_'); textarea_row(_("Memo:"), 'memo_', null, 40, 3); end_table(1); submit_center_first('Process', _("Process"), '', true); submit_center_last('ProcessAndClose', _("Process And Close Order"), '', true); end_form(); end_page(); ?>