public function ajaxGetSupplierCowAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $supplier_id = $this->_getParam('id');
     $rowObj = new Mps_Model_RawProduct();
     $subgroups = $rowObj->fetchRow("supplier_id = '{$supplier_id}' AND process_status = 'Incoming'");
     if (false === $subgroups) {
         $arrResult = array("result" => 0);
     } else {
         $arrResult = array("result" => $subgroups->getId());
     }
     echo Zend_Json::encode($arrResult);
 }
 public function changeProcessStatusAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->_getParam('id');
     $oldstatus = $this->_getParam('oldstatus');
     if (!empty($id) && !empty($oldstatus)) {
         $model1 = new Mps_Model_RawProduct();
         $model = $model1->fetchRow("id='{$id}'");
         if ($model !== false && $model->getProcessStatus() == $oldstatus) {
             //Incoming/Knocking/Killed/Compliance/BloodStation/Weighing
             $flag = 0;
             if ($oldstatus == 'Incoming') {
                 $status = 'Knocking';
             } else {
                 if ($oldstatus == 'Knocking') {
                     $status = 'Killed';
                 } else {
                     if ($oldstatus == 'Killed') {
                         $status = 'Compliance';
                     } else {
                         if ($oldstatus == 'Compliance') {
                             $status = 'BloodStation';
                         } else {
                             if ($oldstatus == 'BloodStation') {
                                 $status = 'Weighing';
                             } else {
                                 if ($oldstatus == 'Weighing') {
                                     $status = 'Complete';
                                 } else {
                                     $arrResult = array("result" => 0);
                                     $flag = 1;
                                 }
                             }
                         }
                     }
                 }
             }
             if ($flag == 0) {
                 $model->setStatus($status);
                 $res = $model->save();
                 $arrResult = array("result" => 1);
             }
         } else {
             $arrResult = array("result" => 0);
         }
     } else {
         $arrResult = array("result" => 0);
     }
     echo Zend_Json::encode($arrResult);
 }