diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 6f0b94f7..f4d8d2f3 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -833,6 +833,8 @@ class purchaseorder extends BaseController function addNewPurchaseOrder() { + + echo "only for Revenue"; $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); @@ -852,8 +854,20 @@ class purchaseorder extends BaseController $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + //$PoRange = $this->input->post('txtPoRange'); + $Modeofshipment=$this->input->post('addmodeofshipment'); + $supplierreference=$this->input->post('addsupplierreference'); + $supplieroffno=$this->input->post('addsupplierofferno'); + $otherreference=$this->input->post('addotherreference'); + $fincap=$this->input->post('addfincap'); + $revenuetype=$this->input->post('PoTypeOptions'); + $insurancestatus=$this->input->post('insurance'); + if($insurancestatus == 1){ + $insuranceno=$this->input->post('insuranceno'); + }else{ + $insuranceno=$this->input->post('insuranceno'); + } $SpcialInstruction = $this->input->post('SpcialInstruction'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); $POStatus = $this->input->post('txtStatus'); @@ -871,10 +885,10 @@ class purchaseorder extends BaseController $OtherPayment=$this->input->post('Otherpayment'); $Local_Interstate=$this->input->post('Range'); // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno); - //print_r($POList); - //die(); + // print_r($POList); + // die(); $POMaster = $this->purchaseorder_model->addPOMaster($POList); @@ -895,6 +909,7 @@ class purchaseorder extends BaseController $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); + $per=$this->input->post('per'.$i); $DiscountType = $this->input->post('DisType'.$i); $DiscountValue = $this->input->post('DisVal'.$i); @@ -909,7 +924,8 @@ class purchaseorder extends BaseController $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $NOOfTrip = $this->input->post('NoOfTrip'.$i); $InsuranceValue = $this->input->post('Insval'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $revenuedescription = $this->input->post('Service_Description'.$i); $CostCenter = $this->input->post('costCode'.$i); $Cgst = $this->input->post('RevenueCgst'.$i); $Sgst = $this->input->post('RevenueSgst'.$i); @@ -934,8 +950,8 @@ class purchaseorder 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); - + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + //print_r($POLineItemList); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); $LineItemNo = ''; @@ -949,7 +965,7 @@ class purchaseorder extends BaseController { // echo 'Success'; $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); - + //print_r($RevenueTaxList); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); //echo 'Revenue tax Success'; } diff --git a/application/views/addconfig.php b/application/views/addconfig.php index aad29fa2..56af6465 100755 --- a/application/views/addconfig.php +++ b/application/views/addconfig.php @@ -102,6 +102,7 @@ $(function() { + @@ -210,11 +211,11 @@ $(function() { + + +
+
+
+
+ + + +
+ + 'Select Work Status'); + + + if(!empty($PoTypeOptions)) + { + foreach ($PoTypeOptions as $POpt): + + + $optionsPO[$POpt->ConfigValue] = $POpt->ConfigValue; + + endforeach; + } + + echo form_dropdown('PoTypeOptions', $optionsPO,set_value('PoTypeOptions'),'id="PoTypeOptions"' ,'required="true"' ,'class="form-control select2'); + + + ?> +
+ + + +
+
+
+ + 'Yes','0'=>'No'); + echo form_dropdown('insurance', $optionsnew,set_value('insurance'),'id="insurance"' ,'required="true"' ,'class="form-control select2'); + + ?> +
+
+ +
+ 'insuranceno','insuranceno' => set_value('insuranceno'),'id'=>'insuranceno', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+
+
+
@@ -2214,6 +2290,7 @@ function calculateEditTaxValue() ?>
+ @@ -2701,7 +2778,18 @@ function calculateEditTaxValue() $data = array('name' => 'txtTotalOrderValue','value' => set_value('txtTotalOrderValue',0.00),'id'=>'txtTotalOrderValue', 'class' => 'form-control num' ,'readonly' => 'true'); echo form_input($data); ?> - + + + +
+ +
+ 'Service_Description','value' => set_value('Service_Description'),'id'=>'Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100'); + echo form_textarea($data);; + ?> + +

  Add Revenue    Cancel @@ -3062,6 +3150,17 @@ function calculateEditTaxValue() ?>
+ +
+ +
+ 'Edit_Service_Description','value' => set_value('Edit_Service_Description'),'id'=>'Edit_Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100'); + echo form_textarea($data);; + ?> + +
+

  Edit Revenue     Cancel
