Very New to Codeigniter need help |
(11-05-2016, 04:51 AM)InsiteFX Wrote: PDF generate in Codeigniter using DOMPDFInsiteFX, It was nice reading from you. This problem is just to create a List of Debtors I have Four Tables Namely Invoice, Student, Parent and Class Section I.E Section. This is what I think might be the solution but nothing is being created since I am new to coding with codeigniter 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 <?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> ?> This code above is not out putting anything that means I have not done the right thing that conforms with codeigniter. |
Messages In This Thread |
Very New to Codeigniter need help - by Jay01 - 11-04-2016, 10:17 PM
RE: Very New to Codeigniter need help - by skunkbad - 11-04-2016, 11:28 PM
RE: Very New to Codeigniter need help - by Jay01 - 11-05-2016, 02:25 AM
RE: Very New to Codeigniter need help - by InsiteFX - 11-05-2016, 04:51 AM
RE: Very New to Codeigniter need help - by Jay01 - 11-05-2016, 07:58 AM
RE: Very New to Codeigniter need help - by InsiteFX - 11-05-2016, 10:33 AM
RE: Very New to Codeigniter need help - by Jay01 - 11-05-2016, 12:02 PM
RE: Very New to Codeigniter need help - by Wouter60 - 11-05-2016, 12:35 PM
RE: Very New to Codeigniter need help - by Jay01 - 11-05-2016, 11:03 PM
RE: Very New to Codeigniter need help - by Jay01 - 11-05-2016, 11:47 PM
RE: Very New to Codeigniter need help - by Xaruf - 07-29-2020, 01:54 PM
|