?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/draft/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/draft/application/views/Accounting/pdf_gl.php |
<?php $company_details= $this->mastermodel->get_data_srow('company','1','company_id'); $html='<html> <body style="margin: 20px 20px 30px 20px;">'; $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>'; $html.=' <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> <br/> <hr> <table cellspacing="-1" style="width:100%;text-align:left">'; $i=1; $balance=0; $totdebit=0; $totcredit=0; $totdebit1=0; $totcredit1=0; $totalbalance=0; $totbal=0; $opentr=1; $tempopen=1; foreach($receipt as $rep) { $tdate= $rep['tran_date']; $credit=0-$rep['credit']; $debit=$rep['debit']; $memo=substr($rep['memo'],0,8); $accountcode=$rep['account']; $accountname=$rep['chart_account_name']; if($sub=='false') { $opendet=$this->accountingmodel->opening_maintrail_balance($accountcode,$date1); } else { $opendet=$this->accountingmodel->opening_trail_balance($accountcode,$date1); } $opencredit=0-$opendet->opencredit; $opendebit=$opendet->opendebit; $openbaln=$opendebit-$opencredit; $tdate=$this->mastermodel->convdatformat($rep['tran_date']); $refs=$rep['reference']; $balance+=($debit-$credit); $totalbalance+=($debit-$credit); if($opentr==1) { $tempaccname=$rep['chart_account_name']; if($openbaln<0) { $newopenbal= abs($openbaln); $sfx='Cr'; } else if($openbaln>0) { $newopenbal= $openbaln; $sfx='Dr'; } else { $newopenbal=0; $sfx=''; } $balance+=$openbaln; $totalbalance+=$openbaln; $totdebit1=$opendebit; $totcredit1=$opencredit; $totdebit=$opendebit; $totcredit=$opencredit; $html.='<tr style="font-weight:bold"> <td colspan="6">'.$accountcode.' '.ucfirst(strtolower($accountname)).'</td> </tr> <tr> <th style="text-align:left;width:15%">Transaction No</th> <th style="text-align:left;width:15%">Date</th> <th style="text-align:left;width:30%">Narration</th> <th style="text-align:right;width:13%">Debit</th> <th style="text-align:right;width:13%">Credit</th> <th style="text-align:right;width:14%">Balance</th> </tr> <tr style="font-weight:bold"> <td colspan="2"></td> <td style="width:30%">Opening Balance</td> <td style="text-align:right;width:13%">'.number_format($opendebit,'2').'</td> <td style="text-align:right;width:13%">'.number_format($opencredit,'2').'</td> <td style="text-align:right;width:14%">'.number_format($newopenbal,'2').' '.$sfx.'</td> </tr>'; } $opentr=2; if($tempaccname!=$accountname) { $tempaccname=$rep['chart_account_name']; if($openbaln<0) { $newopenbal= abs($openbaln); $sfx='Cr'; } else if($openbaln>0) { $newopenbal= $openbaln; $sfx='Dr'; } else { $newopenbal=0; $sfx=''; } $balance+=$openbaln; $totalbalance+=$openbaln; $totbaltemp=$totdebit1-$totcredit1; if($totbaltemp>0) { $newtbalancetemp=$totbaltemp; $sfx='Dr'; } else if($totbaltemp<0) { $newtbalancetemp=abs($totbaltemp); $sfx='Cr'; } else { $newtbalancetemp=0; $sfx=''; } $html.='<tr style="font-weight:bold;"> <td colspan="6" style="border-top:1px solid"></td> </tr> <tr style="font-weight:bold"> <td colspan="2">'.$acctitle.'</td> <td style="width:30%"></td> <td style="text-align:right;width:13%">'.number_format($totdebit1,'2').'</td> <td style="text-align:right;width:13%">'.number_format($totcredit1,'2').'</td> <td style="text-align:right;width:14%">'.number_format($newtbalancetemp,'2').' '.$sfx.'</td> </tr> <tr style="font-weight:bold;"> <td colspan="6" style="border-top:1px solid"></td> </tr> <tr style="font-weight:bold"> <td colspan="6">'.$accountcode.' '.ucfirst(strtolower($accountname)).'</td> </tr> <tr> <th style="text-align:left;width:15%">Transaction No</th> <th style="text-align:left;width:15%">Date</th> <th style="text-align:left;width:30%">Narration</th> <th style="text-align:right;width:13%">Debit</th> <th style="text-align:right;width:13%">Credit</th> <th style="text-align:right;width:14%">Balance</th> </tr> <tr style="font-weight:bold"> <td colspan="2"></td> <td style="width:30%">Opening Balance</td> <td style="text-align:right;width:13%">'.number_format($opendebit,'2').'</td> <td style="text-align:right;width:13%">'.number_format($opencredit,'2').'</td> <td style="text-align:right;width:14%">'.number_format($newopenbal,'2').' '.$sfx.'</td> </tr>'; $totdebit1=$opendebit; $totcredit1=$opencredit; $totdebit+=$opendebit; $totcredit+=$opencredit; $balance-=$newbalance; } if($balance>0) { $newbalance=$balance; $sfx='Dr'; } else if($balance<0) { $newbalance=abs($balance); $sfx='Cr'; } else { $newbalance=0; $sfx=''; } if(empty($debit) && empty($credit)) { continue; } $html.='<tr style="color:#555555"> <td style="width:15%">'.$refs.'</td> <td style="width:15%">'.$tdate.'</td> <td style="width:30%">'.$memo.'</td> <td style="text-align:right;width:13%" >'.number_format($debit,'2').'</td> <td style="text-align:right;width:13%" >'.number_format($credit,'2').'</td> <td style="text-align:right;width:14%" >'; $html.=''.number_format($newbalance,'2').' '.$sfx.'</td> </tr>'; $i++; $totdebit1+=$debit; $totcredit1+=$credit; $totcredit+=$credit; $totdebit+=$debit; } $totbal=$totdebit1-$totcredit1; if($totbal>0) { $newtbalance=$totbal; $sfx='Dr'; } else if($totbal<0) { $newtbalance=abs($totbal); $sfx='Cr'; } else { $newtbalance=0; $sfx=''; } if($totalbalance>0) { $newtotalbalance=$totalbalance; $sfx11='Dr'; } else if($totalbalance<0) { $newtotalbalance=abs($totalbalance); $sfx11='Cr'; } else { $newtotalbalance=0; $sfx11=''; } $html.='<tr style="font-weight:bold;"> <td colspan="6" style="border-top:1px solid"></td> </tr> <tr style="font-weight:bold"> <td colspan="2">'.$acctitle.'</td> <td style="width:30%"></td> <td style="text-align:right;width:13%">'.number_format($totdebit1,'2').'</td> <td style="text-align:right;width:13%">'.number_format($totcredit1,'2').'</td> <td style="text-align:right;width:14%">'.number_format($newtbalance,'2').' '.$sfx.'</td> </tr> <tr style="font-weight:bold;"> <td colspan="6" style="border-top:1px solid"></td> </tr> <tr style="font-weight:bold"> <td style="width:15%"></td> <td style="width:15%"></td> <td style="width:30%" >Total Debit/Credit</td> <td style="text-align:right;width:13%">'.number_format($totdebit,'2').'</td> <td style="text-align:right;width:13%">'.number_format($totcredit,'2').'</td> <td style="text-align:right;width:14%">'.number_format($newtotalbalance,'2').' '.$sfx11.'</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></html>'; //echo $html; pdf_create($html,'Sub Account Ledger'); ?>