svn commit: r696941 - in /ofbiz/trunk/applications/party: config/ webapp/partymgr/WEB-INF/ webapp/partymgr/WEB-INF/actions/party/ webapp/partymgr/party/ widget/partymgr/

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

svn commit: r696941 - in /ofbiz/trunk/applications/party: config/ webapp/partymgr/WEB-INF/ webapp/partymgr/WEB-INF/actions/party/ webapp/partymgr/party/ widget/partymgr/

hansbak-2
Author: hansbak
Date: Thu Sep 18 23:43:34 2008
New Revision: 696941

URL: http://svn.apache.org/viewvc?rev=696941&view=rev
Log:
first version of a function copied from sharedofbiz: financial history of a party, groovy file to be enhanced later

Added:
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy   (with props)
Modified:
    ofbiz/trunk/applications/party/config/PartyUiLabels.xml
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml
    ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml
    ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml

Modified: ofbiz/trunk/applications/party/config/PartyUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/config/PartyUiLabels.xml?rev=696941&r1=696940&r2=696941&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/config/PartyUiLabels.xml (original)
+++ ofbiz/trunk/applications/party/config/PartyUiLabels.xml Thu Sep 18 23:43:34 2008
@@ -196,6 +196,9 @@
         <value xml:lang="de">E-Mail von unbekanntem Akteur</value>
         <value xml:lang="en">Email from unknown parties</value>
         <value xml:lang="fr">Courriel depuis un acteur inconnu</value>
+    </property>
+    <property key="FinancialHistory">
+        <value xml:lang="en">Fin.History</value>
     </property>    
     <property key="FormFieldTitle_attrName">
         <value xml:lang="de">Attribut Name</value>

