コード例 #1
0
 public function GetCaveById(Gyuser_Model_OtherCaves $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from(array('ocs' => 'other_caves'), 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('ops' => 'operations'), 'ops.cave_id = ocs.id', array('cave_id', 'liquidacion_id'));
     $select->joinLeft(array('cqu' => 'cheques'), 'cqu.operation_id = ops.id ', array('sum(cqu.amount) as rej_amount', 'sum(cqu.rejected_cost) as rej_cost'));
     $select->where('cqu.status = ?', 3);
     $select->where('cqu.rejected_liquidacion_id is null');
     $select->where('ocs.status = ?', true);
     $select->where('ocs.id = ?', $obj->getId());
     $select->order('name ASC');
     $row = $table->fetchRow($select);
     if ($row) {
         $entry = new Gyuser_Model_OtherCaves();
         $entry->setId($row->id);
         $entry->setName($row->name);
         $entry->setEmail($row->email);
         $entry->setBalance($row->balance);
         $entry->setRej_check_amount(floatval($row->rej_amount) + floatval($row->rej_cost));
         $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);
         $cMapper = new Gyuser_Model_ChequesDataMapper();
         $cObj = new Gyuser_Model_Cheques();
         $cObj->setStatus(4);
         $cObj->setCave_id($row->cave_id);
         if (@$row->cave_id) {
             $cAmount = $cMapper->GetTotalAmountByCave($cObj);
             $entry->setPassed_amount($cAmount);
         }
         return $entry;
     } else {
         return null;
     }
 }
