<?php
 

        $PONO = '';
		$CompanyAddress = '';
        $CompanyName = '';
	    $SuplierName = '';
		$SuplierAddress = '';
		$DeliveryAddress = '';
		$Podt = '';
		$DeliveryDate ='';
		$ServiceDescription = '';
     
         if(!empty($CompanyDetails))
		{
        foreach ($CompanyDetails as $CO)
          {
		    $CompanyName = $CO->CompanyName;
		    $CompanyAddress = $CO->Address;
		  }
        }	
  
        
		if(!empty($POItem))
		{
            foreach ($POItem as $PO)
           {
		     $PONO = $PO->PONO;
		     $SuplierName = $PO->SupplierName;
		     $SuplierAddress = $PO->Address;
		     $DeliveryAddress = $PO->DeliveryAddress;
		
		     $dt = new DateTime($PO->PODate, new DateTimeZone('Asia/Kolkata'));				
		     $Podt =  $dt->format('d-m-Y');
		     $dtDe = new DateTime($PO->DeliveryDate, new DateTimeZone('Asia/Kolkata'));				
		     $DeliveryDate =  $dtDe->format('d-m-Y');
		     $ServiceDescription =$PO->ServiceDescription;
		
	        }
        }


?>

 
<div><center>
<h2>IMPORT PURCHASE ORDER</h2> 
<a style="color:#515151">#PO0001</a></center>
</div>
 
<p> 
<b style="color:#3c8dbc">Siddharth Industries</b><br/>   Survey No: 168/1C3,Pennalur Pet Road,<br/>Goonipalyam village,Uthukottai Taluk,<br/>Tiruvallur Dist, Chennai,Tamilnadu,Pin code : 602026.</p>
<table style="border-collapse: collapse;"  cellpadding="0" cellspacing="0" border="1" width="100%">
<tr>
<td>
<p><a style="color:#3c8dbc">Vendor Address</a>  <br/> DR Enterprices <br/>Uthukottai Taluk,Tiruvallur Dist,<br/> Chennai,Tamilnadu,Pin code : 602026.</p></td>
<td>
<p><a style="color:#3c8dbc">Delivery To</a><br/>  Siddharth Industries<br/> Survey No: 168/1C3,Pennalur Pet Road, Goonipalyam village, <br/> Uthukottai Taluk,Tiruvallur Dist, Chennai,Tamilnadu,Pin code : 602026.<p></td>
<td><div align="right">Purchase Order Date :2/5/2017 , Delivery Date :10/5/2017</div></td>
</tr>
</table>
 
