?
Current Path : /home1/savoy/www/oscarerp.com/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/www/oscarerp.com/application/views/accounting/xls_trail_balance_report.php |
<?php if(!$company) $images=base_url() .'assets/logo/default_header.jpg'; else { foreach($company as $company) { $loggo=$company['logo']; $images=base_url() .'assets/logo/'.$loggo; // echo $images; } } $html =''; $image = '<img src="'. $images.'" width="285px" height="100px">'; $bullet = '<img src="'.base_url().'/assets/images/li_bullet.jpg" align="bottom">'; $html.=' <html> <head> </head> <body style="margin: 20px 20px 30px 20px;"> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td colspan="2" align="left">'.$image.'</td> </tr> </tbody> </table><br/>'; $html.=' <div style="text-align:center"> <b><u>'.$heading.'</u></b> </div><br/><br/>'; $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>'; $html.='</table><br/><hr>'; $html.=' <table cellspacing="-1" style="width:100%;text-align:left"> <thead> <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>'; $html.=' <tr> <th style="border-bottom:1px solid gray;text-align:left;width:8%"></th> <th style="border-bottom:1px solid gray;text-align:left;width:20%">Account</th> <th style="border-bottom:1px solid gray;text-align:right;width:12%">Debit</th> <th style="border-bottom:1px solid gray;text-align:right;width:12%">Credit</th> <th style="border-bottom:1px solid gray;text-align:right;width:12%">Debit</th> <th style="border-bottom:1px solid gray;text-align:right;width:12%">Credit</th> <th style="border-bottom:1px solid gray;text-align:right;width:12%">Debit</th> <th style="border-bottom:1px solid gray;text-align:right;width:12%">Credit</th> </tr> </thead>'; $i=1; $totaldr1=0; $totalcr1=0; $totaldr2=0; $totalcr2=0; $totaldr3=0; $totalcr3=0; foreach ($result as $list) { $acc_name = substr($list['account_name'], 0, 14); $acc_code = $list['account']; $credit = $list['credit']; $debit = $list['debit']; $totaldebit = $list['opendebit'] + $debit; $totalcredit = $list['opencredit'] + $credit; $opencredit = $list['opencredit']; $totclosbal = $totaldebit - $totalcredit; $totaldr1+=$list['opendebit']; $totalcr1+=$list['opencredit']; $totaldr2+=$debit; $totalcr2+=$credit; $html.=' <tr style="color:#555555"> <td style="width:8%">' . $i . '</td> <td style="width:20%">' . ucfirst(strtolower($acc_name)) . '</td> <td style="text-align:right;width:12%" >' . number_format($list['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>'; $html.=' </table>'; $html.='<hr>'; $footer=""; $html.='<script type="text/php"> if ( isset($pdf) ) { $font = Font_Metrics::get_font("verdana", "normal"); $pdf->page_text(75, 570, "'.$footer.' Page {PAGE_NUM} of {PAGE_COUNT}", $font, 10, array(0,0,0)); } </script>'; $html.=' </body> </html>'; //echo $html; $fname=$file_name; if($reportin=='pdf') pdf_create($html, $fname,'true'); else { header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$fname.".xls"); header("Pragma: no-cache"); header("Expires: 0"); print $html; exit; } ?>