$standard_cost = get_standard_cost($bom_item['component']);
$m_cost += ($bom_item['quantity'] * $standard_cost);
}
- $dec = user_price_dec();
- price_decimal_format($m_cost, $dec);
+ //$dec = user_price_dec();
+ //price_decimal_format($m_cost, $dec);
$sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
.db_escape($stock_id);
$result = db_query($sql);
function add_overhead_cost($stock_id, $qty, $date_, $costs)
{
- $dec = user_price_dec();
- price_decimal_format($costs, $dec);
+ //$dec = user_price_dec();
+ //price_decimal_format($costs, $dec);
if ($qty != 0)
$costs /= $qty;
$sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
function add_labour_cost($stock_id, $qty, $date_, $costs)
{
- $dec = user_price_dec();
- price_decimal_format($costs, $dec);
+ //$dec = user_price_dec();
+ //price_decimal_format($costs, $dec);
if ($qty != 0)
$costs /= $qty;
$sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
$result = db_query($sql);
$myrow = db_fetch($result);
$material_cost = $myrow['material_cost'];
- $dec = user_price_dec();
- price_decimal_format($material_cost, $dec);
+ //$dec = user_price_dec();
+ //price_decimal_format($material_cost, $dec);
//$qoh = get_qoh_on_date($stock_id, null, $date_);
$qoh = get_qoh_on_date($stock_id);
if ($qoh < 0)
return add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, $date_, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc);
begin_transaction();
+ $args = func_get_args();
+ $args = (object)array_combine(array('wo_ref', 'loc_code', 'units_reqd', 'stock_id',
+ 'type', 'date_', 'required_by', 'memo_', 'costs', 'cr_acc', 'labour', 'cr_lab_acc'), $args);
+ $args->woid = 0;
+ hook_db_prewrite($args, ST_WORKORDER);
add_material_cost($stock_id, $units_reqd, $date_);
$Refs->save(ST_WORKORDER, $woid, $wo_ref);
add_audit_trail(ST_WORKORDER, $woid, $date_);
+ $args->woid = $woid;
+ hook_db_postwrite($args, ST_WORKORDER);
commit_transaction();
return $woid;
$date_, $required_by, $memo_)
{
begin_transaction();
+ $args = func_get_args();
+ $args = (object)array_combine(array('woid', 'loc_code', 'units_reqd', 'stock_id',
+ 'date_', 'required_by', 'memo_'), $args);
+ hook_db_prewrite($args, ST_WORKORDER);
add_material_cost($_POST['old_stk_id'], -$_POST['old_qty'], $date_);
add_material_cost($stock_id, $units_reqd, $date_);
update_comments(ST_WORKORDER, $woid, null, $memo_);
add_audit_trail(ST_WORKORDER, $woid, $date_, _("Updated."));
+ hook_db_postwrite($args, ST_WORKORDER);
commit_transaction();
}
function delete_work_order($woid)
{
begin_transaction();
+ hook_db_prevoid(ST_WORKORDER, $woid);
add_material_cost($_POST['stock_id'], -$_POST['quantity'], $_POST['date_']);
function void_work_order($woid)
{
begin_transaction();
+ hook_db_prevoid(ST_WORKORDER, $woid);
$work_order = get_work_order($woid);
if (!($work_order["type"] == WO_ADVANCED))