?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/draft/application/views/Timesheet/ |
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/sgms/draft/application/views/Timesheet/invoice_pdf.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); //$this->load->view('documentreadyfunctions'); $start_date=$this->mastermodel->convertdateformat($viewinfo->invoice_start_date); $end_date=$this->mastermodel->convertdateformat($viewinfo->invoice_end_date); $poinfo=$this->timesheetmodel->get_job_info_single($viewinfo->purchase_order_id); $client_timesheet=$this->timesheetmodel->get_client_timesheet_invoice_info($viewinfo->purchase_order_id,$start_date,$end_date); $manpower_timesheet=$this->timesheetmodel->get_manpower_timesheet_invoice_info($viewinfo->purchase_order_id,$start_date,$end_date); $invoice="<html> <head> <title>Invoice</title> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'> </head> <body> <table width='100%' style='margin-left:10px;'> <tr><td style='font-size: 20px;' align='center'><b><u>".$viewinfo->invoice_heading."</u></b></td></tr> </table><br><br>"; $invoice.="<table width='90%' class='sort' border='0' cellpadding='1' cellspacing='-1' style='margin-left:20px;'> <tr> <td>Invoice No : ".$viewinfo->invoice_no."/". date('M Y')."</td> <td>Date : ".$this->mastermodel->convertdatenormalformat($viewinfo->invoice_date)."</td> </tr> <tr> <td><strong> ". $poinfo->customer_name."</strong></td> <td></td> </tr> <tr> <td>". $poinfo->customer_address."</td> <td></td> </tr>"; $invoice_fields=$this->mastermodel->get_data('payroll_invoice_field',$viewinfo->invoice_id,'invoice_id'); foreach($invoice_fields as $k=>$row) { $invoice.="<tr> <td>".$row['label_text']." : ".$row['label_value']."</td> <td></td> </tr>"; } $invoice.="<br/><br/>"; $invoice.=" <tr> <table width='90%' class='sort' border='1' cellpadding='1' cellspacing='-1' style='margin-left:30px;'> <tr><td colspan='6' style='text-align: center;' Invoice Information for ".$poinfo->customer_purchase_order_no."</td></tr> <tr> <th bgcolor='#7FCEFF'>Sl No</th> <th bgcolor='#7FCEFF'>Trade</th> <th bgcolor='#7FCEFF'>Manpower</th> <th bgcolor='#7FCEFF'>Man Hrs</th> <th bgcolor='#7FCEFF'>Rate/Hr</th> <th bgcolor='#7FCEFF'>Amount</th> </tr>"; $slno=1; $grand_total=0; $man=array(); foreach($manpower_timesheet as $mansheet) { $man[]=$mansheet['trade_id']; } foreach($client_timesheet as $clientsheet) { $ot_type=$this->timesheetmodel->get_ot_type($poinfo->purchase_order_id,$clientsheet['trade_id']); $key=array_search($clientsheet['trade_id'], $man); if(is_numeric($key)) { $manpower=$clientsheet['manpower']+$manpower_timesheet[$key]['manpower']; $normal_hours=($clientsheet['normal_hours']-$clientsheet['ot_hours']-$clientsheet['hot_hours'])+($manpower_timesheet[$key]['normal_hours']-$manpower_timesheet[$key]['ot_hours']-$manpower_timesheet[$key]['hot_hours']); if($ot_type==0) { $ot_hours=0; $hot_hours=0; $ot_rate=0; $hot_rate=0; $normal_hours = $normal_hours+$clientsheet['ot_hours']+$manpower_timesheet[$key]['ot_hours']+$clientsheet['hot_hours']+$manpower_timesheet[$key]['hot_hours']; } else { $ot_hours=$clientsheet['ot_hours']+$manpower_timesheet[$key]['ot_hours']; $hot_hours=$clientsheet['hot_hours']+$manpower_timesheet[$key]['hot_hours']; } unset($manpower_timesheet[$key]); } else { $normal_hours=$clientsheet['normal_hours']-$clientsheet['ot_hours']-$clientsheet['hot_hours']; if($ot_type==0) { $ot_hours=0; $hot_hours=0; $ot_rate=0; $hot_rate=0; $normal_hours = $normal_hours+$clientsheet['ot_hours']+$clientsheet['hot_hours']; } else { $ot_hours=$clientsheet['ot_hours']; $hot_hours=$clientsheet['hot_hours']; } $manpower=$clientsheet['manpower']; } $invoice.=" <tr> <td width='10%' style='text-align: center;'>".$slno++."</td> <td width='30%'>".$clientsheet['trade_name']."</td> <td width='15%' style='text-align: center;'>".$manpower."</td> <td width='20%' style='text-align: right;'>".number_format($normal_hours)."</td> <td width='30%' style='text-align: right;'>".$clientsheet['normal_rate']."</td> <td width='10%' style='text-align: right;'>". number_format($clientsheet['normal_rate']*$normal_hours,2)."</td> </tr> "; if($ot_type!=0) { if($ot_hours!=0) { $invoice.="<tr><td></td><td>OT</td> <td></td> <td style='text-align: right;'>".$ot_hours."</td>"; if($clientsheet['ot_rate']=="0.00") { $ot_rate= $clientsheet['normal_rate']; } else { $ot_rate= $clientsheet['ot_rate']/100*$clientsheet['normal_rate']; } $invoice.="<td style='text-align: right;'>".$ot_rate= number_format($ot_rate,2)."</td> <td style='text-align: right;'>".number_format($ot_rate*$ot_hours,2)."</td></tr>"; } if($hot_hours!=0) { $invoice.=" <tr> <td></td> <td>HOT</td> <td></td> <td style='text-align: right;'>".$hot_hours."</td> "; if($clientsheet['hot_rate']=="0.00") { $hot_rate= $clientsheet['normal_rate']; } else { $hot_rate= $clientsheet['hot_rate']/100*$clientsheet['normal_rate']; } $invoice.="<td style='text-align: right;'>".$hot_rate = number_format($hot_rate,2)."</td> <td style='text-align: right;'>".number_format($hot_rate*$hot_hours,2)."</td> </tr>"; } } $total_amount = $clientsheet['normal_rate']*$normal_hours + $ot_rate*$ot_hours + $hot_rate*$hot_hours; $grand_total+=$total_amount; } foreach($manpower_timesheet as $mansheet) { $ot_type=$this->timesheetmodel->get_ot_type($poinfo->purchase_order_id,$mansheet['trade_id']); $manpower=$mansheet['manpower']; $normal_hours=$mansheet['normal_hours']-$mansheet['ot_hours']-$mansheet['hot_hours']; if($ot_type==0) { $ot_hours=0; $hot_hours=0; $ot_rate=0; $hot_rate=0; $normal_hours = $mansheet['ot_hours']+$mansheet['hot_hours']; } else { $ot_hours=$mansheet['ot_hours']; $hot_hours=$mansheet['hot_hours']; } $invoice.=" <tr> <td width='10%' style='text-align: center;'>".$slno++."</td> <td width='30%'>".$mansheet['trade_name']."</td> <td width='15%' style='text-align: center;'>".$manpower."</td> <td width='20%' style='text-align: right;'>".number_format($normal_hours)."</td> <td width='30%' style='text-align: right;'>".$mansheet['normal_rate']."</td> <td width='10%' style='text-align: right;'>". number_format($mansheet['normal_rate']*$normal_hours,2)."</td> </tr>"; if($ot_type!=0) { if($ot_hours!=0) { $invoice.=" <tr> <td></td> <td>OT</td> <td></td> <td style='text-align: right;'>".$ot_hours."</td>"; if($mansheet['ot_rate']=="0.00") { $ot_rate= $mansheet['normal_rate']; } else { $ot_rate= $mansheet['ot_rate']/100*$mansheet['normal_rate']; } $invoice.="<td style='text-align: right;'>".$ot_rate= number_format($ot_rate,2)."</td> <td style='text-align: right;'>".number_format($ot_rate*$ot_hours,2)."</td> </tr>"; } if($hot_hours!=0) { $invoice.="<tr> <td></td> <td>HOT</td> <td></td> <td style='text-align: right;'>".$hot_hours."</td> "; if($mansheet['hot_rate']=="0.00") { $hot_rate= $mansheet['normal_rate']; } else { $hot_rate= $mansheet['hot_rate']/100*$mansheet['normal_rate']; } $invoice.="<td style='text-align: right;'>".$hot_rate = number_format($hot_rate,2)."</td> <td style='text-align: right;'>".number_format($hot_rate*$hot_hours,2)."</td> </tr>"; } } $total_amount = $mansheet['normal_rate']*$normal_hours + $ot_rate*$ot_hours + $hot_rate*$hot_hours; $grand_total+=$total_amount; } $invoice.="<tr> <td colspan='5' style='text-align: right;font-weight: bold;'>Total</td> <td style='text-align: right;font-weight: bold;'>".$grand_total."</td> </tr> </table> </tr> </table>"; $invoice.='<script type="text/php"> if ( isset($pdf) ) { $font = Font_Metrics::get_font("verdana", "normal"); $pdf->page_text(20, 760, "'.$viewinfo->invoice_footer.'", $font, 10, array(0,0,0)); } </script> </body></html>'; pdf_create($invoice, 'Invoice','false'); //echo $invoice; ?>