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

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Wed Feb 1 19:54:45 CST 2006


Author: hansbak
Date: 2006-02-01 19:54:10 -0600 (Wed, 01 Feb 2006)
New Revision: 6650

Added:
   trunk/specialized/opentravelsystem/webapp/root/
   trunk/specialized/opentravelsystem/webapp/root/WEB-INF/
   trunk/specialized/opentravelsystem/webapp/root/WEB-INF/web.xml
   trunk/specialized/opentravelsystem/webapp/root/index.jsp
Modified:
   trunk/specialized/opentravelsystem/ofbiz-component.xml
   trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml
   trunk/specialized/opentravelsystem/servicedef/services.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml
Log:
OTS: VAT report now by year and some faults fixed

Modified: trunk/specialized/opentravelsystem/ofbiz-component.xml
===================================================================
--- trunk/specialized/opentravelsystem/ofbiz-component.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/ofbiz-component.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -50,6 +50,9 @@
     <!-- service resources: model(s), eca(s) and group definitions -->
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
 
+    <webapp name="Root"  title="Root Page redirector from domainname to domainpath"  server="default-server"
+        location="root"  mount-point="/"  app-bar-display="false"/> <!-- see webapp/root/index.jsp for configuration -->
+    
     <webapp name="hotelbackend"
         title="Hotel demo site Admininstrator backend, the same for all frontends"
         server="default-server"

Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -37,8 +37,20 @@
         </check-permission>        
         <check-errors/-->
 
-        <set field="period.start" value="2005-01-01 00:00:00" type="Timestamp"/>
-        <set field="period.end" value="2005-12-31 23:59:99" type="Timestamp"/>
+        <if-empty field-name="parameters.year">
+            <set field="respond_code" value="error"/>
+            <set field="error_message" value="Please enter a 4 digit year"/>
+            <field-to-list field-name="error_message" list-name="error_list"/>
+            <check-errors/>
+        </if-empty>
+
+        <!--set field="parameters.year" value="2006"/-->
+        <set field="start" from-field="parameters.year"/>
+        <string-append field-name="start" string="-01-01 00:00:00"/>
+        <set field="period.start" from-field="start" type="Timestamp"/>
+        <set field="end" from-field="parameters.year"/>
+        <string-append field-name="end" string="-12-31 23:59:99"/>
+        <set field="period.end" from-field="end" type="Timestamp"/>
         
         <entity-condition entity-name="Invoice" list-name="invoices">
             <condition-list combine="and">
@@ -53,102 +65,117 @@
             <order-by field-name="invoiceDate"/>
         </entity-condition>
 
-        <log level="always" message="Preparing VAT report for organization: ${parameters.organizationPartyId}"/>
+        <log level="always" message="Preparing VAT report for organization: ${parameters.organizationPartyId} for year ${parameters.year}"/>
         <if-empty field-name="invoices">
             <log level="always" message="==== could find an invoice...."/>
         </if-empty>
 
-        <set field="current.monthNr" value="00"/>
+        <set field="current.monthNr" value="0000-00"/>
+        <set field="month.monthNr" value="0000-00"/>
+        <set field="invoiceYear.year" value="0000"/>
         <iterate entry-name="invoice" list-name="invoices">
-            <!-- get the month number -->
             <set field="invoiceDate" from-field="invoice.invoiceDate"/>
