public function deleteData($where) { if ($where) { return Sdptd05denpyocom::deleteAll($where); } return false; }
public function deleteData($primaryKey = []) { $transaction = $this->getDb()->beginTransaction(); try { if (isset($primaryKey['cus_no']) && isset($primaryKey['car_no'])) { if ($obj = Sdptd02car::findOne([$primaryKey['cus_no'], $primaryKey['car_no']])) { if (!$obj->delete()) { $transaction->rollback(); return false; } } } $delete_job = Sdptd04denpyosagyo::deleteAll('D04_DEN_NO =' . $primaryKey['den_no']); $delete_product = Sdptd05denpyocom::deleteAll('D05_DEN_NO =' . $primaryKey['den_no']); if (!isset($delete_job) || !isset($delete_product)) { $transaction->rollback(); return false; } if ($obj = static::findOne($primaryKey['den_no'])) { if (!$obj->delete()) { $transaction->rollback(); return false; } } $insert = new Sdptw01deldenpyo(); $insert->setData(['W01_DEN_NO' => $primaryKey['den_no']]); if (!$insert->saveData()) { $transaction->rollback(); return false; } $transaction->commit(); return true; } catch (Exception $e) { $transaction->rollback(); } return false; }
public function getProduct($den_no) { $obj = new Sdptd05denpyocom(); $product_info = $obj->getData(['D05_DEN_NO' => $den_no]); $product = []; foreach ($product_info as $k => $v) { $product[$k]['D05_SURYO'] = $v['D05_SURYO']; $product[$k]['D05_TANKA'] = $v['D05_TANKA']; $product[$k]['D05_KINGAKU'] = $v['D05_KINGAKU']; $product[$k]['D05_COM_CD'] = $v['D05_COM_CD']; $product[$k]['D05_NST_CD'] = $v['D05_NST_CD']; $obj_sdptm05com = Sdptm05com::findOne([$v['D05_COM_CD'], $v['D05_NST_CD']]); $product[$k]['M05_COM_NAMEN'] = $obj_sdptm05com['M05_COM_NAMEN']; $product[$k]['M05_LIST_PRICE'] = $obj_sdptm05com['M05_LIST_PRICE']; } return $product; }