From 92f7b30aa6d901be1a356ee07f19a9e88090ccb8 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 21 Jul 2017 12:26:18 +0530 Subject: [PATCH] amendment pdf --- .../controllers/amendmentpurchaseorder.php | 321 +++++++++++++----- application/models/purchaseorder_model.php | 4 +- application/views/Amendedimportpopdf.php | 51 ++- 3 files changed, 256 insertions(+), 120 deletions(-) diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index 6382b102..5146e01f 100755 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -819,14 +819,18 @@ function UpdateAmendServicePurchaseOrder() //die(); if($PaymentTerms!=$beforePaymentTerms) { - $MAD=$MAD."Amended Payment Terms:". $beforePaymentTerms ."
"; + //$MAD=$MAD."Amended Payment Terms:". $beforePaymentTerms ."
"; + $MAD.="Amended Payment Terms  " . $beforePaymentTerms."
"; } //$Payableat=$this->input->post('PayableAT'); $Palaceoforigin=$this->input->post('PlaceOforigin'); + $beforePalaceoforigin=$this->input->post('beforePlaceOforigin'); + if($Palaceoforigin!=$beforePalaceoforigin) { - $MAD=$MAD."Amended Place of Origin:". $beforePalaceoforigin ."
"; + //$MAD=$MAD."Amended Place of Origin:". $beforePalaceoforigin ."
"; + $MAD.=$MAD."Amended Place of Origin:  " . $beforePalaceoforigin."
"; } //echo $MAD; //die(); @@ -873,10 +877,7 @@ function UpdateAmendServicePurchaseOrder() $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); $beforeQuantity=$this->input->post('beforequantity'.$i); - if(($Quantity-$beforeQuantity)!=0) - { - $CAD="Amended Quantity :".$beforeQuantity ."
"; - } + $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); @@ -886,10 +887,7 @@ function UpdateAmendServicePurchaseOrder() $Productprice = $this->input->post('ProductPrice'.$i); $LandingCharge = $this->input->post('LandingCharge'.$i); $beforeLandingCharge = $this->input->post('beforeLandingCharge'.$i); - if(($LandingCharge-$beforeLandingCharge)!=0) - { - $CAD=$CAD."Amended Landing :".$beforeLandingCharge ."
"; - } + // echo $LandingCharge; // echo $beforeLandingCharge; // die(); @@ -897,125 +895,61 @@ function UpdateAmendServicePurchaseOrder() $AfterLandingCharge = $this->input->post('AfterLandingCharge'.$i); $HighSeas = $this->input->post('HighSeasSalesCharge'.$i); $beforeHighSeas=$this->input->post('beforeHighSeasSalesCharge'.$i); - if(($HighSeas-$beforeHighSeas)!=0) - { - $CAD=$CAD."Amended Highsesas :".$beforeHighSeas ."
"; - } + $AfterHighSeas = $this->input->post('AfterHighSeasSalesCharge'.$i); $CustomDuty = $this->input->post('CustomDuty'.$i); $beforeCustomDuty=$this->input->post('beforeCustomDuty'.$i); - if(($CustomDuty-$beforeCustomDuty)!=0) - { - $CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; - } - - + $AfterCustomDuty = $this->input->post('AfterCustomDuty'.$i); $ExciseDuty = $this->input->post('ExciseDuty'.$i); $beforeExciseDuty=$this->input->post('beforeExciseDuty'.$i); - if(($ExciseDuty-$beforeExciseDuty)!=0) - { - $CAD=$CAD."Amended ExciseDuty :".$beforeExciseDuty ."
"; - } - - + $AfterExciseDuty = $this->input->post('AfterExciseDuty'.$i); $ExciseDutyEd = $this->input->post('ExciseDutyEdCess'.$i); $beforeExciseDutyEd=$this->input->post('beforeExciseDutyEdCess'.$i); - if($ExciseDutyEd-$beforeExciseDutyEd) - { - $CAD=$CAD."Amended ExciseDutyEd :".$beforeExciseDutyEd ."
"; - } - - + $AfterExciseDutyEd = $this->input->post('AfterExciseDutyEdCess'.$i); $ExciseDutySH = $this->input->post('ExciseDutySHCess'.$i); $beforeExciseDutySH=$this->input->post('beforeExciseDutySHCess'.$i); - if($ExciseDutySH-$beforeExciseDutySH) - { - $CAD=$CAD."Amended ExciseDutySH :".$beforeExciseDutySH ."
"; - } - - + $AfterExciseDutySH = $this->input->post('AfterExciseDutySHCess'.$i); $CustomEd= $this->input->post('CustomEdCess'.$i); $beforeCustomEd=$this->input->post('beforeCustomEdCess'.$i); - if($CustomEd-$beforeCustomEd) - { - $CAD=$CAD."Amended CustomEd :".$beforeCustomEd ."
"; - } - - + $AfterCustomEd= $this->input->post('AfterCustomEdCess'.$i); $CustomSH = $this->input->post('CustomSHCess'.$i); $beforeCustomSH=$this->input->post('beforeCustomSHCess'.$i); - if($CustomSH-$beforeCustomSH) - { - $CAD=$CAD."Amended CustomSH :".$beforeCustomSH ."
"; - } - + $AfterCustomSH = $this->input->post('AfterCustomSHCess'.$i); $AddAdtional = $this->input->post('AddlExciseDuty'.$i); $beforeAddAdtional=$this->input->post('beforeAddlExciseDuty'.$i); - if($AddAdtional-$beforeAddAdtional) - { - $CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; - } + $AfterAddAdtional = $this->input->post('AfterAddlExciseDuty'.$i); $Grossdutypayable = $this->input->post('Grossdutypayable'.$i); $beforeGrossdutypayable = $this->input->post('beforeGrossdutypayable'.$i); - // if($Grossdutypayable-$beforeGrossdutypayable) - // { - // $CAD="Amended Grossdutypayable:".$beforeGrossdutypayable ."
"; - // } - $AvailableModvat = $this->input->post('AvailableModvat'.$i); $beforeAvailableModvat = $this->input->post('beforeAvailableModvat'.$i); - // if($AvailableModvat-$beforeAvailableModvat) - // { - // $CAD="Amended Available Modvat:".$beforeAvailableModvat ."
"; - // } - $Grossexpensesduetocustomduty = $this->input->post('Grossexpensesduetocustomduty'.$i); $beforeGrossexpensesduetocustomduty = $this->input->post('Grossexpensesduetocustomduty'.$i); - //if($Grossexpensesduetocustomduty-$beforeGrossexpensesduetocustomduty) - // { - // $CAD="Amended GrosssExpense:".$beforeGrossexpensesduetocustomduty ."
"; - // } - $purchaseratePerKG = $this->input->post('purchaseratePerKG'.$i); $beforepurchaseratePerKG = $this->input->post('beforepurchaseratePerKG'.$i); - // if($purchaseratePerKG-$beforepurchaseratePerKG) - // { - // $CAD="Amended Purchsae Rate/UOM:".$beforepurchaseratePerKG ."
"; - // } - - - + $CustomDutyExpensesPerKG = $this->input->post('CustomDutyExpensesPerKG'.$i); $beforeCustomDutyExpensesPerKG = $this->input->post('beforeCustomDutyExpensesPerKG'.$i); - //if($CustomDutyExpensesPerKG-$beforeCustomDutyExpensesPerKG) - // { - // $CAD="Amended CustomDutyExpense/UOM".$beforeCustomDutyExpensesPerKG ."
"; - // } - - - - $RMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomersPerKG'.$i); $beforeRMCIncludingCustomersPerKG = $this->input->post('RMCIncludingCustomersPerKG'.$i); // if($RMCIncludingCustomersPerKG-$beforeRMCIncludingCustomersPerKG ) @@ -1023,10 +957,7 @@ function UpdateAmendServicePurchaseOrder() // $CAD="Amended RMC Including Customs".$beforeRMCIncludingCustomersPerKG ."
"; // } - - - - $QuantityKG = $this->input->post('QuantityKG'.$i); + $QuantityKG = $this->input->post('QuantityKG'.$i); @@ -1034,8 +965,109 @@ function UpdateAmendServicePurchaseOrder() $CostCenter = $this->input->post('costCode'.$i); $Totalvalueitem=$this->input->post('txtTotalorderValue'); + $RecQtyvalue=0; + $rowspanvalue=0; $LineItemNo = ''; + + if(($Quantity-$beforeQuantity)!=0) + { + $rowspanvalue++; + //$CAD="Amended Quantity :".$beforeQuantity ."
"; + $CAD=$CAD."Amended Quantity : ".$beforeQuantity ."Current Qty:".$Quantity.""; + } + + + if(($LandingCharge-$beforeLandingCharge)!=0) + { + //$CAD=$CAD."Amended Landing :".$beforeLandingCharge ."
"; + $rowspanvalue++; + $CAD=$CAD."Amended Landing percentage : ".$beforeLandingCharge ."Current Landing Percentage:".$LandingCharge.""; + } + if(($HighSeas-$beforeHighSeas)!=0) + { + $rowspanvalue++; + //$CAD=$CAD."Amended Highsesas :".$beforeHighSeas ."
"; + $CAD=$CAD."Amended Highsesas : ".$beforeHighSeas ."Current Highsesas:".$HighSeas.""; + } + + + if(($CustomDuty-$beforeCustomDuty)!=0) + { + //$CAD=$CAD."Amended CustomDuty :".$beforeCustomDuty ."
"; + $rowspanvalue++; + $CAD=$CAD."Amended CustomDuty : ".$beforeCustomDuty ."Current CustomDuty:".$CustomDuty.""; + } + + + + if(($ExciseDuty-$beforeExciseDuty)!=0) + { + $rowspanvalue++; + //$CAD=$CAD."Amended ExciseDuty :".$beforeExciseDuty ."
"; + $CAD=$CAD."Amended ExciseDuty : ".$beforeExciseDuty ."Current ExciseDuty:".$ExciseDuty.""; + + } + + if($ExciseDutyEd-$beforeExciseDutyEd) + { + $rowspanvalue++; + //$CAD=$CAD."Amended ExciseDutyEd :".$beforeExciseDutyEd ."
"; + $CAD=$CAD."Amended ExciseDutyEd : ".$beforeExciseDutyEd ."Current ExciseDutyEd:".$ExciseDutyEd.""; + + } + + + if($ExciseDutySH-$beforeExciseDutySH) + { + $rowspanvalue++; + //$CAD=$CAD."Amended ExciseDutySH :".$beforeExciseDutySH ."
"; + $CAD=$CAD."Amended ExciseDutySH : ".$beforeExciseDutySH ."Current ExciseDutySH:".$ExciseDutySH.""; + + } + + if($CustomEd-$beforeCustomEd) + { + $rowspanvalue++; + //$CAD=$CAD."Amended CustomEd :".$beforeCustomEd ."
"; + $CAD=$CAD."Amended CustomEd : ".$beforeCustomEd ."Current CustomEd:".$CustomEd.""; + + } + + + if($CustomSH-$beforeCustomSH) + { + $rowspanvalue++; + //$CAD=$CAD."Amended CustomSH :".$beforeCustomSH ."
"; + $CAD=$CAD."Amended CustomSH : ".$beforeCustomSH ."Current CustomSH:".$CustomSH.""; + + } + + + if($AddAdtional-$beforeAddAdtional) + { + //$CAD=$CAD."Amended Additional Excise duty :".$beforeAddAdtional ."
"; + $rowspanvalue++; + $CAD=$CAD."Amended Additional Excise duty: ".$beforeAddAdtional ."Current Additional Excise duty:".$AddAdtional.""; + } + + + if($rowspanvalue>0) + { + $rowspanvalue++; + + $CAD2=''; + $CAD2=$CAD; + $CAD=''; + $CAD="".$MaterialCode.""; + $CAD.=$CAD2; + } + + + + + + $POLineItemList = array('PONO'=>$NewPO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'AmendedDetails'=>$CAD); //print_r($POLineItemList); @@ -1088,6 +1120,121 @@ function CreateAmendPOPrint() } } + + + + + public function importpoprint($PONO) + { + + //$this->load->view('includes/pdfheader'); + + // Load the pdf page with multiviews + $Requester=''; + $Depcode=''; + $Currencycode=''; + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); + $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetailsForPDF($PONO); + //print_r($data['POItem']); + //die(); + $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); + //print_r( $data['releasedetails']); + foreach ($data['POItem'] as $Reqdby) + { + $Requester=$Reqdby->Requestedby; + + } + + foreach ($data['POItem'] as $CURTYPE) + { + $Currencycode=$CURTYPE->CurrencyType; + } + + $data['Requestername']=$this->purchaseorder_model->GerRequesterName($Requester); + + foreach ($data['Requestername'] as $ReqDep) + { + $Depcode=$ReqDep->Departmentcode; + } + + $data['DEPCODE']=$this->purchaseorder_model->GerRequesterDep($Depcode); + //print_r($data['Requestername']); + $data['Currencytype']=$this->purchaseorder_model->GerCurrencyCodeName($Currencycode); + $ProductPrice=''; + $TotalOrderValue = ''; + foreach ($data['POItem'] as $PO ) + { + $TotalOrderValue=$PO->TotalOrderValue; + } + + //$totalAmt=sprintf("%.2f", $ProductPrice); + //$data['TotalAmountInWords']= $this->convertNumber($totalAmt); + //print_r($data['TotalAmountInWords']); + + //$this->load->View("importpopdf", $data); + + + $CurrencyType=''; + if(!empty($data['POItem'])){ + $CurrencyType=$data['POItem'][0]->CurrencyType; + } + //echo $CurrencyType; + + if($CurrencyType=='') + { + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); + } + else + { + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); + } + + // $TotalOrderValue=$data['POItem'][0]->$TotalOrderValue; + //print_r($data['POItem'][0]); + + $totalAmt=sprintf("%.2f", $TotalOrderValue); + + $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + + + + + $SymbolCurrency = ''; + $SymbolCurrencyName =''; + $PaiseVal = ''; + if(!empty($data['CurrencySymbol']) >0) + { + $SymbolCurrency=$data['CurrencySymbol'][0]->FontCode2000; + $SymbolCurrencyName=$data['CurrencySymbol'][0]->Currency; + $PaiseVal=$data['CurrencySymbol'][0]->PaiseVal; + } + $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; + + $totalAmt=sprintf("%.2f", $TotalOrderValue); + + // $data['TotalAmountInWords']= $this->convertNumberSymbol($totalAmt,$SymbolCurrency,$SymbolCurrencyName,$PaiseVal); + + + $this->load->View("Amendedimportpopdf", $data); + + + // Add header to pdf + //s $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->set_paper(array(0, 0, 841.89, 1190.55), 'landscape'); + ///$this->dompdf->load_html($php); + ///$this->dompdf->render(); + ///$data['Attachment'] = FALSE; + ///$this->dompdf->stream("ImportPOReport.pdf",$data,$php); + +} public function revenuepoprint($PONO) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 4e4d564d..0dbbd343 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -607,7 +607,7 @@ function GetImportPurchaseOrderDetailsForPDF($PONO = '') $subQuery='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Import_DispatchDetails, Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount , -ProductPrice,Tax.*,LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.Address +ProductPrice,Tax.*,LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.Address,LineItem.AmendedDetails as LineAmend FROM T_PurchaseOrder_LineItem LineItem join T_Requestion_Master ReqMas on ReqMas.ReqNo=LineItem.ReqNo join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode @@ -784,7 +784,7 @@ function GetCurrencytype() // To update Parent PO as Amended PO function updateAmendPOMaster($PONO,$PODetail) { - echo $PONO."from model"; + //echo $PONO."from model"; $this->db->where('PONO', $PONO); diff --git a/application/views/Amendedimportpopdf.php b/application/views/Amendedimportpopdf.php index 3f9db5e8..fc1ffccc 100644 --- a/application/views/Amendedimportpopdf.php +++ b/application/views/Amendedimportpopdf.php @@ -29,7 +29,7 @@ } } - + $TotalOrderValue1=''; if(!empty($POItem)) { @@ -49,6 +49,7 @@ $ServiceDescription =$PO->ServiceDescription; $CostCenterCode=$PO->CostCenterCode; //$ReqBy=$PO->Requestedby; + $TotalOrderValue1=$PO->TotalOrderValue; $PaymentTerms = $PO->PaymentTerms; $PaymentDays=$PO->PaymentDays; @@ -180,7 +181,7 @@ UOM

Rate per unit in Basic Price in - Total Amount in + @@ -225,7 +226,10 @@ Rate ; ?> Quantity*$record->Rate); echo number_format($BasicValue,2) ; ?> - TotalOrderValue; ?> + + + @@ -263,52 +267,37 @@ - - - - - - MaterialName ; - - ?> - - - - + - - - LineAmend ; + } } ?>
+

Amended Details

+ " . $v->AmendedDetails . ""; + //echo "" . $v->AmendedDetails . ""; break; } - - }?>
Item Descriptionprevious Details
MaterialName ; ?>AmendedDetails ?>Previous DetailsCurrent Details
@@ -349,7 +338,7 @@ Total Amount In Words

- Total Amount In + Total Amount In