コード例 #1
0
ファイル: CalemAssetDbo.php プロジェクト: smartqubit/calemeam
 public function beforeInsert($baseTable, $baseData, $customTable, $customData)
 {
     if (!isset($baseData['asset_no']) || !$baseData['asset_no']) {
         require_once _CALEM_DIR_ . 'server/modules/asset/CalemAssetBo.php';
         $asBo = new CalemAssetBo();
         $baseData['asset_no'] = $asBo->getNextAssetNo();
     }
     return $baseData;
 }
コード例 #2
0
 /**
  * Update schedUser 
  */
 public function updateWoLaborActual($woId, $hours, $cost)
 {
     $woDbo = CalemFactory::getDbo('workorder');
     $row = $woDbo->fetchById($woId);
     $ar = array();
     $ar['actual_labor_hours'] = $row['actual_labor_hours'] + $hours;
     $ar['actual_labor_hours'] = max(0, $ar['actual_labor_hours']);
     $ar['labor_cost'] = $row['labor_cost'] + $cost;
     $ar['labor_cost'] = max(0, $ar['labor_cost']);
     $ar['total_cost'] = $row['material_cost'] + $ar['labor_cost'];
     $woDbo->setChangeBulk($ar);
     $woDbo->setIdForUpdate($woId);
     $woDbo->update();
     //Now update asset
     $assetBo = new CalemAssetBo();
     $assetBo->updateLaborCost($row['asset_id'], $hours, $cost);
 }