public function findMtncJoin($mtnId,Vehicle_Models_Mtnc $mtnc) { $row = $this->getDbTable()->fetchRow('mtnId = '.$mtnId); if (0 == count($row)){ return; } $mtnc->setMtnId($row->mtnId) ->setVeId($row->veId) ->setRDate($row->rDate) ->setDetail($row->detail) ->setContactId($row->contactId) ->setMile($row->mile) ->setAmount($row->amount) ->setRemark($row->remark) ->setCTime($row->cTime); $veId = $mtnc->getVeId(); $vehicles = new Vehicle_Models_VehicleMapper(); $plateNo = $vehicles->findPlateNo($veId); $mtnc->setPlateNo($plateNo); $contacts = new Employee_Models_ContactMapper(); $contactName = $contacts->findContactName($mtnc->getContactId()); $mtnc->setContactName($contactName); }
public function findDrirecordJoin($recordId,Vehicle_Models_Drirecord $drirecord) { $row = $this->getDbTable()->fetchRow('recordId = '.$recordId); if (0 == count($row)) { return; } $drirecord->setRecordId($row->recordId) ->setVeId($row->veId) ->setRYear($row->rYear) ->setRMonth($row->rMonth) ->setMileEarly($row->mileEarly) ->setMileEnd($row->mileEnd) ->setMile($row->mile) ->setRemark($row->remark) ->setCTime($row->cTime); $veId = $drirecord->getVeId(); $vehicles = new Vehicle_Models_VehicleMapper(); $plateNo = $vehicles->findPlateNo($veId); $drirecord->setPlateNo($plateNo); }
public function editAction() { $editForm = new Vehicle_Forms_MtncSave(); $editForm->submit->setLabel('保存修改'); $editForm->submit2->setAttrib('class','hide'); $veId = $editForm->getElement('veId'); $veId->setAttrib('disabled','disabled'); $mtnId = $this->_getParam('id',0); $from = $this->_getParam('from',0); $mtncs = new Vehicle_Models_MtncMapper(); $mtncs->populateVeDd($editForm); $vId = $mtncs->findVeId($mtnId); $editForm = $mtncs->formValidator($editForm,1); $errorMsg = null; $link = null; if($from == 0) { $link = "/vehicle/mtnc"; } elseif($from == 1) { $link = '"/vehicle/index/display/id/'.$vId.'"'; } if($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if($editForm->isValid($formData)) { $array = $mtncs->dataValidator($formData,$mtnId,$vId,1); $trigger = $array['trigger']; $errorMsg = $array['errorMsg']; if($trigger == 0) { $mtnc = new Vehicle_Models_Mtnc(); $mtnc->setMtnId($mtnId); $mtnc->setVeId($vId); $mtnc->setRDate($editForm->getValue('rDate')); $mtnc->setDetail($editForm->getValue('detail')); $mtnc->setContactId($editForm->getValue('contactId')); $mtnc->setMile($editForm->getValue('mile')); $mtnc->setAmount($editForm->getValue('amount')); $mtnc->setRemark($editForm->getValue('remark')); $mtncs->save($mtnc); $veId = new Vehicle_Models_VehicleMapper(); $plateNo = $veId->findPlateNo($mtnc->getVeId()); $this->_helper->flashMessenger->addMessage($plateNo.'修改成功。'); $this->_redirect($link); } else { $editForm->populate($formData); $veId->setValue($vId); } } else { $editForm->populate($formData); $veId->setValue($vId); } } else { if($mtnId > 0) { $arrayMtnc = $mtncs->findArrayMtnc($mtnId); $editForm->populate($arrayMtnc); } else { $this->_redirect($link); } } $this->view->errorMsg = $errorMsg; $this->view->editForm = $editForm; $this->view->id = $mtnId; $this->view->blink = $link; }
public function editAction() { $projectId =$this->getProjectId(); $editForm = new Vehicle_Forms_VerecordSave(); $editForm->submit->setLabel('保存修改'); $editForm->submit2->setAttrib('class','hide'); $veId = $editForm->getElement('veId'); $veId->setAttrib('disabled','disabled'); $recordId = $this->_getParam('id',0); $verecords = new Vehicle_Models_VerecordMapper(); $verecords->populateVeDd($editForm); $vId = $verecords->findVeId($recordId); $editForm = $verecords->formValidator($editForm,1); $errorMsg = null; if($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if($editForm->isValid($formData)) { $array = $verecords->dataValidator($formData,$recordId,$vId,1); $trigger = $array['trigger']; $errorMsg = $array['errorMsg']; if($trigger == 0) { $verecord = new Vehicle_Models_verecord(); $verecord->setrecordId($recordId); $verecord->setVeId($vId); $verecord->setPrjFlag(1); $verecord->setProjectId($projectId); $verecord->setStartDate($editForm->getValue('startDate')); $verecord->setEndDate($editForm->getValue('endDate')); $verecord->setRoute($editForm->getValue('route')); $verecord->setMileBf($editForm->getValue('mileBf')); $verecord->setMileAf($editForm->getValue('mileAf')); $verecord->setPurpose($editForm->getValue('purpose')); $verecord->setUser($editForm->getValue('user')); $verecord->setMileRef($editForm->getValue('mileRef')); $verecord->setContactId($editForm->getValue('contactId')); $verecord->setAmount($editForm->getValue('amount')); $verecord->setRemark($editForm->getValue('remark')); $verecords->save($verecord); $veId = new Vehicle_Models_VehicleMapper(); $plateNo = $veId->findPlateNo($verecord->getVeId()); $this->_helper->flashMessenger->addMessage('对工程用车记录'.$plateNo.'修改成功。'); $this->_redirect('/pment/verecord'); } else { $editForm->populate($formData); $veId->setValue($vId); } } else { $editForm->populate($formData); $veId->setValue($vId); } } else { if($recordId > 0) { $arrayVerecord = $verecords->findArrayVerecord($recordId); $editForm->populate($arrayVerecord); } else { $this->_redirect('/pment/verecord'); } } $this->view->errorMsg = $errorMsg; $this->view->editForm = $editForm; $this->view->id = $recordId; }
public function editAction() { $editForm = new Vehicle_Forms_RepairSave(); $editForm->submit->setLabel('保存修改'); $editForm->submit2->setAttrib('class','hide'); $veId = $editForm->getElement('veId'); $veId->setAttrib('disabled','disabled'); $repId = $this->_getParam('id',0); $from = $this->_getParam('from',0); $repairs = new Vehicle_Models_RepairMapper(); $repairs->populateVeDd($editForm); $vId = $repairs->findVeId($repId); $editForm = $repairs->formValidator($editForm,1); $errorMsg = null; $link = null; if($from == 0) { $link = "/vehicle/repair"; } elseif($from == 1) { $link = '"/vehicle/index/display/id/'.$vId.'"'; } if($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if($editForm->isValid($formData)) { $array = $repairs->dataValidator($formData,1); $trigger = $array['trigger']; $errorMsg = $array['errorMsg']; if($trigger == 0) { $repair = new Vehicle_Models_Repair(); $repair->setRepId($repId); $repair->setVeId($vId); $repair->setRDate($editForm->getValue('rDate')); $repair->setReason($editForm->getValue('reason')); $repair->setDetail($editForm->getValue('detail')); $repair->setContactId($editForm->getValue('contactId')); $repair->setSpot($editForm->getValue('spot')); $repair->setDescr($editForm->getValue('descr')); $repair->setAmount($editForm->getValue('amount')); $repair->setInsFlag($editForm->getValue('insFlag')); if($editForm->getValue('insFlag') == '1') { $repair->setIndem($editForm->getValue('indem')); } else { $repair->setIndem(''); } $repair->setIndem($editForm->getValue('indem')); $repair->setRemark($editForm->getValue('remark')); $repairs->save($repair); $veId = new Vehicle_Models_VehicleMapper(); $plateNo = $veId->findPlateNo($repair->getVeId()); $this->_helper->flashMessenger->addMessage($plateNo.'修改成功。'); $this->_redirect($link); } else { $editForm->populate($formData); $veId->setValue($vId); } } else { $editForm->populate($formData); $veId->setValue($vId); } } else { if($repId > 0) { $arrayRepair = $repairs->findArrayRepair($repId); $editForm->populate($arrayRepair); } else { $this->_redirect($link); } } $this->view->errorMsg = $errorMsg; $this->view->editForm = $editForm; $this->view->id = $repId; $this->view->blink = $link; }
public function addAction() { $drirecords = new Vehicle_Models_DrirecordMapper(); $addForm = new Vehicle_Forms_DrirecordSave(); $addForm->submit->setLabel('保存继续新建'); $addForm->submit2->setLabel('保存返回上页'); $errorMsg = null; $drirecords->populateVeDd($addForm); $drirecords->populateDate($addForm); $addForm = $drirecords->formValidator($addForm,0); if($this->getRequest()->isPost()) { $btClicked = $this->getRequest()->getPost('submit'); $formData = $this->getRequest()->getPost(); if($addForm->isValid($formData)) { $array = $drirecords->dataValidator($formData,null,$addForm->getValue('veId'),0); $trigger = $array['trigger']; $errorMsg = $array['errorMsg']; if($trigger == 0) { $drirecord = new Vehicle_Models_Drirecord(); $drirecord->setVeId($addForm->getValue('veId')); $drirecord->setRYear($addForm->getValue('rYear')); $drirecord->setRMonth($addForm->getValue('rMonth')); $drirecord->setMileEarly($addForm->getValue('mileEarly')); $drirecord->setMileEnd($addForm->getValue('mileEnd')); $drirecord->setRemark($addForm->getValue('remark')); $drirecords->save($drirecord); $errorMsg = General_Models_Text::$text_save_success; if($btClicked == '保存继续新建') { $addForm->reset(); } else { $veId = new Vehicle_Models_VehicleMapper(); $plateNo = $veId->findPlateNo($drirecord->getVeId()); $this->_helper->flashMessenger->addMessage($plateNo.'创建成功。'); $this->_redirect('/vehicle/drirecord'); } } else { $addForm->populate($formData); } } else { $addForm->populate($formData); } } $this->view->errorMsg = $errorMsg; $this->view->addForm = $addForm; }
public function findVerecordJoin($recordId,Vehicle_Models_Verecord $verecord) { $row = $this->getDbTable()->fetchRow('recordId = '.$recordId); if (0 == count($row)){ return; } $verecord->setRecordId($row->recordId) ->setVeId($row->veId) ->setPrjFlag($row->prjFlag) ->setProjectId($row->projectId) ->setStartDate($row->startDate) ->setEndDate($row->endDate) ->setPeriod($row->period) ->setRoute($row->route) ->setMileBf($row->mileBf) ->setMileAf($row->mileAf) ->setMile($row->mile) ->setPurpose($row->purpose) ->setContactId($row->contactId) ->setUser($row->user) ->setMileRef($row->mileRef) ->setAmount($row->amount) ->setRemark($row->remark) ->setCTime($row->cTime); $veId = $verecord->getVeId(); $vehicles = new Vehicle_Models_VehicleMapper(); $plateNo = $vehicles->findPlateNo($veId); $verecord->setPlateNo($plateNo); $contacts = new Employee_Models_ContactMapper(); $contactName = $contacts->findContactName($verecord->getContactId()); $verecord->setContactName($contactName); if($verecord->getPrjFlag() == '0') { $verecord->setPrjFlag(General_Models_Text::$text_verecord_prjFlag_false); $verecord->setProjectName(General_Models_Text::$text_verecord_prjFlag_false); } elseif($verecord->getPrjFlag() == '1') { $verecord->setPrjFlag(General_Models_Text::$text_verecord_prjFlag_true); $projects = new Project_Models_ProjectMapper(); $verecord->setProjectName($projects->findProjectName($verecord->getProjectId())); } }
public function findRepairJoin($repId,Vehicle_Models_Repair $repair) { $row = $this->getDbTable()->fetchRow('repId = '.$repId); if (0 == count($row)){ return; } $repair->setRepId($row->repId) ->setVeId($row->veId) ->setRDate($row->rDate) ->setReason($row->reason) ->setDetail($row->detail) ->setContactId($row->contactId) ->setSpot($row->spot) ->setDescr($row->descr) ->setAmount($row->amount) ->setInsFlag($row->insFlag) ->setIndem($row->indem) ->setRemark($row->remark) ->setCTime($row->cTime); if($repair->getInsFlag() == 1) { $repair->setInsFlag(General_Models_Text::$text_repair_indem_true); } else { $repair->setInsFlag(General_Models_Text::$text_repair_indem_false); } $veId = $repair->getVeId(); $vehicles = new Vehicle_Models_VehicleMapper(); $plateNo = $vehicles->findPlateNo($veId); $repair->setPlateNo($plateNo); $contacts = new Employee_Models_ContactMapper(); $contactName = $contacts->findContactName($repair->getContactId()); $repair->setContactName($contactName); }
public function editAction() { $veId = $this->_getParam('id',0); $editForm = new Vehicle_Forms_VehicleSave(); $vehicles = new Vehicle_Models_VehicleMapper(); $editForm->submit->setLabel('保存修改'); $editForm->submit2->setAttrib('class','hide'); $plateNoEl = $editForm->getElement('plateNo'); $plateNoEl->setAttrib('disabled','disabled'); $plateNo = $vehicles->findPlateNo($veId); $plateNoEl->setValue($plateNo); $editForm = $vehicles->formValidator($editForm,1); $errorMsg = null; if($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if($editForm->isValid($formData)) { $array = $vehicles->dataValidator($formData,1); $trigger = $array['trigger']; $errorMsg = $array['errorMsg']; if($trigger == 0) { $vehicle = new Vehicle_Models_Vehicle(); $vehicle->setVeId($veId); $vehicle->setPlateNo($plateNo); $vehicle->setName($editForm->getValue('name')); $vehicle->setColor($editForm->getValue('color')); $vehicle->setLicense($editForm->getValue('license')); $vehicle->setContactId($editForm->getValue('contactId')); $vehicle->setPilot($editForm->getValue('pilot')); $vehicle->setUser($editForm->getValue('user')); $vehicle->setFuelCons($editForm->getValue('fuelCons')); $vehicle->setPrice($editForm->getValue('price')); $vehicle->setBrand($editForm->getValue('brand')); $vehicle->setPDate($editForm->getValue('pDate')); $vehicle->setRemark($editForm->getValue('remark')); $vehicles->save($vehicle); $this->_helper->flashMessenger->addMessage('对'.$plateNo.'的修改成功。'); $this->_redirect('/vehicle'); } else { $editForm->populate($formData); $plateNoEl->setValue($plateNo); } } else { $editForm->populate($formData); $plateNoEl->setValue($plateNo); } } else { if($veId > 0) { $arrayVehicle = $vehicles->findArrayVehicle($veId); $editForm->populate($arrayVehicle); } else { $this->_redirect('/vehicle'); } } $this->view->errorMsg = $errorMsg; $this->view->editForm = $editForm; $this->view->id = $veId; }