It is my first time to debug other programmers work so I am kinda lost in its codes, anyway this is just the last simple thing I need to accomplish in this system. I already created the search page and all I need now is to create a function how to print the selected values in the checkbox.
I already created a function for creating pdf.
Controller
public function create_pdf_certificate($acctNo,$certReason,$dlCertType)
{
$this->load->model('model_access','access');
//$this->access->check_login();
//$this->access->check_print_access();
$this->load->model('model_account','account');
$this->load->model('model_admin','admin');
$this->load->model('model_constants','constants');
$this->load->helper('to_pdf');
$this->load->helper('file');
$acctNo = str_replace("%7C","|",$acctNo);
$data['accounts'] = $this->account->get_account($acctNo);
$data['cert'] = $this->admin->get_treasury_dept_info();
$data['clientName'] = $data['accounts'][0]->clientName;
$data['certReason'] = $certReason;
if($dlCertType == 'INDICORP')
$html = $this->load->view('pdf_download/indicorp', $data, true);
//$this->load->view('pdf_download/indicorp', $data);
elseif($dlCertType == 'AUDIT')
{
$data['audit'] = $this->admin->get_audit_partner_info();
$html = $this->load->view('pdf_download/audit', $data, true);
//$this->load->view('pdf_download/audit', $data);
}
else
$html = $this->load->view('pdf_download/summary', $data, true);
//$this->load->view('pdf_download/summary', $data);
$filename = 'account'.date('mdY');
create_pdf($html,$filename.time(), true);
}
and here is my MODEL
if(count($res) > 0)
{
$i = 1;
foreach($res as $row)
{
$output['aaData'][] = array(
"<input type='checkbox' name='checkbox".$i."' id='checkbox".$i."' value='".$row->clientId."' />",
$row->clientName,
$row->product,
$row->accountNo,
$row->valueDate,
$row->maturityDate,
$row->ccy,
$row->principal,
$row->interestRate,
$row->maturityAmt
);
$i++;
}
}
//print_r($output);
//return $output;
return json_encode( $output );
Here is my view codes, I have this fieldset that also select the certificate type that I want to use a template.
<fieldset style="width:990px;" >
<div>
<table id="searchTable" class="tableHeader" border="1" cellspacing="0" width="100%">
<thead>
<tr>
<th>SELECT</th>
<th>CLIENT</th>
<th>PROD TYPE</th>
<th>REF ACCNT NO.</th>
<th>VALUE DATE</th>
<th>MATURITY DATE</th>
<th>CCY</th>
<th>PRINCIPAL</th>
<th>RATE (%)</th>
<th>MATURITY AMNT</th>
</tr>
</thead>
<tbody style="color: black" class="tableRow">
</tbody>
</table>
<script>
$(document).ready(function() {
$('#searchTable').dataTable( {
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo site_url() ?>/search/get_account",
"sServerMethod": "GET",
"fnServerData": function ( sSource, aoData, fnCallback )
{
aoData.push( { "name": "txtClient", "value": "<?php echo $_POST["txtClient"]; ?>" } );
aoData.push( { "name": "txtAccntNo", "value": "<?php echo $_POST["txtAccntNo"]; ?>" } );
aoData.push( { "name": "txtGrpAcctName","value": "<?php echo $_POST["txtGrpAcctName"]; ?>" } );
aoData.push( { "name": "txtDate", "value": "<?php echo $_POST["txtDate"]; ?>" } );
$.getJSON( sSource, aoData, function (json)
{
fnCallback(json)
} );
},
"aoColumns": [
{ "sClass": "centerAligned" , "bSortable" : false }, //SELECT
{ "sClass": "centerAligned" , "bSortable" : false }, //CLIENT
{ "sClass": "centerAligned" , "bSortable" : false }, //PROD TYPE
{ "sClass": "centerAligned" , "bSortable" : false }, //REF ACCNT NO.
{ "sClass": "centerAligned" , "bSortable" : false }, //VALUE DATE
{ "sClass": "centerAligned" , "bSortable" : false }, //MATURITY DATE
{ "sClass": "centerAligned" , "bSortable" : false }, //CCY
{ "sClass": "leftAligned" , "bSortable" : false }, //PRINCIPAL
{ "sClass": "leftAligned" , "bSortable" : false }, //RATE (%)
{ "sClass": "leftAligned" , "bSortable" : false }, //MATURITY AMNT
]
} );
} );
</script>
</div>
<hr/>
<table class="formTable" cellspacing="0" align="center">
<tr>
<td class="label" width="200px">Reason: <span class="required">*</span></td>
<td class="field" width="300px"><?php echo form_textarea($formCertReason); ?></td>
<td class="field">
<hr style="visibility: hidden"/>
<div class="btnHolder">
<a id="colDownloadBtn" href="#" onclick="Account.checkRequiredFields();"> <?php echo $_POST['certType']; ?>
<img src="<?php echo base_url(); ?>public/images/form/btn_download_cert.gif" style="cursor: pointer;" />
</a>
</div>
</td>
</tr>
</table>
</fieldset>