コード例 #1
0
 public function SavePaymentForRejectedCheque(Gyuser_Model_Cobranzas $obj)
 {
     list($Day, $Month, $Year) = explode('/', $obj->getDate_paid());
     $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
     $Date_paid = date("Y-m-d", $stampeddate);
     $paymentType = $obj->getPayment_type();
     $data = array('client_id' => $obj->getClient_id(), 'operation_id' => $obj->getOperation_id(), 'cheque_id' => $obj->getCheque_id(), 'date_paid' => $Date_paid, 'paid_amount' => $obj->getPaid_amount(), 'previous_balance' => $obj->getPrevious_balance(), 'current_balance' => $obj->getCurrent_balance(), 'payment_type' => $obj->getPayment_type());
     $id = (int) $this->getDbTable()->insert($data);
     if ($id) {
         $chqMapper = new Gyuser_Model_ChequesDataMapper();
         $chqObj = new Gyuser_Model_Cheques();
         $chqObj->setBalance($obj->getCurrent_balance());
         $chqObj->setId($obj->getCheque_id());
         //$chqObj->setRejected_check_payment(1);
         $updateRes = $chqMapper->UpdateRejectedChequeBalance($chqObj);
         if ($paymentType == 2) {
             //cheque propio
             $newCheObj = $obj->getCheques_obj();
             $newCheRes = $chqMapper->InsertChequeForRejectedCheque($newCheObj);
             if (!$newCheRes) {
                 throw Exception('Error inserting cheque for rejected check on DB');
             }
         } elseif ($paymentType == 3) {
             //cheque de tercero
             $BankMapper = new Gyuser_Model_BankAccountsDataMapper();
             $newBankObj = $obj->getBank_accounts_obj();
             $newBankId = $BankMapper->save($newBankObj);
             if (!$newBankId) {
                 throw Exception('Error inserting bank account for rejected check on DB');
             }
             $newCheObj = $obj->getCheques_obj();
             $newCheObj->setRejected_bank_id($newBankId);
             $newCheRes = $chqMapper->InsertChequeForRejectedCheque($newCheObj);
             if (!$newCheRes) {
                 throw Exception('Error inserting cheque for rejected check on DB');
             }
         }
         if ($updateRes) {
             /// check if the operation has no pending checks, if it doesn't mark the whole operation as saldada
             $opMapper = new Gyuser_Model_OperationsDataMapper();
             $operationPayed = $opMapper->checkOperationSaldada($obj->getOperation_id());
             if ($operationPayed) {
                 $id = $opMapper->setOperationSaldada($obj->getOperation_id());
                 if (!$id) {
                     throw new Exception('There was an error updating the operation to operacion saldada');
                 }
             } else {
                 //op. not yet payed. Here we might have no checks in cobranza but we can still have pending checks because of date.
                 $operationInCobranza = $opMapper->checkOperationCobranza($obj->getOperation_id());
                 if (!$operationInCobranza) {
                     //no checks in cobranza
                     $id = $opMapper->setOperationEnCartera($obj->getOperation_id());
                     //get operation back to "cheques en cartera" state
                     if (!$id) {
                         throw new Exception('There was an error updating the operation to cheques en cartera');
                     }
                 }
             }
             /// check if the user has no more cobranzas ops, if it doesn't set it as active
             $clMapper = new Gyuser_Model_UserDataMapper();
             $cobranzasOp = $clMapper->checkCobranzasOp($obj->getClient_id());
             if (!$cobranzasOp) {
                 //FIX!! Gus asked to pass clients to active once they finish paying cobranzas
                 $id = $clMapper->setActiveClient($obj->getClient_id());
                 //$id = $clMapper->setPasiveClient($obj->getClient_id());
                 if ($id) {
                     $id = -1;
                 } else {
                     throw new Exception('There was an error setting the client to active');
                 }
             }
         } else {
             throw new Exception('There was an error updating the rejected check balance');
         }
     } else {
         throw new Exception('There was an error adding the new payment for rejected check');
     }
     return $id;
 }
