コード例 #1
0
	public function indexAction()
	{
		$projectId =$this->_getProjectId();
		$errorMsg = null;
		$cps = new Pment_Models_CpMapper();
		$addForm = new Pment_Forms_CpSave();
		$contractors = new Contract_Models_ContractorMapper();
		$addForm->submit->setLabel("添加");
		$contractors->populateContractors($addForm);

		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			$array = $cps->dataValidator($formData,$projectId);
			$trigger = $array['trigger'];
			$errorMsg = $array['errorMsg'];
			if($trigger == 0)
			{
				$cp = new Pment_Models_Cp();
				$cp->setProjectId($projectId);
				$cp->setContractorId($formData['contractorId']);
				$cps->save($cp);
				$errorMsg = "添加成功";
				}
			}
		$condition = 'projectId';
		$key = $projectId;
		$arrayCps = $cps->fetchAllJoin($key,$condition);
		if(count($arrayCps) != 0)
		{
			$pageNumber = $this->_getParam('page');
			$arrayCps->setCurrentPageNumber($pageNumber);
			$arrayCps->setItemCountPerPage('20');
			}
		$this->view->addForm = $addForm;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
		$this->view->arrayCps = $arrayCps;
		$this->view->errorMsg = $errorMsg;
	}
コード例 #2
0
	public function editAction()
	{
		$editForm = new Contract_Forms_ContrqualifSave();
		$editForm->submit->setLabel("保存修改");
		$editForm->submit2->setAttrib('class','hide');
		$editForm->getElement('contractorId')->setAttrib('class','hide');
		$editForm->getElement('contractorId')->setLabel('');
		
		$contrqualifs = new Contract_Models_ContrqualifMapper();
		$condition = 0;
		$serie = "施工总承包";
		$contrqualifs->populateContrqualifDd($editForm,$condition,$serie); 
		$cqId = $this->_getParam('id',0);
		$addForm = $contrqualifs->formValidator($editForm,1);
		if($this->getRequest()->isPost())
		{
			$formData=$this->getRequest()->getPost();
			$editForm->getElement('qualifTypeId')->setRegisterInArrayValidator(false);
			if($editForm->isValid($formData))
			{
				$contrqualif = new Contract_Models_Contrqualif();
				$contrqualif->setCqId($cqId);				
				$contrqualif->setContractorId($editForm->getValue('contractorId'));
				$contrqualif->setQualifTypeId($editForm->getValue('qualifTypeId'));
				$contrqualif->setQualifGrade($editForm->getValue('qualifGrade'));
				$result = $contrqualifs->save($contrqualif);
				$this->_redirect('/contract/index/display/id/'.$editForm->getValue('contractorId'));
				}
				else
				{
					$editForm->populate($formData); 
					}
			}
			else
			{
				if($cqId>0)
				{
					$arrayContrqualif = $contrqualifs->findArrayContrQualif($cqId);
					$condition = 1;
					$serie = (string)$arrayContrqualif['qualifSerie'];
					$contrqualifs->populateContrqualifDd($editForm,$condition,$serie);
					$editForm->populate($arrayContrqualif);
					}
					else
					{
						$this->_redirect('/contract/contrqualif');
						}
				}
				
		$contractorId = $editForm->getValue('contractorId');
		$this->view->contractorId = $contractorId;
		$contractors = new Contract_Models_ContractorMapper();
		$contractorName = $contractors->findContractorName($contractorId);
		$this->view->contractorName = $contractorName;		
		$this->view->editForm=$editForm;
		$this->view->cqId=$cqId;
		}
コード例 #3
0
	public function displayAction()
	{
		$contractors = new Contract_Models_ContractorMapper();
		$id = $this->_getParam('id',0);
		if($id >0)
		{
			$contract = new Contract_Models_Contractor();
			$contractors->find($id,$contract);
			$contrqualifs = new Contract_Models_ContrqualifMapper();
			$condition = 'contractorId';
			$arrayContrqualifs = $contrqualifs->fetchAllJoin($id,$condition);
			$this->view->arrayContrqualifs = $arrayContrqualifs;
			$this->view->contract = $contract;
			}
			else
			{
				$this->_redirect('/contract');
				}
		}
コード例 #4
0
	public function populateContrqualifDd($form,$condition,$serie)
	{
		if($condition == 0)
		{
			$contractors = new Contract_Models_ContractorMapper();
			$arrayContractors = $contractors->fetchAllContractorIds();
			
			foreach($arrayContractors as $contr)
			{
				$form->getElement('contractorId')->addMultiOption($contr->getContractorId(),$contr->getName());
				}
			}
		$qualifTypes = new General_Models_QualifTypeMapper();
		$arrayQualifTypes = $qualifTypes->fetchAllBySerie($serie);
		foreach($arrayQualifTypes as $qualif)
		{
			$form->getElement('qualifTypeId')->addMultiOption($qualif->getTypeId(),$qualif->getName());
			}
	}
コード例 #5
0
	public function find($id,Pment_Models_Subcontract $subcontract)
	{
		$resultSet = $this->getDbTable()->find($id);

		if (0 == count($resultSet)) {

			return;
		}

		$row = $resultSet->current();
		$subcontract->setScontrId($row->scontrId)
				->setProjectId($row->projectId)
				->setScontrType($row->scontrType)
				->setContractorId($row->contractorId)
				->setContent($row->content)
				->setDetail($row->detail)
				->setQuality($row->quality)
				->setStartDateExp($row->startDateExp)
				->setEndDateExp($row->endDateExp)
				->setPeriodExp($row->periodExp)
				->setStartDateAct($row->startDateAct)
				->setEndDateAct($row->endDateAct)
				->setPeriodAct($row->periodAct)
				->setBrConContr($row->brConContr)
				->setBrResContr($row->brResContr)
				->setBrConSContr($row->brConSContr)
				->setBrResSContr($row->brResSContr)
				->setContrAmt($row->contrAmt)
				->setGuarantee($row->guarantee)
				->setPrjMargin($row->prjMargin)
				->setPrjWarr($row->prjWarr)
				->setRemark($row->remark)
				->setCTime($row->cTime);

		$contractors = new Contract_Models_ContractorMapper();
		$contractorName = $contractors->findContractorName($subcontract->getContractorId());
		$subcontract->setContractorName($contractorName);
	}