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

hansbak at svn.ofbiz.org hansbak at svn.ofbiz.org
Mon Oct 31 08:22:48 EST 2005


Author: hansbak
Date: 2005-10-31 07:22:10 -0600 (Mon, 31 Oct 2005)
New Revision: 6048

Modified:
   trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/Utilities.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/AccountingForms.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml
Log:
opentravelsystem small fault fixes

Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/Utilities.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/Utilities.xml	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/Utilities.xml	2005-10-31 13:22:10 UTC (rev 6048)
@@ -23,8 +23,8 @@
  * @version 1.0
  -->
  
- <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-     xsi:noNamespaceSchemaLocation="file:/home/hans/ofbiz/framework/minilang/dtd/simple-methods.xsd">
+ <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="file:/home/hans/ofbiz/framework/minilang/dtd/simple-methods.xsd">
      
      <!-- create an invoice from a payment and apply the payment -->
      <simple-method method-name="CreateInvoicesFromPayments" short-description="--Create an Invoice header and detail records from a payment">
@@ -44,125 +44,148 @@
                  </condition-list>
              </condition-list>
          </entity-condition>
-         <calculate field-name="invoicesCreated"><number value="0"/></calculate>
+         <calculate field-name="invoicesCreated"><number value="0"/></calculate><!-- counter for totals..... -->
          <iterate entry-name="payment" list-name="payments">
-             <!-- only select payments which do not have been (partly) applied -->
+             <!-- only select payments which do not have been (partly) applied and optionally generate also sales invoices-->
              <get-related value-name="payment" relation-name="PaymentApplication" list-name="paymentApplications"/>
-             <if-empty field-name="paymentApplications">     
-                 <transaction-begin/>
-                 <!--  create invoice header -->
-                 <set from-field="payment.partyIdFrom" field="invoice.partyId"/>
-                 <set from-field="payment.partyIdTo" field="invoice.partyIdFrom"/>
-                 <set from-field="payment.currencyUomId" field="invoice.currencyUomId"/>
-                 <set from-field="payment.effectiveDate" field="invoice.invoiceDate"/>
-                 <set from-field="payment.effectiveDate" field="invoice.dueDate"/>
-                 <set value="Generated from Payment ${payment.paymentId}" field="invoice.description"/>
-                 <set value="INVOICE_IN_PROCESS" field="invoice.statusId"/>
-                 <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
-                     <set value="PURCHASE_INVOICE" field="invoice.invoiceTypeId"/>
-                     <else>
-                         <set value="SALES_INVOICE" field="invoice.invoiceTypeId"/>
-                     </else>
-                 </if-compare>
-                 <call-service service-name="createInvoice" in-map-name="invoice">
-                     <result-to-field result-name="invoiceId" field-name="invoiceId"/>
-                 </call-service>
-                 
-                 <calculate field-name="invoicesCreated">
-                     <calcop operator="add">
-                         <calcop operator="get" field-name="invoicesCreated"/>
-                         <number value="1"/>
-                     </calcop>
-                 </calculate>
-
-                 <!-- check if party does not need a sales tax -->
-                 <make-value value-name="partyTaxInfo" entity-name="PartyTaxInfo"/>
-                 <set field="partyTaxInfo.partyId" from-field="payment.partyIdTo"/>
-                 <set field="partyTaxInfo.geoId" value="NLD"/>
-                 <find-by-and entity-name="PartyTaxInfo" map-name="partyTaxInfo" list-name="partyTaxInfos"/>
-                 <filter-list-by-date list-name="partyTaxInfos"/>
-                 <first-from-list entry-name="partyTaxInfo" list-name="partyTaxInfos"/>
-                 
-                 <set value="${invoiceId}" field="invoiceItem.invoiceId"/>
-                
-                 <if-compare field-name="partyTaxInfo.isExempt" value="Y" operator="equals">
-                     <!--  create one item record only  -->
-                     <set value="N" field="invoiceItem.taxableFlag"/>
-                     <set field="invoiceItem.amount" from-field="payment.amount"/>
+             <if>
+                 <condition>
+                     <and>
+                         <if-empty field-name="paymentApplications"/>
+                         <or>
+                             <not>
+                                 <if-empty field-name="parameters.generateSalesInvoicesToo"/>
+                             </not>
+                             <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}"/>
+                         </or>     
+                     </and>
+                 </condition>
+                 <then>
+                     
+                     <transaction-begin/>
+                     <!--  create invoice header -->
+                     <set from-field="payment.partyIdFrom" field="invoice.partyId"/>
+                     <set from-field="payment.partyIdTo" field="invoice.partyIdFrom"/>
+                     <set from-field="payment.currencyUomId" field="invoice.currencyUomId"/>
+                     <set from-field="payment.effectiveDate" field="invoice.invoiceDate"/>
+                     <set from-field="payment.effectiveDate" field="invoice.dueDate"/>
+                     <set value="Generated from Payment ${payment.paymentId}" field="invoice.description"/>
+                     <set value="INVOICE_IN_PROCESS" field="invoice.statusId"/>
                      <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
