|
@@ -26,55 +26,6 @@ public class TravelTotalPlugin extends AbstractFormPlugin {
|
|
|
private static String entryentity="nckd_entryentity";
|
|
|
private static String invoiceandexpense="nckd_invoiceandexpense";
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
public void propertyChanged(PropertyChangedArgs e) {
|
|
|
String fieldKey = e.getProperty().getName();
|
|
|
|
|
@@ -83,6 +34,8 @@ public class TravelTotalPlugin extends AbstractFormPlugin {
|
|
|
DynamicObjectCollection nckd_entryentity=dynamicObject.getDynamicObjectCollection(entryentity);
|
|
|
|
|
|
Map<DynamicObject,BigDecimal> allMap=new HashMap<>();
|
|
|
+
|
|
|
+ Map<DynamicObject,BigDecimal> oriMap=new HashMap<>();
|
|
|
|
|
|
if (fieldKey.equals("nckd_amountfield4")) {
|
|
|
|
|
@@ -91,17 +44,24 @@ public class TravelTotalPlugin extends AbstractFormPlugin {
|
|
|
for (DynamicObject item:dynamicObjectCollection) {
|
|
|
for (DynamicObject entry:item.getDynamicObjectCollection("entryentity")) {
|
|
|
|
|
|
- DynamicObject expenseitem=entry.getDynamicObject("expenseitem");
|
|
|
+ DynamicObject expenseitem =entry.getDynamicObject("expenseitem");
|
|
|
|
|
|
BigDecimal orientryamount=entry.getBigDecimal("orientryamount");
|
|
|
+
|
|
|
+ BigDecimal orientryappamount=entry.getBigDecimal("orientryappamount");
|
|
|
|
|
|
if (!allMap.containsKey(expenseitem)) {
|
|
|
allMap.put(expenseitem,orientryamount);
|
|
|
+ oriMap.put(expenseitem,orientryappamount);
|
|
|
}else {
|
|
|
|
|
|
BigDecimal account = allMap.get(expenseitem);
|
|
|
account=account.add(orientryamount);
|
|
|
allMap.put(expenseitem,account);
|
|
|
+
|
|
|
+ BigDecimal oriaccount = oriMap.get(expenseitem);
|
|
|
+ oriaccount=oriaccount.add(orientryappamount);
|
|
|
+ oriMap.put(expenseitem,oriaccount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -115,7 +75,21 @@ public class TravelTotalPlugin extends AbstractFormPlugin {
|
|
|
int rowIndex = this.getModel().createNewEntryRow(entryentity);
|
|
|
this.getModel().setValue("nckd_travelitem",entry.getKey(),rowIndex);
|
|
|
this.getModel().setValue("nckd_oriamount",entry.getValue(),rowIndex);
|
|
|
- this.getModel().setValue("nckd_triamount",entry.getValue(),rowIndex);
|
|
|
+ }
|
|
|
+
|
|
|
+ DynamicObjectCollection dynamicObjects=dynamicObject.getDynamicObjectCollection(entryentity);
|
|
|
+ for (int i=0;i<dynamicObjects.size();i++)
|
|
|
+ {
|
|
|
+ DynamicObject item=dynamicObjects.get(i);
|
|
|
+ DynamicObject nckd_travelitem=item.getDynamicObject("nckd_travelitem");
|
|
|
+ Iterator<Map.Entry<DynamicObject, BigDecimal>> it = oriMap.entrySet().iterator();
|
|
|
+ while (it.hasNext()) {
|
|
|
+ Map.Entry<DynamicObject, BigDecimal> entry = it.next();
|
|
|
+
|
|
|
+ if (entry.getKey().equals(nckd_travelitem)) {
|
|
|
+ this.getModel().setValue("nckd_triamount",entry.getValue(),i);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.getView().updateView("nckd_entryentity");
|