?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/application/views/Accounting/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sgms/application/views/Accounting/pdf_trail_balance.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $company_details= $this->mastermodel->get_data_srow('company','1','company_id'); $html='<html><head><body>'; $html.='<table width="100%"> <tr><td colspan="3"><img src="'.base_url().'assets/images/'.$company_details->logo.'" width="400" height="148"/></td></tr> <tr><td colspan="3" style="font-size:16px;" align="center"><b><u>'.$heading.'</u></b></td></tr> <tr><td colspan="3">Printout Date: '.date('d-m-Y').', '.date('h:i:s a').'</td></tr> </table><br><br>'; $html.='<hr> <table> <tr> <td>Period: '.$date1.' to ' .$date2.'</td> </tr>'; if(!empty($rfrom) && !empty($rto)) $html.='<tr><td>Range From: '.strtoupper($rfrom).' to ' .strtoupper($rto).'</td> </tr> </table>'; $html.='<br/><hr>'; $html.='<table cellspacing="1" style="width:100%;text-align:left"> <tr> <th style="border-bottom:1px solid gray;width:8%"></th> <th style="border-bottom:1px solid gray;width:20%"></th> <th colspan="2" style="text-align:center;border-bottom:1px solid gray;">Opening Balance</th> <th colspan="2" style="text-align:center;border-bottom:1px solid gray;">Current Period</th> <th colspan="2" style="text-align:center;border-bottom:1px solid gray;">Closing Balance</th> </tr> <tr> <th style="text-align:left;border-bottom:1px solid gray;width:8%"></th> <th style="text-align:left;border-bottom:1px solid gray;width:20%">Account</th> <th style="text-align:right;border-bottom:1px solid gray;width:12%">Debit</th> <th style="text-align:right;border-bottom:1px solid gray;width:12%">Credit</th> <th style="text-align:right;border-bottom:1px solid gray;width:12%">Debit</th> <th style="text-align:right;border-bottom:1px solid gray;width:12%">Credit</th> <th style="text-align:right;border-bottom:1px solid gray;width:12%">Debit</th> <th style="text-align:right;border-bottom:1px solid gray;width:12%">Credit</th> </tr>'; $i=1; $totaldr1=0; $totalcr1=0; $totaldr2=0; $totalcr2=0; $totaldr3=0; $totalcr3=0; foreach($receipt as $rep) { $acc_name= substr($rep['chart_account_name'], 0, 14); $acc_code= $rep['account']; $credit=0-$rep['credit']; $debit=$rep['debit']; if($acc_code!='0') { $totaldebit=$rep['opendebit']+$debit; $totalcredit=(0-$rep['opencredit'])+$credit; $opencredit=0-$rep['opencredit']; $totclosbal=$totaldebit-$totalcredit; $totaldr1+=$rep['opendebit']; $totalcr1+=(0-$rep['opencredit']); $totaldr2+=$debit; $totalcr2+=$credit; $html.='<tr style="color:#555555"> <td style="width:8%">'.$acc_code.'</td> <td style="width:20%">'.ucfirst(strtolower($acc_name)).'</td> <td style="text-align:right;width:12%" >'.number_format($rep['opendebit'],'2').'</td> <td style="text-align:right;width:12%" >'.number_format($opencredit,'2').'</td> <td style="text-align:right;width:12%" >'.number_format($debit,'2').'</td> <td style="text-align:right;width:12%" >'.number_format($credit,'2').'</td> <td style="text-align:right;width:12%" >'; if($totclosbal>0) { $totaldebitbal =$totclosbal; $totalcreditbal=0; } else { $totaldebitbal=0; $totalcreditbal=-$totclosbal; } $totaldr3+=$totaldebitbal; $totalcr3+=$totalcreditbal; $html.=''.number_format($totaldebitbal,'2').'</td> <td style="text-align:right;width:12%" >'.number_format($totalcreditbal,'2').'</td> </tr>'; $i++; } } $html.='<tr style="color:#000;font-weight:bold;text-align:right"> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:8%"></td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:20%">Total</td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:12%" >'.number_format($totaldr1,'2').'</td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:12%" >'.number_format($totalcr1,'2').'</td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:12%" >'.number_format($totaldr2,'2').'</td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:12%" >'.number_format($totalcr2,'2').'</td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:12%" >'.number_format($totaldr3,'2').'</td> <td style="border-top:1px solid gray;border-bottom:1px solid gray;width:12%" >'.number_format($totalcr3,'2').'</td> </tr>'; $aggr_totalopen=$totaldr1-$totalcr1; $aggr_current=$totaldr2-$totalcr2; $aggr_bal=$totaldr3-$totalcr3; if($aggr_totalopen>=0) { $agrr_dr1=$aggr_totalopen; $aggr_cr1=0; } else { $agrr_dr1=0; $aggr_cr1=0-$aggr_totalopen; } if($aggr_current>=0) { $agrr_dr2=$aggr_current; $aggr_cr2=0; } else { $agrr_dr2=0; $aggr_cr2=0-$aggr_current; } if($aggr_bal>=0) { $agrr_dr3=$aggr_bal; $aggr_cr3=0; } else { $agrr_dr3=0; $aggr_cr3=0-$aggr_bal; } $html.='<tr style="color:#000;font-weight:bold;text-align:right"> <td style="width:8%"></td> <td style="width:20%">Closing Balance</td> <td style="width:12%">'.number_format($agrr_dr1,'2').'</td> <td style="width:12%">'.number_format($aggr_cr1,'2').'</td> <td style="width:12%">'.number_format($agrr_dr2,'2').'</td> <td style="width:12%">'.number_format($aggr_cr2,'2').'</td> <td style="width:12%">'.number_format($agrr_dr3,'2').'</td> <td style="width:12%">'.number_format($aggr_cr3,'2').'</td> </tr> </table> <hr>'; $html.='<script type="text/php"> if ( isset($pdf) ) { $font = Font_Metrics::get_font("verdana", "normal"); $pdf->page_text(5, 770, "'.$company->footer.' Page {PAGE_NUM} of {PAGE_COUNT}", $font, 10, array(0,0,0)); } </script>'; $html.='</body></head></html>'; //echo $html; pdf_create($html, 'Trial Balance'); ?>