-                         <set value="PINV_MISC_CHARGE" field="invoiceItem.invoiceItemTypeId"/>
-                     <else>
-                         <set value="INV_MISC_CHARGE" field="invoiceItem.invoiceItemTypeId"/>
-                     </else>
+                         <set value="PURCHASE_INVOICE" field="invoice.invoiceTypeId"/>
+                         <else>
+                             <set value="SALES_INVOICE" field="invoice.invoiceTypeId"/>
+                         </else>
                      </if-compare>
-                     <set value="Amount no VAT required" field="invoiceItem.description"/>
-                     <call-service service-name="createInvoiceItem" in-map-name="invoiceItem"/>
-
-                 <else> <!-- apply the sales tax -->
-                                                 
-                         <!-- first invoiceItem -->
-                         <set value="Y" field="invoiceItem.taxableFlag"/>
-                         <calculate field-name="invoiceItem.amount" rounding-mode="HalfUp" >
-                             <calcop operator="divide">
-                                 <calcop operator="multiply">
-                                     <calcop operator="get" field-name="payment.amount"/>
-                                     <number value="100"/>
-                                 </calcop>
-                                 <number value="119"/>
-                             </calcop>
-                         </calculate>
+                     <call-service service-name="createInvoice" in-map-name="invoice">
+                         <result-to-field result-name="invoiceId" field-name="invoiceId"/>
+                     </call-service>
+                     
+                     <calculate field-name="invoicesCreated">
+                         <calcop operator="add">
+                             <calcop operator="get" field-name="invoicesCreated"/>
+                             <number value="1"/>
+                         </calcop>
+                     </calculate>
+                     
+                     <!-- check if party does not need a sales tax -->
+                     <make-value value-name="partyTaxInfo" entity-name="PartyTaxInfo"/>
+                     <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
+                         <set field="partyTaxInfo.partyId" from-field="payment.partyIdTo"/>
+                         <else>
+                             <set field="partyTaxInfo.partyId" from-field="payment.partyIdFrom"/>
+                         </else>
+                     </if-compare>
+                     <set field="partyTaxInfo.geoId" value="NLD"/>
+                     <find-by-and entity-name="PartyTaxInfo" map-name="partyTaxInfo" list-name="partyTaxInfos"/>
+                     <filter-list-by-date list-name="partyTaxInfos"/>
+                     <first-from-list entry-name="partyTaxInfo" list-name="partyTaxInfos"/>
+                     
+                     <set value="${invoiceId}" field="invoiceItem.invoiceId"/>
+                     
+                     <if-compare field-name="partyTaxInfo.isExempt" value="Y" operator="equals">
+                         <!--  create one item record only  -->
+                         <set value="N" field="invoiceItem.taxableFlag"/>
+                         <set field="invoiceItem.amount" from-field="payment.amount"/>
                          <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
-                             <set value="PINV_SPROD_ITEM" field="invoiceItem.invoiceItemTypeId"/>
+                             <if-compare field-name="payment.paymentTypeId" value="SALES_TAX_PAYMENT" operator="equals">
+                                 <set value="PINV_SALES_TAX" field="invoiceItem.invoiceItemTypeId"/>
+                                 <else>
+                                     <set value="PINV_SPROD_ITEM" field="invoiceItem.invoiceItemTypeId"/>
+                                 </else>
+                             </if-compare>
                              <else>
-                                 <set value="INV_SPROD_ITEM" field="invoiceItem.invoiceItemTypeId"/>
+                                 <if-compare field-name="payment.paymentTypeId" value="SALES_TAX_PAYMENT" operator="equals">
+                                     <set value="INV_SALES_TAX" field="invoiceItem.invoiceItemTypeId"/>
+                                     <else>
+                                         <set value="INV_MISC_CHARGE" field="invoiceItem.invoiceItemTypeId"/>
+                                     </else>
+                                 </if-compare>
                              </else>
                          </if-compare>
-                         <set value="Amount ex. VAT" field="invoiceItem.description"/>
+                         <set value="Amount no VAT required" field="invoiceItem.description"/>
                          <call-service service-name="createInvoiceItem" in-map-name="invoiceItem"/>
                          
-                         <!-- second record: create VAT record -->            
-                         <calculate field-name="invoiceItem.amount" rounding-mode="HalfUp" >
-                             <calcop operator="divide">
-                                 <calcop operator="multiply">
-                                     <calcop operator="get" field-name="payment.amount"/>
-                                     <number value="19"/>
+                         <else> <!-- apply the sales tax -->
+                             
+                             <!-- first invoiceItem -->
+                             <set value="Y" field="invoiceItem.taxableFlag"/>
+                             <calculate field-name="invoiceItem.amount" rounding-mode="HalfUp" >
+                                 <calcop operator="divide">
+                                     <calcop operator="multiply">
+                                         <calcop operator="get" field-name="payment.amount"/>
+                                         <number value="100"/>
+                                     </calcop>
+                                     <number value="119"/>
                                  </calcop>
