多税率计算
This commit is contained in:
parent
e31f35e6ef
commit
7f2abe0009
|
@ -25,45 +25,53 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
super.propertyChanged(e);
|
super.propertyChanged(e);
|
||||||
String name = e.getProperty().getName();
|
String name = e.getProperty().getName();
|
||||||
ChangeData changeData = e.getChangeSet()[0];
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
if (name.equals("contracttype")){
|
if (name.equals("contracttype")) {
|
||||||
Object contracttype = this.getModel().getValue("contracttype");
|
Object contracttype = this.getModel().getValue("contracttype");
|
||||||
if (contracttype!=null){
|
if (contracttype != null) {
|
||||||
DynamicObject type = (DynamicObject) contracttype;
|
DynamicObject type = (DynamicObject) contracttype;
|
||||||
String number = type.getString("number");
|
String number = type.getString("number");
|
||||||
if (number.equals("sbzssr")){
|
if (number.equals("sbzssr")) {
|
||||||
this.getView().setVisible(true,"zcgj_equipment");
|
this.getView().setVisible(true, "zcgj_equipment");
|
||||||
this.getView().setVisible(false,"zcgj_administer");
|
this.getView().setVisible(false, "zcgj_administer");
|
||||||
} else if (number.equals("hfzl")) {
|
} else if (number.equals("hfzl")) {
|
||||||
this.getView().setVisible(true,"zcgj_administer");
|
this.getView().setVisible(true, "zcgj_administer");
|
||||||
this.getView().setVisible(false,"zcgj_equipment");
|
this.getView().setVisible(false, "zcgj_equipment");
|
||||||
}else {
|
} else {
|
||||||
this.getView().setVisible(false,"zcgj_administer");
|
this.getView().setVisible(false, "zcgj_administer");
|
||||||
this.getView().setVisible(false,"zcgj_equipment");
|
this.getView().setVisible(false, "zcgj_equipment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object taxrate = this.getModel().getValue("taxrate");
|
Object taxrate = this.getModel().getValue("taxrate");//税率
|
||||||
if (taxrate != null) {
|
BigDecimal avgtaxrate = (BigDecimal) this.getModel().getValue("avgtaxrate");//综合税率
|
||||||
DynamicObject taxrateInfo = (DynamicObject) taxrate;
|
boolean ismultirate = (boolean) this.getModel().getValue("ismultirate");//多税率
|
||||||
BigDecimal trate = taxrateInfo.getBigDecimal("taxrate");
|
BigDecimal pRate = new BigDecimal(0);
|
||||||
BigDecimal pRate = trate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
if (ismultirate) {
|
||||||
BigDecimal amount = new BigDecimal(0);
|
pRate = avgtaxrate;
|
||||||
BigDecimal ofamount = new BigDecimal(0);
|
} else {
|
||||||
BigDecimal rate = new BigDecimal(0);
|
if (taxrate != null) {
|
||||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
DynamicObject taxrateInfo = (DynamicObject) taxrate;
|
||||||
if (name.equals("zcgj_pjnhhshte")) {
|
BigDecimal trate = taxrateInfo.getBigDecimal("taxrate");
|
||||||
Object zcgjPjnhbhshte = this.getModel().getValue("zcgj_pjnhhshte");
|
pRate = trate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||||
if (zcgjPjnhbhshte != null) {
|
}
|
||||||
ofamount = new BigDecimal(zcgjPjnhbhshte.toString());
|
}
|
||||||
}
|
BigDecimal amount = new BigDecimal(0);
|
||||||
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
|
BigDecimal ofamount = new BigDecimal(0);
|
||||||
rate = ofamount.subtract(amount);
|
BigDecimal rate = new BigDecimal(0);
|
||||||
dataEntity.set("zcgj_pjnhbhshte", amount);
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
dataEntity.set("zcgj_pjnhse", rate);
|
if (name.equals("zcgj_pjnhhshte")) {
|
||||||
|
Object zcgjPjnhbhshte = this.getModel().getValue("zcgj_pjnhhshte");
|
||||||
|
if (zcgjPjnhbhshte != null) {
|
||||||
|
ofamount = new BigDecimal(zcgjPjnhbhshte.toString());
|
||||||
|
}
|
||||||
|
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
|
||||||
|
rate = ofamount.subtract(amount);
|
||||||
|
dataEntity.set("zcgj_pjnhbhshte", amount);
|
||||||
|
dataEntity.set("zcgj_pjnhse", rate);
|
||||||
// this.getModel().setValue("zcgj_pjnhbhshte", amount);
|
// this.getModel().setValue("zcgj_pjnhbhshte", amount);
|
||||||
// this.getModel().setValue("zcgj_pjnhse", rate);
|
// this.getModel().setValue("zcgj_pjnhse", rate);
|
||||||
this.getView().updateView();
|
this.getView().updateView();
|
||||||
} else if (name.equals("zcgj_pjnhbhshte")) {
|
} else if (name.equals("zcgj_pjnhbhshte")) {
|
||||||
// Object zcgjPjnhhshte = this.getModel().getValue("zcgj_pjnhbhshte");
|
// Object zcgjPjnhhshte = this.getModel().getValue("zcgj_pjnhbhshte");
|
||||||
// Object zcgjPjnhhshte = changeData.getNewValue();
|
// Object zcgjPjnhhshte = changeData.getNewValue();
|
||||||
// if (zcgjPjnhhshte != null) {
|
// if (zcgjPjnhhshte != null) {
|
||||||
|
@ -77,59 +85,59 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
// dataEntity.set("zcgj_pjnhhshte", ofamount);
|
// dataEntity.set("zcgj_pjnhhshte", ofamount);
|
||||||
// dataEntity.set("zcgj_pjnhse", rate);
|
// dataEntity.set("zcgj_pjnhse", rate);
|
||||||
// this.getView().updateView();
|
// this.getView().updateView();
|
||||||
}else if (name.equals("zcgj_yjhshtsr")) {
|
} else if (name.equals("zcgj_yjhshtsr")) {
|
||||||
Object zcgjyjhshtsr = this.getModel().getValue("zcgj_yjhshtsr");
|
Object zcgjyjhshtsr = this.getModel().getValue("zcgj_yjhshtsr");
|
||||||
if (zcgjyjhshtsr != null) {
|
if (zcgjyjhshtsr != null) {
|
||||||
ofamount = new BigDecimal(zcgjyjhshtsr.toString());
|
ofamount = new BigDecimal(zcgjyjhshtsr.toString());
|
||||||
}
|
}
|
||||||
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
|
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
|
||||||
rate = ofamount.subtract(amount);
|
rate = ofamount.subtract(amount);
|
||||||
// this.getModel().setValue("zcgj_yjbhshtsr", amount);
|
// this.getModel().setValue("zcgj_yjbhshtsr", amount);
|
||||||
// this.getModel().setValue("zcgj_yjzse", rate);
|
// this.getModel().setValue("zcgj_yjzse", rate);
|
||||||
dataEntity.set("zcgj_yjbhshtsr", amount);
|
dataEntity.set("zcgj_yjbhshtsr", amount);
|
||||||
dataEntity.set("zcgj_yjzse", rate);
|
dataEntity.set("zcgj_yjzse", rate);
|
||||||
this.getView().updateView();
|
this.getView().updateView();
|
||||||
} else if (name.equals("zcgj_yjbhshtsr")) {
|
} else if (name.equals("zcgj_yjbhshtsr")) {
|
||||||
Object zcgjyjbhshtsr = this.getModel().getValue("zcgj_yjbhshtsr");
|
Object zcgjyjbhshtsr = this.getModel().getValue("zcgj_yjbhshtsr");
|
||||||
if (zcgjyjbhshtsr != null) {
|
if (zcgjyjbhshtsr != null) {
|
||||||
amount = new BigDecimal(zcgjyjbhshtsr.toString());
|
amount = new BigDecimal(zcgjyjbhshtsr.toString());
|
||||||
}
|
}
|
||||||
ofamount = amount.multiply(pRate);
|
ofamount = amount.multiply(pRate);
|
||||||
rate = ofamount.subtract(amount);
|
rate = ofamount.subtract(amount);
|
||||||
// this.getModel().setValue("zcgj_yjhshtsr", ofamount);
|
// this.getModel().setValue("zcgj_yjhshtsr", ofamount);
|
||||||
// this.getModel().setValue("zcgj_yjzse", rate);
|
// this.getModel().setValue("zcgj_yjzse", rate);
|
||||||
dataEntity.set("zcgj_yjhshtsr", ofamount);
|
dataEntity.set("zcgj_yjhshtsr", ofamount);
|
||||||
dataEntity.set("zcgj_yjzse", rate);
|
dataEntity.set("zcgj_yjzse", rate);
|
||||||
this.getView().updateView();
|
this.getView().updateView();
|
||||||
}else if (name.equals("zcgj_hshtdj")) {
|
} else if (name.equals("zcgj_hshtdj")) {
|
||||||
Object zcgjhshtdj = this.getModel().getValue("zcgj_hshtdj");
|
Object zcgjhshtdj = this.getModel().getValue("zcgj_hshtdj");
|
||||||
if (zcgjhshtdj != null) {
|
if (zcgjhshtdj != null) {
|
||||||
ofamount = new BigDecimal(zcgjhshtdj.toString());
|
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);
|
dataEntity.set("zcgj_bhshtdj", amount);
|
||||||
// this.getModel().setValue("zcgj_bhshtdj", ofamount);
|
// this.getModel().setValue("zcgj_bhshtdj", ofamount);
|
||||||
this.getView().updateView();
|
this.getView().updateView();
|
||||||
}else if (name.equals("zcgj_bhshtdj")) {
|
} else if (name.equals("zcgj_bhshtdj")) {
|
||||||
Object zcgjbhshtdj = this.getModel().getValue("zcgj_bhshtdj");
|
Object zcgjbhshtdj = this.getModel().getValue("zcgj_bhshtdj");
|
||||||
if (zcgjbhshtdj != null) {
|
if (zcgjbhshtdj != null) {
|
||||||
amount = new BigDecimal(zcgjbhshtdj.toString());
|
amount = new BigDecimal(zcgjbhshtdj.toString());
|
||||||
}
|
}
|
||||||
ofamount = amount.multiply(pRate);
|
ofamount = amount.multiply(pRate);
|
||||||
dataEntity.set("zcgj_hshtdj", ofamount);
|
dataEntity.set("zcgj_hshtdj", ofamount);
|
||||||
// this.getModel().setValue("zcgj_hshtdj", ofamount);
|
// this.getModel().setValue("zcgj_hshtdj", ofamount);
|
||||||
this.getView().updateView();
|
this.getView().updateView();
|
||||||
} else if (name.equals("zcgj_bnyjhshte")) {
|
} else if (name.equals("zcgj_bnyjhshte")) {
|
||||||
Object zcgjbnyjbhshte = this.getModel().getValue("zcgj_bnyjhshte");
|
Object zcgjbnyjbhshte = this.getModel().getValue("zcgj_bnyjhshte");
|
||||||
if (zcgjbnyjbhshte != null) {
|
if (zcgjbnyjbhshte != null) {
|
||||||
ofamount = new BigDecimal(zcgjbnyjbhshte.toString());
|
ofamount = new BigDecimal(zcgjbnyjbhshte.toString());
|
||||||
}
|
}
|
||||||
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
|
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
|
||||||
rate = ofamount.subtract(amount);
|
rate = ofamount.subtract(amount);
|
||||||
dataEntity.set("zcgj_bnyjbhshte", amount);
|
dataEntity.set("zcgj_bnyjbhshte", amount);
|
||||||
dataEntity.set("zcgj_bnyjse", rate);
|
dataEntity.set("zcgj_bnyjse", rate);
|
||||||
this.getView().updateView();
|
this.getView().updateView();
|
||||||
} else if (name.equals("zcgj_bnyjbhshte")) {
|
} else if (name.equals("zcgj_bnyjbhshte")) {
|
||||||
// Object zcgjbnyjhshte = this.getModel().getValue("zcgj_bnyjbhshte");
|
// Object zcgjbnyjhshte = this.getModel().getValue("zcgj_bnyjbhshte");
|
||||||
// if (zcgjbnyjhshte != null) {
|
// if (zcgjbnyjhshte != null) {
|
||||||
// amount = new BigDecimal(zcgjbnyjhshte.toString());
|
// amount = new BigDecimal(zcgjbnyjhshte.toString());
|
||||||
|
@ -139,8 +147,7 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
// dataEntity.set("zcgj_bnyjhshte", ofamount);
|
// dataEntity.set("zcgj_bnyjhshte", ofamount);
|
||||||
// dataEntity.set("zcgj_bnyjse", rate);
|
// dataEntity.set("zcgj_bnyjse", rate);
|
||||||
// this.getView().updateView();
|
// this.getView().updateView();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue