projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Quick Entries uses Tax Groups instead of Item Tax Types for calculating taxes (Please...
[fa-stable.git]
/
includes
/
db
/
manufacturing_db.inc
diff --git
a/includes/db/manufacturing_db.inc
b/includes/db/manufacturing_db.inc
index 9592fdaa172efee0a5fd8afd7bbe8847fa5e7ed9..1153010d725e78cb92f1b7592c999c6c6f7ba435 100644
(file)
--- a/
includes/db/manufacturing_db.inc
+++ b/
includes/db/manufacturing_db.inc
@@
-22,6
+22,8
@@
function get_demand_qty($stock_id, $location)
$result = db_query($sql,"No transactions were returned");
$row = db_fetch($result);
$result = db_query($sql,"No transactions were returned");
$row = db_fetch($result);
+ if ($row === false)
+ return 0;
return $row['QtyDemand'];
}
return $row['QtyDemand'];
}
@@
-34,7
+36,7
@@
function load_stock_levels($location)
$date = date2sql(Today());
$sql = "SELECT stock_id, SUM(qty) FROM ".TB_PREF."stock_moves WHERE tran_date <= '$date'";
$date = date2sql(Today());
$sql = "SELECT stock_id, SUM(qty) FROM ".TB_PREF."stock_moves WHERE tran_date <= '$date'";
- if ($location !=
null
) $sql .= " AND loc_code = '$location'";
+ if ($location !=
''
) $sql .= " AND loc_code = '$location'";
$sql .= " GROUP BY stock_id";
$result = db_query($sql, "QOH calulcation failed");
while ($row = db_fetch($result)) {
$sql .= " GROUP BY stock_id";
$result = db_query($sql, "QOH calulcation failed");
while ($row = db_fetch($result)) {
@@
-58,11
+60,11
@@
function stock_demand_manufacture($stock_id, $qty, $demand_id, $location, $level
}
$stock_qty = $qoh_stock[$stock_id];
if ($stock_qty == NULL) $stock_qty = 0;
}
$stock_qty = $qoh_stock[$stock_id];
if ($stock_qty == NULL) $stock_qty = 0;
- if ($qty < $stock_qty) return $demand;
+ if ($qty <
=
$stock_qty) return $demand;
$bom = $bom_list[$stock_id];
if ($bom == NULL) {
$sql = "SELECT parent, component, quantity FROM ".TB_PREF."bom WHERE parent = '$stock_id'";
$bom = $bom_list[$stock_id];
if ($bom == NULL) {
$sql = "SELECT parent, component, quantity FROM ".TB_PREF."bom WHERE parent = '$stock_id'";
- if ($location !=
''
) $sql .= " AND loc_code = '$location'";
+ if ($location !=
""
) $sql .= " AND loc_code = '$location'";
$result = db_query($sql, "Could not search bom");
$bom = array();
// Even if we get no results, remember that fact
$result = db_query($sql, "Could not search bom");
$bom = array();
// Even if we get no results, remember that fact