-                                 <number value="119"/>
-                             </calcop>
-                         </calculate>
-                         <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
-                             <set value="PINV_SALES_TAX" field="invoiceItem.invoiceItemTypeId"/>
-                             <else>
-                                 <set value="INV_SALES_TAX" field="invoiceItem.invoiceItemTypeId"/>
-                             </else>
-                         </if-compare>
-                         <set value="VAT 19%" field="invoiceItem.description"/>
-                         <call-service service-name="createInvoiceItem" in-map-name="invoiceItem"/>
-                 </else>                     
-                 </if-compare>
-                 
-                 <!-- apply the payment to the invoice -->
-                 <set value="${invoiceId}" field="application.invoiceId"/>
-                 <set from-field="payment.paymentId" field="application.paymentId"/>
-                 <call-service service-name="updatePaymentApplication" in-map-name="application"/>
-                 
-                 <!-- change the payment status to confirmed if fully applied -->
-                 <set field="notApplied" value="${bsh:org.ofbiz.accounting.payment.PaymentExtWorker.getPaymentApplied(payment)}"/>
-                 <if-compare field-name="notApplied" value="0.000001" operator="less" format="Double">
-                     <set-service-fields service-name="updatePayment" map-name="payment" to-map-name="updPayment"/>
-                     <set field="updPayment.statusId" value="PMNT_CONFIRMED"/>
-                     <call-service service-name="updatePayment"/>
-                 </if-compare>
-             </if-empty>
-             <if-compare field-name="invoicesCreated" value="100" operator="greater" type="Double">
+                             </calculate>
+                             <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
+                                 <set value="PINV_SPROD_ITEM" field="invoiceItem.invoiceItemTypeId"/>
+                                 <else>
+                                     <set value="INV_SPROD_ITEM" field="invoiceItem.invoiceItemTypeId"/>
+                                 </else>
+                             </if-compare>
+                             <set value="Amount ex. VAT" field="invoiceItem.description"/>
+                             <call-service service-name="createInvoiceItem" in-map-name="invoiceItem"/>
+                             
+                             <!-- second record: create VAT record -->            
+                             <calculate field-name="invoiceItem.amount" rounding-mode="HalfUp" >
+                                 <calcop operator="divide">
+                                     <calcop operator="multiply">
+                                         <calcop operator="get" field-name="payment.amount"/>
+                                         <number value="19"/>
+                                     </calcop>
+                                     <number value="119"/>
+                                 </calcop>
+                             </calculate>
+                             <if-compare field-name="payment.partyIdFrom" operator="equals" value="${parameters.organizationPartyId}">
+                                 <set value="PINV_SALES_TAX" field="invoiceItem.invoiceItemTypeId"/>
+                                 <else>
+                                     <set value="INV_SALES_TAX" field="invoiceItem.invoiceItemTypeId"/>
+                                 </else>
+                             </if-compare>
+                             <set value="VAT 19%" field="invoiceItem.description"/>
+                             <call-service service-name="createInvoiceItem" in-map-name="invoiceItem"/>
+                         </else>                     
+                     </if-compare>
+                     
+                     <!-- apply the payment to the invoice -->
+                     <set value="${invoiceId}" field="application.invoiceId"/>
+                     <set from-field="payment.paymentId" field="application.paymentId"/>
+                     <clear-field field-name="application.amountApplied"/>
+                     <call-service service-name="updatePaymentApplication" in-map-name="application"/>
+                     
+                 </then>
+             </if>
+             <if-compare field-name="invoicesCreated" value="100" operator="greater-equals" type="Double">
                  <to-string field-name="invoicesCreated"/>
-                 <string-append field-name="invoicesCreated" string=" invoices created"/>
+                 <string-append field-name="invoicesCreated" string=" invoices created, more to be processed, rerun action....."/>
                  <set value="${invoicesCreated}" field="_event_message_"/>
                  <return/>                 
              </if-compare>
          </iterate>
          <to-string field-name="invoicesCreated"/>
-         <string-append field-name="invoicesCreated" string=" invoices created"/>
+         <string-append field-name="invoicesCreated" string=" invoices created, all processed."/>
          <set value="${invoicesCreated}" field="_event_message_"/>
      </simple-method>
 
@@ -196,7 +219,7 @@
                  <set field="param.statusId" value="PMNT_RECEIVED"/>
              </if-compare-field>
              
-             <call-service service-name="updatePayment" in-map-name="param">
+             <call-service service-name="setPaymentStatus" in-map-name="param">
                  <result-to-result result-name="result" service-result-name="result"/>
              </call-service>
              
@@ -209,7 +232,7 @@
              </calculate>
              
              <transaction-commit/>
-             <if-compare field-name="paymentsUpdated" value="100" operator="greater"  type="Double">
+             <if-compare field-name="paymentsUpdated" value="100" operator="greater-equals"  type="Double">
                  <to-string field-name="paymentsUpdated"/>
                  <string-append field-name="paymentsUpdated" string=" payments updated"/>
                  <set value="${paymentsUpdated}" field="_event_message_"/>
@@ -243,91 +266,79 @@
          <calculate field-name="invoicesUpdated"><number value="0"/></calculate>
          <calculate field-name="paymentsUpdated"><number value="0"/></calculate>
          <iterate entry-name="payment" list-name="payments">
+             <log level="always" message="Processing Payment ${payment.paymentId}"></log>
              <!-- only process fully applied payments -->
