销售发票本币汇率计算调整

This commit is contained in:
mzr 2025-03-11 09:17:15 +08:00
parent c5f34f9f24
commit ff835002e9
1 changed files with 19 additions and 18 deletions

View File

@ -278,6 +278,13 @@ public class saveCommitAction extends AbstractNCCRestResource {
// // 主含税净价 = 含税单价原始 // // 主含税净价 = 含税单价原始
// BigDecimal norigtaxnetprice = norigtaxprice; // BigDecimal norigtaxnetprice = norigtaxprice;
// 从销售订单中获取币种
String currencycode = getString_TrimAsNull(value2.get("currencycode"));
otherJson.put("corigcurrencyid", currencycode.isEmpty() ? "CNY" : currencycode);
// 从销售订单中获取折本汇率
BigDecimal nexchangerate = getUFDouble_NullAsZero(value2.get("nexchangerate")).toBigDecimal();
otherJson.put("nexchangerate", nexchangerate);
// 输入参数从你的 item 获取各个字段 // 输入参数从你的 item 获取各个字段
BigDecimal nastnum = new BigDecimal(item.getString("nastnum")); // 数量 BigDecimal nastnum = new BigDecimal(item.getString("nastnum")); // 数量
nastnum = nastnum.setScale(4, RoundingMode.HALF_UP); nastnum = nastnum.setScale(4, RoundingMode.HALF_UP);
@ -309,26 +316,20 @@ public class saveCommitAction extends AbstractNCCRestResource {
// 主无税净价即不含税单价 // 主无税净价即不含税单价
BigDecimal norignetprice = nqtorigprice; BigDecimal norignetprice = nqtorigprice;
// 从销售订单中获取币种 // 本币(人民币)需要处理汇率金额保留两位小数单价保留4位小数
String corigcurrencyid = getString_TrimAsNull(value2.get("corigcurrencyid")); // 本币无税金额
otherJson.put("corigcurrencyid", "".equals(corigcurrencyid) ? "CNY" : corigcurrencyid); BigDecimal nmny = norigmny.multiply(nexchangerate).setScale(2, RoundingMode.HALF_UP);
// 从销售订单中获取折本汇率 // 主本币无税净价
BigDecimal nexchangerate = getUFDouble_NullAsZero(value2.get("nexchangerate")).toBigDecimal(); BigDecimal nnetprice = norignetprice.multiply(nexchangerate).setScale(4, RoundingMode.HALF_UP);
otherJson.put("nexchangerate", nexchangerate); // 本币价税合计 价税合计*汇率
// 单价和金额*汇率 BigDecimal ntaxmny = norigtaxmny.multiply(nexchangerate).setScale(2, RoundingMode.HALF_UP);
nqtorigprice = nqtorigprice.multiply(nexchangerate); // 税额
norigmny = norigmny.multiply(nexchangerate); ntax = ntaxmny.subtract(nmny).setScale(2, RoundingMode.HALF_UP);
norigtaxmny = norigtaxmny.multiply(nexchangerate);
norigtaxprice = norigtaxprice.multiply(nexchangerate);
norignetprice = norignetprice.multiply(nexchangerate);
nqtorigtaxprice = nqtorigtaxprice.multiply(nexchangerate);
norigtaxnetprice = norigtaxnetprice.multiply(nexchangerate);
itemDetails.put("nqtorigprice", nqtorigprice);//无税单价 itemDetails.put("nqtorigprice", nqtorigprice);//无税单价
itemDetails.put("norigprice", nqtorigprice);//主无税单价 itemDetails.put("norigprice", nqtorigprice);//主无税单价
itemDetails.put("norigmny", norigmny);//无税金额 itemDetails.put("norigmny", norigmny);//无税金额
itemDetails.put("nmny", norigmny);//本币无税金额 itemDetails.put("nmny", nmny);//本币无税金额
itemDetails.put("norigtaxmny", norigtaxmny);//价税合计 itemDetails.put("norigtaxmny", norigtaxmny);//价税合计
itemDetails.put("norigtaxprice", norigtaxprice);//主含税单价 itemDetails.put("norigtaxprice", norigtaxprice);//主含税单价
itemDetails.put("norignetprice", norignetprice);//主无税净价 itemDetails.put("norignetprice", norignetprice);//主无税净价
@ -336,8 +337,8 @@ public class saveCommitAction extends AbstractNCCRestResource {
itemDetails.put("ntax", ntax);//税额 itemDetails.put("ntax", ntax);//税额
itemDetails.put("ncaltaxmny", ncaltaxmny);//计税金额 itemDetails.put("ncaltaxmny", ncaltaxmny);//计税金额
itemDetails.put("norigtaxnetprice", norigtaxnetprice);//主含税净价 itemDetails.put("norigtaxnetprice", norigtaxnetprice);//主含税净价
itemDetails.put("nnetprice", norignetprice);//主本币无税净价 itemDetails.put("nnetprice", nnetprice);//主本币无税净价
itemDetails.put("ntaxmny", norigtaxmny);//本币价税合计 itemDetails.put("ntaxmny", ntaxmny);//本币价税合计
csaleinvoicebid.add(itemDetails); csaleinvoicebid.add(itemDetails);