[OFBiz] SVN: r6719 - in trunk/specialized/opentravelsystem: script/org/ofbiz/opentravelsystem webapp/HotelSimple/html webapp/hotelbackend/WEB-INF webapp/hotelbackend/screens webapp/hotelbackend/script webapp/newShop/data webapp/newShop/html/images

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Sat Feb 11 21:13:15 CST 2006


Author: hansbak
Date: 2006-02-11 21:12:29 -0600 (Sat, 11 Feb 2006)
New Revision: 6719

Added:
   trunk/specialized/opentravelsystem/webapp/HotelSimple/html/index.html
   trunk/specialized/opentravelsystem/webapp/newShop/html/images/company.jpg
Modified:
   trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh
   trunk/specialized/opentravelsystem/webapp/newShop/data/ShopData.xml
Log:
OTS: erors in accounting reports fixed and now selectable by year

Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/ReportServices.xml	2006-02-12 03:12:29 UTC (rev 6719)
@@ -1,31 +1,31 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
- * Copyright (c) 2001-2005 The Open For Business Project and repective authors.
- * 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 <a href="mailto:support at opentravelsystem.org">Hans Bakker</a>
- * @version 1.0
- -->
+    * Copyright (c) 2001-2005 The Open For Business Project and repective authors.
+    * 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 <a href="mailto:support at opentravelsystem.org">Hans Bakker</a>
+    * @version 1.0
+-->
 
 <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd">
-
+    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd">
+    
     <!-- ================================================================ -->
     <!-- Opentravelsystem reporting Services -->
     <!-- ================================================================ -->
@@ -34,129 +34,127 @@
         <!--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"/>
-        </check-permission>        
-        <check-errors/-->
-
+            </check-permission>        
+            <check-errors/-->
+        
+        <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>
+        
         <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/>
+            <now-timestamp-to-env env-name="nowTimestamp"/>
+            <call-bsh><![CDATA[parameters.put("year",nowTimestamp.toString().substring(0,4))]]></call-bsh>
         </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"/>
+        <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">
+                <condition-expr field-name="invoiceId" operator="like" value="${searchPrefix}"/>
                 <condition-expr field-name="invoiceDate" operator="greater-equals" value="${period.start}"/>
                 <condition-expr field-name="invoiceDate" operator="less-equals" value="${period.end}"/>
                 <condition-expr field-name="statusId" operator="not-equals" value="INVOICE_CANCELLED"/>
-                <condition-list combine="or">
-                    <condition-expr field-name="partyId" value="${parameters.organizationPartyId}"/>
-                    <condition-expr field-name="partyIdFrom" value="${parameters.organizationPartyId}"/>
-                </condition-list>
             </condition-list>            
             <order-by field-name="invoiceDate"/>
         </entity-condition>
-
+        
         <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...."/>
+            <log level="always" message="==== could not find an invoice...."/>
         </if-empty>
 
-        <set field="current.monthNr" value="0000-00"/>
-        <set field="month.monthNr" value="0000-00"/>
-        <set field="invoiceYear.year" value="0000"/>
+        <set field="invoiceTotalP" value="0" type="Double"/>        
+        <set field="invoiceTotalS" value="0" type="Double"/>        
+        <set field="current.monthNr" value="0000-00"/>  <!-- read in from record -->
+        <set field="month.monthNr" value="0000-00"/> <!-- report line value -->
         <iterate entry-name="invoice" list-name="invoices">
+            <!-- get the month number -->
             <set field="invoiceDate" from-field="invoice.invoiceDate"/>
-            <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"/>
+            <call-bsh><![CDATA[current.put("monthNr",invoiceDate.toString().substring(0,7))]]></call-bsh>
+            <!-- store in list if changed however not the first line-->
+            <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.salesTaxDue">
+                        <calcop operator="get" field-name="month.salesTaxIn"/>
+                        <calcop operator="negative" field-name="month.salesTaxOut"/>
+                        <calcop operator="add" field-name="monthTotal.salesTaxDue"/>
+                    </calculate>
+                    <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">
+                        <calcop operator="get" field-name="invoiceItem.quantity"/>
+                        <calcop operator="get" field-name="invoiceItem.amount"/>
+                    </calcop>
+                </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="get" field-name="totalAmount"/>
+                                <calcop operator="get" field-name="month.salesTaxIn"/>
                         </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-name="monthTotal.salesTaxIn">
+                            <calcop operator="add" field-name="totalAmount"/>
+                            <calcop operator="get" field-name="monthTotal.salesTaxIn"/>
                         </calculate>
-                        <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">
+                        <else>
+                            <calculate field-name="month.revenue">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="month.salesTaxIn"></calcop>
+                                <calcop operator="get" field-name="month.revenue"></calcop>
                             </calculate>
-                            <calculate field-name="monthTotal.salesTaxIn">
+                            <calculate field-name="monthTotal.revenue">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="monthTotal.salesTaxIn"></calcop>
+                                <calcop operator="get" field-name="monthTotal.revenue"></calcop>
                             </calculate>
-                            <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>
+                        </else>
                     </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">
+                </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">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="month.salesTaxOut"></calcop>
+                                <calcop operator="get" field-name="month.expenses"></calcop>
                             </calculate>
-                            <calculate field-name="monthTotal.salesTaxOut">
+                            <calculate field-name="monthTotal.expenses">
                                 <calcop operator="add" field-name="totalAmount"></calcop>
-                                <calcop operator="get" field-name="monthTotal.salesTaxOut"></calcop>
+                                <calcop operator="get" field-name="monthTotal.expenses"></calcop>
                             </calculate>
-                            <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>
+                        </else>
                     </if-compare>
