public function GetOperationsIdByClientId(Gyuser_Model_User $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->from($table, 'id');
     $select->where('client_id = ?', $obj->getId());
     $row = $table->fetchRow($select);
     return $row->id;
 }
    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;
        }
    }
Esempio n. 3
0
 public function findContacto(Gyuser_Model_User $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from(array('c' => 'clients'), array('id', 'contact_point', 'client_type'))->joinLeft(array('cp' => 'contact_point'), 'c.contact_point = cp.id', array('title as contact_title'))->joinLeft(array('ct' => 'client_types'), 'c.client_type = ct.id', array('name as type_name'))->where('c.id = ?', $obj->getId());
     $row = $table->fetchRow($select);
     $entry = array();
     if ($row) {
         $entry = array('client_type' => $row->client_type, 'contact_title' => $row->contact_title, 'type_name' => $row->type_name);
     }
     return $entry;
 }