コード例 #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 dashboardAction()
 {
     try {
         $sessionNamespace = new Zend_Session_Namespace();
         if ($sessionNamespace->loginAuth == true) {
             $authDetail = $sessionNamespace->authDetail;
             $oprType = $authDetail->getType();
             $this->view->oprType = $oprType;
             $this->view->oprId = $authDetail->getId();
             if ($oprType == 1) {
                 /*
                 $cMapper = new Gyuser_Model_OtherCavesDataMapper();
                 $cObj = new Gyuser_Model_OtherCaves();
                 $cObj->setId(1);
                 $cList = $cMapper->GetCaveById($cObj);
                 $this->view->cList = $cList;
                 $sMapper = new Gyuser_Model_SupplierOperationsDataMapper();
                 $sList = $sMapper->GetAllSuppliers();
                 */
                 $pMapper = new Gyuser_Model_ProvidersDataMapper();
                 $this->view->pList = $pMapper->getProviders();
                 $cMapper = new Gyuser_Model_ChequesDataMapper();
                 $cObj = new Gyuser_Model_Cheques();
                 $cObj->setStatus(1);
                 $this->view->ctAmount = $cMapper->GetTotalAmountByStats($cObj);
                 $cObj->setStatus(4);
                 $this->view->cpAmount = $cMapper->GetTotalAmountByStats($cObj);
                 $sMapper = new Gyuser_Model_OperationsDataMapper();
                 $current_date = date('Y-m-d');
                 /*************************************** Operaciones widget values   *****************************/
                 $this->view->CurrentMonthHalfCave = $sMapper->GetOperationsAmount(findFirstAndLastDay($current_date), true);
                 $this->view->CurrentMonth = $sMapper->GetOperationsAmount(findFirstAndLastDay($current_date), true);
                 $this->view->CurrentQuarter = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfCurrentQuater($current_date), true);
                 $this->view->CurrentSemester = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfCurrentSemester($current_date), true);
                 $this->view->CurrentYear = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfCurrentYear($current_date), true);
                 $this->view->PrevMonthToDate = $sMapper->GetOperationsAmount(prevFirstAndCurrentDay($current_date), true);
                 $this->view->PrevQuaterToDate = $sMapper->GetOperationsAmount(findFirstAndLastCurrentDatesOfPrevQuater($current_date), true);
                 $this->view->PrevSemesterToDate = $sMapper->GetOperationsAmount(findFirstAndLastCurrentDatesOfPrevSemester($current_date), true);
                 $this->view->PrevYearToDate = $sMapper->GetOperationsAmount(findFirstAndLastCurrentDatesOfPrevYear($current_date), true);
                 $PrevMonthTotal = $sMapper->GetOperationsAmount(findPrevMonthFirstAndLastDay($current_date), true, true);
                 $PrevQuaterTotal = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfPrevQuater($current_date), true, true);
                 $PrevSemesterTotal = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfPrevSemester($current_date), true, true);
                 $PrevYearTotal = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfPrevYear($current_date), true, true);
                 $this->view->PrevMonthTotal = $PrevMonthTotal;
                 $this->view->PrevQuaterTotal = $PrevQuaterTotal;
                 $this->view->PrevSemesterTotal = $PrevSemesterTotal;
                 $this->view->PrevYearTotal = $PrevYearTotal;
                 $this->view->PrevMonthToDateAvg = $sMapper->GetOperationsAmountAvg(findPrevMonthFirstAndLastDay($current_date), findFirstAndLastDay($current_date), $PrevMonthTotal);
                 $this->view->PrevQuaterToDateAvg = $sMapper->GetOperationsAmountAvg(findFirstAndLastDatesOfPrevQuater($current_date), findFirstAndLastDatesOfCurrentQuater($current_date), $PrevQuaterTotal);
                 $this->view->PrevSemesterToDateAvg = $sMapper->GetOperationsAmountAvg(findFirstAndLastDatesOfPrevSemester($current_date), findFirstAndLastDatesOfCurrentSemester($current_date), $PrevSemesterTotal);
                 $this->view->PrevYearToDateAvg = $sMapper->GetOperationsAmountAvg(findFirstAndLastDatesOfPrevYear($current_date), findFirstAndLastDatesOfCurrentYear($current_date), $PrevYearTotal);
                 $OperationsAmountByPrevMonths = $sMapper->GetOperationsAmountByPrevMonths($current_date, 4);
                 $this->view->OperationsAmountByPrevMonths = json_encode($OperationsAmountByPrevMonths, JSON_FORCE_OBJECT);
                 /************************************ EOF Operaciones widget values   ***********************************/
                 $AmounByPayedCheques = $cMapper->GetAmounByPayedCheques();
                 $AmounByPayedCheques0To30Days = $cMapper->GetAmounByPayedCheques0To30Days();
                 $AmounByPayedCheques30To60Days = $cMapper->GetAmounByPayedCheques30To60Days();
                 $AmounByPayedCheques60To90Days = $cMapper->GetAmounByPayedCheques60To90Days();
                 $AmounByPayedCheques120Days = $cMapper->GetAmounByPayedCheques120Days();
                 $this->view->AmounByPayedCheques = $AmounByPayedCheques;
                 $this->view->AmounByPayedCheques0To30Days = $AmounByPayedCheques0To30Days;
                 $this->view->AmounByPayedCheques30To60Days = $AmounByPayedCheques30To60Days;
                 $this->view->AmounByPayedCheques60To90Days = $AmounByPayedCheques60To90Days;
                 $this->view->AmounByPayedCheques120Days = $AmounByPayedCheques120Days;
                 $AmounByChequesStatusAcredited = $cMapper->GetAmounByChequesStatusAcredited($current_date);
                 $ChequeAmountByPrevMonths = $cMapper->GetChequeAmountByPrevMonths($current_date, 4);
                 $this->view->AmounByChequesStatusAcredited = $AmounByChequesStatusAcredited;
                 $this->view->ChequeAmountByPrevMonths = $ChequeAmountByPrevMonths;
                 $RejectedChequesBalanceByCal = $cMapper->GetRejectedChequesBalanceByCal();
                 $PrecOfRejectedChequesByPassed = $cMapper->GetPrecOfRejectedChequesByPassed();
                 $RejectedChequesBalanceByCaves = $cMapper->getRejectedChequesBalance();
                 //GetRejectedChequesBalanceByCaves();
                 $RejectedChequesBalanceByCavesAndMonths = $cMapper->GetRejectedChequesBalanceByCavesAndMonths($current_date, 4);
                 /*
                 $AmounByPayedCheques0To30DaysByCaves = $cMapper->GetAmounByPayedCheques0To30DaysByCaves();
                 $AmounByPayedCheques30To60DaysByCaves = $cMapper->GetAmounByPayedCheques30To60DaysByCaves();
                 $AmounByPayedCheques60To90DaysByCaves = $cMapper->GetAmounByPayedCheques60To90DaysByCaves();
                 $AmounByPayedChequesAfter90DaysByCaves = $cMapper->GetAmounByPayedChequesAfter90DaysByCaves();
                 $this->view->AmounByPayedCheques0To30DaysByCaves = $AmounByPayedCheques0To30DaysByCaves;
                 $this->view->AmounByPayedCheques30To60DaysByCaves = $AmounByPayedCheques30To60DaysByCaves;
                 $this->view->AmounByPayedCheques60To90DaysByCaves = $AmounByPayedCheques60To90DaysByCaves;
                 $this->view->AmounByPayedChequesAfter90DaysByCaves = $AmounByPayedChequesAfter90DaysByCaves;
                 */
                 $this->view->amountsPassedByDates = $cMapper->getEachAmountPassedByDates();
                 $this->view->RejectedChequesBalanceByCal = $RejectedChequesBalanceByCal;
                 $this->view->PrecOfRejectedChequesByPassed = $PrecOfRejectedChequesByPassed;
                 $this->view->RejectedChequesBalanceByCaves = $RejectedChequesBalanceByCaves;
                 $this->view->RejectedChequesBalanceByCavesAndMonths = $RejectedChequesBalanceByCavesAndMonths;
             }
             /* notification tasks starts */
             $tasksModel = new Gyuser_Model_CRMTasks();
             $this->view->myTasks = $tasksModel->getMyTasks();
             //$this->view->pending = $tasksModel->getMyPendingTasks();
             if ($oprType == 1) {
                 $this->view->adminPending = $tasksModel->getMyPendingTasks(true);
                 $this->view->adminMonitor = $tasksModel->getAdminMonitor();
                 $this->view->completedTasks = FALSE;
             } else {
                 $this->view->adminPending = FALSE;
                 $this->view->adminMonitor = FALSE;
                 $this->view->completedTasks = $tasksModel->getCompletedTasks();
             }
             $this->view->oprType = $oprType;
             /* notification tasks ends */
         } else {
             $this->_helper->redirector('login', 'index', 'gyuser');
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
コード例 #4
0
 public function RejectedChequeBySupplierId(Gyuser_Model_Cheques $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from(array('cqu' => 'cheques'), array('id as cheque_id', 'operation_id', 'date as cheque_date', 'check_n', 'amount', 'local', 'liquidacion_id', 'status as cheque_status', 'rejected_cost', 'rejected_type', 'check_zip_code', 'credit_provider_id'));
     $select->joinLeft(array('lqs' => 'liquidaciones'), 'lqs.id = cqu.liquidacion_id');
     $select->joinLeft(array('ops' => 'operations'), 'cqu.operation_id = ops.id', array('client_id', 'bank_account_id'));
     $select->joinLeft(array('bas' => 'bank_accounts'), 'ops.bank_account_id = bas.id', array('bank_name'));
     $select->joinLeft(array('cls' => 'clients'), 'ops.client_id = cls.id', array('first_name', 'last_name'));
     $select->joinLeft(array('chqs' => 'cheques_status'), 'cqu.status = chqs.id', array('id as cheque_state_id', 'status_list'));
     $select->where('cqu.credit_provider_id = ?', $obj->getCredit_provider_id());
     //$select->where('ops.liquidacion_id IS NOT NULL');
     $select->where('cqu.status = ?', 3);
     //$select->where('cqu.local = ?', 1);
     //$select->where('cqu.date <= ?', date("Y-m-d"));
     $select->where('cqu.rejected_liquidacion_id IS NULL');
     //$select->where('cqu.status = ?', '');
     $select->order('cqu.id ASC');
     $resultSet = $table->fetchAll($select);
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new Gyuser_Model_Cheques();
         $entry->setId($row->cheque_id);
         $entry->setOperation_id($row->operation_id);
         $entry->setDate(date("d/m/Y", strtotime($row->cheque_date)));
         $entry->setCheck_n($row->check_n);
         $entry->setAmount($row->amount);
         $entry->setStatus($row->cheque_status);
         $entry->setRejected_gastos($row->rejected_cost);
         $entry->setRejected_type($row->rejected_type);
         $entry->setCheck_zip_code($row->check_zip_code);
         $entry->setLiquidacion_id($row->liquidacion_id);
         $entry->setCredit_provider_id($row->credit_provider_id);
         $clientObj = new Gyuser_Model_User();
         $clientObj->setFirst_name($row->first_name);
         $clientObj->setLast_name($row->last_name);
         $entry->setClients_obj($clientObj);
         $cheques_state_obj = new Gyuser_Model_ChequesStatus();
         $cheques_state_obj->setId($row->cheque_state_id);
         $cheques_state_obj->setStatus_list($row->status_list);
         $entry->setCheques_status_obj($cheques_state_obj);
         $_bank_accounts_obj = new Gyuser_Model_BankAccounts();
         $_bank_accounts_obj->setBank_name($row->bank_name);
         $entry->setBank_accounts_obj($_bank_accounts_obj);
         $entries[] = $entry;
     }
     return $entries;
 }