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 GetChequeForLiquidacionesForSupplier(Gyuser_Model_Cheques $obj) { $rejClientIds = $this->RejectedChequesClientIdsByDayCount($obj); $allRejClientIds = $this->RejectedChequesClientIds(); $rejClientIdArr = array(); foreach ($allRejClientIds as $row) { $rejClientIdArr[] = $row->client_id; } $suplChequeCount = $caveChequeCount = array(); if ($obj->getCredit_provider_id()) { $suplChequeCount = $this->ChequesCountBySupplierId($obj); } $chequeFCount = 2; $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')); $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', 'zip_code', 'state')); $select->joinLeft(array('cls' => 'clients'), 'ops.client_id = cls.id', array('first_name', 'last_name')); $select->joinLeft(array('add' => 'addresses'), 'cls.id = add.client_id', array('city', 'country')); $select->joinLeft(array('chqs' => 'cheques_status'), 'cqu.status = chqs.id', array('id as cheque_state_id', 'status_list')); //$select->where('ops.cave_id = ?', $obj->getCave_id()); $select->where('cqu.liquidacion_id IS NULL'); $select->where('cqu.date >= ?', date("Y-m-d")); $select->where('cqu.status = ?', 1); $select->group('cqu.id'); foreach ($caveChequeCount as $row) { if ((int) $row->cheque_count > $chequeFCount) { $select->where('cls.id != ?', $row->client_id); } } foreach ($suplChequeCount as $row) { if ((int) $row->cheque_count > $chequeFCount) { $select->where('cls.id != ?', $row->client_id); } } foreach ($rejClientIds as $row) { $select->where('cls.id != ?', $row->client_id); } $select->where('cqu.local = ?', true); $select->order('cqu.date 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->setRej_cheque_client_ids($rejClientIdArr); $entry->setCheck_zip_code($row->zip_code); $clientObj = new Gyuser_Model_User(); $clientObj->setFirst_name($row->first_name); $clientObj->setLast_name($row->last_name); $clientObj->setId($row->client_id); $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); $address_obj = new Gyuser_Model_Address(); $address_obj->setId($row->client_id); $address_obj->setCity($row->city); $address_obj->setCountry($row->country); $entry->setAddress_obj($address_obj); $_bank_accounts_obj = new Gyuser_Model_BankAccounts(); $_bank_accounts_obj->setBank_name($row->bank_name); $_bank_accounts_obj->setState($row->state); $entry->setBank_accounts_obj($_bank_accounts_obj); $entries[] = $entry; } return $entries; }
public function DeleteClientAddress(Gyuser_Model_Address $obj) { try { $table = $this->getDbTable(); $set = array('status' => 0); $where = array('client_id = ?' => $obj->getClient_id()); $result = $table->update($set, $where); return $result; } catch (Exception $e) { echo $e; } }
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 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; } }