From 58860763401f254940b40d79c835b98100f67e58 Mon Sep 17 00:00:00 2001 From: velz2020 Date: Wed, 26 Jul 2017 19:26:23 +0530 Subject: [PATCH] AMEND CAPITAL PO PDF --- .../controllers/amendmentpurchaseorder.php | 147 +++++++-- application/models/purchaseorder_model.php | 13 +- ...alamendpopdf.php => amendcapitalpopdf.php} | 298 +++++++++--------- 3 files changed, 290 insertions(+), 168 deletions(-) rename application/views/{capitalamendpopdf.php => amendcapitalpopdf.php} (56%) diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index dd2ed51d..cdd66233 100755 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -1509,43 +1509,49 @@ public function CapitalPoPrint($PONO) { - // Load the pdf page with multiviews - $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); + //print_r($data['CompanyDetails']); $data['POItem'] = $this->purchaseorder_model->GetCapitalAmendPurchaseOrderDetailsForprintPDF($PONO); //print_r($data['POItem']); - $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); - + $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); + //print_r($data['releasedetails']); + $CurrencyType=''; if(!empty($data['POItem'])){ $CurrencyType=$data['POItem'][0]->CurrencyType; + // echo $CurrencyType; } - + if($CurrencyType=='' OR $CurrencyType=='0'){ $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); - + // echo "

"; + //print_r($data['CurrencySymbol']); $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; - echo $TotalOrderValue; - die(); - - $totalAmt=sprintf("%.2f", $TotalOrderValue); - + //echo $TotalOrderValue; + $totalAmt=sprintf("%.2f", $TotalOrderValue); + //echo $totalAmt; $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + //print_r($data['TotalAmountInWords']); } else{ $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); + //echo "

"; + // print_r($data['CurrencySymbol']); $SymbolCurrency=$data['CurrencySymbol'][0]->FontCode2000; $SymbolCurrencyName=$data['CurrencySymbol'][0]->Currency; $PaiseVal=$data['CurrencySymbol'][0]->PaiseVal; $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; - + // echo $TotalOrderValue; $totalAmt=sprintf("%.2f", $TotalOrderValue); + //echo "
" . $totalAmt; - // $data['TotalAmountInWords']= $this->convertNumberSymbol($totalAmt,$SymbolCurrency,$SymbolCurrencyName,$PaiseVal); + $data['TotalAmountInWords']= $this->convertNumberSymbol($totalAmt,$SymbolCurrency,$SymbolCurrencyName,$PaiseVal); + //print_r($data['TotalAmountInWords']); } @@ -1557,12 +1563,11 @@ public function CapitalPoPrint($PONO) - $this->load->View("capitalamendpopdf", $data); + $this->load->View("amendcapitalpopdf", $data); + + - // Add header to pdf - //$this->load->view('includes/pdffooter'); - // Get output html $php = $this->output->get_output(); // Load library @@ -1572,11 +1577,117 @@ public function CapitalPoPrint($PONO) $this->dompdf->load_html($php); $this->dompdf->render(); $data['Attachment'] = FALSE; - $this->dompdf->stream("CapitalPOReport.pdf",$data,$php); + $this->dompdf->stream("capitalamenpo.pdf",$data,$php); } + public function convertNumberSymbol($number,$symbol,$name,$paise) +{ + + list($integer, $fraction) = explode(".", (string) $number); + + $output = $name." "; + + 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 convertNumber($number) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 1737a743..d3e61e23 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -856,21 +856,16 @@ QuantityRejected,ROUND(ReceivedQuantity-QuantityRejected)as PendingQty, { //echo $PONO; - $subQuery ='SELECT distinct LineItem.PONO,LineItem.LineItemNo,SUP.SupplierName,SUP.Address,POMast.DeliveryAddress,POMast.DeliveryDate,POMast.PODate,POMast.DeliveryOption,POMast.ServiceDescription,POMast.PaymentTerms,POMast.Import_PlaceofOrgin,POMast.AmendedDetails,POMast.DeliverySchedule,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency, -Mat.UOM,Quantity,Rate,Req.Status,ROUND((ServiceTax.After_CGST + ServiceTax.After_SGST + ServiceTax.After_IGST + ServiceTax.otherallowance),2) as ServiceTaxamount - ,ServiceTax.TotalValue,ServiceTax.CGST,ServiceTax.After_CGST,ServiceTax.SGST,ServiceTax.After_SGST,ServiceTax.IGST,ServiceTax.After_IGST,ServiceTax.otherallowance, - ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,POMast.CurrencyType, - - Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem + $subQuery ='SELECT distinct LineItem.PONO,LineItem.AmendedDetails as lineamd,LineItem.LineItemNo,SUP.SupplierName,SUP.Address,POMast.DeliveryAddress,POMast.DeliveryDate,POMast.PODate,POMast.DeliveryOption,POMast.ServiceDescription,POMast.PaymentTerms,POMast.Import_PlaceofOrgin,POMast.AmendedDetails,POMast.PaymentDays,POMast.DeliverySchedule,POMast.TotalOrderValue,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency, +Mat.UOM,Quantity,Rate,Req.Status,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,POMast.CurrencyType, + Req.CostCenterCode FROM T_PurchaseOrder_LineItem LineItem join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO join T_SupplierDetailsN SUP on SUP.SupplierID=POMast.SupplierID join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode join T_Service_Tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo - join T_Employee_Details emp on Req.Requestedby = emp.EmpID - - join T_DepartmentDetails Dept on emp.Departmentcode = Dept.DEPCode where LineItem.PONO =?'; + join T_Employee_Details emp on Req.Requestedby = emp.EmpID where LineItem.PONO =?'; $query = $this->db->query($subQuery,array($PONO)); //print_r ($query->result()); return $query->result(); diff --git a/application/views/capitalamendpopdf.php b/application/views/amendcapitalpopdf.php similarity index 56% rename from application/views/capitalamendpopdf.php rename to application/views/amendcapitalpopdf.php index b78e606e..94ec13ff 100644 --- a/application/views/capitalamendpopdf.php +++ b/application/views/amendcapitalpopdf.php @@ -1,6 +1,8 @@ CompanyName; - $CompanyAddress = $CO->Address; - - } + 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'){ + + foreach ($POItem as $PO) + { + $ReqNo=$PO->ReqNo; + $PONO = $PO->PONO; + $postatus= $PO->Status; + $SuplierName = $PO->SupplierName; + $SuplierAddress = $PO->Address; + $DeliveryAddress = $PO->DeliveryAddress; + + $dt = new DateTime($PO->PODate, new DateTimeZone('Asia/Kolkata')); + $Podt = $dt->format('d-m-Y'); + if($PO->DeliveryOption=='1'){ $DeliveryDate = ''; $DeliverySchedule = $PO->DeliverySchedule; - $Import_DispatchDetails=''; } else{ $dtDe = new DateTime($PO->DeliveryDate, new DateTimeZone('Asia/Kolkata')); $DeliveryDate = $dtDe->format('d-m-Y'); $DeliverySchedule = ''; - $Import_DispatchDetails=$PO->Import_DispatchDetails; } + $ServiceDescription =$PO->ServiceDescription; + $CostCenterCode=$PO->CostCenterCode; + + $PaymentTerms=$PO->PaymentTerms; + $PaymentDays=$PO->PaymentDays; + $PayableAT=$PO->PaymentTerms; + } + } + - $ServiceDescription =$PO->ServiceDescription; - $PaymentTerms = $PO->PaymentTerms; - $Placeoforigin=$PO->Import_PlaceofOrgin; - - - } -} - $currencyName='INR'; $currencyCode =''; - if(!empty($CurrencySymbol)) + $currencyName=''; + if(!empty($CurrencySymbol)) { foreach ($CurrencySymbol as $Curr) { $currencyCode = $Curr->FontCode2000; - //$currencyName = $currencyName; + $currencyName = $Curr->Currency_Code; } } + + + + +?> - - ?> +
- +
 
PURCHASE ORDER - PO NO:
- - +
@@ -114,34 +118,33 @@ - - - + + +

Vendor Address :

-


+


Delivery To :

-

+

PO DATE :DISPATCH / SCHEDULE BY :PLACE OF ORIGIN:PO DATE :DELIVERY DATE / SCHEDULE BY :
- -
-

 

- +
+ +
- - - - - - - + + + + + + -
Requistion NumberRequested ByRequested DepartmentCost Center  
Requistion NumberRequested ByRequested DepartmentCost Center
-

 

- - - - +

 

+
+ + - + - - - - + - + + - + - - -Quantity*$record->Rate; - ?> - - + + - - - - - - - - + - -
#Item NameItem and Description QtyUOM

-
Rate Per Unit in Rate Per Unit in Total Amount in Total Amount in
Total Amount in
MaterialName ; ?> Quantity ; ?>UOM ; ?>Rate),2) ; ?>Quantity * $record->Rate),2);?>
Rate ; ?>
-

 

- + + + + +
Quantity*$record->Rate); + echo number_format($BasicValue,2) ; ?>
+ + + + + + + + + + + + + + + + lineamd ; + } + } ?> + +
+

Amended Details

+
+" . $v->AmendedDetails . ""; + break; + } +}?> +
Item DescriptionPrevious DetailsCurrent Details
+
+ +

 

+ + Total Order Amount in Total Order Amount in
@@ -264,25 +283,21 @@ -
Total Amount In Words

- - Total Order Amount in Total Order Amount in
-

 

- -

Special Instruction:

-

-

 

- + +
Special Instruction:
+ + ReleasedOn, new DateTimeZone('Asia/Kolkata')); - + ?> - + - -

 

-
Released By : FirstName;?>
-
Released On : format('d-m-Y');?>
+ - + +
+
+ + + \ No newline at end of file