-                </iterate>
-            </if-compare-field>
+                </if-compare>
+            </iterate>
         </iterate>    
-        <if-compare field-name="month.monthNr" operator="not-equals" value="0000-00">
+        <if-compare field-name="month.monthNr" operator="not-equals" value="0000-00"><!-- process last line -->
             <calculate field-name="month.salesTaxDue">
                 <calcop operator="get" field-name="month.salesTaxIn"/>
                 <calcop operator="negative" field-name="month.salesTaxOut"/>

Added: trunk/specialized/opentravelsystem/webapp/HotelSimple/html/index.html
===================================================================
--- trunk/specialized/opentravelsystem/webapp/HotelSimple/html/index.html	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/HotelSimple/html/index.html	2006-02-12 03:12:29 UTC (rev 6719)
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+    <!-- InstanceBegin template="/Templates/haagschesuites2.dwt" codeOutsideHTMLIsLocked="false" -->
+    <head>
+        <meta content="Mozilla/4.79 [en] (Win98; U) [Netscape]" name="GENERATOR" />
+        <meta content="Guido J. van den Elshout" name="Author" />
+        <meta
+            content="Hotel, Exclusive Bed and Breakfast, Exclusive all suite Hotel, Exclusive Private Guesthouse"
+            name="description" />
+        <meta
+            content="Haagsche Suites, Hotel, Exclusive Bed and Breakfast, Luxurious Bed &amp; Breakfast, Exclusive Private Guesthouse, Exclusive all suites Hotel, Haagsche Suite, Haagse Suites, Haagse Suite, Hotels in Den Haag, Hotels in The Hague, Hotels in 's-Gravenhage, Hotel in The Hague, Hotel in Den Haag, Hotel in 's-Gravenhage, Suites in Den Haag, Suites in Den Haag, Suites in 's-Gravenhage, Hague Suites, Hague suite, Bed and Breakfast in Den Haag, Bed and Breakfast in The Hague, Bed and Breakfast in 's-Gravenhage, Exclusive B&amp;B, Exclusive all suites Hotel, Private Guesthouse,  Accomodation in The Hague, The Hague accomodation, Luxurious Hotelsuites, Luxurious accomodation in Den Haag, The Hague, Nederland, The Netherlands, Holland, Zuid-Holland, haagschesuites.nl, haagschesuites.com, haagsesuites.nl, haagse suites.nl, Boutique Hotel, Boutique Hotel in Den Haag,  Hip Hotel in Den Haag, Luxurious  Weekend Hotel in Den Haag, Weekend Hotel, Weekend hotel in The Hague, Weekend hotel in Den Haag, Hip Weekend Hotel, Weekend Hotel in 's-Gravenhage, Den Haag, Zuid-Holland, Weekend in Den Haag, Weekend in The Hague, Weekend holiday in Den Haag, Midweek in Den Haag, North Sea Jazz Festival, GEM, Gemeente Museum, Madurodam, Panorama Mesdag, Museum Mesdag, Omniversum, Nederlands Congres Centrum, haagschesuites.nl, haagschesuites.com, haagsesuites.nl, haagse suites.nl, Streetcar 3, Streetcar 7, Wedding in The Hague, Bridal Suite in Den Haag, Bridal Suite in The Hague, Bridal Suite in 's-Gravenhage, Wedding night in The Hague, Wedding night Suite, wedding proposal, wedding aniversary, just married, wedding idea, Scheveningen, Boutique Hotel, Boutique hotel in Den Haag, Boutique Hotel in The Hague, Boutique Hotel in 's-Gravenhage, Hip Hotel in Den Haag, Hip Hotel in the Hague,  Luxurious weekend in Den Haag, weekend hotel, Weekend hotel in Den Haag, Weekend hotel in The Hague, Hip weekend hotel, weekend in The hague, Weekend uit in Den Haag, Midweek in Den Haag, North Sea Jazz Festival, GEM, Gemeente Museum, Madurodam, Panorama Mesdag, Museum Mesdag, Omniversum, Nederlands Congres Centrum, lounging, wining and dining, best breakfast in  The Hague, Private Guesthouse,  Accomodation in The Hague, The Hague accomodation, Luxurious Hotelsuites, Luxurious accomodation in Den Haag, The Hague, Nederland, The Netherlands, Holland, Zuid-Holland, haagschesuites.nl, haagschesuites.com, haagsesuites.nl, haagse suites, haagse suites.nl, Boutique Hotel, Boutique Hotel in Den Haag,  Hip Hotel in Den Haag, Luxurious  Weekend Hotel in Den Haag, Weekend Hotel, Weekend hotel in The Hague, Weekend hotel in Den Haag, Hip Weekend Hotel, Weekend Hotel in 's-Gravenhage, Den Haag, Zuid-Holland, Weekend in Den Haag, Weekend in The Hague, Weekend holiday in Den Haag, Midweek in Den Haag, North Sea Jazz Festival, GEM, Gemeente Museum, Madurodam, Panorama Mesdag, Museum Mesdag, Omniversum, Nederlands Congres Centrum, haagschesuites.nl, haagschesuites.com, haagsesuites.nl,  Streetcar 3, Streetcar 10,  Wedding in The Hague, Bridal Suite in Den Haag, Bridal Suite in The Hague, , Madurodam, Panorama Mesdag, Museum Mesdag, Omniversum, Nederlands Congres Centrum, lounging, wining and dining, best breakfast in  The Hague, inn, city center, city, condominimum, condominium, congress, furnished, gay friendly, guest, guesthouse, holiday homes, homestay, leisure, lodging, motels, Bridal Suite in 's-Gravenhage, Honeymoon suite, Honeymoon suites, Wedding night in The Hague, Wedding night Suite, wedding proposal, wedding aniversary, just married, wedding idea, Scheveningen, Boutique Hotel, Boutique hotel in Den Haag, Boutique Hotel in The Hague, Boutique Hotel in 's-Gravenhage, Hip Hotel in Den Haag, Hip Hotel in the Hague,  Luxurious weekend in Den Haag, luxe weekend in Den haag, Luxurious weekend in The Hague, weekend hotel, Weekend hotel in Den Haag, Weekend hotel in The Hague, Hip weekend hotel, weekend in The hague, Weekend uit in Den Haag, Midweek in Den Haag, North Sea Jazz Festival, GEM, Gemeente Museumuseum, nightlife, non smoking, Amsterdam, expat apartment, rent, expat rent, rental, studio, Schiphol Airport, art, art galleries, business, cabaret, caf&eacute;s, coffee, casino, centre, central, cinema, classical music, clothes, clubs, cruising, dance, dancing, designer, discos, drink, drinking, eating, english-language, entertainment, fashion, festivals, film, folk, food, fun, fringe theatre, galleries, gay, gourmet, gyms, lesbian, getting around, health, hostels, hotels, house,  health food, information, internet, jazz, literature, lounge, markets, menu, museums, money, movies, opera, orchestra, public transport, parks, parties, party, pension, photography, pop, post office, private, private meetings, private dinner, pubs, restaurants, reviews, rock, rock music, roots, shopping, sightseeing, soccer, souvenirs, sport, swimming, taxis, tennis, theatre, tourist, VVV, tourist board, tourist information, tourism, tours, transport, travel, vegetarian, smoke-free, non-smoking, privacy, internet, broadband, Hotel seulement a Suites, La Haye, Pays Bas, B&amp;B, bed, Breakfast, auberge, appartement,  centre, chalet, chambre, chambres, gite, gites, herbergement, historique, h&iuml;&iquest;&frac12;e, h&iuml;&iquest;&frac12;el, immeuble particulier , lit, logement, loisirs, petit d&iuml;&iquest;&frac12;euner, pi&iuml;&iquest;&frac12;e, romantique, marriage, f&iuml;&iquest;&frac12;e, studio, tourisme, vacances, voyage, maison, Mesdag, Mauritshuis, Niederlande, Bett, Kondominium, Kongress,  Kongress, Ferien, Freizeit,  Frhstck, Gast,  G&iuml;&iquest;&frac12;tezimmer, Gaestezimmer, Gasthaus, accommodation,  Haus,  historisch, logement, messe, Miete, Stadt Mitte, Museum, nicht rauchen, rauchfrei, Pension, reisen, romantisch, schwull, Fruehstueck, Studio, Tourismus, Unterkunft, Wohnung, Zentrum, Zimmer"
+            name="keywords" />
+        <meta content="Copyright  2002 - 2005 Guido J. van den Elshout" name="copyright" />
+        <meta
+            content="Hotel, Exclusive Bed and Breakfast, Exclusive Bead and Breakfast in The Hague, Luxurious B &amp; B, Luxurious B&amp;B in Den Haag, Exclusive all suite hotel, hotelsuites, suites, The Hague"
+            name="Classification" />
+        <meta content="index" name="robot" />
+        <meta content="15" name="revisit-after" />
+        <title>Haagsche Suites - Den Haag, Hotel, Exclusive Bed and Breakfast, Exclusive Private
+            Guesthouse</title>
+        <link href="haagsestyles.css" rel="stylesheet" type="text/css" ></link>
+        <script language="JavaScript" type="text/JavaScript">
+function MM_preloadImages() { //v3.0
+  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
+    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
+    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
+}
+
+function MM_findObj(n, d) { //v4.01
+  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
+    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
+  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
+  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
+  if(!x && d.getElementById) x=d.getElementById(n); return x;
+}
+
+function MM_swapImage() { //v3.0
+  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
+   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
+}
+
+function MM_swapImgRestore() { //v3.0
+  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
+}
+
+function MM_jumpMenu(targ,selObj,restore){ //v3.0
+  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
+  if (restore) selObj.selectedIndex=0;
+}
+
+// Open travel System link in new window 
+function newWin(){
+      window.open("","test","scrollbars=yes,width=500,height=600");
+      }
+</script>
+    </head>
+        <body>
+            <table border="0" cellpadding="0" cellspacing="0" width="100%">
+                <tr>
+                    <td align="center" bgcolor="#666666" class="credits" height="35">
+                        Booking links:<br />
+                        <a href="../control/main" onclick="newWin()"
+                            style="color:#FFFFFF;font:11px Verdana, Arial, Helvetica, sans-serif;text-decoration:none;"
+                            target="test">List of Suites</a>           - <a
+                                href="../control/product/~product_id=HS10000" onclick="newWin()"
+                            style="color:#FFFFFF;font:11px Verdana, Arial, Helvetica, sans-serif;text-decoration:none;"
+                            target="test">BOOK Suite 1</a>           - <a
+                                href="../control/product/~product_id=HS10010" onclick="newWin()"
+                            style="color:#FFFFFF;font:11px Verdana, Arial, Helvetica, sans-serif;text-decoration:none;"
+                            target="test">BOOK Suite 2</a>           - <a
+                                href="../control/product/~product_id=HS10020" onclick="newWin()"
+                            style="color:#FFFFFF;font:11px Verdana, Arial, Helvetica, sans-serif;text-decoration:none;"
+                            target="test">BOOK Suite 3</a>           - <a
+                                href="../control/product/~product_id=HS10021" onclick="newWin()"
+                            style="color:#FFFFFF;font:11px Verdana, Arial, Helvetica, sans-serif;text-decoration:none;"
+                            target="test">BOOK all 3 Suites</a>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="text" style="text-align:center">
+                        <center>   In the top menu demo links are provided as an example<br />
+                            they can be placed anywhere in an existing website<br />The page below
+                            is for decoration only...it is not functional.</center>
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <!-- InstanceBeginEditable name="body" -->
+                        <table bgcolor="#FFFFFF" border="0" cellpadding="0"
+                            cellspacing="0" width="100%">
+                            <tr>
+                                <td>
+                                    <img height="25" src="../images/spacer.gif" width="8" alt=""/>
+                                </td>
+                                <td>&nbsp;</td>
+                                <td>&nbsp;</td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <img height="40" src="../images/spacer.gif" width="40" alt=""/>
+                                </td>
+                                <td rowspan="3">
+                                    <img border="1" height="330" id="trap" name="trap"
+                                        src="../images/Homerechtsg330.jpg" vspace="5" width="330" alt=""/>
+                                </td>
+                                <td>
+                                    <table border="0" cellpadding="10" cellspacing="0" width="100%">
+                                        <tr>
+                                            <td class="kop">
+                                                <span class="koppers">
+                                                  <strong>'Thou shalt enjoy
+                                                  Thyself!'</strong>
+                                                </span>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td bgcolor="#D8D0C8" height="250">&nbsp;</td>
+                                <td bgcolor="#D8D0C8" valign="top">
+                                    <table border="0" cellpadding="10" width="400">
+                                        <tr>
+                                            <td class="text" valign="top">
+                                                <p align="justify" class="textblok">Under
+                                                  this motto we created three luxurious private
+                                                  suites in a                      townhouse,
+                                                  originally built in 1890 and recently completely
+                                                  refurbished. Situated between the heart of The
+                                                  Hague and the                      beaches of
+                                                  Scheveningen. Amsterdam and Rotterdam airports
+                                                  not far away. Each suite occupies a whole floor.
+                                                  Each suite                      has a lovely
+                                                  view of the designer garden. Each suite
+                                                  suiteable                      for both the
+                                                  distinguished business and leisure traveller.
+                                                  Each suite a bridal suite.<br />
+                                                  We offer ultimate luxury and intimate
+                                                  privacy.<br />                     Guido and
+                                                  Irene van den Elshout </p>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <img height="40" src="../images/spacer.gif" width="8" alt=""/>
+                                </td>
+                                <td width="100%">
+                                    <div align="right">
+                                        <span class="koppers">Dutch                </span>
+                                        <span class="koppers"> - &raquo;Next&nbsp;</span>
+                                        <img align="middle" border="0" height="54"
+                                            src="../images/logo.GIF" width="200" alt="" />
+                                    </div>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <img height="25" src="../images/spacer.gif" width="15" alt="" />
+                                </td>
+                                <td class="linktekst">
+                                    <div align="center"> more                <img align="top"
+                                            border="0" height="15" hspace="3" id="blokje1"
+                                            name="blokje1"
+                                            onmouseout="MM_swapImage('blokje1','','../images/blokjegrijs.gif',1)"
+                                            onmouseover="MM_swapImage('blokje1','','../images/blokjewit.gif',1)"
+                                            src="../images/blokjegrijs.gif" width="15" alt="" />
+                                        <img align="top" border="0" height="15" hspace="3"
+                                            id="blokje2" name="blokje2"
+                                            onmouseout="MM_swapImage('blokje2','','../images/blokjegrijs.gif',1)"
+                                            onmouseover="MM_swapImage('blokje2','','../images/blokjewit.gif',1)"
+                                            src="../images/blokjegrijs.gif" width="15"  alt=""  />
+                                        <img align="top" border="0" height="15" hspace="3"
+                                            id="blokje3" name="blokje3"
+                                            onmouseout="MM_swapImage('blokje3','','../images/blokjegrijs.gif',1)"
+                                            onmouseover="MM_swapImage('blokje3','','../images/blokjewit.gif',1)"
+                                            src="../images/blokjegrijs.gif" width="15"  alt="" />
+                                        <img align="top" border="0" height="15" hspace="3"
+                                            id="blokje4" name="blokje4"
+                                            onmouseout="MM_swapImage('blokje4','','../images/blokjegrijs.gif',1)"
+                                            onmouseover="MM_swapImage('blokje4','','../images/blokjewit.gif',1)"
+                                            src="../images/blokjegrijs.gif" width="15"  alt="" />photo's
+                                            <span class="text"> </span></div>
+                                </td>
+                                <td class="text" valign="top" width="100%">
+                                    <div align="right">info at haagschesuites.nl&nbsp;&nbsp;
+                                    </div>
+                                </td>
+                            </tr>
+                        </table>
+                        <!-- InstanceEndEditable -->
+                    </td>
+                </tr>
+                <tr>
+                    <td class="text" height="10" style="border-top:8px solid #D8D0C8">
+                        <div align="center">
+                            <strong>
+                                <font color="#725E4E">Laan van Meerdervoort          155, NL 2517 AX
+                                    The Hague - Tel: +31 (0)70 364 78 79 - Fax: +31 (0)70 345
+                                    65 33</font>
+                            </strong>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <!-- InstanceEnd -->
+        </body>
+</html>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2006-02-12 03:12:29 UTC (rev 6719)
@@ -995,7 +995,7 @@
     <request-map uri="createProduct">
         <security https="true" auth="true"/>
         <event type="service" path="" invoke="createProduct"/>