Added: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy?rev=696941&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy (added)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy Thu Sep 18 23:43:34 2008
@@ -0,0 +1,312 @@
+/*
+ *  Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included
+ *  in all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+ *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *@author     Hans Bakker ([hidden email])
+ *@version    $Rev$
+ *@since      3.0
+ */
+
+import java.util.*;
+import java.math.*;
+import java.sql.Timestamp;
+import org.ofbiz.base.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.securityext.login.*;
+import org.ofbiz.common.*;
+import org.ofbiz.webapp.control.*;
+import org.ofbiz.accounting.invoice.*;
+import org.ofbiz.accounting.payment.*;
+
+delegator = parameters.get("delegator");
+organizationPartyId = parameters.get("organizationPartyId");
+partyId = parameters.get("partyId");
+if (partyId == null && organizationPartyId == null) return;
+List historyList = new LinkedList();
+
+//get payment totals
+BigDecimal totalPaymentsIn = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+BigDecimal totalPaymentsOut = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+tpayments = delegator.findByOr("Payment",[partyIdTo:partyId,partyIdFrom:partyId]);
+Iterator pl = tpayments.iterator();
+while (pl.hasNext()) {
+ payment = pl.next();
+ if (payment.getString("statusId").equals("PMNT_CANCELLED")) continue;
+ if (payment.getString("partyIdTo").equals(organizationPartyId))
+ totalPaymentsIn = totalPaymentsIn.add(payment.getBigDecimal("amount")).setScale(2,BigDecimal.ROUND_HALF_UP);
+ else
+ totalPaymentsOut = totalPaymentsOut.add(payment.getBigDecimal("amount")).setScale(2,BigDecimal.ROUND_HALF_UP);
+}
+
+// totals
+BigDecimal totalSalesInvoice = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+BigDecimal totalPurchaseInvoice = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+BigDecimal totalInvoiceApplied = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+BigDecimal totalInvoiceNotApplied = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+
+// payment and invoices list which will be updated with the amount applied
+// to see what is left over...
+List invoices = delegator.findByOr("Invoice",
+ UtilMisc.toMap("partyId",partyId,"partyIdFrom",partyId),
+ UtilMisc.toList("invoiceDate"));
+List payments = delegator.findByOr("Payment",
+ UtilMisc.toMap("partyIdTo",partyId,"partyIdFrom",partyId),
+ UtilMisc.toList("effectiveDate"));
+
+List notAppliedInvoices = new LinkedList(); // to store the not fully applied invoices
+
+// start reeading from the invoices list
+if (invoices != null && invoices.size() > 0) {
+ Iterator inv = invoices.iterator();
+ while (inv.hasNext()) {
+ invoice = inv.next();
+ if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) continue;
+ BigDecimal invoiceAmount = InvoiceWorker.getInvoiceTotalBd(invoice).setScale(2,BigDecimal.ROUND_HALF_UP);
+ invoiceApplied = InvoiceWorker.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);
+ 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"),
+ "invoiceTypeId", invoice.getString("invoiceTypeId").substring(0,1),
+ "invoiceDate", invoice.getString("invoiceDate").substring(0,10),
+ "invoiceAmount", invoiceAmount.toString(),
+ "invoiceNotApplied", invoiceAmount.subtract(invoiceApplied).toString());
+ notAppliedInvoices.add(notAppliedInvoice);
+ totalInvoiceNotApplied = totalInvoiceNotApplied.add(invoiceAmount).subtract(invoiceApplied);
+ }
+ Map historyItem = UtilMisc.toMap(
+ "invoiceId",invoice.getString("invoiceId"),
+ "invoiceTypeId", invoice.getString("invoiceTypeId").substring(0,1),
+ "invoiceDate", invoice.getString("invoiceDate").substring(0,10),
+ "invoiceAmount", invoiceAmount.toString(),
+ "totInvoiceApplied", invoiceApplied.toString()
+ );
+
+ // check for applications
+ List applications = invoice.getRelated("PaymentApplication",null,UtilMisc.toList("paymentId"));
+ if (applications != null && applications.size() > 0) {
+ Iterator appl = applications.iterator();
+ oldPaymentId = new String(" ");
+ BigDecimal applied = new BigDecimal("0");
+ boolean first = true;
+ while (appl.hasNext()) { // read the applications for this invoice
+ application = appl.next();
+ paymentId = application.getString("paymentId");
+
+ //reduce the payment amount in the payment list
+ pl = payments.iterator();
+ while (pl.hasNext()) {
+ payment = pl.next();
+ if (paymentId.equals(payment.getString("paymentId"))) {
+ plInd = payments.indexOf(payment);
+ payment.put("amount",
+ payment.getBigDecimal("amount").
+ subtract(application.getBigDecimal("amountApplied")).doubleValue());
+ payments.remove(plInd);
+ payments.add(plInd,payment);
+ break;
+ }
+ }
+
+ // check if the payment number has changed, then we have to output a line....
+ if (!first && !paymentId.equals(oldPaymentId)) { // if the payment number has changed, but not the first
+ historyItem.put("applied", applied.toString());
+ 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"));
+ historyItem.put("amount",amount.toString());
+ historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
+ historyList.add(historyItem);
+ historyItem = new HashMap();
+ applied = new BigDecimal("0");
+ }
+ applied = applied.add(application.getBigDecimal("amountApplied")).setScale(2,BigDecimal.ROUND_HALF_UP);
+ oldPaymentId = paymentId;
+ first = false;
+ }
+ if (!applied.equals("0")) {
+ historyItem.put("applied", applied.toString());
+ historyItem.put("paymentId", oldPaymentId);
+ payment = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",oldPaymentId));
+ if (payment != null) {
+ BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
+// 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);
+ }
+ }
+ }
+ }
+ context.put("historyListInvoices",historyList);
+}
+
+// totals
+BigDecimal totalPaymentApplied = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+// list of payments where payments are applied
+historyList = new LinkedList();
+if (payments != null && payments.size() > 0) {
+ pay = payments.iterator();
+ while (pay.hasNext()) {
+ payment = pay.next();
+ if (payment.getString("statusId").equals("PMNT_CANCELLED")) continue;
+ List applications = payment.getRelated("ToPaymentApplication",null,UtilMisc.toList("paymentId"));
+ 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"));
+ historyItem.put("amount",amount.toString());
+ ap = applications.iterator();
+ while (ap.hasNext()) {
+ GenericValue application = ap.next();
+ historyItem.put("toPaymentId",application.getString("paymentId"));
+ historyItem.put("applied",application.getString("amountApplied"));
+ 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"));
+ historyItem.put("toAmount",toAmount.toString());
+ historyList.add(historyItem);
+
+ //reduce the payment amount in the payment list
+ pl = payments.iterator();
+ while (pl.hasNext()) {
+ payment = pl.next();
+ // reduce paymentId
+ if (application.getString("paymentId").equals(payment.getString("paymentId"))) {
+ plInd = payments.indexOf(payment);
+ payment.put("amount",
+ payment.getBigDecimal("amount").
+ subtract(application.getBigDecimal("amountApplied")).doubleValue());
+ payments.remove(plInd);
+ payments.add(plInd,payment);
+ totalPaymentApplied = totalPaymentApplied.add(application.getBigDecimal("amountApplied"));
+ }
+ // reduce toPaymentId
+ if (application.getString("toPaymentId").equals(payment.getString("paymentId"))) {
+ plInd = payments.indexOf(payment);
+ payment.put("amount",
+ payment.getBigDecimal("amount").
+ subtract(application.getBigDecimal("amountApplied")).doubleValue());
+ payments.remove(plInd);
+ payments.add(plInd,payment);
+ totalPaymentApplied = totalPaymentApplied.add(application.getBigDecimal("amountApplied"));
+ }
+ }
+ }
+ }
+ context.put("historyListPayments",historyList);
+}
+
+
+// check if any invoices left not applied
+if (notAppliedInvoices != null && notAppliedInvoices.size() > 0) {
+ context.put("historyListInvoicesN",notAppliedInvoices);
+}
+
+
+// list payments applied to other companies
+historyList = new LinkedList();
+if (payments != null && payments.size() > 0) {
+ Iterator pm = payments.iterator();
+ while (pm.hasNext()) {
+ payment = pm.next();
+ // check if payment completely applied
+ BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
+ if (amount.compareTo(new BigDecimal("0.00")) == 0)
+ continue;
+ Debug.logInfo(" other company payments: " + payment.getString("paymentId") + " amount:" + payment.getBigDecimal("amount") + " applied:" + PaymentWorker.getPaymentAppliedBd(payment),"??");
+ List paymentApplications = payment.getRelated("PaymentApplication");
+ Iterator pa = paymentApplications.iterator();
+ while (pa.hasNext()) {
+ GenericValue paymentApplication = pa.next();
+ if (paymentApplication.get("invoiceId") != null) {
+ GenericValue invoice = paymentApplication.getRelatedOne("Invoice");
+ if (!invoice.getString("partyId").equals(partyId)) {
+ historyItem = new HashMap();
+ historyItem.put("paymentId",payment.getString("paymentId"));
+ historyItem.put("invoiceId",paymentApplication.getString("invoiceId"));
+ historyItem.put("invoiceItemSeqId",paymentApplication.getString("invoiceItemSeqId"));
+ historyItem.put("partyId",invoice.getString("partyIdFrom"));
+ historyItem.put("amount",amount.toString());
+ historyItem.put("applied",paymentApplication.getBigDecimal("amountApplied").setScale(2,BigDecimal.ROUND_HALF_UP).toString());
+ historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
+ historyList.add(historyItem);
+ }
+ }
+ }
+ }
+ context.put("historyListPaymentsO",historyList);
+}
+
+// list not applied payments
+BigDecimal totalPaymentNotApplied = new BigDecimal("0.00").setScale(2,BigDecimal.ROUND_HALF_UP);
+historyList = new LinkedList();
+if (payments != null && payments.size() > 0) {
+ Iterator pm = payments.iterator();
+ while (pm.hasNext()) {
+ payment = pm.next();
+ payment = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",payment.getString("paymentId")));
+ notApplied = payment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentAppliedBd(payment)).setScale(2,BigDecimal.ROUND_HALF_UP);
+ // check if payment completely applied
+ Debug.logInfo(" payment: " + payment.getString("paymentId") + " amount:" + payment.getBigDecimal("amount") + " applied:" + PaymentWorker.getPaymentAppliedBd(payment),"??");  
+ if (notApplied.compareTo(new BigDecimal("0.00")) == 0)
+ continue;
+ historyItem = new HashMap();
+ historyItem.put("paymentId",payment.getString("paymentId"));
+ BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
+ totalPaymentNotApplied = totalPaymentNotApplied.add(notApplied);
+ historyItem.put("amount",amount.toString());
+ historyItem.put("notApplied",notApplied.toString());
+ historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
+ historyList.add(historyItem);
+ }
+ context.put("historyListPaymentsN",historyList);
+}
+
+
+// create totals
+
+finanSummary = UtilMisc.toMap(
+ "totalSalesInvoice",totalSalesInvoice.toString(),
+ "totalPurchaseInvoice",totalPurchaseInvoice.toString(),
+ "totalPaymentsIn",totalPaymentsIn.toString(),
+ "totalPaymentsOut",totalPaymentsOut.toString(),
+ "totalInvoiceApplied",totalInvoiceApplied.toString(),
+ "totalInvoiceNotApplied",totalInvoiceNotApplied.toString());
+finanSummary.put("totalPaymentNotApplied",totalPaymentNotApplied.toString());
+finanSummary.put("totalPaymentNotApplied",totalPaymentNotApplied.toString());
+totalToBePaid = totalSalesInvoice.add(totalPurchaseInvoice).subtract(totalInvoiceApplied).subtract(totalPaymentNotApplied);
+if (totalToBePaid.compareTo(new BigDecimal("0.00")) < 0 ) finanSummary.put("totalToBePaid",totalToBePaid.toString());
+else if (totalToBePaid.compareTo(new BigDecimal("0.00")) > 0 ) finanSummary.put("totalToBeReceived",totalToBePaid.toString());
+else {
+ finanSummary.put("totalToBePaid","0.00");
+ finanSummary.put("totalToBeReceived","0.00");
+}
+ context.put("finanSummary",finanSummary);
+
\ No newline at end of file

Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=696941&r1=696940&r2=696941&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Thu Sep 18 23:43:34 2008
@@ -1057,6 +1057,7 @@
         <response name="success" type="none"/>
         <response name="error" type="none"/>
     </request-map>
