[OFBiz] SVN: r6854 - in trunk/specialized/opentravelsystem: script/org/ofbiz/opentravelsystem servicedef src/org/ofbiz/opentravelsystem webapp/hotelbackend/WEB-INF webapp/hotelbackend/screens

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Mon Feb 27 03:25:40 CST 2006


Author: hansbak
Date: 2006-02-27 03:25:06 -0600 (Mon, 27 Feb 2006)
New Revision: 6854

Modified:
   trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml
   trunk/specialized/opentravelsystem/servicedef/services.xml
   trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java
   trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml
Log:
OTS: add report for open payments and invoices

Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml	2006-02-27 07:55:33 UTC (rev 6853)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml	2006-02-27 09:25:06 UTC (rev 6854)
@@ -30,7 +30,7 @@
     <!-- Opentravelsystem reporting Services -->
     <!-- ================================================================ -->
     
-    <simple-method method-name="vatReport" short-description="Sow the vat for a certain period">
+    <simple-method method-name="vatReport" short-description="Show the vat for a certain period">
         <!--check-permission permission="CATALOG" action="_CREATE">
             <alt-permission permission="CATALOG_ROLE" action="_CREATE"/>
             <fail-message message="Security Error: to update you need CATALOG_CREATE or CATALOG_ADMIN permission, or the limited CATALOG_ROLE_CREATE permission"/>
@@ -40,6 +40,7 @@
         <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" auto-field-map="false" use-cache="true">
             <field-map field-name="partyId" env-name="parameters.userLogin.partyId"/>
         </entity-one>
+        <set field="searchPrefix" from-field="partyAcctgPreference.invoiceIdPrefix"/>
         
         <if-empty field-name="parameters.year">
             <now-timestamp-to-env env-name="nowTimestamp"/>
@@ -53,7 +54,6 @@
         <string-append field-name="end" string="-12-31 23:59:59"/>
         <set field="period.end" from-field="end" type="Timestamp"/>
         
-        <set field="searchPrefix" from-field="partyAcctgPreference.invoiceIdPrefix"/>
         <string-append field-name="searchPrefix" string="%"/>
         <entity-condition entity-name="Invoice" list-name="invoices">
             <condition-list combine="and">
@@ -176,4 +176,78 @@
         <field-to-result field-name="monthList" result-name="monthList"/>
     </simple-method>
     
+    <simple-method method-name="openInvoiceReport" short-description="Show the invoices which are not fully applied">
+        
+        <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" auto-field-map="false" use-cache="true">
+            <field-map field-name="partyId" env-name="parameters.userLogin.partyId"/>
+        </entity-one>
+        <set field="searchPrefix" from-field="partyAcctgPreference.invoiceIdPrefix"/>
+        <string-append field-name="searchPrefix" string="%"/>
+        <entity-condition entity-name="Invoice" list-name="invoices">
+            <condition-list combine="and">
+                <condition-expr field-name="invoiceId" operator="like" value="${searchPrefix}"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="INVOICE_CANCELLED"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="INVOICE_PAID"/>
+            </condition-list>            
+            <order-by field-name="invoiceDate"/>
+        </entity-condition>
+        
+        <if-empty field-name="invoices">
+            <log level="always" message="==== could not find an invoice...."/>
+        </if-empty>
+        
+        <iterate entry-name="invoice" list-name="invoices">
+            <set field="appliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceAppliedBd(invoice)}"/>
+            <set field="invoiceAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(invoice)}"/>
+            <if-compare-field field-name="appliedAmount" operator="not-equals" to-field-name="invoiceAmount">
+                <field-to-list field-name="invoice" list-name="openInvoices"/>
+            </if-compare-field>
+            <calculate field-name="count">
+                <number value="1"/>
+                <calcop operator="get" field-name="count"/>
+            </calculate>
+            <if-compare field-name="count" value="100" operator="equals">
+                <field-to-result field-name="openInvoices"/>
+                <return/>
+            </if-compare>
+        </iterate>
+        <field-to-result field-name="openInvoices"/>
+    </simple-method>
+    
+    <simple-method method-name="openPaymentReport" short-description="Show the payments which are not fully applied">
+        
+        <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" auto-field-map="false" use-cache="true">
+            <field-map field-name="partyId" env-name="parameters.userLogin.partyId"/>
+        </entity-one>
+        <set field="searchPrefix" from-field="partyAcctgPreference.invoiceIdPrefix"/>
+        <string-append field-name="searchPrefix" string="%"/>
+        <entity-condition entity-name="Payment" list-name="payments">
+            <condition-list combine="and">
+                <condition-expr field-name="paymentId" operator="like" value="${searchPrefix}"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="PMNT_CANCELLED"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="PMNT_PAID"/>
+            </condition-list>            
+            <order-by field-name="effectiveDate"/>
+        </entity-condition>
+        
+        <if-empty field-name="payments">
+            <log level="always" message="==== could not find a payment...."/>
+        </if-empty>
+        
+        <iterate entry-name="payment" list-name="payments">
+            <set field="appliedAmount" value="${bsh:org.ofbiz.accounting.payment.PaymentWorker.getPaymentAppliedBd(payment)}"/>
+            <if-compare field-name="appliedAmount" operator="not-equals" value="${payment.amount}">
+                <field-to-list field-name="payment" list-name="openPayments"/>
+            </if-compare>
+            <calculate field-name="count">
+                <number value="1"/>
+                <calcop operator="get" field-name="count"/>
+            </calculate>
+            <if-compare field-name="count" value="100" operator="equals">
+                <field-to-result field-name="openPayments"/>
+                <return/>
+            </if-compare>
+        </iterate>
+        <field-to-result field-name="openPayments"/>
+    </simple-method>
 </simple-methods>