-        <response name="success" type="view" value="EditProducts"/>
+        <response name="success" type="view" value="EditProduct"/>
         <response name="error" type="view" value="EditProduct"/>
     </request-map>
     <request-map uri="updateProduct">
@@ -2832,7 +2832,6 @@
     
     <request-map uri="VatReport">
         <security https="true" auth="true"/>
-        <event type="service" invoke="otsVatReport"/>
         <response name="success" type="view" value="VatReport"/>
         <response name="error" type="view" value="AccountingReports"/>
     </request-map>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml	2006-02-12 03:12:29 UTC (rev 6719)
@@ -62,29 +62,4 @@
             <submit button-type="button"/>
         </field>
     </form>
-    <form name="ListInvoices" target="ListInvoices" title="List invoices" type="single"
-        default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox">
-        <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
-        <field name="submitButton" title="submit" widget-style="smallSubmit">
-            <submit button-type="button"/>
-        </field>
-    </form>
-    <form name="InvoicesList" target="InvoicesList" title="Invoice List" type="list" list-name="invoiceList" default-widget-style="tabletext"
-        default-title-style="tableheadtext" default-tooltip-style="tabletext">
-        <actions>
-            <script location="component://opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh"/>
-        </actions>
-        <field name="company" widget-style="buttontext" >
-            <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>
-            <field name="salesTaxIn" widget-area-style="tabletextright"><display/></field>
-        <field name="expenses" widget-area-style="tabletextright"><display/></field>
-        <field name="salesTaxOut" widget-area-style="tabletextright"><display/></field>
-        <!--field name="miscIn"><display/></field>
-        <field name="miscOut"><display/></field-->
-        <field name="totalValue" widget-area-style="tabletextright"><display currency="ss"/></field>
-    </form>
-    
 </forms>
