$result = $db->Execute("select next_shipment_num from " . TABLE_CURRENT_STATUS); $sql_data_array['shipment_id'] = $result->fields['next_shipment_num']; db_perform(TABLE_SHIPPING_LOG, $sql_data_array, 'insert'); $db->Execute("update " . TABLE_CURRENT_STATUS . " set next_shipment_num = next_shipment_num + 1"); gen_add_audit_log(SHIPPING_SHIPMENT_DETAILS . ' - ' . TEXT_INSERT, $sID); } else { // update db_perform(TABLE_SHIPPING_LOG, $sql_data_array, 'update', "id = " . $sID); gen_add_audit_log(SHIPPING_SHIPMENT_DETAILS . ' - ' . TEXT_UPDATE, $sID); } $close_popup = true; break; default: } /***************** prepare to display templates *************************/ $js_methods = build_js_methods($methods); if ($sID) { $sql = "select id, shipment_id, carrier, ref_id, method, ship_date, deliver_date, tracking_id, cost \n\tfrom " . TABLE_SHIPPING_LOG . " where id = " . (int) $sID; $result = $db->Execute($sql); $cInfo = new objectInfo($result->fields); // need to build the methods pull down $carrier_methods = array(); foreach ($shipping_defaults['service_levels'] as $key => $value) { if (defined($cInfo->carrier . '_' . $key)) { $carrier_methods[] = array('id' => $key, 'text' => constant($cInfo->carrier . '_' . $key)); } } } else { $cInfo = new objectInfo(array('shipment_id' => $sID, 'carrier' => $carrier, 'method' => $method, 'ship_date' => $ship_date)); } $cal_ship = array('name' => 'ship_cal', 'form' => 'popup_tracking', 'fieldname' => 'ship_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($cInfo->ship_date), 'params' => array('align' => 'left'));
$js_tax_rates .= 'tax_rates[' . $i . '] = new salesTaxes("' . $tax_rates[$i]['id'] . '", "' . $tax_rates[$i]['text'] . '", "' . $tax_rates[$i]['rate'] . '");' . chr(10); } // load projects $proj_list = ord_get_projects(); // generate a project list array parallel to the drop down for the javascript add line item function $js_proj_list = 'var proj_list = new Array(' . count($proj_list) . ');' . chr(10); for ($i = 0; $i < count($proj_list); $i++) { $js_proj_list .= 'proj_list[' . $i . '] = new dropDownData("' . $proj_list[$i]['id'] . '", "' . $proj_list[$i]['text'] . '");' . chr(10); } // see if current user points to a employee for sales rep default $result = $db->Execute("select account_id from " . TABLE_USERS . " where admin_id = " . $_SESSION['admin_id']); $default_sales_rep = $result->fields['account_id'] ? $result->fields['account_id'] : '0'; // Load shipping methods if (defined('MODULE_SHIPPING_STATUS')) { $methods = load_all_methods('shipping', true, true); $shipping_methods = build_js_methods($methods); } else { $shipping_methods = 'var freightLevels = new Array(); ' . chr(10); $shipping_methods .= 'var freightCarriers = new Array(); ' . chr(10); $shipping_methods .= 'var freightDetails = new Array(); ' . chr(10); } // load calendar parameters $now = new DateTime(); if (JOURNAL_ID == 6) { $now->modify('-1 day'); } $cal_order = array('name' => 'dateOrdered', 'form' => 'orders', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => isset($order->post_date) ? gen_locale_date($order->post_date) : $now->format(DATE_FORMAT), 'params' => array('align' => 'left')); $cal_terminal = array('name' => 'dateRequired', 'form' => 'orders', 'fieldname' => 'terminal_date', 'imagename' => 'btn_date_2', 'default' => isset($order->terminal_date) ? gen_locale_date($order->terminal_date) : $req_date, 'params' => array('align' => 'left')); // build the display options based on JOURNAL_ID $template_options = array(); switch (JOURNAL_ID) {