Browse Source

[fix]销售模块:修改客户报价信息汇率转换计算

dev
zhangsiqi 8 months ago
parent
commit
f204c0e7b0
  1. 61
      ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html
  2. 90
      ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html
  3. 11
      ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

61
ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html

@ -49,7 +49,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" class="form-control" type="number" placeholder="美元对人民币汇率">
<input name="usdTax" id="usdTax" class="form-control" type="number" placeholder="美元对人民币汇率">
</div>
</div>
<div class="form-group">
@ -65,7 +65,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">国内税率:</label>
<div class="col-sm-8">
<input name="rmbTax" class="form-control" type="number" placeholder="13" tloop="%"/>
<input name="rmbTax" id="rmbTax" class="form-control" type="number" placeholder="13" tloop="%"/>
</div>
</div>
<div class="form-group">
@ -210,6 +210,7 @@
$("input[name='rmbTax']").val(data.taxRate);
$("input[name='confirmFax']").val(data.confirmTax);
commonCurrency = $("#commonCurrency_add option:selected").val();
console.log("commonCurrency",commonCurrency);
});
$(function() {
var options = {
@ -266,17 +267,16 @@
{ title: '物料的不含税单价(RMB)',
field: 'materialNoRmb',
align: 'center',
editable: commonCurrency == '1'?false:true,
editable: commonCurrency == 1?false:true,
},
{title: '物料的不含税单价(USD)',
field: 'materialNoUsd',
align: 'center',
editable: commonCurrency == '2'?false:true,
editable: commonCurrency == 2?false:true,
},
{ title: '物料的含税单价(USD)',
field: 'materialUsd',
align: 'center'
align: 'center',
},
{ title: '物料的含税总价(USD)',
field: 'materialUsdSum',
@ -343,34 +343,29 @@
}
],
onEditableSave:function(field, row, oldValue, $el){
if(field =="materialNum" && row.materialNum != '' && currentCurrency == '1'){
$("#bootstrap-sub-table-quoteChild").bootstrapTable('updateByUniqueId', {
id: row.id,
row: {
materialNoRmb : row.materialNoRmb,
materialRmb : row.materialNoRmb * (1 + $("#rmbTax").val()),
materialNoUsd : row.materialNoRmb / $("#rmbTax").val(),
materialNoUsdSum : row.materialNoRmb / $("#rmbTax").val(),
materialUsd : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()),
materialUsdSum : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()),
materialNoRmbSum : row.materialNum * row.materialNoRmb,
materialRmbSum : row.materialNum * row.materialRmb
}
});
commonCurrency = $("#commonCurrency_add option:selected").val();
var Double = function(value) {
this.value = Number(value);
};
var rmb1 = new Double($("#rmbTax").val());
var rmb = rmb1 / 100;
var usd = new Double($("#usdTax").val());
console.log(commonCurrency);
if(commonCurrency == 1){
row.materialRmb = Number(row.materialNoRmb) * (1 + rmb);
row.materialNoUsd = Number(row.materialNoRmb) / rmb;
row.materialNoUsdSum = Number(row.materialNum) * Number(row.materialNoUsd);
row.materialUsd = Number(row.materialNoUsd);
row.materialUsdSum = Number(row.materialNum) * Number(row.materialUsd);
row.materialNoRmbSum = Number(row.materialNum) * Number(row.materialNoRmb);
}
else if(field =="materialNum" && row.materialNum != '' && currentCurrency == '2'){
$("#bootstrap-sub-table-quoteChild").bootstrapTable('updateByUniqueId', {
id: row.id,
row: {
materialUsd : row.materialNoUsd,
materialUsdSum : row.materialNum * row.materialUsd,
materialNoUsdSum : row.materialNoUsd * row.materialNum,
materialNoRmb : $("#usdTax").val() * row.materialNoUsd,
materialRmb : $("#usdTax").val() * row.materialNoUsd * (1 + $("#rmbTax").val()),
materialNoRmbSum : row.materialNoRmb * row.materialNum,
materialRmbSum : row.materialRmb * row.materialNum
}
});
else if( commonCurrency == 2){
row.materialUsd = Number(row.materialNoUsd);
row.materialUsdSum = Number(row.materialNum) * Number(row.materialUsd);
row.materialNoUsdSum = Number(row.materialNoUsd) * Number(row.materialNum);
row.materialNoRmb = usd * Number(row.materialNoUsd);
row.materialRmb = usd * Number(row.materialNoUsd) * (1 + rmb);
row.materialNoRmbSum = Number(row.materialNoRmb) * Number(row.materialNum);
}
getTotalAmount()
},

90
ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html

@ -43,7 +43,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">报价币种:</label>
<div class="col-sm-8">
<select class="form-control" name="commonCurrency" th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required>
<select class="form-control" id="commonCurrency_edit" name="commonCurrency" th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required>
<option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" ></option>
</select>
@ -52,7 +52,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" th:field="*{usdTax}" class="form-control" type="text" placeholder="美元对人民币汇率">
<input name="usdTax" th:field="*{usdTax}" id="usdTax_edit" class="form-control" type="number" placeholder="美元对人民币汇率">
</div>
</div>
<div class="form-group">
@ -68,7 +68,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">国内税率:</label>
<div class="col-sm-8">
<input name="rmbTax" th:field="*{rmbTax}" class="form-control" type="text" placeholder="13%" />
<input name="rmbTax" th:field="*{rmbTax}" id="rmbTax_edit" class="form-control" type="number" placeholder="13%" />
</div>
</div>
<div class="form-group">
@ -97,7 +97,7 @@
<div class="col-xs-12 form-row">
<label class="col-sm-2"> 不含税单价(RMB):</label><input placeholder="RMB" class="col-sm-1" name="noRmb" id="noRmb" th:field="*{noRmb}" type="number" disabled />
<label class="col-sm-2"> 不含税总价:</label><input placeholder="RMB" class="col-sm-1" name="noRmbSum" id="noRmbSum" th:field="*{noRmbSum}" type="number" disabled/>
<label class="col-sm-2"> 含税单价:</label><input placeholder="RMB" class="col-sm-1" name="rmb" id="rmb" type="text" th:field="*{rmb}" disabled/>
<label class="col-sm-2"> 含税单价:</label><input placeholder="RMB" class="col-sm-1" name="rmb" id="rmb" type="number" th:field="*{rmb}" disabled/>
<label class="col-sm-2"> 含税总价:</label><input placeholder="RMB" class="col-sm-1" name="rmbSum" id="rmbSum" th:field="*{rmbSum}" type="number" disabled/>
</div>
<div class="col-xs-12">
@ -140,6 +140,7 @@
var userName = [[${@permission.getPrincipalProperty('userName')}]];
var sysCustomerQuote = [[${sysCustomerQuote}]];
var prefix = ctx + "system/customerQuote"
var commonCurrency = $("#commonCurrency_edit option:selected").val();
$("#form-customerQuote-edit").validate({
focusCleanup: true,
});
@ -169,7 +170,6 @@
$("input[name='customerFax']").change(function () {
if ($("input[name='customerFax']").val() == "1") {
var taxRate = $("input[name='rmbTax']").val();
$("input[name='rmbTax']").val(taxRate / 100);
} else {
$("input[name='rmbTax']").val(0);
}
@ -190,7 +190,6 @@
showColumns: false,
showPaginationSwitch: false,
model: "物料报价信息",
onEditableSave: onEditableSave,
columns: [
{checkbox: true},
{title: '序号',align: 'center',
@ -230,14 +229,14 @@
{title: '美元汇率',field: 'usdTax', align: 'center',editable: true},
{title: '对外售价',field: 'materialSole',editable: true},
{title: '物料的数量',field: 'materialNum',align: 'center',editable: true},
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable: true,editable: true},
{title: '物料的不含税单价(美元)',field: 'materialNoUsd',align: 'center',editable: true,editable: true},
{title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',editable: true},
{title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',editable: true},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',editable: true},
{title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',editable: true},
{title: '物料的含税总价(美元)',field: 'materialUsdSum',align: 'center',editable: true},
{title: '物料的不含税总价(美元)', field: 'materialNoUsdSum',align: 'center',editable: true},
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable: commonCurrency==1?true:false},
{title: '物料的不含税单价(美元)',field: 'materialNoUsd',align: 'center',editable: commonCurrency==2?true:false},
{title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'},
{title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center'},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center'},
{title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center'},
{title: '物料的含税总价(美元)',field: 'materialUsdSum',align: 'center'},
{title: '物料的不含税总价(美元)', field: 'materialNoUsdSum',align: 'center'},
{field: 'remark',align: 'center',title: '备注',visible: false},
{title: '操作', align: 'center',
formatter: function (value, row, index) {
@ -246,7 +245,34 @@
return actions.join('');
}
}
]
],
onEditableSave:function(field, row, oldValue, $el){
commonCurrency = $("#commonCurrency_add option:selected").val();
var Double = function(value) {
this.value = Number(value).toFixed(2);
};
var rmb1 = new Double($("#rmbTax_edit").val());
var rmb = rmb1 / 100;
var usd = new Double($("#usdTax_edit").val());
console.log(commonCurrency);
if(commonCurrency == 1){
row.materialRmb = Number(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoUsd = Number(row.materialNoRmb / rmb).toFixed(2);
row.materialNoUsdSum = Number(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = Number(row.materialNoUsd).toFixed(2);
row.materialUsdSum = Number(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoRmbSum = Number(row.materialNum* row.materialNoRmb).toFixed(2);
}
else if( commonCurrency == 2){
row.materialUsd = Number(row.materialNoUsd).toFixed(2);
row.materialUsdSum = Number(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = Number(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = Number(usd * row.materialNoUsd).toFixed(2);
row.materialRmb = usd * Number(row.materialNoUsd * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = Number(row.materialNoRmb * row.materialNum).toFixed(2);
}
getTotalAmount()
},
};
$.table.init(options);
});
@ -374,39 +400,7 @@
$("#usdSum").val(usdSum);
}
// 结算金额
function onEditableSave(field, row, oldValue, $el){
const commonCurrency = $("#commonCurrency:checked").val();
if(field =="materialNum" && row.materialNum != "" && commonCurrency =="1"){
$("#bootstrap-table-Quote-child").bootstrapTable('updateByUniqueId', {
id: row.id,
row: {
materialNoRmb : row.materialNoRmb,
materialRmb : row.materialNoRmb * (1 + $("#rmbTax").val()),
materialNoUsd : row.materialNoRmb / $("#rmbTax").val(),
materialNoUsdSum : row.materialNoRmb / $("#rmbTax").val(),
materialUsd : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()),
materialUsdSum : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()),
materialNoRmbSum : row.materialNum * row.materialNoRmb,
materialRmbSum : row.materialNum * row.materialRmb
}
});
}
else if(field =="materialNum" && row.materialNum != "" && commonCurrency =="2"){
$("#bootstrap-table-Quote-child").bootstrapTable('updateByUniqueId', {
id: row.id,
row: {
materialUsd : row.materialNoUsd,
materialUsdSum : row.materialNum * row.materialUsd,
materialNoUsdSum : row.materialNoUsd * row.materialNum,
materialNoRmb : $("#usdTax").val() * row.materialNoUsd,
materialRmb : $("#usdTax").val() * row.materialNoUsd * (1 + $("#rmbTax").val()),
materialNoRmbSum : row.materialNoRmb * row.materialNum,
materialRmbSum : row.materialRmb * row.materialNum
}
});
}
getTotalAmount()
}
</script>
</body>
</html>

11
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@ -336,4 +336,15 @@ public class RedisCache
String serialNum = String.format("%03d",no);
return codeKey+serialNum;
}
public String generateUUNo(String prefix) {
String codeKey = prefix;
Long no = 0L;
//获取每日流水
no = incr(codeKey, 1);
if (no == null) {
throw new RuntimeException("Redis单据编号流水递增失败");
}
String serialNum = String.format("%03d",no);
return codeKey+serialNum;
}
}

Loading…
Cancel
Save