コード例 #2
0
 public function getchequesbycaveidfilterajaxAction()
 {
     try {
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $this->_helper->layout->disableLayout();
             $this->_helper->viewRenderer->setNoRender();
             $cave_id = (int) $request->cave_id;
             $pos = (int) $request->pos;
             $liqDate = $request->liqDate;
             if ($cave_id) {
                 $cObj = new Gyuser_Model_Cheques();
                 $cObj->setCave_id($cave_id);
                 $cMapper = new Gyuser_Model_ChequesDataMapper();
                 $result = $cMapper->GetChequeDetailsByCaveIdJson($cObj, $pos, $liqDate);
                 if ($result) {
                     echo json_encode($result);
                 } else {
                     echo 'f';
                 }
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
コード例 #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 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;
     }
 }
コード例 #5
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;
 }
コード例 #6
0
 public function GetTotalAmountByCave(Gyuser_Model_Cheques $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from(array('ops' => 'operations'), array('cave_id', 'liquidacion_id'));
     $select->joinLeft(array('cqu' => 'cheques'), 'cqu.operation_id = ops.id', array('sum(cqu.amount) as total_amount'));
     $select->where('ops.cave_id = ?', $obj->getCave_id());
     $select->where('cqu.status = ?', $obj->getStatus());
     $row = $table->fetchRow($select);
     return $row->total_amount;
 }
