Now have Work Centers per Work Order line item:
Also have number of setups required for WO and Std Cost update via overhead from same. So if WC cost (i.e., rate and/or time and/or capacity) is changed stock overhead value will also change.
Below is from WorkOrderReceive.php:
PHP Code:
//Check overhead cost value and update if it does not match Work Center setup value
$OvhdResult = DB_query("SELECT workcentres.setuphrs,
workcentres.overheadperhour,
workcentres.capacity,
woitems.qtyreqd
FROM workcentres
INNER JOIN woitems
ON workcentres.code=woitems.wccode
WHERE woitems.wo='". $_POST['WO'] . "'
AND woitems.stockid='" . $_POST['StockID'] . "'");
if (DB_num_rows($OvhdResult)>0){
$OvhdRow = DB_fetch_array($OvhdResult);
if ($OvhdRow['qtyreqd'] <= $OvhdRow['capacity']){
$QtySetups = 1; //Within capacity so only one setup required
} else {
$QtySetups = Round(($OvhdRow['qtyreqd'] / $OvhdRow['capacity'] + 0.999); //Qty setups
}
$OverheadCost = ($QtySetups * $OvhdRow['setuphrs'] * $OvhdRow['overheadperhour']) / $OvhdRow['qtyreqd'];
$ItemCostRow['overheadcost'] = $OverheadCost; //Set to cost of Work Centre setup
} else {
$ItemCostRow['overheadcost'] = 0; //Set to zero if Work Order has no Work Centre
}
Still have a lot of testing to do but seems sane. I assume Absorption/Recovery GL Account can be incorporated and implemented when timesheets are done...