+
                 
     <!-- Lookup request mappings -->
     <request-map uri="LookupPartyName"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyName"/></request-map>
@@ -1078,9 +1079,15 @@
     <request-map uri="LookupPreferredContactMech"><security https="true" auth="true"/><response name="success" type="view" value="LookupPreferredContactMech"/></request-map>
     <request-map uri="LookupEmploymentApp"><security auth="true" https="true"/><response name="success" type="view" value="LookupEmploymentApp"/></request-map>
     <request-map uri="LookupEmplPosition"><security auth="true" https="true"/><response name="success" type="view" value="LookupEmplPosition"/></request-map>
-
+    
+    <!-- Financail History Report-->
+    <request-map uri="PartyFinancialHistory">
+         <security https="true" auth="true"/>
+         <response name="success" type="view" value="PartyFinancialHistory"/>
+         <response name="error" type="view" value="viewprofile"/>
+    </request-map>  
     <!-- end of request mappings -->
-
+        
     <!-- View Mappings -->
     <view-map name="main" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#findparty"/>
 
@@ -1186,5 +1193,6 @@
     <view-map name="EditPersonTrainings" type="screen" page="component://humanres/widget/PersonTrainingScreens.xml#EditPersonTrainings"/>
     <view-map name="EditPartyResumes" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#EditPartyResumes"/>
     <view-map name="EditEmploymentApps" type="screen" page="component://humanres/widget/EmploymentAppScreens.xml#EditEmploymentApps"/>
+    <view-map name="PartyFinancialHistory" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#PartyFinancialHistory"/>
     <!-- end of view mappings -->
 </site-conf>

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml?rev=696941&r1=696940&r2=696941&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml Thu Sep 18 23:43:34 2008
@@ -778,6 +778,106 @@
         <field name="roleTypeIdTo"><hidden value="CONTACT"/></field>
         <field name="partyRelationshipTypeId"><hidden value="EMPLOYMENT"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field>
-    </form>
+    </form>
     
+    <form name="partyFinancialHistoryInvoices" type="list" list-name="historyListInvoices"
+        default-title-style="tableheadtext" default-widget-style="tabletext" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"
+        default-tooltip-style="tabletext" target="updateCategoryProductMember">
+        <field name="invoiceId"><hidden/></field>
+        <field name="invoiceId" title="invoiceId">
+            <display-entity entity-name="Invoice" description=" ">
+                <sub-hyperlink target="/accounting/control/invoiceOverview?invoiceId=${invoiceId}" description="[${invoiceId}]" target-type="inter-app"/>
+            </display-entity>
+        </field>
+        <field name="invoiceTypeId" title="T"><display/></field>
+        <field name="invoiceDate"><display/></field>
+        <field name="invoiceAmount" widget-area-style="tabletextright"><display/></field>
+        <field name="totInvoiceApplied" widget-area-style="tabletextright"><display/></field>
+        <field name="applied" widget-area-style="tabletextright"><display/></field>  
+        <field name="paymentId"><hidden/></field>
+        <field name="paymentId" title="PaymentId">
+            <display-entity entity-name="Payment" description=" ">
+                <sub-hyperlink target="/accounting/control/paymentOverview?paymentId=${paymentId}" description="[${paymentId}]" target-type="inter-app"/>
+            </display-entity>
+        </field>
+        <field name="effectiveDate"><display/></field>
+        <field name="amount" widget-area-style="tabletextright"><display/></field>
+    </form>
+    <!--/accounting/control/invoiceOverview-->
+    <form name="partyFinancialHistoryPayments" type="list" list-name="historyListPayments"
+        default-title-style="tableheadtext" default-widget-style="tabletext" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"
+        default-tooltip-style="tabletext" target="updateCategoryProductMember">
+        <field name="paymentId"><hidden/></field>
+        <field name="paymentId" title="PaymentId">
+            <display-entity entity-name="Payment" description=" ">
+                <sub-hyperlink target="/accounting/control/paymentOverview?paymentId=${paymentId}" description="[${paymentId}]" target-type="inter-app"/>
+            </display-entity>
+        </field>
+        <field name="effectiveDate"><display/></field>
+        <field name="amount" widget-area-style="tabletextright"><display/></field>
+        <field name="applied" widget-area-style="tabletextright"><display/></field>
+        <field name="toPaymentId"><hyperlink target="paymentOverview?paymentId=${paymentId}" description="${toPaymentId}"/></field>
+        <field name="toEffectiveDate"><display/></field>
+        <field name="toAmount" widget-area-style="tabletextright"><display/></field>
+    </form>
+    
+    <form name="partyFinancialHistoryInvoicesN" type="list" list-name="historyListInvoicesN"
+        default-title-style="tableheadtext" default-widget-style="tabletext" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"
+        default-tooltip-style="tabletext" target="updateCategoryProductMember">
+        <field name="invoiceId"><hidden/></field>
+        <field name="invoiceId" title="invoiceId">
+            <display-entity entity-name="Invoice" description=" ">
+                <sub-hyperlink target="/accounting/control/invoiceOverview?invoiceId=${invoiceId}" description="[${invoiceId}]" target-type="inter-app"/>
+            </display-entity>
+        </field>
+        <field name="invoiceTypeId" title="T"><display/></field>
+        <field name="invoiceDate"><display/></field>
+        <field name="invoiceAmount" widget-area-style="tabletextright"><display/></field>
+        <field name="invoiceNotApplied" widget-area-style="tabletextright"><display/></field>
+    </form>
+    
+    <form name="partyFinancialHistoryPaymentsO"
+        type="list"
+        list-name="historyListPaymentsO"
+        default-title-style="tableheadtext" default-widget-style="tabletext"
+        odd-row-style="alternate-row" default-table-style="basic-table hover-bar"
+        default-tooltip-style="tabletext" target="updateCategoryProductMember">
+        <field name="paymentId" title="PaymentId" >
+            <display-entity entity-name="Payment" description=" ">
+                <sub-hyperlink target="/accounting/control/paymentOverview?paymentId=${paymentId}" description="[${paymentId}]" target-type="inter-app"/>
+            </display-entity>
+        </field>
+        <field name="effectiveDate"><display/></field>
+        <field name="amount" widget-area-style="tabletextright"><display/></field>
+        <field name="applied" widget-area-style="tabletextright"><display/></field>
+        <field name="invoiceId"><hyperlink target="invoiceOverview?invoiceId=${invoiceId}" description="${invoiceId}"/></field>
+        <field name="invoiceItemSeqId" title="Seq"><display/></field>
+        <field name="partyId" widget-area-style="tabletextright"><display/></field>
+    </form>
+    
+    <form name="partyFinancialHistoryPaymentsN" type="list" list-name="historyListPaymentsN" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"
+        default-title-style="tableheadtext" default-widget-style="tabletext"
+        default-tooltip-style="tabletext" target="updateCategoryProductMember">
+        <field name="paymentId"><hidden/></field>
+        <field name="paymentId" title="PaymentId">
+            <display-entity entity-name="Payment" description=" ">
+                <sub-hyperlink target="/accounting/control/paymentOverview?paymentId=${paymentId}" description="[${paymentId}]" target-type="inter-app"/>
+            </display-entity>
+        </field>
+        <field name="effectiveDate"><display/></field>
+        <field name="amount" widget-area-style="tabletextright"><display/></field>
+        <field name="notApplied" widget-area-style="tabletextright"><display/></field>
+    </form>
+    
+    <form name="partyFinancialSummary" type="single" title="Financial summary" default-map-name="finanSummary"
+        default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
+        <field position="1" name="totalSalesInvoice"><display/></field>
+        <field position="2" name="totalPurchaseInvoice"><display/></field>
+        <field position="1" name="totalPaymentsIn"><display/></field>
+        <field position="2" name="totalPaymentsOut"><display/></field>
+        <field position="1" name="totalInvoiceNotApplied"><display/></field>
+        <field position="2" name="totalPaymentNotApplied"><display/></field>
+        <field position="1" name="totalToBePaid" title="To be paid to: ${parameters.partyId}"><display/></field>
+        <field position="2" name="totalToBeReceived" title="To be received from: ${parameters.partyId}"><display/></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml?rev=696941&r1=696940&r2=696941&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml Thu Sep 18 23:43:34 2008
@@ -70,6 +70,12 @@
         <menu-item name="EditEmploymentApps" title="${uiLabelMap.HumanResEmploymentApp}">
             <link target="EditEmploymentApps?partyId=${partyId}&amp;&amp;referredByPartyId=${partyId}"/>
         </menu-item>
