public function onDataDeleted($table, $id) { $reqBo = new CalemReqBo(); $poBo = new CalemPoBo(); $poBo->updatePoCostById($this->row['po_id'], -1 * $this->row['line_cost']); $reqBo->removeAllReqItemFromPo($this->row['po_id'], $this->row['in_id']); }
/** * Status change cause req item changes */ public function onReqItemChanged($reqId, $sign) { $calemReqBo = new CalemReqBo(); $reqItemDbo = CalemFactory::getDbo('req_item'); try { $rows = $reqItemDbo->fetchBySqlParam('select * from req_item where req_id=?', $reqId); foreach ($rows as $row) { if ($row['qty']) { $calemReqBo->onReqItemChanged($row['in_id'], $reqId, $row['qty'] * $sign, $row['unit_cost'], $row['uom_id']); } } } catch (CalemDboDataNotFoundException $ex) { } }
public function onReqItemChange($inId, $reqId, $qty, $uc, $uom) { if ($this->isReqVoided($reqId)) { return; } $reqBo = new CalemReqBo(); $reqBo->onReqItemChanged($inId, $reqId, $qty, $uc, $uom); }
/** * Manual-gen a req */ public function manualGenOrderRequest($inId, $reqRow) { $inDbo = CalemFactory::getDbo('inventory'); $inRow = $inDbo->fetchById($inId); if (!$inRow['qty_to_order']) { return; } //In case it's processed already //Figure out the due date $initRow = $this->conf['in_order_gen']['req_manual']['init']; foreach ($initRow as $key => $val) { if (!$reqRow[$key]) { $reqRow[$key] = $val; } } $dueDate = $this->getReqDueDateByWo($inId); if ($dueDate) { $reqRow['due_date'] = CalemText::datetimeToDate($dueDate); } $reqRow['request_time'] = CalemText::getServerDateTime(); $reqBo = new CalemReqBo(); $reqId = $reqBo->createInOrderRequest($reqRow, $inId, $inRow['qty_to_order'], $inRow['uom_id']); }
public function removeAllReqFromPo($poId) { $poItemDbo = CalemFactory::getDbo('po_item'); try { $rows = $poItemDbo->fetchBySqlParam('select * from po_item where po_id=?', $poId); $reqBo = new CalemReqBo(); foreach ($rows as $row) { $reqBo->removeAllReqItemFromPo($poId, $row['in_id']); } } catch (CalemDboDataNotFoundException $ex) { } }