<table style="border-collapse: collapse;"  cellpadding="0" cellspacing="0" border="1" width="100%">
<tr style="background:#000;color:#fff;">
<th>#</th>
<th>Item and Description</th>
<th>Qty</th>
<th>Rate per unit</th>
<th>Landing Charge</th>
<th>High Seas Sales charge</th>
<th>Custom duty</th>
<th>Custom duty- Edu.cess</th>
<th>Custom duty-Sec & Hig Edu cess</th>
<th>Excise duty</th>
<th>Excise duty- Edu.cess</th>
<th>Excise duty-Sec & Hig Edu cess</th>
<th>Additional Excise duty</th>
<th>Gross duty payable</th>
<th>Available Modvat -set-off on import</th>
<th>Gross expenses due to custom duty</th>
<th>Total Amount(INR)</th>
</tr>

       <?php
           if(!empty($POItem))
            {
			    		$BasicValue=0;
				       	$ProductPrice = 0;
						$AfterLandingCharge= 0;
						$AfterHighSeasSalesCharge= 0;
						$AfterCustomDuty = 0;
						$AfterCustomEdCess = 0;
						$AfterCustomSHCess = 0;
						$AfterExciseDuty = 0;
						$AfterExciseDutyEdCess = 0;
						$ExciseDutySHCess = 0;
						$AfterAddlExciseDuty = 0;
						$Grossdutypayable = 0;
						$AvailableModvat = 0;
						$Grossexpensesduetocustomduty = 0;
						$purchaseratePerKG=0;
						$CustomDutyExpensesPerKG=0;
						$RMCIncludingCustomersPerKG=0;
						$AfterExciseDutySHCess=0;
                        $TotalOrderValue=0;

                        foreach($POItem as $record)
                        {
							$index = $index + 1;

       ?>



<!--<tr>
<td>1</td>
<td>Resin - (A grade)</td>
<td align="right">100</td>
<td align="right">120</td>
<td align="right">500</td>
<td align="right">1000</td>
<td align="right">1300</td>
<td align="right">100</td>
<td align="right">120</td>
<td align="right">500</td>
<td align="right">1000</td>
<td align="right">1300</td>
<td align="right">700</td>
<td align="right">1300</td>
<td align="right">7000</td>
<td align="right">200</td>
<td align="right">1,23,800</td>
</tr>
<tr>
<td>2</td>
<td>Dry Sand - (A grade)</td>
<td align="right">1000</td>
<td align="right">1200</td>
<td align="right">5000</td>
<td align="right">10000</td>
<td align="right">13000</td>
<td align="right">100</td>
<td align="right">120</td>
<td align="right">500</td>
<td align="right">1000</td>
<td align="right">1300</td>
<td align="right">7000</td>
<td align="right">1300</td>
<td align="right">7000</td>
<td align="right">2000</td>
<td align="right">12,38,000</td>
</tr>-->

<tr>
<td><?php echo $index ; ?></td>
<td><?php echo $record->MaterialName ; ?></td>
<td align="right"><?php echo $record->Quantity ; ?></td>
<td align="right"><?php echo $record->Rate ; ?></td>
<td align="right"><?php $BasicValue=($record->Quantity*$record->Rate);
									echo number_format($BasicValue,2) ; ?></td>
<td align="right"><?php echo $record->AfterLandingCharge; ?></td>
<td align="right"><?php echo $record->AfterHighSeasSalesCharge ; ?></td>
<td align="right"><?php echo $record->AfterCustomDuty ; ?></td>
<td align="right"><?php echo $record->AfterExciseDuty ; ?></td>
<td align="right"><?php echo $record->AfterExciseDutyEdCess ; ?></td>
<td align="right"><?php echo $record->AfterCustomEdCess ; ?></td>
<td align="right"><?php echo $record->AfterAddlExciseDuty ; ?></td>
<td align="right"><?php echo $record->Grossdutypayable ; ?></td>
<td align="right"><?php echo $record->AvailableModvat ; ?></td>
<td align="right"><?php echo $record->Grossexpensesduetocustomduty ; ?></td>
<td align="right"><?php echo $record->purchaseratePerKG ; ?></td>
<td align="right"><?php echo $record->CustomDutyExpensesPerKG ; ?></td>
<td align="right"><?php echo $record->RMCIncludingCustomersPerKG ; ?></td>
<td align="right"><?php echo $record->AfterCustomSHCess ; ?></td>
<td align="right"><?php echo $record->AfterExciseDutySHCess ; ?></td>
<td align="right"><?php echo $record->QuantityKG ; ?></td>
<td align="right"><?php echo $record->TotalOrderValue; ?></td>
</tr>


    			<?php

						$AfterLandingCharge= $AfterLandingCharge+$record->AfterLandingCharge;
						$AfterHighSeasSalesCharge=$AfterHighSeasSalesCharge+$record->AfterHighSeasSalesCharge ; 
						$AfterCustomDuty = $AfterCustomDuty+$record->AfterCustomDuty ;
						$AfterCustomEdCess = $AfterCustomEdCess+$record->AfterCustomEdCess ;
						$AfterCustomSHCess = $AfterCustomSHCess+$record->AfterCustomSHCess ;
						$AfterExciseDuty = $AfterExciseDuty+$record->AfterExciseDuty ;
						$AfterExciseDutyEdCess = $AfterExciseDutyEdCess+$record->AfterExciseDutyEdCess ;
						$AfterAddlExciseDuty = $AfterAddlExciseDuty+$record->AfterAddlExciseDuty ;
						$Grossdutypayable = $Grossdutypayable+$record->Grossdutypayable ;
						$AvailableModvat = $AvailableModvat+$record->AvailableModvat ;
						$Grossexpensesduetocustomduty = $Grossexpensesduetocustomduty+$record->Grossexpensesduetocustomduty ;
						$purchaseratePerKG = $purchaseratePerKG+$record->purchaseratePerKG ;
						$CustomDutyExpensesPerKG = $CustomDutyExpensesPerKG+$record->CustomDutyExpensesPerKG ;
						$RMCIncludingCustomersPerKG = $RMCIncludingCustomersPerKG+$record->RMCIncludingCustomersPerKG ;
						$AfterExciseDutySHCess= $AfterExciseDutySHCess+$record->AfterExciseDutySHCess ;
                        $TotalOrderValue = $TotalOrderValue+$record->TotalOrderValue;
                    }
                    }
					
                ?>

