?
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_statement_of_account.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?> <?php if (!$company) { $images = base_url() . 'assets/logo/default_header.jpg'; $company_name = ''; $country = ""; $city = ""; $address = ""; $postbox = ""; } else { foreach ($company as $company) { $loggo = $company['logo']; $images = base_url() . 'assets/logo/' . $loggo; $company_name = $company['nursery_name']; $address = $company['address']; $country = $company['country']; $city = $company['city']; } } $html = ""; $code = $acc_name . '-' . $acc_code; $codeheader = "Code"; $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: 4cm 3cm 8cm 3cm;"> <div style="margin: 0cm 0cm 1cm 0cm;"> <table width="100%" border="0" > <tbody> <tr> <td colspan="4" align="left">' . $image . '</td> </tr> </tbody> </table> <br/> <table width="100%" border="0" > <tbody> <tr> <td colspan="6" style="text-align:center"><b>Statement of Accounts</b></td> </tr> <tr> <td colspan="6"></td> </tr> </tbody> </table> <br/>'; $html.='<table width=100% style="margin-left:0%";> <tr> <td>To:</td> <td colspan="2">' . $company_name . '</td> <td></td> <td>Date : ' . date('d-m-Y') . '</td> </tr> <tr> <td></td> <td colspan="2">' . $address . ', ' . $city . ', ' . $country . '</td> <td></td> <td>' . $codeheader . ' : ' . $code . '</td> </tr> </table> <br/> <table width="100%" border="0" > <tbody> <tr> <td colspan="6" style="text-align:left">Period :' . $date1 . ' to ' . $date2 . '</td> </tr> </tbody> </table> <hr><br/> <table width="100%" border="0" cellpadding="-1" cellspacing="-1"> <thead> <tr style="font-weight:bold"> <th style="background-color:#80C0FF;width:8%">Date</th> <th style="background-color:#80C0FF;width:12%">Transaction No</th> <th style="background-color:#80C0FF;width:10%">Payment Method</th> <th style="background-color:#80C0FF;width:26%">Description</th> <th style="background-color:#80C0FF;width:12%">Debit</th> <th style="background-color:#80C0FF;width:12%">Credit</th> <th style="background-color:#80C0FF;width:20%">Balance</th> </tr> </thead>'; $balance = 0; $totdebit = 0; $totcredit = 0; $totbal = 0; $currency = $this->mastermodel->getdatas('finance_currency'); $currency_type = $currency[0]['currency_code']; $opendebit = $open_debit; $opencredit = $open_credit; $openbal = $opendebit - $opencredit; if ($openbal < 0) { $newopenbal = abs($openbal); $sfx = 'Cr'; } else if ($openbal > 0) { $newopenbal = $openbal; $sfx = 'Dr'; } else { $newopenbal = 0; $sfx = ''; } $balance = $openbal; $totdebit = $opendebit; $totcredit = $opencredit; $html.=' <tr style="font-weight:bold"> <td style="width:8%"></td> <td style="width:12%"></td> <td style="width:10%"></td> <td style="width:26%">Opening Balance</td> <td style="text-align:right;width:12%">' . number_format($opencredit, '2') . '</td> <td style="text-align:right;width:12%">' . number_format($opendebit, '2') . '</td> <td style="text-align:right;width:20%">' . number_format($newopenbal, '2') . ' ' . $sfx . '</td> </tr>'; $colspan = 7; if (count($result) > 0) { foreach ($result as $dbt) { $debit = $dbt['debit']; $credit = $dbt['credit']; $country = ""; $tdate = $this->mastermodel->convertdatenormalformat($dbt['journal_date']); $city = ""; $address = ""; $postbox = ""; $refs = $dbt['reference']; $description = $dbt['description']; if ($debit > 0) $balance = $balance + $debit; if ($credit > 0) $balance = $balance - $credit; if ($balance > 0) { $newbalance = $balance; $sfx = 'Dr'; } else if ($balance < 0) { $newbalance = abs($balance); $sfx = 'Cr'; } else { $newbalance = 0; $sfx = ''; } $payment = ""; $payment_info=$payments; if (isset($payment_info[$dbt['journal_id']])) { if ($payment_info[$dbt['journal_id']]['trans_type'] == "PV" || $payment_info[$dbt['journal_id']]['trans_type'] == "RV") { $method = $payment_info[$dbt['journal_id']]['method']; $cheque_no = $payment_info[$dbt['journal_id']]['ch_no']; $cheque_drawn = $payment_info[$dbt['journal_id']]['cheque_info']; $cheque_date = $this->mastermodel->convdatformat($payment_info[$dbt['journal_id']]['ch_date']); if (strtolower($method) == "cheque") { $payment = "Cheque <br/>(Date : $cheque_date , No:$cheque_no , Drawn: $cheque_drawn)"; } else { $payment = $method; } } } $html.=' <tr style="font-size:11px" > <td style="width:8%">' . $tdate . '</td> <td style="width:12%">' . $refs . '</td> <td style="width:10%;text-transform:capitalize;">' . $payment . '</td> <td style="width:26%">' . $description . '</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:20%">' . number_format($newbalance, '2') . ' ' . $sfx . '</td> </tr>'; $totdebit+=$debit; $totcredit+=$credit; } $totbal = $totdebit - $totcredit; if ($totbal > 0) { $newtbalance = $totbal; $sfx = 'Dr'; } else if ($totbal < 0) { $newtbalance = abs($totbal); $sfx = 'Cr'; } else { $newtbalance = 0; $sfx = ''; } $colspan = 7; $html.=' <tr style="font-weight:bold;"> <td colspan="' . $colspan . '" style="border-top:1px solid"></td> </tr> <tr style="font-weight:bold"> <td style="width:8%"></td> <td style="width:12%"></td> <td style="width:10%"></td> <td style="width:26%">Total Debit/Credit (' . $currency_type . ')</td> <td style="text-align:right;width:12%">' . number_format($totdebit, '2') . '</td> <td style="text-align:right;width:12%">' . number_format($totcredit, '2') . '</td> <td style="text-align:right;width:20%">' . number_format($newtbalance, '2') . ' ' . $sfx . '</td> </tr> </table> <br/> <hr>'; } else { $html.=' <tr style="font-weight:bold;"> <td colspan="' . $colspan . '" style="border-top:1px solid"></td> </tr> <tr style="font-weight:bold"> <td style="width:10%"></td> <td style="width:15%"></td> <td style="width:30%">Total Debit/Credit (' . $currency_type . ')</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:19%">' . number_format($newopenbal, '2') . ' ' . $sfx . '</td> </tr> </table>'; } $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.='</div></body></head></html>'; //echo $html; //die; $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; } ?>