function Output($params) { global $db, $currencies; $contents = ''; $control = ''; for ($i = 0; $i <= 7; $i++) { if ('Mon' == strftime("%a", time() - $i * 24 * 60 * 60)) { $a = $i; } } // Build content box $total = 0; $sql = "select SUM(total_amount) as day_total, currencies_code, currencies_value, post_date \n\t\t from " . TABLE_JOURNAL_MAIN . " \n\t\t where journal_id = 19 and post_date >= '" . date('Y-m-d', time() - $a * 24 * 60 * 60) . "' GROUP BY post_date ORDER BY post_date"; $result = $db->Execute($sql); if ($result->RecordCount() < 1) { $contents = ACT_NO_RESULTS; } else { $week = array(); while (!$result->EOF) { $total += $result->fields['day_total']; $contents .= '<div style="float:right">' . $currencies->format_full($result->fields['day_total'], true, $result->fields['currencies_code'], $result->fields['currencies_value']) . '</div>'; $contents .= '<div>'; $contents .= gen_locale_date($result->fields['post_date']); $contents .= '</a></div>' . chr(10); $result->MoveNext(); } } if (!$params['num_rows'] && $result->RecordCount() > 0) { $contents .= '<div style="float:right"><b>' . $currencies->format_full($total, true, $result->fields['currencies_code'], $result->fields['currencies_value']) . '</b></div>'; $contents .= '<div><b>' . TEXT_TOTAL . '</b></div>' . chr(10); } return $this->build_div('', $contents, $control); }
function Output($params) { global $db, $currencies; if (count($params) != $this->size_params) { //upgrading $params = $this->Upgrade($params); } $list_length = array(); $contents = ''; $control = ''; for ($i = 0; $i <= $this->max_length; $i++) { $list_length[] = array('id' => $i, 'text' => $i); } $list_order = array(array('id' => 'asc', 'text' => TEXT_ASC), array('id' => 'desc', 'text' => TEXT_DESC)); $list_limit = array(array('id' => '0', 'text' => TEXT_NO), array('id' => '1', 'text' => TEXT_YES)); // Build control box form data $control = '<div class="row">'; $control .= ' <div style="white-space:nowrap">'; $control .= TEXT_SHOW . TEXT_SHOW_NO_LIMIT . ' ' . html_pull_down_menu('po_status_field_0', $list_length, $params['num_rows']) . '<br />'; $control .= CP_PO_STATUS_SORT_ORDER . ' ' . html_pull_down_menu('po_status_field_1', $list_order, $params['order']) . '<br />'; $control .= CP_PO_STATUS_HIDE_FUTURE . ' ' . html_pull_down_menu('po_status_field_2', $list_limit, $params['limit']); $control .= html_submit_field('sub_po_status', TEXT_SAVE); $control .= ' </div>'; $control .= '</div>'; if (count($params) != $this->size_params) { $this->update(); } // Build content box $sql = "select id, post_date, purchase_invoice_id, bill_primary_name, total_amount, currencies_code, currencies_value \n\t\t from " . TABLE_JOURNAL_MAIN . " where journal_id = 4 and closed = '0'"; if ($params['limit'] == '1') { $sql .= " and post_date <= '" . date('Y-m-d') . "'"; } if ($params['order'] == 'desc') { $sql .= " order by post_date desc"; } if ($params['num_rows']) { $sql .= " limit " . $params['num_rows']; } $result = $db->Execute($sql); if ($result->RecordCount() < 1) { $contents = ACT_NO_RESULTS; } else { while (!$result->EOF) { $contents .= '<div style="float:right">'; $contents .= html_button_field('invoice_' . $result->fields['id'], TEXT_RECEIVE, 'onclick="window.open(\'' . html_href_link(FILENAME_DEFAULT, 'module=phreebooks&page=orders&oID=' . $result->fields['id'] . '&jID=6&action=prc_so', 'SSL') . '\',\'_blank\')"') . " "; $contents .= $currencies->format_full($result->fields['total_amount'], true, $result->fields['currencies_code'], $result->fields['currencies_value']); $contents .= '</div>'; $contents .= '<div>'; $contents .= '<a href="' . html_href_link(FILENAME_DEFAULT, 'module=phreebooks&page=orders&oID=' . $result->fields['id'] . '&jID=4&action=edit', 'SSL') . '">'; $contents .= $result->fields['purchase_invoice_id'] . ' - '; $contents .= gen_locale_date($result->fields['post_date']); $contents .= ' ' . htmlspecialchars(gen_trim_string($result->fields['bill_primary_name'], 20, true)); $contents .= '</a>'; $contents .= '</div>' . chr(10); $result->MoveNext(); } } return $this->build_div('', $contents, $control); }
function Output($params) { global $db, $currencies; if (count($params) != $this->size_params) { //upgrading $params = $this->Upgrade($params); } $list_length = array(); $contents = ''; $control = ''; for ($i = 0; $i <= $this->max_length; $i++) { $list_length[] = array('id' => $i, 'text' => $i); } // Build control box form data $control = '<div class="row">'; $control .= '<div style="white-space:nowrap">' . TEXT_SHOW . TEXT_SHOW_NO_LIMIT; $control .= html_pull_down_menu('to_receive_inv_field_0', $list_length, $params['num_rows']); $control .= html_submit_field('sub_to_receive_inv', TEXT_SAVE); $control .= '</div></div>'; // Build content box $total = 0; $sql = "select id, purchase_invoice_id, total_amount, bill_primary_name, currencies_code, currencies_value, post_date, journal_id \n\t\t from " . TABLE_JOURNAL_MAIN . " \n\t\t where journal_id in (6,7) and waiting = '1' order by post_date DESC, purchase_invoice_id DESC"; if ($params['num_rows']) { $sql .= " limit " . $params['num_rows']; } $result = $db->Execute($sql); if ($result->RecordCount() < 1) { $contents = ACT_NO_RESULTS; } else { while (!$result->EOF) { $inv_balance = $result->fields['total_amount'] - fetch_partially_paid($result->fields['id']); if ($result->fields['journal_id'] == 7) { $inv_balance = -$inv_balance; } $total += $inv_balance; $contents .= '<div style="float:right">' . $currencies->format_full($inv_balance, true, $result->fields['currencies_code'], $result->fields['currencies_value']) . '</div>'; $contents .= '<div>'; $contents .= '<a href="' . html_href_link(FILENAME_DEFAULT, "module=phreebooks&page=orders&oID={$result->fields['id']}&jID={$result->fields['journal_id']}&action=edit", 'SSL') . '">'; $contents .= gen_locale_date($result->fields['post_date']) . ' - '; if ($result->fields['purchase_invoice_id'] != '') { $contents .= $result->fields['purchase_invoice_id'] . ' - '; } $contents .= htmlspecialchars($result->fields['bill_primary_name']); $contents .= '</a></div>' . chr(10); $result->MoveNext(); } } if (!$params['num_rows'] && $result->RecordCount() > 0) { $contents .= '<div style="float:right">' . $currencies->format_full($total, true, DEFAULT_CURRENCY, 1) . '</div>'; $contents .= '<div><b>' . TEXT_TOTAL . '</b></div>' . chr(10); } return $this->build_div('', $contents, $control); }
} 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')); $cal_del = array('name' => 'cal', 'form' => 'popup_tracking', 'fieldname' => 'deliver_date', 'imagename' => 'btn_date_2', 'default' => gen_locale_date($cInfo->deliver_date), 'params' => array('align' => 'left')); $include_header = false; $include_footer = false; $include_template = 'template_main.php'; define('PAGE_TITLE', $subject_module->title);
echo TEXT_ACTION; ?> </th> </tr> </thead> <tbody class="ui-widget-content"> <?php $result = $db->Execute("select id, shipment_id, ref_id, method, deliver_date, tracking_id, cost \n\t\tfrom " . TABLE_SHIPPING_LOG . " \n\t\twhere carrier = 'storepickup' and ship_date = '" . $date . "'"); if ($result->RecordCount() > 0) { while (!$result->EOF) { echo ' <tr>' . chr(10); echo ' <td align="right">' . $result->fields['shipment_id'] . '</td>' . chr(10); echo ' <td align="right">' . $result->fields['ref_id'] . '</td>' . chr(10); echo ' <td align="center">' . constant('storepickup_' . $result->fields['method']) . '</td>' . chr(10); echo ' <td align="right">' . gen_locale_date($result->fields['deliver_date']) . '</td>' . chr(10); echo ' <td align="right">' . gen_locale_date($result->fields['actual_date']) . '</td>' . chr(10); echo ' <td align="right">' . $result->fields['tracking_id'] . '</td>' . chr(10); echo ' <td align="right">' . $currencies->format_full($result->fields['cost']) . '</td>' . chr(10); echo ' <td align="right">'; echo html_icon('phreebooks/stock_id.png', TEXT_VIEW_SHIP_LOG, 'small', 'onclick="loadPopUp(\'storepickup\', \'edit\', ' . $result->fields['id'] . ')"') . chr(10); // echo html_icon('actions/document-print.png', TEXT_PRINT, 'small', 'onclick="window.open(\'' . html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('method', 'labels', 'date')) . 'method=storepickup&date=' . $date . '&labels=' . $result->fields['tracking_id'], 'SSL') . '\',\'label_mgr\',\'width=800,height=700,resizable=1,scrollbars=1,top=50,left=50\')"') . chr(10); echo html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SHIPPING_DELETE_CONFIRM . '\')) window.open(\'index.php?module=shipping&page=popup_label_mgr&method=storepickup&sID=' . $result->fields['shipment_id'] . '&action=delete\',\'popup_label_mgr\',\'width=800,height=700,resizable=1,scrollbars=1,top=50,left=50\')"') . chr(10); echo ' </td>'; echo ' </tr>' . chr(10); $result->MoveNext(); } } else { echo ' <tr><td align="center" colspan="8">' . SHIPPING_NO_SHIPMENTS . '</td></tr>'; } ?> </tbody>
} /***************** prepare to display templates *************************/ $user_choices = gen_get_pull_down(TABLE_USERS, true, '1', 'admin_id', 'display_name'); // build disposition drop-dwn javascript $js_disp_code = 'js_disp_code = new Array(' . sizeof($action_codes) . ');' . chr(10); $js_disp_value = 'js_disp_value = new Array(' . sizeof($action_codes) . ');' . chr(10); $i = 0; foreach ($action_codes as $key => $value) { $js_disp_code .= 'js_disp_code[' . $i . '] = "' . $key . '";' . chr(10); $js_disp_value .= 'js_disp_value[' . $i . '] = "' . gen_js_encode($value) . '";' . chr(10); $i++; } $cal_create = array('name' => 'createDate', 'form' => 'rma', 'fieldname' => 'creation_date', 'imagename' => 'btn_date_1', 'default' => isset($cInfo->creation_date) ? gen_locale_date($cInfo->creation_date) : gen_locale_date($creation_date), 'params' => array('align' => 'left')); $cal_rcv = array('name' => 'receiveDate', 'form' => 'rma', 'fieldname' => 'receive_date', 'imagename' => 'btn_date_1', 'default' => isset($cInfo->receive_date) ? gen_locale_date($cInfo->receive_date) : gen_locale_date($receive_date), 'params' => array('align' => 'left')); $cal_close = array('name' => 'closedDate', 'form' => 'rma', 'fieldname' => 'closed_date', 'imagename' => 'btn_date_1', 'default' => isset($cInfo->closed_date) ? gen_locale_date($cInfo->closed_date) : gen_locale_date($closed_date), 'params' => array('align' => 'left')); $cal_invoice = array('name' => 'invoiceDate', 'form' => 'rma', 'fieldname' => 'invoice_date', 'imagename' => 'btn_date_1', 'default' => isset($cInfo->invoice_date) ? gen_locale_date($cInfo->invoice_date) : gen_locale_date($invoice_date), 'params' => array('align' => 'left')); $include_header = true; $include_footer = true; switch ($_REQUEST['action']) { case 'new': // set some defaults $cInfo->creation_date = date('Y-m-d'); if (isset($_GET['name'])) { // defaults wre passed $cInfo->caller_name = urldecode($_GET['name']); $cInfo->purchase_invoice_id = urldecode($_GET['invoice']); $cInfo->caller_telephone1 = urldecode($_GET['phone']); $cInfo->caller_email = urldecode($_GET['email']); } $cInfo->status = '1'; case 'edit':
)"><?php echo $query_result->fields['description_short']; ?> </td> <td onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?> )"><?php echo gen_locale_date($query_result->fields['acquisition_date']); ?> </td> <td onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?> )"><?php echo gen_locale_date($query_result->fields['terminal_date']); ?> </td> <td align="right"> <?php // build the action toolbar // first pull in any extra buttons, this is dynamic since each row can have different buttons if (function_exists('add_extra_action_bar_buttons')) { echo add_extra_action_bar_buttons($query_result->fields); } if ($security_level > 1) { echo html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'edit\')"') . chr(10); } if ($security_level > 3) { echo html_icon('apps/accessories-text-editor.png', TEXT_RENAME, 'small', 'onclick="renameItem(' . $query_result->fields['id'] . ')"') . chr(10); }
// correct check boxes since changing the values will not affect the check status but change the value behind it $order->fields['cb_closed'] = $order->fields['closed'] == '1' ? 1 : 0; $order->fields['cb_waiting'] = $order->fields['waiting'] == '1' ? 1 : 0; $order->fields['cb_drop_ship'] = $order->fields['drop_ship'] == '1' ? 1 : 0; unset($order->fields['closed']); unset($order->fields['waiting']); unset($order->fields['drop_ship']); // some adjustments based on what we are doing $order->fields['search'] = $contact->fields['short_name']; $order->fields['post_date'] = gen_locale_date($order->fields['post_date']); $order->fields['terms_text'] = gen_terms_to_language($order->fields['terms'], true, $terms_type); $order->fields['disc_percent'] = '0'; if ($order->fields['terminal_date'] == '000-00-00' || $order->fields['terminal_date'] == '') { unset($order->fields['terminal_date']); } else { $order->fields['terminal_date'] = gen_locale_date($order->fields['terminal_date']); } if (!$order->fields['rep_id']) { unset($order->fields['rep_id']); } $ship_level = explode(':', $order->fields['shipper_code']); $order->fields['ship_carrier'] = $ship_level[0]; $order->fields['ship_service'] = $ship_level[1]; $order->fields['attach_exist'] = file_exists(PHREEBOOKS_DIR_MY_ORDERS . 'order_' . $oID . '.zip') ? 1 : 0; if ($so_po) { // opening a SO/PO for Invoice/Receive $id = 0; $so_po_ref_id = $order->fields['id']; $order->fields['so_po_ref_id'] = $so_po_ref_id; $order->fields['cb_closed'] = 0; $order->fields['cb_waiting'] = 0;
case '9': case '10': case '12': case '19': // check for stock available for SO, Customer Quote and Sales if ($qty > $inventory_array['branch_qty_in_stock'] && strpos(COG_ITEM_TYPES, $inventory_array['inventory_type']) !== false) { $stock_note[] = ORD_INV_STOCK_LOW; $stock_note[] = ORD_INV_STOCK_BAL . $inventory_array['branch_qty_in_stock']; // fetch open orders $sku_history = gather_history($inventory_array['sku']); if (is_array($sku_history['open_po'])) { $stock_note[] = ORD_INV_OPEN_POS; foreach ($sku_history['open_po'] as $value) { $store = $value['store_id'] ? gen_get_contact_name($value['store_id']) : COMPANY_NAME; // get name from id $stock_note[] = sprintf(ORD_INV_STOCK_STATUS, $store, $value['purchase_invoice_id'], $value['qty'], gen_locale_date($value['date_1'])); } } } break; default: } if ($jID == 4) { $inventory_array['item_cost'] = $inventory_array['item_cost'] * $inventory_array['purch_package_quantity']; // build the sales price $xml .= xmlEntry("sales_price", $sales_price * $inventory_array['purch_package_quantity']); } else { // build the sales price $xml .= xmlEntry("sales_price", $sales_price); } //put it all together
break; case 'edit': $oID = (int) $_GET['oID']; validate_security($security_level, 2); $cInfo = new objectInfo(array()); break; case 'dn_attach': $oID = db_prepare_input($_POST['id']); if (file_exists(PHREEBOOKS_DIR_MY_ORDERS . 'order_' . $oID . '.zip')) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(PHREEBOOKS_DIR_MY_ORDERS, 'order_' . $oID . '.zip', true); } die; default: } /***************** prepare to display templates *************************/ // retrieve the list of gl accounts and fill js arrays $gl_array_list = gen_coa_pull_down(); $i = 0; $js_gl_array = 'var js_gl_array = new Array();' . chr(10); foreach ($gl_array_list as $account) { $is_asset = $coa_types_list[$account['type']]['asset'] ? '1' : '0'; $js_gl_array .= 'js_gl_array[' . $i . '] = new glProperties("' . $account['id'] . '", "' . $account['text'] . '", "' . $is_asset . '");' . chr(10); $i++; } $cal_gl = array('name' => 'datePost', 'form' => 'journal', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($post_date)); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', GL_ENTRY_TITLE);
// | This program is free software: you can redistribute it and/or | // | modify it under the terms of the GNU General Public License as | // | published by the Free Software Foundation, either version 3 of | // | the License, or any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // +-----------------------------------------------------------------+ // Path: /modules/contacts/pages/main/template_e_history.php // ?> <div id="tab_history"> <fieldset> <legend><?php echo ACT_ACT_HISTORY; ?> </legend> <table class="ui-widget" style="border-collapse:collapse;width:100%;"> <tbody class="ui-widget-content"> <tr> <td width="50%"><?php echo constant('ACT_' . strtoupper($type) . '_FIRST_DATE') . ' ' . gen_locale_date($cInfo->first_date); ?> </td> </tr> </tbody> </table> </fieldset> </div>
dateInMs += oneDay; nextDay.setTime(dateInMs); thisDay = nextDay.getDate(); if (thisDay < 10) thisDay = '0' + thisDay; thisMonth = nextDay.getMonth() + 1; if (thisMonth < 10) thisMonth = '0' + thisMonth; thisYear = nextDay.getFullYear(); temp = thisYear + '-' + thisMonth + '-' + thisDay; document.getElementById('start_'+(index+1)).value = formatDate(temp); } } // --> </script> <?php // set up a calendar variable for each possible calendar echo '<script type="text/javascript">' . chr(10); $i = 0; foreach ($fy_array as $key => $value) { if ($key > $max_period) { // only allow changes if nothing has bee posted above this period $ctl_end = 'P' . $i . 'Start'; $cal_gen[$i] = array('name' => $ctl_end, 'form' => 'admin_tools', 'fieldname' => 'start_' . $i, 'imagename' => 'btn_date_' . $i, 'default' => gen_locale_date($value['start']), 'params' => array('align' => 'left', 'readonly' => 'true')); echo js_calendar_init($cal_gen[$i]); $ctl_end = 'P' . $i . 'End'; $cal_gen[$i] = array('name' => $ctl_end, 'form' => 'admin_tools', 'fieldname' => 'end_' . $i, 'imagename' => 'btn_date_' . $i, 'default' => gen_locale_date($value['end']), 'params' => array('align' => 'left', 'onchange' => 'updateEnd(' . $i . ');', 'readonly' => 'true')); echo js_calendar_init($cal_gen[$i]); } $i++; } echo '</script>' . chr(10);
case 'search': default: } /***************** prepare to display templates *************************/ // load the gl account beginning balance $acct_balance = load_cash_acct_balance($post_date, $gl_acct_id, $period); // load gl accounts $gl_array_list = gen_coa_pull_down(); // build the list header $heading_array = array('post_date' => BNK_INVOICE_DATE, 'bill_primary_name' => BNK_VENDOR_NAME, 'purchase_invoice_id' => BNK_INVOICE_NUM, 'total_amount' => BNK_AMOUNT_DUE); $result = html_heading_bar($heading_array, array(TEXT_NOTES, BNK_DUE_DATE, TEXT_DISCOUNT, BNK_20_AMOUNT_PAID, TEXT_PAY)); $list_header = $result['html_code']; $disp_order = $result['disp_order']; if (!$disp_order) { $disp_order = 'post_date'; } // build the list for the page selected $field_list = array('m.id', 'm.journal_id', 'm.post_date', 'm.total_amount', 'm.terms', 'm.gl_acct_id', 'm.purchase_invoice_id', 'm.purch_order_id', 'm.bill_acct_id', 'm.bill_primary_name', 'm.waiting'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select " . implode(', ', $field_list) . " \n\tfrom " . TABLE_JOURNAL_MAIN . " m inner join " . TABLE_CONTACTS . " a on m.bill_acct_id = a.id \n\twhere a.type = 'v' and m.journal_id in (6, 7) and m.closed = '0' \n\torder by {$disp_order}, post_date"; $query_result = $db->Execute($query_raw); $cal_bills0 = array('name' => 'datePosted', 'form' => 'bulk_bills', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($post_date), 'params' => array('align' => 'left', 'onchange' => 'loadNewBalance();')); $cal_bills1 = array('name' => 'dateInvoice', 'form' => 'bulk_bills', 'fieldname' => 'invoice_date', 'imagename' => 'btn_date_2', 'default' => gen_locale_date($invoice_date), 'params' => array('align' => 'left')); $cal_bills2 = array('name' => 'dateDiscount', 'form' => 'bulk_bills', 'fieldname' => 'discount_date', 'imagename' => 'btn_date_3', 'default' => gen_locale_date($discount_date), 'params' => array('align' => 'left')); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', ORD_TEXT_20_V_WINDOW_TITLE);
?> </th> <th><?php echo ORD_NEW_DELIVERY_DATES; ?> </th> </tr> </thead> <tbody class="ui-widget-content"> <?php $j = 1; while (!$ordr_items->EOF) { $price = $currencies->format($level_info[0] ? $level_info[0] : ($i == 0 ? $full_price : 0)); echo '<tr>' . chr(10); echo ' <td align="center">' . $ordr_items->fields['qty'] . '</td>' . chr(10); echo ' <td align="center">' . $ordr_items->fields['sku'] . '</td>' . chr(10); echo ' <td>' . $ordr_items->fields['description'] . '</td>' . chr(10); echo ' <td align="center">' . gen_locale_date($ordr_items->fields['date_1']) . '</td>' . chr(10); echo ' <td align="center" nowrap="nowrap">'; echo html_hidden_field('id_' . $j, $ordr_items->fields['id']) . chr(10); echo html_calendar_field($cal_gen[$j]) . chr(10); echo ' </td>' . chr(10); echo '</tr>'; $j++; $ordr_items->MoveNext(); } ?> </tbody> </table> </form>
break; case 'go_next': $_REQUEST['list']++; break; case 'go_last': $_REQUEST['list'] = 99999; break; case 'search': case 'search_reset': case 'go_page': default: } /***************** prepare to display templates *************************/ $include_header = true; $include_footer = true; $cal_date = array('name' => 'dateReference', 'form' => 'work_orders', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($post_date), 'params' => array('align' => 'left')); switch ($_REQUEST['action']) { case 'new': case 'edit': // build priority drop-down $priority_list = array(); for ($i = 1; $i < 10; $i++) { $priority_list[] = array('id' => $i, 'text' => $i); } define('PAGE_TITLE', $_REQUEST['action'] == 'edit' ? HEADING_WORK_ORDER_MODULE_EDIT : HEADING_WORK_ORDER_MODULE_NEW); $include_template = 'template_new.php'; break; case 'build': $user_list = wo_build_users(); define('PAGE_TITLE', HEADING_WORK_ORDER_MODULE_BUILD); $include_template = 'template_build.php';
while (!$levels->EOF) { $db->Execute("insert into " . TABLE_INVENTORY_SPECIAL_PRICES . " set inventory_id = {$levels->fields}['inventory_id'],\n\t\t price_sheet_id = {$id}, price_levels = '{$levels->fields}['price_levels']'"); $levels->MoveNext(); } gen_add_audit_log(PRICE_SHEETS_LOG . TEXT_REVISE, $result->fields['sheet_name'] . ' Rev. ' . $old_rev . ' => ' . ($old_rev + 1)); $_REQUEST['action'] = 'edit'; // continue with edit. // continue with edit. case 'edit': if (!isset($id)) { $id = db_prepare_input($_POST['rowSeq']); } $result = $db->Execute("select * from " . TABLE_PRICE_SHEETS . " where id = {$id}"); $sheet_name = $result->fields['sheet_name']; $revision = $result->fields['revision']; $effective_date = gen_locale_date($result->fields['effective_date']); $default_sheet = $result->fields['default_sheet'] ? '1' : '0'; $default_levels = $result->fields['default_levels']; break; case 'go_first': $_REQUEST['list'] = 1; break; case 'go_previous': $_REQUEST['list'] = max($_REQUEST['list'] - 1, 1); break; case 'go_next': $_REQUEST['list']++; break; case 'go_last': $_REQUEST['list'] = 99999; break;
$search_fields = array('bill_primary_name', 'purchase_invoice_id', 'purch_order_id', 'bill_postal_code', 'ship_primary_name', 'total_amount'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } } $field_list = array('id', 'post_date', 'shipper_code', 'purchase_invoice_id', 'total_amount', 'bill_primary_name', 'journal_id', 'currencies_code', 'currencies_value', 'total_amount as new_total_amount'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_JOURNAL_MAIN . " \n\t\twhere journal_id in (19,21) {$period_filter} {$search} order by {$disp_order}, purchase_invoice_id DESC"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pos_mgr'); $cal_date = array('name' => 'searchdate', 'form' => 'pos_mgr', 'fieldname' => 'search_date', 'imagename' => 'btn_date_1', 'default' => isset($date) ? gen_locale_date($date) : '', 'params' => array('align' => 'left')); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_POS_MGR);
?> </th> </tr> </thead> <tbody class="ui-widget-content"> <?php $i = 0; foreach ($fy_array as $key => $value) { echo '<tr><td width="33%" align="center">' . $key . html_hidden_field('per_' . $i, $key) . '</td>' . chr(10); if ($key > $max_period) { // only allow changes if nothing has been posted above this period echo '<td width="33%" nowrap="nowrap">' . html_calendar_field($cal_start[$i]) . '</td>' . chr(10); echo '<td width="33%" nowrap="nowrap">' . html_calendar_field($cal_end[$i]) . '</td>' . chr(10); } else { echo '<td width="33%" align="center" nowrap="nowrap">' . html_input_field('start_' . $i, gen_locale_date($value['start']), 'readonly="readonly"', false, 'text', false) . '</td>' . chr(10); echo '<td width="33%" align="center" nowrap="nowrap">' . html_input_field('end_' . $i, gen_locale_date($value['end']), 'readonly="readonly"', false, 'text', false) . '</td>' . chr(10); } echo '</tr>' . chr(10); $i++; } ?> </tbody> </table></td> </tr> </table></td> <td width="33%" valign="top" align="right"> <?php echo html_hidden_field('period', '') . chr(10); echo '<p>' . html_button_field('change', GL_BTN_CHG_ACCT_PERIOD, 'onclick="if (fetchPeriod()) submitToDo(\'change\')"') . '</p>' . chr(10); echo '<p>' . html_button_field('update', GL_BTN_UPDATE_FY, 'onclick="submitToDo(\'update\')"') . '</p>' . chr(10);
if (DEBUG) { $messageStack->write_debug(); } gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); break; } else { $db->transRollback(); } } else { $db->transRollback(); } } } $error = $messageStack->add(GL_ERROR_NO_DELETE, 'error'); $cInfo = new objectInfo($_POST); break; case 'edit': validate_security($security_level, 2); // security check $oID = (int) $_GET['oID']; // fall through like default // fall through like default default: $cInfo = new objectInfo(); } /***************** prepare to display templates *************************/ $cal_xfr = array('name' => 'dateReference', 'form' => 'inv_xfer', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($post_date)); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_INV_TRANSFER);
function TextReplace($text_string) { global $report; // substitutes a command string with dynamic information $text_string = str_replace('%date%', gen_locale_date(date('Y-m-d')), $text_string); $text_string = str_replace('%reportname%', $report->title, $text_string); $text_string = str_replace('%company%', COMPANY_NAME, $text_string); return $text_string; }
if (!isset($order->{$id_num})) { break; } // no more rows to build, exit loop $extra_params = $order->{$inv_num} ? '' : 'readonly="readonly" '; echo '<tr' . ($extra_params ? ' class="ui-state-error"' : '') . '>' . chr(10); echo '<td align="center">' . chr(10); echo html_input_field($inv_num, $order->{$inv_num}, 'readonly="readonly" size="15"') . chr(10); // Hidden fields echo html_hidden_field($id_num, $order->{$id_num}) . chr(10); echo html_hidden_field($prcnt_num, $order->{$prcnt_num}) . chr(10); echo html_hidden_field($early_num, $order->{$early_num}) . chr(10); echo html_hidden_field($acct_num, $order->{$acct_num}) . chr(10); // End hidden fields echo '</td>' . chr(10); echo '<td align="center">' . html_input_field($due_num, gen_locale_date($order->{$due_num}), 'readonly="readonly" size="15"') . '</td>' . chr(10); echo '<td align="center">' . html_input_field($amt_num, $currencies->format($currencies->clean_value($order->{$amt_num})), 'readonly="readonly" size="12" style="text-align:right"') . '</td>' . chr(10); echo '<td align="center">' . html_input_field($desc_num, $order->{$desc_num}, $extra_params . 'size="64" maxlength="64"') . '</td>' . chr(10); echo '<td align="center">' . html_input_field($dscnt_num, $currencies->format($currencies->clean_value($order->{$dscnt_num})), $extra_params . 'size="15" maxlength="20" onchange="updateRowTotal(' . $i . ')" style="text-align:right"') . '</td>' . chr(10); echo '<td align="center">' . html_input_field($total_num, $currencies->format($currencies->clean_value($order->{$total_num})), $extra_params . 'size="15" maxlength="20" onchange="updateUnitPrice(' . $i . ')" style="text-align:right"') . '</td>' . chr(10); echo '<td align="center">' . ($extra_params ? ' ' : html_checkbox_field($pay_num, '1', $order->{$pay_num} ? true : false, '', 'onclick="updatePayValues(' . $i . ')"')) . '</td>' . chr(10); echo '</tr>' . chr(10); $i++; } } ?> </tbody> </table> </div> </form>
$db->transStart(); if ($delAssy->unPost('delete')) { // unpost the prior assembly $db->transCommit(); // if not successful rollback will already have been performed gen_add_audit_log(INV_LOG_ASSY . TEXT_DELETE, $delAssy->journal_rows[0]['sku'], $delAssy->journal_rows[0]['qty']); if (DEBUG) { $messageStack->write_debug(); } gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); break; // *************** END TRANSACTION ************************* } } $messageStack->add(GL_ERROR_NO_DELETE, 'error'); $cInfo = new objectInfo($_POST); break; case 'edit': validate_security($security_level, 2); // security check $oID = (int) $_GET['oID']; $cInfo = new objectInfo(array()); break; default: } /***************** prepare to display templates *************************/ $cal_assy = array('name' => 'datePost', 'form' => 'inv_assy', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => isset($glEntry->post_date) ? gen_locale_date($glEntry->post_date) : date(DATE_FORMAT)); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', INV_ASSY_HEADING_TITLE);
echo html_hidden_field('ship_address_id', $order->ship_address_id) . chr(10); echo html_hidden_field('terms', $order->terms) . chr(10); echo html_hidden_field('item_count', $order->item_count) . chr(10); echo html_hidden_field('weight', $order->weight) . chr(10); echo html_hidden_field('currencies_code', $order->currencies_code) . chr(10); echo html_hidden_field('printed', $order->printed); echo html_hidden_field('override_user', ''); echo html_hidden_field('override_pass', ''); if (!isset($template_options['closed'])) { echo html_hidden_field('closed', $order->closed); } if (!isset($template_options['waiting'])) { echo html_hidden_field('waiting', $order->waiting); } if (!isset($template_options['terminal_date'])) { echo html_hidden_field('terminal_date', $order->terminal_date ? gen_locale_date($order->terminal_date) : ''); } if (!isset($template_options['terms'])) { echo html_hidden_field('terms_text', $order->terms_text); } // placeholder when not used if (!ENABLE_MULTI_CURRENCY) { echo html_hidden_field('display_currency', DEFAULT_CURRENCY) . chr(10); echo html_hidden_field('currencies_value', '1') . chr(10); } if (!ENABLE_MULTI_BRANCH) { echo html_hidden_field('store_id', '0') . chr(10); } // customize the toolbar actions $toolbar->icon_list['cancel']['params'] = 'onclick="location.href = \'' . html_href_link(FILENAME_DEFAULT, '', 'SSL') . '\'"'; $toolbar->icon_list['open']['params'] = 'onclick="OpenOrdrList(this)"';
, 'edit')"><?php echo $query_result->fields['purchase_invoice_id']; ?> </td> <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?> , 'edit')"><?php echo $status_codes[$query_result->fields['status']]; ?> </td> <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?> , 'edit')"><?php echo $query_result->fields['closed_date'] == '0000-00-00' ? ' ' : gen_locale_date($query_result->fields['closed_date']); ?> </td> <td align="right"> <?php // build the action toolbar // first pull in any extra buttons, this is dynamic since each row can have different buttons if (function_exists('add_extra_action_bar_buttons')) { echo add_extra_action_bar_buttons($query_result->fields); } if ($security_level > 1) { echo html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'edit\')"') . chr(10); } if ($attach_exists) { echo html_icon('status/mail-attachment.png', TEXT_DOWNLOAD_ATTACHMENT, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'dn_attach\', true)"') . chr(10); }
} break; case 'bulkupload': $upXML = new bulk_upload(); $inc_image = isset($_POST['include_images']) ? true : false; if ($upXML->bulkUpload($inc_image)) { gen_add_audit_log(ZENCART_BULK_UPLOAD); write_configure('MODULE_ZENCART_LAST_UPDATE', date('Y-m-d H:i:s')); } break; case 'sync': $upXML = new zencart(); if ($upXML->submitXML(0, 'product_sync')) { gen_add_audit_log(ZENCART_PRODUCT_SYNC); } break; case 'confirm': $upXML = new zencart(); $upXML->post_date = $ship_date; if ($upXML->submitXML(0, 'confirm')) { gen_add_audit_log(ZENCART_SHIP_CONFIRM, $ship_date); } break; default: } /***************** prepare to display templates *************************/ $cal_zc = array('name' => 'shipDate', 'form' => 'zencart', 'fieldname' => 'ship_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($ship_date), 'params' => array('align' => 'left')); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_ZENCART_MODULE);
$messageStack->add(GEN_ADM_TOOLS_REPAIR_SUCCESS, 'success'); } else { $messageStack->add(GEN_ADM_TOOLS_REPAIR_ERROR, 'error'); } if (DEBUG) { $messageStack->write_debug(); } break; default: } /***************** prepare to display templates *************************/ $fy_array = array(); $cal_end = array(); $i = 0; $result = $db->Execute("select period, start_date, end_date from " . TABLE_ACCOUNTING_PERIODS . " where fiscal_year = {$fy}"); while (!$result->EOF) { $fy_array[$result->fields['period']] = array('start' => $result->fields['start_date'], 'end' => $result->fields['end_date']); $cal_start[$i] = array('name' => 'startDate', 'form' => 'admin_tools', 'fieldname' => 'start_' . $i, 'imagename' => 'btn_date_2', 'default' => gen_locale_date($result->fields['start_date']), 'params' => array('align' => 'left')); $cal_end[$i] = array('name' => 'endDate', 'form' => 'admin_tools', 'fieldname' => 'end_' . $i, 'imagename' => 'btn_date_2', 'default' => gen_locale_date($result->fields['end_date']), 'params' => array('align' => 'left')); $i++; $result->MoveNext(); } // set up calendars for re-post $cal_repost_start = array('name' => 'repostStartDate', 'form' => 'admin_tools', 'fieldname' => 'start_date', 'imagename' => 'btn_date_2', 'default' => gen_locale_date($start_date), 'params' => array('align' => 'left')); $cal_repost_end = array('name' => 'repostEndDate', 'form' => 'admin_tools', 'fieldname' => 'end_date', 'imagename' => 'btn_date_2', 'default' => gen_locale_date($end_date), 'params' => array('align' => 'left')); $result = $db->Execute("SELECT journal_main_id FROM " . TABLE_INVENTORY_COGS_OWED); $cogs_owed = $result->RecordCount(); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_HEADING_ADMIN_TOOLS);
$extra_params = $query_result->fields['waiting'] == '1' ? 'readonly="readonly" ' : ''; echo '<tr' . ($extra_params ? ' class="ui-state-error"' : '') . '>' . chr(10); echo '<td align="center">' . chr(10); echo gen_locale_date($query_result->fields['post_date']) . chr(10); // Hidden fields echo html_hidden_field('id_' . $idx, $query_result->fields['id']) . chr(10); echo html_hidden_field('bill_acct_id_' . $idx, $query_result->fields['bill_acct_id']) . chr(10); echo html_hidden_field('amt_' . $idx, $amount_due) . chr(10); echo html_hidden_field('inv_' . $idx, $query_result->fields['purchase_invoice_id']) . chr(10); echo html_hidden_field('origdisc_' . $idx, $currencies->clean_value($discount)) . chr(10); echo html_hidden_field('discdate_' . $idx, $due_dates['early_date']) . chr(10); echo html_hidden_field('acct_' . $idx, $query_result->fields['gl_acct_id']) . chr(10); // End hidden fields echo '</td>' . chr(10); echo '<td>' . htmlspecialchars($query_result->fields['bill_primary_name']) . '</td>' . chr(10); echo '<td align="center">' . $query_result->fields['purchase_invoice_id'] . '</td>' . chr(10); echo '<td align="center" style="text-align:right">' . $currencies->format($amount_due) . '</td>' . chr(10); echo '<td align="center">' . html_input_field('desc_' . $idx, $query_result->fields['purch_order_id'], $extra_params . 'size="32"') . '</td>' . chr(10); echo '<td align="center">' . gen_locale_date($due_dates['net_date']) . '</td>' . chr(10); echo '<td align="center">' . html_input_field('dscnt_' . $idx, $discount, $extra_params . 'size="11" maxlength="20" onchange="updateDiscTotal(' . $idx . ')" style="text-align:right"') . '</td>' . chr(10); echo '<td align="center">' . html_input_field('total_' . $idx, '', $extra_params . 'size="11" maxlength="20" onchange="updateLineTotal(' . $idx . ')" style="text-align:right"') . '</td>' . chr(10); echo '<td align="center">' . html_checkbox_field('pay_' . $idx, '1', false, '', ($extra_params ? 'disabled="disabled" ' : '') . 'onclick="bbUpdatePayValues(' . $idx . ')"') . '</td>' . chr(10); echo '</tr>' . chr(10); $idx++; $query_result->MoveNext(); } ?> </tbody> </table> </div> </form>
case '0': $bkgnd = ''; break; case 'T': $bkgnd = ' style="background-color:yellow"'; break; case 'L': $bkgnd = ' style="background-color:lightred"'; break; } echo ' <tr class="' . ($odd ? 'odd' : 'even') . '">' . chr(10); echo ' <td' . $bkgnd . ' align="center">' . $result->fields['shipment_id'] . '</td>' . chr(10); echo ' <td' . $bkgnd . ' align="center">' . $result->fields['ref_id'] . '</td>' . chr(10); echo ' <td align="center">' . constant($method_id . '_' . $result->fields['method']) . '</td>' . chr(10); echo ' <td align="right">' . ($result->fields['deliver_date'] != '0000-00-00 00:00:00' ? gen_locale_date($result->fields['deliver_date'], true) : ' ') . '</td>' . chr(10); echo ' <td align="right">' . ($result->fields['actual_date'] != '0000-00-00 00:00:00' ? gen_locale_date($result->fields['actual_date'], true) : ' ') . '</td>' . chr(10); echo ' <td align="right"><a target="_blank" href="' . FEDEX_V7_TRACKING_URL . $result->fields['tracking_id'] . '">' . $result->fields['tracking_id'] . '</a></td>' . chr(10); echo ' <td align="right">' . $currencies->format_full($result->fields['cost']) . '</td>' . chr(10); echo ' <td align="right" nowrap="nowrap">'; if ($result->fields['actual_date'] == '0000-00-00 00:00:00') { // not tracked yet, show the tracking icon echo html_icon('phreebooks/truck-icon.png', TEXT_TRACK_CONFIRM, 'small', 'onclick="submitShipSequence(\'' . $method_id . '\', ' . $result->fields['id'] . ', \'track\')"') . chr(10); } echo html_icon('phreebooks/stock_id.png', TEXT_VIEW_SHIP_LOG, 'small', 'onclick="loadPopUp(\'' . $method_id . '\', \'edit\', ' . $result->fields['id'] . ')"') . chr(10); echo html_icon('actions/document-print.png', TEXT_PRINT, 'small', 'onclick="window.open(\'index.php?module=shipping&page=popup_label_mgr&action=view&method=' . $method_id . '&date=' . $date . '&labels=' . $result->fields['tracking_id'] . '\',\'label_mgr\',\'width=800,height=700,resizable=1,scrollbars=1,top=50,left=50\')"') . chr(10); echo html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SHIPPING_DELETE_CONFIRM . '\')) window.open(\'index.php?module=shipping&page=popup_label_mgr&method=' . $method_id . '&sID=' . $result->fields['shipment_id'] . '&action=delete\',\'popup_label_mgr\',\'width=800,height=700,resizable=1,scrollbars=1,top=50,left=50\')"') . chr(10); echo ' </td>'; echo ' </tr>' . chr(10); $result->MoveNext(); $odd = !$odd; }
} $purch_order_id = $query_result->fields['so_po_ref_id'] ? ord_get_so_po_num($query_result->fields['so_po_ref_id']) : ''; $total_amount = $currencies->format_full($query_result->fields['total_amount'], true, $query_result->fields['currencies_code'], $query_result->fields['currencies_value']); if (ENABLE_MULTI_CURRENCY) { $total_amount .= ' (' . $query_result->fields['currencies_code'] . ')'; } ?> <tr class="<?php echo $odd ? 'odd' : 'even'; ?> " style="cursor:pointer" onclick="setReturnOrdr(<?php echo $query_result->fields['id']; ?> , false)"> <td><?php echo gen_locale_date($query_result->fields['post_date']); ?> </td> <td><?php echo $query_result->fields['purchase_invoice_id']; ?> </td> <?php switch (JOURNAL_ID) { case 6: case 12: echo '<td>' . $purch_order_id . '</td>'; break; case 7: case 13: echo '<td>' . $query_result->fields['purch_order_id'] . '</td>';
)"><?php echo $query_result->fields['wo_title']; ?> </td> <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'build\''; ?> )"><?php echo $query_result->fields['closed'] ? TEXT_YES : ''; ?> </td> <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'build\''; ?> )"><?php echo gen_locale_date($query_result->fields['close_date']); ?> </td> <td align="right"> <?php // build the action toolbar // first pull in any extra buttons, this is dynamic since each row can have different buttons if (function_exists('add_extra_action_bar_buttons')) { echo add_extra_action_bar_buttons($query_result->fields); } if ($security_level > 1) { echo html_icon('categories/applications-development.png', TEXT_BUILD, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'build\')"') . chr(10); } if ($security_level > 1) { echo html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'edit\')"') . chr(10); }