?
Current Path : /home1/savoy/public_html/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/public_html/oscarerp.com/application/views/accounting/xls_balance_sheet.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?> <?php if(!$company){ $images=base_url() .'assets/logo/default_header.jpg'; $company_name = '';} else { foreach($company as $company) { $loggo=$company['logo']; $images=base_url() .'assets/logo/'.$loggo; $company_name = $company['nursery_name']; // echo $images; } } $html=""; $image = '<img src="' . $images . '" widtd="285px" height="100px">'; $html.=' <html> <head> </head> <body style="margin: 20px 20px 30px 20px;"> <table widtd="100%" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr><td colspan="2" align="left">'. $image .'</td></tr> </tbody> </table><br/> <table> <tr><th colspan="3"><b><u><b>'. $company_name .'</b></u></b></th></tr> <tr><th colspan="3"><b><u>'. $heading .'</u></b></th></tr> </table> <table> <tr>'; $dt1=($date1 != 0) ? $date1 : "-" ; $dt2=($date2 != 0) ? $date2 : "-" ; $html.='<td colspan="3"> Period : '.$dt1.' to '.$dt2.'</td> </tr> </table> <br/><hr>'; $current_assets = array(); $non_current_assets = array(); $current_labilities = array(); $non_current_liabilities=array(); $owners_equity = array(); $chart_types=$this->mastermodel->get_data_joined('finance_chart_type', 'chart_account_group', 'chart_group', 'chart_group_id', '', '', ""); foreach ($chart_types as $list){ if($list['account_group']=="current_assets") $current_assets[]=$list['chart_type_id']; if($list['account_group']=="non_current_assets") $non_current_assets[]=$list['chart_type_id']; if($list['account_group']=="current_liabilities") $current_labilities[]=$list['chart_type_id']; if($list['account_group']=="non_current_liabilities") $non_current_liabilities[]=$list['chart_type_id']; if($list['account_group']=="equity") $owners_equity[]=$list['chart_type_id']; } $c_assets = ""; $nc_assets = ""; $c_liablities = ""; $nc_liablities = ""; $equity = ""; $c_assets_sum = 0; $nc_assets_sum = 0; $c_liablities_sum = 0; $nc_liablities_sum = 0; $equity_sum = 0; foreach ($result as $list) { $list['account_amount']=$list['account_amount_debit']-$list['account_amount_credit']; // foreach ($account as $list) { if (in_array($list['chart_id'], $current_assets)) { $c_assets.='<tr> <td style="text-align:left">' . $list['account_name']. '</td> <td></td> <td style="text-align:right">' . number_format($list['account_amount'], 2) . '</td> </tr>'; $c_assets_sum+=$list['account_amount']; } if (in_array($list['chart_id'], $non_current_assets)) { $nc_assets.='<tr> <td style="text-align:left">' . $list['account_name'] . '</td> <td></td> <td style="text-align:right">' . number_format($list['account_amount'], 2) . '</td> </tr>'; $nc_assets_sum+=$list['account_amount']; } if (in_array($list['chart_id'], $current_labilities)) { $c_liablities.='<tr> <td style="text-align:left">' . $list['account_name'] . '</td> <td></td> <td style="text-align:right">' . number_format($list['account_amount'], 2) . '</td> </tr>'; $c_liablities_sum+=$list['account_amount']; } if (in_array($list['chart_id'], $non_current_liabilities)) { $nc_liablities.='<tr> <td style="text-align:left">' . $list['account_name'] . '</td> <td></td> <td style="text-align:right">' . number_format($list['account_amount'], 2) . '</td> </tr>'; $nc_liablities_sum+=$list['account_amount']; } if (in_array($list['chart_id'], $owners_equity)) { $equity.='<tr> <td style="text-align:left">' . $list['account_name'] . '</td> <td></td> <td style="text-align:right">' . number_format($list['account_amount'], 2) . '</td> </tr>'; $equity_sum+=$list['account_amount']; } // } } $html.=' <table cellspacing="-1" style="widtd:100%;text-align:left;"> <tr> <td></td> <td></td> <td style="text-align:right"><b style="text-align:right">Amount</b></td> </tr> <tr> <td style="text-align:left">ASSETS</td> <td></td> <td></td> </tr> <tr> <td style="background-color: #E9E123;text-align:left">Current Assets</td> <td></td> <td></td> </tr> '.$c_assets .' <tr> <td style="text-align:left" >Total Current Assets</td> <td></td> <td style="text-align:right">'. number_format($c_assets_sum, 2) .'</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td style="background-color: #E9E123;text-align:left">Non Current Assets</td> <td></td> <td></td> </tr> '. $nc_assets .' <tr> <td style="text-align:left">Total Non Current Assets</td> <td></td> <td style="text-align:right">'. number_format($nc_assets_sum, 2) .'</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td>TOTAL ASSETS</td> <td></td> <td style="text-align:right">'. number_format(($c_assets_sum + $nc_assets_sum), 2) .'</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td> LIABILITIES AND OWNERS EQUITY</td> <td></td> <td></td> </tr> <tr> <td style="background-color: #E9E123;text-align: left;"> Current Liabilities</td> <td></td> <td></td> </tr> '. $c_liablities .' <tr> <td style="text-align: left;">Total Current Liabilities</td> <td></td> <td style="text-align:right">'. number_format($c_liablities_sum, 2) .'</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td style="background-color: #E9E123;text-align: left;">Non Current Liabilities</td> <td></td> <td></td> </tr> '. $nc_liablities .' <tr> <td style="text-align: left;">Total Non Current Liabilities</td> <td></td> <td style="text-align:right">'. number_format($nc_liablities_sum, 2) .'</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td style="text-align: left;">TOTAL LIABILITIES</td> <td></td> <td style="text-align:right">'. number_format(($c_liablities_sum + $nc_liablities_sum), 2) .'</td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td style="background-color: #E9E123;text-align: left;">OWNERS EQUITY</td> <td></td> <td></td> </tr> '. $equity .' <tr> <td style="text-align: left">TOTAL EQUITY</td> <td></td> <td style="text-align:right">'. number_format($equity_sum, 2) .'</td> </tr> <tr> <td style="text-align: left">TOTAL LIABILITIES AND OWNERS EQUITY</td> <td></td> <td style="text-align:right">'. number_format(($c_liablities_sum + $nc_liablities_sum + $equity_sum), 2) .'</td> </tr> </table> </body> </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; } ?>