?
Current Path : /home1/savoy/public_html/savoyglobal.net/horeitia/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/horeitia/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->mastermodel->get_data('payroll_invoice_purchase_order',$viewinfo->invoice_id,'invoice_id'); $purchase_order_id=''; foreach($poinfo as $po) $purchase_order_id.=$po['po_id'].'~'; $job_info=$this->timesheetmodel->get_jobs_info($purchase_order_id); $client_timesheet=$this->timesheetmodel->get_client_timesheet_invoice_info($purchase_order_id,$start_date,$end_date); $manpower_timesheet=$this->timesheetmodel->get_manpower_timesheet_invoice_info($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> <style> @page { margin: 100px 0 50px 0; } </style> <body>"; $invoice.="<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>"; $customer_po=''; $customer_site=''; foreach($job_info as $list) { $customer_name = $list['customer_name']; $customer_address = $list['customer_address']; $company_name = $list['purchase_order_company_name']; $customer_po .= $list['customer_purchase_order_no'].", "; $customer_site .= $list['site_name'].", "; } $customer_po=rtrim($customer_po,', '); $customer_site=rtrim($customer_site,', '); $invoice.="<table width='90%' class='sort' border='0' cellpadding='1' cellspacing='-1' style='margin-left:20px;'> <tr> <td>Invoice No : ".$viewinfo->invoice_no."</td> <td align='right'>Date : ".$this->mastermodel->convertdatenormalformat($viewinfo->invoice_date)."</td> </tr> <tr> <td><strong> ".$customer_name."</strong></td> <td></td> </tr> <tr> <td>".$customer_address."</td> <td></td> </tr> <tr> <td>Site : ".$customer_site."</td> <td></td> </tr> <tr> <td>PO : ".$customer_po."</td> <td></td> </tr> "; $invoice_fields=$this->mastermodel->get_data('payroll_invoice_field',$viewinfo->invoice_id,'invoice_id'); foreach($invoice_fields as $k=>$row) { $header_value = $row['label_text']; if($row['label_value']!='') $header_value.= " : ".$row['label_value']; $invoice.="<tr> <td>".$header_value."</td> <td></td> </tr>"; } $invoice.="<br/><br/>"; $invoice.=" <tr> <table width='90%' class='sort' border='1' cellpadding='1' cellspacing='-1' style='margin-left:20px;'> <tr><td colspan='6' style='text-align: center;' Invoice Information</td></tr> <tr> <th bgcolor='#aaaaaa'>Sl No</th> <th bgcolor='#aaaaaa'>Trade</th> <th bgcolor='#aaaaaa'>Manpower</th> <th bgcolor='#aaaaaa'>Man Hrs</th> <th bgcolor='#aaaaaa'>Rate/Hr</th> <th bgcolor='#aaaaaa'>Amount</th> </tr>"; $slno=1; $grand_total=0; foreach($client_timesheet as $clientsheet) { $normal_hours=$clientsheet['normal_hours']; if($clientsheet['ot_rate']==$clientsheet['normal_rate']&&$clientsheet['hot_rate']==$clientsheet['normal_rate']) { $normal_hours+=$clientsheet['ot_hours']; $normal_hours+=$clientsheet['hot_hours']; $flag=0; } else $flag=1; $invoice.=" <tr> <td width='10%' style='text-align: center;'>".$slno++."</td> <td width='30%'>".rtrim($clientsheet['trade_name'], '- ')."</td> <td width='10%' style='text-align: center;'>".$clientsheet['manpower']."</td> <td width='15%' style='text-align: right;'>".number_format($normal_hours,2)."</td> <td width='10%' style='text-align: right;'>".number_format($clientsheet['normal_rate'],2)."</td> <td width='25%' style='text-align: right;'>". number_format($normal_hours*$clientsheet['normal_rate'],2)."</td> </tr>"; if($flag==1) { if($clientsheet['ot_hours']!=0) { $invoice.="<tr><td></td><td>OT</td> <td></td> <td style='text-align: right;'>".number_format($clientsheet['ot_hours'],2)."</td>"; $invoice.="<td style='text-align: right;'>".number_format($clientsheet['ot_rate'],2)."</td> <td style='text-align: right;'>".number_format($clientsheet['ot_hours']*$clientsheet['ot_rate'],2)."</td></tr>"; } } if($flag==1) { if($clientsheet['hot_hours']!=0) { $invoice.="<tr><td></td><td>HOT</td> <td></td> <td style='text-align: right;'>".number_format($clientsheet['hot_hours'],2)."</td>"; $invoice.="<td style='text-align: right;'>".number_format($clientsheet['hot_rate'],2)."</td> <td style='text-align: right;'>".number_format($clientsheet['hot_hours']*$clientsheet['hot_rate'],2)."</td></tr>"; } } $total_amount = $normal_hours*$clientsheet['normal_rate'] + $clientsheet['ot_hours']*$clientsheet['ot_rate'] + $clientsheet['hot_hours']*$clientsheet['hot_rate']; $grand_total+=$total_amount; } $total_words = $this->mastermodel->convert_number($grand_total); $num_array = explode('.', number_format($grand_total,2)); if(!empty($num_array) && $num_array[1] !="00") { $total_words .= " & ".$num_array[1]." /100"; } $total_words .= " only"; $invoice.="<tr> <td colspan='5' style='text-align: right;font-weight: bold;'>Total</td> <td style='text-align: right;font-weight: bold;'>".number_format($grand_total,2)."</td> </tr> <tr> <td colspan='6' style='text-align: left;font-weight: bold;'>QAR. ".$total_words."</td> </tr> </table> </tr> </table><br/>"; $invoice.='<table width="100%"> <tr><td align="center"><strong>**THANK YOU - WE APPRECIATE YOUR BUSINESS**</strong></td></tr> </table><br/><br/>'; $invoice.='<table style="margin-left:20px;"> <tr><td><strong>For. '.$company_name.'</strong></td></tr> </table>'; $invoice.='<br/><br/><br/><br/><table style="margin-left:20px;"> <tr><td>[Authorized Signatory]</td></tr> </table>'; $invoice.='</body></html>'; pdf_create($invoice, 'Invoice','false'); //echo $invoice; ?>