public function ajaxStockIssueTempAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $stock_batch = new Model_StockBatch();
     $stock_detail = new Model_StockDetail();
     $form_values = array();
     $start = 0;
     $end = $this->_request->getParam('counter', 10);
     $form = new Form_AddStockIssue();
     $form->addRows($start, $end);
     $em = Zend_Registry::get('doctrine');
     $em->getConnection()->beginTransaction();
     try {
         if ($this->_request->isPost()) {
             if ($form->isValid($this->_request->getPost())) {
                 $stock_master = new Model_StockMaster();
                 $temp = $form->getValues();
                 $form_values['counter'] = $end;
                 $form_values['transaction_type_id'] = 2;
                 $form_values['adjustment_type'] = 2;
                 //$form_values['stock_master_id'] = $this->_request->stock_master_id;
                 $data = array_merge($temp, $form_values);
                 $stock_id = $stock_master->addStockMasterTemp($data);
                 // need to dynamic
                 $form_values['type'] = 'd';
                 $form_values['stock_master_id'] = $stock_id;
                 $form_values['counter'] = $end;
                 $form_values['transaction_type_id'] = 2;
                 $form_values['counter'] = $end;
                 $data = array_merge($temp, $form_values);
                 $detail_id = $stock_detail->addStockDetailTempValidation($data);
                 //  echo $detail_id;
                 //  exit;
             }
         }
         $em->getConnection()->commit();
     } catch (Exception $e) {
         $em->getConnection()->rollback();
         $em->close();
     }
     if ($detail_id) {
         echo '1';
     } else {
         return FALSE;
     }
 }