-             <set field="applied" value="${bsh:org.ofbiz.accounting.payment.PaymentExtWorker.getPaymentApplied(payment)}" type="Double"/>
-             <calculate field-name="notApplied">
-                 <calcop operator="subtract">
-                     <calcop operator="get" field-name="payment.amount"></calcop>
-                     <calcop operator="get" field-name="applied"></calcop>
-                 </calcop>
-             </calculate>
-             <if-compare field-name="notApplied" operator="less" value="0.000001" type="Double">
-                 <transaction-begin/>
-                 <set field="payment.statusId" value="PMNT_CONFIRMED"/>
-                 <store-value value-name="payment"/>
-                 <check-errors/>                 
+             <set field="applied" value="${bsh:org.ofbiz.accounting.payment.PaymentExtWorker.getPaymentAppliedBd(payment)}" />
+             <if-compare-field field-name="applied" operator="equals" to-field-name="payment.amount" type="Double">
+                 <set field="updStatus.statusId" value="PMNT_CONFIRMED"/>
+                 <set field="updStatus.paymentId" from-field="payment.paymentId"/>
+                 <call-service service-name="setPaymentStatus" in-map-name="updStatus"/>
                  <calculate field-name="paymentsUpdated">
                      <calcop operator="add">
                          <calcop operator="get" field-name="paymentsUpdated"/>
                          <number value="1"/>
                      </calcop>
                  </calculate>
-                 <!-- find related invoices -->
-                 <get-related value-name="payment" relation-name="PaymentApplication" list-name="paymentApplications"/>
-                 <first-from-list entry-name="paymentApplication" list-name="paymentApplications"/>
-                 <get-related value-name="paymentApplication" relation-name="Invoice" list-name="invoices"/>
-                 <first-from-list entry-name="invoice" list-name="invoices"/>
-                 <set field="applied" value="${bsh:org.ofbiz.accounting.invoice.InvoiceExtWorker.getInvoiceApplied(invoice)}" type="Double"/>
-                 <set field="total" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(invoice)}" type="Double"/>
-                 <calculate field-name="notApplied" type="Double">
-                     <calcop operator="subtract">
-                         <calcop operator="get" field-name="total"/>
-                         <calcop operator="get" field-name="applied"/>
-                     </calcop>
-                 </calculate>
-                 <if-compare field-name="notApplied" operator="less" value="0.000001" type="Double">
-                     
-                     <set-service-fields service-name="setInvoiceStatus" map-name="invoice" to-map-name="param"/>
-                     <if-compare field-name="invoice.invoiceTypeId" value="SALES_INVOICE" operator="equals">
-                         <if-compare field-name="param.statusId" value="INVOICE_IN_PROCESS" operator="equals">
-                             <set field="param.statusId" value="INVOICE_READY"/>
-                             <call-service service-name="setInvoiceStatus" in-map-name="param"/>
-                         </if-compare>
-                         <if-compare field-name="param.statusId" value="INVOICE_READY" operator="equals">
-                             <set field="param.statusId" value="INVOICE_SENT"/>
-                             <call-service service-name="setInvoiceStatus" in-map-name="param"/>
-                         </if-compare>
-                         <if-compare field-name="param.statusId" value="INVOICE_SENT" operator="equals">
-                             <set field="param.statusId" value="INVOICE_PAID"/>
-                             <call-service service-name="setInvoiceStatus" in-map-name="param"/>
-                         </if-compare>
+             </if-compare-field>
+         </iterate>
+         <!-- find invoices with the status non paid and which are fully applied -->
+         <entity-condition entity-name="Invoice" list-name="invoices">
+             <condition-list combine="and">
+                 <condition-expr field-name="statusId" operator="not-equals" value="INVOICE_PAID"/>
+             </condition-list>
+         </entity-condition>
+         <iterate entry-name="invoice" list-name="invoices">
+             <set field="notApplied" value="${bsh:org.ofbiz.accounting.invoice.InvoiceExtWorker.getInvoiceNotApplied(invoice)}"/>
+             <log level="always" message="Looking at Invoice ${invoice.invoiceId} not applied value: ${notApplied}"></log>
+             <if-compare field-name="notApplied" operator="equals" value="0.00"> <!-- only fully applied invoices required -->
+                 <log level="always" message="Processing Invoice ${invoice.invoiceId}"></log>
+                 <set-service-fields service-name="setInvoiceStatus" map-name="invoice" to-map-name="param"/>
+                 <if-compare field-name="invoice.invoiceTypeId" value="SALES_INVOICE" operator="equals">
+                     <if-compare field-name="param.statusId" value="INVOICE_IN_PROCESS" operator="equals">
+                         <set field="param.statusId" value="INVOICE_READY"/>
+                         <call-service service-name="setInvoiceStatus" in-map-name="param"/>
                      </if-compare>
-                     
-                     <if-compare field-name="invoice.invoiceTypeId" value="PURCHASE_INVOICE" operator="equals">
-                         <if-compare field-name="param.statusId" value="INVOICE_IN_PROCESS" operator="equals">
-                             <set field="param.statusId" value="INVOICE_RECEIVED"/>
-                             <call-service service-name="setInvoiceStatus" in-map-name="param"/>
-                         </if-compare>
-                         <if-compare field-name="param.statusId" value="INVOICE_RECEIVED" operator="equals">
-                             <set field="param.statusId" value="INVOICE_PAID"/>
-                             <call-service service-name="setInvoiceStatus" in-map-name="param"/>
-                         </if-compare>
+                     <if-compare field-name="param.statusId" value="INVOICE_READY" operator="equals">
+                         <set field="param.statusId" value="INVOICE_SENT"/>
+                         <call-service service-name="setInvoiceStatus" in-map-name="param"/>
                      </if-compare>