+        <menu-item name="FinancialHistory" title="${uiLabelMap.FinancialHistory}">
+            <condition>
+                <if-has-permission permission="ACCOUNTING" action="_VIEW"/>
+            </condition>
+            <link target="PartyFinancialHistory?partyId=${partyId}&amp;&amp;referredByPartyId=${partyId}"/>
+        </menu-item>
     </menu>
     <menu name="ProfileSubTabBar" menu-container-style="button-bar button-style-2" default-selected-style="selected">  
         <menu-item name="createNew" title="${uiLabelMap.AccountingBillingAccount}" >
@@ -117,7 +123,7 @@
             </condition>
             <link target="/ordermgr/control/checkinits?partyId=${partyId}&amp;externaLoginKey=${externalLoginKey}" url-mode="inter-app"/>
         </menu-item>
-        <menu-item name="paymentsSent" title="${uiLabelMap.AccountingPaymentsSent}">
+        <!-- menu-item name="paymentsSent" title="${uiLabelMap.AccountingPaymentsSent}">
             <condition>
                 <if-has-permission permission="ACCOUNTING" action="_VIEW"/>
             </condition>
@@ -128,7 +134,7 @@
                 <if-has-permission permission="ACCOUNTING" action="_VIEW"/>
             </condition>
             <link target="/accounting/control/findPayments?lookupFlag=Y&amp;hideFields=Y&amp;partyIdFrom=${partyId}&amp;externaLoginKey=${externalLoginKey}" url-mode="inter-app"/>