-            <call-bsh><![CDATA[current.put("monthNr",invoiceDate.toString().substring(0,7))]]></call-bsh>
-            <!-- store in list if changed -->
-            <if-compare-field field-name="month.monthNr" operator="not-equals" to-field-name="current.monthNr">
-                <if-not-empty field-name="month">
-                    <calculate field-name="month.salesTaxDue">
-                        <calcop operator="get" field-name="month.salesTaxIn"/>
-                        <calcop operator="negative" field-name="month.salesTaxOut"/>
-                    </calculate>
-                    <calculate field-name="monthTotal.salesTaxDue">
-                        <calcop operator="get" field-name="month.salesTaxIn"/>
-                        <calcop operator="negative" field-name="month.salesTaxOut"/>
-                        <calcop operator="get" field-name="monthTotal.salesTaxDue"/>
-                    </calculate>
-                    <field-to-list field-name="month" list-name="monthList"/>
-                    <clear-field field-name="month"/>
-                </if-not-empty>
-            </if-compare-field>
-            <set field="month.monthNr" from-field="current.monthNr"/>
-            <get-related value-name="invoice" relation-name="InvoiceItem" list-name="invoiceItems"/>
-            <iterate entry-name="invoiceItem" list-name="invoiceItems">
-                <!-- calculate amount -->
-                <if-empty field-name="invoiceItem.quantity">
-                    <set field="invoiceItem.quantity" value="1" type="Double"/>
-                </if-empty>
-                <calculate field-name="totalAmount" decimal-scale="2" type="BigDecimal">
-                    <calcop operator="multiply" field-name="invoiceItem.quantity"/>
-                    <calcop operator="get" field-name="invoiceItem.amount"/>
-                </calculate>
-                <!-- store in appropriate total month value -->
-                <if-compare field-name="invoice.invoiceTypeId" value="SALES_INVOICE" operator="equals">
-                    <if-compare field-name="invoiceItem.invoiceItemTypeId" value="INV_SALES_TAX" operator="equals">
-                        <calculate field-name="month.salesTaxIn">
-                            <calcop operator="add" field-name="totalAmount"></calcop>
-                            <calcop operator="get" field-name="month.salesTaxIn"></calcop>
+            <call-bsh><![CDATA[invoiceYear.put("year",invoiceDate.toString().substring(0,4))]]></call-bsh>
+            <if-compare-field field-name="parameters.year" operator="equals" to-field-name="invoiceYear.year">
+                <!-- get the month number -->
+                <set field="invoiceDate" from-field="invoice.invoiceDate"/>
+                <call-bsh><![CDATA[current.put("monthNr",invoiceDate.toString().substring(0,7))]]></call-bsh>
+                <!-- store in list if changed -->
+                <if-compare-field field-name="month.monthNr" operator="not-equals" to-field-name="current.monthNr">
+                    <if-compare field-name="month.monthNr" operator="not-equals" value="0000-00">
+                        <calculate field-name="month.salesTaxDue">
+                            <calcop operator="get" field-name="month.salesTaxIn"/>
+                            <calcop operator="negative" field-name="month.salesTaxOut"/>
                         </calculate>
-                        <calculate field-name="monthTotal.salesTaxIn">
-                            <calcop operator="add" field-name="totalAmount"></calcop>
-                            <calcop operator="get" field-name="monthTotal.salesTaxIn"></calcop>
+                        <calculate field-name="monthTotal.salesTaxDue">
+                            <calcop operator="get" field-name="month.salesTaxIn"/>
+                            <calcop operator="negative" field-name="month.salesTaxOut"/>
+                            <calcop operator="get" field-name="monthTotal.salesTaxDue"/>
                         </calculate>
