replace groovy file with new view and add orderitemSeqId to invoiceitemlist

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1512132 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2013-08-09 03:08:25 +00:00
parent afb70f3469
commit ff9107cb25
4 changed files with 23 additions and 63 deletions
@@ -1670,6 +1670,18 @@ under the License.
</view-link>
</view-entity>
<view-entity entity-name="InvItemAndOrdItem" package-name="org.ofbiz.accounting.invoice">
<member-entity entity-alias="INVITM" entity-name="InvoiceItem"/>
<member-entity entity-alias="ORDBIL" entity-name="OrderItemBilling"/>
<alias-all entity-alias="INVITM"/>
<alias name="orderId" entity-alias="ORDBIL"/>
<alias name="orderItemSeqId" entity-alias="ORDBIL"/>
<view-link entity-alias="INVITM" rel-entity-alias="ORDBIL" rel-optional="true">
<key-map field-name="invoiceId"/>
<key-map field-name="invoiceItemSeqId"/>
</view-link>
</view-entity>
<view-entity entity-name="InvoiceContentAndInfo"
package-name="org.ofbiz.accounting.invoice"
title="InvoiceContent Content and DataResource View Entity">
@@ -1,54 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.*;
import org.ofbiz.entity.*;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.util.EntityUtil;
import javolution.util.FastMap;
invoiceId = context.invoiceId;
if (!invoiceId) return;
List invoiceItems = [];
invoiceItemList = delegator.findByAnd("InvoiceItem", [invoiceId : invoiceId], ["invoiceItemSeqId"], false);
if (invoiceItemList) {
invoiceItemList.each { invoiceItem ->
invoiceItemSeqId = invoiceItem.invoiceItemSeqId;
invoiceId = invoiceItem.invoiceId;
orderItemBilling = EntityUtil.getFirst(delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId, invoiceItemSeqId : invoiceItemSeqId], null, false));
Map invoiceItemMap = FastMap.newInstance();
invoiceItemMap.putAll((Map) invoiceItem);
if (orderItemBilling) {
orderId = orderItemBilling.orderId;
invoiceItemMap.orderId = orderId;
} else {
orderAdjustmentBilling = EntityUtil.getFirst(delegator.findByAnd("OrderAdjustmentBilling", [invoiceId : invoiceId, invoiceItemSeqId : invoiceItemSeqId], null, false));
if (orderAdjustmentBilling) {
orderAdjustment = EntityUtil.getFirst(delegator.findByAnd("OrderAdjustment", [orderAdjustmentId : orderAdjustmentBilling.orderAdjustmentId], null, false))
if (orderAdjustment) {
orderId = orderAdjustment.orderId;
invoiceItemMap.orderId = orderId;
}
}
}
invoiceItems.add(invoiceItemMap);
}
context.invoiceItems = invoiceItems;
}
@@ -139,13 +139,11 @@ under the License.
<field name="currencyUomId"><hidden/></field>
</form>
<form name="invoiceItems" list-name="invoiceItems" target="" title="" type="list" separate-columns="true" paginate-target="invoiceOverview" odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<form name="invoiceItems" list-name="invItemAndOrdItems" target="" title="" type="list" separate-columns="true" paginate-target="invoiceOverview"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<row-actions>
<set field="total" value="${groovy:
import java.math.BigDecimal;
if(quantity==null) quantity = BigDecimal.ONE;
if(amount==null) amount = BigDecimal.ZERO;
return (quantity.multiply(amount));}"/>
<set field="quantity" value="${groovy: quantity==null?1:quantity}"/>
<set field="total" value="${quantity * amount}"/>
</row-actions>
<auto-fields-entity entity-name="InvoiceItem" default-field-type="display"/>
<field name="invoiceId"><hidden/></field>
@@ -156,6 +154,7 @@ under the License.
<parameter param-name="orderId"/>
</hyperlink>
</field>
<field name="orderItemSeqId" widget-area-style="align-text"><display/></field>
<field name="inventoryItemId" widget-area-style="align-text"><display/></field>
<field name="quantity" widget-area-style="align-text"><display/></field>
<field name="amount" title="${uiLabelMap.AccountingUnitPrice}" widget-area-style="align-text"><display type="currency" currency="${invoice.currencyUomId}"/></field>
@@ -208,7 +207,7 @@ under the License.
<field name="paymentApplicationId"><hidden/></field>
<field name="amountApplied" widget-area-style="align-text"><display type="currency" currency="${invoice.currencyUomId}"/></field>
</form>
<form name="AcctgTransAndEntries" type="list" title="Accounting Transactions" list-name="AcctgTransAndEntries"
<form name="AcctgTransAndEntries" type="list" title="Accounting Transactions" list-name="acctgTransAndEntries"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<auto-fields-entity entity-name="AcctgTransAndEntries" default-field-type="display"/>
<field name="invoiceId"><hidden/></field>
@@ -188,11 +188,14 @@ under the License.
<order-by field-name="invoiceItemSeqId"/>
</entity-and>
<script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/CreateApplicationList.groovy"/>
<script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy"/>
<set field="invoiceAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(invoice)}" type="BigDecimal"/>
<set field="notAppliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice)}" type="BigDecimal"/>
<set field="appliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceApplied(invoice)}" type="BigDecimal"/>
<entity-condition entity-name="AcctgTransAndEntries" list="AcctgTransAndEntries">
<entity-condition entity-name="InvItemAndOrdItem" list="invItemAndOrdItems">
<condition-expr field-name="invoiceId" operator="equals" from-field="invoiceId"/>
<order-by field-name="invoiceItemSeqId"/>
</entity-condition>
<entity-condition entity-name="AcctgTransAndEntries" list="acctgTransAndEntries">
<condition-expr field-name="invoiceId" operator="equals" from-field="invoiceId"/>
<order-by field-name="acctgTransId"/>
<order-by field-name="acctgTransEntrySeqId"/>