public function getchecksbyoperationidajaxAction() { try { $request = $this->getRequest(); if ($this->getRequest()->isPost()) { $operationid = $request->operation_id; $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $mapper = new Gyuser_Model_OperationsDataMapper(); $obj = new Gyuser_Model_Operations(); $obj->setId($operationid); $planid = $mapper->GetPlanIdByOperationId($obj); $interests_id = $mapper->GetInterestsIdByOperationId($obj); $mapper = new Gyuser_Model_ChequesDataMapper(); $chequesList = $mapper->GetChequeDetailsByOpId($operationid); $result['planid'] = $planid; $result['interests_id'] = $interests_id; $result['cheques'] = $chequesList; if ($result) { echo json_encode($result); } else { echo "f"; } } } catch (Exception $e) { echo $e; } }
public function sendPedidoInformesOpTerceros($opId) { try { $mapper = new Gyuser_Model_ChequesDataMapper(); $chequesList = $mapper->GetChequeDetailsByOpId($opId); $html = <<<EOT <style type="text/css"> .liq-table { border:1px solid #777; } .liq-table td, .liq-table th { border-top: 0px; border-right: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; border-left: 0px; border:1px solid #ccc; padding:3px 7px; font:12px Geneva, sans-serif; background-color:#fff; white-space:nowrap; } td.liq-header { background-color:#777; text-align:center; color:#fff; font:bold 13px Geneva, sans-serif; text-transform:uppercase; border-width:0; white-space:nowrap; } .liq-header2 td, .liq-header2 th{ background-color:#f7f7f7; } .liq-header3 td, .liq-header3 th{ background-color:#e3e3e3; } .liq-header2 td, .liq-header2 th, .liq-header3 td, .liq-header3 th{ font:bold 12px Geneva, arial, sans-serif; text-transform: uppercase white-space:nowrap; } .liq-footer td{ background-color:#e3e3e3; font-weight:bold; border-top:1px solid #333; white-space:nowrap; } </style> EOT; $html .= <<<EOT <h1 style="font:bold 26px arial, sans-serif">Pedidos de Informe</h1> <table cellpadding="0" cellspacing="0" border="1" class="liq-table"> <thead> <tr> <td colspan="12" class="liq-header">CHEQUES</td> </tr> <tr class="liq-header2"> <th>TITULAR</th> <th>FECHA</th> <th>N. CHEQUE</th> <th>IMPORTE</th> <th>DNI</th> <th>CUIL</th> <th>EMPRESA</th> <th>N. CUENTA</th> <th>BANCO</th> <th>SUCURSAL</th> <th>C.P.</th> <th>FECHA APERTURA</th> </tr> </thead> <tbody class="gridtbody">' EOT; foreach ($chequesList as $cheque) { $chequeAmt = '$ ' . number_format($cheque['amount'], 2, ',', '.'); $html .= "<tr> \n <td>{$cheque['first_name']} {$cheque['last_name']}</td>\n <td>{$cheque['date']}</td>\n <td>{$cheque['check_n']}</td>\n <td>{$chequeAmt}</td>\n <td>{$cheque['DNI']}</td>\n <td>{$cheque['CUIL']}</td>\n <td>{$cheque['business']}</td>\n <td>{$cheque['account_n']}</td>\n <td>{$cheque['bank_name']}</td>\n <td>{$cheque['branch']}</td>\n <td>{$cheque['zip_code']}</td>\n <td>{$cheque['opening_date']}</td>\n </tr>"; } $html .= '</tbody> </table><br />'; //$param = array(); //if ($status) { // $param = array('compress' => 0, 'Attachment' => 0); //} $mail = new Zend_Mail('utf-8'); /* $at = new Zend_Mime_Part($html); $at->type = 'application/vnd.ms-excel'; $at->disposition = Zend_Mime::DISPOSITION_INLINE; $at->encoding = Zend_Mime::ENCODING_BASE64; $at->filename = $filename.'.xls'; * */ $adminSettings = $this->getAdminSettings(); $mail->addTo($adminSettings->getMail_informes()); //$mail->addAttachment($at); $mail->setSubject('Cheques para aprobación'); $mail->setBodyHtml($html); $mail->send(); return 'success'; } catch (Exception $e) { } }
public function GetOperationsByClientId(Gyuser_Model_Operations $obj) { $table = $this->getDbTable(); $select = $table->select(); $select->setIntegrityCheck(false); $select->from(array('ope' => 'operations'), array('id', 'type', 'state_order_id', 'amount', 'tasa_porcentual', 'date', 'ac_date', 'state_change', 'cave_id', 'report')); $select->joinLeft(array('ope_s' => 'operations_state'), 'ope.state_order_id = ope_s.id', array('name as state_name', 'order_id')); //$select->joinLeft(array('ocvs' => 'other_caves'), 'ope.cave_id = ocvs.id', array('name as cave_name')); $select->joinLeft(array('provs' => 'providers'), 'ope.cave_id = provs.id', array('name as prov_name')); $select->where('ope.client_id = ?', $obj->getClient_id()); $select->order('ope.id DESC'); $resultSet = $table->fetchAll($select); if ($resultSet) { $entries = array(); $mapper = new Gyuser_Model_ChequesDataMapper(); foreach ($resultSet as $row) { $operationid = $row->id; $stateChange = date("d/m H:i", strtotime($row->state_change)) . ' hs'; if ($row->state_order_id == 99) { $stateChange = date("d/m/Y", strtotime($row->state_change)); } $entry = array('stateid' => $row->state_order_id, 'type' => $row->type, 'state_name' => $row->state_name, 'operationid' => $operationid, 'amount' => $row->amount, 'tasa' => $row->tasa_porcentual, 'date' => date("d/m/Y", strtotime($row->date)), 'ac_date' => date("d/m/Y", strtotime($row->ac_date)), 'state_change' => $stateChange, 'cave_id' => $row->cave_id, 'cave_name' => $row->prov_name, 'report' => $row->report); $cheques = $mapper->GetChequeDetailsByOpId($operationid); $entry['cheques'] = $cheques; $entries[$operationid] = $entry; } return $entries; } else { return null; } }