-                        <else>
-                            <calculate field-name="month.revenue">
+                        <log level="always" message="=========adding ${month.monthNr} from invoicedate: ${invoice.invoiceDate}"></log>
+                        <field-to-list field-name="month" list-name="monthList"/>
+                        <clear-field field-name="month"/>
+                    </if-compare>
+                </if-compare-field>
+                <set field="month.monthNr" from-field="current.monthNr"/>
+                <get-related value-name="invoice" relation-name="InvoiceItem" list-name="invoiceItems"/>
+                <iterate entry-name="invoiceItem" list-name="invoiceItems">
+                    <!-- calculate amount -->
+                    <if-empty field-name="invoiceItem.quantity">
+                        <set field="invoiceItem.quantity" value="1" type="Double"/>
+                    </if-empty>
+                    <calculate field-name="totalAmount" decimal-scale="2" type="BigDecimal">
+                        <calcop operator="multiply" field-name="invoiceItem.quantity"/>
+                        <calcop operator="get" field-name="invoiceItem.amount"/>
+                    </calculate>
+                    <!-- store in appropriate total month value -->
+                    <if-compare field-name="invoice.invoiceTypeId" value="SALES_INVOICE" operator="equals">
+                        <if-compare field-name="invoiceItem.invoiceItemTypeId" value="INV_SALES_TAX" operator="equals">
+                            <calculate field-name="month.salesTaxIn">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="month.revenue"></calcop>
+                                <calcop operator="get" field-name="month.salesTaxIn"></calcop>
                             </calculate>
-                            <calculate field-name="monthTotal.revenue">
+                            <calculate field-name="monthTotal.salesTaxIn">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="monthTotal.revenue"></calcop>
+                                <calcop operator="get" field-name="monthTotal.salesTaxIn"></calcop>
                             </calculate>
-                        </else>
+                            <else>
+                                <calculate field-name="month.revenue">
+                                    <calcop operator="add" field-name="totalAmount"></calcop>
+                                    <calcop operator="get" field-name="month.revenue"></calcop>
+                                </calculate>
+                                <calculate field-name="monthTotal.revenue">
+                                    <calcop operator="add" field-name="totalAmount"></calcop>
+                                    <calcop operator="get" field-name="monthTotal.revenue"></calcop>
+                                </calculate>
+                            </else>
+                        </if-compare>
                     </if-compare>
-                </if-compare>
-                <if-compare field-name="invoice.invoiceTypeId" value="PURCHASE_INVOICE" operator="equals">
-                    <if-compare field-name="invoiceItem.invoiceItemTypeId" value="PINV_SALES_TAX" operator="equals">
-                        <calculate field-name="month.salesTaxOut">
-                            <calcop operator="add" field-name="totalAmount"></calcop>
-                            <calcop operator="get" field-name="month.salesTaxOut"></calcop>
-                        </calculate>
-                        <calculate field-name="monthTotal.salesTaxOut">
-                            <calcop operator="add" field-name="totalAmount"></calcop>
-                            <calcop operator="get" field-name="monthTotal.salesTaxOut"></calcop>
-                        </calculate>
-                        <else>
-                            <calculate field-name="month.expenses">
+                    <if-compare field-name="invoice.invoiceTypeId" value="PURCHASE_INVOICE" operator="equals">
+                        <if-compare field-name="invoiceItem.invoiceItemTypeId" value="PINV_SALES_TAX" operator="equals">
+                            <calculate field-name="month.salesTaxOut">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="month.expenses"></calcop>
+                                <calcop operator="get" field-name="month.salesTaxOut"></calcop>
                             </calculate>
-                            <calculate field-name="monthTotal.expenses">
+                            <calculate field-name="monthTotal.salesTaxOut">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="monthTotal.expenses"></calcop>
+                                <calcop operator="get" field-name="monthTotal.salesTaxOut"></calcop>
                             </calculate>
-                        </else>
+                            <else>
+                                <calculate field-name="month.expenses">
+                                    <calcop operator="add" field-name="totalAmount"></calcop>
+                                    <calcop operator="get" field-name="month.expenses"></calcop>
+                                </calculate>
+                                <calculate field-name="monthTotal.expenses">
+                                    <calcop operator="add" field-name="totalAmount"></calcop>
+                                    <calcop operator="get" field-name="monthTotal.expenses"></calcop>
+                                </calculate>
+                            </else>
+                        </if-compare>
                     </if-compare>
-                </if-compare>
-            </iterate>
+                </iterate>
+            </if-compare-field>
         </iterate>    
