自动汇总汇率

This commit is contained in:
“wyx12345678” 2024-06-14 15:54:30 +08:00
parent 2eeec3ee90
commit f1831e3b13
1 changed files with 16 additions and 0 deletions

View File

@ -1,12 +1,14 @@
package shkd.fi.er.plugin.formplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.IDataEntityProperty;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import java.math.BigDecimal;
import java.util.EventObject;
/**
@ -54,6 +56,20 @@ public class ContractbillFromPlugin extends AbstractFormPlugin {
case "contractparty" :
DynamicObject newValue = (DynamicObject)changeData.getNewValue();
this.getModel().setValue("costcompany",newValue);
case "orientryamount":
DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity");
BigDecimal orientryamounttotal = BigDecimal.ZERO;
BigDecimal taxamounttotal = BigDecimal.ZERO;
for(int i = 0;i<expenseentryentity.size();i++){
DynamicObject dynamicObject = expenseentryentity.get(i);
BigDecimal orientryamount = dynamicObject.getBigDecimal("orientryamount");
BigDecimal taxamount = dynamicObject.getBigDecimal("taxamount");
orientryamounttotal = orientryamounttotal.add(orientryamount);
taxamounttotal = taxamounttotal.add(taxamount);
}
BigDecimal divide = orientryamounttotal.divide(taxamounttotal, 2, 4); //计算税率
this.getModel().setValue("taxrate",divide);
}
}
}