Esempio n. 1
0
 public function createtercerosopajaxAction()
 {
     try {
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             //1. create operation
             $mapper = new Gyuser_Model_OperationsDataMapper();
             $Obj = new Gyuser_Model_Operations();
             $Obj->setClient_id($request->client_id);
             //format date to yyyy-mm-dd
             list($Day, $Month, $Year) = explode('/', $request->date);
             $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
             $realDate = date("Y-m-d", $stampeddate);
             $Obj->setDate($realDate);
             $Obj->setAmount($request->total_amount);
             $Obj->setTasa_porcentual($request->tasa_anual);
             /*
                             $Obj->setState($request->state);
                             $Obj->setObservations($request->observations);
                             $Obj->setCave_id($request->cave);
                             $Obj->setBank_account_id($request->bank_account_id);                
                             if ($request->id)
                $Obj->setId($request->id);      
             * 
             */
             $chequesList = $request->cheques_list;
             $opId = $mapper->createTercerosOp($Obj, $chequesList);
             $mapper = new Gyuser_Model_AdminDataMapper();
             $mapper->sendPedidoInformesOpTerceros($opId);
             if (!$opId) {
                 throw Exception("Hubo un error al crear la operación de cheques de terceros.");
             }
             echo $opId;
             // return op id so that it counts as success
         } else {
             throw Exception("Hubo un error al enviar el formulario.");
         }
     } catch (Exception $e) {
         echo $e;
     }
 }