Cleanup comments. Small bugfixes. Third run
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 8 Nov 2015 07:56:42 +0000 (08:56 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 8 Nov 2015 07:56:42 +0000 (08:56 +0100)
37 files changed:
install/index.php
inventory/adjustments.php
inventory/cost_update.php
inventory/includes/db/items_trans_db.inc
inventory/includes/db/items_units_db.inc
inventory/includes/inventory_db.inc
inventory/includes/item_adjustments_ui.inc
inventory/includes/stock_transfers_ui.inc
inventory/inquiry/stock_movements.php
inventory/manage/item_codes.php
inventory/manage/items.php
inventory/manage/sales_kits.php
inventory/purchasing_data.php
js/inserts.js
manufacturing/includes/db/work_order_issues_db.inc
manufacturing/includes/db/work_order_produce_items_db.inc
manufacturing/includes/db/work_orders_quick_db.inc
manufacturing/includes/work_order_issue_ui.inc
manufacturing/inquiry/bom_cost_inquiry.php
manufacturing/manage/bom_edit.php
manufacturing/search_work_orders.php
manufacturing/work_order_add_finished.php
manufacturing/work_order_entry.php
manufacturing/work_order_issue.php
purchasing/includes/db/grn_db.inc
purchasing/includes/db/po_db.inc
purchasing/includes/db/suppalloc_db.inc
purchasing/includes/purchasing_db.inc
purchasing/includes/ui/grn_ui.inc
purchasing/includes/ui/invoice_ui.inc
purchasing/includes/ui/po_ui.inc
purchasing/manage/suppliers.php
purchasing/po_entry_items.php
purchasing/po_receive_items.php
purchasing/supplier_credit.php
purchasing/view/view_po.php
reporting/rep709.php

index 56e8bb9d671f8a50258fb4c33a47996d029b98d2..2d67867b9cdfcf91e14c3d6d7411cca742d29376 100644 (file)
@@ -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'));
index 3d2c39baf1c1fc89a3794b834887a50335e60d21..f71bb9204dd9607e0bb08e2c7780d9d615f08d0f 100644 (file)
@@ -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();
 }
 
index be6a19e64e898b0c4576d2a849bfce5fd31971c6..efd99593f8a2bf1e60b3befe8d9895e9942b2f4d 100644 (file)
@@ -91,7 +91,6 @@ if (!isset($_POST['stock_id']))
 if (!$page_nested)
 {
        echo "<center>" . _("Item:"). "&nbsp;";
-       //echo stock_costable_items_list('stock_id', $_POST['stock_id'], false, true);
        echo stock_items_list('stock_id', $_POST['stock_id'], false, true);
 
        echo "</center><hr>";
index c0dff65cc34613e55d5dc0daa6274e908fb291f6..c12641463c4f3a50d67927e5d9b5b8222461f6ba 100644 (file)
@@ -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);
index ec6b8f5ff2729267e41785ff6f4c96841fac0abc..e1841f1cd8508a2fc8e1ae031639e5bd86fcae1f 100644 (file)
@@ -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
index e922102e1a8193fcfbf72c0af5950e06353f3402..901ddcfd9dae68c561c10c65f9135fce4e2c7c51 100644 (file)
@@ -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";
index 0bd5d2b75a22820a55b8a4e5596892bb0e57e145..4aa976cbbb5a269940db334c2f635bf28c59fcba 100644 (file)
@@ -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("&nbsp;");
 
index 3fd5110a2f839afdcacdfb265354cd5c17fc7a48..f3c0f5dcf167b2598ab3c9d6e46426f89d950d21 100644 (file)
@@ -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);
index 3efdfb4232d1522a26357f60ac37035d3389d048..363f4dc9b8d402ce65d864009ed56d57febfb12d 100644 (file)
@@ -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("<b>"._("Quantity on hand before") . " " . $_POST['AfterDate']."</b>", "align=center colspan=$header_span");
index ffbd942c0192caf5ad9b99ce5f96047982ea0db4..9fa68ebb43a813c4f252b4349d7f550909e3bd99 100644 (file)
@@ -102,9 +102,8 @@ if (!isset($_POST['stock_id']))
        $_POST['stock_id'] = get_global_stock_item();
 
 echo "<center>" . _("Item:"). "&nbsp;";
-//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 "<hr></center>";
 
index 449eae17b9fa74e949d37af419043dfadba77074..3725aca9e84b5d5fa783c142d3be74c05ebced4b 100644 (file)
@@ -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 .= "<img id='item_img' alt = '[".$_POST['NewStockID'].".jpg".
                        "]' src='".company_path().'/images/'.item_img_name($_POST['NewStockID']).
                        ".jpg?nocache=".rand()."'"." height='".$SysPrefs->pic_height."' border='0'>";
index 8fdf6bea294655f49bc14c7b054fdb53ed1c86a4..2f4066787f548658e938f07cb28bae179122d044 100644 (file)
@@ -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'];
index 4482a5faf517ddc75217002ad81755993537ce6f..d0302261ed86e5b857ff4e8cac0b3577e7ac28e3 100644 (file)
@@ -115,9 +115,8 @@ if (!isset($_POST['stock_id']))
 if (!$page_nested)
 {
        echo "<center>" . _("Item:"). "&nbsp;";
-       //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 "<hr></center>";
 }
 else
