多税率计算

This commit is contained in:
xiaoshi 2025-07-18 14:58:37 +08:00
parent e31f35e6ef
commit 7f2abe0009
1 changed files with 86 additions and 79 deletions

View File

@ -25,28 +25,36 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
super.propertyChanged(e);
String name = e.getProperty().getName();
ChangeData changeData = e.getChangeSet()[0];
if (name.equals("contracttype")){
if (name.equals("contracttype")) {
Object contracttype = this.getModel().getValue("contracttype");
if (contracttype!=null){
if (contracttype != null) {
DynamicObject type = (DynamicObject) contracttype;
String number = type.getString("number");
if (number.equals("sbzssr")){
this.getView().setVisible(true,"zcgj_equipment");
this.getView().setVisible(false,"zcgj_administer");
if (number.equals("sbzssr")) {
this.getView().setVisible(true, "zcgj_equipment");
this.getView().setVisible(false, "zcgj_administer");
} else if (number.equals("hfzl")) {
this.getView().setVisible(true,"zcgj_administer");
this.getView().setVisible(false,"zcgj_equipment");
}else {
this.getView().setVisible(false,"zcgj_administer");
this.getView().setVisible(false,"zcgj_equipment");
this.getView().setVisible(true, "zcgj_administer");
this.getView().setVisible(false, "zcgj_equipment");
} else {
this.getView().setVisible(false, "zcgj_administer");
this.getView().setVisible(false, "zcgj_equipment");
}
}
}
Object taxrate = this.getModel().getValue("taxrate");
Object taxrate = this.getModel().getValue("taxrate");//税率
BigDecimal avgtaxrate = (BigDecimal) this.getModel().getValue("avgtaxrate");//综合税率
boolean ismultirate = (boolean) this.getModel().getValue("ismultirate");//多税率
BigDecimal pRate = new BigDecimal(0);
if (ismultirate) {
pRate = avgtaxrate;
} else {
if (taxrate != null) {
DynamicObject taxrateInfo = (DynamicObject) taxrate;
BigDecimal trate = taxrateInfo.getBigDecimal("taxrate");
BigDecimal pRate = trate.divide(new BigDecimal(100)).add(new BigDecimal(1));
pRate = trate.divide(new BigDecimal(100)).add(new BigDecimal(1));
}
}
BigDecimal amount = new BigDecimal(0);
BigDecimal ofamount = new BigDecimal(0);
BigDecimal rate = new BigDecimal(0);
@ -77,7 +85,7 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
// dataEntity.set("zcgj_pjnhhshte", ofamount);
// dataEntity.set("zcgj_pjnhse", rate);
// this.getView().updateView();
}else if (name.equals("zcgj_yjhshtsr")) {
} else if (name.equals("zcgj_yjhshtsr")) {
Object zcgjyjhshtsr = this.getModel().getValue("zcgj_yjhshtsr");
if (zcgjyjhshtsr != null) {
ofamount = new BigDecimal(zcgjyjhshtsr.toString());
@ -101,16 +109,16 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
dataEntity.set("zcgj_yjhshtsr", ofamount);
dataEntity.set("zcgj_yjzse", rate);
this.getView().updateView();
}else if (name.equals("zcgj_hshtdj")) {
} else if (name.equals("zcgj_hshtdj")) {
Object zcgjhshtdj = this.getModel().getValue("zcgj_hshtdj");
if (zcgjhshtdj != null) {
ofamount = new BigDecimal(zcgjhshtdj.toString());
}
amount = ofamount.divide(pRate,6, BigDecimal.ROUND_HALF_UP);
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
dataEntity.set("zcgj_bhshtdj", amount);
// this.getModel().setValue("zcgj_bhshtdj", ofamount);
this.getView().updateView();
}else if (name.equals("zcgj_bhshtdj")) {
} else if (name.equals("zcgj_bhshtdj")) {
Object zcgjbhshtdj = this.getModel().getValue("zcgj_bhshtdj");
if (zcgjbhshtdj != null) {
amount = new BigDecimal(zcgjbhshtdj.toString());
@ -142,5 +150,4 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
}
}
}
}