-        </menu-item>
+        </menu-item-->
     </menu>
     <menu name="create-new-party" type="simple" menu-container-style="basic-nav">
         <menu-item name="create-party-group" title="${uiLabelMap.PartyCreateNewPartyGroup}">

Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml?rev=696941&r1=696940&r2=696941&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml Thu Sep 18 23:43:34 2008
@@ -63,12 +63,11 @@
                 <set field="tabButtonItem" value="viewprofile"/>
                 <set field="headerItem" value="find"/>
                 <set field="labelTitleProperty" value="PartyTaxAuthInfos"/>
-
+                <set field="partyId" from-field="parameters.partyId"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>                
                 <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/control.progress_bar.js" global="true"/>                
                 <set field="layoutSettings.styleSheets[]" value="/images/prototypejs/progress_bar.css" global="true"/>
-                <set field="layoutSettings.javaScripts[]" value="/partymgr/js/PartyProfileContent.js" global="true"/>                
-
+                <set field="layoutSettings.javaScripts[]" value="/partymgr/js/PartyProfileContent.js" global="true"/>    
                 <script location="component://party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy"/>
                 <script location="component://party/webapp/partymgr/WEB-INF/actions/party/GetUserLoginPrimaryEmail.groovy"/>
             </actions>
@@ -968,4 +967,80 @@
             </widgets>
         </section>
     </screen>