\ No newline at end of file

Modified: trunk/specialized/opentravelsystem/servicedef/services.xml
===================================================================
--- trunk/specialized/opentravelsystem/servicedef/services.xml	2006-02-27 07:55:33 UTC (rev 6853)
+++ trunk/specialized/opentravelsystem/servicedef/services.xml	2006-02-27 09:25:06 UTC (rev 6854)
@@ -172,7 +172,21 @@
         <attribute name="year" type="String" mode="IN" optional="false"/>
         <attribute name="monthList" type="java.util.List" mode="OUT" optional="true"/>
     </service>
-
+    
+    <service name="otsOpenInvoiceReport" engine="simple"
+        location="org/ofbiz/opentravelsystem/ReportServices.xml" invoke="openInvoiceReport" auth="true">
+        <description>Report not completely applied invoices</description>
+        <attribute name="organizationPartyId" type="String" mode="IN"/>
+        <attribute name="openInvoices" type="java.util.List" mode="OUT" optional="true"></attribute>
+    </service>
+    
+    <service name="otsOpenPaymentReport" engine="simple"
+        location="org/ofbiz/opentravelsystem/ReportServices.xml" invoke="openPaymentReport" auth="true">
+        <description>Report not completely applied payments</description>
+        <attribute name="organizationPartyId" type="String" mode="IN"/>
+        <attribute name="openPayments" type="java.util.List" mode="OUT" optional="true"></attribute>
+    </service>
+    
     <!-- catalog/product services -->
     <service name="CreateProductCategoryLinkToProdCatalog" engine="simple"
         location="org/ofbiz/opentravelsystem/CatalogServices.xml"

Modified: trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java
===================================================================
--- trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java	2006-02-27 07:55:33 UTC (rev 6853)
+++ trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java	2006-02-27 09:25:06 UTC (rev 6854)
@@ -195,9 +195,9 @@
 			if (debug) Debug.logInfo("Creating payment with reference number: " + payment.get("paymentRefNum"),module);
 			if (checkPayment() == true)	{
 				paymentAlreadyUploaded++;
-				if (debug) Debug.logInfo("Payment already exists...so delete first.",module);
+				if (debug) Debug.logInfo("Payment already exists...so not create again...",module);
 			}
-			if (!partyOnly)	{	// input parameter.....
+			else if (!partyOnly)	{	// input parameter.....
 				// finally create payment record.
 				payment.put("userLogin",userLogin);
 				payment.put("locale", loc);
@@ -211,7 +211,7 @@
 			}
 		}
 		String mess = "Upload ended... " + partiesCreated + " partyGroups created, ";
-		if (!partyOnly) mess = mess.concat(paymentsCreated + " payment records created, " + paymentAlreadyUploaded + " payments deleted....");
+		if (!partyOnly) mess = mess.concat(paymentsCreated + " payment records created, " + paymentAlreadyUploaded + " payments already uploaded....");
 		request.setAttribute("_EVENT_MESSAGE_", mess);
 		
 		return "success";
