public function consolidateAction()
 {
     try {
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $lMapper = new Gyuser_Model_LiquidacionesDataMapper();
             $pdlObj = new Gyuser_Model_Liquidaciones();
             $liquidaciones_id = (int) $request->id;
             if ($liquidaciones_id) {
                 $cMapper = new Gyuser_Model_ChequesDataMapper();
                 $cObj = new Gyuser_Model_Cheques();
                 $cObj->setLiquidacion_id($liquidaciones_id);
                 $chequesList = $cMapper->UpdateLiquidacionDeleted($cObj);
                 $cMapper = new Gyuser_Model_OperationsDataMapper();
                 $pObj = new Gyuser_Model_Operations();
                 $pObj->setLiquidacion_id($liquidaciones_id);
                 $opertationsList = $cMapper->UpdateLiquidacionDeleted($pObj);
             }
             $pdlObj->setId($liquidaciones_id);
             $pdlObj->setDate($request->date);
             $pdlObj->setCurrent_account_balance($request->current_account_balance);
             $pdlObj->setAmount_payed($request->amount_payed);
             $pdlObj->setPrevious_account_balance(floatval($request->previous_account_balance));
             $pdlObj->setProvider_id($request->provider_id);
             $pdlObj->setCheques_json($request->cheques_json);
             $pdlObj->setOperations_json($request->operations_json);
             $pdlObj->setRejected_cheques_json($request->rejected_cheques_json);
             $pdlObj->setAcreditacion($request->acreditacion);
             $pdlObj->setTasa_anual($request->tasa_anual);
             $pdlObj->setImpuesto_al_cheque($request->impuesto_al_cheque);
             $pdlObj->setAcreditacion_capital($request->acreditacion_capital);
             $pdlObj->setAcreditacion_interior($request->acreditacion_interior);
             $pdlObj->setGastos_general($request->gastos_general);
             $pdlObj->setGastos_interior($request->gastos_interior);
             if ($request->committed) {
                 $pdlObj->setCommitted($request->committed);
             }
             $lMapper->consolidate($pdlObj);
             $this->_helper->redirector('index', 'liquidaciones', 'gyuser', array('cave_id' => $request->cave_id));
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
 public function GetLiquidacionesBySupplierId(Gyuser_Model_Liquidaciones $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->from($table, array('id', 'date', 'current_account_balance', 'amount_payed', 'previous_account_balance', 'committed', 'checks_qty', 'average_days', 'total_bruto', 'impuesto_al_cheque_amt', 'intereses', 'gastos_interior', 'gastos_general', 'gastos_interior_fee', 'gastos_general_fee', 'gastos_varios', 'total_neto', 'impuesto_al_cheque', 'tasa_anual', 'acreditacion_capital', 'acreditacion_interior'));
     $select->where('status = ?', true);
     $select->where('credit_provider_id = ?', $obj->getCredit_provider_id());
     $select->order('date DESC');
     $resultSet = $table->fetchAll($select);
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new Gyuser_Model_Liquidaciones();
         $entry->setId($row->id);
         $entry->setDate(date("d/m/Y", strtotime($row->date)));
         $entry->setCurrent_account_balance($row->current_account_balance);
         $entry->setAmount_payed($row->amount_payed);
         $entry->setPrevious_account_balance($row->previous_account_balance);
         $entry->setCommitted($row->committed);
         $entry->setChecks_qty($row->checks_qty);
         $entry->setAverage_days($row->average_days);
         $entry->setTotal_bruto($row->total_bruto);
         $entry->setImpuesto_al_cheque_amt($row->impuesto_al_cheque_amt);
         $entry->setIntereses($row->intereses);
         $entry->setGastos_interior($row->gastos_interior);
         $entry->setGastos_general($row->gastos_general);
         $entry->setGastos_interior_fee($row->gastos_interior_fee);
         $entry->setGastos_general_fee($row->gastos_general_fee);
         $entry->setGastos_varios($row->gastos_varios);
         $entry->setTotal_neto($row->total_neto);
         $entry->setImpuesto_al_cheque($row->impuesto_al_cheque);
         $entry->setTasa_anual($row->tasa_anual);
         $entry->setAcreditacion_capital($row->acreditacion_capital);
         $entry->setAcreditacion_interior($row->acreditacion_interior);
         $entries[] = $entry;
     }
     return $entries;
 }