\ No newline at end of file

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml	2006-02-12 03:12:29 UTC (rev 6719)
@@ -100,17 +100,17 @@
                             <label style="head1" text="Accounting Reports for ${organizationPartyId}"/>
                         </container>
                         <container>
-                            <label style="head2" text="Invoices Test report"/>
-                            <include-form name="ListInvoices" location="component://opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml"/>
+                            <label style="head2" text="Invoices report by customer/supplier"/>
+                            <include-form name="ListInvoices" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
                         </container>
                         <container>
                             <label style="head2" text="VAT report"/>
                             <include-form name="VatReportOptions" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
                         </container>
-                        <container>
+                        <!--container>
                             <label style="head2" text="Open Sales invoices."/>
                             <include-form name="OpenSalesInvoices" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
-                        </container>
+                        </container-->
                         <container>
                             <label style="head2" text="Reports from accounting module."/>
                             <platform-specific>
@@ -127,14 +127,15 @@
             <actions>
                 <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" />
                 <set field="salesTaxIn" from-field="requestAttributes.salesTaxIn"/> 
-                <set field="salesTaxOut" from-field="requestAttributes.salesTaxOut"/> 
+                <set field="salesTaxOut" from-field="requestAttributes.salesTaxOut"/>
+                <script location="component://opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh"/>
             </actions>
             <widgets>
                 <decorator-screen name="mainAccountingDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <container>
