|
@@ -1,11 +1,8 @@
|
|
package fi.er.opplugin;
|
|
package fi.er.opplugin;
|
|
|
|
|
|
import com.alibaba.druid.util.StringUtils;
|
|
import com.alibaba.druid.util.StringUtils;
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
-import com.grapecity.documents.excel.B;
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
-import kd.bos.dataentity.serialization.SerializationUtils;
|
|
|
|
import kd.bos.entity.datamodel.events.ChangeData;
|
|
import kd.bos.entity.datamodel.events.ChangeData;
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
import kd.bos.form.field.RefBillEdit;
|
|
import kd.bos.form.field.RefBillEdit;
|
|
@@ -16,8 +13,6 @@ import kd.bos.list.ListShowParameter;
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
-import scala.Int;
|
|
|
|
-
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -209,29 +204,32 @@ public class FinapbillBeforeF7SelectSample extends AbstractFormPlugin implements
|
|
//刷新资产信息分录
|
|
//刷新资产信息分录
|
|
this.getView().updateView("assetentry");
|
|
this.getView().updateView("assetentry");
|
|
} else if (StringUtils.equals("expenseamount", fieldKey) || StringUtils.equals("nckd_amountfield3", fieldKey)) {
|
|
} else if (StringUtils.equals("expenseamount", fieldKey) || StringUtils.equals("nckd_amountfield3", fieldKey)) {
|
|
- ChangeData changeData = e.getChangeSet()[0];
|
|
|
|
- BigDecimal expenseamount = (BigDecimal) changeData.getNewValue();
|
|
|
|
- this.getModel().setValue("nckd_amountfield3", expenseamount);//含税单价
|
|
|
|
|
|
+ String reimbursetype = (String) this.getModel().getValue("reimbursetype");
|
|
|
|
+ if("asset".equals(reimbursetype)) {
|
|
|
|
+ ChangeData changeData = e.getChangeSet()[0];
|
|
|
|
+ BigDecimal expenseamount = (BigDecimal) changeData.getNewValue();
|
|
|
|
+ this.getModel().setValue("nckd_amountfield3", expenseamount);//含税单价
|
|
|
|
|
|
- //含税金额 = 含税单价*数量
|
|
|
|
- BigDecimal asset_quantity = (BigDecimal) this.getModel().getValue("asset_quantity");
|
|
|
|
- BigDecimal assetexpenseamount = expenseamount.multiply(asset_quantity);
|
|
|
|
- this.getModel().setValue("assetexpenseamount", assetexpenseamount);
|
|
|
|
|
|
+ //含税金额 = 含税单价*数量
|
|
|
|
+ BigDecimal asset_quantity = (BigDecimal) this.getModel().getValue("asset_quantity");
|
|
|
|
+ BigDecimal assetexpenseamount = expenseamount.multiply(asset_quantity);
|
|
|
|
+ this.getModel().setValue("assetexpenseamount", assetexpenseamount);
|
|
|
|
|
|
- //不含税单价 = 含税单价/(1+税率)
|
|
|
|
- BigDecimal assettaxrate = (BigDecimal) this.getModel().getValue("assettaxrate");
|
|
|
|
- assettaxrate = assettaxrate.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
|
|
|
- BigDecimal rate = assettaxrate.add(BigDecimal.ONE);
|
|
|
|
- BigDecimal assetpricewithouttax = expenseamount.divide(rate, 2 , RoundingMode.HALF_UP);
|
|
|
|
- this.getModel().setValue("assetpricewithouttax", assetpricewithouttax);
|
|
|
|
|
|
+ //不含税单价 = 含税单价/(1+税率)
|
|
|
|
+ BigDecimal assettaxrate = (BigDecimal) this.getModel().getValue("assettaxrate");
|
|
|
|
+ assettaxrate = assettaxrate.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
|
|
|
+ BigDecimal rate = assettaxrate.add(BigDecimal.ONE);
|
|
|
|
+ BigDecimal assetpricewithouttax = expenseamount.divide(rate, 2 , RoundingMode.HALF_UP);
|
|
|
|
+ this.getModel().setValue("assetpricewithouttax", assetpricewithouttax);
|
|
|
|
|
|
- //不含税金额 = 不含税单价*数量
|
|
|
|
- BigDecimal assetorientryamount = assetpricewithouttax.multiply(asset_quantity);
|
|
|
|
- this.getModel().setValue("assetorientryamount", assetorientryamount);
|
|
|
|
|
|
+ //不含税金额 = 不含税单价*数量
|
|
|
|
+ BigDecimal assetorientryamount = assetpricewithouttax.multiply(asset_quantity);
|
|
|
|
+ this.getModel().setValue("assetorientryamount", assetorientryamount);
|
|
|
|
|
|
- //税额 = 含税金额-不含税金额
|
|
|
|
- BigDecimal assettaxamount = assetexpenseamount.subtract(assetorientryamount);
|
|
|
|
- this.getModel().setValue("assettaxamount", assettaxamount);
|
|
|
|
|
|
+ //税额 = 含税金额-不含税金额
|
|
|
|
+ BigDecimal assettaxamount = assetexpenseamount.subtract(assetorientryamount);
|
|
|
|
+ this.getModel().setValue("assettaxamount", assettaxamount);
|
|
|
|
+ }
|
|
} else if (StringUtils.equals("taxrate", fieldKey) || StringUtils.equals("assettaxrate", fieldKey)) {
|
|
} else if (StringUtils.equals("taxrate", fieldKey) || StringUtils.equals("assettaxrate", fieldKey)) {
|
|
ChangeData changeData = e.getChangeSet()[0];
|
|
ChangeData changeData = e.getChangeSet()[0];
|
|
BigDecimal assettaxrate = (BigDecimal) changeData.getNewValue();
|
|
BigDecimal assettaxrate = (BigDecimal) changeData.getNewValue();
|
|
@@ -263,6 +261,7 @@ public class FinapbillBeforeF7SelectSample extends AbstractFormPlugin implements
|
|
public void afterCreateNewData(EventObject e) {
|
|
public void afterCreateNewData(EventObject e) {
|
|
//报账类型
|
|
//报账类型
|
|
String reimbursetype = (String) this.getModel().getValue("reimbursetype");
|
|
String reimbursetype = (String) this.getModel().getValue("reimbursetype");
|
|
|
|
+ int rowIndex = this.getModel().createNewEntryRow("assetentry");
|
|
if("asset".equals(reimbursetype)){
|
|
if("asset".equals(reimbursetype)){
|
|
//获取费用明细分录
|
|
//获取费用明细分录
|
|
DynamicObjectCollection assetentry = this.getModel().getEntryEntity("expenseentryentity");
|
|
DynamicObjectCollection assetentry = this.getModel().getEntryEntity("expenseentryentity");
|
|
@@ -271,7 +270,6 @@ public class FinapbillBeforeF7SelectSample extends AbstractFormPlugin implements
|
|
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load("er_expenseitemedit","id",new QFilter[] {filter});
|
|
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load("er_expenseitemedit","id",new QFilter[] {filter});
|
|
DynamicObject info = BusinessDataServiceHelper.loadSingle(dynamicObjects[0].getPkValue(), dynamicObjects[0].getDynamicObjectType().getName());
|
|
DynamicObject info = BusinessDataServiceHelper.loadSingle(dynamicObjects[0].getPkValue(), dynamicObjects[0].getDynamicObjectType().getName());
|
|
this.getModel().setValue("expenseitem", info, 0);
|
|
this.getModel().setValue("expenseitem", info, 0);
|
|
- int rowIndex = this.getModel().createNewEntryRow("assetentry");
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|