ADD REVENUE NEW CHANGES

This commit is contained in:
velz2020 2017-09-12 19:52:59 +05:30
parent 16ddba31d5
commit ef1ae94965
4 changed files with 203 additions and 37 deletions

View File

@ -833,6 +833,8 @@ class purchaseorder extends BaseController
function addNewPurchaseOrder() function addNewPurchaseOrder()
{ {
echo "only for Revenue";
$POdt =$this->input->post('PODate'); $POdt =$this->input->post('PODate');
$PODate = $this->getDateformat($POdt); $PODate = $this->getDateformat($POdt);
@ -852,8 +854,20 @@ class purchaseorder extends BaseController
$POType = $this->input->post('POType'); $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'); $SpcialInstruction = $this->input->post('SpcialInstruction');
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
$POStatus = $this->input->post('txtStatus'); $POStatus = $this->input->post('txtStatus');
@ -871,10 +885,10 @@ class purchaseorder extends BaseController
$OtherPayment=$this->input->post('Otherpayment'); $OtherPayment=$this->input->post('Otherpayment');
$Local_Interstate=$this->input->post('Range'); $Local_Interstate=$this->input->post('Range');
// PO Master // 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); // print_r($POList);
//die(); // die();
$POMaster = $this->purchaseorder_model->addPOMaster($POList); $POMaster = $this->purchaseorder_model->addPOMaster($POList);
@ -895,6 +909,7 @@ class purchaseorder extends BaseController
$Quantity = $this->input->post('quantity'.$i); $Quantity = $this->input->post('quantity'.$i);
$Reqnumber = $this->input->post('Reqnumber'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i);
$itemRate = $this->input->post('itemRate'.$i); $itemRate = $this->input->post('itemRate'.$i);
$per=$this->input->post('per'.$i);
$DiscountType = $this->input->post('DisType'.$i); $DiscountType = $this->input->post('DisType'.$i);
$DiscountValue = $this->input->post('DisVal'.$i); $DiscountValue = $this->input->post('DisVal'.$i);
@ -909,7 +924,8 @@ class purchaseorder extends BaseController
$AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $AfterFreightValue = $this->input->post('AfterFreightVal'.$i);
$NOOfTrip = $this->input->post('NoOfTrip'.$i); $NOOfTrip = $this->input->post('NoOfTrip'.$i);
$InsuranceValue = $this->input->post('Insval'.$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); $CostCenter = $this->input->post('costCode'.$i);
$Cgst = $this->input->post('RevenueCgst'.$i); $Cgst = $this->input->post('RevenueCgst'.$i);
$Sgst = $this->input->post('RevenueSgst'.$i); $Sgst = $this->input->post('RevenueSgst'.$i);
@ -934,8 +950,8 @@ class purchaseorder extends BaseController
} }
if($SkipInsert == "False") 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); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
$LineItemNo = ''; $LineItemNo = '';
@ -949,7 +965,7 @@ class purchaseorder extends BaseController
{ {
// echo 'Success'; // 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); $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); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
//echo 'Revenue tax Success'; //echo 'Revenue tax Success';
} }

View File