</table>
<div align="right">
<table style="border-collapse: collapse;"  cellpadding="0" cellspacing="0" border="1" width="100%"> 
<tr>
	<td align="right">Landing charge :</td>
	<td align="right"><?php echo number_format($AfterLandingCharge,2);?></td>
<br/>
</tr>
<tr>
	<td align="right">High seas sales charge:</td>
	<td align="right"><?php echo number_format($AfterHighSeasSalesCharge,2);?></td>
<br/>
</tr>

<tr>
<td align="right">Custom duty : </td>
<td align="right"><?php echo  number_format($AfterCustomDuty,2);?></td>
</tr>

<tr>
<td align="right">Excise duty :</td>
<td align="right"><?php echo  number_format($AfterExciseDuty,2);?></td>
</tr>

<tr>
<td align="right">Excise duty ED_cess : </td>
<td align="right"><?php echo  number_format($AfterExciseDutyEdCess,2);?></td>
</tr>

<tr>
<td align="right">Excise duty S & H cess :</td>
<td align="right"><?php echo  number_format($AfterExciseDutySHCess,2);?></td>
</tr>

<tr>
<td align="right">Custom ED_cess : </td>
<td align="right"><?php echo  number_format($AfterCustomEdCess,2);?></td>
</tr>

<tr>
<td align="right">Custom S & H cess :</td>
<td align="right"><?php echo  number_format($AfterCustomSHCess,2);?></td>
</tr>

<tr>
<td align="right">Additional Excise duty :</td>
<td align="right"><?php echo  number_format($AfterAddlExciseDuty,2);?></td>
</tr>

<tr>
<td align="right">Gross duty payable :</td>
<td align="right"><?php echo  number_format($Grossdutypayable,2);?></td>
</tr>

<tr>
<td align="right">Available Modvat set-off on import :</td>
<td align="right"><?php echo  number_format($AvailableModvat,2);?></td>
</tr>

<tr>
<td align="right">Gross expenses due to custom duty :</td>
<td align="right"><?php echo  number_format($Grossexpensesduetocustomduty ,2);?></td>
</tr>

<tr>
<td align="right">Purchase Rate :</td>
<td align="right"><?php echo  number_format($purchaseratePerKG,2);?></td>
</tr>

<tr>
<td align="right">Custom Duty Expenses :</td>
<td align="right"><?php echo  number_format($CustomDutyExpensesPerKG,2);?></td>
</tr>


<tr>
<td align="right">RMC Including Customers :</td>
<td align="right"><?php echo  number_format($RMCIncludingCustomersPerKG ,2);?></td>
</tr>


<tr>
<td align="right"><p><b>Total Order Amount :</b></p></td>
<td align="right"><?php echo  number_format($TotalOrderValue,2);?></td>
</tr>

</table>
<br>
<br>

</div>