?
Current Path : /home1/savoy/www/savoyglobal.net/drafthr/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/www/savoyglobal.net/drafthr/system/application/views/Accounting/pdf_ageing_report.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; $compname=$company['company']; $address=$company['address']; $phone=$company['phone']; $website=$company['website']; $fax=$company['fax']; $email=$company['email']; // 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 35px 20px;"><table width="100%" border="0" cellpadding="2" cellspacing="2"> <tbody><tr><td style="width:300px" align="left">'.$image.'</td> </tr></table><br/>'; $html.='<div align="center"><b><u>Statement Of Account Outstanding As At '.$date1.'</u></b></div>'; if($maintype==3) { $type=$accdet->type; if($type=='Individual') { $insured=$this->customermodel->getSingleFieldValue('customer_personal_ind','insured','customer_id',$cid); } else { $insured=$this->customermodel->getSingleFieldValue('customer_corp_info','insured','customer_id',$cid); } $insured=ucwords($insured); } else { $insured=ucwords($accdet->name); } $html.='<head><body><table width="100%" border="0" cellpadding="2" cellspacing="2"> <tbody><tr><td><table><tr><td align="left">'.$compname.'</td></tr> <tr><td align="left">'.$address.'</td></tr> <tr><td align="left">Tel :'.$phone.'</td></tr> <tr><td align="left">Fax :'.$fax.'</td></tr> <tr><td align="left">Email :'.$email.'</td></tr></table></td> <td align="right"><table><tr><td align="left">'.$insured.'</td></tr> <tr><td align="left">'.$accdet->address.'</td></tr> <tr><td align="left">P.O BOX :'.$accdet->postbox.'</td></tr> <tr><td align="left">'.$accdet->cityname.' '.$accdet->countryname.'</td></tr> <tr><td align="left">Code :'.$accdet->code.'</td></tr></td></table></td></tr></table>'; $html.='<br/><hr>'; $html.='<div align="center">AGING ANALYSIS</div>'; $html.='<table width="100%" border="1" cellpadding="1" cellspacing="1"> <tr><th style="background-color:#80C0FF;">Balance</th> <th style="background-color:#80C0FF;">Current</th> <th style="background-color:#80C0FF;">> 30 Days</th> <th style="background-color:#80C0FF;">> 90 Days</th> <th style="background-color:#80C0FF;">> 180 Days</th> <th style="background-color:#80C0FF;">> 270 Days</th> <th style="background-color:#80C0FF;">> 365 Days</th></tr>'; $html.='<tr><td>'.$balance.'</td><td>'.$current.'</td><td>'.$lthirty.'</td> <td>'.$lninty.'</td><td>'.$loneeighty.'</td> <td>'.$ltseventy.'</td><td>'.$ltsixty.'</td></tr></table>'; $html.='<br/><br/><br/> <table width="100%" border="0" cellpadding="1" cellspacing="1"> <thead> <tr> <th style="background-color:#80C0FF;width:100px;width:15%">Date</th> <th style="background-color:#80C0FF;width:15%">Transaction No</th> <th style="background-color:#80C0FF;width:30%">Description</th> <th style="background-color:#80C0FF;width:13%">Debit</th> <th style="background-color:#80C0FF;width:13%">Credit</th> <th style="background-color:#80C0FF;width:14%">Balance</th> </tr></thead>'; $balance=0; $totdebit=0; $totcredit=0; $totbal=0; // $totalloc=0; // $balancealloc=0; // $totbalalloc=0; $dnewdate=$this->accountingsmodel->mintransdate($accountcode,$maintype); $open=$this->accountingsmodel->opening_bal_statementacc($dnewdate,$accountcode,'gl_trans'); if($dnewdate) { $dnewdate1=$this->mastermodel->convdatformat($dnewdate); } else { $dnewdate1=""; } if(isset($open->row()->debit)||isset($open->row()->credit)) { $opendebit=$open->row()->debit; $opencredit=$open->row()->credit; // $openalloc=$open->row()->alloc; } else { $opendebit=0; $opencredit=0; // $openalloc=0; } $opencredit=0-$opencredit; $openbal=$opendebit-$opencredit; if($openbal<0) { $openbal=abs($openbal); $sfx="Cr"; } else if($openbal>0) { $sfx="Dr"; } else { $sfx=""; } // $openbalalloc=$openbal-$openalloc; $balance=$openbal; $totdebit=$opendebit; $totcredit=$opencredit; // $totalloc=$openalloc; $html.='<tr style="font-weight:bold"> <td style="width:15%"></td> <td style="width:15%"></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($openbal,'2').' '.$sfx.'</td> </tr>'; foreach($statement as $dbt) { $cover=$dbt['cover']; $tdate=$this->mastermodel->convdatformat($dbt['tran_date']); $amount=$dbt['amount']; // $pid=$dbt['pid']; $qref=$dbt['quotation_ref']; $refs=$dbt['reference']; $acc=$dbt['account']; // $alloc=$dbt['alloc']; // echo $amount.'<br>'; $policyno=$dbt['policyno']; $qid=$dbt['qid']; $plid=$dbt['placingid']; $trtype=$dbt['type']; $balance+=$amount; if($trtype=='issue') { $qtnref=$policyno.','.$dbt['quotation_ref'].''; } else if($trtype=='endorsement') { $enddet=$this->policiesmodel->getendorsementpayment($qid,$plid); $qtnref=$enddet[0]['endpolicyno'].','.$enddet[0]['endrefno'].''; } else if($trtype=='cancellation') { $candet=$this->policiesmodel->getcancellationpayment($qid,$plid); $qtnref=$candet[0]['canpolicyno'].','.$candet[0]['canrefno'].''; } if($balance<0) { $newbalance=abs($balance); $sfx="Cr"; } else { $newbalance=$balance; $sfx="Dr"; } // $balancealloc+=$amount; // if($balancealloc<0) // { // $balancealloc=abs($balancealloc); // $sfx="Cr"; // } // else // { // $sfx="Dr"; // } // // $newbalalloc=abs($amount)-$alloc; if($amount>0) { $debit=$amount; $credit=0; } else { $debit=0; $credit=0-$amount; } if($plid=='0') { $description=$dbt['memo']; } else { if($maintype==2) { $description=$qtnref.', '.$cover; } else { $comp=$dbt['company_name']; $description=$qtnref.', '.$cover.', '.$comp; } } $html.='<tr style="font-size:11px" > <td style="width:15%">'.$tdate.'</td> <td style="width:15%">'.$refs.'</td> <td style="width:30%">'.$description.'</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%">'.number_format($newbalance,'2').' '.$sfx.'</td> </tr>'; $totdebit+=$debit; $totcredit+=$credit; // $totalloc+=$alloc; // $totbalalloc+=$newbalalloc; } $totbal=$totdebit-$totcredit; if($totbal<0) { $totbal=abs($totbal); $sfx3="Cr"; } else { $sfx3="Dr"; } $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($totbal,'2').' '.$sfx3.'</td> </tr>'; $html.='</table><br/><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; pdf_create($html, 'Aging Report','true'); ?>