@ -102,6 +102,7 @@ $(function() {
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -210,11 +211,11 @@ $(function() {
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
<div class="col-md-3 col-md-offset-2"> <div class="col-md-3 col-md-offset-2">
Budget Amount : Configuration Value :
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<?php <?php
$data = array('name' => 'ConfigValue', 'value' => set_value('ConfigValue'),'id'=>'ConfigValue', 'class' => 'form-control'); $data = array('name' => 'EditConfigValue', 'value' => set_value('EditConfigValue'),'id'=>'EditConfigValue', 'class' => 'form-control');
echo form_input($data); echo form_input($data);
?> ?>
@ -306,12 +307,13 @@ var numbers = /^[0-9]+$/;
var userid = ''; var userid = '';
$("#Edit").on("shown.bs.modal", function(e) { $("#Edit").on("shown.bs.modal", function(e) {
//alert();
userid = $(e.relatedTarget).data('userid'); userid = $(e.relatedTarget).data('userid');
var s=$('#configtable tr:eq('+ userid +') td:eq(1)').text()
$("#EditConfigValue").val(s);
var s = $('#ConfigValue').val($('#configtable tr:eq('+ userid +') td:eq(0)').text());
alert(s);
}); });
@ -377,9 +379,10 @@ $("#Edit").on("shown.bs.modal", function(e) {
function addHidden(theForm, key, value) { function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form: // Create a hidden input element, and append it to the form:
var input = document.createElement('input'); var input = document.createElement('input');
input.type = 'hidden'; input.type = 'text';
input.name = key;'name-as-seen-at-the-server'; input.name = key;'name-as-seen-at-the-server';
input.value = value; input.value = value;
input.id=key;
theForm.append(input); theForm.append(input);
} }
@ -400,17 +403,19 @@ $('.tempClickEdit').click(function(){
// } // }
if ( $('#EditAmout').val() != '' && $('#EditYear').val() != '' ) if ( $("#EditConfigValue").val() != '' )
{ {
var temp = index; var temp = index;
var ConfigValue = $("#ConfigValue").val(); var ConfigValue = $("#EditConfigValue").val();
//alert(userid);
$('#configtable tr:eq('+ userid +') td:eq(1)').text(ConfigValue); $('#configtable tr:eq('+ userid +') td:eq(1)').text(ConfigValue);
//alert($('#hConfigValue'+userid).val());
$('#ConfigValue'+userid).val(ConfigValue); //$('#hConfigValue'+userid).val(ConfigValue);
$("#ConfigValue"+userid).val(ConfigValue);//ConfigValue2

View File

@ -79,6 +79,20 @@ if(!empty($INRSYMBOL))
tinymce.init({ tinymce.init({
selector: "textarea#txtSpcialInstruction", selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#Service_Description",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#Edit_Service_Description",
menubar: false, menubar: false,
statusbar: false, statusbar: false,
toolbar: false toolbar: false
@ -92,6 +106,9 @@ if(!empty($INRSYMBOL))
$("#PaymentTerms").select2(); $("#PaymentTerms").select2();
clearTotalItemValues(); clearTotalItemValues();
}); });
function openModal() function openModal()
{ {
@ -208,7 +225,9 @@ $('#drpSupplier').change(function() {
if(PaymentID!='PT08'){ if(PaymentID!='PT08'){
$('#otheroptiondiv').hide(); $('#otheroptiondiv').hide();
$('#Otherpayment').val(''); $('#Otherpayment').val('');
} }else if(PaymentID == 'PT08'){
$('#otheroptiondiv').show();
}
$.each(Payment, function(pay, payobj) { $.each(Payment, function(pay, payobj) {
if(payobj.PaymentID == PaymentID) if(payobj.PaymentID == PaymentID)
{ {
@ -1882,11 +1901,13 @@ return true;
function validateEditExceedLimit() function validateEditExceedLimit()
{ {
//alert(" Edit Budget Check");
var avalbudAmt = parseFloat($('#EditAvlBudAmt').val()); var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
var basicAmountRate = parseFloat($('#txtEditBasicValue').val()); var basicAmountRate = parseFloat($('#txtEditBasicValue').val());
var totalAmount = parseFloat($('#txtEditTotalOrderValue').val()); //alert(basicAmountRate);
// var totalAmount = parseFloat($('#txtEditTotalOrderValue').val());
if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt) if(basicAmountRate > avalbudAmt)// || totalAmount > avalbudAmt)
{ {
alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.'); alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
$('#EditRate').focus(); $('#EditRate').focus();
@ -1932,7 +1953,7 @@ function calculateEditTaxValue()
var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(); var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val();
var totvalue = parseFloat(Packaging)+ parseFloat(AfterCgst)+ parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(Freight) + parseFloat(Insurance) ; var totvalue = parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(AfterCgst) ;
var tot = parseFloat(totvalue).toFixed(2); var tot = parseFloat(totvalue).toFixed(2);
//alert('tot:'+tot); //alert('tot:'+tot);
@ -2179,6 +2200,61 @@ function calculateEditTaxValue()
</div> </div>
</div> </div>
</div><!--End new fields 1 sep--> </div><!--End new fields 1 sep-->
<!--start new fields 1 sep-->
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="col-md-12" style="padding: 0px;">
<label>Revenue Type Options</label>
<div class="form-group">
<?php
//$optionsWork = array("0"=>'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');
?>
</div>
</div>
</div>
<div class="col-md-1">
<label for="insurance">Insurance</label>
<?php
$optionsnew=array('1'=>'Yes','0'=>'No');
echo form_dropdown('insurance', $optionsnew,set_value('insurance'),'id="insurance"' ,'required="true"' ,'class="form-control select2');
?>
</div>
<div class="col-md-3" id="insurancenodiv" style="display:block;">
<label>Insurance No<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5 ;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'insuranceno','insuranceno' => set_value('insuranceno'),'id'=>'insuranceno', 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-12" style="padding:0px;"> <div class="col-md-12" style="padding:0px;">
@ -2214,6 +2290,7 @@ function calculateEditTaxValue()
?> ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -2701,7 +2778,18 @@ function calculateEditTaxValue()
$data = array('name' => 'txtTotalOrderValue','value' => set_value('txtTotalOrderValue',0.00),'id'=>'txtTotalOrderValue', 'class' => 'form-control num' ,'readonly' => 'true'); $data = array('name' => 'txtTotalOrderValue','value' => set_value('txtTotalOrderValue',0.00),'id'=>'txtTotalOrderValue', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data); echo form_input($data);
?> ?>
</div>
</div>
</div>
<div class="col-md-4 ">
<label><?php echo "Revenue Description";?></label>
<div class="form-group">
<?php
$data = array('name' => 'Service_Description','value' => set_value('Service_Description'),'id'=>'Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100');
echo form_textarea($data);;
?>
</div>
</div> </div>
<div class="col-md-4 col-md-offset-4"><br/> <div class="col-md-4 col-md-offset-4"><br/>
<a class="btn btn-primary font AddRevenue" ID="AddRevenue"> &nbsp;&nbsp;<span class="bold">Add Revenue</span></a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a> <a class="btn btn-primary font AddRevenue" ID="AddRevenue"> &nbsp;&nbsp;<span class="bold">Add Revenue</span></a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
@ -3062,6 +3150,17 @@ function calculateEditTaxValue()
?> ?>
</div> </div>
</div> </div>
<div class="col-md-4 ">
<label><?php echo "Reveneue Description";?></label>
<div class="form-group">
<?php
$data = array('name' => 'Edit_Service_Description','value' => set_value('Edit_Service_Description'),'id'=>'Edit_Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100');
echo form_textarea($data);;
?>
</div>
</div>
<div class="col-md-4 col-md-offset-4" ><br/> <div class="col-md-4 col-md-offset-4" ><br/>
<a class="btn btn-primary EditRevenue" ID="EditRevenue"> &nbsp;&nbsp;<span class="bold">Edit Revenue</span></a>&nbsp;&nbsp;&nbsp;&nbsp; <a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a> <a class="btn btn-primary EditRevenue" ID="EditRevenue"> &nbsp;&nbsp;<span class="bold">Edit Revenue</span></a>&nbsp;&nbsp;&nbsp;&nbsp; <a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
</div> </div>
@ -3260,6 +3359,18 @@ $("#REVENUE").on("shown.bs.modal", function(e) {
$('#isEdit').val(0); $('#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) { $("#EDITREVENUE").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid'); userid = $(e.relatedTarget).data('userid');
@ -3278,6 +3389,12 @@ $("#EDITREVENUE").on("shown.bs.modal", function(e) {
$('#EditUOM').val($('#uom'+userid).val()); $('#EditUOM').val($('#uom'+userid).val());
$('#EditQuantity').val($('#quantity'+userid).val()); $('#EditQuantity').val($('#quantity'+userid).val());
$('#EditRate').val($('#itemRate'+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); $('#txtEditBasicValue').val(cellval[7].innerHTML);
RequistQuantity = $('#quantity'+userid).val(); RequistQuantity = $('#quantity'+userid).val();
$('#txtEditDiscount').val($('#DisVal'+userid).val()); $('#txtEditDiscount').val($('#DisVal'+userid).val());
@ -3301,6 +3418,8 @@ $("#EDITREVENUE").on("shown.bs.modal", function(e) {
$('#EditTripsValue').hide(); $('#EditTripsValue').hide();
} }
$('#txtEditTotalOrderValue').val($('#TotalOrderValue'+userid).val()); $('#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()); $('#EditAfterCgst').val($('#RevenueAfterCgst'+userid).val());
$('#EditAfterSgst').val($('#RevenueAfterSgst'+userid).val()); $('#EditAfterSgst').val($('#RevenueAfterSgst'+userid).val());
$('#EditAfterIgst').val($('#RevenueAfterIgst'+userid).val()); $('#EditAfterIgst').val($('#RevenueAfterIgst'+userid).val());
@ -3367,7 +3486,7 @@ $("#EDITREVENUE").on("shown.bs.modal", function(e) {
}); });
$('.AddRevenue').click(function(){ $('.AddRevenue').click(function(){
tinyMCE.triggerSave();
if(validateRevenueTax() && validateExceedLimit() && ExceedQuantityCheck()) if(validateRevenueTax() && validateExceedLimit() && ExceedQuantityCheck())
{ {
var temp = index; var temp = index;
@ -3380,7 +3499,10 @@ $('.AddRevenue').click(function(){
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var quantity = $("#Quantity").val(); var quantity = $("#Quantity").val();
var itemRate = parseFloat($("#Rate").val()).toFixed(2); var itemRate = parseFloat($("#Rate").val()).toFixed(2);
var per=$("#AddPer").val();
if(per == ''){
per=$("#UOM").val();
}
var DisType = $("#DiscountType").val(); var DisType = $("#DiscountType").val();
var DisVal = $("#txtDiscount").val(); var DisVal = $("#txtDiscount").val();
var AfterDisVal = $("#txtAfterDiscount").val(); var AfterDisVal = $("#txtAfterDiscount").val();
@ -3400,6 +3522,8 @@ $('.AddRevenue').click(function(){
var Insval = parseFloat($('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val()).toFixed(2); var Insval = parseFloat($('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val()).toFixed(2);
var TotalOrderValue = $("#txtTotalOrderValue").val(); var TotalOrderValue = $("#txtTotalOrderValue").val();
var Service_Description = $('#Service_Description').val();
var Cgst = $("#Cgst").val(); var Cgst = $("#Cgst").val();
var AfterCgst = $("#AfterCgst").val(); var AfterCgst = $("#AfterCgst").val();
var Sgst = $("#Sgst").val(); var Sgst = $("#Sgst").val();
@ -3445,6 +3569,7 @@ $('.AddRevenue').click(function(){
addHidden(theForm,"uom"+temp,uom); addHidden(theForm,"uom"+temp,uom);
addHidden(theForm,"quantity"+temp,quantity); addHidden(theForm,"quantity"+temp,quantity);
addHidden(theForm,"itemRate"+temp,itemRate); addHidden(theForm,"itemRate"+temp,itemRate);
addHidden(theForm,"per"+temp,per);
addHidden(theForm,"DisType"+temp,DisType); addHidden(theForm,"DisType"+temp,DisType);
addHidden(theForm,"DisVal"+temp,DisVal); addHidden(theForm,"DisVal"+temp,DisVal);
addHidden(theForm,"AfterDisVal"+temp,AfterDisVal); addHidden(theForm,"AfterDisVal"+temp,AfterDisVal);
@ -3466,7 +3591,8 @@ $('.AddRevenue').click(function(){
addHidden(theForm,"basicval"+temp,basicval); addHidden(theForm,"basicval"+temp,basicval);
addHidden(theForm,"Insval"+temp,Insval); 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); addHidden(theForm,"LineItemNo"+temp,0);
$('#txtRowCount').val(temp); $('#txtRowCount').val(temp);
// $('#REVENUE').modal('hide'); // $('#REVENUE').modal('hide');
@ -3475,7 +3601,7 @@ $('.AddRevenue').click(function(){
}); });
$('.EditRevenue').click(function(){ $('.EditRevenue').click(function(){
tinyMCE.triggerSave();
if(validateEditRevenueTax() && validateEditExceedLimit() && ExceedEditQuantityCheck()) if(validateEditRevenueTax() && validateEditExceedLimit() && ExceedEditQuantityCheck())
{ {
//alert('inside Add'); //alert('inside Add');
@ -3487,7 +3613,11 @@ $('.AddRevenue').click(function(){
var editQuantity = $('#EditQuantity').val(); var editQuantity = $('#EditQuantity').val();
var itemRate = $("#EditRate").val(); var itemRate = $("#EditRate").val();
var per=$('#EditPer').val();
if(per==""){
per=$('#EditUOM').val();
}
var DisType = $("#EditDiscountType").val(); var DisType = $("#EditDiscountType").val();
var DisVal = $("#txtEditDiscount").val(); var DisVal = $("#txtEditDiscount").val();
@ -3510,7 +3640,8 @@ $('.AddRevenue').click(function(){
var basicval = $("#txtEditBasicValue").val(); var basicval = $("#txtEditBasicValue").val();
var Insval = $("#txtEditInsurance").val(); var Insval = $("#txtEditInsurance").val();
var TotalOrderValue = $("#txtEditTotalOrderValue").val(); var TotalOrderValue = $("#txtEditTotalOrderValue").val();
// tinyMCE.get('EdittxtSpcialInstruction').setContent($('#ItemDescription'+userid).val());
var Service_Description=$("#Edit_Service_Description").val();
var TotalTaxValue = calculateEditTaxValue(); var TotalTaxValue = calculateEditTaxValue();
@ -3531,6 +3662,7 @@ $('.AddRevenue').click(function(){
$('#uom'+userid).val(editUOM); $('#uom'+userid).val(editUOM);
$('#quantity'+userid).val(editQuantity); $('#quantity'+userid).val(editQuantity);
$('#itemRate'+userid).val(itemRate); $('#itemRate'+userid).val(itemRate);
$('#per'+userid).val(per);
$('#DisType'+userid).val(DisType); $('#DisType'+userid).val(DisType);
$('#DisVal'+userid).val(DisVal); $('#DisVal'+userid).val(DisVal);
$('#AfterDisVal'+userid).val(AfterDisVal); $('#AfterDisVal'+userid).val(AfterDisVal);
@ -3551,7 +3683,8 @@ $('.AddRevenue').click(function(){
$('#AfterFreightVal'+userid).val(AfterFreightVal); $('#AfterFreightVal'+userid).val(AfterFreightVal);
$('#basicval'+userid).val(basicval); $('#basicval'+userid).val(basicval);
$('#Insval'+userid).val(Insval); $('#Insval'+userid).val(Insval);
$('#TotalOrderValue'+userid).val(TotalOrderValue); $('#TotalOrderValue'+userid).val(TotalOrderValue);
$('#Service_Description'+userid).val(Service_Description);
populateValueMainFormForEditRevenueTax(); populateValueMainFormForEditRevenueTax();
} }
@ -3680,6 +3813,7 @@ function clearRevenueModalFields()
$('#UOM').val(''); $('#UOM').val('');
$('#Quantity').val(''); $('#Quantity').val('');
$("#Rate").val(''); $("#Rate").val('');
$("#AddPer").val('');
$("#DiscountType").val('0'); $("#DiscountType").val('0');
$("#txtDiscount").val(''); $("#txtDiscount").val('');
@ -3715,6 +3849,8 @@ function clearRevenueModalFields()
$("#txtBasicValue").val(''); $("#txtBasicValue").val('');
$("#txtInsurance").val(''); $("#txtInsurance").val('');
$("#txtTotalOrderValue").val(''); $("#txtTotalOrderValue").val('');
tinyMCE.activeEditor.setContent('');
//$('#Service_Description').val('');
} }
function validateEditRevenueTax() function validateEditRevenueTax()
{ {
@ -3856,7 +3992,10 @@ $('#txtStatus').val(stat);
var splinstr = $('#txtSpcialInstruction').val(); var splinstr = $('#txtSpcialInstruction').val();
$('#SpcialInstruction').val(splinstr); $('#SpcialInstruction').val(splinstr);
var AvlBudAmt = '<?php echo $AvlAmount ?>'; var AvlBudAmt = '<?php echo $AvlAmount ?>';
var txtTotalOrderValueSummary = $('#txtTotalOrderValueSummary').val(); var txtTotBasicAmount = $('#txtTotBasicAmount').val();
var txtTotalDiscount = $('#txtTotalDiscount').val();
var finalBasicAmount = txtTotBasicAmount - txtTotalDiscount;
//alert(txtTotBasicAmount+"--"+txtTotalDiscount+"--"+finalBasicAmount+"--"+AvlBudAmt);
if(validate()) if(validate())
{ {
if(document.getElementById('revenueTax').rows.length < 3) if(document.getElementById('revenueTax').rows.length < 3)
@ -3865,7 +4004,7 @@ var AvlBudAmt = '<?php echo $AvlAmount ?>';
$('#Deliverydt').focus(); $('#Deliverydt').focus();
return false; 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.'); alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.');
return false; return false;
@ -3875,6 +4014,11 @@ var AvlBudAmt = '<?php echo $AvlAmount ?>';
$('#Otherpayment').focus(); $('#Otherpayment').focus();
return false; return false;
} }
else if($('#insurance').val() == 1 && $('#insuranceno').val() == ''){
alert('Please Enter Insurance No..!');
$('#insurance').focus();
return false;
}
else else
{ {
@ -4072,7 +4216,7 @@ function calculateTotalValue()
var Discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(); 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); var tot = parseFloat(totvalue).toFixed(2);
//alert('tot:'+tot); //alert('tot:'+tot);

View File

@ -200,11 +200,12 @@ function calculateTaxValue()
function validateExceedLimit() function validateExceedLimit()
{ {
// alert("add budget");
var avalbudAmt = parseFloat($('#AvlBudAmt').val()); var avalbudAmt = parseFloat($('#AvlBudAmt').val());
var basicAmountRate = parseFloat($('#txtBasicValue').val()); var basicAmountRate = parseFloat($('#txtBasicValue').val());
var totalAmount = parseFloat($('#txtTotalOrderValue').val()); // var totalAmount = parseFloat($('#txtTotalOrderValue').val());
//alert(basicAmountRate);
if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt) if(basicAmountRate > avalbudAmt)// || totalAmount > avalbudAmt)
{ {
alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.'); alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
$('#Rate').focus(); $('#Rate').focus();