@@ -227,11 +227,11 @@
 		if (payments == null || payments.size() == 0)	
 			return false;
 		else	{
-			try {
+/*			try {
 				((GenericValue) payments.get(0)).remove();
 			} catch (GenericEntityException e1) {
 				Debug.logError(e1, "Error deleting payment record", module);
-			}
+			} */
 			return true;
 		}
 	}

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-02-27 07:55:33 UTC (rev 6853)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-02-27 09:25:06 UTC (rev 6854)
@@ -2844,6 +2844,17 @@
         <response name="success" type="view" value="VatReport"/>
         <response name="error" type="view" value="AccountingReports"/>
     </request-map>
+    <request-map uri="OpenInvoiceReport">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="OpenInvoiceReport"/>
+        <response name="error" type="view" value="AccountingReports"/>
+    </request-map>
+    <request-map uri="OpenPaymentReport">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="OpenPaymentReport"/>
+        <response name="error" type="view" value="AccountingReports"/>
+    </request-map>
+    
     <!-- from the accounting component -->    
     <request-map uri="IncomeStatement">
         <security https="true" auth="true"/>
@@ -3185,10 +3196,11 @@
     <view-map name="editPaymentApplications" type="screen" page="component://accounting/widget/PaymentScreens.xml#EditPaymentApplications"/>
     <!-- Accounting Utilities -->
     <view-map name="Utilities" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#Utilities"/>
-    <!--view-map name="DataExchange" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#DataExchange"/-->
     <!-- accounting reports -->
     <view-map name="AccountingReports" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#reports"/>
     <view-map name="VatReport" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#VatReport"/>
+    <view-map name="OpenInvoiceReport" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#OpenInvoiceReport"/>
+    <view-map name="OpenPaymentReport" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#OpenPaymentReport"/>
     <view-map name="IncomeStatement" type="screen" page="component://accounting/widget/AccountingScreens.xml#IncomeStatement"/>
     <view-map name="BalanceSheet" type="screen" page="component://accounting/widget/AccountingScreens.xml#BalanceSheet"/>
     <view-map name="TrialBalance" type="screen" page="component://accounting/widget/AccountingScreens.xml#TrialBalance"/>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml	2006-02-27 07:55:33 UTC (rev 6853)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml	2006-02-27 09:25:06 UTC (rev 6854)
@@ -91,7 +91,6 @@
                 <set field="page.appTabButtonItem" value="Reservations"/>
                 <set field="page.headerItem" value="Reports"/>
                 <set field="title" value="Accounting Report Options"/>
-                <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" />
             </actions>
             <widgets>
                 <decorator-screen name="mainAccountingDecorator" location="${parameters.mainDecoratorLocation}">
@@ -107,16 +106,14 @@
                             <label style="head2" text="VAT report"/>
                             <include-form name="VatReportOptions" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
                         </container>
-                        <!--container>
-                            <label style="head2" text="Open Sales invoices."/>
-                            <include-form name="OpenSalesInvoices" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
-                        </container-->
-                        <!--container>
-                            <label style="head2" text="Reports from accounting module."/>
-                            <platform-specific>
-                                <html><html-template location="component://accounting/webapp/accounting/reports/reportsAvailable.ftl"/></html>
-                            </platform-specific>                    
-                        </container-->
+                        <container>
+                            <label style="head2" text="Open (not fully applied) Invoices."/>
+                            <include-form name="OpenInvoiceOptions" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
+                        </container>
+                        <container>
+                            <label style="head2" text="Open (not fully applied) Payments."/>
+                            <include-form name="OpenPaymentOptions" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
+                        </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
@@ -162,4 +159,40 @@
         </section>
     </screen>
     
+    <screen name="OpenInvoiceReport">
+        <section>
+            <actions>
+                <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" />
+            </actions>
+            <widgets>
+                <decorator-screen name="mainAccountingDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <label style="head1" text="Open Invoice Report for: ${organizationPartyId}"/>
+                            <include-form name="OpenInvoiceReport" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="OpenPaymentReport">
+        <section>
+            <actions>
+                <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" />
+            </actions>
+            <widgets>
+                <decorator-screen name="mainAccountingDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <label style="head1" text="Open Payment Report for: ${organizationPartyId}"/>
+                            <include-form name="OpenPaymentReport" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    
 </screens>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml	2006-02-27 07:55:33 UTC (rev 6853)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml	2006-02-27 09:25:06 UTC (rev 6854)
@@ -108,8 +108,77 @@
         <field name="salesTaxDue" widget-area-style="tabletextright"><display/></field>
     </form>
 
-    <form name="OpenInvoices" type="single" target="OpenSalesInvoices.pdf" title=""
+    <form name="OpenInvoiceOptions" type="single" target="OpenInvoiceReport" title=""
         default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+        <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
         <field name="submitButton" title="Run Report" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    