@@ -3260,6 +3359,18 @@ $("#REVENUE").on("shown.bs.modal", function(e) { $('#isEdit').val(0); }); + +$("#insurance").change(function(){ + var ans=$("#insurance").val(); + //alert(ans); + if(ans == 0){ + $("#insurancenodiv").hide(); + $("#insuranceno").val(""); + } + else { + $("#insurancenodiv").show();} +}); + $("#EDITREVENUE").on("shown.bs.modal", function(e) { userid = $(e.relatedTarget).data('userid'); @@ -3278,6 +3389,12 @@ $("#EDITREVENUE").on("shown.bs.modal", function(e) { $('#EditUOM').val($('#uom'+userid).val()); $('#EditQuantity').val($('#quantity'+userid).val()); $('#EditRate').val($('#itemRate'+userid).val()); + var p=$('#per'+userid).val() + if(p!=""){ + $('#EditPer').val($('#per'+userid).val()); + }else{ + $('#EditPer').val($('#uom'+userid).val()); + } $('#txtEditBasicValue').val(cellval[7].innerHTML); RequistQuantity = $('#quantity'+userid).val(); $('#txtEditDiscount').val($('#DisVal'+userid).val()); @@ -3301,6 +3418,8 @@ $("#EDITREVENUE").on("shown.bs.modal", function(e) { $('#EditTripsValue').hide(); } $('#txtEditTotalOrderValue').val($('#TotalOrderValue'+userid).val()); + tinyMCE.get('Edit_Service_Description').setContent($('#Service_Description'+userid).val()); + //$('#Edit_Service_Description').val($('#Service_Description'+userid).val()); $('#EditAfterCgst').val($('#RevenueAfterCgst'+userid).val()); $('#EditAfterSgst').val($('#RevenueAfterSgst'+userid).val()); $('#EditAfterIgst').val($('#RevenueAfterIgst'+userid).val()); @@ -3367,7 +3486,7 @@ $("#EDITREVENUE").on("shown.bs.modal", function(e) { }); $('.AddRevenue').click(function(){ - + tinyMCE.triggerSave(); if(validateRevenueTax() && validateExceedLimit() && ExceedQuantityCheck()) { var temp = index; @@ -3380,7 +3499,10 @@ $('.AddRevenue').click(function(){ var uom = $("#UOM").val(); var quantity = $("#Quantity").val(); var itemRate = parseFloat($("#Rate").val()).toFixed(2); - + var per=$("#AddPer").val(); + if(per == ''){ + per=$("#UOM").val(); + } var DisType = $("#DiscountType").val(); var DisVal = $("#txtDiscount").val(); var AfterDisVal = $("#txtAfterDiscount").val(); @@ -3400,6 +3522,8 @@ $('.AddRevenue').click(function(){ var Insval = parseFloat($('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val()).toFixed(2); var TotalOrderValue = $("#txtTotalOrderValue").val(); + + var Service_Description = $('#Service_Description').val(); var Cgst = $("#Cgst").val(); var AfterCgst = $("#AfterCgst").val(); var Sgst = $("#Sgst").val(); @@ -3445,6 +3569,7 @@ $('.AddRevenue').click(function(){ addHidden(theForm,"uom"+temp,uom); addHidden(theForm,"quantity"+temp,quantity); addHidden(theForm,"itemRate"+temp,itemRate); + addHidden(theForm,"per"+temp,per); addHidden(theForm,"DisType"+temp,DisType); addHidden(theForm,"DisVal"+temp,DisVal); addHidden(theForm,"AfterDisVal"+temp,AfterDisVal); @@ -3466,7 +3591,8 @@ $('.AddRevenue').click(function(){ addHidden(theForm,"basicval"+temp,basicval); addHidden(theForm,"Insval"+temp,Insval); - addHidden(theForm,"TotalOrderValue"+temp,TotalOrderValue); + addHidden(theForm,"TotalOrderValue"+temp,TotalOrderValue); + addHidden(theForm,"Service_Description"+temp,Service_Description); addHidden(theForm,"LineItemNo"+temp,0); $('#txtRowCount').val(temp); // $('#REVENUE').modal('hide'); @@ -3475,7 +3601,7 @@ $('.AddRevenue').click(function(){ }); $('.EditRevenue').click(function(){ - + tinyMCE.triggerSave(); if(validateEditRevenueTax() && validateEditExceedLimit() && ExceedEditQuantityCheck()) { //alert('inside Add'); @@ -3487,7 +3613,11 @@ $('.AddRevenue').click(function(){ var editQuantity = $('#EditQuantity').val(); var itemRate = $("#EditRate").val(); - + var per=$('#EditPer').val(); + if(per==""){ + per=$('#EditUOM').val(); + } + var DisType = $("#EditDiscountType").val(); var DisVal = $("#txtEditDiscount").val(); @@ -3510,7 +3640,8 @@ $('.AddRevenue').click(function(){ var basicval = $("#txtEditBasicValue").val(); var Insval = $("#txtEditInsurance").val(); var TotalOrderValue = $("#txtEditTotalOrderValue").val(); - + // tinyMCE.get('EdittxtSpcialInstruction').setContent($('#ItemDescription'+userid).val()); + var Service_Description=$("#Edit_Service_Description").val(); var TotalTaxValue = calculateEditTaxValue(); @@ -3531,6 +3662,7 @@ $('.AddRevenue').click(function(){ $('#uom'+userid).val(editUOM); $('#quantity'+userid).val(editQuantity); $('#itemRate'+userid).val(itemRate); + $('#per'+userid).val(per); $('#DisType'+userid).val(DisType); $('#DisVal'+userid).val(DisVal); $('#AfterDisVal'+userid).val(AfterDisVal); @@ -3551,7 +3683,8 @@ $('.AddRevenue').click(function(){ $('#AfterFreightVal'+userid).val(AfterFreightVal); $('#basicval'+userid).val(basicval); $('#Insval'+userid).val(Insval); - $('#TotalOrderValue'+userid).val(TotalOrderValue); + $('#TotalOrderValue'+userid).val(TotalOrderValue); + $('#Service_Description'+userid).val(Service_Description); populateValueMainFormForEditRevenueTax(); } @@ -3680,6 +3813,7 @@ function clearRevenueModalFields() $('#UOM').val(''); $('#Quantity').val(''); $("#Rate").val(''); + $("#AddPer").val(''); $("#DiscountType").val('0'); $("#txtDiscount").val(''); @@ -3715,6 +3849,8 @@ function clearRevenueModalFields() $("#txtBasicValue").val(''); $("#txtInsurance").val(''); $("#txtTotalOrderValue").val(''); + tinyMCE.activeEditor.setContent(''); + //$('#Service_Description').val(''); } function validateEditRevenueTax() { @@ -3856,7 +3992,10 @@ $('#txtStatus').val(stat); var splinstr = $('#txtSpcialInstruction').val(); $('#SpcialInstruction').val(splinstr); var AvlBudAmt = ''; - var txtTotalOrderValueSummary = $('#txtTotalOrderValueSummary').val(); + var txtTotBasicAmount = $('#txtTotBasicAmount').val(); + var txtTotalDiscount = $('#txtTotalDiscount').val(); + var finalBasicAmount = txtTotBasicAmount - txtTotalDiscount; + //alert(txtTotBasicAmount+"--"+txtTotalDiscount+"--"+finalBasicAmount+"--"+AvlBudAmt); if(validate()) { if(document.getElementById('revenueTax').rows.length < 3) @@ -3865,7 +4004,7 @@ var AvlBudAmt = ''; $('#Deliverydt').focus(); return false; } - else if(parseInt(AvlBudAmt) < parseInt(txtTotalOrderValueSummary)) { + else if(parseInt(AvlBudAmt) < parseInt(finalBasicAmount)) { alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); return false; @@ -3875,6 +4014,11 @@ var AvlBudAmt = ''; $('#Otherpayment').focus(); return false; } + else if($('#insurance').val() == 1 && $('#insuranceno').val() == ''){ + alert('Please Enter Insurance No..!'); + $('#insurance').focus(); + return false; + } else { @@ -4072,7 +4216,7 @@ function calculateTotalValue() var Discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(); - var totvalue = parseFloat(Packaging)+ parseFloat(AfterCgst)+ parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(Freight) + parseFloat(Insurance) ; + var totvalue = parseFloat(AfterCgst)+ parseFloat(AfterSgst) + parseFloat(AfterIgst) ; var tot = parseFloat(totvalue).toFixed(2); //alert('tot:'+tot); diff --git a/assets/js/CreatePOValidation.js b/assets/js/CreatePOValidation.js index 44971dd1..52c74094 100755 --- a/assets/js/CreatePOValidation.js +++ b/assets/js/CreatePOValidation.js @@ -200,11 +200,12 @@ function calculateTaxValue() function validateExceedLimit() { + // alert("add budget"); var avalbudAmt = parseFloat($('#AvlBudAmt').val()); var basicAmountRate = parseFloat($('#txtBasicValue').val()); - var totalAmount = parseFloat($('#txtTotalOrderValue').val()); - - if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt) + // var totalAmount = parseFloat($('#txtTotalOrderValue').val()); + //alert(basicAmountRate); + if(basicAmountRate > avalbudAmt)// || totalAmount > avalbudAmt) { alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.'); $('#Rate').focus();