?
Current Path : /home1/savoy/public_html/savoyglobal.net/sibsmoved/system/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/sibsmoved/system/application/views/Accounting/pdf_gl.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?> <?php if (!$company) $images = base_url() . 'logo/default_header.jpg'; else { foreach ($company as $company) { $loggo = $company['filename']; $images = base_url() . 'logo/' . $loggo; // echo $image; } } $html = ''; $image = '<img src="' . $images . '" width="285px" height="100px">'; $bullet = '<img src="' . base_url() . '/assets/images/li_bullet.jpg" align="bottom">'; $html = '<html><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></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>'; $html.='<br/><hr>'; $html.='<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['account_name']; if ($sub == 'false') { $opendet = $this->accountingsmodel->opening_maintrail_balance($accountcode, $date1, $date2); } else { $opendet = $this->accountingsmodel->opening_trail_balance($accountcode, $date1, $date2); } $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['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>'; $html.='<thead><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></thead>'; $html.='<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['account_name']; // if($tempopen==1) /// { 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>'; $html.='<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>'; $html.='<tr style="font-weight:bold;"> <td colspan="6" style="border-top:1px solid"></td> </tr>'; $html.='<tr style="font-weight:bold"> <td colspan="6">' . $accountcode . ' ' . ucfirst(strtolower($accountname)) . '</td> </tr>'; $html.='<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>'; $html.='<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; //} // $tempopen=2; } 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>'; $html.='<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>'; $html.='<tr style="font-weight:bold;"> <td colspan="6" style="border-top:1px solid"></td> </tr>'; $html.='<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>'; $html.='</table>'; $html.='<hr>'; $footer = $this->reportmodel->getfootervalue(); $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></head></html>'; //echo $html; 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; } ?>