-                     
-                     <check-errors/>                 
-
-                     <calculate field-name="invoicesUpdated">
-                         <calcop operator="add">
-                             <calcop operator="get" field-name="invoicesUpdated"/>
-                             <number value="1"/>
-                         </calcop>
-                     </calculate>
-                     <if-compare field-name="invoicesUpdated" operator="greater" value="100" type="Double">
-                         <set field="message" value="Posting payments and related invoices. "/>
-                         <to-string field-name="invoicesUpdated"/>
-                         <string-append field-name="message"  string="${invoicesUpdated}"/>
-                         <string-append field-name="message" string=" invoices updated"/>
-                         <to-string field-name="paymentsUpdated"/>
-                         <string-append field-name="message"  string="${paymentsUpdated}"/>
-                         <string-append field-name="message" string=" payments updated"/>
-                         <set value="${message}" field="_event_message_"/>
-                         <return/>
+                     <if-compare field-name="param.statusId" value="INVOICE_SENT" operator="equals">
+                         <set field="param.statusId" value="INVOICE_PAID"/>
+                         <call-service service-name="setInvoiceStatus" in-map-name="param"/>
                      </if-compare>
-
-                     
                  </if-compare>
-              <transaction-commit/>
+                 
+                 <if-compare field-name="invoice.invoiceTypeId" value="PURCHASE_INVOICE" operator="equals">
+                     <if-compare field-name="param.statusId" value="INVOICE_IN_PROCESS" operator="equals">
+                         <set field="param.statusId" value="INVOICE_RECEIVED"/>
+                         <call-service service-name="setInvoiceStatus" in-map-name="param"/>
+                     </if-compare>
+                     <if-compare field-name="param.statusId" value="INVOICE_RECEIVED" operator="equals">
+                         <set field="param.statusId" value="INVOICE_PAID"/>
+                         <call-service service-name="setInvoiceStatus" in-map-name="param"/>
+                     </if-compare>
+                 </if-compare>
              </if-compare>
+             
+             <check-errors/>                 
+             
+             <calculate field-name="invoicesUpdated">
+                 <calcop operator="add">
+                     <calcop operator="get" field-name="invoicesUpdated"/>
+                     <number value="1"/>
+                 </calcop>
+             </calculate>
+             <if-compare field-name="invoicesUpdated" operator="greater" value="99" type="Double">
+                 <set field="message" value="Posting payments and related invoices. "/>
+                 <to-string field-name="invoicesUpdated"/>
+                 <string-append field-name="message"  string="${invoicesUpdated}"/>
+                 <string-append field-name="message" string=" invoices updated"/>
+                 <to-string field-name="paymentsUpdated"/>
+                 <string-append field-name="message"  string="${paymentsUpdated}"/>
+                 <string-append field-name="message" string=" payments updated"/>
+                 <set value="${message}" field="_event_message_"/>
+                 <return/>
+             </if-compare>
          </iterate>
          <set field="message" value="Posting payments and related invoices. "/>
          <to-string field-name="invoicesUpdated"/>
@@ -338,4 +349,5 @@
          <string-append field-name="message" string=" payments updated"/>
          <set value="${message}" field="_event_message_"/>
      </simple-method>    
+     
  </simple-methods>
\ No newline at end of file

