REVENUE AMENDMENT

This commit is contained in:
velz2020 2017-07-19 13:31:59 +05:30
parent 73f31cdfad
commit 72c074438f
5 changed files with 1447 additions and 1287 deletions

View File

@ -228,8 +228,11 @@ class amendmentpurchaseorder extends BaseController
function EditRevenuePurchaseOrder()
{
$NewPO='0';
$NewPO='';
$MAD='';
$PONO =$this->input->post('txtPONO');
//echo "Revenue Amendment";
//echo "OLD PO IS" . $PONO;
$POdt =$this->input->post('PODate');
@ -238,22 +241,44 @@ class amendmentpurchaseorder extends BaseController
$POType = $this->input->post('POType');
$DeliveryAddr = $this->input->post('txtDeliveryAddress');
$dt = $this->input->post('Deliverydt');
$predeliverydate=$this->input->post('beforeDeliverydt');
$preschedule=$this->input->post('beforeScheduleby');
//$Deliverydt = $this->getDateformat($dt);
$DeliverySchedule = $this->input->post('Scheduleby');
$DeliveryOption = $this->input->post('DateRange');
if($DeliveryOption==1){
$Deliverydt = '';
$DeliverySchedule = $this->input->post('Scheduleby');
}
else{
$Deliverydt = $this->getDateformat($dt);
$DeliverySchedule = '';
}
if($DeliveryOption==1){
$Deliverydt = '';
$DeliverySchedule = $this->input->post('Scheduleby');
}
else{
$Deliverydt = $this->getDateformat($dt);
$DeliverySchedule = '';
}
//$predeliverydate=$this->getDateformat($predeliverydate);
$POType = $this->input->post('POType');
$PoRange = $this->input->post('txtPoRange');
$PaymentTerms=$this->input->post('PaymentTerms');
$prePaymentTerms=$this->input->post('beforePaymentTerms');
if($PaymentTerms!=$prePaymentTerms)
{
$MAD="Amended PaymentTerms :&nbsp;&nbsp;". $prePaymentTerms ."<br>";
}
if(($dt) != ($predeliverydate))
{
$predeliverydate = $this->getDateformat($dt);
$MAD.='Amended Delivery Date : &nbsp;&nbsp; ' . $predeliverydate . '<br>' ;
}
if($DeliverySchedule != $preschedule)
{
$MAD.="Amended Schedule :&nbsp;&nbsp;" . $preschedule."<br>";
}
$SpcialInstruction = $this->input->post('SpcialInstruction');
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
@ -262,26 +287,29 @@ class amendmentpurchaseorder extends BaseController
$updatedBy = $this->session->userdata ( 'userId' );
$RowCount = $this->input->post('txtRowCount');
//echo "Rowcount is" . $RowCount;
//die();
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $dt->format('Y-m-d H:i:s');
// PO Master
// PO Master
$POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'PaymentTerms'=> $PaymentTerms,'PayableAT'=>$PayableAT,'PaymentDays'=>$PaymentDays,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>'ST015','DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt );
$POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID,'POType'=>$POType,'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>PO_RELEASED,'PaymentTerms'=>$PaymentTerms,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'AmendedDetails'=>$MAD);
//print_r($POMaster);
//$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
$LastPO = $this->purchaseorder_model->addPOMaster($POMaster);
foreach($LastPO as $PO):
$NewPO=$PO['PONO'];
endforeach;
$LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$updatedBy,$PONO);
if(count($LastPO)>0)
{
$NewPO = $LastPO[0]['PONO'];
}
//echo "NEW PO IS " . $NewPO;
//echo "";
//change old po status as Amendment
$PODetail=array('Status'=>"ST030");//TO SET PARENT PO AS AMENDMENT STATUS
$PODetail=array('Status'=>PO_AMENDED);//TO SET PARENT PO AS AMENDMENT STATUS
//print_r($PODetail);
$APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail);
echo $APO."Affected";
//echo $APO."Affected";
//die();
//print_r($LastPO);
@ -296,54 +324,124 @@ class amendmentpurchaseorder extends BaseController
for ($i = 1; $i <= $RowCount; $i++)
{
//echo "inside loop";
$CAD='';
$MaterialCode = $this->input->post('materialCode'.$i);
$Quantity = $this->input->post('quantity'.$i);
$preqty=$this->input->post('beforeqty'.$i);
$Reqnumber = $this->input->post('Reqnumber'.$i);
$itemRate = $this->input->post('itemRate'.$i);
$preitemrate=$this->input->post('beforeitemRate'.$i);
$DiscountType = $this->input->post('DisType'.$i);
$DiscountValue = $this->input->post('DisVal'.$i);
$preDiscountValue = $this->input->post('beforeDisVal'.$i);
$AfterDiscount = $this->input->post('AfterDisVal'.$i);
$PackagingOption = $this->input->post('PackOption'.$i);
$PackagingType = $this->input->post('PackType'.$i);
$PackagingValue = $this->input->post('PackVal'.$i);
$prePackagingValue = $this->input->post('beforePackVal'.$i);
$AfterPackagingValue = $this->input->post('AfterPackVal'.$i);
$ExciseOption = $this->input->post('ExciseOption'.$i);
$ExciseValue = $this->input->post('ExciseVal'.$i);
$AfterExciseValue = $this->input->post('AfterExciseVal'.$i);
$VatOption = $this->input->post('VatOption'.$i);
$VatOption = $this->input->post('VatOption'.$i);//SGST
$VatValue = $this->input->post('VatVal'.$i);
$preVatValue = $this->input->post('beforeVatVal'.$i);
$AfterVatValue = $this->input->post('AfterVatVal'.$i);
$CSTOption = $this->input->post('CSTOption'.$i);
$CSTValue = $this->input->post('CSTVal'.$i);
$AfterCSTValue = $this->input->post('AfterCSTVal'.$i);
$GSTValue = $this->input->post('GSTVal'.$i);
$GSTValue = $this->input->post('GSTVal'.$i);//CGST
$preGSTValue = $this->input->post('beforeGSTVal'.$i);
$AfterGSTValue = $this->input->post('AfterGSTVal'.$i);
$OtherTaxValue = $this->input->post('OtherTaxVal'.$i);
$OtherTaxValue = $this->input->post('OtherTaxVal'.$i);//IGST
$preOtherTaxValue = $this->input->post('beforeOtherTaxVal'.$i);
$AfterOtherTaxValue = $this->input->post('AfterOtherTaxVal'.$i);
$FreightType = $this->input->post('FreightType'.$i);
$FreightValue = $this->input->post('FreightVal'.$i);
$preFreightValue = $this->input->post('beforeFreightVal'.$i);
$AfterFreightValue = $this->input->post('AfterFreightVal'.$i);
$InsuranceValue = $this->input->post('Insval'.$i);
$preInsuranceValue = $this->input->post('beforeInsval'.$i);
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
$POLineItemNo = $this->input->post('LineItemNo'.$i);
$CostCenter = $this->input->post('costCode'.$i);
$ServiceFrequency=$this->input->post('Frequency'.$i);
$LineItemNo = '';
$RecQtyvalue=0;
$rowspanvalue=0;
if(($Quantity-$preqty)!=0)
{
$rowspanvalue++;
$CAD="<tr><td>Amended Qty :".$preqty ."</td><td>Current Qty:".$Quantity."</td></tr>";
}
if(($itemRate-$preitemrate)!=0)
{
$rowspanvalue++;
$CAD.="<tr><td>Amended Rate :" . $preitemrate."</td><td>Current Item Rate:".$itemRate."</td></tr>";
}
if(($DiscountValue-$preDiscountValue)!=0)
{
$rowspanvalue++;
$CAD.="<tr><td>Amended Discount:". $preDiscountValue ."</td><td>Current Discount Value:".$itemRate."</td></tr>";
}
if(($PackagingValue-$prePackagingValue)!=0)
{
$rowspanvalue++;
$CAD.="<tr><td>Amended PackageValue:". $prePackagingValue."</td><td>Current Packaginf Value:".$PackagingValue."</td></tr>";
}
if(($VatValue-$preVatValue)!=0)//SGST
{
$rowspanvalue++;
$CAD.="<tr><td>Amended SGST value:". $preVatValue."</td><td>Current SGST Value:".$VatValue."</td></tr>";
}
if(($GSTValue-$preGSTValue)!=0)//CGST
{
$rowspanvalue++;
$CAD.="<tr><td>Amended CGSTValue:". $preGSTValue."</td><td>Current CGST Value:".$GSTValue."</td></tr>";
}
if(($OtherTaxValue-$preOtherTaxValue)!=0)//IGST
{
$rowspanvalue++;
$CAD.="<tr><td>Amended IGST Value:". $preOtherTaxValue."</td><td>Current IGST Value:".$OtherTaxValue."</td></tr>";
}
if(($FreightValue-$preFreightValue)!=0)
{
$rowspanvalue++;
$CAD.="<tr><td>Amended FreightValue:". $preFreightValue."</td><td>Current Freight Value:".$FreightValue."</td></tr>";
}
if(($InsuranceValue-$preInsuranceValue)!=0)
{
$rowspanvalue++;
$CAD.="<tr><td>Amended InsuranceValue:". $preInsuranceValue."</td><td>Current Insurance Value:".$InsuranceValue."</td></tr>";
}
if($rowspanvalue>0)
{
$rowspanvalue++;
$CAD2='';
$CAD2=$CAD;
$CAD='';
$CAD="<tr><td rowspan=". $rowspanvalue .">".$MaterialCode."</td></tr>";
$CAD.=$CAD2;
}
$ReceivedQty = $this->purchaseorder_model->GetLineItemReceivedQty($PONO,$MaterialCode);
if(count($ReceivedQty)>0)
{
$RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity'];
}
$POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter);
$POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'ReceivedQuantity'=>$RecQtyvalue,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'AmendedDetails'=>$CAD);
//print_r($POLineItemList);
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
foreach($POLineItem as $line):
$LineItemNo = $line['LineItemNo'];
endforeach;
if(count($POLineItem)>0)
{
$LineItemNo = $POLineItem[0]['LineItemNo'];
}
$RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'ExciseDuty'=>$ExciseValue,'ExciseDutyCalulatedOn'=>$ExciseOption,'AfterExciseDuty'=>$AfterExciseValue,'Vat'=>$VatValue,'AfterVAT'=>$AfterVatValue,'VatCalulatedOn'=>$VatOption, 'CST'=>$CSTValue,'AfterCST'=>$AfterCSTValue,'CSTCalulatedOn'=>$CSTOption,'GST'=>$GSTValue,'AfterGST'=>$AfterGSTValue,'OtherTaxes'=>$OtherTaxValue,'AfterOtherTaxes'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt);
$RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Vat'=>$VatValue,'AfterVAT'=>$AfterVatValue,'GST'=>$GSTValue,'AfterGST'=>$AfterGSTValue,'OtherTaxes'=>$OtherTaxValue,'AfterOtherTaxes'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt);
// print_r($RevenueTaxList);
$RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
}
@ -959,6 +1057,499 @@ function UpdateAmendServicePurchaseOrder()
}
echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ; }
function CreateAmendPOPrint()
{
$PONO = $_GET['PONO'];
$ReqType = $_GET['ReqType'];
if($ReqType == SERVICE)
{
$this ->servicepoprint($PONO);
}
else if($ReqType == REVENUE)
{
$this ->revenuepoprint($PONO);
}
else if($ReqType == IMPORT)
{
$this ->importpoprint($PONO);
}
else if($ReqType == CAPITAL)
{
$this ->CapitalPoPrint($PONO);
}
}
public function revenuepoprint($PONO)
{
// Load all views as normal
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
$data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO);
//print_r($data['POItem']);
//die();
$data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO);
$data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR');
$Currencycode='';
$TotalOrderValue=$data['POItem'][0]->TotalOrderValue;
$totalAmt=sprintf("%.2f", $TotalOrderValue);
// die();
$data['TotalAmountInWords']= $this->convertNumber($totalAmt);
$data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO);
// Add header to pdf
//$this->load->view('includes/pdfheader');
// Load the pdf page with multiviews
$this->load->View("Amendrevenuepopdf", $data);
// Add header to pdf
//$this->load->view('includes/pdffooter');
// Get output html
$php = $this->output->get_output();
// // Load library
$this->load->library('dompdf_gen');
// // Convert to PDF
$this->dompdf->load_html($php);
$this->dompdf->render();
$data['Attachment'] = FALSE;
$this->dompdf->stream("Amendrevenuepopdf.pdf",$data,$php);
}
public function convertNumber($number)
{
list($integer, $fraction) = explode(".", (string) $number);
$output = "Rupee"." ";
if ($integer{0} == "-")
{
$output = "negative ";
$integer = ltrim($integer, "-");
}
else if ($integer{0} == "+")
{
$output = "positive ";
$integer = ltrim($integer, "+");
}
if ($integer{0} == "0")
{
$output .= "zero";
}
else
{
$integer = str_pad($integer, 36, "0", STR_PAD_LEFT);
$group = rtrim(chunk_split($integer, 3, " "), " ");
$groups = explode(" ", $group);
$groups2 = array();
foreach ($groups as $g)
{
$groups2[] = $this->convertThreeDigit($g{0}, $g{1}, $g{2});
}
for ($z = 0; $z < count($groups2); $z++)
{
if ($groups2[$z] != "")
{
$output .= $groups2[$z] . $this->convertGroup(11 - $z) . (
$z < 11
&& !array_search('', array_slice($groups2, $z + 1, -1))
&& $groups2[11] != ''
&& $groups[11]{0} == '0'
? " "
: ", "
);
}
}
$output = rtrim($output, ", ");
}
if ($fraction > 0)
{
$output .= " paise";
for ($i = 0; $i < strlen($fraction); $i++)
{
$output .= " " . $this->convertDigit($fraction{$i});
}
}
return $output;
}
public function convertThreeDigit($digit1, $digit2, $digit3)
{
$buffer = "";
if ($digit1 == "0" && $digit2 == "0" && $digit3 == "0")
{
return "";
}
if ($digit1 != "0")
{
$buffer .= $this->convertDigit($digit1) . " hundred";
if ($digit2 != "0" || $digit3 != "0")
{
$buffer .= " and ";
}
}
if ($digit2 != "0")
{
$buffer .= $this->convertTwoDigit($digit2, $digit3);
}
else if ($digit3 != "0")
{
$buffer .= $this->convertDigit($digit3);
}
return $buffer;
}
public function convertTwoDigit($digit1, $digit2)
{
if ($digit2 == "0")
{
switch ($digit1)
{
case "1":
return "ten";
case "2":
return "twenty";
case "3":
return "thirty";
case "4":
return "forty";
case "5":
return "fifty";
case "6":
return "sixty";
case "7":
return "seventy";
case "8":
return "eighty";
case "9":
return "ninety";
}
} else if ($digit1 == "1")
{
switch ($digit2)
{
case "1":
return "eleven";
case "2":
return "twelve";
case "3":
return "thirteen";
case "4":
return "fourteen";
case "5":
return "fifteen";
case "6":
return "sixteen";
case "7":
return "seventeen";
case "8":
return "eighteen";
case "9":
return "nineteen";
}
} else
{
$temp = $this->convertDigit($digit2);
switch ($digit1)
{
case "2":
return "twenty-$temp";
case "3":
return "thirty-$temp";
case "4":
return "forty-$temp";
case "5":
return "fifty-$temp";
case "6":
return "sixty-$temp";
case "7":
return "seventy-$temp";
case "8":
return "eighty-$temp";
case "9":
return "ninety-$temp";
}
}
}
public function convertDigit($digit)
{
switch ($digit)
{
case "0":
return "zero";
case "1":
return "one";
case "2":
return "two";
case "3":
return "three";
case "4":
return "four";
case "5":
return "five";
case "6":
return "six";
case "7":
return "seven";
case "8":
return "eight";
case "9":
return "nine";
}
}
public function convertGroup($index)
{
switch ($index)
{
case 11:
return " decillion";
case 10:
return " nonillion";
case 9:
return " octillion";
case 8:
return " septillion";
case 7:
return " sextillion";
case 6:
return " quintrillion";
case 5:
return " quadrillion";
case 4:
return " trillion";
case 3:
return " billion";
case 2:
return " million";
case 1:
return " thousand";
case 0:
return "";
}
}
function getDateformat($Val)

