This is the Big Problem which I believe I could have taken care of if I am a good codeigniter but very new to codeigniter
application\controllers I have this codings in her
application\controllers I have this codings in her
PHP Code:
function debtor_print_viewNEW()
{
if ($this->session->userdata('admin_login') != 1)
redirect('login', 'refresh');
$page_data['page_name'] = 'debtor_print_viewNEW';
$page_data['page_title'] = get_phrase('debtor_print_viewNEW');
$query = $this->debtor_print_viewNEW();
$this->load->view('backend/index', $page_data);
}
}
inside application\models I have this codes
function debtor_print_viewNEW( ) {
$this->db->select("invoice.student_id as STUDENT_ID,student.name AS STUDENT_NAME,section.name AS CLASS,invoice.description AS DESCRIPTION, invoice.amount AS TOTAL_AMOUNT, invoice.amount_owed AS AMOUNT_OWED, parent.name AS PARENT_NAME, parent.email AS PARENT_EMAIL, parent.phone AS PARENT_PHONE, parent.address AS PARENT_ADDRESS, invoice.status AS STATUS");
$this->db->from('invoice ');
$this->db->join('student ', 'student.student_id = invoice.student_id');
$this->db->join('parent ', 'parent.parent_id = student.parent_id, 'left'');
$this->db->join('section ', 'section.section_id = student.section_id','left');
$this->db->where('invoice.status', 'debtor');
$query = $this->db->get();
return $query->result();
}
Inside View Block application\views\backend\admin
foreach ($get_debtors as $row)
{
$i = 0;
$max = 25;
if ($i == $max) or ($i == 0)
{
//print column titles for the current page
</center>
<table style="width:100%; border-collapse:collapse;border: 1px solid #ccc; margin-top: 10px;" border="1">
<tbody>
<thead>
<tr>
<td style="text-align: center;">STUDENT ID</td>
<td style="text-align: center;">STUDENT NAME</td>
<td style="text-align: center;">CLASS</td>
<td style="text-align: center;">DESCRIPTION</td>
<td style="text-align: center;">TOTAL AMOUNT</td>
<td style="text-align: center;">AMOUNT OWED</td>
<td style="text-align: center;">PARENT NAME</td>
<td style="text-align: center;">PARENT EMAIL</td>
<td style="text-align: center;">PARENT PHONE</td>
<td style="text-align: center;">PAREBT ADDRESS</td>
<td style="text-align: center;">STATUS</td>
</tr>
</thead>
//Set $i variable to 0 (first row)
$i = 0;
}
$i += 1;
<tr>
echo '<td><div align="left">'.$row['STUDENT_ID'].'</td>';
echo '<td><div align="left">'.$row['STUDENT_NAME'].'</td>';
echo '<td><div align="left">'.$row['CLASS'].'</td>';
echo '<td><div align="left">'.$row['DESCRPTION'].'</td>';
echo '<td><div align="left">'.$row['TOTAL_AMOUNT'].'</td>';
echo '<td><div align="left">'.$row['AMOUNT_OWED'].'</td>';
echo '<td><div align="left">'.$row['PARENT_NAME'].'</td>';
echo '<td><div align="left">'.$row['PAREBT_PHONE'].'</td>';
echo '<td><div align="left">'.$row['PARENT_ADDRESS'].'</td>';
echo '<td><div align="left">'.$row['STATUS'].'</td>';
}
<?php endforeach; ?>
?>