[OFBiz] SVN: r6456 - in trunk/specialized/opentravelsystem: script/org/ofbiz/opentravelsystem servicedef webapp/hotelbackend/screens webapp/hotelbackend/script

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Sun Jan 1 20:43:44 CST 2006


Author: hansbak
Date: 2006-01-01 20:43:20 -0600 (Sun, 01 Jan 2006)
New Revision: 6456

Modified:
   trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml
   trunk/specialized/opentravelsystem/servicedef/services.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh
Log:
OTS: create new invoice,payment and partyId with company prefix

Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml	2005-12-31 18:32:02 UTC (rev 6455)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml	2006-01-02 02:43:20 UTC (rev 6456)
@@ -45,7 +45,13 @@
         <check-errors/>
 
         <!-- partygroup -->
+        <!-- create id using the invoice prefix -->
+        <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" auto-field-map="false">
+            <field-map field-name="partyId" env-name="parameters.organizationPartyId"/>
+        </entity-one>
         <set field="createPartyGroup.groupName" from-field="parameters.groupName"/>
+        <sequenced-id-to-env sequence-name="${partyAcctgPreference.invoiceIdPrefix}Party" env-name="nextPartyId"/>
+        <set field="createPartyGroup.partyId" value="${partyAcctgPreference.invoiceIdPrefix}${nextPartyId}"/>        
         <call-service service-name="createPartyGroup" in-map-name="createPartyGroup">
             <result-to-field result-name="partyId" field-name="partyId"/>
         </call-service>    

Modified: trunk/specialized/opentravelsystem/servicedef/services.xml
===================================================================
--- trunk/specialized/opentravelsystem/servicedef/services.xml	2005-12-31 18:32:02 UTC (rev 6455)
+++ trunk/specialized/opentravelsystem/servicedef/services.xml	2006-01-02 02:43:20 UTC (rev 6456)
@@ -240,11 +240,37 @@
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>
         <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/>
     </service>
-    <service name="otsRemoveUserLoginFromSecurityGroup" engine="simple" location="org/ofbiz/opentravelsystem/GeneralServices.xml" invoke="removeUserLoginFromSecurityGroup" auth="true">
+    <service name="otsRemoveUserLoginFromSecurityGroup" engine="simple" 
+        location="org/ofbiz/opentravelsystem/GeneralServices.xml" invoke="removeUserLoginFromSecurityGroup" auth="true">
         <description>Remove a UserLogin from a SecurityGroup</description>
         <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="userLoginId" type="String" mode="IN" optional="false"/>
         <attribute name="groupId" type="String" mode="IN" optional="false"/>
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>
     </service>
+    <service name="createPayment" engine="simple" default-entity-name="Payment"
+        location="org/ofbiz/opentravelsystem/PaymentServices.xml" invoke="createPayment" auth="true">
+        <description>Create a Payment</description>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="paymentTypeId" optional="false"/>
+        <override name="paymentMethodTypeId" optional="false"/>
+        <override name="partyIdFrom" optional="false"/>
+        <override name="partyIdTo" optional="false"/>
+        <override name="statusId" optional="false"/>
+        <override name="amount" optional="false"/>
+    </service>
+    <service name="createPaymentOfbiz" engine="simple" default-entity-name="Payment"
+        location="org/ofbiz/accounting/payment/PaymentServicesExt.xml" invoke="createPayment" auth="true">
+        <description>Create a Payment</description>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="INOUT" optional="false"/>
+        <override name="paymentTypeId" optional="false"/>
+        <override name="paymentMethodTypeId" optional="false"/>
+        <override name="partyIdFrom" optional="false"/>
+        <override name="partyIdTo" optional="false"/>
+        <override name="statusId" optional="false"/>
+        <override name="amount" optional="false"/>
+    </service>
+    
 </services>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml	2005-12-31 18:32:02 UTC (rev 6455)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml	2006-01-02 02:43:20 UTC (rev 6456)
@@ -75,7 +75,7 @@
             <script location="component://opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh"/>
         </actions>
         <field name="company" widget-style="buttontext" >
-            <hyperlink description="${company}" target="editParty?partyId=${company}" target-window="new"/>
+            <hyperlink description="${company}" target="partyFinancialHistory?partyId=${company}" target-window="new"/>
         </field>
         <field name="name"><display/></field>
         <field name="revenue" widget-area-style="tabletextright"><display/></field>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh	2005-12-31 18:32:02 UTC (rev 6455)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh	2006-01-02 02:43:20 UTC (rev 6456)
@@ -19,7 +19,7 @@
  *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
  *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
- *@author     Andy Zeneski (jaz at ofbiz.org)
+ *@author     Hans Bakker (h.bakker at antwebsystems.com)
  *@version    $Rev: 5462 $
  *@since      3.0
  */
@@ -79,11 +79,15 @@
 		invoice = inv.next();
 		if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) continue;
 		BigDecimal invoiceAmount = InvoiceWorker.getInvoiceTotalBd(invoice).setScale(2,BigDecimal.ROUND_HALF_UP);