コード例 #7
0
    public function CreatePDF(Gyuser_Model_User $obj, $typeid, $status, $operationid)
    {
        $clietid = $obj->getId();
        $param = array();
        if ($status) {
            $param = array('compress' => 0, 'Attachment' => 0);
        }
        switch ($typeid) {
            case 1:
                $mapper = new Gyuser_Model_UserDataMapper();
                $result = $mapper->ClientDetailsById($obj);
                $fn = $result->getFirst_name();
                $ln = $result->getLast_name();
                $dni = $result->GetDNI();
                $html = '<html><body>' . '<table style="font-size:30px;font-weight:bold;font-family:Helvetica,Arial;">' . '<tr>' . '<td>Nombre</td>' . '<td>: </td>' . "<td>{$fn}</td>" . '</tr>' . '<tr>' . '<td>Apellido</td>' . '<td>: </td>' . "<td>{$ln}</td>" . '</tr>' . '<tr>' . '<td>DNI</td>' . '<td>: </td>' . "<td>{$dni}</td>" . '</tr>' . '</table>' . '</body></html>';
                $dompdf = new DOMPDF();
                $dompdf->load_html($html);
                $dompdf->render();
                $dompdf->stream("Mutuo-1.pdf", $param);
                break;
            case 2:
                $mapper = new Gyuser_Model_UserDataMapper();
                $result = $mapper->ClientDetailsById($obj);
                $fn = $result->getFirst_name();
                $ln = $result->getLast_name();
                $dni = $result->GetDNI();
                $chequeObj = new Gyuser_Model_Cheques();
                $chequeObj->setOperation_id($operationid);
                $chequeMapper = new Gyuser_Model_ChequesDataMapper();
                $chequesList = $chequeMapper->GetChequeDetailsByUserId($chequeObj);
                $html = '<html>
					  <style>
                                        .cheques{
                                            width:100%;
                                            border:1px solid #ccc;
                                        }
                                            .cheques td,.cheques th{
                                                    border:2px solid #ccc;
                                                    font-family:Helvetica,Arial;
                                                    padding:10px;
        				}
        				.cheques th{
        					font-size:20px;
        					font-weight:bold;
        				}
        				.h1Txt{
        					text-decoration:underline;
        					font-family:Helvetica,Arial;
        				}
					  </style>

					  <body>' . '<table style="font-size:30px;font-weight:bold;font-family:Helvetica,Arial;">' . '<tr>' . '<td>Nombre</td>' . '<td>: </td>' . "<td>{$fn}</td>" . '</tr>' . '<tr>' . '<td>Apellido</td>' . '<td>: </td>' . "<td>{$ln}</td>" . '</tr>' . '<tr>' . '<td>DNI</td>' . '<td>: </td>' . "<td>{$dni}</td>" . '</tr>' . '</table><br/><br/>';
                if ($chequesList) {
                    $html .= '<table class="cheques"><tr><th>Fecha</th><th>Numero De Cheque</th><th>Importe</th></tr>';
                    foreach ($chequesList as $cheque) {
                        $html .= '<tr>';
                        $html .= '<td >' . $cheque['date'] . '</td>';
                        $html .= '<td >' . $cheque['check_n'] . '</td>';
                        $html .= '<td >' . $cheque['amount'] . '</td>';
                        $html .= '</tr>';
                    }
                    $html .= '</table>';
                }
                $html .= '</body></html>';
                $dompdf = new DOMPDF();
                $dompdf->load_html($html);
                $dompdf->render();
                $dompdf->stream("Mutuo-2.pdf", $param);
                break;
            case 3:
                $mapper = new Gyuser_Model_UserDataMapper();
                $result = $mapper->ClientDetailsById($obj);
                $fn = $result->getFirst_name();
                $ln = $result->getLast_name();
                $dni = $result->GetDNI();
                $telc = $result->getTel_cell_code() . ' ' . $result->getTel_cell();
                $tell = $result->getTel_lab_code() . ' ' . $result->getTel_lab();
                $telo = $result->getTel_otro_code() . ' ' . $result->getTel_otro();
                $telp = $result->getTel_part_code() . ' ' . $result->getTel_part();
                $chequeObj = new Gyuser_Model_Cheques();
                $chequeObj->setOperation_id($operationid);
                $chequeMapper = new Gyuser_Model_ChequesDataMapper();
                $chequesList = $chequeMapper->GetChequeDetailsByUserId($chequeObj);
                $addressMapper = new Gyuser_Model_AddressDataMapper();
                $addressObj = new Gyuser_Model_Address();
                $addressObj->setClient_id($clietid);
                $address = $addressMapper->GetDeliveryAddressByClientId($addressObj);
                $html = '<html>
					  <style>
					    .cheques{
					    	width:100%;
					    	border:1px solid #ccc;
					    }
					  	.cheques td,.cheques th{
					  		border:2px solid #ccc;
					  		font-family:Helvetica,Arial;
					  		padding:10px;
        				}
        				.cheques th{
        					font-size:20px;
        					font-weight:bold;
        				}
        				.address td{
        					font-family:Helvetica,Arial;
					  		padding:10px;
					  		font-size:20px;
        				}
					  </style>

					  <body>' . '<table style="font-size:30px;font-weight:bold;font-family:Helvetica,Arial;">' . '<tr>' . '<td>Nombre</td>' . '<td>: </td>' . "<td>{$fn}</td>" . '</tr>' . '<tr>' . '<td>Apellido</td>' . '<td>: </td>' . "<td>{$ln}</td>" . '</tr>' . '<tr>' . '<td>DNI</td>' . '<td>: </td>' . "<td>{$dni}</td>" . '</tr>' . '</table><br/><br/><h1 class="h1Txt">Cheques</h1>';
                if ($chequesList) {
                    $html .= '<table class="cheques"><tr><th>Fecha</th><th>Numero De Cheque</th><th>Importe</th></tr>';
                    foreach ($chequesList as $cheque) {
                        $html .= '<tr>';
                        $html .= '<td >' . $cheque['date'] . '</td>';
                        $html .= '<td >' . $cheque['check_n'] . '</td>';
                        $html .= '<td >' . $cheque['amount'] . '</td>';
                        $html .= '</tr>';
                    }
                    $html .= '</table>';
                }
                $html .= '<br/><br/><h1 class="h1Txt">Domicilios</h1>';
                if ($address) {
                    $str = '';
                    $jsonData = $address;
                    $id = $jsonData['id'];
                    $street = $jsonData['street'];
                    $city = $jsonData['city'];
                    $state = $jsonData['state'];
                    $state_name = $jsonData['state_name'];
                    $country = $jsonData['country'];
                    $html .= '<table class="address">' . '<tr>' . '<td width="100">Domicilio</td><td> : </td><td>' . $street . '</td>' . '</tr>' . '<tr>' . '<td>Barrio / Ciudad</td><td> : </td><td>' . $city . '</td>' . '</tr>' . '<tr>' . '<td>Provincia</td><td> : </td><td>' . $state_name . '</td>' . '</tr>' . '<tr>' . '<td>Tel�fono</td><td> : </td><td>' . $telc . '<br/>' . $tell . '<br/>' . $telo . '<br/>' . $telp . '<br/></td>' . '</tr>' . '</table>';
                }
                $html .= '</body></html>';
                $dompdf = new DOMPDF();
                $dompdf->load_html($html);
                $dompdf->render();
                $dompdf->stream("Mutuo-3.pdf", $param);
                break;
            default:
                break;
        }
    }