-                            <label style="head1" text="List of invoices"/>
-                            <include-form name="InvoicesList" location="component://opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml"/>
+                            <label style="head1" text="List of invoices from: ${organizationPartyId} for: ${year}"/>
+                            <include-form name="InvoicesList" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
                         </container>
                     </decorator-section>
                 </decorator-screen>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml	2006-02-12 03:12:29 UTC (rev 6719)
@@ -64,16 +64,42 @@
         <field name="submitButton" title="Run Product Report" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
     
+    <form name="ListInvoices" target="ListInvoices" title="List invoices" type="single"
+        default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox">
+        <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
+        <field name="year" title="Year"><text size="4" maxlength="4"/></field>
+        <field name="submitButton" title="submit" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+    <form name="InvoicesList" target="InvoicesList" title="Invoice List" type="list" list-name="invoiceList" default-widget-style="tabletext"
+        default-title-style="tableheadtext" default-tooltip-style="tabletext">
+        <field name="company" widget-style="buttontext" >
+            <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>
+        <field name="salesTaxIn" widget-area-style="tabletextright"><display/></field>
+        <field name="expenses" widget-area-style="tabletextright"><display/></field>
+        <field name="salesTaxOut" widget-area-style="tabletextright"><display/></field>
+        <!--field name="miscIn"><display/></field>
+            <field name="miscOut"><display/></field-->
+        <field name="totalValue" widget-area-style="tabletextright"><display currency="ss"/></field>
+    </form>
+    
     <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="year" title="Year"><text size="4" maxlength="4" default-value="2005"/></field>
+        <field name="year" title="Year"><text size="4" maxlength="4"/></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">
+        <actions>
+            <service service-name="otsVatReport" result-map-list-name="monthList">
+                <field-map field-name="year" env-name="parameters.year"/>
+            </service>
+        </actions>
         <field name="monthNr"><display/></field>
         <field name="revenue" widget-area-style="tabletextright"><display/></field>
         <field name="salesTaxIn" widget-area-style="tabletextright"><display/></field>
@@ -82,7 +108,7 @@
         <field name="salesTaxDue" widget-area-style="tabletextright"><display/></field>
     </form>
 
-    <form name="OpenSalesInvoices" type="single" target="OpenSalesInvoices.pdf" title=""
+    <form name="OpenInvoices" type="single" target="OpenSalesInvoices.pdf" title=""
         default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
         <field name="submitButton" title="Run Report" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/script/ListInvoices.bsh	2006-02-12 03:12:29 UTC (rev 6719)
