svn commit: r564383 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r564383 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

sichen
Author: sichen
Date: Thu Aug  9 14:10:54 2007
New Revision: 564383

URL: http://svn.apache.org/viewvc?view=rev&rev=564383
Log:
Populate the ShipmentItemBilling entity when creating invoices from sales or purchase shipments

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?view=diff&rev=564383&r1=564382&r2=564383
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Thu Aug  9 14:10:54 2007
@@ -481,6 +481,19 @@
                         return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingOrderItemBillingFromOrder",locale), null, null, createOrderItemBillingResult);
                     }
 
+                    if ("ItemIssuance".equals(currentValue.getEntityName()) || "ShipmentReceipt".equals(currentValue.getEntityName())) {
+
+                        // create the ShipmentItemBilling record
+                        GenericValue shipmentItemBilling = delegator.makeValue("ShipmentItemBilling", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId));
+                        shipmentItemBilling.put("shipmentId", currentValue.get("shipmentId"));
+    
+                        // ShipmentReceipt has no shipmentItemSeqId field
+                        if ("ItemIssuance".equals(currentValue.getEntityName())) {
+                        shipmentItemBilling.put("shipmentItemSeqId", currentValue.get("shipmentItemSeqId"));
+                        }
+                        shipmentItemBilling.create();
+                    }
+
                     String parentInvoiceItemSeqId = invoiceItemSeqId;
                     // increment the counter
                     invoiceItemSeqNum++;