View File

@ -569,7 +569,7 @@ function purchaseorderListing($forwhat='')
Mat.UOM,Quantity,Rate,ROUND((Quantity *Rate),2 ) as BasicValue ,
ROUND(((AfterPackagingValue + AfterFreightValue + AfterExciseDuty + AfterVAT + AfterCST +
AfterGST + AfterOtherTaxes + Insurance)) ,2)as Taxamount ,
TotalValue,Tax.*,CostCenterCode ,POMaster.*,sup.SupplierName,sup.Address
TotalValue,Tax.*,LineItem.CostCenterCode ,POMaster.*,sup.SupplierName,sup.Address
FROM T_PurchaseOrder_LineItem LineItem
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo

View File

@ -73,7 +73,7 @@
<td> <a data-toggle="tooltip" href="<?php echo base_url().'EditAmendPO?PONO='.$record->PONO.'&ReqType='.$record->ReqType.'&CapitalRange='.$record->CapitalRange; ?>" ><i class="fa fa-pencil" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Edit Purchase Order details"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-toggle="tooltip" href="<?php echo base_url().'EditAmendPO?PONO='.$record->PONO.'&ReqType='.$record->ReqType.'&CapitalRange='.$record->CapitalRange; ?>"> &nbsp;&nbsp;&nbsp; <a data-toggle="tooltip" href="<?php echo base_url().'purchaseorder/CreatePOPrint?PONO='.$record->PONO.'&ReqType='.$record->ReqType; ?>"><i class="fa fa-print" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Print the Purchase Order details"></i>&nbsp;&nbsp;&nbsp;</a> </td>
<a data-toggle="tooltip" href="<?php echo base_url().'EditAmendPO?PONO='.$record->PONO.'&ReqType='.$record->ReqType.'&CapitalRange='.$record->CapitalRange; ?>"> &nbsp;&nbsp;&nbsp; <a data-toggle="tooltip" href="<?php echo base_url().'amendmentpurchaseorder/CreateAmendPOPrint?PONO='.$record->PONO.'&ReqType='.$record->ReqType; ?>"><i class="fa fa-print" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Print the Purchase Order details"></i>&nbsp;&nbsp;&nbsp;</a> </td>
<?php
}?>
</tr>

