From e9ad9e87f5eb2682d2e91c93134250fd8a8d2ad9 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sun, 8 Nov 2015 08:56:42 +0100 Subject: [PATCH] Cleanup comments. Small bugfixes. Third run --- install/index.php | 3 -- inventory/adjustments.php | 4 +-- inventory/cost_update.php | 1 - inventory/includes/db/items_trans_db.inc | 4 +-- inventory/includes/db/items_units_db.inc | 2 +- inventory/includes/inventory_db.inc | 15 +++++----- inventory/includes/item_adjustments_ui.inc | 1 - inventory/includes/stock_transfers_ui.inc | 1 - inventory/inquiry/stock_movements.php | 6 ---- inventory/manage/item_codes.php | 3 +- inventory/manage/items.php | 6 ++-- inventory/manage/sales_kits.php | 24 ++++++---------- inventory/purchasing_data.php | 3 +- js/inserts.js | 23 +-------------- .../includes/db/work_order_issues_db.inc | 18 +++++------- .../db/work_order_produce_items_db.inc | 15 ++++------ .../includes/db/work_orders_quick_db.inc | 19 ------------- .../includes/work_order_issue_ui.inc | 8 ------ manufacturing/inquiry/bom_cost_inquiry.php | 2 +- manufacturing/manage/bom_edit.php | 25 ----------------- manufacturing/search_work_orders.php | 8 ------ manufacturing/work_order_add_finished.php | 3 +- manufacturing/work_order_entry.php | 9 +----- manufacturing/work_order_issue.php | 2 -- purchasing/includes/db/grn_db.inc | 28 ++++++++----------- purchasing/includes/db/po_db.inc | 16 +---------- purchasing/includes/db/suppalloc_db.inc | 7 ----- purchasing/includes/purchasing_db.inc | 2 +- purchasing/includes/ui/grn_ui.inc | 8 ++---- purchasing/includes/ui/invoice_ui.inc | 13 ++------- purchasing/includes/ui/po_ui.inc | 9 +----- purchasing/manage/suppliers.php | 1 - purchasing/po_entry_items.php | 12 ++------ purchasing/po_receive_items.php | 4 +-- purchasing/supplier_credit.php | 3 +- purchasing/view/view_po.php | 2 +- reporting/rep709.php | 1 - 37 files changed, 68 insertions(+), 243 deletions(-) diff --git a/install/index.php b/install/index.php index 56e8bb9d..2d67867b 100644 --- a/install/index.php +++ b/install/index.php @@ -315,9 +315,6 @@ if (list_updated('inst_lang')) { start_form(); switch(@$_POST['Page']) { default: -// include ('../install.html'); -// submit_center('continue', _('Continue >>')); -// break; case '1': div_start('welcome'); subpage_title(_('System Diagnostics')); diff --git a/inventory/adjustments.php b/inventory/adjustments.php index 3d2c39ba..f71bb920 100644 --- a/inventory/adjustments.php +++ b/inventory/adjustments.php @@ -78,7 +78,7 @@ function handle_new_order() function can_process() { - global $Refs, $SysPrefs; + global $SysPrefs; $adj = &$_SESSION['adj_items']; @@ -178,7 +178,7 @@ function handle_delete_item($id) function handle_new_item() { add_to_order($_SESSION['adj_items'], $_POST['stock_id'], - input_num('qty'), input_num('std_cost')); + input_num('qty'), input_num('std_cost')); line_start_focus(); } diff --git a/inventory/cost_update.php b/inventory/cost_update.php index be6a19e6..efd99593 100644 --- a/inventory/cost_update.php +++ b/inventory/cost_update.php @@ -91,7 +91,6 @@ if (!isset($_POST['stock_id'])) if (!$page_nested) { echo "
" . _("Item:"). " "; - //echo stock_costable_items_list('stock_id', $_POST['stock_id'], false, true); echo stock_items_list('stock_id', $_POST['stock_id'], false, true); echo "

"; diff --git a/inventory/includes/db/items_trans_db.inc b/inventory/includes/db/items_trans_db.inc index c0dff65c..c1264146 100644 --- a/inventory/includes/db/items_trans_db.inc +++ b/inventory/includes/db/items_trans_db.inc @@ -20,9 +20,6 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co if (is_service($mb_flag)) { - //display_db_error("Cannot do cost update for Service item : $stock_id", ""); - - //Chaitanya $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)." WHERE stock_id=".db_escape($stock_id); @@ -54,6 +51,7 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co if ($value_of_change != 0) { + global $Refs; $stock_gl_code = get_stock_gl_code($stock_id); $cart = new items_cart(ST_COSTUPDATE); diff --git a/inventory/includes/db/items_units_db.inc b/inventory/includes/db/items_units_db.inc index ec6b8f5f..e1841f1c 100644 --- a/inventory/includes/db/items_units_db.inc +++ b/inventory/includes/db/items_units_db.inc @@ -64,7 +64,7 @@ function get_all_item_units($all=false) { $sql .= " ORDER BY name"; return db_query($sql, "could not get stock categories"); } -// 2008-06-15. Added Joe Hunt to get a measure of unit by given stock_id +// 2008-06-15. Added to get a measure of unit by given stock_id function get_unit_dec($stock_id) { $sql = "SELECT decimals FROM ".TB_PREF."item_units, ".TB_PREF."stock_master diff --git a/inventory/includes/inventory_db.inc b/inventory/includes/inventory_db.inc index e922102e..901ddcfd 100644 --- a/inventory/includes/inventory_db.inc +++ b/inventory/includes/inventory_db.inc @@ -34,12 +34,12 @@ function get_stock_movements($stock_id, $StockLocation, $BeforeDate, $AfterDate) { $before_date = date2sql($BeforeDate); $after_date = date2sql($AfterDate); - $sql = "SELECT move.*, IF(ISNULL(supplier.supplier_id), debtor.name, supplier.supp_name) name"; + $sql = "SELECT move.*, IF(ISNULL(supplier.supplier_id), debtor.name, supplier.supp_name) name"; if(!$StockLocation) { $sql .= ", move.loc_code"; } - $sql.= " FROM ".TB_PREF."stock_moves move + $sql.= " FROM ".TB_PREF."stock_moves move LEFT JOIN ".TB_PREF."supp_trans credit ON credit.trans_no=move.trans_no AND credit.type=move.type LEFT JOIN ".TB_PREF."grn_batch grn ON grn.id=move.trans_no AND 25=move.type LEFT JOIN ".TB_PREF."suppliers supplier ON IFNULL(grn.supplier_id, credit.supplier_id)=supplier.supplier_id @@ -47,15 +47,15 @@ function get_stock_movements($stock_id, $StockLocation, $BeforeDate, $AfterDate) LEFT JOIN ".TB_PREF."debtors_master debtor ON cust_trans.debtor_no=debtor.debtor_no WHERE"; - if ($StockLocation) { - $sql.= " move.loc_code=".db_escape($StockLocation)." AND"; + if ($StockLocation) { + $sql.= " move.loc_code=".db_escape($StockLocation)." AND"; } $sql.= " move.tran_date >= '". $after_date . "' - AND move.tran_date <= '" . $before_date . "' - AND move.stock_id = ".db_escape($stock_id) . " ORDER BY move.tran_date, move.trans_id"; + AND move.tran_date <= '" . $before_date . "' + AND move.stock_id = ".db_escape($stock_id) . " ORDER BY move.tran_date, move.trans_id"; - return db_query($sql, "could not query stock moves"); + return db_query($sql, "could not query stock moves"); } function calculate_reorder_level($location, $line, &$st_ids, &$st_names, &$st_num, &$st_reorder) @@ -92,7 +92,6 @@ function send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder) require_once($path_to_root . "/reporting/includes/class.mail.inc"); $company = get_company_prefs(); $mail = new email($company['coy_name'], $company['email']); - $from = $company['coy_name'] . " <" . $company['email'] . ">"; $to = $loc['location_name'] . " <" . $loc['email'] . ">"; $subject = _("Stocks below Re-Order Level at " . $loc['location_name']); $msg = "\n"; diff --git a/inventory/includes/item_adjustments_ui.inc b/inventory/includes/item_adjustments_ui.inc index 0bd5d2b7..4aa976cb 100644 --- a/inventory/includes/item_adjustments_ui.inc +++ b/inventory/includes/item_adjustments_ui.inc @@ -146,7 +146,6 @@ function adjustment_edit_item_controls(&$order, $line_no=-1) qty_cells(null, 'qty', $_POST['qty'], null, null, $dec); label_cell($_POST['units'], '', 'units'); - //amount_cells(null, 'std_cost', $_POST['std_cost']); amount_cells(null, 'std_cost', null, null, null, $dec2); label_cell(" "); diff --git a/inventory/includes/stock_transfers_ui.inc b/inventory/includes/stock_transfers_ui.inc index 3fd5110a..f3c0f5dc 100644 --- a/inventory/includes/stock_transfers_ui.inc +++ b/inventory/includes/stock_transfers_ui.inc @@ -57,7 +57,6 @@ function display_transfer_items($title, &$order) $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), ''); if ( count($order->line_items)) $th[] = ''; table_header($th); - $subtotal = 0; $k = 0; //row colour counter $low_stock = $order->check_qoh($_POST['FromStockLocation'], $_POST['AdjDate'], true); diff --git a/inventory/inquiry/stock_movements.php b/inventory/inquiry/stock_movements.php index 3efdfb42..363f4dc9 100644 --- a/inventory/inquiry/stock_movements.php +++ b/inventory/inquiry/stock_movements.php @@ -89,12 +89,6 @@ $before_qty = get_qoh_on_date($_POST['stock_id'], $_POST['StockLocation'], add_d $after_qty = $before_qty; -/* -if (!isset($before_qty_row[0])) -{ - $after_qty = $before_qty = 0; -} -*/ start_row("class='inquirybg'"); $header_span = $display_location ? 6 : 5; label_cell(""._("Quantity on hand before") . " " . $_POST['AfterDate']."", "align=center colspan=$header_span"); diff --git a/inventory/manage/item_codes.php b/inventory/manage/item_codes.php index ffbd942c..9fa68ebb 100644 --- a/inventory/manage/item_codes.php +++ b/inventory/manage/item_codes.php @@ -102,9 +102,8 @@ if (!isset($_POST['stock_id'])) $_POST['stock_id'] = get_global_stock_item(); echo "
" . _("Item:"). " "; -//Chaitanya : Manufcatured item visible +//Manufcatured item visible echo stock_items_list('stock_id', $_POST['stock_id'], false, true); -//echo stock_purchasable_items_list('stock_id', $_POST['stock_id'], false, true); echo "
"; diff --git a/inventory/manage/items.php b/inventory/manage/items.php index 449eae17..3725aca9 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -79,7 +79,7 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '') $imagetype = $type; else $imagetype = false; - //$imagetype = exif_imagetype($_FILES['pic']['tmp_name']); + if ($imagetype != IMAGETYPE_GIF && $imagetype != IMAGETYPE_JPEG && $imagetype != IMAGETYPE_PNG) { //File type Check display_warning( _('Only graphics files can be uploaded')); @@ -98,7 +98,7 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '') elseif ( $_FILES['pic']['type'] == "text/plain" ) { //File type Check display_warning( _('Only graphics files can be uploaded')); - $upload_file ='No'; + $upload_file ='No'; } elseif (file_exists($filename)) { @@ -402,7 +402,7 @@ function item_settings(&$stock_id, $new_item) if (isset($_POST['NewStockID']) && file_exists(company_path().'/images/' .item_img_name($_POST['NewStockID']).".jpg")) { - // 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D. + // 31/08/08 - rand() call is necessary here to avoid caching problems. $stock_img_link .= "[".$_POST["; diff --git a/inventory/manage/sales_kits.php b/inventory/manage/sales_kits.php index 8fdf6bea..2f406678 100644 --- a/inventory/manage/sales_kits.php +++ b/inventory/manage/sales_kits.php @@ -22,13 +22,7 @@ include_once($path_to_root . "/includes/data_checks.inc"); check_db_has_stock_items(_("There are no items defined in the system.")); simple_page_mode(true); -/* -if (isset($_GET['item_code'])) -{ - $_POST['item_code'] = $_GET['item_code']; - $selected_kit = $_GET['item_code']; -} -*/ + //-------------------------------------------------------------------------------------------------- function display_kit_items($selected_kit) { @@ -56,7 +50,7 @@ function display_kit_items($selected_kit) } //END WHILE LIST LOOP end_table(); -div_end(); + div_end(); } //-------------------------------------------------------------------------------------------------- @@ -69,13 +63,13 @@ function update_kit($selected_kit, $component_id) { display_error(_("The quantity entered must be numeric and greater than zero.")); set_focus('quantity'); - return; + return 0; } elseif (get_post('description') == '') { display_error( _("Item code description cannot be empty.")); set_focus('description'); - return; + return 0; } elseif ($component_id == -1) // adding new component to alias/kit with optional kit creation { @@ -83,14 +77,14 @@ function update_kit($selected_kit, $component_id) if (get_post('kit_code') == '') { display_error( _("Kit/alias code cannot be empty.")); set_focus('kit_code'); - return; + return 0; } $kit = get_item_kit(get_post('kit_code')); if (db_num_rows($kit)) { $input_error = 1; display_error( _("This item code is already assigned to stock item or sale kit.")); set_focus('kit_code'); - return; + return 0; } } } @@ -98,14 +92,14 @@ function update_kit($selected_kit, $component_id) if (check_item_in_kit($component_id, $selected_kit, get_post('component'), true)) { display_error(_("The selected component contains directly or on any lower level the kit under edition. Recursive kits are not allowed.")); set_focus('component'); - return; + return 0; } /*Now check to see that the component is not already in the kit */ if (check_item_in_kit($component_id, $selected_kit, get_post('component'))) { display_error(_("The selected component is already in this kit. You can modify it's quantity but it cannot appear more than once in the same kit.")); set_focus('component'); - return; + return 0; } if ($component_id == -1) { // new component in alias/kit if ($selected_kit == '') { @@ -224,8 +218,6 @@ if (get_post('item_code') == '') { sales_local_items_list_row(_("Component:"),'component', null, false, true); -// if (get_post('description') == '') -// $_POST['description'] = get_kit_name($_POST['component']); if (get_post('item_code') == '') { // new kit/alias if ($Mode!='ADD_ITEM' && $Mode!='UPDATE_ITEM') { $_POST['description'] = $props['description']; diff --git a/inventory/purchasing_data.php b/inventory/purchasing_data.php index 4482a5fa..d0302261 100644 --- a/inventory/purchasing_data.php +++ b/inventory/purchasing_data.php @@ -115,9 +115,8 @@ if (!isset($_POST['stock_id'])) if (!$page_nested) { echo "
" . _("Item:"). " "; - //Chaitanya : All items can be purchased + // All items can be purchased echo stock_items_list('stock_id', $_POST['stock_id'], false, true); - //echo stock_purchasable_items_list('stock_id', $_POST['stock_id'], false, true); echo "
"; } else diff --git a/js/inserts.js b/js/inserts.js index 7da83993..e1762dd3 100644 --- a/js/inserts.js +++ b/js/inserts.js @@ -139,8 +139,6 @@ function _set_combo_select(e) { e.setAttribute('_last', e.selectedIndex); e.onblur = function() { var box = document.getElementsByName(this.getAttribute('rel'))[0]; -// if(string_contains(this.className, 'combo')) -// _update_box(this); if ((this.selectedIndex != this.getAttribute('_last')) ||((string_contains(this.className, 'combo') || string_contains(this.className, 'combo3')) && _update_box(this)) ) @@ -469,8 +467,6 @@ var inserts = { var ulist=ul.getElementsByTagName("li"); for (var x=0; xquantity = -$item->quantity; - //Chaitanya: Stamp the standard_cost + // Stamp the standard_cost $standard_cost = get_standard_cost($item->stock_id); // insert a -ve stock move for each item add_stock_move(ST_MANUISSUE, $item->stock_id, $number, @@ -71,7 +71,7 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $w $issue = get_stock_gl_code($item->stock_id); $stockitem = get_item($item->stock_id); - //Chaitanya : Compatibility for Service Items + // Compatibility for Service Items if (!is_service($issue["mb_flag"])) $ivaccount = $issue["inventory_account"]; else @@ -82,7 +82,7 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $w $issue_total += $issue_cost; } if ($issue_total != 0) - //Chaitanya : Apply cost to QOH as adjustment only + // Apply cost to QOH as adjustment only add_issue_cost($details['stock_id'], $details['units_reqd'], $date_, $issue_total, true); $issue = get_stock_gl_code($details['stock_id']); $stockitem = get_item($details['stock_id']); @@ -180,11 +180,7 @@ function void_work_order_issue($type_no) .db_escape($type_no); db_query($sql,"A work order issue item could not be voided"); - // void any related gl trans - //Chaitanya : Nothing happens due to next statement as all gl postings are done against WO - //void_gl_trans(ST_MANUISSUE, $type_no, true); - - //Chaitanya : Reverse the gl posting + // Reverse the gl posting $issue = get_work_order_issue($type_no); $manf_stock_id = $issue["stock_id"]; $date_ = sql2date($issue["issue_date"]); @@ -199,7 +195,7 @@ function void_work_order_issue($type_no) $issue = get_stock_gl_code($myrow["stock_id"]); $stockitem = get_item($myrow["stock_id"]); - //Chaitanya : Compatibility for Service Items + // Compatibility for Service Items if (!is_service($issue["mb_flag"])) $ivaccount = $issue["inventory_account"]; else @@ -214,7 +210,7 @@ function void_work_order_issue($type_no) } } if ($issue_total != 0) - //Chaitanya : Revese cost effect on manfactured stock item as adjustment only + // Revese cost effect on manfactured stock item as adjustment only add_issue_cost($manf_stock_id, 0, $date_, $issue_total, true); $issue = get_stock_gl_code($manf_stock_id); $stockitem = get_item($manf_stock_id); @@ -223,7 +219,7 @@ function void_work_order_issue($type_no) 0, 0, $date_.": "._("Reversed the issue to")." ".$stockitem["description"], -$total_cost); - //Chaitanya : Shifted below void all related stock moves + // Shifted below void all related stock moves void_stock_move(ST_MANUISSUE, $type_no); commit_transaction(); diff --git a/manufacturing/includes/db/work_order_produce_items_db.inc b/manufacturing/includes/db/work_order_produce_items_db.inc index e935d57d..111feb4c 100644 --- a/manufacturing/includes/db/work_order_produce_items_db.inc +++ b/manufacturing/includes/db/work_order_produce_items_db.inc @@ -50,7 +50,7 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo) work_order_quick_costs($woid, $details["stock_id"], $quantity, $date_, $id); // ------------------------------------------------------------------------- - // Chaitanya: stamp BOM cost to finished item + // Stamp BOM cost to finished item $m_cost = 0; $result = get_bom($details["stock_id"]); while ($bom_item = db_fetch($result)) @@ -119,7 +119,7 @@ function void_work_order_produce($type_no) begin_transaction(); hook_db_prevoid(ST_MANURECEIVE, $type_no); - //Chaitanya : Skip processing already voided entry i.e. explicitly voided + // Skip processing already voided entry i.e. explicitly voided $void_entry = get_voided_entry(ST_MANURECEIVE, $type_no); if ($void_entry) return; @@ -129,13 +129,8 @@ function void_work_order_produce($type_no) // deduct the quantity of this production from the parent work order work_order_update_finished_quantity($row["workorder_id"], -$row["quantity"]); - //Chaitanya : skipped this step as BOM may have got changed - //work_order_quick_costs($row['workorder_id'], $row['stock_id'], -$row['quantity'], sql2date($row['date_']), $type_no); - // void any related gl trans - //Chaitanya : Nothing happens due to next statement as all gl postings are done against WO - //void_gl_trans(ST_MANURECEIVE, $type_no, true); - + $woid = $row["workorder_id"]; $date_ = sql2date($row["date_"]); @@ -146,7 +141,7 @@ function void_work_order_produce($type_no) $issue = get_stock_gl_code($myrow["stock_id"]); $stockitem = get_item($myrow["stock_id"]); - //Chaitanya : Compatibility for Service Items + // Compatibility for Service Items if (!is_service($issue["mb_flag"])) $ivaccount = $issue["inventory_account"]; else @@ -163,7 +158,7 @@ function void_work_order_produce($type_no) $sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".db_escape($type_no); db_query($sql, "Cannot void a wo production"); - //Chaitanya : Shifted below + // Shifted below // void all related stock moves void_stock_move(ST_MANURECEIVE, $type_no); diff --git a/manufacturing/includes/db/work_orders_quick_db.inc b/manufacturing/includes/db/work_orders_quick_db.inc index e7932edc..4aa2a176 100644 --- a/manufacturing/includes/db/work_orders_quick_db.inc +++ b/manufacturing/includes/db/work_orders_quick_db.inc @@ -113,7 +113,6 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced=0, $costs=0, $cr_acc="", $labour=0, $cr_lab_acc="") { - global $wo_cost_types; $result = get_bom($stock_id); // credit all the components @@ -142,24 +141,6 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced if ($advanced) { $wo = get_work_order($woid); - // also take the additional issues - // moved to work_order_issues_db.inc - /* - $res = get_additional_issues($woid); - $issue_total = 0; - while ($item = db_fetch($res)) - { - $standard_cost = get_standard_cost($item['stock_id']); - $issue_cost = $standard_cost * $item['qty_issued'] * $units_reqd / $wo['units_reqd']; - $issue = get_stock_gl_code($item['stock_id']); - $stockitem = get_item($item['stock_id']); - $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"], 0, 0, - $date_.": "._("Issue of")." ".$stockitem["description"], -$issue_cost); - $issue_total += $issue_cost; - } - if ($issue_total != 0) - add_issue_cost($stock_id, $units_reqd, $date_, $issue_total); - */ $lcost = get_gl_wo_cost($woid, WO_LABOUR); add_labour_cost($stock_id, $units_reqd, $date_, $lcost * $units_reqd / $wo['units_reqd']); $ocost = get_gl_wo_cost($woid, WO_OVERHEAD); diff --git a/manufacturing/includes/work_order_issue_ui.inc b/manufacturing/includes/work_order_issue_ui.inc index 45390e21..936685ab 100644 --- a/manufacturing/includes/work_order_issue_ui.inc +++ b/manufacturing/includes/work_order_issue_ui.inc @@ -44,8 +44,6 @@ function display_issue_items($title, &$order) foreach ($order->line_items as $line_no=>$stock_item) { -// $total += ($stock_item->standard_cost * $stock_item->quantity); - if ($id != $line_no) { if (in_array($stock_item->stock_id, $low_stock)) @@ -75,8 +73,6 @@ function display_issue_items($title, &$order) if ($id == -1) issue_edit_item_controls($order); -// label_row(_("Total"), number_format2($total,user_price_dec()), "colspan=5", "align=right"); - end_table(); if (@$low_stock) display_note(_("Marked items have insufficient quantities in stock as on day of issue."), 0, 1, "class='stockmankofg'"); @@ -96,7 +92,6 @@ function issue_edit_item_controls(&$order, $line_no=-1) $_POST['stock_id'] = $order->line_items[$id]->stock_id; $_POST['qty'] = qty_format($order->line_items[$id]->quantity, $order->line_items[$id]->stock_id, $dec); - //$_POST['std_cost'] = price_format($order->line_items[$id]->standard_cost); $std_cost = $order->line_items[$id]->standard_cost; $_POST['units'] = $order->line_items[$id]->units; @@ -121,7 +116,6 @@ function issue_edit_item_controls(&$order, $line_no=-1) $dec = $item_info["decimals"]; $_POST['qty'] = number_format2(0, $dec); - //$_POST['std_cost'] = price_format($item_info["standard_cost"]); $std_cost = $item_info["standard_cost"]; $_POST['units'] = $item_info["units"]; } @@ -172,8 +166,6 @@ function issue_options_controls() yesno_list_row(_("Type:"), 'IssueType', $_POST['IssueType'], _("Return Items to Location"), _("Issue Items to Work order")); - - textarea_row(_("Memo"), 'memo_', null, 50, 3); end_table(1); diff --git a/manufacturing/inquiry/bom_cost_inquiry.php b/manufacturing/inquiry/bom_cost_inquiry.php index 02605b56..9b8f9d21 100644 --- a/manufacturing/inquiry/bom_cost_inquiry.php +++ b/manufacturing/inquiry/bom_cost_inquiry.php @@ -27,7 +27,7 @@ if (isset($_GET['stock_id'])) $_POST['stock_id'] = $_GET['stock_id']; } if (list_updated('stock_id')) - $Ajax->activate('_page_body'); + $Ajax->activate('_page_body'); start_form(false, true); start_table(TABLESTYLE_NOBORDER); diff --git a/manufacturing/manage/bom_edit.php b/manufacturing/manage/bom_edit.php index aca1d761..5d60f317 100644 --- a/manufacturing/manage/bom_edit.php +++ b/manufacturing/manage/bom_edit.php @@ -27,37 +27,12 @@ simple_page_mode(true); $selected_component = $selected_id; //-------------------------------------------------------------------------------------------------- -//if (isset($_GET["NewItem"])) -//{ -// $_POST['stock_id'] = $_GET["NewItem"]; -//} if (isset($_GET['stock_id'])) { $_POST['stock_id'] = $_GET['stock_id']; $selected_parent = $_GET['stock_id']; } -/* selected_parent could come from a post or a get */ -/*if (isset($_GET["selected_parent"])) -{ - $selected_parent = $_GET["selected_parent"]; -} -else if (isset($_POST["selected_parent"])) -{ - $selected_parent = $_POST["selected_parent"]; -} -*/ -/* selected_component could also come from a post or a get */ -/*if (isset($_GET["selected_component"])) -{ - $selected_component = $_GET["selected_component"]; -} -else -{ - $selected_component = get_post("selected_component", -1); -} -*/ - //-------------------------------------------------------------------------------------------------- function display_bom_items($selected_parent) diff --git a/manufacturing/search_work_orders.php b/manufacturing/search_work_orders.php index 98b645b3..f848a763 100644 --- a/manufacturing/search_work_orders.php +++ b/manufacturing/search_work_orders.php @@ -135,12 +135,6 @@ function produce_link($row) function costs_link($row) { -/* - return $row["closed"] || !$row["released"] ? '' : - pager_link(_('Costs'), - "/gl/gl_bank.php?NewPayment=1&PayType=" - .PT_WORKORDER. "&PayPerson=" .$row["id"]); -*/ return $row["closed"] || !$row["released"] ? '' : pager_link(_('Costs'), "/manufacturing/work_order_costs.php?trans_no=" .$row["id"]); @@ -148,8 +142,6 @@ function costs_link($row) function view_gl_link($row) { - //if ($row['closed'] == 0) - // return ''; return get_gl_view_str(ST_WORKORDER, $row['id']); } diff --git a/manufacturing/work_order_add_finished.php b/manufacturing/work_order_add_finished.php index 8a9947a4..cec7ce78 100644 --- a/manufacturing/work_order_add_finished.php +++ b/manufacturing/work_order_add_finished.php @@ -69,7 +69,7 @@ if (strlen($wo_details[0]) == 0) function can_process($wo_details) { - global $SysPrefs, $Refs; + global $SysPrefs; if (!check_reference($_POST['ref'], ST_MANURECEIVE)) { @@ -174,7 +174,6 @@ display_wo_details($_POST['selected_id']); start_form(); hidden('selected_id', $_POST['selected_id']); -//hidden('WOReqQuantity', $_POST['WOReqQuantity']); $dec = get_qty_dec($wo_details["stock_id"]); if (!isset($_POST['quantity']) || $_POST['quantity'] == '') diff --git a/manufacturing/work_order_entry.php b/manufacturing/work_order_entry.php index 6a27bfc2..be602d93 100644 --- a/manufacturing/work_order_entry.php +++ b/manufacturing/work_order_entry.php @@ -122,7 +122,7 @@ if (!isset($_POST['date_'])) function can_process() { - global $selected_id, $SysPrefs, $Refs; + global $selected_id, $SysPrefs; if (!isset($selected_id)) { @@ -223,15 +223,8 @@ function can_process() display_error( _("The date entered is in an invalid format.")); return false; } - //elseif (!is_date_in_fiscalyear($_POST['RequDate'])) - //{ - // display_error(_("The entered date is out of fiscal year or is closed for further data entry.")); - // return false; - //} if (isset($selected_id)) { - $myrow = get_work_order($selected_id, true); - if ($_POST['units_issued'] > input_num('quantity')) { set_focus('quantity'); diff --git a/manufacturing/work_order_issue.php b/manufacturing/work_order_issue.php index 86e3677a..025a9125 100644 --- a/manufacturing/work_order_issue.php +++ b/manufacturing/work_order_issue.php @@ -71,8 +71,6 @@ function handle_new_order() //----------------------------------------------------------------------------------------------- function can_process() { - global $Refs; - if (!is_date($_POST['date_'])) { display_error(_("The entered date for the issue is invalid.")); diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 3b29b75b..d3bed587 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -//------------------- update average material cost ------------------------------------------ Joe Hunt Mar-03-2008 +//------------------- update average material cost ---------------------------------------------- function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $adj_only=false) { // probably this function should be optimized @@ -36,8 +36,8 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $price_in_home_currency_ = $price_in_home_currency; - //Handle if inventory will become negative - //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only + // Handle if inventory will become negative + // Skip negative inventory adjustment for case of adjust_only if (is_inventory_item($stock_id) && !$adj_only) handle_negative_inventory($stock_id, $qty, $price_in_home_currency, $date); @@ -49,15 +49,10 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, //Price adjustment for manufactured item if (!$adj_only && $myrow['mb_flag'] == 'M') { - $standard_cost = get_standard_cost($stock_id); //reduce overhead_cost and labour_cost from price as those will remain as is $price_in_home_currency = $price_in_home_currency - $myrow['labour_cost'] - $myrow['overhead_cost']; } - if ($adj_only) - $exclude = ST_CUSTDELIVERY; - else - $exclude = 0; $cost_adjust = false; $qoh = get_qoh_on_date($stock_id); @@ -79,7 +74,7 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $material_cost = ($qoh * $material_cost + $qty * $price_in_home_currency) / ($qoh + $qty); } - if ($cost_adjust) // new 2010-02-10 //Chaitanya : Material_cost replaced with price + if ($cost_adjust) // Material_cost replaced with price adjust_deliveries($stock_id, $price_in_home_currency_, $date); $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)." WHERE stock_id=".db_escape($stock_id); @@ -120,25 +115,27 @@ function add_grn(&$po) { $stock_gl_code = get_stock_gl_code($order_line->stock_id); - /*Update sales_order_details for the new quantity received and the standard cost used for postings to GL and recorded in the stock movements for FIFO/LIFO stocks valuations*/ - //------------------- update average material cost and clearing account ----- Joe Hunt Mar-03-2008 + /*Update sales_order_details for the new quantity received and the standard cost used for postings to GL + and recorded in the stock movements for FIFO/LIFO stocks valuations*/ + //------------------- update average material cost and clearing account -------------------------------- if (is_inventory_item($order_line->stock_id)) { if ($clearing_act) $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $stock_gl_code["inventory_account"], $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], - $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, $order_line->stock_id); + $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, + $order_line->stock_id); update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price, $order_line->receive_qty, $date_); } - //---------------------------------------------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------ if ($order_line->qty_received == 0) { /*This must be the first receipt of goods against this line */ /*Need to get the standard cost as it is now so we can process GL jorunals later*/ $order_line->standard_cost = get_standard_cost($order_line->stock_id); } - // added 2008-12-08 Joe Hunt. Update the purchase data table + // Update the purchase data table add_or_update_purchase_data($po->supplier_id, $order_line->stock_id, $order_line->price, $order_line->item_description); @@ -198,7 +195,6 @@ function add_grn_detail_item($grn_batch_id, $po_detail_item, $item_code, $descri quantity_ordered=".db_escape($quantity).", act_price=".db_escape($price)." WHERE po_detail_item = ".db_escape($po_detail_item); - db_query($sql, "a purchase order details record could not be updated. This receipt of goods has not been processed "); $sql = "INSERT INTO ".TB_PREF."grn_items (grn_batch_id, po_detail_item, item_code, description, qty_recd) @@ -345,7 +341,7 @@ function read_grn_items_to_order($grn_batch, &$order) while ($myrow = db_fetch($result)) { if ($myrow['qty_recd'] == 0 && $myrow['quantity_inv'] == 0) - continue; // 2011-01-18 Joe Hunt. We will not have empty credited rows. + continue; // We will not have empty credited rows. if (is_null($myrow["units"])) { $units = ""; diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index 9bc64d4c..fbc3a8cc 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -102,8 +102,6 @@ function add_po(&$po_obj) $Refs->save(ST_PURCHORDER, $po_obj->order_no, $po_obj->reference); - //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); - add_audit_trail(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date); hook_db_postwrite($po_obj, ST_PURCHORDER); commit_transaction(); @@ -150,13 +148,7 @@ function update_po(&$po_obj) db_query($sql, "One of the purchase order detail records could not be updated"); } -//_vd($po_obj->prepayments); reallocate_payments($po_obj->order_no, ST_PURCHORDER, $po_obj->orig_order_date, $po_obj->get_trans_total(), $po_obj->prepayments); -//_vd($p = get_payments_for($po_obj->order_no, ST_PURCHORDER)); -//_vd(get_supp_trans($p[0]['trans_no_from'], $p[0]['trans_type_from'])); -//exit; - - // add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); add_audit_trail($po_obj->trans_type, $po_obj->order_no, Today(), _("Updated.")); hook_db_postwrite($po_obj, ST_PURCHORDER); @@ -236,8 +228,6 @@ function read_po_items($order_no, &$order, $open_items_only=false) { if ($data['supplier_description'] != "") $myrow['description'] = $data['supplier_description']; - //if ($data['suppliers_uom'] != "") - // $myrow['units'] = $data['suppliers_uom']; } if (is_null($myrow["units"])) { @@ -252,11 +242,7 @@ function read_po_items($order_no, &$order, $open_items_only=false) $myrow["quantity_ordered"],$myrow["description"], $myrow["unit_price"],$units, sql2date($myrow["delivery_date"]), $myrow["qty_invoiced"], $myrow["quantity_received"])) { - $newline = &$order->line_items[$order->lines_on_order-1]; - $newline->po_detail_rec = $myrow["po_detail_item"]; - $newline->standard_cost = $myrow["std_cost_unit"]; /*Needed for receiving goods and GL interface */ - // set for later GRN edition -// $newline->receive_qty = $newline->quantity - $newline->qty_dispatched; + $order->line_items[$order->lines_on_order-1]->po_detail_rec = $myrow["po_detail_item"]; } } /* line po from purchase order details */ } //end of checks on returned data set diff --git a/purchasing/includes/db/suppalloc_db.inc b/purchasing/includes/db/suppalloc_db.inc index 57e76b35..e8506bb0 100644 --- a/purchasing/includes/db/suppalloc_db.inc +++ b/purchasing/includes/db/suppalloc_db.inc @@ -97,10 +97,6 @@ function clear_supp_alloctions($type, $type_no, $person_id=null, $date="") $sql .= " AND person_id=".db_escape($person_id); db_query($sql, "could not void supp transactions for type=$type and trans_no=$type_no"); -// is this necessary? -// if ($date != "") -// exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date, -// $row['amt'], PT_SUPPLIER, true); } //------------------------------------------------------------------------------------------------------------- @@ -168,8 +164,6 @@ function get_allocatable_purch_orders($supplier_id = null, $trans_no=null, $type } else { -// FIXME: change to form below when prepayments terms finally can be selected in PO entry form: -// $sql .= " AND round(prep_amount) > 0 AND ISNULL(grn.purch_order_no)"; // only sales orders with prepayment level set and no yet received $sql .= " AND ISNULL(grn.purch_order_no)"; // only sales orders no yet received } if ($supplier_id) @@ -261,7 +255,6 @@ function get_allocatable_from_supp_transactions($supplier_id, $trans_no=null, $t AND trans.type NOT IN (".implode(',',array(ST_SUPPAYMENT,ST_BANKPAYMENT)).")"; $sql .= " GROUP BY type, trans_no"; } -//_vd($sql); return db_query($sql." ORDER BY due_date", "Cannot retreive alloc to transactions"); } diff --git a/purchasing/includes/purchasing_db.inc b/purchasing/includes/purchasing_db.inc index 98308576..86a84181 100644 --- a/purchasing/includes/purchasing_db.inc +++ b/purchasing/includes/purchasing_db.inc @@ -130,7 +130,7 @@ function get_po_prepayments($supp_trans) FROM ".TB_PREF."supp_allocations allocs LEFT JOIN ".TB_PREF."purch_order_details line ON line.order_no=allocs.trans_no_to AND trans_type_to=".ST_PURCHORDER." WHERE line.po_detail_item IN(".implode(',', array_values($line_ids)).")"; -//_vd($sql); + $result = db_query($sql, "Cannot retrieve po prepayments"); while($dat = db_fetch($result)) diff --git a/purchasing/includes/ui/grn_ui.inc b/purchasing/includes/ui/grn_ui.inc index 5d2c25a2..a0ab2c48 100644 --- a/purchasing/includes/ui/grn_ui.inc +++ b/purchasing/includes/ui/grn_ui.inc @@ -13,8 +13,8 @@ function display_grn_summary(&$po) { - global $Refs; - start_table(TABLESTYLE2, "width='90%'"); + + start_table(TABLESTYLE2, "width='90%'"); start_row(); label_cells(_("Supplier"), $po->supplier_name, "class='tableheader2'"); @@ -45,7 +45,7 @@ function display_grn_summary(&$po) function edit_grn_summary(&$po) { global $Refs; - + start_outer_table(TABLESTYLE2, "width='80%'"); table_section(1); @@ -74,8 +74,6 @@ function edit_grn_summary(&$po) date_row(_("Date Items Received"), 'DefaultReceivedDate', '', true, 0, 0, 0, '', true); table_section(3); - // currently this is related order supp reference -// ref_row(_("Supplier's Reference"), 'supp_ref', _("Supplier's Reference")); label_row(_("Supplier's Reference"), $po->supp_ref); label_row(_("Delivery Address"), $po->delivery_address); diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index 11ebbf7e..7470300d 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -63,7 +63,6 @@ function copy_to_trans(&$supp_trans) { foreach ( $supp_trans->gl_codes as $gl_line) { - ////////// 2009-08-18 Joe Hunt if (!is_tax_account($gl_line->gl_code) || $supp_trans->tax_included) $supp_trans->ov_amount += $gl_line->amount; } @@ -86,11 +85,6 @@ function invoice_header(&$supp_trans) if ($supp_trans->trans_type == ST_SUPPCREDIT && $supp_trans->src_docs) { -// $trans = get_supp_trans($_POST['invoice_no'], ST_SUPPINVOICE); -// $trans = get_supp_trans($supp_trans->supplier_id, ST_SUPPINVOICE); -// $_POST['supplier_id'] = $trans['supplier_id']; -// $supp = $trans['supplier_name'] . " - " . $trans['SupplierCurrCode']; - $_POST['supplier_id'] = $supp_trans->supplier_id; $supp = $supp_trans->supplier_name." - ".$supp_trans->currency; label_row(_("Supplier:"), $supp.hidden('supplier_id', $_POST['supplier_id'], false)); @@ -218,7 +212,7 @@ function display_gl_controls(&$supp_trans, $k) amount_cells(null, 'amount'); if ($dim < 1) text_cells_ex(null, 'memo_', 35, 50, null, null, null, hidden('dimension_id', 0, false).hidden('dimension2_id', 0, false)); - else if ($dim < 2) + elseif ($dim < 2) text_cells_ex(null, 'memo_', 35, 50, null, null, null, hidden('dimension2_id', 0, false)); else text_cells_ex(null, 'memo_', 35, 50, null, null, null); @@ -282,7 +276,7 @@ function display_gl_items(&$supp_trans, $mode=0) $dim = get_company_pref('use_dimension'); if ($dim == 2) $th = array(_("Account"), _("Name"), _("Dimension")." 1", _("Dimension")." 2", _("Amount"), _("Memo")); - else if ($dim == 1) + elseif ($dim == 1) $th = array(_("Account"), _("Name"), _("Dimension"), _("Amount"), _("Memo")); else $th = array(_("Account"), _("Name"), _("Amount"), _("Memo")); @@ -325,7 +319,6 @@ function display_gl_items(&$supp_trans, $mode=0) label_cell(""); } end_row(); - /////////// 2009-08-18 Joe Hunt if ($mode > 1) { if ($supp_trans->tax_included || !is_tax_account($entered_gl_code->gl_code)) $total_gl_value += $entered_gl_code->amount; @@ -364,7 +357,7 @@ function display_grn_items_for_selection(&$supp_trans, $k) { // only invoiced if (isset($_POST['receive_begin']) && isset($_POST['receive_end'])) $result = get_grn_items(0, $supp_trans->supplier_id, false, true, 0, $_POST['receive_begin'], $_POST['receive_end']); - else if ($supp_trans->src_docs) + elseif ($supp_trans->src_docs) $result = get_grn_items(0, $supp_trans->supplier_id, false, true, array_keys($supp_trans->src_docs)); else $result = get_grn_items(0, $supp_trans->supplier_id, false, true); diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index c0770d3e..55690ee3 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -353,12 +353,10 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) $id = find_submit('Edit'); if (($id != -1) && $line_no == $id) { -// hidden('line_no', $id); $_POST['stock_id'] = $order->line_items[$id]->stock_id; $dec = get_qty_dec($_POST['stock_id']); $_POST['qty'] = qty_format($order->line_items[$id]->quantity, $_POST['stock_id'], $dec); - //$_POST['price'] = price_format($order->line_items[$id]->price); $_POST['price'] = price_decimal_format($order->line_items[$id]->price, $dec2); if ($order->trans_type == ST_PURCHORDER) $_POST['req_del_date'] = $order->line_items[$id]->req_del_date; @@ -373,7 +371,6 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) text_cells(null,'item_description', null, 45, 150); else { hidden('item_description', $_POST['item_description']); -// label_cell($_POST['item_description']); label_cell($order->line_items[$id]->item_description); } @@ -382,11 +379,9 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) } else { -// hidden('line_no', ($_SESSION['PO']->lines_on_order + 1)); - //Chaitanya : Manufcatured item can be purchased + // Manufcatured item can be purchased stock_items_list_cells(null, 'stock_id', null, false, true, false, true, array('editable' => 30)); - //stock_purchasable_items_list_cells(null, 'stock_id', null, false, true, true); if (list_updated('stock_id')) { $Ajax->activate('price'); $Ajax->activate('units'); @@ -399,7 +394,6 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) $dec = $item_info["decimals"]; $_POST['qty'] = number_format2(get_purchase_conversion_factor ($order->supplier_id, $_POST['stock_id']), $dec); - //$_POST['price'] = price_format(get_purchase_price ($order->supplier_id, $_POST['stock_id'])); $_POST['price'] = price_decimal_format(get_purchase_price ($order->supplier_id, $_POST['stock_id']), $dec2); if ($order->trans_type == ST_PURCHORDER) $_POST['req_del_date'] = add_days(Today(), $SysPrefs->default_receival_required_by()); @@ -420,7 +414,6 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) else amount_cells(null, 'price', null, null, null, $dec2); - //$line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100); $line_total = round(input_num('qty') * input_num('price'), user_price_dec()); amount_cell($line_total, false, '','line_total'); diff --git a/purchasing/manage/suppliers.php b/purchasing/manage/suppliers.php index 49261dcb..6e2867ff 100644 --- a/purchasing/manage/suppliers.php +++ b/purchasing/manage/suppliers.php @@ -285,7 +285,6 @@ start_form(); if (db_has_suppliers()) { start_table(false, "", 3); -// start_table(TABLESTYLE_NOBORDER); start_row(); supplier_list_cells(_("Select a supplier: "), 'supplier_id', null, _('New supplier'), true, check_value('show_inactive')); diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index 4a5aa39d..4362ea16 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -106,8 +106,6 @@ if (isset($_GET['AddedID'])) $clearing_act = get_company_pref('grn_clearing_act'); if ($clearing_act) display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Journal Entries for this Delivery")), 1); -// not yet -// display_note(print_document_link($trans_no, _("&Print This GRN"), true, $trans_type), 0, 1); hyperlink_params("$path_to_root/purchasing/supplier_invoice.php", _("Entry purchase &invoice for this receival"), "New=1"); @@ -128,9 +126,6 @@ if (isset($_GET['AddedID'])) display_note(get_trans_view_str($trans_type, $trans_no, _("&View this Invoice")), 0); -// not yet -// display_note(print_document_link($trans_no, _("&Print This Invoice"), true, $trans_type), 0, 1); - display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Journal Entries for this Invoice")), 1); hyperlink_params("$path_to_root/purchasing/supplier_payment.php", _("Entry supplier &payment for this invoice"), @@ -302,7 +297,6 @@ function handle_add_new_item() if ($allow_update) { - $myrow = db_fetch($result); $_SESSION['PO']->add_to_order (count($_SESSION['PO']->line_items), $_POST['stock_id'], input_num('qty'), get_post('stock_id_text'), //$myrow["description"], input_num('price'), '', // $myrow["units"], (retrived in cart) @@ -325,8 +319,6 @@ function handle_add_new_item() function can_commit() { - global $Refs; - if (!get_post('supplier_id')) { display_error(_("There is no supplier selected.")); @@ -358,6 +350,8 @@ function can_commit() { if (!check_reference(get_post('ref'), $_SESSION['PO']->trans_type)) { + _vd("bad reference"); + exit; set_focus('ref'); return false; } @@ -388,7 +382,7 @@ function can_commit() set_focus('StkLocation'); return false; } - if (!db_has_currency_rates($_SESSION['PO']->curr_code, $_POST['OrderDate'])) + if (!db_has_currency_rates($_SESSION['PO']->curr_code, $_POST['OrderDate'], true)) return false; if ($_SESSION['PO']->order_has_items() == false) { diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index d8cfca98..fcd7348b 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -131,7 +131,7 @@ function check_po_changed() { /*Now need to check that the order details are the same as they were when they were read into the Items array. If they've changed then someone else must have altered them */ - // Sherifoz 22.06.03 Compare against COMPLETED items only !! + // Compare against COMPLETED items only !! // Otherwise if you try to fullfill item quantities separately will give error. $result = get_po_items($_SESSION['PO']->order_no); @@ -161,7 +161,7 @@ function check_po_changed() function can_process() { - global $SysPrefs, $Refs; + global $SysPrefs; if (count($_SESSION['PO']->line_items) <= 0) { diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index 8a0ab8cb..35012f29 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -53,7 +53,6 @@ if (isset($_GET['New'])) $_SESSION['supp_trans']->trans_type = ST_SUPPCREDIT; $_SESSION['supp_trans']->trans_no = 0; $_SESSION['supp_trans']->supp_reference = ''; - // $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no']; $help_context = "Supplier Credit Note"; $_SESSION['page_title'] = _("Supplier Credit Note"); @@ -161,7 +160,7 @@ if (isset($_POST['AddGLCodeToTrans'])) { function check_data() { - global $Refs, $SysPrefs; + global $SysPrefs; if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { diff --git a/purchasing/view/view_po.php b/purchasing/view/view_po.php index 550bec05..e84e4e33 100644 --- a/purchasing/view/view_po.php +++ b/purchasing/view/view_po.php @@ -154,7 +154,7 @@ if (db_num_rows($invoice_result) > 0) echo ""; end_table(1); // outer table -//_vd($purchase_order); + display_allocations_to(PT_SUPPLIER, $purchase_order->supplier_id, ST_PURCHORDER, $purchase_order->order_no, $total + $tax_total); //---------------------------------------------------------------------------------------------------- diff --git a/reporting/rep709.php b/reporting/rep709.php index 9ee5ef2c..824a65db 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -57,7 +57,6 @@ function getTaxTransactions($from, $to) AND taxrec.tran_date >= '$fromdate' AND taxrec.tran_date <= '$todate' ORDER BY taxrec.trans_type, taxrec.tran_date, taxrec.trans_no, taxrec.ex_rate"; -//display_error($sql); return db_query($sql,"No transactions were returned"); } -- 2.30.2