From 9c6f5ca3af98efb4fc5a9bd4850295db293db3a0 Mon Sep 17 00:00:00 2001 From: velz2020 Date: Wed, 26 Jul 2017 17:15:00 +0530 Subject: [PATCH] AMEND CAPITAL PO --- .../controllers/amendmentpurchaseorder.php | 222 ++++++++++--- application/models/purchaseorder_model.php | 26 ++ application/views/capitalamendpopdf.php | 309 ++++++++++++++++++ application/views/editCapitalAmendPO.php | 147 +++++---- 4 files changed, 607 insertions(+), 97 deletions(-) create mode 100644 application/views/capitalamendpopdf.php diff --git a/application/controllers/amendmentpurchaseorder.php b/application/controllers/amendmentpurchaseorder.php index ac213858..dd2ed51d 100755 --- a/application/controllers/amendmentpurchaseorder.php +++ b/application/controllers/amendmentpurchaseorder.php @@ -653,9 +653,10 @@ function UpdateAmendServicePurchaseOrder() { //echo "WELCOME-"; + $PONO =$this->input->post('txtPONO'); //echo $PONO."--"; - + $MAD=''; $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); @@ -664,9 +665,10 @@ function UpdateAmendServicePurchaseOrder() $dt = $this->input->post('Deliverydt'); $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + $PoRange = $this->input->post('capitalType'); $DeliveryOption = $this->input->post('DateRange'); + $Deliverydt = ''; if($DeliveryOption==1){ $Deliverydt = ''; $DeliverySchedule = $this->input->post('Scheduleby'); @@ -676,6 +678,28 @@ function UpdateAmendServicePurchaseOrder() $DeliverySchedule = ''; } + $predispatch=$this->input->post('beforeDisins'); + $curdispatch=$this->input->post('Dispatch'); + $PaymentMethod = $this->input->post('PaymentMethod'); + $prePaymentmethod=$this->input->post('beforePaymentmethod'); + $DeliverySchedule = $this->input->post('Scheduleby'); + $preDeliverySchedule = $this->input->post('beforeSchedule'); + $PlaceOforigin = $this->input->post('PlaceOforigin'); + + if($PaymentMethod != $prePaymentmethod) + { + $MAD.="Amended Paymemnt Terms :  " .$prePaymentmethod."
"; + } + if($predispatch != $curdispatch) + { + $MAD.="Amended Dispatch Instruction :  " .$predispatch."
"; + } + if($DeliverySchedule != $preDeliverySchedule) + { + $MAD.="Amended Schedule :  " .$preDeliverySchedule."
"; + } + //echo "

" . $MAD; + $capitalType = $this->input->post('capitalType'); $currencytypeID = $this->input->post('currencytype'); if($capitalType=='1'){ @@ -690,11 +714,11 @@ function UpdateAmendServicePurchaseOrder() $ExchangeRateOn = $this->input->post('ExchangeRateOn'); $ExchangeRate=$this->input->post('ExchangeRt'); } - $PaymentMethod = $this->input->post('PaymentMethod'); - $PayableAT = $this->input->post('PayableAT'); + + // $PayableAT = $this->input->post('PayableAT'); - $PaymentDate=$this->input->post('PaymentDate'); + //$PaymentDate=$this->input->post('PaymentDate'); $SpcialInstruction = $this->input->post('txtSpcialInstruction'); $TotalOrder = $this->input->post('CapitalToatlOrder'); $POStatus = $this->input->post('txtStatus'); @@ -702,26 +726,28 @@ function UpdateAmendServicePurchaseOrder() $CreateBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); - + //echo $RowCount; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); $updateddt = $dt->format('Y-m-d H:i:s'); - $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'POType'=>$POType,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'PaymentDays'=>$PaymentDate,'PayableAt'=>$PayableAT,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID); + $POMaster = array('ParentPO'=>$PONO,'SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'POType'=>$POType,'PODate'=>$PODate,'Status'=>PO_RELEASED,'CapitalRange'=>$PoRange,'ExchangeRate'=>$ExchangeRate,'ExchangeRateCalculatedon'=>$ExchangeRateOn,'PaymentTerms'=>$PaymentMethod,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'CurrencyType'=>$currencytypeID,'AmendedDetails'=>$MAD,'Import_DispatchDetails'=>$curdispatch,'Import_PlaceofOrgin'=>$PlaceOforigin); //print_r($POMaster); $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster,$CreateBy,$PONO); - foreach($LastPO as $PO): + + foreach($LastPO as $PO): $NewPO=$PO['PONO']; endforeach; - //echo "NEW PO IS " . $NewPO."
"; - //echo ""; - $PODetail=array('Status'=>"ST030");//TO SET PARENT PO AS AMENDMENT STATUS + // echo "NEW PO IS " . $NewPO."
"; + + + $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
"; + $APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail); + // echo $APO."Affected
"; $LineItemStatus = REQITEM_NEW; @@ -732,10 +758,13 @@ function UpdateAmendServicePurchaseOrder() for ($i = 1; $i <= $RowCount; $i++) { - $MaterialCode = $this->input->post('materialCode'.$i); + $CAD=''; + $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); + $preQuantity = $this->input->post('beforequantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); + $preitemRate = $this->input->post('itemRate'.$i); + $itemRate = $this->input->post('rateInUs'.$i); $Exchangerate = $this->input->post('echangeRate'.$i); $BasicPriceinmton = $this->input->post('rateInUs'.$i); @@ -778,41 +807,89 @@ function UpdateAmendServicePurchaseOrder() //echo $BasicPriceinmton; $CostCenter = $this->input->post('CPCostCode'.$i); - $ServiceTax = $this->input->post('AfterServiceTax'.$i); - $EduCess = $this->input->post('AfterEduCess'.$i); - $SecHighTax = $this->input->post('AfterSecHighTax'.$i); - $KrishiTax = $this->input->post('AfterKrishiTax'.$i); - $SwachhTax = $this->input->post('AfterSwachhTax'.$i); - - - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $POLineItemNo = $this->input->post('LineItemNo'.$i); - + + $SGST = $this->input->post('SGST'.$i); + $preSGST = $this->input->post('beforeSGST'.$i); + $CGST = $this->input->post('CGST'.$i); + $preCGST = $this->input->post('beforeCGST'.$i); + $IGST = $this->input->post('IGST'.$i); + $preIGST = $this->input->post('beforeIGST'.$i); + + $SGSTvalue=$this->input->post('afterSGST'.$i); + $preSGSTvalue=$this->input->post('beforeSGSTvalue'.$i); + $CGSTvalue=$this->input->post('afterCGST'.$i); + $preCGSTvalue=$this->input->post('beforeCGSTvalue'.$i); + $IGSTvalue=$this->input->post('afterIGST'.$i); + $preIGSTvalue=$this->input->post('beforeIGSTvalue'.$i); + $otherallowance=$this->input->post('otherallowance'.$i); + $preotherallowance=$this->input->post('beforeotherallowance'.$i); + $TotalServiceOrderValue = $this->input->post('totalservicevalue'.$i); + $POLineItemNo = $this->input->post('LineItemNo'.$i); + $rowspanvalue=0; + + if($Quantity != $preQuantity) + { + $rowspanvalue++; + $CAD.="Amended Qty : " . $preQuantity ."Current Qty : " . $Quantity . ""; + } + if($itemRate != $preitemRate) + { + $rowspanvalue++; + $CAD.="Amended Rate : " . $preitemRate ."Current Rate : " . $itemRate . ""; + } + if(($SGST != $preSGST) && ($SGSTvalue != $preSGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Amended SGST : " . $preSGST ."Current SGST : " . $SGST . "Amended SGST value : " . $preSGSTvalue ."Current SGST value: " . $SGSTvalue . ""; + } + if(($CGST != $preCGST) && ($CGSTvalue != $preCGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Amended CGST : " . $preCGST ."Current CGST : " . $CGST . "Amended CGST value : " . $preCGSTvalue ."Current CGST value: " . $CGSTvalue . ""; + } + if(($IGST != $preIGST) && ($IGSTvalue != $preIGSTvalue)) + { + $rowspanvalue+=2; + $CAD.="Amended IGST : " . $preIGST ."Current IGST : " . $IGST . "Amended IGST value : " . $preIGSTvalue ."Current IGST value: " . $IGSTvalue . ""; + } + if($otherallowance != $preotherallowance) + { + $rowspanvalue++; + $CAD.="Amended OtherAllowances : " . $preotherallowance ."Current OtherAllowances : " . $otherallowance . ""; + } + 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); - // print_r($POLineItemList); + $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); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); $LineItemNo = ''; - // if(count($POLineItem)>0) - // { + foreach($POLineItem as $line): $LineItemNo = $line['LineItemNo']; endforeach; - //echo $LineItemNo; - //} - //echo $LineItemNo; + //echo $LineItemNo; if(trim($POType) == CAPITAL ) { - $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'ServiceTax'=>$ServiceTax,'EducessTax'=>$EduCess,'SecHigherEducessTax'=>$SecHighTax,'KrishiKalyantax'=>$KrishiTax,'SwachhBharattax'=>$SwachhTax,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); - + $ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$CGST,'After_CGST'=>$CGSTvalue,'SGST'=>$SGST,'After_SGST'=>$SGSTvalue,'IGST'=>$IGST,'After_IGST'=>$IGSTvalue, 'otherallowance'=>$otherallowance,'TotalValue'=>$TotalServiceOrderValue,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); + //print_r($ServiceTaxList); $ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList); //echo "Service"; //print_r($ServiceTax); $ImportTaxList = array('LineItemNo'=>$LineItemNo, 'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'AfterHighSeasSalesCharge'=>$AfterHighSeas,'HighSeasSalesCharge'=>$HighSeas,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'ExciseDuty'=>$ExciseDuty,'AfterExciseDuty'=>$AfterExciseDuty,'ExciseDutyEdCess'=>$ExciseDutyEd,'AfterExciseDutyEdCess'=>$AfterExciseDutyEd,'ExciseDutySHCess'=>$ExciseDutySH,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'AddlExciseDuty'=>$AddAdtional,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'AfterExciseDutySHCess'=>$AfterExciseDutySH,'AfterAddlExciseDuty'=>$AfterAddAdtional,'Grossdutypayable'=>$Grossdutypayable,'AvailableModvat'=>$AvailableModvat,'Grossexpensesduetocustomduty'=>$Grossexpensesduetocustomduty,'purchaseratePerKG'=>$purchaseratePerKG,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'RMCIncludingCustomersPerKG'=>$RMCIncludingCustomersPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem); - + //print_r($ImportTaxList); //die(); @@ -826,8 +903,7 @@ function UpdateAmendServicePurchaseOrder() } echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; - } - + } function EditAmendImportPO() { $MAD=''; @@ -1429,6 +1505,78 @@ public function servicepoprint($PONO) } +public function CapitalPoPrint($PONO) + { + + + // Load the pdf page with multiviews + $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); + + $data['POItem'] = $this->purchaseorder_model->GetCapitalAmendPurchaseOrderDetailsForprintPDF($PONO); + //print_r($data['POItem']); + $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); + + $CurrencyType=''; + if(!empty($data['POItem'])){ + $CurrencyType=$data['POItem'][0]->CurrencyType; + } + + + if($CurrencyType=='' OR $CurrencyType=='0'){ + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); + + $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; + echo $TotalOrderValue; + die(); + + $totalAmt=sprintf("%.2f", $TotalOrderValue); + + $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + } + + + else{ + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); + $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); + } + + + + + + + $data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO); + + + + $this->load->View("capitalamendpopdf", $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("CapitalPOReport.pdf",$data,$php); + +} + + public function convertNumber($number) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index b8722d27..1737a743 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -851,6 +851,32 @@ QuantityRejected,ROUND(ReceivedQuantity-QuantityRejected)as PendingQty, } + + function GetCapitalAmendPurchaseOrderDetailsForprintPDF($PONO = '') + { + //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 + 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 =?'; + $query = $this->db->query($subQuery,array($PONO)); + //print_r ($query->result()); + return $query->result(); + + + } diff --git a/application/views/capitalamendpopdf.php b/application/views/capitalamendpopdf.php new file mode 100644 index 00000000..b78e606e --- /dev/null +++ b/application/views/capitalamendpopdf.php @@ -0,0 +1,309 @@ +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; + $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; + $PaymentTerms = $PO->PaymentTerms; + $Placeoforigin=$PO->Import_PlaceofOrgin; + + + } +} + $currencyName='INR'; + $currencyCode =''; + if(!empty($CurrencySymbol)) + { + foreach ($CurrencySymbol as $Curr) + { + + $currencyCode = $Curr->FontCode2000; + //$currencyName = $currencyName; + + + } + + } + + + ?> + + +
+
+ DRAFT
'; + + } + + ?> +
+ +
PURCHASE ORDER - PO NO:
+ + + + + + + + + + + + + + + + + + + +
+

+

+
+

Vendor Address :

+


+
+

Delivery To :

+

+
PO DATE :DISPATCH / SCHEDULE BY :PLACE OF ORIGIN:
+ + + +

 

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

 

+ + + + + + + + + + + + + + + + + + + + + + + + + +Quantity*$record->Rate; + ?> + + + + + + + + + + + + + + +
#Item NameQtyUOM

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

 

+ + + + + + + + + + + + +
Total Amount In Words

+ + Total Order Amount in Total Order Amount in
+

Payment Terms

+

+
+

Certified that the particulars given above are true and correct

+

+

 

+

Authorized Signatory

+
+

 

+ +

Special Instruction:

+

+

 

+ReleasedOn, new DateTimeZone('Asia/Kolkata')); + + + ?> + + + +

 

+
Released By : FirstName;?>
+
Released On : format('d-m-Y');?>
+ + + + diff --git a/application/views/editCapitalAmendPO.php b/application/views/editCapitalAmendPO.php index 2d73a003..82567688 100644 --- a/application/views/editCapitalAmendPO.php +++ b/application/views/editCapitalAmendPO.php @@ -34,7 +34,8 @@ $MaxPoDate = ''; $AvlAmount = 0; $currentCurrencyType=''; - $exchangeRate = $ExchangeRate; + $exchangeRate=''; + $exchangeRate = $ExchangeRate; $ConfigValue=''; $TotalLanding=0; @@ -112,10 +113,12 @@ if(!empty($POMaster)) $PONO = $Req->PONO; $scopeofwork = $Req->ServiceDescription; $PayableAT=$Req->PayableAT; - $ExchangeRateOn=$Req->ExchangeRateCalculatedon; + $ExchangeRateOn1=new DateTime($Req->ExchangeRateCalculatedon); + $ExchangeRateOn=$ExchangeRateOn1->format('Y-m-d'); $PaymentDays=$Req->PaymentDays; $PaymentTerms=$Req->PaymentTerms; + //echo $PaymentTerms; $UpdatedOn=$Req->UpdatedOn; $CapitalRange=$Req->CapitalRange; $Import_DispatchDetails=$Req->Import_DispatchDetails; @@ -153,11 +156,14 @@ if(!empty($AvlBudAmt)) @@ -313,13 +321,12 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; // $currentCurrencyType=$CurrencyDetail[0]->CurrencyCode; $options1[$CurrencyDetail[0]->Currency_Code] = $CurrencyDetail[0]->Currency_Code.' '.' - '.' '.$CurrencyDetail[0]->Country_and_Currency; - foreach ($Currency as $Cur): + foreach ($Currency as $Cur) if($CurrencyDetail[0]->Currency_Code!=$Cur->Currency_Code){ $options1[$Cur->Currency_Code] = $Cur->Currency_Code.' '.' - '.' '.$Cur->Country_and_Currency; + } - } - - endforeach; + } echo form_dropdown('currencytype', $options1,set_value('currencytype',$currentCurrencyType),'id="currencytype"','class="form-control select2"' , 'required="true"'); @@ -407,16 +414,16 @@ document.getElementById('currencyTypeDiv').style.display = 'block';

- + 'Dispatch','value' => set_value('Dispatch',$Import_DispatchDetails),'id'=>'Dispatch', 'class' => 'form-control' ,'required' => 'true'); // echo form_input($data); @@ -449,7 +456,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
'ExchangeRt','value' => set_value('ExchangeRt',$exchangeRate),'id'=>'ExchangeRt', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);'); + $data = array('name' => 'ExchangeRt','value' => set_value('ExchangeRt',$exchangeRate),'id'=>'ExchangeRt', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','style'=>'text-align:right'); echo form_input($data); ?>
@@ -483,7 +490,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
Payment Details -
+
Payable Terms PaymentTerms) { + //echo $PaymentTerms."
"; + //print_r($Payment); $options6[$rl->PaymentTerms] = $rl->PaymentTerms; } @@ -563,12 +572,12 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; ReqNo ?> MaterialName?> - Quantity ?> + Quantity ?> UOM ?> - Rate ?> - Rate * $record->Quantity ?> - ServiceTaxamount?> - Rate * $record->Quantity ?> + Rate ?> + Rate * $record->Quantity ?> + ServiceTaxamount?> + Rate * $record->Quantity ?> $record->MaterialCode,"ReqNo"=>$record->ReqNo); array_push($res_arr_values, $row); @@ -587,7 +596,9 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; + + @@ -641,12 +652,19 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; + + + + + + + @@ -665,7 +683,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; After_SGST; + $TotalSGST =$TotalSGST+$record->After_SGST; $TotalCGST = $TotalCGST+$record->After_CGST; $TotalIGST = $TotalIGST+$record->After_IGST; $Totalotherallowances = $Totalotherallowances+$record->otherallowance; @@ -695,11 +713,21 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; // $totorder=$totorder+$record->TotalOrderValue; - $totalCapitalOrder = $totalCapitalOrder+$record->BasicValue; + } + //echo $TotalSummary; + if($CapitalRange=='1'){ + + $totalCapitalOrder = $totalCapitalOrder+$TotalSummary; + + } + else if($CapitalRange=='0') + { + $totalCapitalOrder = $totalCapitalOrder+$record->BasicValue;; + } ?> @@ -869,8 +897,8 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
-
-
+
+
CGST In % @@ -898,7 +926,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
-
+
SGST In % @@ -927,7 +955,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
-
+
IGST In % @@ -955,7 +983,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
-
+
@@ -968,7 +996,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block'; ?>
-
+
@@ -983,6 +1011,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
+

@@ -1312,8 +1341,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
-
- +
@@ -1338,7 +1366,7 @@ document.getElementById('currencyTypeDiv').style.display = 'block';
-
+
  Submit +   Submit @@ -1643,13 +1671,13 @@ var myArray = ; $('#ADDCAPdiv2').hide(); $('#ADDCAPdiv3').hide(); $('#EDITCAPdiv').hide(); - $('#EDITCAPdiv1').hide(); - $('#EDITCAPdiv2').hide(); - $('#EDITCAPdiv3').hide(); - $('#VIEWCAPdiv').hide(); - $('#VIEWCAPdiv1').hide(); - $('#VIEWCAPdiv2').hide(); - $('#VIEWCAPdiv3').hide(); + // $('#EDITCAPdiv1').hide(); + // $('#EDITCAPdiv2').hide(); + // $('#EDITCAPdiv3').hide(); + // $('#VIEWCAPdiv').hide(); + // $('#VIEWCAPdiv1').hide(); + // $('#VIEWCAPdiv2').hide(); + // $('#VIEWCAPdiv3').hide(); //$('#DOMdiv').hide(); } @@ -2575,7 +2603,7 @@ $('#PurQuantity').val(''); $('#EditCPUOM').val($('#uom'+userid).val()); $('#EditCPQuantity').val($('#quantity'+userid).val()); - $('#EditCPRate').val($('#rateInUs'+userid).val()); + $('#EditCPRate').val($('#rateInUs'+userid).val()); $('#EditCPTotalAmount').val($('#basicval'+userid).val()); @@ -2728,20 +2756,15 @@ $("#EdittxtTotalOrderValue").val(''); } - function Save(status) -{ //alert('save function'); + function Save() +{ +//alert('save function'); - -if(status == '0') -{ - stat = ''; -} -else -{ stat = ''; -} + var splinstr = $('#txtSpcialInstruction').val(); +//alert(splinstr); var deladd = $('#DeliveryAddr').val(); var ExchangeRateOn = $('#Exchangerateon').val(); @@ -2771,16 +2794,17 @@ $('#txtStatus').val(stat); $('#content').loader('show'); //salert('ss'); - + //alert('before Ajax'); $.ajax({ data:$('.CapitalPO').serialize()+"&ExchangeRateOn="+ExchangeRateOn+"&PaymentMethod="+PaymentMethod+"&PayableAT="+PayableAT+"&PaymentDate="+PaymentDate, type:"POST", - url:"purchaseorder/EditCapitalPurchaseOrder", + url:"amendmentpurchaseorder/EditAmendCapitalPurchaseOrder", success:function(data) { if(data) { + alert(data); $('#content').loader('hide'); $('#txtRowCount').val(''); @@ -2789,7 +2813,7 @@ $('#txtStatus').val(stat); $('#txtDeliveryAddress').val(''); clearAfterAddLineItemAdd(); - //window.location ="purchaseorderListing"; + window.location ="amendmentpurchaseorder"; } else @@ -2847,13 +2871,16 @@ $('#txtStatus').val(stat); //var txtExchangeRate = parseFloat( $('#EditExchangeRtModal').val()); var RatePerTon = parseFloat( $('#EditCPRate').val()); //var txtUnitPrice = parseFloat($('#Rate').val()); - var txtExchangeRate=''; - if(capitalType=='International'){ + + //var txtExchangeRate=''; + if(capitalType=='International'){ + alert('international'); txtExchangeRate = parseFloat( $('#EditExchangeRtModal').val()); var Tot = txtQuantity * RatePerTon; } else{ + alert('Dometic'); var Tot = txtQuantity * RatePerTon; txtExchangeRate = 1; }