@@ -33,10 +33,23 @@
 import org.ofbiz.common.*;
 import org.ofbiz.webapp.control.*;
 import org.ofbiz.accounting.invoice.*;
+import org.ofbiz.entity.condition.*;
 
 delegator = parameters.get("delegator");
-organizationPartyId = parameters.get("organizationPartyId");
+String organizationPartyId = parameters.get("organizationPartyId");
+GenericValue partyAcctgPreference = delegator.findByPrimaryKey("PartyAcctgPreference",UtilMisc.toMap("partyId",organizationPartyId));
+String prefix = partyAcctgPreference.getString("invoiceIdPrefix");
 
+String year = parameters.get("year");
+if (year.equals("")) {
+	year = UtilDateTime.nowTimestamp().toString().substring(0,4);
+}
+
+Timestamp startDate = null;
+Timestamp endDate = null;
+startDate = Timestamp.valueOf(year.concat("-01-01 00:00:00"));
+endDate = Timestamp.valueOf(year.concat("-12-31 23:59:59"));
+
 // Create totals:
 BigDecimal salesTaxInTot = new BigDecimal("0");
 BigDecimal salesTaxOutTot = new BigDecimal("0");
@@ -46,31 +59,38 @@
 BigDecimal MiscOutTot = new BigDecimal("0");
 BigDecimal totalValueTot = new BigDecimal("0");
 