-        <if-not-empty field-name="month">
+        <if-compare field-name="month.monthNr" operator="not-equals" value="0000-00">
             <calculate field-name="month.salesTaxDue">
                 <calcop operator="get" field-name="month.salesTaxIn"/>
                 <calcop operator="negative" field-name="month.salesTaxOut"/>
             </calculate>
+            <calculate field-name="monthTotal.salesTaxDue">
+                <calcop operator="get" field-name="month.salesTaxIn"/>
+                <calcop operator="negative" field-name="month.salesTaxOut"/>
+                <calcop operator="get" field-name="monthTotal.salesTaxDue"/>
+            </calculate>
             <field-to-list field-name="month" list-name="monthList"/>
-        </if-not-empty>
+        </if-compare>
         <if-not-empty field-name="monthList">
             <set field="monthTotal.monthNr" value="Total:"/>
-            <field-to-list field-name="monthTotal" list-name="monthList"/>
-            <field-to-result field-name="monthList" result-name="monthList"/>
+            <else>
+                <set field="monthTotal.monthNr" value="No invoices found....."/>
+            </else>
         </if-not-empty>
+        <field-to-list field-name="monthTotal" list-name="monthList"/>
+        <field-to-result field-name="monthList" result-name="monthList"/>
     </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-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/servicedef/services.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -169,6 +169,7 @@
         location="org/ofbiz/opentravelsystem/ReportServices.xml" invoke="vatReport" auth="true">
         <description>Report on in/out going VAT for a certain time period</description>
         <attribute name="organizationPartyId" type="String" mode="IN"/>
+        <attribute name="year" type="String" mode="IN" optional="false"/>
         <attribute name="monthList" type="java.util.List" mode="OUT" optional="true"/>
     </service>
 

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -114,12 +114,9 @@
     
     <!-- hotelbackend specific Request Mappings -->
     <request-map uri="main">
