Hi all,
I am trying to out values using loop from an array, but facing error:
here my model:
Here my controller:
Here my view, I am using html2pdf for pdf outpu.
I tried
/*
echo '<pre>';
print_r($this->data['fee_detail']);
echo '</pre>';
die();
*/
and it return the following but unable to display these fields in view.
I am trying to out values using loop from an array, but facing error:
Quote:Message: Undefined index: payment_description
here my model:
PHP Code:
public function get_fee_invoice_4class($data){
$this->anotherDb
->where('class_id',$data['id'])
->where('activated',1)
->where('role','Student');
$student_query = $this->anotherDb->get('users');
$totalrows = $student_query->num_rows();
for($i=0;$i<$totalrows;$i++) {
$result = $student_query->result_array();
$student_id = $result[$i]['id'];
$this->anotherDb
->where('payment_student', $result[$i]['id'])
->where('date_format(fee_month,"%d-%m%Y") >=date_format(curdate(),"00-%m-%Y")')
->where('payment_status=0');
$this->anotherDb
->select('payment_amount', 'payment_description','payment_student');
$query = $this->anotherDb->get('payments');
$result_array[] = $query->result_array();
}
return $result_array;
}
Here my controller:
PHP Code:
public function rep_fee_invoice_4class()
{
$data = array(
//'fee_type' => $this->input->post('fee_type'),
'id' => $this->input->post('class')
);
$this->data['fee_detail']= $this->Fee_model->get_fee_invoice_4class($data);
/*
echo '<pre>';
print_r($this->data['fee_detail']);
echo '</pre>';
die();
*/
$template_pdf = $this->load->view('reports/rep_fee_invoice_4class_html', $this->data, TRUE);
$html2pdf = new Html2Pdf();
$html2pdf->writeHTML($template_pdf);
$html2pdf->output('Student_Fee_invoice.pdf', 'D');
}
Here my view, I am using html2pdf for pdf outpu.
PHP Code:
<style type="text/Css">
<!--.test1
{
border: solid 1px #FF0000;
background: #FFFFFF;
border-collapse: collapse;
}
-->
</style>
<page style="font-size: 14px;">
<div style="fload: left; width: 48%;">
<span style="font-weight: bold; font-size: 18pt; color: #FF0000; font-family: Times">
<h1 style="font-size: 24px; text-align: center;">
Fee Invoice</h1>
<br></span>
<?php
$school_name = ($this->Main_model->get_settings('school_name'));
$school_address = ($this->Main_model->get_settings('address'));
$phone_no = ($this->Main_model->get_settings('phone_no'));
?>
<br>
<p> School Name: <?php echo $school_name; ?></p>
<p> School Address: <?php echo $school_address; ?></p>
<p> Phone No: <?php echo $phone_no; ?></p>
<table style=" border: 1px solid #555555;">
<thead>
<tr>
<th style=" border: 1px solid #555555;">No.</th>
<th style=" border: 1px solid #555555;">Particulars</th>
<th style=" border: 1px solid #555555;">Amount</th>
</tr>
</thead>
<tbody>
<?php
if(isset($fee_detail) && is_array($fee_detail) && count($fee_detail)): $i=1;
foreach ($fee_detail as $key => $data) {
?>
<tr>
<td style=" border: 1px solid #555555;"><?php echo $i; ?></td>
<td style=" border: 1px solid #555555;"><?php echo $data['payment_description']; ?></td>
<td style=" border: 1px solid #555555;"><?php echo $data['payment_amount']; ?></td>
</tr>
<?php
$i++;
}
else:
?>
<tr>
<td style=" border: solid 1px #000000 colspan="8" >No Records Found..</td>
</tr>
<?php
endif;
?>
</tbody>
<!--<td style="width: 100%">Test 1</td> </tr>-->
</table><br />
</div>
</page>
I tried
/*
echo '<pre>';
print_r($this->data['fee_detail']);
echo '</pre>';
die();
*/
and it return the following but unable to display these fields in view.
Quote:Array
(
[0] => Array
(
[0] => Array
(
[payment_amount] => 1800
)
)
[1] => Array
(
[0] => Array
(
[payment_amount] => 1800
)
[1] => Array
(
[payment_amount] => 1800
)
[2] => Array
(
[payment_amount] => 1800
)
[3] => Array
(
[payment_amount] => 1800
)
[4] => Array
(
[payment_amount] => 1800
)
[5] => Array
(
[payment_amount] => 1800
)
[6] => Array
(
[payment_amount] => 1800
)
[7] => Array
(
[payment_amount] => 1800
)
[8] => Array
(
[payment_amount] => 1800
)
)
[2] => Array
(
[0] => Array
(
[payment_amount] => 1800
)
[1] => Array
(
[payment_amount] => 1800
)
[2] => Array
(
[payment_amount] => 1800
)
[3] => Array
(
[payment_amount] => 1800
)
[4] => Array
(
[payment_amount] => 1800
)
[5] => Array
(
[payment_amount] => 1800
)
[6] => Array
(
[payment_amount] => 1800
)
[7] => Array
(
[payment_amount] => 1800
)
)
)