I have to join 4 tables using the SQL Select Statement I do not know how to set it up in Model , controllers/admin.php, application\models\Crud_model.php, application\controllers\Admin.php and the application\views\backend\admin\view.php to display my output or print it with pdf
This is my Coding I hope someone out there can give me a heads up on this Thanks and God Bless
CODINGS
Code:
<?php
function get_debtors( ) {
$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 , student , parent , section ');
$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();
<div id="print">
<script src="assets/js/jquery-1.11.0.min.js"></script>
<style type="text/css">
td {
padding: 5px;
}
</style>
<center>
$system_name = $this->db->get_where('settings' , array('type'=>'system_name'))->row()->description;
<img src="uploads/logo.png" style="max-height : 60px;"><br>
<h3 style="font-weight: 100;"><?php echo $system_name;?></h3>
<?php echo get_phrase('Debtor List');?><br>
</center>
<?php
foreach ($query->result() 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; ?>
?>
</tbody>
</table>
<br>
<center>
</center>
</div>
?>