public function deleteliquidacionesAction()
 {
     try {
         $request = $this->getRequest();
         $liquidaciones_id = (int) $request->liquidaciones_id;
         if ($liquidaciones_id) {
             $lMapper = new Gyuser_Model_LiquidacionesDataMapper();
             $lObj = new Gyuser_Model_Liquidaciones();
             $lObj->setId($liquidaciones_id);
             $lList = $lMapper->GetLiquidacionesById($lObj);
             $provider_id = $lList['provider_id'];
             $pMapper = new Gyuser_Model_ProvidersDataMapper();
             $prov = new Gyuser_Model_Providers();
             $prov->setId($provider_id);
             $prov->setBalance(floatval($lList['previous_account_balance']));
             $pMapper->UpdateBalanceByReject($prov);
             $cMapper = new Gyuser_Model_ChequesDataMapper();
             $chequesList = $cMapper->UpdateLiquidacionDeleted($liquidaciones_id);
             $oMapper = new Gyuser_Model_OperationsDataMapper();
             $opertationsList = $oMapper->UpdateLiquidacionDeleted($liquidaciones_id);
             $cList = $lMapper->delete($lObj);
             if ($cList && $chequesList && $opertationsList) {
                 $result = '1';
             } else {
                 $result = '0';
             }
             $this->_helper->redirector('providers', 'liquidaciones', 'gyuser', array('provider_id' => $request->provider_id));
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
Пример #2
0
 public function getProviders()
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from('providers', array('id', 'name', 'email', 'balance', 'tasa_anual', 'impuesto_al_cheque', 'gastos_general', 'gastos_interior', 'gastos_denuncia', 'gastos_rechazo', 'acreditacion_capital', 'acreditacion_interior', 'gastos_menor_a_monto_1', 'gastos_menor_a_1', 'gastos_menor_a_monto_2', 'gastos_menor_a_2'));
     $select->joinLeft(array('cqu' => 'cheques'), 'cqu.provider_id = providers.id and cqu.status = 3 and cqu.rejected_liquidacion_id IS NULL', array('sum(amount) as rej_amount', 'sum(rejected_cost) as rej_cost'));
     //$select->where('cqu.status = ?', 3);
     //$select->where('cqu.rejected_liquidacion_id IS NULL');
     $select->where('providers.status = ?', true);
     $select->group('providers.id');
     $select->order('id ASC');
     $resultset = $table->fetchAll($select);
     $entires = array();
     foreach ($resultset as $row) {
         //$entry = new Gyuser_Model_SupplierOperations();
         $entry = new Gyuser_Model_Providers();
         $entry->setId($row->id);
         $entry->setName($row->name);
         $entry->setEmail($row->email);
         $entry->setBalance($row->balance);
         $entry->setTasa_anual($row->tasa_anual);
         $entry->setImpuesto_al_cheque($row->impuesto_al_cheque);
         $entry->setGastos_general($row->gastos_general);
         $entry->setGastos_interior($row->gastos_interior);
         $entry->setGastos_denuncia($row->gastos_denuncia);
         $entry->setGastos_rechazo($row->gastos_rechazo);
         $entry->setAcreditacion_capital($row->acreditacion_capital);
         $entry->setAcreditacion_interior($row->acreditacion_interior);
         $entry->setGastos_cheque_menor_a_1($row->gastos_menor_a_monto_1);
         $entry->setGastos_cheque_a_1($row->gastos_menor_a_1);
         $entry->setGastos_cheque_menor_a_2($row->gastos_menor_a_monto_2);
         $entry->setGastos_cheque_a_2($row->gastos_menor_a_2);
         $entry->setRej_check_amount(floatval($row->rej_amount) + floatval($row->rej_cost));
         $cMapper = new Gyuser_Model_ChequesDataMapper();
         $cObj = new Gyuser_Model_Cheques();
         $cObj->setStatus(4);
         $cObj->setProvider_id($row->id);
         $cAmount = $cMapper->GetTotalAmountByStats($cObj);
         $entry->setPassed_amount($cAmount);
         $entires[] = $entry;
     }
     return $entires;
 }
Пример #3
0
 public function providereditajaxAction()
 {
     try {
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_ProvidersDataMapper();
             $Obj = new Gyuser_Model_Providers();
             if ($request->id) {
                 $Obj->setId($request->id);
             }
             $Obj->setName($request->name);
             $Obj->setEmail($request->email);
             $Obj->setTasa_anual($request->tasa_anual);
             $Obj->setImpuesto_al_cheque($request->impuesto_al_cheque);
             $Obj->setGastos_interior($request->gastos_interior);
             $Obj->setGastos_general($request->gastos_general);
             $Obj->setGastos_denuncia($request->gastos_denuncia);
             $Obj->setGastos_rechazo($request->gastos_rechazo);
             $Obj->setAcreditacion_capital($request->acreditacion_capital);
             $Obj->setAcreditacion_interior($request->acreditacion_interior);
             $Obj->setGastos_cheque_menor_a_1($request->gastos_cheque_menor_a_1);
             $Obj->setGastos_cheque_a_1($request->gastos_cheque_a_1);
             $Obj->setGastos_cheque_menor_a_2($request->gastos_cheque_menor_a_2);
             $Obj->setGastos_cheque_a_2($request->gastos_cheque_a_2);
             $id = $mapper->update($Obj);
             if ($id) {
                 echo $id;
             } else {
                 echo "f";
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
 public function getProvData($liqId)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from($table, array('id', 'provider_id', 'date', 'impuesto_al_cheque', 'tasa_anual', 'acreditacion_capital', 'acreditacion_interior', 'gastos_general', 'gastos_interior', 'gastos_menor_a_monto_1', 'gastos_menor_a_1', 'gastos_menor_a_monto_2', 'gastos_menor_a_2', 'committed'));
     $select->join(array('prov' => 'providers'), 'liquidaciones.provider_id = prov.id', array('name as provider_name', 'email'));
     $select->where('liquidaciones.id = ?', $liqId);
     $row = $table->fetchRow($select);
     if ($row) {
         $prov = new Gyuser_Model_Providers();
         $prov->setId($row->id);
         $prov->setName($row->provider_name);
         $prov->setEmail($row->email);
         $prov->setImpuesto_al_cheque($row->impuesto_al_cheque);
         $prov->setTasa_anual($row->tasa_anual);
         $prov->setAcreditacion_capital($row->acreditacion_capital);
         $prov->setAcreditacion_interior($row->acreditacion_interior);
         $prov->setGastos_general($row->gastos_general);
         $prov->setGastos_interior($row->gastos_interior);
         $prov->setGastos_cheque_menor_a_1($row->gastos_menor_a_monto_1);
         $prov->setGastos_cheque_a_1($row->gastos_menor_a_1);
         $prov->setGastos_cheque_menor_a_2($row->gastos_menor_a_monto_2);
         $prov->setGastos_cheque_a_2($row->gastos_menor_a_2);
     }
     return $prov;
 }