index 7da839936feac7c052de375bedc39557edf51e39..e1762dd37b1ba43836d72eb771fa70b16f8a8110 100644 (file)
@@ -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; x<ulist.length; x++){ //loop through each LI e
                var tab=ulist[x].getElementsByTagName("button")[0];
-//             if(tab.onclick==undefined) {
-// ?  var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
                    var url = tab.form.action
                    tab.onclick=function(){
                    if (!_hotkeys.alt && !tab.disabled)
@@ -487,24 +483,7 @@ var inserts = {
                        };
                }
        }
-/*     'tr.editrow': function(e) {
-                       e.onkeydown = function(ev) {
-                       ev = ev||window.event;
-                       key = ev.keyCode||ev.which;
-                       if(key == 13) {
-                         // Find & click additem/update button
-
-                       } else  if(key == 27) {
-                         return false;
-                       }
-               }
-
-       },
-*//*   '#msgbox': function(e) {
-       // this is to avoid changing div height after ajax update in IE7
-         e.style.display = e.innerHTML.length ? 'block' : 'none';
-       }
-*//* TODO
+/* TODO
        'a.date_picker':  function(e) {
            // this un-hides data picker for js enabled browsers
            e.href = date_picker(this.getAttribute('rel'));
index c374e581787290baa4ef0c086f0d61a7e9d55655..cfc581d29f19ffd6b4e8a865ae815cba8ba56307 100644 (file)
@@ -55,7 +55,7 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $w
                if ($to_work_order)
                        $item->quantity = -$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();
index e935d57dcab70ac5bcbf6103b9b5fbad39fadab5..111feb4ca29ea0121b6690d766c3913e96b5a331 100644 (file)
@@ -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);
 
index e7932edcac60d13b5965cc112c642f78bb833efa..4aa2a176a09d659af77efe37c26890c43c9dfbc2 100644 (file)
@@ -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);
index 45390e21b4e0e28dee849f80aa5afc926a532fca..936685abd9d6877742ed775be455d9c94a50d341 100644 (file)
@@ -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);
index 02605b5637ef1866fc68e298a2927b6439eb35d1..9b8f9d21db61406ef715f524119c9aa1d63bc1e3 100644 (file)
@@ -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);
index aca1d7610ff1f31d6348faceb8815637d018c38b..5d60f317848aac4fca39d6dca0ebc376a33e20ec 100644 (file)
@@ -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)
index 98b645b340e351d9b9810aa75d50732e08b7459e..f848a763ad31d1c000adb808c7942e66b678c9d6 100644 (file)
@@ -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']);
 }
 
index 8a9947a401a9e16e2e61f731a39cc3161e78773f..cec7ce78cdb067ecfa034f732a1b216b99af242e 100644 (file)
@@ -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'] == '')
index 6a27bfc2eb3df89e845d4cdcb60fdfb7ee3fa107..be602d93de0568b04d417b2f7f4f98b7afa55fb4 100644 (file)
@@ -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');
index 86e3677aa6670923d46ad71cc57e72a7d34fe933..025a91258c2dcfb7f76c398c90927b23c7ea9951 100644 (file)
@@ -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."));
index 3b29b75b04bc08e4e098f8b101d5b2224791c0a8..d3bed587e3c2bbdc65314ad1ca4bb6f8d1e5cfa1 100644 (file)
@@ -9,7 +9,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-//------------------- 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 = "";
index 9bc64d4c6208da34a53985290202581ad2572939..fbc3a8cc984987c496ea701ab153815266755063 100644 (file)
@@ -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
index 57e76b35fd23ca2ea23e132d842e93fd56ee5f4a..e8506bb04c6ff5101ae788730aa0bb03a861ad7c 100644 (file)
@@ -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");
 }
 
index 983085769894f972b327eda71eae97da4fc9dc34..86a8418152495d99fe828b55c56c36559fbd853a 100644 (file)
@@ -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))
index 5d2c25a2bc5ebe5437eecb527bc7ae0d7655c8e2..a0ab2c4822827b6c782e8d4e5eca198a8dd8841d 100644 (file)
@@ -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);
index 11ebbf7ed2f32f96b2ab75cd699c2f843164c511..7470300dd71b0118dfe51e07e8c24f02f3bed22b 100644 (file)
@@ -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);
index c0770d3ee3be57fda62c67869e78adf749cee7a6..55690ee3ac7ec83373e9896a43818e479a120b22 100644 (file)
@@ -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');
 
index 49261dcbd770c3ef6f3d4c0ca2eca63fe155ca78..6e2867ffaeb5729983d7f9f650c2bc91d770b39e 100644 (file)
@@ -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'));
index 4a5aa39dea106fac0d1171781303a6f8ecc8066e..4362ea1658c312709ee252064abde0661538a170 100644 (file)
@@ -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)
        {
index d8cfca98dc8c9ec9e719304d2a01cb115c365fa6..fcd7348b4e9b2fd72f3fa5153db533044c48892d 100644 (file)
@@ -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)
        {
index 8a0ab8cb49b3296385eda82b417bdadd162c0bda..35012f297532c3c22e0b16444a167928f86f53ec 100644 (file)
@@ -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())
        {
index 550bec056106cdbae890741c3bec6b70d54939a8..e84e4e33139039424ee3820a42c2d8164779d418 100644 (file)
@@ -154,7 +154,7 @@ if (db_num_rows($invoice_result) > 0)
 echo "</td></tr>";
 
 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);
 
 //----------------------------------------------------------------------------------------------------
index 9ee5ef2c3050f289c715a5dd21a46c2b32c49468..824a65dbd0b7d8b97637b0b31634f9c314ce4306 100644 (file)
@@ -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");
 }