-        <description>Check if access to productstores, when not log off, otherwise go to selectStore or main (now disabled and using partyId of login</description>
         <security https="true" auth="true"/>
-        <!--event type="java" path="org.ofbiz.opentravelsystem.otsEvents" invoke="checkProductStore"/> 
-        <response name="selectStore" type="view" value="selectStore"/-->
         <response name="success" type="view" value="main" />
-        <response name="error" type="view" value="login" />
+        <response name="error" type="view" value="main" />
     </request-map>
 
     <request-map uri="intro">
@@ -2809,7 +2806,7 @@
         <security https="true" auth="true"/>
         <event type="service" invoke="otsVatReport"/>
         <response name="success" type="view" value="VatReport"/>
-        <response name="error" type="view" value="VatReport"/>
+        <response name="error" type="view" value="AccountingReports"/>
     </request-map>
     <!-- from the accounting component -->    
     <request-map uri="IncomeStatement">

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -40,9 +40,9 @@
                 <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
-                <set field="productStoreId" from-field="parameters.userLogin.partyId" global="true"/>
-                <set field="prodCatalogId" from-field="parameters.userLogin.partyId" global="true"/>
-                <set field="organizationPartyId" from-field="parameters.userLogin.partyId" global="true"/>
+                <set field="productStoreId" from-field="parameters.userLogin.partyId" global="true" to-scope="user"/>
+                <set field="prodCatalogId" from-field="parameters.userLogin.partyId" global="true" to-scope="user"/>
+                <set field="organizationPartyId" from-field="parameters.userLogin.partyId" global="true" to-scope="user"/>
                 <set field="activeApp" value="hotelbackend" global="true"/>
                 <set field="MainColumnStyle" value="nocolumns" global="true"/>
                 <entity-one entity-name="PartyGroup" value-name="partyGroup" use-cache="true">

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/MainScreens.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -27,17 +27,9 @@
     <screen name="main">
         <section>
             <actions>
-                <set field="page.appTabButtonItem" value="Settings"/>
-                <set field="page.appTabButtonItem" value="Main"/>
-                <set field="page.headerItem" value="main"/>
-                
-                <!--set field="productStoreId" to-scope="user" from-field="productStoreId" global="true"/>
-                <set field="prodCatalogId" to-scope="user" from-field="productStoreId" global="true"/>
-                <set field="webSiteId" to-scope="user" from-field="productStoreId" global="true"/-->
-                
-                <set field="productStoreId" from-scope="user" from-field="productStoreId" global="true"/>
-                <set field="prodCatalogId" from-scope="user" from-field="prodCatalogId"  global="true"/>
-                <set field="webSiteId" from-scope="user" from-field="webSiteId" global="true"/>
+                <set field="productStoreId" from-scope="user" from-field="productStoreId"/>
+                <set field="prodCatalogId" from-scope="user" from-field="prodCatalogId"/>
+                <set field="webSiteId" from-scope="user" from-field="webSiteId"/>
             </actions>
             <widgets>
                 <decorator-screen name="CatalogDecorator" location="${parameters.mainDecoratorLocation}">

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -67,14 +67,13 @@
     <form name="VatReportOptions" type="single" target="VatReport" title=""
         default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
         <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
-        <!--field name="fromOrderDate" title="From Date (orderDate&gt;=)"><date-time type="timestamp"/></field>
-        <field name="thruOrderDate" title="Thru Date (orderDate&lt;)"><date-time type="timestamp"/></field-->
+        <field name="year" title="Year"><text size="4" maxlength="4" default-value="2005"/></field>
         <field name="submitButton" title="Run Report" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 
     <form name="VatReport" type="list" list-name="monthList" 
         default-title-style="tableheadtext" default-widget-style="tabletext" 
-        default-tooltip-style="tabletext" target="updateCategoryProductMember">
+        default-tooltip-style="tabletext">
         <field name="monthNr"><display/></field>
         <field name="revenue" widget-area-style="tabletextright"><display/></field>
         <field name="salesTaxIn" widget-area-style="tabletextright"><display/></field>

Added: trunk/specialized/opentravelsystem/webapp/root/WEB-INF/web.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/root/WEB-INF/web.xml	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/webapp/root/WEB-INF/web.xml	2006-02-02 01:54:10 UTC (rev 6650)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+    <display-name>Opentravel system root redirector</display-name>
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+</web-app>

Added: trunk/specialized/opentravelsystem/webapp/root/index.jsp
===================================================================
--- trunk/specialized/opentravelsystem/webapp/root/index.jsp	2006-02-02 00:49:11 UTC (rev 6649)
+++ trunk/specialized/opentravelsystem/webapp/root/index.jsp	2006-02-02 01:54:10 UTC (rev 6650)
@@ -0,0 +1,27 @@
+
+<%
+/* 	
+	all domains assigned to this ofbiz installation will arrive here when this webapp is activated.
+	Here is the possibility to rerout them to the proper path keeping the requested domainname...
+		or do some other stuff, this info should be forwarded by apache if you use that as a frontend.
+*/	
+
+// check if test parameter there, remove it and redirect
+
+
+
+String serverName 	= 	request.getServerName();	// name of the host
+String serverPath 	= 	request.getServletPath();	// path of the requested servlet
+String scheme		=	getScheme(); 				// http or https or ftp
+String addr			=	getRemoteAddr();			// the ip address of the requester
+
+// these paths need to be switched to https mode and if required to a different port
+if (scheme.equals("http") && (serverPath.equals("/backend") || serverPath.equals("/webtools") || serverPath.equals("/partymgr"))) 
+	response.sendRedirect("https://" + serverName + ":8443/" + serverpath + "/control/main");
+
+if (serverName.equals("ant.co.th")) response.sendRedirect("/antwebsystems");
+if (serverName.equals("openwinkel.co.th")) response.sendRedirect("/openwinkel");
+if (serverName.equals("anet.co.th")) response.sendRedirect("/anet");
+
+
+%>



More information about the Svn mailing list