siddharth_application/application/views/revenuepopdf.php
2017-09-18 17:08:27 +05:30

512 lines
19 KiB
PHP
Executable File

<?php
$PONO = '';
$postatus ='';
$CompanyAddress = '';
$CompanyName = '';
$SuplierName = '';
$SuplierAddress = '';
$DeliveryAddress = '';
$Podt = '';
$DeliveryDate ='';
$DeliverySchedule='';
$postatus='';
$ServiceDescription = '';
$PaymentTerms = '';
$PaymentOtherDescription='';
$type='';
$value='';
$amt='';
$totaltaxonly=0;
$advance=0;
$supOfferNo='';
$supRef = '';
$finCap='';
$modeofshipment='';
$insuranceno='';
$companyWebsit='';
$companyPan='';
$companyEmail='';
$companyGst='';
$supplierEmail='';
$supcode='';
$supplierPan='';
$supplierContact='';
$supplierGst='';
$statecode='';
$ourRef='';
if(!empty($CompanyDetails))
{
foreach ($CompanyDetails as $CO)
{
$CompanyName = $CO->CompanyName;
$CompanyAddress = $CO->Address;
$companyWebsit=$CO->companyWebsite;
$companyPan=$CO->PAN;
$companyEmail=$CO->EmailAddress;
$companyGst=$CO->GSTNO;
$statecode=$CO->StateCode;
}
}
if(!empty($POItem))
{
foreach ($POItem as $PO)
{
$PONO = $PO->PONO;
$postatus= $PO->Status;
$SuplierName = $PO->SupplierName;
$SuplierAddress = $PO->Address;
$supplierEmail=$PO->EmailAddress;
$supcode=$PO->SupplierID;
$supplierPan=$PO->PAN;
$supplierContact=$PO->ContactNumber;
$supplierGst=$PO->GSTNO;
$ourRef=$PO->Other_Reference;
$DeliveryAddress = $PO->DeliveryAddress;
$postatus= $PO->Status;
$advance=$PO->AdvanceAmount;
$dt = new DateTime($PO->PODate, new DateTimeZone('Asia/Kolkata'));
$Podt = $dt->format('d-m-Y');
if($PO->DeliveryOption=='1'){
$DeliveryDate = '';
$DeliverySchedule = $PO->DeliverySchedule;
}
else{
$dtDe = new DateTime($PO->DeliveryDate, new DateTimeZone('Asia/Kolkata'));
$DeliveryDate = $dtDe->format('d-m-Y');
$DeliverySchedule = '';
}
$ServiceDescription =$PO->ServiceDescription;
$supOfferNo = $PO->Supplier_Offer_No;
$supRef = $PO->Supplier_Reference;
$finCap = $PO->Fincap;
$modeofshipment = $PO->Mode_Of_Shipment;
$PaymentTerms = $PO->PaymentTerms;
$insuranceno = $PO->InsuranceNumber;
if($PaymentTerms=='Others'){
$PaymentOtherDescription=$PO->PaymentOtherDescription;
}
}
}
$currencyName='INR';
$currencyCode ='';
if(!empty($CurrencySymbol))
{
foreach ($CurrencySymbol as $Curr)
{
$currencyCode = $Curr->FontCode2000;
//$currencyName = $currencyName;
}
}
if(!empty($ParentMaster)){
foreach($ParentMaster as $pm){
$PPaymentTerms = $pm->PaymentTerms;
$PDeliverydate= $pm->DeliveryDate;
$dtDe = new DateTime($PDeliverydate, new DateTimeZone('Asia/Kolkata'));
$PDeliverydate = $dtDe->format('d-m-Y');
$PDeliverySchedule=$pm->DeliverySchedule;
}
}
?>
<style>
@page { margin: 280px 25px 210px 25px; }
.header { position: fixed; left: 0px; top: -280px; right: 0px; height: 500px;text-align: center; }
.footer { position: fixed; bottom: 10px;}
.pagenum:before { content: counter(page); }
</style>
<body>
<div class="footer" style="font-size:12px;">
<table style="border-collapse: collapse; " border="1" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<p><b>Note:</b> Please acknowledge receipt of this order for acceptance<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Material to be delivered to our stores before 3pm<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Please refer order number and item code in your challan/invoice</p>
<?php
if(!empty($releasedetails)){
$releasedOn = '';
foreach($releasedetails as $detail){
$releasedOn= new DateTime($detail->ReleasedOn, new DateTimeZone('Asia/Kolkata'));
?>
<div align="Left"> Released By : <?php echo $detail->FirstName;?></div>
<div align="Left"> Released On : <?php echo $releasedOn->format('d-m-Y');?></div>
<?php
}
}
else { }
?>
</td>
<td style="text-align: right;">
<p>For SIDDHARTH INDUSTRIES</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Authorised signatory</p>
</td>
</tr>
<tr><td colspan="2"><p style="text-align: center;">This is a system generated purchase order</p></td></tr>
</tbody>
</table>
Page: <span class="pagenum"></span>
</div>
<div class="header" style="font-size:12px;">
<div style="text-align:right;">
<?php
if ($postatus == PO_RELEASED || $postatus == PO_SERVICE_COMPLETED || $postatus == MRIR_APPROVED || $postatus == MRIR_REJECTED || $postatus == IGR_CREATED)
{ echo '<br>'; }
else
{
echo '<b>DRAFT</b>'; }
?>
</div>
<p>&nbsp;</p>
<table style="border-collapse: collapse;" border="1" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style= "text-align: center;" colspan="12"><center> <span style="font-size:24px;">PURCHASE ORDER </span></center></td>
</tr>
<tr>
<td style="width:1px;background-color: #2c0101;" rowspan="2"><center><img width="100" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA11JREFUeNrsnT9IHEEYxWfFw8rgpUhlo5URi2gTbIUUSrq1ui4oRLRIY9JIKrGKTQrBgJLuuutEi4CtSSOpPIuATdIEcid2YpN9C3sc8c6bf7uZmX0P7k7ultm7337zzXxvZjGaiaIfQoiqoHTUHk6eniSPUbLQUmUoebojB23dDZGBmQiQAAmQAAmQIkACJEACpAiweA3bbvDV5mb6+iKOxfTc3MDjf15dicbBQfr3591d7wBGM1H0J3l9bNLI84UFsby6mkIzFWACJMCafJ9PJyfSx29vbHQuoqJaxl34zc5O+mVtwIPi5EIcXV52IjnoLvx+by/9wXkIF8aHbq0dgYi4vOB1Q7QV2c4BXM4Z3r+RGBTAR9VqmqhVBoZnIyOdx9taTXqQGJ+YUDqXFwBV4WGU69aXRkNsr69LtyEzHfIKIKJCVl9PT3u+/63P+6bnC64SuWm3jdsYn5xkKcdamCJAAiwjQJcHAC8ATs/OBg1Qy0y4ub6WPhb1cuPwUFycn9/77OPWlvXzeQGw2QPGQ9o/PhZrS0v3IPpooFrpwgChYniidq6fnTnvrBSaA3Uc3A/1uvPuSmEA0f0uFLsyBKcZDjaisvSj8DsFW6pbcHPQpV12WQoBCHhri4taEOGwhJAXjeeBgFebn1eyp0LKi1Ym0rCsXieRqLk06HVetFqJwHmWnRz3yotHzabT9n0hpRxGZ0SjjpGKCEQkxgUtWDlbCyMfIi/qTHMgrDf7srCem5mQDS5YQNKRD2vCuQLMhCVM3bwIiK4PLIUYqrp5EXPFeGWFALO8CEdGddId7NYOHWFQUa1cUO4Fty78/fZW6tFrjx7gqfqAT0PbmWAqVCwq+bDUOxMeyokh6L8B1J1kE2BgIkACJMDyAbSx56/cACV3CoyOjfX9rNSrcrI7E/qVYYCnYhKY3LXkJECVOdx+Us51m6Nwm7HVQyUCf4UGEJuFZPMgIhC+XlYfw21WWQ/GxXJ50q09iBS1MSjYW73ww3SXMVXOobsk4MU80GQZc5DQbl5tOzWRRpS8nJqy1tUAzWZ7ecvKDdfdggWfTV0GbdnA4JB1UdhbHjo0LesAS6YWa2GaCQRIgARIESABEiABUgRIgARYRoAVYtBWBfcL/xb8hwS6av8VYADVjF2M5sTWJAAAAABJRU5ErkJggg==" width="80" /></center></td>
<td style="text-align: left;" colspan="5" rowspan="2">
<span><strong style="font-size:16px;"> <?php echo $CompanyName; ?> </strong></span><br>
<span><?php echo $CompanyAddress; ?></span><br><br><table>
<tr>
<td style="border: none;">
<strong>web: </strong><?php echo $companyWebsit; ?>
</td>
<td style="border: none;">
<strong> PAN:</strong> <?php echo $companyPan; ?>
</td>
</tr>
<tr>
<td style="border: none;">
<strong>Email: </strong><?php echo $companyEmail; ?>
</td>
<td style="border: none;">
<strong> GSTIN: </strong><?php echo $companyGst; ?>
</td>
</tr>
</table>
</td>
<td colspan="3">
<span><strong>Purchase Order No:</strong></span><br>
<span><?php echo $PONO?></span>
</td>
<td colspan="3">
<span><strong> PO Date :</strong> </span><br>
<span> <?php echo $Podt?></span>
</td>
</tr>
<tr>
<td colspan="3">
<span><strong>Supplier's Offer No</strong>:<br><?php echo $supOfferNo; ?></span>
</td>
<td colspan="3"><strong>Our Reference : </strong><br><?php echo $ourRef; ?></td> </tr>
<tr>
<td colspan="4" rowspan="2"><u><strong style="font-size:16px;">Shipped From:</strong></u><br /><?php echo $SuplierName?><br/><?php echo $SuplierAddress ?> <br/><br /><strong>Email :</strong><?php echo $supplierEmail; ?><br><table width="100%"><tr><td style="border: none;"><strong>Vendor code:</strong> <?php echo $supcode; ?> </td><td style="border: none;"><strong>PAN:</strong><?php echo $supplierPan; ?></td></tr><tr><td style="border: none;width:50%"><strong>Contact :</strong><?php echo $supRef; ?> </td><td style="border: none;"><strong>GSTIN:</strong><?php echo $supplierGst; ?></td></tr></table></td>
<td rowspan="2" colspan="2"><u><strong style="font-size:16px;">Shipped To:</strong></u><br /><?php echo $CompanyAddress;?><br> <strong>State code:</strong><?php echo $statecode;?> </td>
<td colspan="6"><strong>Delivery</strong> :<br><?php echo $DeliveryDate.$DeliverySchedule;?></td>
</tr>
<?php
if(!empty($RequistionDetails))
{
foreach($RequistionDetails as $ReqDetails)
{
?>
<tr>
<td><strong>Indent :</strong></td>
<td width="11%"><?php echo $ReqDetails['RequistionNo']; ?></td>
<td><?php $date = new DateTime($ReqDetails['ReqDate'],new DateTimeZone('Asia/Kolkata')); $date=$date->format("d-m-Y"); echo $date; ?></td>
<td ><strong>Dept:</strong> <?php echo $ReqDetails['RequestedDept']; ?></td>
<td ><strong>CCD: </strong><?php echo $ReqDetails['CostCenterCode']; ?></td>
<td><strong>Fin cap:</strong><?php echo $finCap; ?></td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
<div class="page" style="height:98%; border-right: solid 1.5px ;
border-left: solid 1.5px ;font-size:12px;">
<br>
<p><strong>Mode of Shipment</strong>:<?php echo $modeofshipment;?> </p>
<p><strong>Insurance : </strong><?php echo $insuranceno;?></p>
<p>Please arrange to deliver the materials listed below as per schedule to our works</p>
<table style="border-collapse: collapse; width: 100.2%;" border="1" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th style="text-align: center;"><strong> SNo</strong></th>
<th style="text-align: center;"><strong>ITEM CODE</strong></th>
<th style="text-align: center;"><strong> ITEM DESCRIPTION</strong></th>
<th style="text-align: center;"><strong>HSN</strong></th>
<th style="text-align: center;"> <strong>UOM</strong></th>
<th style="text-align: center;"><strong> QTY</strong></th>
<th style="text-align: center;"> <strong>RATE&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></th>
<th style="text-align: center;"> <strong>PER</strong></th>
</tr>
</thead>
<tbody>
<?php
if(!empty($POItem))
{
$SubTotalAmount = 0;
$index = 0;
$TotalAmount = 0;
$OrderValue = 0;
$AfterSGST = 0;
$AfterCGST = 0;
$AfterIGST = 0;
$Insurance = 0;
$AfterFreightValue = 0;
$AfterDiscount = 0;
$AfterPackaging = 0;
foreach($POItem as $record)
{
$index = $index + 1;
?>
<tr style="text-align: center;line-height: 1.8em;border: none;">
<td style="border-right: solid 1px ;
border-left: solid 0px ;"><?php echo $index ; ?></td>
<td style="text-align: left;border-right: solid 1px ;
border-left: solid 1px ;"><?php echo $record->MaterialCode ; ?></td>
<td style="text-align: left;border-right: solid 1px ;
border-left: solid 1px ;"><?php echo $record->MaterialName ; ?></td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"><?php if(!empty($record->HSNCODE)){echo $record->HSNCODE;}else{echo "NIL";} ; ?></td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"><?php echo $record->UOM ; ?></td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"><?php echo $record->Quantity ; ?></td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"><?php echo number_format(($record->Rate),2) ; ?></td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"><?php echo $record->Per ; ?></td>
</tr>
<?php
$SubTotalAmount = $SubTotalAmount + $record->BasicValue;
$AfterCGST =$AfterCGST + $record->AfterCGST;
$AfterSGST =$AfterSGST + $record->AfterSGST;
$AfterIGST =$AfterIGST + $record->AfterIGST;
$Insurance =$Insurance + $record->Insurance;
$AfterFreightValue =$AfterFreightValue + $record->AfterFreightValue;
$AfterDiscount = $AfterDiscount + $record->AfterDiscount ;
$AfterPackaging=$AfterPackaging+$record->AfterPackagingValue;
$totaltaxonly=($AfterCGST+$AfterSGST+$AfterIGST);
$others=$Insurance+$AfterFreightValue+$AfterPackaging;
}
$OrderValue = (( $SubTotalAmount + $AfterCGST +$AfterIGST+$AfterSGST +$Insurance +$AfterFreightValue+$AfterPackaging) - $AfterDiscount) ;
}?>
<?php for($index = ++$index;$index <10;$index++) { ?>
<tr style="text-align: center;line-height: 1.8em;border: none;">
<td style="border-right: solid 1px ;
border-left: solid 0px ;"> <br><br></td>
<td style="text-align: left;border-right: solid 1px ;
border-left: solid 1px ;"> </td>
<td style="text-align: left;border-right: solid 1px ;
border-left: solid 1px ;"> </td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"> </td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"> </td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"> </td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"> </td>
<td style="border-right: solid 1px ;
border-left: solid 1px ;"> </td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
$i=0;
if(!empty($POItem))
{
foreach($POItem as $x){
if($x->ParentPO != ''){
$i++;
}
}
}
if($i>0){
?>
<table style="border-collapse: collapse;font-size:12px;" cellpadding="0" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td style="text-align: center;" colspan="3">
<p>Amended Details</p>
</td>
</tr>
<tr>
<td colspan="3">
<?php
if(!empty($POItem))
{
foreach($POItem as $v)
{
echo "<b>" . $v->AmendedDetails . "</b>";
break;
}
}?>
</td>
</tr>
<tr>
<td style="text-align: center;"><strong>Item Description</strong></td>
<td style="text-align: center;" rowspan="2"><strong>Previous Details</strong></td><td style="text-align: center;" rowspan="2" ><strong>Current Details</strong></td>
</tr>
<?php if(!empty($POItem))
{
foreach($POItem as $rec)
{
echo $rec->LineAmend ;
}
} ?>
</tbody>
</table>
<?php
}?>
<p>&nbsp;</p>
<span><strong>Tax and other details:</strong></span>
<table style="border-collapse: collapse; height: 36px;" border="1" width="60%" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th style="text-align: center;"><strong>ITEM CODE</strong></th>
<th style="text-align: center;"><strong>DIS</strong></th>
<th style="text-align: center;"><strong>PACKING</strong></th>
<th style="text-align: center;"><strong>CGST%</strong></th>
<th style="text-align: center;"><strong>SGST%</strong></th>
<th style="text-align: center;"><strong>IGST%</strong></th>
<th style="text-align: center;"><strong>FREIGHT</strong></th>
</tr>
</thead>
<tbody>
<?php if(!empty($reveuetax))
{
foreach($reveuetax as $r)
{ ?>
<tr style="text-align: center;">
<td style="text-align: left;"><?php echo $r->Itemcode ; ?></td>
<!--<td><?php if($r->DiscountType == 'PERCENTAGE'){$type="%";}else if($r->DiscountType == 'LUMP SUM'){$type="LS";}else if($r->DiscountType == 'NIL'){$type='';} echo $r->DiscountValue . $type;?></td>-->
<!--<td><?php if($r->PackagingType == 'PERCENTAGE'){$type="%";}else if($r->PackagingType == 'LUMP SUM'){$type="LS";}else if($r->PackagingType == 'NIL'){$type='';} echo $r->PackagingValue . $type;?></td>-->
<td><?php echo $r->DiscountValue;?></td>
<td><?php echo $r->PackagingValue;?></td>
<td><?php echo $r->CGST."%";?></td>
<td><?php echo $r->SGST."%";?></td>
<td><?php echo $r->IGST."%";?></td>
<td><?php echo $r->FreightValue;?></td>
<!-- <td><?php if($r->FreightType == 'PER TRIP'){$type="TRIP"; echo $r->FreightValue ."*" . $r->NoOfTrip . $type;}else{ if($r->FreightType == 'LUMP SUM'){$type="LS";}else if($r->FreightType == 'NIL'){$type='';}else if($r->FreightType == 'PER UOM'){$type='UOM';}else if($r->FreightType == 'PERCENTAGE'){$type='%';} echo $r->FreightValue . $type;}?></td>-->
</tr><?php }
}?>
</tbody>
</table>
<p style="text-align: left;"><strong>Special instructions:</strong></p>
<p style="text-align: left;"><?php echo $ServiceDescription;?></p>
<table style="border-collapse: collapse;position:fixed;bottom:145px;" border="1" width="100.3%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="4" rowspan="3" width="50%">
<span><strong>Payment terms</strong> :<br><?php echo $PaymentTerms ."&nbsp;&nbsp;".$PaymentOtherDescription;?></span>
</td>
<td style="text-align: center;"><strong>Total Amount&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
<td style="text-align: center;"><strong>Total CGST Amount&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
<td style="text-align: center;"><strong>Total SGST Amount&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
<td style="text-align: center;"><strong>Total IGST Amount&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
<td style="text-align: center;"><strong>Others&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
<td style="text-align: center;"><strong>Total Tax Amount&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
<td style="text-align: center;"><strong>Order Value&nbsp; <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></strong></td>
</tr>
<tr>
<td style="text-align: right;"><?php echo number_format($OrderValue,2);?></td>
<td style="text-align: right;"><?php echo number_format($AfterCGST,2);?></td>
<td style="text-align: right;"><?php echo number_format($AfterSGST,2);?></td>
<td style="text-align: right;"><?php echo number_format($AfterIGST,2);?></td>
<td style="text-align: center;"><?php echo number_format($others,2);?></td>
<td style="text-align: right;"><?php echo number_format($totaltaxonly,2);?></td>
<td style="text-align: right;"><?php echo number_format($SubTotalAmount,2);?></td>
</tr>
<tr>
<td colspan="7">
<p><strong>Order value in words:</strong> <br><?php echo $TotalAmountInWords;?></p>
</td>
</tr>
</tbody>
</table>
</div>
</body>