+    <form name="OpenInvoiceReport" type="list" separate-columns="true" 
+        title="Invoice List"  default-title-style="tableheadtext" list-name="openInvoices" target=""
+        default-widget-style="tabletext" default-tooltip-style="tabletext"
+        paginate-target="openInvoices" default-entity-name="Invoice">
+        <actions>
+            <service service-name="otsOpenInvoiceReport" result-map-list-name="openInvoices">
+                <field-map field-name="organizationPartyId" value="${organizationPartyId}"/>
+            </service>
+        </actions>
+        <row-actions>
+            <service service-name="getPartyNameForDate" result-map-name="partyNameResultFrom">
+                <field-map field-name="partyId" env-name="partyIdFrom"/>
+                <field-map field-name="compareDate" env-name="invoiceDate"/>
+                <field-map field-name="lastNameFirst" value="Y"/>
+            </service>
+            <service service-name="getPartyNameForDate" result-map-name="partyNameResultTo">
+                <field-map field-name="partyId" env-name="partyId"/>
+                <field-map field-name="compareDate" env-name="invoiceDate"/>
+                <field-map field-name="lastNameFirst" value="Y"/>
+            </service>
+        </row-actions>
+        
+        <field name="invoiceId" widget-style="buttontext">
+            <hyperlink description="${invoiceId}" target="invoiceOverview?invoiceId=${invoiceId}"/>
+        </field>
+        <field name="invoiceTypeId"><display-entity entity-name="InvoiceType" description="${description}"/></field>
+        <field name="invoiceDate"><display/></field>
+        <field name="statusId" title="${uiLabelMap.CommonStatus}" widget-style="tabletext"><display-entity entity-name="StatusItem" description="${description}"/></field>
+        <field name="description"><display/></field>
+        <field name="partyIdFrom" title="Party Billed From"><display description="${partyNameResultFrom.fullName} [${partyIdFrom}]"/></field>
+        <field name="partyId" title="Party Billed To"><display description="${partyNameResultTo.fullName} [${partyId}]"/></field>
+        <field name="invoiceDate"><display/></field>
+        <field name="total" widget-area-style="tabletextright"><display description="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId)}" type="currency" currency="${currencyUomId}" also-hidden="false"/></field>
+        <!-- payments applied means the invoice has been paid -->
+        <field name="applied" title="Paid" widget-area-style="tabletextright"><display description="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceAppliedBd(delegator,invoiceId)}" type="currency" currency="${currencyUomId}" also-hidden="false"/></field>
+    </form>
+
+    <form name="OpenPaymentOptions" type="single" target="OpenPaymentReport" title=""
+        default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+        <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
+        <field name="submitButton" title="Run Report" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+
+    <form name="OpenPaymentReport" type="list" separate-columns="true" default-entity-name="Payment"
+        title="Payment List"  default-title-style="tableheadtext" list-name="openPayments"
+        default-widget-style="tabletext" default-tooltip-style="tabletext"
+        paginate-target="/findPayments" paginate="true">
+        <actions>
+            <service service-name="otsOpenPaymentReport" result-map-list-name="openPayments">
+                <field-map field-name="organizationPartyId" value="${organizationPartyId}"/>
+            </service>
+        </actions>
+        <field name="paymentId" widget-style="buttontext">
+            <hyperlink description="${paymentId}" target="paymentOverview?paymentId=${paymentId}"/>
+        </field>
+        <field name="paymentTypeId" title="${uiLabelMap.CommonType}"><display-entity entity-name="PaymentType" description="${description}"/></field>
+        <field name="statusId" title="${uiLabelMap.CommonStatus}" widget-style="tabletext"><display-entity entity-name="StatusItem"/></field>
+        <field name="comments"><display/></field>
+        <field name="partyIdFrom" title="Party Payed From"><display-entity entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${lastName},${firstName}[${partyId}]"/></field>
+        <field name="partyIdTo" title="Party Payed To"><display-entity entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${lastName},${firstName}[${partyId}]"/></field>
+        <field name="effectiveDate"><display/></field>
+        <field name="currencyUomId" title="${uiLabelMap.CommonCurrency}"><display/></field>
+        <field name="amount"><display also-hidden="false"/></field>
+        <field name="applied"><display description="${bsh:org.ofbiz.accounting.payment.PaymentWorker.getPaymentAppliedBd(delegator,paymentId)}" also-hidden="false"/></field>
+    </form>
+    
+    
 </forms>



More information about the Svn mailing list