?
Current Path : /home1/savoy/www/savoyglobal.net/sibs_draft/system/application/views/Report/ |
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/sibs_draft/system/application/views/Report/salesbranchwisepdf.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 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"> <tr><td colspan="2" align="left">' . $image . '</td></tr></table><br/>'; $html.='<div style="text-align:center"><b><u>Branch Production Report</u></b> </div><br/><br/>'; if ($search == "") $search = 'search'; if (!$todate == '') $todate = 'to ' . $todate; $brname = $this->mastermodel->get_data_srow('ourbranch', $search, 'id'); $html.='<table width="90%" class="sort" border="0" cellpadding="1" cellspacing="1">'; $k = 0; $incr = 0; $cctot = 0; $actot = 0; $nettot = 0; $gptot = 0; $tot_pre_rec = 0; $brtot_pre_rec = 0; $brcctot = 0; $bractot = 0; $brnettot = 0; $brgptot = 0; $cvrid = 'unknown'; $coveridsort = array(); foreach ($viewinfo as $key => $row) { $coveridsort[$key] = $row['cover_id']; } array_multisort($coveridsort, SORT_DESC, $viewinfo); foreach ($viewinfo as $updata) { if ($updata['cover_id'] != $cvrid) { $i = 1; if ($k != 0) { $html.=' <tr><td colspan="6" align="center">Total (' . $updata['currencycode'] . ')</td> <td style="text-align:right">' . number_format($gptot, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($cctot, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($actot, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($nettot, 2, '.', ',') . '</td> </tr>'; $cctot = 0; $actot = 0; $nettot = 0; $gptot = 0; $tot_pre_rec = 0; } $html.='</table>'; $html.='<div style="text-align:left"><b>Branch:</b>' . $brname->branchname . ' </div><br/><br/>'; $html.='<div style="text-align:left"><b>Cover:</b> ' . $updata['covertype'] . '</div><br/><br/>'; $html.='<div style="text-align:left"><b>Period:</b>' . $fromdate . ' ' . $todate . ' </div><br/><br/>'; $html.='<table class="reportheader"> <tr> <td style="width:20%"></td> <td></td> </tr> <tr> <td style="width:20%"></td> <td></td> </tr> <tr> <td style="width:20%"></td> <td></td> </tr>'; $html.='</table> <table width="100%" class="sort" border="1" cellpadding="1" cellspacing="-1"> <thead> <tr > <th style="background-color:#80C0FF;">Sl No</th> <th style="width:10%;background-color:#80C0FF;">Issue Date</th> <th style="background-color:#80C0FF;">Quotation Ref No</th> <th style="background-color:#80C0FF;">Insured/Policy No</th> <th style="background-color:#80C0FF;">Insurer</th> <th style="background-color:#80C0FF;">Account Holder</th> <th style="background-color:#80C0FF;">Gross Premium</th> <th style="background-color:#80C0FF;">Brokerage Commission</th> <th style="background-color:#80C0FF;">Commission Others</th> <th style="background-color:#80C0FF;">Net Premium</th> </tr></thead>'; $cvrid = $updata['cover_id']; } $k++; if ($updata['insurance_company_id'] != 0) $comp = $this->mastermodel->get_data_srow('insurance_company', $updata['insurance_company_id'], 'id'); else $comp->company_name = ''; $stf = $this->mastermodel->get_data_srow('staffpersonaldetails', $updata['staffid'], 'id'); $type = $this->customermodel->getSingleFieldValue('customers', 'type', 'id', $updata['customerid']); if ($type == "Individual") { $cus = $this->mastermodel->get_data_srow('customer_personal_ind', $updata['customerid'], 'customer_id'); } else { $cus = $this->mastermodel->get_data_srow('customer_corp_info', $updata['customerid'], 'customer_id'); } $premium = $updata['premium']; $policy_fees = $updata['policy_fees']; if ($updata['ispercentage']) { $brokerage = ($premium*$updata['brokerage'])/100; } else { $brokerage = $updata['brokerage']; } if ($updata['endmode'] == 'Deduction') { $premium = -$premium; $policy_fees = -$policy_fees; $brokerage = -$brokerage; } $bc = $brokerage; if ($updata['ispercentage']) { $ac = (($premium * $updata['percentage']) / 100); $cc = $bc - $ac; } else { $ac = $updata['percentage']; $cc = $bc + $ac; } $html.='<tr> <td>' . $i++ . '</td> <td>' . $this->mastermodel->convdatformat($updata['qdate']) . '</td> <td>' . $updata['qtnref'] . '</td> <td>' . $cus->insured . ' / ' . $updata['policy_no'] . ' </td> <td>' . $comp->company_name . '</td> <td>' . $stf->name . '</td> <td style="text-align:right">' . number_format($premium + $policy_fees, 2, '.', ',') . '</td>'; $html.='<td style="text-align:right">' . number_format($cc, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($ac, 2, '.', ',') . '</td>'; if ($updata['ispercentage']) $net = ($premium - ($bc)) + $policy_fees; else $net = ($premium + ($bc)) + $policy_fees; $gp = $premium + $policy_fees; $cctot+=$cc; $actot+=$ac; $nettot+=$net; $gptot+=$gp; $brcctot+=$cc; $bractot+=$ac; $brnettot+=$net; $brgptot+=$gp; $html.='<td style="text-align:right">' . number_format($net, 2, '.', ',') . '</td></tr>'; } if ($viewinfo) { $html.='<tr> <td colspan="6" align="center">Total (' . $updata['currencycode'] . ')</td> <td style="text-align:right">' . number_format($gptot, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($cctot, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($actot, 2, '.', ',') . '</td> <td style="text-align:right">' . number_format($nettot, 2, '.', ',') . '</td> </tr> <tr> <td colspan="6" align="center"> <strong>Gross Total (' . $updata['currencycode'] . ')</strong></td> <td style="text-align:right"><strong>' . number_format($brgptot, 2, '.', ',') . '</strong></td> <td style="text-align:right"><strong>' . number_format($brcctot, 2, '.', ',') . '</strong></td> <td style="text-align:right"><strong>' . number_format($bractot, 2, '.', ',') . '</strong></td> <td style="text-align:right"><strong>' . number_format($brnettot, 2, '.', ',') . '</strong></td></tr>'; } $html.='</table>'; $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, 'Sales-Branchwise', 'true'); ?>