-// first get the list of companies
-List invoiceList = new LinkedList();
+// set up basic search condition for the invoiceTable
+// avoid invoices which are cancelled and only select with the according prefixes
+EntityExpr invoiceNotCancelled = new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "INVOICE_CANCELLED");
+EntityExpr invoicePrefixExpr = new EntityExpr("invoiceId", EntityOperator.LIKE, prefix.concat("%"));
+// the date of the requested year
+List dateExprs = new LinkedList();
+	dateExprs.add(new EntityExpr("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, startDate));
+	dateExprs.add(new EntityExpr("invoiceDate", EntityOperator.LESS_THAN_EQUAL_TO, endDate));
 
+// set up basic search condition for the party Table
+List partyExp = new LinkedList();
+// only selected partyIds with invoiceprefix
+partyExp.add(new EntityExpr("partyId", EntityOperator.LIKE, prefix.concat("%")));
+if (organizationPartyId.equals("anet")) {
+	partyExp.add(new EntityExpr("partyId", EntityOperator.EQUALS, "BelastingDienst"));
+	partyExp.add(new EntityExpr("partyId", EntityOperator.EQUALS, "Sidin"));
+	partyExp.add(new EntityExpr("partyId", EntityOperator.EQUALS, "Stulemeijer"));
+}
+EntityCondition partyCond = new EntityConditionList(partyExp, EntityOperator.OR);
 
+List orderList = new LinkedList();
+orderList.add("partyId");
 
-// check companies who have invoices from/to thye organizationParty but no relation
-
-parties = delegator.findAll("Party");
-Iterator p = parties.iterator();
-while (p.hasNext())	{
-	party = p.next();
-	List rel = delegator.findByAnd("PartyRelationship",UtilMisc.toMap("partyIdTo",party.getString("partyId")));
-	if (rel == null || rel.size() == 0)	{
-		invoices = delegator.findByAnd("Invoice",UtilMisc.toMap("partyIdFrom",party.getString("partyId")));
-		if (invoices != null && invoices.size() != 0) Debug.logInfo("!!!!!!!!!!(partyIdFrom)" + party.getString("partyId") + " InvoiceId:" + invoices.get(0).getString("invoiceId"),"ListInvoices.bsh");
-		invoices = delegator.findByAnd("Invoice",UtilMisc.toMap("partyId",party.getString("partyId")));
-		if (invoices != null  && invoices.size() != 0) Debug.logInfo("!!!!!!!!!!(party)" + party.getString("partyId") + " InvoiceId:" + invoices.get(0).getString("invoiceId"),"???????");
-	}
-}
-
-companies = delegator.findByAnd("PartyRelationshipAndPartyDetail",UtilMisc.toMap("partyIdFrom",organizationPartyId));
+companies = delegator.findByCondition("PartyNameView",partyCond, null, orderList);
+List invoiceList = new LinkedList(); // list to put on screen
+List compCheck = new LinkedList();	// for crosschecking totals
 Iterator comp = companies.iterator();
 while (comp.hasNext())	{
 	company = comp.next();
 	partyId = company.getString("partyId");
+	compCheck.add(partyId);
+	if (partyId.equals(organizationPartyId)) continue;  // do not process own company
 	name = company.getString("groupName");
 	if (name == null) 	{
 		if (company.getString("lastName") != null)	{
@@ -89,56 +109,69 @@
 	BigDecimal totalValue = new BigDecimal("0");
 
 	// purchase invoices
-	invoices = delegator.findByAnd("Invoice",UtilMisc.toMap("partyIdFrom",partyId));
+	List pExprs = new LinkedList();
+		pExprs.add(invoicePrefixExpr);												// prefix
+		pExprs.add(new EntityExpr("partyIdFrom", EntityOperator.EQUALS, partyId));	// party
+		pExprs.add(new EntityConditionList(dateExprs, EntityOperator.AND));			// date limitation
+		pExprs.add(invoiceNotCancelled);											// not cancelled
+	EntityCondition pinvoiceCond = new EntityConditionList(pExprs, EntityOperator.AND);
+	invoices = delegator.findByCondition("Invoice",pinvoiceCond,null,null);
 	Iterator inv = invoices.iterator();
 	while (inv.hasNext())	{
 		invoice = inv.next();
-		if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) continue;
-
 		invoiceItems = invoice.getRelated("InvoiceItem");
 		Iterator invit = invoiceItems.iterator();
 		while (invit.hasNext())	{
 			invoiceItem = invit.next();
+			BigDecimal total = new BigDecimal("0");
+			if (invoiceItem.getBigDecimal("amount") != null) {
+				if (invoiceItem.getBigDecimal("quantity") != null)
+					total = invoiceItem.getBigDecimal("amount").multiply(invoiceItem.getBigDecimal("quantity")).setScale(2,4);
+				else
+					total = invoiceItem.getBigDecimal("amount").setScale(2,4);
+			}
 			if (invoiceItem.getString("invoiceItemTypeId").equals("PINV_SALES_TAX"))	{
-				salesTaxOut = salesTaxOut.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-				salesTaxOutTot = salesTaxOutTot.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
+				salesTaxOut = salesTaxOut.add(total);
+				salesTaxOutTot = salesTaxOutTot.add(total);
 			}
-			else if (invoiceItem.getString("invoiceItemTypeId").equals("PINV_SPROD_ITEM"))	{
-				expenses = expenses.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-				expensesTot = expensesTot.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
+			else {
+				expenses = expenses.add(total);
+				expensesTot = expensesTot.add(total);
 			}
-			else if (invoiceItem.getString("invoiceItemTypeId").equals("PINV_MISC_CHARGE"))	{
-				MiscOut = MiscOut.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-				MiscOutTot = MiscOutTot.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-			}
-			else	{	Debug.logInfo(" not registered invoiceItem: " + invoiceItem.getString("invoiceItemTypeId") + " invoiceId: " + invoiceItem.getString("invoiceId") + " itemId: " + invoiceItem.getString("invoiceItemSeqId") ,"ListInvoices.bsh"); }
 		}
 	}
 			
 	// Sales invoices
-	invoices = delegator.findByAnd("Invoice",UtilMisc.toMap("partyId",partyId));
+	List sExprs = new LinkedList();
+		sExprs.add(invoicePrefixExpr);												// prefix
+		sExprs.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId));		// party
+		sExprs.add(new EntityConditionList(dateExprs, EntityOperator.AND));			// date limitation
+		sExprs.add(invoiceNotCancelled);											// not cancelled
+	EntityCondition sinvoiceCond = new EntityConditionList(sExprs, EntityOperator.AND);
+	
+	invoices = delegator.findByCondition("Invoice",sinvoiceCond,null,null);
 	Iterator inv = invoices.iterator();
 	while (inv.hasNext())	{
 		invoice = inv.next();
-		if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) continue; // ignore cancelled invoices
 		invoiceItems = invoice.getRelated("InvoiceItem");
 		Iterator invit = invoiceItems.iterator();
 		while (invit.hasNext())	{
 			invoiceItem = invit.next();
+			BigDecimal total = new BigDecimal("0");
+			if (invoiceItem.getBigDecimal("amount") != null) {
+				if (invoiceItem.getBigDecimal("quantity") != null)
+					total = invoiceItem.getBigDecimal("amount").multiply(invoiceItem.getBigDecimal("quantity")).setScale(2,4);
+				else
+					total = invoiceItem.getBigDecimal("amount").setScale(2,4);
+			}
 			if (invoiceItem.getString("invoiceItemTypeId").equals("INV_SALES_TAX"))	{
-				salesTaxIn = salesTaxIn.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-				salesTaxInTot = salesTaxInTot.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
+				salesTaxIn = salesTaxIn.add(total);
+				salesTaxInTot = salesTaxInTot.add(total);
 			}
-			else if (invoiceItem.getString("invoiceItemTypeId").equals("INV_SPROD_ITEM"))	{
-				revenue = revenue.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-				revenueTot = revenueTot.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
+			else {
+				revenue = revenue.add(total);
+				revenueTot = revenueTot.add(total);
 			}
-			else if (invoiceItem.getString("invoiceItemTypeId").equals("INV_MISC_CHARGE"))	{
-				MiscIn = MiscIn.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-				MiscInTot = MiscInTot.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
-			}
-			 else	{	Debug.logInfo(" not registered payment: " + 
-			 					invoiceItem.getString("invoiceItemTypeId") + "Id:" + invoiceItem.getString("invoiceId") +"/" + invoiceItem.getString("invoiceItemSeqId"),"??"); }
 		}
 	}
 			
@@ -149,7 +182,7 @@
 	listItem.put("miscOut", MiscOut.toString());
 	BigDecimal totalValue = salesTaxIn.add(salesTaxOut).add(revenue).add(expenses).add(MiscOut).add(MiscIn);
 	listItem.put("totalValue", totalValue.toString());
-	invoiceList.add(listItem);
+	if (!totalValue.equals(new BigDecimal("0"))) invoiceList.add(listItem);
 }
 
 Map listItem = UtilMisc.toMap("company","Total.","name", " ", "salesTaxIn",salesTaxInTot,"salesTaxOut",salesTaxOutTot);
@@ -163,19 +196,53 @@
 
 // create total check of all values
 BigDecimal generalTotal = new BigDecimal("0");
-ii = delegator.findAll("InvoiceItem");
+ii = delegator.findByCondition("InvoiceItem",invoicePrefixExpr,null,null);
 	Iterator it = ii.iterator();
 	while (it.hasNext())	{
 		invoiceItem = it.next();
 		GenericValue invoice = invoiceItem.getRelatedOne("Invoice");
-			if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) continue; // ignore cancelled items
 		if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) continue; // ignore cancelled items
-		if (!invoice.getString("partyIdFrom").equals(organizationPartyId) &&
-					!invoice.getString("partyId").equals(organizationPartyId)) continue; // only items from organization party id
-		if (invoiceItem.getBigDecimal("amount") != null)
-			generalTotal = generalTotal.add(invoiceItem.getBigDecimal("amount")).setScale(2,4);
+		if (invoice.getTimestamp("invoiceDate").before(startDate)) continue;
+		if (invoice.getTimestamp("invoiceDate").after(endDate)) continue;
+		BigDecimal total = new BigDecimal("0");
+		if (invoiceItem.getBigDecimal("amount") != null) {
+			if (invoiceItem.getBigDecimal("quantity") != null)
+				total = invoiceItem.getBigDecimal("amount").multiply(invoiceItem.getBigDecimal("quantity")).setScale(2,4);
+			else
+				total = invoiceItem.getBigDecimal("amount").setScale(2,4);
+		}
+		if (compCheck.indexOf(invoice.getString("partyId")) == -1) {
+			Debug.logInfo(" not found to Party (" + invoice.getString("partyId") + ") in list: " + 
+			 					invoiceItem.getString("invoiceItemTypeId") + " Id:" + invoiceItem.getString("invoiceId") +"/" + invoiceItem.getString("invoiceItemSeqId")  + " value: " + total,"ListInvoices.bsh");
+			continue;
+		}
+		if (compCheck.indexOf(invoice.getString("partyIdFrom")) == -1) {
+			Debug.logInfo(" not found from Party (" + invoice.getString("partyIdFrom") + ") in list: " + 
+			 					invoiceItem.getString("invoiceItemTypeId") + " Id:" + invoiceItem.getString("invoiceId") +"/" + invoiceItem.getString("invoiceItemSeqId") + " value: " + total,"ListInvoices.bsh");
+			continue;
+		}
+		generalTotal = generalTotal.add(total);
 	}