コード例 #8
0
    public function getLiquidacionesForPrint($liqId)
    {
        if ($liqId) {
            $lMapper = new Gyuser_Model_LiquidacionesDataMapper();
            $lObj = new Gyuser_Model_Liquidaciones();
            $lObj->setId($liqId);
            $lqList = $lMapper->GetLiquidacionesById($lObj);
            $html = '';
            $html .= '<h1>Liquidacion ' . $lqList['id'] . '</h1>
                        <table cellpadding="0" cellspacing="0" border="1">
                                <thead>
                                    <tr>
                                        <th>Id</th>
                                        <th>FECHA</th>
                                        <th>DEBE</th>
                                        <th>ACREDITACIONES</th>
                                        <th>IMPORTE PAGADO</th>
                                        <th>SALDO</th>
                                    </tr>
                                </thead>
                                   <tbody>';
            $html .= "<tr>\n                            <td>{$lqList['id']}</td>\n                            <td>{$lqList['date']}</td>\n                            <td>{$lqList['amount_debt']}</td>\n                            <td>{$lqList['acreditacion']}</td>\n                            <td>{$lqList['amount_payed']}</td>\n                            <td>{$lqList['current_account_balance']}</td>\n                    </tr>";
            $html .= '</tbody></table><br/>';
            $html .= '
                        <table cellpadding="0" cellspacing="0" border="1" >
                        <thead>
                                <tr>
                                    <td colspan="6" style="text-align:center">OPERACIONES COMPARTIDAS</td>
                                </tr>
                                <tr>
                                        <th>FECHA OP.</th>
                                        <th>NOMBRE</th>
                                        <th>TOTAL</th>
                                        <th>GY</th>
                                        <th>COMISIONES</th>
                                        <th>SALDO</th>
                                </tr>
                        </thead>
                           <tbody class="gridtbody">';
            $oMapper = new Gyuser_Model_OperationsDataMapper();
            $cObj = new Gyuser_Model_Operations();
            $cObj->setLiquidacion_id($liqId);
            $opertationsList = $oMapper->GetOperationsByLiquidacionIdJson($cObj);
            $pArr = $opertationsList;
            $strBld = '';
            $pay_final_amount = 0;
            if (count($pArr)) {
                foreach ($pArr as $pRow) {
                    $pay_final_amount += $pRow['prov_payment'];
                    $halfAmt = number_format($pRow['amount'] / 2, 2, '.', '');
                    $html .= "<tr >\n                                    <td>{$pRow['date']}</td>\n                                    <td>{$pRow['first_name']} {$pRow['last_name']}</td>\n                                    <td>{$pRow['amount']}</td>\n                                    <td>{$halfAmt}</td>                                   \n                                    <td>{$pRow['comision_amt']}</td>\n                                    <td>{$pRow['prov_payment']}</td>\n                            </tr>";
                }
            }
            $html .= '</tbody>
                            <tfoot>
                                <tr style="font-weight:bold"><td colspan="4">&nbsp;</td><td>TOTAL</td><td><span class="operationsTotal_span">' . $pay_final_amount . '/span></td></tr>
                            </tfoot>
                        </table><br />';
            $html .= '<table cellpadding="0" cellspacing="0" border="1" >
                        <thead>
                                <tr>
                                    <td colspan="6" style="text-align:center">CHEQUES RECHAZADOS</td>
                                </tr>
                                <tr>
                                        <th>TITULAR</th>
                                        <th>FECHA</th>
                                        <th>N. CHEQUE</th>
                                        <th>RECHAZOS</th>
                                        <th>GASTOS</th>
                                        <th>SALDO</th>
                                </tr>
                        </thead>
                        <tbody class="gridtbody">';
            $cMapper = new Gyuser_Model_ChequesDataMapper();
            $cObj = new Gyuser_Model_Cheques();
            $cObj->setLiquidacion_id($liqId);
            $cObj->setProvider_id($lqList['provider_id']);
            $pArr = $cMapper->RejectedChequeByLiquidacionesIdForProv($cObj);
            $strBld = '';
            $sName = '';
            $rejectedTotal = 0;
            //$rejectedChequesFee = number_format($rejectedChequesFee,2,'.','');
            if (count($pArr)) {
                foreach ($pArr as $pRow) {
                    $cObj->setRejected_type($pRow['rejected_type']);
                    $rejectedChequesFee = (int) $cMapper->GetRejectionCostForProv($cObj);
                    $amount = $pRow['amount'];
                    $rChequeWithFee = $amount + $rejectedChequesFee;
                    $rChequeWithFee = number_format($rChequeWithFee, 2, '.', '');
                    $rejectedTotal += $rChequeWithFee;
                    $pay_final_amount += $rChequeWithFee;
                    $rejectedChequesFee = number_format($rejectedChequesFee, 2, '.', '');
                    $strBld .= <<<EOT
                    <tr id="RejectedCheque_{$pRow['id']}" style="background:#E3E3E3;">
                        <td class="user_operation_id">{$pRow['first_name']} {$pRow['last_name']}</td>
                        <td class="user_check_n">{$pRow['date']}</td>
                        <td class="user_bank_name">{$pRow['check_n']}</td>
                        <td class="user_amount">{$amount}</td>
                        <td class="user_rejected_cheque_fee">{$rejectedChequesFee}</td>                                            
                        <td class="pay_amount_cls">{$rChequeWithFee}</td>
                    </tr>
EOT;
                }
            }
            $pay_final_amountInv = $pay_final_amount * -1;
            $pre_val = $pre_val * -1;
            $html .= $strBld;
            $html .= '  </tbody>
                        <tfoot>
                            <tr style="font-weight:bold"><td colspan="4">&nbsp;</td><td>TOTAL</td><td><span class="rejectedTotal_span">' . $rejectedTotal . '</span></td></tr>
                        </tfoot>
                    </table><br />';
            $html .= '<table id="operationGridADDst" class="totals-table">
                            <tr id="Acreditacion">
                                <td>Acreditaciones:</td>
                                <td>
                                    $ <input type="text" name="acreditacion" class="pay_amount_cls" value="" size="5" style="height:11px" />                                        
                                </td>
                            </tr>
                            <tr id="operationGridADDend">
                                <td>Importe a Liquidar:</td>
                                <td>
                                    <span class="pay_final_amount_span">' . $pay_final_amount . '</span>     
                                    <input type="hidden" id="pay_final_amount" value="' . $pay_final_amountInv . '" />
                                </td>
                            </tr>
                        </table><br />';
            /*
                        $rejectedCheques = $cMapper->RejectedChequeByLiquidacionesIdForProv($cObj);
                        $pArr = $rejectedCheques;
                        $rejectedChequesFee = 60.00;
                        $rejectedChequesFee = number_format($rejectedChequesFee, 2, '.', '');
            
                        if (count($pArr)) {
               $html .= '<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>-</td></tr>';
               foreach ($pArr as $pRow) 
               {
                   //$pRow	=	new Gyuser_Model_Cheques();
                   $amount = $pRow['amount'];
                   $rChequeWithFee = $amount + $rejectedChequesFee;
                   $rChequeWithFee = number_format($rChequeWithFee, 2, '.', '');
                   $pay_final_amount += $rChequeWithFee;
                   $html .= "<tr  style='background:#E3E3E3;'>
            					<td class='user_operation_id'>{$pRow['first_name']}<input type='hidden' value='}' name='operation_id'/></td>
            					<td class='user_date'></td>
            					<td class='user_check_n'></td>
            					<td class='user_bank_name'></td>
            					<td class='user_amount'>{$amount}</td>
            					<td class='user_rejected_cheque_fee'>{$rejectedChequesFee}</td>
            					<td class='user_bank_name'></td>
            					<td class='user_bank_name'>$rChequeWithFee</td>
            				</tr>";
               }                
               if (count($pArr)) 
               {
                   $html .= '<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>-</td></tr>';
                   $html .= '<tr><td style="height:20px"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>';
                   $pay_final_amount = number_format($pay_final_amount, 2, '.', '');
                   $html .= "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td style='background:#E3E3E3;'>SALDO EN CHEQUES</td><td style='background:#CCCCCC;'><b>$pay_final_amount</b><input type='hidden' id='pay_final_amount' value='$pay_final_amount' /></td></tr>";
                   $html .= "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td><input type='button' class='chooseChequesBtn jqButton' value='Choose Cheques'/></td><td></td></tr>";
               }
                        }
                        $html .= '</tbody></table>';
            * 
            * 
            */
            $html .= '<br /><br />
    <h1>CALCULO DE DESCUENTO - <span class="currentDate"></span></h1>
    <table  cellpadding="0" cellspacing="0" border="1" >
	<thead>
		<tr>
			<th>TITULAR</th>
			<th>EMPRESA</th>
			<th>FECHA</th>
			<th>N. CHEQUE</th>
			<th>IMPORTE</th>
			<th>CANT. DIAS</th>
			<th>IMP. AL CHEQUE</th>
			<th>DESCUENTO</th>
			<th>SALDO A HOY</th>
		</tr>
	</thead>
	   <tbody class="gridtbody">';
            $cMapper = new Gyuser_Model_ChequesDataMapper();
            $cObj = new Gyuser_Model_Cheques();
            $cObj->setLiquidacion_id($liqId);
            $chequesList = $cMapper->GetChequeDetailsByLiquidacionIdJson($liqId, $provData, $liqDate);
            $totalFinalAmount = 0;
            foreach ($chequesList as $cheques) {
                $item = $cheques;
                $cave_name = $item['first_name'];
                $amount = floatval($item['amount']);
                $check_n = $item['check_n'];
                $bank_name = $item['bank_name'];
                $date = $item['date'];
                $l_date = $item['liquidacion_date'];
                $acreditacion_hr = (int) $item['acreditacion_hrs'];
                $date = $item['date'];
                $date_arc = add_days_by_hr($date, $acreditacion_hr);
                $date_diff = dateDiff($l_date, $date_arc);
                $chqPer = $amount * 2.1 / 100;
                $discount = $amount * 0.17 / 100 * $date_diff;
                $finalAmount = $amount - $chqPer - $discount;
                $finalAmount = number_format($finalAmount, 2, '.', '');
                $amount = number_format($amount, 2, '.', '');
                $chqPer = number_format($chqPer, 2, '.', '');
                $discount = number_format($discount, 2, '.', '');
                $commision = number_format($commision, 2, '.', '');
                $totalFinalAmount += $finalAmount;
                $html .= "<tr>  \n                            <td>{$cave_name}</td>\n                            <td>{$date}</td>\n                            <td>{$amount}</td>\n                            <td>{$check_n}</td>\n                            <td>{$bank_name}</td>\n                            <td>{$date_diff}</td>\n                            <td>{$chqPer}</td>\n                            <td>{$discount}</td>\n                            <td>{$finalAmount}</td>\n                         </tr>";
            }
            $html .= '<tr><td style="height:20px"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>';
            $html .= "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td style='background:#E3E3E3;'>SALDO A LIQUIDAR</td><td style='background:#CCCCCC;'><b>{$totalFinalAmount}</b><input type='hidden' id='pay_final_amount' value='{$totalFinalAmount}' /></td></tr>";
            $html .= "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type='button' class='chooseChequesBtn jqButton' value='Choose Cheques'/></td><td></td></tr>";
            $html .= '</tbody></table>';
            echo $html;
        }
    }
