Пример #1
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;
     }
 }
Пример #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;
 }