-Map listItem = UtilMisc.toMap("company","GeneralTotal","totalValue", generalTotal);
-invoiceList.add(listItem);
+invoiceList.add(UtilMisc.toMap("company","GeneralTotal","totalValue", generalTotal));
 
-context.put("invoiceList",invoiceList);
\ No newline at end of file
+/*  testing
+BigDecimal invoiceTotal = new BigDecimal("0");
+	List invExprs = new LinkedList();
+		invExprs.add(invoicePrefixExpr);												// prefix
+		invExprs.add(new EntityExpr("invoiceTypeId", EntityOperator.EQUALS, "PURCHASE_INVOICE"));
+		invExprs.add(new EntityConditionList(dateExprs, EntityOperator.AND));			// date limitation
+		invExprs.add(invoiceNotCancelled);											// not cancelled
+	EntityCondition invCond = new EntityConditionList(invExprs, EntityOperator.AND);
+jj = delegator.findByCondition("Invoice",invCond,null,null);
+	Iterator inv = jj.iterator();
+	while (inv.hasNext())	{
+		invoice = inv.next();
+		invoiceTotal = invoiceTotal.add(InvoiceWorker.getInvoiceTotalBd(invoice));
+	}
+	Debug.logInfo("Invoice file total for prefix :" + prefix + " -- " + invoiceTotal,"");	
+*/
+
+
+context.put("invoiceList",invoiceList);
+context.put("year",year);
+context.put("organizationPartyId",organizationPartyId);
\ No newline at end of file

Modified: trunk/specialized/opentravelsystem/webapp/newShop/data/ShopData.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/newShop/data/ShopData.xml	2006-02-11 20:26:37 UTC (rev 6718)
+++ trunk/specialized/opentravelsystem/webapp/newShop/data/ShopData.xml	2006-02-12 03:12:29 UTC (rev 6719)
@@ -127,6 +127,10 @@
     <ProductAssoc productId="shop10002" productIdTo="shop1000002" productAssocTypeId="PRODUCT_VARIANT" fromDate="2006-01-23 09:54:21.076" reason="" instruction="" lastUpdatedStamp="2006-01-23 09:54:21.098" lastUpdatedTxStamp="2006-01-23 09:54:21.096" createdStamp="2006-01-23 09:54:21.098" createdTxStamp="2006-01-23 09:54:21.096"/>
     <ProductAssoc productId="shop10002" productIdTo="shop1000003" productAssocTypeId="PRODUCT_VARIANT" fromDate="2006-01-23 09:54:21.076" reason="" instruction="" lastUpdatedStamp="2006-01-23 09:54:21.098" lastUpdatedTxStamp="2006-01-23 09:54:21.096" createdStamp="2006-01-23 09:54:21.098" createdTxStamp="2006-01-23 09:54:21.096"/>
     <ProductAssoc productId="shop10002" productIdTo="shop1000004" productAssocTypeId="PRODUCT_VARIANT" fromDate="2006-01-23 09:54:21.076" reason="" instruction="" lastUpdatedStamp="2006-01-23 09:54:21.098" lastUpdatedTxStamp="2006-01-23 09:54:21.096" createdStamp="2006-01-23 09:54:21.098" createdTxStamp="2006-01-23 09:54:21.096"/>
+
+    <!-- set next to be used sequence number for new products/categories -->
+    <SequenceValueItem seqName="shopProductCategory" seqId="10003"/> 
+    <SequenceValueItem seqName="shopProduct" seqId="10003"/> 
     
     <!-- security -->
     <SecurityGroup groupId="shop" description="full access to shop information"/><!-- same as the organizationPartyId -->

Added: trunk/specialized/opentravelsystem/webapp/newShop/html/images/company.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/specialized/opentravelsystem/webapp/newShop/html/images/company.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the Svn mailing list