Exemplo n.º 1
0
	public function save(Pment_Models_Material $material) 
	{
		$data = array(
			'mtrId' => $material->getMtrId(),
			'planId' => $material->getPlanId(),
			'type' => $material->getType(),
			'mName' => $material->getMName(),
			'unit' => $material->getUnit(),
			'spec' => $material->getSpec(),
			'amount' => $material->getAmount(),
			'amountc' => $material->getAmountc(),
			'amountf' =>$material->getAmountf(),
			'cost' => $material->getCost(),
			'costTotal' => $material->getCostTotal(),
			'budget' => $material->getBudget(),
			'budgetTotal' => $material->getBudgetTotal(),
			'inDate' => $material->getInDate(),
			'remark' => $material->getRemark(),
			'vendorName' =>$material->getVendorName()
			);
		if (null === ($id = $material->getMtrId())) {
			unset($data['mtrId']);
			return $this->getDbTable()->insert($data);
		} else {
			return $this->getDbTable()->update($data, array('mtrId = ?' => $material->getMtrId()));
		}
	}