-		if (invoice.getString("partyId").equals(organizationPartyId))	invoiceAmount = invoiceAmount.multiply(new BigDecimal("-1"));
-		if (invoice.getString("invoiceTypeId").equals("PURCHASE_INVOICE")) totalPuchaseInvoice = totalPurchaseInvoice.add(invoiceAmount);
+		invoiceApplied = InvoiceExtWorker.getInvoiceAppliedBd(invoice).setScale(2,BigDecimal.ROUND_HALF_UP);
+/*		if (invoice.getString("partyId").equals(organizationPartyId)) { //negate for outgoing payments
+			invoiceAmount = invoiceAmount.multiply(new BigDecimal("-1"));
+			invoiceApplied = invoiceApplied.multiply(new BigDecimal("-1"));
+		}
+*/		if (invoice.getString("invoiceTypeId").equals("PURCHASE_INVOICE")) totalPurchaseInvoice = totalPurchaseInvoice.add(invoiceAmount);
 		if (invoice.getString("invoiceTypeId").equals("SALES_INVOICE")) totalSalesInvoice = totalSalesInvoice.add(invoiceAmount);
-		invoiceApplied = InvoiceExtWorker.getInvoiceAppliedBd(invoice).setScale(2,BigDecimal.ROUND_HALF_UP);
 		totalInvoiceApplied = totalInvoiceApplied.add(invoiceApplied);
+//		Debug.logInfo("Invoice type: "+ invoice.getString("invoiceTypeId") + "amount: " + invoiceAmount + " applied: " + invoiceApplied,"??");
 		if (!invoiceAmount.equals(invoiceApplied))	{
 			Map notAppliedInvoice = UtilMisc.toMap(
 				"invoiceId",invoice.getString("invoiceId"),
@@ -134,7 +138,7 @@
 					historyItem.put("paymentId", oldPaymentId);
 					payment = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",oldPaymentId));
 					BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
-					if (payment.getString("partyIdFrom").equals(organizationPartyId)) amount = amount.multiply(new BigDecimal("-1"));
+//					if (payment.getString("partyIdFrom").equals(organizationPartyId)) amount = amount.multiply(new BigDecimal("-1"));
 					historyItem.put("amount",amount.toString());
 					historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
 					historyList.add(historyItem);
@@ -150,7 +154,7 @@
 				historyItem.put("paymentId", oldPaymentId);
 				payment = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",oldPaymentId));
 					BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
-					if (payment.getString("partyIdFrom").equals(organizationPartyId))	amount = amount.multiply(new BigDecimal("-1"));
+//					if (payment.getString("partyIdFrom").equals(organizationPartyId))	amount = amount.multiply(new BigDecimal("-1"));
 					historyItem.put("amount",amount.toString());
 				historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
 				historyList.add(historyItem);
@@ -173,7 +177,7 @@
 		if (applications == null || applications.size() == 0 ) continue; // none found				
 		Map historyItem = UtilMisc.toMap("paymentId",payment.getString("paymentId"),"effectiveDate",payment.getString("effectiveDate").substring(0,10));
 		BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
-		if (payment.getString("partyIdFrom").equals(organizationPartyId)) amount = amount.multiply(new BigDecimal("-1"));
+//		if (payment.getString("partyIdFrom").equals(organizationPartyId)) amount = amount.multiply(new BigDecimal("-1"));
 		historyItem.put("amount",amount.toString());
 		ap = applications.iterator();
 		while (ap.hasNext())	{
@@ -183,7 +187,7 @@
 			toPayment = application.getRelatedOne("Payment");
 			historyItem.put("toEffectiveDate",toPayment.getString("effectiveDate").substring(0,10));
 			toAmount = toPayment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
-			if (toPayment.getString("partyIdFrom").equals(organizationPartyId)) toAmount = toAmount.multiply(new BigDecimal("-1"));
+//			if (toPayment.getString("partyIdFrom").equals(organizationPartyId)) toAmount = toAmount.multiply(new BigDecimal("-1"));
 			historyItem.put("toAmount",toAmount.toString());
 			historyList.add(historyItem);
 			
@@ -237,11 +241,11 @@
 		notApplied = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
 		paymentDb = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",payment.getString("paymentId")));
 		BigDecimal amount = paymentDb.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
-		if (payment.getString("partyIdFrom").equals(organizationPartyId)) {
+/*		if (payment.getString("partyIdFrom").equals(organizationPartyId)) {
 			 amount = amount.multiply(new BigDecimal("-1"));
 			 notApplied = notApplied.multiply(new BigDecimal("-1"));
 		}
-		totalPaymentNotApplied = totalPaymentNotApplied.add(notApplied);
+*/		totalPaymentNotApplied = totalPaymentNotApplied.add(notApplied);
 		historyItem.put("amount",amount.toString());
 		historyItem.put("notApplied",notApplied.toString());
 		historyItem.put("effectiveDate",paymentDb.getString("effectiveDate").substring(0,10));



More information about the Svn mailing list