+    
+    <screen name="PartyFinancialHistory">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleEditPartyAttribute"/>
+                <set field="headerItem" value="accountsMain"/>
+                <set field="tabButtonItem" value="FinancialHistory"/>
+                <set field="partyId" from-field="parameters.partyId"/>
+                <entity-one entity-name="PartyNameView" value-name="party"></entity-one>
+                <set field="organizationPartyId" from-scope="user" to-scope="screen" from-field="productStoreId"/>
+                <script location="component://party/webapp/partymgr/WEB-INF/actions/party/PartyFinancailHistory.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container><label style="h1" text="Financial History"/></container>
+                        <screenlet title="${uiLabelMap.Invoices paid by payments}" navigation-form-name="Invoices">
+                            <include-form name="partyFinancialHistoryInvoices" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                        </screenlet>
+                        <section>
+                            <condition>
+                                <not>
+                                    <if-empty field-name="historyListPaymentsO"/>
+                                </not>
+                            </condition>
+                            <widgets>
+                                <screenlet title="${uiLabelMap.Invoices of other parties paid by payments from }${partyId}" navigation-form-name="PaymentsO">
+                                <include-form name="partyFinancialHistoryPaymentsO" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition>
+                                <not>
+                                    <if-empty field-name="historyListPayments"/>
+                                </not>
+                            </condition>
+                            <widgets>
+                                <screenlet title="${uiLabelMap.Applied payments to payments" navigation-form-name="Payments">
+                                <container><label style="head1" text="Applied payments to payments"/></container>
+                                <include-form name="partyFinancialHistoryPayments" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition>
+                                <not>
+                                    <if-empty field-name="historyListInvoicesN"/>
+                                </not>
+                            </condition>
+                            <widgets>
+                                <screenlet title="${uiLabelMap.Invoices not yet (fully) applied}" navigation-form-name="InvoicesN">
+                                <include-form name="partyFinancialHistoryInvoicesN" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition>
+                                <not>
+                                    <if-empty field-name="historyListPaymentsN"/>
+                                </not>
+                            </condition>
+                            <widgets>
+                                <screenlet title="${uiLabelMap.Payments not yet (fully) applied}" navigation-form-name="PaymentsN">
+                                <include-form name="partyFinancialHistoryPaymentsN" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                        <screenlet title="${uiLabelMap.Totals for Company:}${organizationPartyId}" navigation-form-name="Summary">
+                        <include-form name="partyFinancialSummary" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                        </screenlet>    
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>
\ No newline at end of file