public function killCowAction() { $request = $this->getRequest(); $options = $request->getPost(); if ($options['supplier_id']) { $Db = new Base_Db(); $transaction_nid = $Db->genCodeId('transaction_id_' . $options[supplier_id]); $options1['transactionId'] = $transaction_nid; $options1['status'] = 1; $options1['breed'] = $options['map_id1']; $options1['type'] = $options['map_id2']; $options1['color'] = $options['map_id3']; $options1['supplierId'] = $options['supplier_id']; $options1['sequenceNo'] = $Db->genCodeId('sequence_num'); $options1['tagNo'] = $Db->genCodeId('tag_num'); $options1['processStatus'] = 'Knocked'; $options1['knockedDate'] = date("Y-m-d"); $model = new Mps_Model_RawProduct($options1); $id = $model->save(); } else { $model1 = new Mps_Model_RawProduct(); $model = $model1->fetchRow("id='{$options['cow_id']}'"); $model->setBreed($options['map_id1']); $model->setType($options['map_id2']); $model->setColor($options['map_id3']); $model->setProcessStatus('Knocked'); $model->setKnockedDate(date("Y-m-d")); $id = $model->save(); } if ($id) { $this->_flashMessenger->addMessage(array('success' => 'Cow Knocked successfully!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/mps/knocking')); } else { $this->_flashMessenger->addMessage(array('error' => 'Failed to KNock Cow!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/knocking')); } }
public function ajaxGetSavePrintRawProductAction() { $request = $this->getRequest(); $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $Db = new Base_Db(); $transaction_nid = $Db->genCodeId('transaction_id'); $options = $request->getPost(); $options['transactionId'] = $transaction_nid; $options['status'] = 1; $i = 0; while ($options['num_cows']) { $options['sequenceNo'] = $Db->genCodeId('sequence_num'); $options['tagNo'] = $Db->genCodeId('tag_num'); $options['processStatus'] = 'Incoming'; $options['incomingDate'] = date("Y-m-d"); $model = new Mps_Model_RawProduct($options); $id = $model->save(); $options['num_cows']--; $i++; } echo Zend_Json::encode($id); }