X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fdb%2Fmanufacturing_db.inc;h=93027b764b9f32e65beda3e463c4c6ba280ecfb8;hb=f3a1386748cd9250419b5ad03b95c56af2bb5f92;hp=0a4035f0ab2144a9b36321c41634ecaad5751367;hpb=a2ae0e35302270ae811db2e6acb44c16b186a970;p=fa-stable.git diff --git a/includes/db/manufacturing_db.inc b/includes/db/manufacturing_db.inc index 0a4035f0..93027b76 100644 --- a/includes/db/manufacturing_db.inc +++ b/includes/db/manufacturing_db.inc @@ -149,29 +149,14 @@ function get_on_porder_qty($stock_id, $location) function get_on_worder_qty($stock_id, $location) { - $sql = "SELECT SUM((wo.units_reqd-wo.units_issued) * (req.units_req-req.units_issued)) AS qoo - FROM ".TB_PREF."wo_requirements req - INNER JOIN ".TB_PREF."workorders wo ON req.workorder_id=wo.id - WHERE req.stock_id=".db_escape($stock_id) - ." AND wo.released=1"; - if ($location != "") - $sql .= " AND req.loc_code=".db_escape($location); - - $qoo_result = db_query($sql,"could not receive quantity on order for item"); - if (db_num_rows($qoo_result) == 1) - { - $qoo_row = db_fetch_row($qoo_result); - $qoo = $qoo_row[0]; - } - else - $qoo = 0.0; + $qoo = 0.0; $flag = get_mb_flag($stock_id); if ($flag == 'M') { $sql = "SELECT SUM((units_reqd-units_issued)) AS qoo FROM ".TB_PREF."workorders WHERE stock_id=".db_escape($stock_id) - ." AND released=1"; + ." AND released AND NOT closed"; if ($location != "") $sql .= " AND loc_code=".db_escape($location); @@ -180,7 +165,7 @@ function get_on_worder_qty($stock_id, $location) if (db_num_rows($qoo_result) == 1) { $qoo_row = db_fetch_row($qoo_result); - $qoo += $qoo_row[0]; + $qoo = $qoo_row[0]; } } return $qoo; @@ -222,8 +207,8 @@ function get_bom($item) $sql = "SELECT bom.*, loc.location_name, centre.name AS WorkCentreDescription, item.description, item.mb_flag AS ResourceType, - item.material_cost+item.labour_cost+item.overhead_cost AS standard_cost, units, - bom.quantity * (item.material_cost+ item.labour_cost+ item.overhead_cost) AS ComponentCost + item.material_cost AS ProductCost, units, + bom.quantity * item.material_cost AS ComponentCost FROM ".TB_PREF."workcentres centre, ".TB_PREF."locations loc, ".TB_PREF."bom bom