コード例 #9
0
 public function OpTercerosStateChange($opId, $newStateId, $tasaAnual = null, $chequesListJson = null)
 {
     $success = 0;
     $obj = new Gyuser_Model_Operations();
     $obj->setId($opId);
     $opResult = $this->GetStateByOperationId($obj);
     $currentStateId = (int) $opResult['stateid'];
     if ($currentStateId < $newStateId) {
         switch ($newStateId) {
             case 2:
                 $data = array('state_order_id' => $obj->getState(), 'cave_id' => $obj->getCave_id());
                 break;
             case 3:
             case 4:
                 $data = array('state_order_id' => $obj->getState(), 'report' => $obj->getReport());
                 break;
             case 5:
                 //cerrada
                 $chequesMapper = new Gyuser_Model_ChequesDataMapper();
                 $informesCompletos = $chequesMapper->checkInformesCompletos($opId);
                 if ($informesCompletos) {
                     $data = array('state_order_id' => $newStateId);
                 }
                 break;
             case 6:
                 //op. en camino
                 $opAmount = 0;
                 $opTodayVal = 0;
                 $adminMapper = new Gyuser_Model_AdminDataMapper();
                 $admin = $adminMapper->getAdminSettings();
                 $prov = new Gyuser_Model_Providers();
                 $prov->setAcreditacion_capital($admin->getTiempo_ac_capital());
                 $prov->setAcreditacion_interior($admin->getTiempo_ac_interior());
                 $prov->setGastos_general($admin->getGastos_general());
                 $prov->setGastos_interior($admin->getGastos_interior());
                 $prov->setImpuesto_al_cheque($admin->getImpuesto_al_cheque());
                 $prov->setTasa_anual($tasaAnual);
                 $chequesMapper = new Gyuser_Model_ChequesDataMapper();
                 $cheque = new Gyuser_Model_Cheques();
                 $cheques = $chequesMapper->GetChequesByOpId($opId);
                 //gets only cheques with status 7 (aprobados)
                 foreach ($cheques as $cheque) {
                     $cDetails = $chequesMapper->saveDetails($cheque->getId(), $prov);
                     $opAmount += $cDetails['amount'];
                     $opTodayVal += $cDetails['terceros_today_value'];
                 }
                 $data = array('amount' => $opAmount, 'amount_today' => $opTodayVal, 'ac_date' => date('Y-m-d'), 'tasa_porcentual' => $tasaAnual, 'state_order_id' => $newStateId);
                 break;
             case 9:
                 //consolidated / cheques en cartera
                 $chequesList = json_decode($chequesListJson);
                 $chequesMapper = new Gyuser_Model_ChequesDataMapper();
                 $chequesTotals = $chequesMapper->consolidateCheques($chequesList);
                 $data = array('amount' => $chequesTotals['amount'], 'amount_today' => $chequesTotals['todayValue'], 'state_order_id' => $newStateId);
                 break;
             case 99:
                 $chequesMapper = new Gyuser_Model_ChequesDataMapper();
                 $cheques = new Gyuser_Model_Cheques();
                 $cheques->setOperation_id($obj->getId());
                 $result = $chequesMapper->deleteByOperationId($cheques);
                 $data = array('state_order_id' => $obj->getState());
                 break;
             default:
                 $data = array('state_order_id' => $obj->getState());
                 break;
         }
         if ($data) {
             $id = (int) $obj->getId();
             $id = $this->getDbTable()->update($data, array('id = ?' => $id));
         }
         $success = 1;
     } elseif ($currentStateId >= $newStateId) {
         //new state is smaller or equal to current state
         $success = 2;
     }
     //2 = the state has already been changed.
     return $success;
 }