View File

@ -0,0 +1,367 @@
<?php
$PONO = '';
$postatus ='';
$CompanyAddress = '';
$CompanyName = '';
$SuplierName = '';
$SuplierAddress = '';
$DeliveryAddress = '';
$Podt = '';
$DeliveryDate ='';
$DeliverySchedule='';
$postatus='';
$ServiceDescription = '';
$PaymentTerms = '';
/* $PaymentDays='';
$PayableAT=''; */
if(!empty($CompanyDetails))
{
foreach ($CompanyDetails as $CO)
{
$CompanyName = $CO->CompanyName;
$CompanyAddress = $CO->Address;
}
}
if(!empty($POItem))
{
foreach ($POItem as $PO)
{
$PONO = $PO->PONO;
$postatus= $PO->Status;
$SuplierName = $PO->SupplierName;
$SuplierAddress = $PO->Address;
$DeliveryAddress = $PO->DeliveryAddress;
$postatus= $PO->Status;
$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;
$PaymentTerms = $PO->PaymentTerms;
$PaymentDays=$PO->PaymentDays;
$PayableAT=$PO->PayableAT;
}
}
$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: 240px 50px 30px 50px; }
.header { position: fixed; left: 0px; top: -240px; right: 0px; height: 550px;text-align: center; }
.footer { position: fixed; bottom: 0px; }
.pagenum:before { content: counter(page); }
</style>
<div class="footer">Page: <span class="pagenum"></span></div>
<div class="header">
<div style="text-align:right;">
<?php
if ($postatus == 'ST026')
{}
else
{
echo '<div><b>DRAFT</b> </div>';
}
?>
</div>
<div>&nbsp;</div>
<center> <span style="font-size:24px;">SIDDHARTH INDUSTRIES - PURCHASE ORDER - <a style="color:#515151">PO NO:<?php echo $PONO?> </a></span></center>
<div style="border:1px solid;">
<table width="100%">
<tbody>
<tr>
<td>
<b style="color:#3c8dbc"><h3><?php echo $CompanyName; ?></h3></b><br/> <?php echo $CompanyAddress; ?>
</td>
<td style="text-align: center;"><img width="80" height="80" 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=="></td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse;font-size:14px; border-color: #fff #fff;" cellpadding="0" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td> <a style="color:#3c8dbc">Vendor Address :</a> <br/><?php echo $SuplierName?> <br/><?php echo $SuplierAddress ?> </td>
<td> <a style="color:#3c8dbc">Delivery To :</a><br/> <?php echo $DeliveryAddress?> </td>
</tr>
</tbody>
</table>
<table style="font-size:12px;" width="100%">
<tbody>
<tr>
<td>PO DATE :<?php echo $Podt?></td>
<td>DELIVERY DATE / SCHEDULE BY :<?php echo $DeliveryDate.$DeliverySchedule;?></td>
</tr>
</tbody>
</table>
</div>
</div>
<p>&nbsp;</p>
<div class="page" style="font-size:12px;">
<table style="border-collapse: collapse;" cellpadding="0" cellspacing="0" border="1" width="100%">
<tbody>
<tr style="background:#8c8c8c;color:#fff;">
<td>Requistion Number</td>
<td>Requested By</td>
<td>Requested Department</td>
<td>Cost Center</td>
</tr>
<?php
if(!empty($RequistionDetails))
{
foreach($RequistionDetails as $ReqDetails)
{
?>
<tr>
<td><?php echo $ReqDetails['RequistionNo']; ?></td>
<td><?php echo $ReqDetails['RequestedName']; ?></td>
<td><?php echo $ReqDetails['RequestedDept']; ?></td>
<td><?php echo $ReqDetails['CostCenterCode']; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<table width="100%">
<tr style="background:#8c8c8c;color:#fff;">
<th>#</th>
<th>Item Code</th>
<th>Item Description</th>
<th>UOM</th>
<th>Qty</th>
<th>Rate In INR</th>
<th>Basic Value In INR</th>
<th>Discount In INR</th>
<th>CGST In INR</th>
<th>SGST In INR</th>
<th>IGST In INR</th>
<th>Insurance In INR</th>
<th>Packaging In INR</th>
<th>Freight In INR</th>
<th>Total Amount In INR</th>
</tr>
<?php
if(!empty($POItem))
{
$SubTotalAmount = 0;
$index = 0;
$TotalAmount = 0;
$OrderValue = 0;
$AfterExciseDuty = 0;
$AfterVAT = 0;//SGST
$AfterGST = 0;//CGST
$AfterOtherTaxes = 0;//IGST
$Insurance = 0;
$AfterFreightValue = 0;
$AfterDiscount = 0;
$AfterPackaging = 0;
foreach($POItem as $record)
{
$index = $index + 1;
?>
<tr>
<td><?php echo $index ; ?></td>
<td><?php echo $record->MaterialCode ; ?></td>
<td><?php echo $record->MaterialName ; ?></td>
<td><?php echo $record->UOM ; ?></td>
<td align="right"><?php echo $record->Quantity ; ?></td>
<td align="right"><?php echo $record->Rate ; ?></td>
<td align="right"><?php echo $record->BasicValue ; ?></td>
<td align="right"><?php echo $record->AfterDiscount; ?></td>
<td align="right"><?php echo $record->AfterVAT ; ?></td>
<td align="right"><?php echo $record->AfterGST ; ?></td>
<td align="right"><?php echo $record->AfterOtherTaxes ; ?></td>
<td align="right"><?php echo $record->Insurance ; ?></td>
<td align="right"><?php echo $record->AfterPackagingValue ; ?></td>
<td align="right"><?php echo $record->AfterFreightValue ; ?></td>
<td align="right"><?php $TotalAmount = (($record->BasicValue+$record->AfterExciseDuty
+ $record->AfterVAT+$record->AfterCST+$record->AfterGST + $record->AfterOtherTaxes + $record->Insurance+ $record->AfterFreightValue+$record->AfterPackagingValue)- $record->AfterDiscount);
echo number_format($TotalAmount,2) ; ?></td>
</tr>
<?php
$SubTotalAmount = $SubTotalAmount + $record->BasicValue;
$AfterExciseDuty =$AfterExciseDuty + $record->AfterExciseDuty;
$AfterVAT =$AfterVAT + $record->AfterVAT;
$AfterGST =$AfterGST + $record->AfterGST;
$AfterOtherTaxes =$AfterOtherTaxes + $record->AfterOtherTaxes;
$Insurance =$Insurance + $record->Insurance;
$AfterFreightValue =$AfterFreightValue + $record->AfterFreightValue;
$AfterDiscount = $AfterDiscount + $record->AfterDiscount ;
$AfterPackaging=$AfterPackaging+$record->AfterPackagingValue;
}
?>
</table>
<?php
$OrderValue = (( $SubTotalAmount + $AfterVAT +$AfterGST+$AfterOtherTaxes +$Insurance +$AfterFreightValue+$AfterExciseDuty+$AfterPackaging) - $AfterDiscount ) ;
}?>
<div align="right">
<table style="border-collapse: collapse;font-size:12px;" cellpadding="0" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td style="text-align: center;" colspan="4">
<p>Amended Details</p>
</td>
</tr>
<tr>
<td colspan="4">
<?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;">previous Details</td><td style="text-align: center;" colspan="2">Current Details</td>
</tr>
<?php if(!empty($POItem))
{
foreach($POItem as $record)
{
echo $record->lineamd ;?>
<?php }
} ?>
</tbody>
</table>
<table style="border-collapse: collapse;font-size:12px;" cellpadding="0" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td style="text-align: center;" rowspan="3"><strong>Total Amount In Words</strong><br /><br /><b><i><?php echo $TotalAmountInWords." "."Only.";?></i></b></td>
<td style="text-align: right;">&nbsp;<strong>Total Amount Before Tax In INR&nbsp;&nbsp; <?php echo number_format($SubTotalAmount,2); ?></strong></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;<strong>Total Tax Amount In INR&nbsp;&nbsp;<?php echo number_format(($OrderValue - $SubTotalAmount),2);?><strong></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;<strong>Total Amount After Tax In INR&nbsp;&nbsp; <?php echo number_format($OrderValue,2);?></strong></td>
</tr>
<tr>
<td>
<p>&nbsp;Payment Terms</p>
<p><?php echo $PaymentTerms;?></p>
</td>
<td style="text-align: center;">
<p>&nbsp;Certified that the particulars given above are true and correct</p>
<p><b style="font-size: small;"><?php echo $CompanyName; ?></b></p>
<p>&nbsp;</p>
<p>Authorized Signatory</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div align="Left"> <b>Special Instruction:</b><br/><?php echo $ServiceDescription;?></div>
<?php
if(!empty($releasedetails)){
$releasedOn = '';
foreach($releasedetails as $detail){
$releasedOn= new DateTime($detail->ReleasedOn, new DateTimeZone('Asia/Kolkata'));
?>
<table width="100%">
<tbody>
<tr>
<td><b>Released By:</b></td>
<td style="text-align:right;"><b>Released On:</b></td>
</tr>
<tr>
<td><?php echo $detail->FirstName;?></td>
<td style="text-align:right;"><?php echo $releasedOn->format('d-m-Y');?></td>
</tr>
</tbody>
</table>
<?php
}
}
else {
?>
<?php } ?>
</div>
</div>

File diff suppressed because it is too large Load Diff