diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index dfc7ef0f..56b5f52f 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -304,7 +304,7 @@ class purchaseorder extends BaseController $this->load->View("capitalpopdf", NULL); } //To View/Update Purchase Order - //To View/Update Purchase Order + function EditPurchaseOrder() { $PONO = $_GET['PONO']; @@ -325,6 +325,7 @@ class purchaseorder extends BaseController $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); + $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); /* Cost code from Requisition - Client Review Fix Start here */ @@ -429,7 +430,7 @@ class purchaseorder extends BaseController // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); - $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); + //print_r($data['PaymentTerms']); $unicode =''; foreach ($data['CurrencyDetail'] as $Detail) diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index f141d68e..8d7d7ddc 100755 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -179,10 +179,9 @@ class servicepurchaseorder extends BaseController } //This used to Create Service Purchase Order - function addNewServicePurchaseOrder() { - + $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); @@ -199,7 +198,15 @@ class servicepurchaseorder extends BaseController $Deliverydt = $this->getDateformat($dt); $DeliverySchedule = ''; } - + $ModeOfShipment=$this->input->post('addmodeofshipment'); + $SupplierReference=$this->input->post('addsupplierreference'); + $SuppliersOfferNo=$this->input->post('addsupplierofferno'); + $OtherReferences=$this->input->post('addotherreference'); + $Fincap=$this->input->post('addfincap'); + $InsuranceOptions=$this->input->post('insuranceStatus'); + $InsuranceNo=$this->input->post('insuranceNo'); + $ServiceTypeOptions=$this->input->post('PoTypeOptions'); + $DescriptionOfPo = $this->input->post('descofpo'); $PaymentTerms=$this->input->post('PaymentTerms'); $OtherPayment=$this->input->post('Otherpayment'); @@ -220,7 +227,7 @@ class servicepurchaseorder extends BaseController $WorkStatus=$this->input->post('workstatus'); // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus, 'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption, 'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$WorkStatus,'POType'=>$POType,'PaymentOtherDescription'=>$OtherPayment); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus, 'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption, 'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$WorkStatus,'POType'=>$POType,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); $POMaster = $this->purchaseorder_model->addPOMaster($POList); @@ -235,7 +242,7 @@ class servicepurchaseorder extends BaseController for ($i = 1; $i <= $RowCount; $i++) { - + $Per = $this->input->post('per'.$i); $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); @@ -270,7 +277,7 @@ class servicepurchaseorder extends BaseController if($SkipInsert == "False") { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per); //print_r($POLineItemList); //die(); @@ -319,7 +326,15 @@ class servicepurchaseorder extends BaseController $DeliverySchedule = ''; } - + $ModeOfShipment=$this->input->post('editmodeofshipment'); + $SupplierReference=$this->input->post('editsupplierreference'); + $SuppliersOfferNo=$this->input->post('editsupplierofferno'); + $OtherReferences=$this->input->post('editotherreference'); + $Fincap=$this->input->post('editfincap'); + $InsuranceOptions=$this->input->post('insuranceStatus'); + $InsuranceNo=$this->input->post('insuranceNo'); + $ServiceTypeOptions=$this->input->post('PoTypeOptions'); + $DescriptionOfPo = $this->input->post('editdescofpo'); $PaymentTerms=$this->input->post('PaymentTerms'); @@ -342,7 +357,7 @@ class servicepurchaseorder extends BaseController // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$WorkStatus,'PaymentOtherDescription'=>$OtherPayment); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'ServiceWorkStatus'=>$WorkStatus,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$SupplierReference,'Mode_Of_Shipment'=>$ModeOfShipment,'Supplier_Offer_No'=>$SuppliersOfferNo,'Other_Reference'=>$OtherReferences,'Fincap'=>$Fincap,'Description_Of_Service'=>$DescriptionOfPo,'InsuranceStatus'=>$InsuranceOptions,'InsuranceNumber'=>$InsuranceNo,'POSubType'=>$ServiceTypeOptions); $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); @@ -365,7 +380,8 @@ class servicepurchaseorder extends BaseController $POLineItemNo = $this->input->post('LineItemNo'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); $ItemDescription = $this->input->post('ItemDescription'.$i); - $OtherAmt = $this->input->post('OtherAmt'.$i); + $OtherAmt = $this->input->post('OtherAmt'.$i); + $Per = $this->input->post('per'.$i); $POLineItem = array(); $LineItemNo = ''; @@ -389,7 +405,7 @@ class servicepurchaseorder extends BaseController if(strlen($POLineItemNo) == 0) { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); if(count($POLineItem)>0) @@ -403,7 +419,7 @@ class servicepurchaseorder extends BaseController { $LineItemNo = $POLineItemNo; - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ItemDescription); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); } diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index c7125202..da157a50 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -636,7 +636,7 @@ function GetPOType($ReqNo) function GetServicePurchaseOrderDetails($PONO = '') { - $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Quantity,ReceivedQuantity,Rate,LineItem.Status,(Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount + $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Quantity,ReceivedQuantity,Rate,LineItem.Status,(Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount ,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period FROM T_PurchaseOrder_LineItem LineItem join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index bf0acf99..87f5076a 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -1,6 +1,8 @@ "NO","value"=>"0"),array("name"=>"YES","value"=>"1") +); + $DeliverOption=''; $SupId = ''; $SupName = ''; $Address = ''; @@ -25,6 +27,15 @@ $DeliverOption=''; $Value="₹"; $StatusName=''; + $ModeOfShipment=''; + $SupplierReference=''; + $SuppliersOfferNo=''; + $OtherReferences=''; + $Fincap=''; + $InsuranceOptions=''; + $InsuranceNo=''; + $ServiceTypeOptions=''; + $DescriptionOfPo = ''; if(!empty($INRSYMBOL)) @@ -47,6 +58,7 @@ if(!empty($MaxPODate)) } if(!empty($POMaster)) { + foreach ($POMaster as $Req) { @@ -64,11 +76,19 @@ if(!empty($POMaster)) $PONOStatus = $Req->StatusCode; $PONO = $Req->PONO; $ServiceDescription = $Req->ServiceDescription; - - - $WrkStatus=$Req->ServiceWorkStatus; - $StatusName=$Req->StatusName; - $otherPayment = $Req->PaymentOtherDescription; + $WrkStatus=$Req->ServiceWorkStatus; + $StatusName=$Req->StatusName; + $otherPayment = $Req->PaymentOtherDescription; + $ModeOfShipment=$Req->Mode_Of_Shipment; + $SupplierReference=$Req->Supplier_Reference; + $SuppliersOfferNo=$Req->Supplier_Offer_No; + $OtherReferences=$Req->Other_Reference; + $Fincap=$Req->Fincap; + $InsuranceOptions=$Req->InsuranceStatus; + $InsuranceNo=$Req->InsuranceNumber; + $ServiceTypeOptions=$Req->POSubType; + $DescriptionOfPo = $Req->Description_Of_Service; + } } @@ -152,11 +172,20 @@ foreach ($PaymentTerms as $TER) \ No newline at end of file +$("#insuranceStatus").change(function(){ +var InsNo = ''; + +if($("#insuranceStatus").val()=="1"){ +$('#insuranceTxtDiv').show(); +$('#insuranceNo').val(InsNo); +} +else{ +$('#insuranceTxtDiv').hide(); +$('#insuranceNo').val(''); +} +}); + diff --git a/application/views/servicePurchaseorder.php b/application/views/servicePurchaseorder.php index d93b063d..78c334c0 100755 --- a/application/views/servicePurchaseorder.php +++ b/application/views/servicePurchaseorder.php @@ -1,4 +1,10 @@ -"NO","value"=>"0"),array("name"=>"YES","value"=>"1") +); + + +$ReqType =''; $CompanyAddress = ''; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $CurrentDate = $dt->format('d-m-Y'); @@ -132,6 +138,10 @@ $('#drpSupplier').change(function() { $('#otheroptiondiv').hide(); $('#Otherpayment').val(''); } + else if(PaymentID=='PT08'){ + $('#otheroptiondiv').show(); + $('#Otherpayment').val(''); + } $.each(Payment, function(pay, payobj) { if(payobj.PaymentID == PaymentID) { @@ -383,7 +393,7 @@ function Ratechange(){ calculateTotalOrdervalue(); - var res = ExceedBudget($('#TotalOrderValue').val(), $('#AvlBudAmt').val()); + var res = ExceedBudget($('#txtBasicValue').val(), $('#AvlBudAmt').val()); if(!res) { $('#Rate').focus(); @@ -410,7 +420,7 @@ function EditRatechange(){ var frequencyValue = parseFloat($('#EditFrequencyNo').val()); var Tot = txtQuantity * frequencyValue * txtUnitPrice $('#txtEditBasicValue').val(parseFloat(Tot).toFixed(2)); - ExceedBudget(Tot, $('#EditAvlBudAmt').val()); + ExceedBudget($('#txtEditBasicValue').val(), $('#EditAvlBudAmt').val()); $('#EditAfterCgst').val(calculateCgstTax($('#txtEditBasicValue').val(),$("#EditCgst").val()== '' ? "0.00" : $("#EditCgst").val())); @@ -509,6 +519,7 @@ function ExceedQuantityCheck() function clearTaxField() { + $('#txtBasicValue').val(''); $('#AfterCgst').val(0); $('#AfterSgst').val(0); @@ -521,6 +532,8 @@ function clearTaxField() $("#ItemName").val(''); $("#UOM").val(''); + $("#AddPer").val(''); + tinyMCE.get('txtSpcialInstruction').setContent(''); $("#Quantity").val(''); RequistQuantity = ''; @@ -812,6 +825,84 @@ function clearEditTaxField() + +