Modified: trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java
===================================================================
--- trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java	2005-10-31 13:22:10 UTC (rev 6048)
@@ -187,7 +187,7 @@
 			else	{ // credit
 			if (otherParty.equals(taxAuthPartyId) || accountPartyId.equals(taxAuthPartyId))
 					payment.put("paymentTypeId","SALES_TAX_PAYMENT");
-				else 
+						else 
 					payment.put("paymentTypeId","VENDOR_PAYMENT");
 				payment.put("partyIdTo",otherParty);
 				payment.put("partyIdFrom", accountPartyId);    		
@@ -200,26 +200,23 @@
 			if (debug) Debug.logInfo("Creating payment with reference number: " + payment.get("paymentRefNum"),module);
 			if (checkPayment() == true)	{
 				paymentAlreadyUploaded++;
-				if (debug) Debug.logInfo("Payment already exists....",module);
+				if (debug) Debug.logInfo("Payment already exists...so delete first.",module);
 			}
-			else	{
-				if (!partyOnly)	{	// input parameter.....
-					// finally create payment record.
-					payment.put("userLogin",userLogin);
-					payment.put("locale", loc);
-					try {
-						dispatcher.runSync("createPayment", payment);
-					} catch (GenericServiceException e1) {
-						Debug.logError(e1, "Error creating payment", module);
-						continue;
-					}
-					
-					paymentsCreated++;
+			if (!partyOnly)	{	// input parameter.....
+				// finally create payment record.
+				payment.put("userLogin",userLogin);
+				payment.put("locale", loc);
+				try {
+					dispatcher.runSync("createPayment", payment);
+				} catch (GenericServiceException e1) {
+					Debug.logError(e1, "Error creating payment", module);
+					continue;
 				}
+				paymentsCreated++;
 			}
 		}
 		String mess = "Upload ended... " + partiesCreated + " partyGroups created, ";
-		if (!partyOnly) mess = mess.concat(paymentsCreated + " payment records created, " + paymentAlreadyUploaded + " payments already uploaded....");
+		if (!partyOnly) mess = mess.concat(paymentsCreated + " payment records created, " + paymentAlreadyUploaded + " payments deleted....");
 		request.setAttribute("_EVENT_MESSAGE_", mess);
 		
 		return "success";
@@ -234,9 +231,16 @@
 		catch (GenericEntityException e) {	Debug.logError("Find payment exception:" + e.getMessage(), module); }
 		if (payments == null || payments.size() == 0)	
 			return false;
-		else
+		else	{
+			try {
+				((GenericValue) payments.get(0)).remove();
+			} catch (GenericEntityException e1) {
+				Debug.logError(e1, "Error deleting payment record", module);
+			}
 			return true;
+		}
 	}
+
 	/**
 	 *  create party with payment method and eftAccount for an eftAccount that was not found.
 	 *  create roles for customer or supplier...
@@ -532,11 +536,13 @@
 					if (tagData.charAt(10) == 'D')	debet = true; else debet = false;
 					int x=11; while( x < 19 && tagData.charAt(x) != ',' && tagData.charAt(x) != '.')  x++;	// find end of amount string
 					if (x < 19)		{
-						payment.put("amount",new Double(tagData.substring(11,x).concat(".").
-								concat( tagData.charAt(x+1) == 'N'? "0": tagData.substring(x+1,x+2)).
-								concat( tagData.charAt(x+2) == 'N'? "0": tagData.substring(x+2,x+3))));
+						String amount = new String(tagData.substring(11,x));
+						if (tagData.charAt(x+2) == 'N')	amount = amount.concat(".").concat(tagData.substring(x+1,x+2));
+						if (tagData.charAt(x+3) == 'N')	amount = amount.concat(".").concat(tagData.substring(x+1,x+3));
+						payment.put("amount",new Double(amount));
 					}
 					else payment.put("amount",new Double("00.00"));
+					if (debug) Debug.logInfo("Line: " + lineNumber + " Value of 'x':" + x + " Char at 'x+3':" + tagData.charAt(x+3) + "  Payment amount: " + payment.get("amount"), module);
 					break;
 				case 86:  // more information. For ABN-AMRO account info other party.
 					payment.put("comments","");

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml	2005-10-31 13:22:10 UTC (rev 6048)
@@ -21,6 +21,7 @@
  *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 -->
 
+
 <site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/site-conf.xsd">
     <description>Hotel Backend Site Configuration File</description>
@@ -2115,18 +2116,42 @@
     </request-map>
 
     <!-- ================ Lookup Requests ================= -->
-    <request-map uri="LookupFixedAsset">
-        <security auth="true" https="true"/>
-        <response name="success" type="view" value="LookupFixedAsset"/>
-    </request-map>
     <request-map uri="LookupProduct">
         <security auth="true" https="true"/>
         <response name="success" type="view" value="LookupProduct"/>
     </request-map>
+    <request-map uri="LookupProductFeature">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupProductFeature"/>
+    </request-map>
+    <request-map uri="LookupPerson">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupPerson"/>
+    </request-map>
+    <request-map uri="LookupPartyGroup">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupPartyGroup"/>
+    </request-map>
     <request-map uri="LookupPartyName">
         <security auth="true" https="true"/>
         <response name="success" type="view" value="LookupPartyName"/>
     </request-map>
+    <request-map uri="LookupFixedAsset">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupFixedAsset"/>
+    </request-map>
+    <request-map uri="LookupBillingAccount">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupBillingAccount"/>
+    </request-map>
+    <request-map uri="LookupPayment">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupPayment"/>
+    </request-map>
+    <request-map uri="LookupInvoice">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupInvoice"/>
+    </request-map>
     <!-- invoice requests -->
     <request-map uri="findInvoices">
         <security https="true" auth="true"/>
@@ -2267,6 +2292,12 @@
         <response name="success" type="view" value="editPaymentApplications"/>
         <response name="error" type="view" value="editPaymentApplications"/>
     </request-map>
+    <request-map uri="setPaymentStatus">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="setPaymentStatus"/>
+        <response name="success" type="view" value="paymentOverview"/>
+        <response name="error" type="view" value="paymentOverview"/>
+    </request-map>
     <!-- =============== Accouting Utilities =================-->
     <request-map uri="Utilities">
         <security https="true" auth="true"/>
@@ -2597,9 +2628,21 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ViewGlReconciliation"/>
     </request-map>
+
+    <!-- pdf processes  -->
+    <request-map uri="invoice.pdf">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="InvoicePDF"/>
+    </request-map>
     
     <!-- end of request mappings -->
-
+    <request-map uri="ListInvoices">
+        <security https="true" auth="true"/>
+        <!--event type="simple" path="org/ofbiz/opentravelsystem/Utilities.xml" invoke="ListInvoices"/-->
+        <response name="success" type="view" value="InvoicesList"/>
+    </request-map>    
+    <view-map name="InvoicesList" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml#InvoicesList"/>
+    
     <!-- View Mappings -->
     <!-- Main Screens -->
     <view-map name="error" page="/error/error.jsp"/>
@@ -2656,16 +2699,24 @@
     <view-map name="listSalesInvoices" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/PartyScreens.xml#listSalesInvoices"/>
     <view-map name="listPurchaseInvoices" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/PartyScreens.xml#listPurchaseInvoices"/>
     <view-map name="viewprofile" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#viewprofile"/>
-    <!--view-map name="viewprofile" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/PartyScreens.xml#viewprofile"/-->
     <view-map name="visitdetail" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/PartyScreens.xml#visitdetail"/>
     <view-map name="findordersCust" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/PartyScreens.xml#findordersCust"/>
     <!--display by the frontend -->
     <view-map name="product" type="screen" page="component://opentravelsystem/webapp/hotelfrontend/screens/CatalogScreens.xml#product"/>
     
-    <!-- Lookup request mappings -->
-    <view-map name="LookupFixedAsset" page="component://opentravelsystem/webapp/hotelbackend/screens/LookupScreens.xml#LookupFixedAsset" type="screen"/>
-    <view-map name="LookupProduct" page="component://opentravelsystem/webapp/hotelbackend/screens/LookupScreens.xml#LookupProduct" type="screen"/>
+    <!-- Lookup request mappings other components-->
+    <view-map name="LookupPerson" page="component://party/widget/partymgr/LookupScreens.xml#LookupPerson" type="screen"/>
+    <view-map name="LookupPartyGroup" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyGroup" type="screen"/>
     <view-map name="LookupPartyName" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyName" type="screen"/>
+    <view-map name="LookupProduct" page="component://product/widget/catalog/LookupScreens.xml#LookupProduct" type="screen"/>
+    <view-map name="LookupProductFeature" page="component://product/widget/catalog/LookupScreens.xml#LookupProductFeature" type="screen"/>
+    
+    <!-- Lookup request mappings accounting component-->
+    <view-map name="LookupFixedAsset" page="component://accountingext/widget/LookupScreens.xml#LookupFixedAsset" type="screen"/>
+    <view-map name="LookupBillingAccount" page="component://accountingext/widget/LookupScreens.xml#LookupBillingAccount" type="screen"/>
+    <view-map name="LookupPayment" page="component://accountingext/widget/LookupScreens.xml#LookupPayment" type="screen"/>
+    <view-map name="LookupInvoice" page="component://accountingext/widget/LookupScreens.xml#LookupInvoice" type="screen"/>
+    
     <!-- invoices -->
     <view-map name="invoiceOverview" type="screen" page="component://accountingext/widget/InvoiceScreens.xml#invoiceOverview"/>
     <view-map name="findInvoices" type="screen" page="component://accountingext/widget/InvoiceScreens.xml#FindInvoices"/>
@@ -2719,6 +2770,8 @@
     <view-map name="ReconcileAccounts" type="screen" page="component://accountingext/widget/AccountingScreens.xml#ReconcileAccounts"/>
     <view-map name="ViewGlAccountBalance" type="screen" page="component://accountingext/widget/AccountingScreens.xml#ViewGlAccountBalance"/>
     <view-map name="ViewGlReconciliation" type="screen" page="component://accountingext/widget/AccountingScreens.xml#ViewGlReconciliation"/>
+    <!-- PDFs  -->
+    <view-map name="InvoicePDF" type="screenfop" page="component://accountingext/widget/AccountingPrintForms.xml#InvoicePDF" content-type="application/pdf" encoding="none"/>
     
     <!-- end of view mappings -->
 </site-conf>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml	2005-10-31 13:22:10 UTC (rev 6048)
@@ -22,7 +22,7 @@
 -->
 
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="file:/home/Hans/ofbiz/framework/widget/dtd/widget-form.xsd">
+ xsi:noNamespaceSchemaLocation="file:/home/hans/ofbiz/framework/widget/dtd/widget-form.xsd">
 
     <form name="DataExchangePartyOnly" target="uploadDataFilePartyOnly" title="Upload data file" type="upload"
         default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox">
@@ -40,17 +40,18 @@
             <submit button-type="button"/>
         </field>
     </form>
-    <form name="SendReceivePayments" target="SendReceivePayments" title="Set all payments with the 'not paid' status to send/received" type="single"
+    <form name="CreateInvoicesFromPayments" target="CreateInvoicesFromPayments" title="Create Invoices from Payments" 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="change status to received/send" widget-style="smallSubmit">
+        <field name="generateSalesInvoicesToo"><check/></field>
+        <field name="submitButton" title="Copy" widget-style="smallSubmit">
             <submit button-type="button"/>
         </field>
     </form>
-    <form name="CreateInvoicesFromPayments" target="CreateInvoicesFromPayments" title="Create Invoices from Payments" type="single"
+    <form name="SendReceivePayments" target="SendReceivePayments" title="Set all payments with the 'not paid' status to send/received" 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="Copy" widget-style="smallSubmit">
+        <field name="submitButton" title="change status to received/send" widget-style="smallSubmit">
             <submit button-type="button"/>
         </field>
     </form>
@@ -61,5 +62,29 @@
             <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="viewprofile?partyId=${company}" target-window="new"/>
+        </field>
+        <field name="name"><display/></field>
+        <field name="revenue"><display/></field>
+        <field name="salesTaxIn"><display/></field>
+        <field name="expenses"><display/></field>
+        <field name="salesTaxOut"><display/></field>
+        <field name="miscIn"><display/></field>
+        <field name="miscOut"><display/></field>
+        <field name="totalValue"><display/></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	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/AccountingScreens.xml	2005-10-31 13:22:10 UTC (rev 6048)
@@ -48,25 +48,6 @@
         </section>
     </screen>
 
-    <!--screen name="DataExchange">
-        <section>            
-            <actions>
-                <set field="title" value="Data Exchange"/>
-                <set field="headerItem" value="DataExchange"/>
-                <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" to-scope="application"/>
-            </actions>
-            <widgets>
-                <decorator-screen name="mainAccountingDecorator" location="${parameters.mainDecoratorLocation}">
-                    <decorator-section name="body">
-                        <container>
-                            <label style="head1">Bankstatement MT940 file upload.</label>
-                        </container>
-                        <include-form name="DataExchange" location="component://opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml"/>
-                    </decorator-section>
-                </decorator-screen>
-            </widgets>
-        </section>
-    </screen-->
     <screen name="Utilities">
         <section>            
             <actions>
@@ -94,7 +75,7 @@
                         </container>
                         <include-form name="SendReceivePayments" location="component://opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml"/>
                         <container>
-                            <label style="head1">Post Invoices by changing the status to.</label>
+                            <label style="head1">Post Invoices and Confirm Payments.</label>
                         </container>
                         <include-form name="PostInvoicesStatements" location="component://opentravelsystem/webapp/hotelbackend/screens/AccountingForms.xml"/>
                     </decorator-section>
@@ -119,6 +100,10 @@
                             <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"/>
+                        </container>
+                        <container>
                             <label style="head2" text="VAT report"/>
                             <include-form name="VatReportOptions" location="component://opentravelsystem/webapp/hotelbackend/screens/ReportForms.xml"/>
                         </container>
@@ -137,34 +122,24 @@
             </widgets>
         </section>
     </screen>
-    
-    <screen name="VatReport">
+    <screen name="InvoicesList">
         <section>
             <actions>
-                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
-                <set field="title" value="Vat Report"/>
-                <set field="productStoreId" from-scope="user" from-field="productStoreId"/>
-                <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" to-scope="application"/>
-                <entity-condition entity-name="Invoice" list-name="invoices">
-                    <condition-list combine="or">
-                        <condition-expr field-name="partyIdFrom" operator="equals" value="Company"/>
-                        <condition-expr field-name="partyId" operator="equals" value="Company"/>
-                    </condition-list>
-                    <select-field field-name="invoiceId" />
-                    <select-field field-name="description"/>
-                    <!--select-field name="invoiceDate"><display/></select-field>
-                    <select-field name="currencyUomId" title="Curr."><display/></select-field>
-                    <select-field name="total"><display description="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)}" also-hidden="false"/></select-field>
-                    <select-field name="applied"><display description="${bsh:org.ofbiz.accounting.invoice.InvoiceExtWorker.getInvoiceApplied(delegator,invoiceId)}" also-hidden="false"/></select-field-->
-                    <order-by field-name="paymentId"/>
-                </entity-condition>
+                <set field="organizationPartyId" from-scope="user"  from-field="productStoreId" />
+                <set field="salesTaxIn" from-field="requestAttributes.salesTaxIn"/> 
+                <set field="salesTaxOut" from-field="requestAttributes.salesTaxOut"/> 
             </actions>
             <widgets>
-                <platform-specific>
-                    <!-- NOTE: this is really generating XSL:FO, but the HTML oriented renderer should do fine, the screen will need to be called differently though to get binary output from it -->
-                    <html><html-template location="component://order/webapp/ordermgr/reports/OrderPurchaseReportPayment.fo.ftl"/></html>
-                </platform-specific>
+                <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"/>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
             </widgets>
         </section>
     </screen>
+    
 </screens>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/CommonScreens.xml	2005-10-31 13:22:10 UTC (rev 6048)
@@ -138,6 +138,7 @@
                             <container style="contentarea">
                                 <container style="${MainColumnStyle}">
                                     <platform-specific><html><html-template location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific>
+                                    <include-menu location="component://party/widget/partymgr/PartyMenus.xml" name="ProfileTabBar"/>
                                     <decorator-section-include name="body"/>
                                 </container>
                                 <container style="endcolumns"><label text="&amp;nbsp;"/></container>

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml	2005-10-31 13:18:56 UTC (rev 6047)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml	2005-10-31 13:22:10 UTC (rev 6048)
@@ -25,7 +25,7 @@
     <form name="ListParties" type="list" separate-columns="true" 
         title="Party List"  default-title-style="tableheadtext"
         default-widget-style="tabletext" default-tooltip-style="tabletext"
-        paginate-target="findparties" list-iterator-name="listIt" default-entity-name="PartyRelationshipAndPartyDetail">
+        paginate-target="findParties" list-iterator-name="listIt" default-entity-name="PartyRelationshipAndPartyDetail">
         <actions>
             <service service-name="performFind" result-map-name="result" result-map-list-iterator-name="listIt">
                 <field-map field-name="inputFields" env-name="parameters"/>



More information about the Svn mailing list