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; } }
public function useraddressformajaxAction() { try { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); if ($this->getRequest()->isPost()) { $mapper = new Gyuser_Model_AddressDataMapper(); $Obj = new Gyuser_Model_Address(); $Obj->setStreet($request->street); $Obj->setCity($request->city); $Obj->setZip_code($request->zip_code); $Obj->setState($request->state); $Obj->setAddress_type($request->address_type); $Obj->setDelivery_address((int) $request->delivery_address); $Obj->setClient_id($request->client_id); if ($request->id != '') { $Obj->setId($request->id); } $id = $mapper->save($Obj); if ($id) { echo $id; } else { echo "f"; } } } catch (Exception $e) { echo $e; } }
public function DeleteClientDetails(Gyuser_Model_User $obj) { try { $table = $this->getDbTable(); $set = array('status' => 0); $where = array('id = ?' => $obj->getId()); $result = $table->update($set, $where); if ($result) { $addressMapper = new Gyuser_Model_AddressDataMapper(); $addressObj = new Gyuser_Model_Address(); $addressObj->setClient_id($obj->getId()); $addressMapper->DeleteClientAddress($addressObj); $bankMapper = new Gyuser_Model_BankAccountsDataMapper(); $bankObj = new Gyuser_Model_BankAccounts(); $bankObj->setUser_id($obj->getId()); $bankMapper->DeleteClientBankAccounts($bankObj); } return $result; } catch (Exception $e) { echo $e; } }