This is an automated email from the git hooks/post-receive script. New commit to branch feature/newReportBuilder in repository lima. See http://git.chorem.org/lima.git commit 5e5d8f200e878d145bb0a6d77743d2a3a8cfe50f Author: dcosse <japbiw74> Date: Thu Nov 6 15:50:18 2014 +0100 refs #769 création d'un nouveau module pour la partie web de lima et création du rapport balance avec jasper report --- .../chorem/lima/business/api/AccountService.java | 1 + .../api/ClosedPeriodicEntryBookService.java | 5 + .../chorem/lima/business/api/DocumentService.java | 5 + .../org/chorem/lima/business/api/EntryService.java | 7 + .../lima/business/api/HttpServerService.java | 31 - .../chorem/lima/business/api/ReportService.java | 2 +- .../api/report/BalanceBeanReportService.java | 21 + lima-business/pom.xml | 23 + .../jasperreports/accounts/AccountReport.jrxml | 0 .../main/jasperreports/balance/BalanceReport.jrxml | 347 +++++++++++ .../balance/BalanceReportAccountReport.jrxml | 132 ++++ .../balance/BalanceSubAccountsReport.jrxml | 109 ++++ .../lima/business/ejb/AccountServiceImpl.java | 9 + .../ejb/ClosedPeriodicEntryBookServiceImpl.java | 16 +- .../chorem/lima/business/ejb/EntryServiceImpl.java | 22 + .../ejb/report/BalanceBeanReportServiceImpl.java | 195 ++++++ .../java/org/chorem/lima/service/package-info.java | 27 - .../lima/beans/BalanceReportAccountImpl.java | 41 ++ .../java/org/chorem/lima/entity/EntryTopiaDao.java | 2 +- lima-callao/src/main/xmi/accounting-model.zargo | Bin 48221 -> 48316 bytes lima-swing/pom.xml | 30 +- lima-swing/src/main/filters/pom.properties | 6 +- .../main/jasperreports/balance/BalanceReport.jrxml | 292 --------- .../balance/BalanceReportAccountReport.jrxml | 126 ---- .../balance/BalanceSubAccountsReport.jrxml | 107 ---- .../src/main/java/org/chorem/lima/LimaMain.java | 18 +- .../java/org/chorem/lima/ui/MainViewHandler.java | 5 +- .../lima/ui/lettering/LetteringViewHandler.java | 2 +- .../org/chorem/lima/ui/report/ReportBuilder.java | 107 ---- .../org/chorem/lima/ui/report/ReportFactory.java | 148 ----- .../dataSource/AccountCustomDataSourceFabric.java | 137 ----- .../dataSource/BalanceCustomDataSourceFabric.java | 147 ----- lima-web/LICENSE.txt | 674 +++++++++++++++++++++ lima-web/README.txt | 20 + {lima-business => lima-web}/pom.xml | 108 ++-- lima-web/src/main/assembly/bin.xml | 67 ++ lima-web/src/main/assembly/lima-server | 9 + .../jasperreports/accounts/AccountReport.jrxml | 0 .../main/jasperreports/balance/BalanceReport.jrxml | 347 +++++++++++ .../balance/BalanceReportAccountReport.jrxml | 132 ++++ .../balance/BalanceSubAccountsReport.jrxml | 109 ++++ .../src/main/java/org/chorem/lima/LimaServer.java | 75 +++ .../chorem/lima/web/action/DocumentService.java | 121 ++-- .../web/action/balance/BalanceReportBuilder.java | 60 ++ .../chorem/lima/web/service/HttpServerService.java | 60 +- .../org/chorem/lima/web/utils/DocumentsEnum.java | 67 ++ .../org/chorem/lima/web/action}/ReportTest.java | 32 +- pom.xml | 5 +- 48 files changed, 2657 insertions(+), 1349 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java index 41e123c..6e1badf 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java @@ -108,4 +108,5 @@ public interface AccountService { List<Account> stringToListAccounts(String selectedAccounts); + Account findAccountById(String accountId); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/ClosedPeriodicEntryBookService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/ClosedPeriodicEntryBookService.java index 09a8766..64bbed9 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/ClosedPeriodicEntryBookService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/ClosedPeriodicEntryBookService.java @@ -26,10 +26,15 @@ import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialPeriod; +import java.util.Date; +import java.util.List; + /** * Created by davidcosse on 17/01/14. */ public interface ClosedPeriodicEntryBookService { ClosedPeriodicEntryBook getByEntryBookAndFinancialPeriod(EntryBook entryBook, FinancialPeriod financialPeriod); + + List<ClosedPeriodicEntryBook> getAllByDates(Date beginDate, Date endDate); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java index 2abf0a2..f090da5 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java @@ -22,6 +22,8 @@ package org.chorem.lima.business.api; +import org.chorem.lima.beans.BalanceReport; + import java.util.Date; /** @@ -45,4 +47,7 @@ public interface DocumentService { void createVatDocuments(Date beginDate, Date endDate, String autocomplete); String createAccountDocument(Date beginDate, Date endDate, String account); + + BalanceReport buildGeneralEntryBooksDocuments(Date beginDate, + Date endDate); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryService.java index e0c08cc..1925c8b 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryService.java @@ -22,12 +22,19 @@ package org.chorem.lima.business.api; * #L% */ +import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; +import java.util.List; + /** * Created by davidcosse on 17/01/14. */ public interface EntryService { Entry createEntry(Entry entry); + + List<Entry> findAllEntryByDateForEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook); + + List<Object[]> findDebitCreditOfTransaction(ClosedPeriodicEntryBook closedPeriodicEntryBook); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/HttpServerService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/HttpServerService.java deleted file mode 100644 index 4a09027..0000000 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/HttpServerService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * #%L - * Lima :: business API - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.business.api; - -public interface HttpServerService { - - void start(); - - int getHttpPort(); - -} diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/ReportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/ReportService.java index 6a8b9cf..dbfb93f 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/ReportService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/ReportService.java @@ -37,7 +37,7 @@ import java.util.List; * <p/> * Actuellement: * <ul> - * <li>Balance</li> + * <li>balance</li> * <li>Bilan</li> * <li>TVA</li> * </ul> diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceBeanReportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceBeanReportService.java new file mode 100644 index 0000000..c94f9d6 --- /dev/null +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceBeanReportService.java @@ -0,0 +1,21 @@ +package org.chorem.lima.business.api.report; + +import org.chorem.lima.beans.BalanceReport; + +import java.util.Date; + +/** + * Created by davidcosse on 06/11/14. + */ +public interface BalanceBeanReportService { + + /** + * Generate the necessary beans to make balance report. + * + * @param from from date + * @param to to date + * @param selectedAccounts if null all accounts will be selected + * @return the balance beans + */ + BalanceReport generateBalanceReportDocument(Date from, Date to, String selectedAccounts); +} diff --git a/lima-business/pom.xml b/lima-business/pom.xml index 2b6774e..ab0714e 100644 --- a/lima-business/pom.xml +++ b/lima-business/pom.xml @@ -125,6 +125,11 @@ <artifactId>commons-codec</artifactId> </dependency> + <dependency> + <groupId>net.sf.jasperreports</groupId> + <artifactId>jasperreports</artifactId> + </dependency> + </dependencies> <build> @@ -146,6 +151,24 @@ <pluginManagement> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jasperreports-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>compile-reports</goal> + </goals> + </execution> + </executions> + <dependencies> + <!--note this must be repeated here to pick up correct xml validation --> + <dependency> + <groupId>net.sf.jasperreports</groupId> + <artifactId>jasperreports</artifactId> + </dependency> + </dependencies> + </plugin> + <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> diff --git a/lima-swing/src/main/jasperreports/accounts/AccountReport.jrxml b/lima-business/src/main/jasperreports/accounts/AccountReport.jrxml similarity index 100% copy from lima-swing/src/main/jasperreports/accounts/AccountReport.jrxml copy to lima-business/src/main/jasperreports/accounts/AccountReport.jrxml diff --git a/lima-business/src/main/jasperreports/balance/BalanceReport.jrxml b/lima-business/src/main/jasperreports/balance/BalanceReport.jrxml new file mode 100644 index 0000000..a0339b9 --- /dev/null +++ b/lima-business/src/main/jasperreports/balance/BalanceReport.jrxml @@ -0,0 +1,347 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2014-11-04T17:37:18 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceReport" pageWidth="595" pageHeight="842" columnWidth="575" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" uuid="66929b65-d52d-4e6b-8d8e-8bd4ef5ac821"> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <style name="Column header" forecolor="#D0B48E" backcolor="#F2EBDF" fontName="Arial" fontSize="12" isBold="true"/> + <style name="Default" isDefault="true" fontName="Arial" /> + <style name="Default oblique" isDefault="true" fontName="Monospaced" /> + <queryString> + <![CDATA[]]> + </queryString> + <field name="fromDate" class="java.util.Date"/> + <field name="toDate" class="java.util.Date"/> + <field name="currency" class="java.lang.String"/> + <field name="fromAccount" class="java.lang.String"/> + <field name="toAccount" class="java.lang.String"/> + <field name="accounts" class="java.util.List"/> + <field name="balanceReportAccountPath" class="java.lang.String"/> + <field name="companyName" class="java.lang.String"/> + <variable name="accounts" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"> + <variableExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource((java.util.List)$F{accounts})]]></variableExpression> + </variable> + <group name="accounts"/> + <background> + <band splitType="Stretch"/> + </background> + <title> + <band height="41" splitType="Stretch"> + <frame> + <reportElement style="Default" mode="Opaque" x="0" y="1" width="578" height="40" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="1aba49d4-0acc-4925-8731-13c1cc1a90f4"/> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textField pattern="dd/MM/yyyy"> + <reportElement style="Default" x="210" y="20" width="80" height="20" forecolor="#736343" uuid="37d0a47c-0197-4f09-8358-823b39a2a42a"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{fromDate}]]></textFieldExpression> + </textField> + <staticText> + <reportElement style="Default" x="0" y="0" width="578" height="20" forecolor="#736343" uuid="e7bf1b4c-d748-4c99-b9e2-838903711b48"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="14" isBold="true" pdfFontName="Times-Roman"/> + </textElement> + <text><![CDATA[Balance]]></text> + </staticText> + <textField pattern="dd/MM/yyyy HH:mm"> + <reportElement style="Default" x="480" y="0" width="98" height="20" forecolor="#736343" uuid="a60d5d40-69ac-4c50-a33a-67c26cce05f3"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="10" isBold="false"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <staticText> + <reportElement style="Default" x="422" y="0" width="58" height="20" forecolor="#736343" uuid="ddf50f55-7669-44be-b427-d03bc72cc264"/> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[Edition du:]]></text> + </staticText> + <staticText> + <reportElement style="Default" x="190" y="20" width="20" height="20" forecolor="#736343" uuid="08282b18-8e67-4bcb-878e-ac97dc0bbc5b"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <text><![CDATA[Du]]></text> + </staticText> + <staticText> + <reportElement style="Default" x="290" y="20" width="20" height="20" forecolor="#736343" uuid="e149a451-2c1c-4d8d-9b01-85e35144eb86"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <text><![CDATA[au]]></text> + </staticText> + <textField pattern="dd/MM/yyyy"> + <reportElement style="Default" x="310" y="20" width="80" height="20" forecolor="#736343" uuid="5fc4df4a-5930-4ccd-b450-cf7aac6be57b"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{toDate}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="0" y="0" width="190" height="20" forecolor="#736343" uuid="5aa3ceb9-e407-42da-bdc3-097875bdd5f5"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle" rotation="None"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{companyName}]]></textFieldExpression> + </textField> + </frame> + </band> + </title> + <pageHeader> + <band height="25" splitType="Stretch"> + <staticText> + <reportElement style="Default oblique" x="0" y="9" width="42" height="16" uuid="33ba6496-bc27-466f-9764-7336b6741c13"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font size="8" isItalic="true"/> + </textElement> + <text><![CDATA[Comptes :]]></text> + </staticText> + <textField isBlankWhenNull="true"> + <reportElement style="Default oblique" x="42" y="9" width="402" height="16" uuid="9db3917c-44e3-46d2-b95a-6463e5eff328"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8" isItalic="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{fromAccount}]]></textFieldExpression> + </textField> + <staticText> + <reportElement style="Default oblique" x="444" y="9" width="30" height="16" forecolor="#000000" uuid="02207af8-5ccd-43c9-b475-acb534bcd6cf"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Devise:]]></text> + </staticText> + <textField> + <reportElement style="Default oblique" x="474" y="9" width="104" height="16" forecolor="#000000" uuid="abcb18cb-7d0e-4eb8-a9f5-aca4baffa9ae"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{currency}]]></textFieldExpression> + </textField> + </band> + </pageHeader> + <columnHeader> + <band height="20"> + <frame> + <reportElement style="Column header" mode="Opaque" x="0" y="0" width="578" height="20" uuid="6c2c2b44-eebf-41d3-8b56-47d4a20a4b24"> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + </reportElement> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <staticText> + <reportElement x="0" y="0" width="40" height="20" uuid="63da28a1-a793-4bf5-81d4-6a4d6fc1e4df"> + <property name="local_mesure_unitwidth" value="pixel"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Compte]]></text> + </staticText> + <staticText> + <reportElement x="40" y="0" width="250" height="20" uuid="da44668c-4f62-4f75-abaf-cb941b73bfcb"> + <property name="local_mesure_unitheight" value="pixel"/> + </reportElement> + <box> + <topPen lineWidth="0.6"/> + <leftPen lineWidth="0.6"/> + <bottomPen lineWidth="0.6"/> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Intitulé]]></text> + </staticText> + <staticText> + <reportElement x="290" y="0" width="144" height="10" uuid="caadc464-ad77-4b53-b5cb-11e29c0a18ce"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Total Période]]></text> + </staticText> + <staticText> + <reportElement x="290" y="10" width="72" height="10" uuid="e6928f86-fe5c-4c14-996c-19728e6abf44"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Débit]]></text> + </staticText> + <staticText> + <reportElement x="362" y="10" width="72" height="10" uuid="13dd0f7b-3331-4ca4-8ef8-5468fb65fc3e"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Crédit]]></text> + </staticText> + <staticText> + <reportElement x="434" y="0" width="144" height="10" uuid="1bc6ab8b-d490-46a2-9a10-8f4c4f219889"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Solde Période]]></text> + </staticText> + <staticText> + <reportElement x="434" y="10" width="72" height="10" uuid="b6ea8597-d637-47d1-9a39-7c99101594e9"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.6"/> + <leftPen lineWidth="0.6"/> + <bottomPen lineWidth="0.6"/> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Débit]]></text> + </staticText> + <staticText> + <reportElement x="506" y="10" width="72" height="10" uuid="c4f9f592-7052-4b66-abc2-f04cc5f3972c"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Crédit]]></text> + </staticText> + </frame> + </band> + </columnHeader> + <detail> + <band height="20" splitType="Stretch"> + <subreport isUsingCache="false" runToBottom="false"> + <reportElement key="subreport-5" positionType="Float" mode="Transparent" x="0" y="0" width="578" height="20" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"/> + <dataSourceExpression><![CDATA[$V{accounts}]]></dataSourceExpression> + <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{balanceReportAccountPath})]]></subreportExpression> + </subreport> + </band> + </detail> + <pageFooter> + <band height="10" splitType="Stretch"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <textField> + <reportElement x="295" y="0" width="50" height="10" uuid="bbf610ed-68ca-4ff7-992a-b894a61b2379"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="235" y="0" width="50" height="10" uuid="7f4c8e82-7fe3-4207-ab07-1a8c4d977a94"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="285" y="0" width="10" height="10" uuid="2609dfd4-556d-4dbd-8d23-74474c5b344c"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement textAlignment="Center"> + <font size="8"/> + </textElement> + <text><![CDATA[/]]></text> + </staticText> + </band> + </pageFooter> +</jasperReport> diff --git a/lima-business/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml b/lima-business/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml new file mode 100644 index 0000000..e16efa2 --- /dev/null +++ b/lima-business/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2014-11-04T15:21:19 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <style name="Default" isDefault="true" fontName="Arial" /> + <style name="Default oblique" isDefault="true" fontName="Monospaced" /> + <queryString> + <![CDATA[]]> + </queryString> + <field name="accountNumber" class="java.lang.String"/> + <field name="label" class="java.lang.String"/> + <field name="amountDebit" class="java.lang.String"/> + <field name="amountCredit" class="java.lang.String"/> + <field name="soldeDebit" class="java.lang.String"/> + <field name="soldeCredit" class="java.lang.String"/> + <field name="subAccounts" class="java.util.List"/> + <field name="balanceSubAccountsReportPath" class="java.lang.String"/> + <variable name="subAccounts" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"> + <variableExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource((java.util.List)$F{subAccounts})]]></variableExpression> + </variable> + <detail> + <band height="10" splitType="Stretch"> + <subreport isUsingCache="false" runToBottom="false"> + <reportElement key="subreport-5" positionType="Float" mode="Transparent" x="0" y="0" width="578" height="10" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"/> + <dataSourceExpression><![CDATA[$V{subAccounts}]]></dataSourceExpression> + <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{balanceSubAccountsReportPath})]]></subreportExpression> + </subreport> + </band> + <band height="10" splitType="Stretch"> + <textField isBlankWhenNull="true"> + <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <paragraph lineSpacingSize="0.0" leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="40" y="0" width="250" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> + <property name="local_mesure_unity" value="pixel"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <paragraph lineSpacingSize="0.0" leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="290" y="0" width="72" height="10" uuid="e774e638-6353-46d0-9968-15992ef50bd3"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="362" y="0" width="72" height="10" uuid="daac5561-4c81-4582-aabf-e8034c2cf93e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountCredit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> + </textField> + </band> + </detail> + <columnFooter> + <band height="1"> + <line> + <reportElement style="Default" x="0" y="0" width="578" height="1" uuid="ca761e3c-0dba-448f-a60d-afc241c74411"/> + </line> + </band> + </columnFooter> +</jasperReport> diff --git a/lima-business/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml b/lima-business/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml new file mode 100644 index 0000000..b6fb933 --- /dev/null +++ b/lima-business/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2014-11-04T15:21:33 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <style name="Default" isDefault="true" fontName="Arial" /> + <style name="Default oblique" isDefault="true" fontName="Monospaced" /> + <queryString> + <![CDATA[]]> + </queryString> + <field name="accountNumber" class="java.lang.String"/> + <field name="label" class="java.lang.String"/> + <field name="amountDebit" class="java.lang.String"/> + <field name="amountCredit" class="java.lang.String"/> + <field name="soldeDebit" class="java.lang.String"/> + <field name="soldeCredit" class="java.lang.String"/> + <detail> + <band height="10" splitType="Stretch"> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="0" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="40" y="0" width="250" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> + <property name="local_mesure_unity" value="pixel"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="290" y="0" width="72" height="10" uuid="e774e638-6353-46d0-9968-15992ef50bd3"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="362" y="0" width="72" height="10" uuid="daac5561-4c81-4582-aabf-e8034c2cf93e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountCredit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> + </textField> + </band> + </detail> +</jasperReport> diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java index 99a6776..f31c240 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java @@ -294,4 +294,13 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe } return new ArrayList<Account>(accounts); } + + @Override + public Account findAccountById(String accountId) { + + AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); + Account account = accountDao.forTopiaIdEquals(accountId).findUniqueOrNull(); + + return account; + } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ClosedPeriodicEntryBookServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ClosedPeriodicEntryBookServiceImpl.java index 5dd7a13..30a7cb6 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ClosedPeriodicEntryBookServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ClosedPeriodicEntryBookServiceImpl.java @@ -31,6 +31,8 @@ import org.chorem.lima.entity.FinancialPeriod; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; +import java.util.Date; +import java.util.List; /** * Created by davidcosse on 17/01/14. @@ -39,12 +41,22 @@ import javax.ejb.TransactionAttribute; @Remote(ClosedPeriodicEntryBookService.class) @TransactionAttribute public class ClosedPeriodicEntryBookServiceImpl extends AbstractLimaService implements ClosedPeriodicEntryBookService { + + @Override public ClosedPeriodicEntryBook getByEntryBookAndFinancialPeriod(EntryBook entryBook, FinancialPeriod financialPeriod) { + ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao(); + ClosedPeriodicEntryBook result = closedPeriodicEntryBookTopiaDao.findByEntryBookAndFinancialPeriod(entryBook, financialPeriod); - ClosedPeriodicEntryBookTopiaDao accountTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao(); - ClosedPeriodicEntryBook result = accountTopiaDao.findByEntryBookAndFinancialPeriod(entryBook, financialPeriod); + return result; + } + @Override + public List<ClosedPeriodicEntryBook> getAllByDates(Date beginDate, Date endDate) { + ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao(); + List<ClosedPeriodicEntryBook> result = + closedPeriodicEntryBookTopiaDao.findAllByDates(beginDate, endDate); return result; } + } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java index 9bcbee0..aac45fb 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryServiceImpl.java @@ -23,12 +23,14 @@ package org.chorem.lima.business.ejb; */ import org.chorem.lima.business.api.EntryService; +import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryTopiaDao; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; +import java.util.List; /** * Created by davidcosse on 17/01/14. @@ -47,4 +49,24 @@ public class EntryServiceImpl extends AbstractLimaService implements EntryServic return result; } + @Override + public List<Entry> findAllEntryByDateForEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) { + EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); + List<Entry> result = entryTopiaDao.findAllEntryByDateForEntryBook(closedPeriodicEntryBook.getEntryBook(), + closedPeriodicEntryBook.getFinancialPeriod().getBeginDate(), + closedPeriodicEntryBook.getFinancialPeriod().getEndDate()); + return result; + } + + @Override + public List<Object[]> findDebitCreditOfTransaction(ClosedPeriodicEntryBook closedPeriodicEntryBook) { + EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); + List<Object[]> result = entryTopiaDao.getDebitCreditOfTransaction(closedPeriodicEntryBook.getEntryBook(), + closedPeriodicEntryBook.getFinancialPeriod().getBeginDate(), + closedPeriodicEntryBook.getFinancialPeriod().getEndDate()); + return result; + } + + + } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceBeanReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceBeanReportServiceImpl.java new file mode 100644 index 0000000..d3cf917 --- /dev/null +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceBeanReportServiceImpl.java @@ -0,0 +1,195 @@ +package org.chorem.lima.business.ejb.report; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import org.apache.commons.lang3.StringUtils; +import org.chorem.lima.beans.BalanceReport; +import org.chorem.lima.beans.BalanceReportAccount; +import org.chorem.lima.beans.BalanceReportAccountImpl; +import org.chorem.lima.beans.BalanceReportImpl; +import org.chorem.lima.beans.BalanceTrial; +import org.chorem.lima.beans.BalanceTrialImpl; +import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.business.api.AccountService; +import org.chorem.lima.business.api.FinancialPeriodService; +import org.chorem.lima.business.api.IdentityService; +import org.chorem.lima.business.api.report.BalanceBeanReportService; +import org.chorem.lima.business.ejb.AbstractLimaService; +import org.chorem.lima.business.utils.AccountComparator; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.AccountTopiaDao; +import org.chorem.lima.entity.EntryTopiaDao; +import org.chorem.lima.entity.Identity; + +import javax.ejb.EJB; +import javax.ejb.Remote; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import java.io.File; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +/** + * Created by davidcosse on 04/11/14. + */ +@Stateless +@Remote(BalanceBeanReportService.class) +@TransactionAttribute +public class BalanceBeanReportServiceImpl extends AbstractLimaService implements BalanceBeanReportService { + + @EJB + protected FinancialPeriodService financialPeriodService; + + @EJB + protected AccountService accountService; + + @EJB + protected IdentityService identityService; + + protected static final Integer ACCOUNT_NUMBER_SIZE = 6; + protected static String ROOT_PATH = new File("").getAbsolutePath(); + protected static String BALANCE_REPORT_ACCOUNT_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml"; + protected static String BALANCE_SUB_ACCOUNTS_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml"; + + protected static final Predicate<BalanceReportAccount> HAS_NO_ENTRY = new Predicate<BalanceReportAccount>() { + + @Override + public boolean apply(BalanceReportAccount subClasses) { + boolean result = StringUtils.isBlank(subClasses.getAmountDebit()) && + StringUtils.isBlank(subClasses.getAmountCredit()) && + StringUtils.isBlank(subClasses.getSoldeDebit()) && + StringUtils.isBlank(subClasses.getSoldeCredit()); + return result; + } + }; + + @Override + public BalanceReport generateBalanceReportDocument(Date from, Date to, String selectedAccounts) { + BalanceReport result = new BalanceReportImpl(); + + Identity identity = identityService.getIdentity(); + result.setCompanyName(StringUtils.isNotBlank(identity.getName()) ? identity.getName() : ""); + + // TODO DCossé 06/11/14 + String currency = "€"; + + // general info about balance report + result.setCurrency(currency); + result.setFromDate(from); + result.setToDate(to); + result.setBalanceReportAccountPath(BALANCE_REPORT_ACCOUNT_REPORT_PATH); + + + BalanceTrial balanceTrial = new BalanceTrialImpl(); + balanceTrial.setReportsDatas(new ArrayList<ReportsDatas>()); + + AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao(); + //for each account create a balance sheet with a ReportsDatas + + List<Account> accounts; + + //Remove Spaces + // TODO DCossé 12/06/14 selectedAccounts is allways NULL + selectedAccounts = StringUtils.deleteWhitespace(selectedAccounts); + //if no filter account + if (selectedAccounts == null || selectedAccounts.equals("")) { + accounts = accountTopiaDao.findAll(); + } + //build list account from selectedAccounts + else { + accounts = accountService.stringToListAccounts(selectedAccounts); + } + + Collection<BalanceReportAccount> returnedAccounts = new ArrayList<>(); + if (accounts != null && !accounts.isEmpty()) { + Collections.sort(accounts, new AccountComparator()); + + Account fromAccount = accounts.get(0); + Account toAccount = accounts.get(accounts.size()-1); + String fromAccountLabel = StringUtils.isNotBlank(fromAccount.getLabel()) ? fromAccount.getLabel() + " (" + fromAccount.getAccountNumber() + ")" : fromAccount.getAccountNumber(); + String toAccountLabel = StringUtils.isNotBlank(toAccount.getLabel()) ? toAccount.getLabel() + " (" + toAccount.getAccountNumber() + ")" : toAccount.getAccountNumber(); + result.setFromAccount(fromAccountLabel + " à " + toAccountLabel); + + HashMap<String, BalanceReportAccountImpl> accountsByClasses = new HashMap<>(); + for (Account account : accounts) { + String accountClass = String.valueOf(account.getAccountNumber().charAt(0)); + + BalanceReportAccountImpl classAccount = accountsByClasses.get(accountClass); + if (classAccount == null) { + classAccount = new BalanceReportAccountImpl(); + classAccount.setBalanceSubAccountsReportPath(BALANCE_SUB_ACCOUNTS_REPORT_PATH); + classAccount.setSubAccounts(new ArrayList<BalanceReportAccount>()); + classAccount.setAccountNumber(""); + classAccount.setLabel("Total " + accountClass); + accountsByClasses.put(accountClass, classAccount); + returnedAccounts.add(classAccount); + } + BalanceReportAccount subClassAccount = bindAccountToBalanceReportAccount(account, from, to); + classAccount.addSubAccount(subClassAccount); + } + } + + Iterables.removeIf(returnedAccounts, HAS_NO_ENTRY); + result.addAllAccounts(returnedAccounts); + return result; + } + + /** + * Calculate all credit, debit and solde amounts for the balance + * <p/> + * Get all entries if true + * @throws org.nuiton.topia.persistence.TopiaException + */ + protected BalanceReportAccount bindAccountToBalanceReportAccount(Account account, Date beginDate, Date endDate) { + BalanceReportAccount balanceReportAccount = new BalanceReportAccountImpl(); + String accountNumber = account.getAccountNumber(); + accountNumber = StringUtils.rightPad(accountNumber, ACCOUNT_NUMBER_SIZE - accountNumber.length(), '0'); + balanceReportAccount.setAccountNumber(accountNumber); + balanceReportAccount.setLabel(account.getLabel()); + + EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); + + BigDecimal credit = BigDecimal.ZERO; + BigDecimal debit = BigDecimal.ZERO; + BigDecimal solde = BigDecimal.ZERO; + + List<Object[]> results = entryTopiaDao.getDebitCreditOfBalancedTransaction(account, beginDate, endDate); + + int nbAmount = results.size(); + if (nbAmount == 2) { + debit = (BigDecimal) results.get(0)[1]; + credit = (BigDecimal) results.get(1)[1]; + } + if (nbAmount == 1) { + if ((Boolean) results.get(0)[0]) { + debit = (BigDecimal) results.get(0)[1]; + } else { + credit = (BigDecimal) results.get(0)[1]; + } + } + + // set the amounts and solde + //solde = debit - credit + solde = solde.add(debit); + solde = solde.subtract(credit); + + if (solde.compareTo(BigDecimal.ZERO) == 1) { + balanceReportAccount.setSoldeDebit(String.valueOf(solde.abs())); + balanceReportAccount.setSoldeCredit(""); + } else { + balanceReportAccount.setSoldeCredit(solde.compareTo(BigDecimal.ZERO) == 0 ? "" : String.valueOf(solde.abs())); + balanceReportAccount.setSoldeDebit(""); + + } + + balanceReportAccount.setAmountCredit(credit.compareTo(BigDecimal.ZERO) == 0 ? "" : String.valueOf(credit)); + balanceReportAccount.setAmountDebit(debit.compareTo(BigDecimal.ZERO) == 0 ? "" : String.valueOf(debit)); + + return balanceReportAccount; + } +} diff --git a/lima-business/src/main/java/org/chorem/lima/service/package-info.java b/lima-business/src/main/java/org/chorem/lima/service/package-info.java deleted file mode 100644 index 1b461f0..0000000 --- a/lima-business/src/main/java/org/chorem/lima/service/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * #%L - * Lima :: business - * %% - * Copyright (C) 2012 CodeLutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -/** - * This package defined factory to access for service definied on OpenEJB. - * - * This is a client side package but can be usefull for unit test too. - */ -package org.chorem.lima.service; diff --git a/lima-callao/src/main/java/org/chorem/lima/beans/BalanceReportAccountImpl.java b/lima-callao/src/main/java/org/chorem/lima/beans/BalanceReportAccountImpl.java new file mode 100644 index 0000000..b69f7db --- /dev/null +++ b/lima-callao/src/main/java/org/chorem/lima/beans/BalanceReportAccountImpl.java @@ -0,0 +1,41 @@ +package org.chorem.lima.beans; + + +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; + +public class BalanceReportAccountImpl extends BalanceReportAccount { + + private static final long serialVersionUID = 1L; + + public void addSubAccount(BalanceReportAccount subAccount) { + + // we only add account that have values + if (StringUtils.isNotBlank(subAccount.getAmountDebit()) && StringUtils.isNotBlank(subAccount.getAmountCredit())) { + getSubAccounts().add(subAccount); + + BigDecimal newAmountDebit = StringUtils.isBlank(this.amountDebit) ? BigDecimal.ZERO : BigDecimal.valueOf(Double.parseDouble(this.amountDebit)); + BigDecimal newAmountCredit = StringUtils.isBlank(this.amountCredit) ? BigDecimal.ZERO : BigDecimal.valueOf(Double.parseDouble(this.amountCredit)); + BigDecimal newSoldeDebit = StringUtils.isBlank(this.soldeDebit) ? BigDecimal.ZERO : BigDecimal.valueOf(Double.parseDouble(this.soldeDebit)); + BigDecimal newSoldeCredit = StringUtils.isBlank(this.soldeCredit) ? BigDecimal.ZERO : BigDecimal.valueOf(Double.parseDouble(this.soldeCredit)); + + if (StringUtils.isNotBlank(subAccount.getAmountDebit())) { + this.amountDebit = String.valueOf(BigDecimal.valueOf(Double.parseDouble(subAccount.getAmountDebit())).add(newAmountDebit)); + } + + if (StringUtils.isNotBlank(subAccount.getAmountCredit())) { + this.amountCredit = String.valueOf(BigDecimal.valueOf(Double.parseDouble(subAccount.getAmountCredit())).add(newAmountCredit)); + } + + if (StringUtils.isNotBlank(subAccount.getSoldeDebit())) { + this.soldeDebit = String.valueOf(BigDecimal.valueOf(Double.parseDouble(subAccount.getSoldeDebit())).add(newSoldeDebit)); + } + if (StringUtils.isNotBlank(subAccount.getSoldeCredit())) { + this.soldeCredit = String.valueOf(BigDecimal.valueOf(Double.parseDouble(subAccount.getSoldeCredit())).add(newSoldeCredit)); + } + } + +// firePropertyChange(PROPERTY_SUB_ACCOUNTS, null, subAccount); + } +} diff --git a/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java b/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java index 9079327..68f3eb6 100644 --- a/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java +++ b/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java @@ -256,7 +256,7 @@ public class EntryTopiaDao extends AbstractEntryTopiaDao<Entry> { } /** - * gat all entries where some field are not filled in. + * get all entries where some field are not filled in. * * @param beginDate begin date * @param endDate end date diff --git a/lima-callao/src/main/xmi/accounting-model.zargo b/lima-callao/src/main/xmi/accounting-model.zargo index 7164628..a308d61 100644 Binary files a/lima-callao/src/main/xmi/accounting-model.zargo and b/lima-callao/src/main/xmi/accounting-model.zargo differ diff --git a/lima-swing/pom.xml b/lima-swing/pom.xml index 5edb383..f2a02f3 100644 --- a/lima-swing/pom.xml +++ b/lima-swing/pom.xml @@ -58,6 +58,12 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>lima-web</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>lima-callao</artifactId> <version>${project.version}</version> <scope>compile</scope> @@ -175,11 +181,6 @@ <artifactId>commons-lang</artifactId> </dependency> - <dependency> - <groupId>net.sf.jasperreports</groupId> - <artifactId>jasperreports</artifactId> - </dependency> - </dependencies> <build> @@ -204,25 +205,6 @@ <plugins> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jasperreports-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>compile-reports</goal> - </goals> - </execution> - </executions> - <dependencies> - <!--note this must be repeated here to pick up correct xml validation --> - <dependency> - <groupId>net.sf.jasperreports</groupId> - <artifactId>jasperreports</artifactId> - </dependency> - </dependencies> - </plugin> - - <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> diff --git a/lima-swing/src/main/filters/pom.properties b/lima-swing/src/main/filters/pom.properties index afdf399..0ab2863 100644 --- a/lima-swing/src/main/filters/pom.properties +++ b/lima-swing/src/main/filters/pom.properties @@ -20,9 +20,9 @@ # #L% ### # mock service -#serviceFactory.impl=org.chorem.lima.service.mock.MockServiceFactory +#serviceFactory.impl=org.chorem.lima.web.service.mock.MockServiceFactory # neogia service -#serviceFactory.impl=org.chorem.lima.service.neogia.NeogiaServiceFactory +#serviceFactory.impl=org.chorem.lima.web.service.neogia.NeogiaServiceFactory # callao implementation -serviceFactory.impl=org.chorem.lima.service.callao.CallaoServiceFactory +serviceFactory.impl=org.chorem.lima.web.service.callao.CallaoServiceFactory encoding=UTF-8 diff --git a/lima-swing/src/main/jasperreports/balance/BalanceReport.jrxml b/lima-swing/src/main/jasperreports/balance/BalanceReport.jrxml deleted file mode 100644 index b26c9fe..0000000 --- a/lima-swing/src/main/jasperreports/balance/BalanceReport.jrxml +++ /dev/null @@ -1,292 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 --> -<!-- 2014-10-09T13:51:26 --> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceReport" pageWidth="595" pageHeight="842" columnWidth="575" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" uuid="66929b65-d52d-4e6b-8d8e-8bd4ef5ac821"> - <property name="com.jaspersoft.studio.data.defaultdataadapter" value="BalanceBeanAdapter"/> - <property name="com.jaspersoft.studio.unit." value="pixel"/> - <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> - <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/> - <queryString> - <![CDATA[]]> - </queryString> - <field name="fromDate" class="java.util.Date"/> - <field name="toDate" class="java.util.Date"/> - <field name="currency" class="java.lang.String"/> - <field name="fromAccount" class="java.lang.String"/> - <field name="toAccount" class="java.lang.String"/> - <field name="accounts" class="java.util.List"/> - <field name="balanceReportAccountPath" class="java.lang.String"/> - <variable name="accounts" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"> - <variableExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource((java.util.List)$F{accounts})]]></variableExpression> - </variable> - <group name="accounts"/> - <background> - <band splitType="Stretch"/> - </background> - <title> - <band height="74" splitType="Stretch"> - <frame> - <reportElement mode="Opaque" x="0" y="1" width="578" height="40" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="1aba49d4-0acc-4925-8731-13c1cc1a90f4"/> - <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textField pattern="dd/MM/yyyy"> - <reportElement x="210" y="20" width="80" height="20" forecolor="#736343" uuid="37d0a47c-0197-4f09-8358-823b39a2a42a"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <textElement verticalAlignment="Middle"> - <font isBold="true"/> - </textElement> - <textFieldExpression><![CDATA[$F{fromDate}]]></textFieldExpression> - </textField> - <staticText> - <reportElement x="0" y="0" width="578" height="20" forecolor="#736343" uuid="e7bf1b4c-d748-4c99-b9e2-838903711b48"/> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font fontName="DejaVu Sans" size="14" isBold="true" pdfFontName="Times-Roman"/> - </textElement> - <text><![CDATA[Balance]]></text> - </staticText> - <textField pattern="dd/MM/yyyy HH:mm"> - <reportElement x="480" y="0" width="98" height="20" forecolor="#736343" uuid="a60d5d40-69ac-4c50-a33a-67c26cce05f3"/> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="10" isBold="false"/> - </textElement> - <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> - </textField> - <staticText> - <reportElement x="422" y="0" width="58" height="20" forecolor="#736343" uuid="ddf50f55-7669-44be-b427-d03bc72cc264"/> - <textElement textAlignment="Center" verticalAlignment="Middle"/> - <text><![CDATA[Edition du:]]></text> - </staticText> - <staticText> - <reportElement x="190" y="20" width="20" height="20" forecolor="#736343" uuid="08282b18-8e67-4bcb-878e-ac97dc0bbc5b"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - </reportElement> - <textElement verticalAlignment="Middle"> - <font isBold="true"/> - </textElement> - <text><![CDATA[Du]]></text> - </staticText> - <staticText> - <reportElement x="290" y="20" width="20" height="20" forecolor="#736343" uuid="e149a451-2c1c-4d8d-9b01-85e35144eb86"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - </reportElement> - <textElement verticalAlignment="Middle"> - <font isBold="true"/> - </textElement> - <text><![CDATA[au]]></text> - </staticText> - <textField pattern="dd/MM/yyyy"> - <reportElement x="310" y="20" width="80" height="20" forecolor="#736343" uuid="5fc4df4a-5930-4ccd-b450-cf7aac6be57b"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - </reportElement> - <textElement verticalAlignment="Middle"> - <font isBold="true"/> - </textElement> - <textFieldExpression><![CDATA[$F{toDate}]]></textFieldExpression> - </textField> - </frame> - <staticText> - <reportElement x="0" y="53" width="40" height="20" forecolor="#736343" uuid="02207af8-5ccd-43c9-b475-acb534bcd6cf"/> - <text><![CDATA[Devise:]]></text> - </staticText> - <textField> - <reportElement x="41" y="53" width="100" height="20" forecolor="#736343" uuid="abcb18cb-7d0e-4eb8-a9f5-aca4baffa9ae"/> - <textFieldExpression><![CDATA[$F{currency}]]></textFieldExpression> - </textField> - </band> - </title> - <pageHeader> - <band height="38" splitType="Stretch"> - <staticText> - <reportElement x="0" y="9" width="50" height="16" uuid="33ba6496-bc27-466f-9764-7336b6741c13"/> - <textElement> - <font isItalic="true"/> - </textElement> - <text><![CDATA[Comptes :]]></text> - </staticText> - <staticText> - <reportElement x="100" y="9" width="20" height="16" uuid="cd1272d9-f113-4552-a19f-941ec046265e"/> - <textElement> - <font isItalic="true"/> - </textElement> - <text><![CDATA[à :]]></text> - </staticText> - <textField isBlankWhenNull="true"> - <reportElement x="50" y="9" width="50" height="16" uuid="9db3917c-44e3-46d2-b95a-6463e5eff328"/> - <textElement> - <font isItalic="true"/> - </textElement> - <textFieldExpression><![CDATA[$F{fromAccount}]]></textFieldExpression> - </textField> - <textField> - <reportElement x="120" y="9" width="80" height="16" uuid="05525266-9965-4412-bef5-eb7dc7b1be42"/> - <textElement> - <font isItalic="true"/> - </textElement> - <textFieldExpression><![CDATA[$F{toAccount}]]></textFieldExpression> - </textField> - </band> - </pageHeader> - <columnHeader> - <band height="20"> - <frame> - <reportElement style="Column header" mode="Opaque" x="0" y="0" width="578" height="20" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="6c2c2b44-eebf-41d3-8b56-47d4a20a4b24"> - <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> - </reportElement> - <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <staticText> - <reportElement x="0" y="0" width="40" height="20" uuid="63da28a1-a793-4bf5-81d4-6a4d6fc1e4df"> - <property name="local_mesure_unitwidth" value="pixel"/> - </reportElement> - <box> - <rightPen lineWidth="0.6"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Compte]]></text> - </staticText> - <staticText> - <reportElement x="40" y="0" width="250" height="20" uuid="da44668c-4f62-4f75-abaf-cb941b73bfcb"> - <property name="local_mesure_unitheight" value="pixel"/> - </reportElement> - <box> - <topPen lineWidth="0.6"/> - <leftPen lineWidth="0.6"/> - <bottomPen lineWidth="0.6"/> - <rightPen lineWidth="0.6"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Intitulé]]></text> - </staticText> - <staticText> - <reportElement x="290" y="0" width="144" height="10" uuid="caadc464-ad77-4b53-b5cb-11e29c0a18ce"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Total Période]]></text> - </staticText> - <staticText> - <reportElement x="290" y="10" width="72" height="10" uuid="e6928f86-fe5c-4c14-996c-19728e6abf44"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <rightPen lineWidth="0.6"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Débit]]></text> - </staticText> - <staticText> - <reportElement x="362" y="10" width="72" height="10" uuid="13dd0f7b-3331-4ca4-8ef8-5468fb65fc3e"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <rightPen lineWidth="0.6"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Crédit]]></text> - </staticText> - <staticText> - <reportElement x="434" y="0" width="144" height="10" uuid="1bc6ab8b-d490-46a2-9a10-8f4c4f219889"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Solde Période]]></text> - </staticText> - <staticText> - <reportElement x="434" y="10" width="72" height="10" uuid="b6ea8597-d637-47d1-9a39-7c99101594e9"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.6"/> - <leftPen lineWidth="0.6"/> - <bottomPen lineWidth="0.6"/> - <rightPen lineWidth="0.6"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Débit]]></text> - </staticText> - <staticText> - <reportElement x="506" y="10" width="72" height="10" uuid="c4f9f592-7052-4b66-abc2-f04cc5f3972c"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <rightPen lineWidth="0.6"/> - </box> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="8"/> - </textElement> - <text><![CDATA[Crédit]]></text> - </staticText> - </frame> - </band> - </columnHeader> - <detail> - <band height="21" splitType="Stretch"> - <subreport isUsingCache="false" runToBottom="false"> - <reportElement key="subreport-5" positionType="Float" mode="Transparent" x="0" y="0" width="578" height="20" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"/> - <dataSourceExpression><![CDATA[$V{accounts}]]></dataSourceExpression> - <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{balanceReportAccountPath})]]></subreportExpression> - </subreport> - </band> - </detail> - <pageFooter> - <band height="54" splitType="Stretch"/> - </pageFooter> -</jasperReport> diff --git a/lima-swing/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml b/lima-swing/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml deleted file mode 100644 index c2be540..0000000 --- a/lima-swing/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 --> -<!-- 2014-10-09T13:04:10 --> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> - <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> - <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> - <property name="com.jaspersoft.studio.unit." value="pixel"/> - <queryString> - <![CDATA[]]> - </queryString> - <field name="accountNumber" class="java.lang.String"/> - <field name="label" class="java.lang.String"/> - <field name="amountDebit" class="java.lang.String"/> - <field name="amountCredit" class="java.lang.String"/> - <field name="soldeDebit" class="java.lang.String"/> - <field name="soldeCredit" class="java.lang.String"/> - <field name="subAccounts" class="java.util.List"/> - <field name="balanceSubAccountsReportPath" class="java.lang.String"/> - <variable name="subAccounts" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"> - <variableExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource((java.util.List)$F{subAccounts})]]></variableExpression> - </variable> - <detail> - <band height="10" splitType="Stretch"> - <subreport isUsingCache="false" runToBottom="false"> - <reportElement key="subreport-5" positionType="Float" mode="Transparent" x="0" y="0" width="578" height="10" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"/> - <dataSourceExpression><![CDATA[$V{subAccounts}]]></dataSourceExpression> - <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{balanceSubAccountsReportPath})]]></subreportExpression> - </subreport> - </band> - <band height="11" splitType="Stretch"> - <textField isBlankWhenNull="true"> - <reportElement x="0" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8" isBold="true"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="40" y="0" width="250" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> - <property name="local_mesure_unity" value="pixel"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8" isBold="true"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="290" y="0" width="72" height="10" uuid="e774e638-6353-46d0-9968-15992ef50bd3"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8" isBold="true"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{amountDebit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="362" y="0" width="72" height="10" uuid="daac5561-4c81-4582-aabf-e8034c2cf93e"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8" isBold="true"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{amountCredit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8" isBold="true"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8" isBold="true"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> - </textField> - </band> - </detail> - <columnFooter> - <band height="1"> - <line> - <reportElement x="0" y="0" width="578" height="1" uuid="ca761e3c-0dba-448f-a60d-afc241c74411"/> - </line> - </band> - </columnFooter> -</jasperReport> diff --git a/lima-swing/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml b/lima-swing/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml deleted file mode 100644 index 53bfca0..0000000 --- a/lima-swing/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml +++ /dev/null @@ -1,107 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 --> -<!-- 2014-10-09T13:05:11 --> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> - <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> - <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> - <property name="com.jaspersoft.studio.unit." value="pixel"/> - <queryString> - <![CDATA[]]> - </queryString> - <field name="accountNumber" class="java.lang.String"/> - <field name="label" class="java.lang.String"/> - <field name="amountDebit" class="java.lang.String"/> - <field name="amountCredit" class="java.lang.String"/> - <field name="soldeDebit" class="java.lang.String"/> - <field name="soldeCredit" class="java.lang.String"/> - <detail> - <band height="10" splitType="Stretch"> - <textField isBlankWhenNull="true"> - <reportElement x="0" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="40" y="0" width="250" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> - <property name="local_mesure_unity" value="pixel"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="290" y="0" width="72" height="10" uuid="e774e638-6353-46d0-9968-15992ef50bd3"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{amountDebit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="362" y="0" width="72" height="10" uuid="daac5561-4c81-4582-aabf-e8034c2cf93e"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{amountCredit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8"/> - <paragraph rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> - </textField> - </band> - </detail> -</jasperReport> diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java index b83de13..23070eb 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java @@ -26,11 +26,11 @@ import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.api.AccountService; -import org.chorem.lima.business.api.HttpServerService; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; import org.chorem.lima.ui.MainViewHandler; import org.chorem.lima.ui.opening.OpeningView; +import org.chorem.lima.web.service.HttpServerService; import javax.swing.*; import java.util.Arrays; @@ -55,6 +55,9 @@ public class LimaMain { /** splash */ protected static LimaSplash splash; + /** http serveur */ + protected static HttpServerService httpServerService; + /** * Lima main method. * @@ -144,11 +147,11 @@ public class LimaMain { // if not, call #loadDefaultAccount() splash.updateProgression(0.7, t("lima.launch.accounting")); - //start http server - LimaServiceFactory.getService(HttpServerService.class).start(); - AccountService accountService = LimaServiceFactory.getService(AccountService.class); + //start http server + getHttpServerService().start(); + long accountCount = accountService.getAccountCount(); if (accountCount == 0) { if (log.isInfoEnabled()) { @@ -195,4 +198,11 @@ public class LimaMain { } } } + + public static HttpServerService getHttpServerService() { + if (httpServerService == null) { + httpServerService = new HttpServerService(); + } + return httpServerService; + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java index d9a3180..62e70bb 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java @@ -27,9 +27,9 @@ import jaxx.runtime.swing.AboutPanel; import jaxx.runtime.swing.config.ConfigUIHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaMain; import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.LimaSwingConfig; -import org.chorem.lima.business.api.HttpServerService; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.account.AccountView; @@ -482,8 +482,7 @@ public class MainViewHandler { } public void loadURI(MainView ui) { - int port = LimaServiceFactory.getService( - HttpServerService.class).getHttpPort(); + int port = LimaMain.getHttpServerService().getHttpPort(); String address = LimaSwingConfig.getInstance().getHostAdress(); String url = "http://" + address + ":" + port + "/"; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index bce6335..e1d5e13 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -336,7 +336,7 @@ public class LetteringViewHandler{ BigDecimal creditVal = debit ? BigDecimal.ZERO : amount; if (log.isDebugEnabled()) { - log.debug("Balance calculation"); + log.debug("balance calculation"); } if (debitVal.equals(BigDecimal.ZERO)){ diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/report/ReportBuilder.java b/lima-swing/src/main/java/org/chorem/lima/ui/report/ReportBuilder.java deleted file mode 100644 index 3b734a2..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/report/ReportBuilder.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.chorem.lima.ui.report; - -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2014 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import net.sf.jasperreports.engine.JRException; -import net.sf.jasperreports.engine.JasperCompileManager; -import net.sf.jasperreports.engine.JasperExportManager; -import net.sf.jasperreports.engine.JasperFillManager; -import net.sf.jasperreports.engine.JasperPrint; -import net.sf.jasperreports.engine.JasperReport; -import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaTechnicalException; -import java.io.File; -import org.apache.commons.logging.Log; -import org.chorem.lima.ui.report.dataSource.AccountCustomDataSourceFabric; -import org.chorem.lima.ui.report.dataSource.BalanceCustomDataSourceFabric; - -import java.util.HashMap; - -/** - * Created by davidcosse on 02/10/14. - */ -public class ReportBuilder { - - private static final Log log = LogFactory.getLog(ReportBuilder.class); - - protected JasperReport accountReport; - protected JasperReport balanceReport; - - // TODO DCossé 02/10/14 remove it as soon as maven jasper plugin works - public ReportBuilder() { - try { - // compile phase - String rootPath = new File("").getAbsolutePath(); - accountReport = JasperCompileManager.compileReport(rootPath + "/src/main/jasperreports/accounts/AccountReport.jrxml"); - balanceReport= JasperCompileManager.compileReport(rootPath + "/src/main/jasperreports/balance/BalanceReport.jrxml"); - } catch (JRException e) { - throw new LimaTechnicalException(e); - } - } - - - public void generateAccountReport(String path) { - - try { - // fill up report - JasperPrint jasperPrint = JasperFillManager.fillReport(accountReport, new HashMap(), new JRBeanCollectionDataSource(ReportFactory.createNewAccountBeanDocument())); - // same as before but with call to custom datasource -// JasperPrint jasperPrint = JasperFillManager.fillReport(accountReport, new HashMap(), new AccountCustomDataSourceFabric.AccountCustomDataSource()); - - // eport to PDF - JasperExportManager.exportReportToPdfFile(jasperPrint, path); - if (log.isInfoEnabled()) { - log.info("Rapport généré:"+path); - } - - } catch (JRException e) { - throw new LimaTechnicalException(e); - } - - } - - public void generateBalanceReport(String path) { - - try { - // fill up report - JasperPrint jasperPrint = JasperFillManager.fillReport(balanceReport, new HashMap(), new JRBeanCollectionDataSource(ReportFactory.createBalanceBeanCollection())); - // same as before but with call to custom datasource -// JasperPrint jasperPrint = JasperFillManager.fillReport(balanceReport, new HashMap(), new BalanceCustomDataSourceFabric.BalanceCustomData()); - - // eport to PDF - JasperExportManager.exportReportToPdfFile(jasperPrint, path); - if (log.isInfoEnabled()) { - log.info("Rapport généré:"+path); - } - - } catch (JRException e) { - throw new LimaTechnicalException(e); - } - - } - - public void generateBalanceReportAccount() { - - } -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/report/ReportFactory.java b/lima-swing/src/main/java/org/chorem/lima/ui/report/ReportFactory.java deleted file mode 100644 index a55a9e5..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/report/ReportFactory.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.chorem.lima.ui.report; - -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2014 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.Lists; -import net.sf.jasperreports.engine.JRDataSource; -import org.chorem.lima.beans.AccountBean; -import org.chorem.lima.beans.AccountBeanImpl; -import org.chorem.lima.beans.BalanceReport; -import org.chorem.lima.beans.BalanceReportAccount; -import org.chorem.lima.beans.BalanceReportAccountImpl; -import org.chorem.lima.beans.BalanceReportImpl; -import org.chorem.lima.business.api.AccountService; -import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.report.dataSource.AccountCustomDataSourceFabric; - -import java.io.File; -import java.util.Date; -import java.util.List; - -/** - * Created by davidcosse on 02/10/14. - */ -public class ReportFactory { - - protected static AccountService accountService; - protected static String rootPath = new File("").getAbsolutePath(); - protected static String balanceReportAccountReportPath = rootPath + "/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml"; - protected static String balanceSubAccountsReport = rootPath + "/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml"; - - - public static List<org.chorem.lima.entity.Account> createNewAccountDocument() { - accountService = LimaServiceFactory.getService(AccountService.class); - List<org.chorem.lima.entity.Account> accounts = accountService.getAllAccounts(); - return accounts; - } - - public static List<AccountBean> createNewAccountBeanDocument() { - AccountBean a1 = new AccountBeanImpl(); - a1.setAccountNumber("000"); - a1.setLabel("premier"); - - AccountBean a2 = new AccountBeanImpl(); - a2.setAccountNumber("001"); - a2.setLabel("deuxième"); - - AccountBean a3 = new AccountBeanImpl(); - a3.setAccountNumber("002"); - a3.setLabel("troisième"); - - AccountBean a4 = new AccountBeanImpl(); - a4.setAccountNumber("003"); - a4.setLabel("quatrième"); - List<AccountBean> accounts = Lists.newArrayList(a1, a2, a3, a4); - return accounts; - } - - public static List<BalanceReport> createBalanceBeanCollection() { - BalanceReport br0 = new BalanceReportImpl(); - br0.setCurrency("EURO"); - br0.setFromAccount("100000"); - br0.setToAccount("999999"); - br0.setFromDate(new Date()); - br0.setToDate(new Date()); - br0.setBalanceReportAccountPath(balanceReportAccountReportPath); - - BalanceReportAccount class1 = new BalanceReportAccountImpl(); - class1.setBalanceSubAccountsReportPath(balanceSubAccountsReport); - br0.addAccounts(class1); - - class1.setAccountNumber("100000"); - class1.setLabel("TOTAL 1"); - class1.setAmountDebit("1 176 285.16"); - class1.setAmountCredit("224 466.74"); - class1.setSoldeDebit("1 007 245.42"); - class1.setSoldeCredit("55 427.00"); - - BalanceReportAccount a110000 = new BalanceReportAccountImpl(); - a110000.setAccountNumber("110000"); - a110000.setLabel("report à nouveau"); - a110000.setAmountDebit("2 677.00"); - a110000.setAmountCredit("1 343.00"); - a110000.setSoldeDebit("1 334.00"); - - BalanceReportAccount a108 = new BalanceReportAccountImpl(); - a108.setAccountNumber("108000"); - a108.setLabel("Compte de l'exploitant"); - a108.setAmountDebit("27 023.73"); - a108.setAmountCredit("15 300.00"); - a108.setSoldeDebit("11 723.73"); - - class1.addSubAccounts(a110000); - class1.addSubAccounts(a108); - - BalanceReportAccount class2 = new BalanceReportAccountImpl(); - class2.setBalanceSubAccountsReportPath(balanceSubAccountsReport); - br0.addAccounts(class2); - - class2.setAccountNumber("200000"); - class2.setLabel("TOTAL 2"); - class2.setAmountDebit("2 867 904.76"); - class2.setAmountCredit("2 867 904.76"); - class2.setSoldeDebit("1 979 199.44"); - class2.setSoldeCredit("1 979 199.44"); - - BalanceReportAccount a2815 = new BalanceReportAccountImpl(); - a2815.setAccountNumber("a28150"); - a2815.setLabel("Installations techniques; matériel et outillage industriels"); - a2815.setAmountDebit("37 446.00"); - a2815.setAmountCredit("32 020.00"); - a2815.setSoldeDebit("5 426.00"); - - BalanceReportAccount a28130000 = new BalanceReportAccountImpl(); - a28130000.setAccountNumber("28130000"); - a28130000.setLabel("Constructions même ventilation que celle du compte 213"); - - class2.addSubAccounts(a2815); - class2.addSubAccounts(a28130000); - - List<BalanceReport> result = Lists.newArrayList(br0); - return result; - } - - public static JRDataSource getAccountJRDatadSource() { - return new AccountCustomDataSourceFabric.AccountCustomDataSource(); - } - -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/report/dataSource/AccountCustomDataSourceFabric.java b/lima-swing/src/main/java/org/chorem/lima/ui/report/dataSource/AccountCustomDataSourceFabric.java deleted file mode 100644 index 3760dbb..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/report/dataSource/AccountCustomDataSourceFabric.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.chorem.lima.ui.report.dataSource; - -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2014 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import net.sf.jasperreports.engine.JRDataSource; -import net.sf.jasperreports.engine.JRDataSourceProvider; -import net.sf.jasperreports.engine.JRException; -import net.sf.jasperreports.engine.JRField; -import net.sf.jasperreports.engine.JasperReport; -import net.sf.jasperreports.engine.base.JRBaseField; -import org.chorem.lima.beans.AccountBean; -import org.chorem.lima.ui.report.ReportFactory; - -import java.util.HashMap; -import java.util.List; - -/** - * Created by davidcosse on 28/10/14. - */ -public class AccountCustomDataSourceFabric { - /** - * Created by davidcosse on 03/10/14. - * this class will be removed. - * It show how to configure a custom datasource - */ - public static class AccountDataSourceProvider implements JRDataSourceProvider { - - private class AccountField extends JRBaseField { - - private static final long serialVersionUID = 4771755443118002691L; - - public AccountField(String name, String description, Class<?> type) { - this.name = name; - this.description = description; - this.valueClass = type; - this.valueClassName = type.getName(); - } - - public AccountField(String name,String description){ - this(name, description, String.class); - } - } - - @Override - public boolean supportsGetFieldsOperation() { - return true; - } - - @Override - public JRField[] getFields(JasperReport report) throws JRException, UnsupportedOperationException { - JRField field1 = new AccountField("accountNumber","Account number"); - JRField field2 = new AccountField("label","acount description"); - return new JRField[]{field1, field2}; - } - - @Override - public JRDataSource create(JasperReport report) throws JRException { - return new AccountCustomDataSource(ReportFactory.createNewAccountBeanDocument()); - } - - @Override - public void dispose(JRDataSource dataSource) throws JRException { - - } - } - - /** - * Created by davidcosse on 03/10/14. - */ - public static class AccountCustomDataSource implements JRDataSource { - - private static List<AccountBean> accounts; - - public AccountCustomDataSource() { - this.accounts= ReportFactory.createNewAccountBeanDocument(); - } - - public AccountCustomDataSource(List<AccountBean> accounts) { - this.accounts = accounts; - } - - /** - * Variables to store the number of fields, and their names, in the report - */ - private HashMap<String, Integer> fieldsNumber = new HashMap<String, Integer>(); - private int lastFieldsAdded = 0; - - /** - * Variable to store how much records were read - */ - private int counter = -1; - - @Override - public boolean next() throws JRException { - if (counter<accounts.size()-1) { - counter++; - return true; - } - return false; - } - - @Override - public Object getFieldValue(JRField jrField) throws JRException { - Integer fieldIndex; - if (fieldsNumber.containsKey(jrField.getName())) - fieldIndex = fieldsNumber.get(jrField.getName()); - else { - fieldsNumber.put(jrField.getName(), lastFieldsAdded); - fieldIndex = lastFieldsAdded; - lastFieldsAdded ++; - } - if (fieldIndex == 0) return accounts.get(counter).getAccountNumber(); - else if (fieldIndex == 1) return accounts.get(counter).getLabel(); - return ""; - } - } -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/report/dataSource/BalanceCustomDataSourceFabric.java b/lima-swing/src/main/java/org/chorem/lima/ui/report/dataSource/BalanceCustomDataSourceFabric.java deleted file mode 100644 index f432eff..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/report/dataSource/BalanceCustomDataSourceFabric.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.chorem.lima.ui.report.dataSource; - -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2014 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import net.sf.jasperreports.engine.JRDataSource; -import net.sf.jasperreports.engine.JRDataSourceProvider; -import net.sf.jasperreports.engine.JRException; -import net.sf.jasperreports.engine.JRField; -import net.sf.jasperreports.engine.JasperReport; -import net.sf.jasperreports.engine.base.JRBaseField; -import org.chorem.lima.beans.BalanceReport; -import org.chorem.lima.ui.report.ReportFactory; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; - -/** - * Created by davidcosse on 28/10/14. - * this class will be removed. - * It show how to configure a custom datasource - */ -public class BalanceCustomDataSourceFabric { - - /** - * Created by davidcosse on 28/10/14. - */ - public static class BalanceDataSourceProvider implements JRDataSourceProvider { - - private class BalanceField extends JRBaseField { - - private static final long serialVersionUID = 1L; - - public BalanceField(String name, String description, Class<?> type) { - this.name = name; - this.description = description; - this.valueClass = type; - this.valueClassName = type.getName(); - } - - public BalanceField(String name,String description){ - this(name, description, String.class); - } - } - - @Override - public boolean supportsGetFieldsOperation() { - return true; - } - - @Override - public JRField[] getFields(JasperReport report) throws JRException, UnsupportedOperationException { - JRField field1 = new BalanceField("fromDate","du", Date.class); - JRField field2 = new BalanceField("toDate","au", Date.class); - JRField field3 = new BalanceField("currency","currency"); - JRField field4 = new BalanceField("fromAccount","du compte"); - JRField field5 = new BalanceField("toAccount","jusqu'au compte"); - JRField field6 = new BalanceField("accounts","comptes", List.class); - - return new JRField[]{field1, field2, field3, field4, field5, field6}; - } - - @Override - public JRDataSource create(JasperReport report) throws JRException { - return new BalanceCustomData(ReportFactory.createBalanceBeanCollection()); - } - - @Override - public void dispose(JRDataSource dataSource) throws JRException { - - } - } - - - public static class BalanceCustomData implements JRDataSource { - private static List<BalanceReport> balanceReports; - - public BalanceCustomData() { - this.balanceReports = ReportFactory.createBalanceBeanCollection(); - } - - public BalanceCustomData(List<BalanceReport> balances) { - this.balanceReports = balances; - } - - /** - * Variables to store the number of fields, and their names, in the report - */ - private HashMap<String, Integer> fieldsNumber = new HashMap<String, Integer>(); - private int lastFieldsAdded = 0; - - /** - * Variable to store how much records were read - */ - private int counter = -1; - - @Override - public boolean next() throws JRException { - if (counter < balanceReports.size() - 1) { - counter++; - return true; - } - return false; - } - - @Override - public Object getFieldValue(JRField jrField) throws JRException { - Integer fieldIndex; - if (fieldsNumber.containsKey(jrField.getName())) - fieldIndex = fieldsNumber.get(jrField.getName()); - else { - fieldsNumber.put(jrField.getName(), lastFieldsAdded); - fieldIndex = lastFieldsAdded; - lastFieldsAdded++; - } - - if (fieldIndex == 0) return balanceReports.get(counter).getFromDate(); - else if (fieldIndex == 1) return balanceReports.get(counter).getToDate(); - else if (fieldIndex == 2) return balanceReports.get(counter).getCurrency(); - else if (fieldIndex == 3) return balanceReports.get(counter).getFromAccount(); - else if (fieldIndex == 4) return balanceReports.get(counter).getToAccount(); - else if (fieldIndex == 5) return balanceReports.get(counter).getAccounts(); - return ""; - } - - } -} diff --git a/lima-web/LICENSE.txt b/lima-web/LICENSE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/lima-web/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/lima-web/README.txt b/lima-web/README.txt new file mode 100644 index 0000000..be7fe95 --- /dev/null +++ b/lima-web/README.txt @@ -0,0 +1,20 @@ +Présentation : + +Acronyme de Lutin Invoice Monitoring and Accounting, +l'application de comptabilité Lima est un logiciel libre pensé pour être le plus ergonomique possible et facile d'accès à tout utilisateur, +quelque soit son niveau en comptabilité : débutant comme confirmé. +La particularité de Lima est qu'il s'agit d'un produit évolutif permettant de répondre aux besoins spécifiques de toute entreprise ou organisation, +tout en garantissant le maintien des données comptables. + +Le logiciel est écrit en Java ce qui assure une compatibilité multiplateforme : Windows, Mac OS X, Linux. +Il peut-être installé en fonctionnement client monoposte, ou en configuration client <–> serveur. +Lors d'une installation en client serveur, le moteur de persistence de données est installé coté serveur, +et l'interface est installée sur autant de postes client que désiré. + +Pour lancer l'application : + + Sous Linux : via le script lima ou en ligne de commande java -jar lima.jar ; + + Sous Mac OS X : en double-cliquant sur le jar lima.jar ; + + Sous Windows : en double-cliquant sur l'éxécutable lima.exe. \ No newline at end of file diff --git a/lima-business/pom.xml b/lima-web/pom.xml similarity index 71% copy from lima-business/pom.xml copy to lima-web/pom.xml index 2b6774e..669412a 100644 --- a/lima-business/pom.xml +++ b/lima-web/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -10,38 +11,42 @@ </parent> <groupId>org.chorem.lima</groupId> - <artifactId>lima-business</artifactId> + <artifactId>lima-web</artifactId> - <name>Lima :: business</name> - <description>Business module for lima</description> + <name>Lima :: web</name> + <description>Lima Web Module</description> <properties> <!--Main class in JAR --> <maven.jar.main.class>org.chorem.lima.LimaServer</maven.jar.main.class> <redmine.releaseFiles> - target/lima-server-${project.version}-bin.zip + target/lima-web-server-${project.version}-bin.zip </redmine.releaseFiles> </properties> <dependencies> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>lima-callao</artifactId> + <artifactId>lima-business-api</artifactId> <version>${project.version}</version> + <scope>compile</scope> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>lima-business-api</artifactId> + <artifactId>lima-business</artifactId> <version>${project.version}</version> + <scope>compile</scope> </dependency> <dependency> - <groupId>org.apache.pdfbox</groupId> - <artifactId>pdfbox</artifactId> + <groupId>${project.groupId}</groupId> + <artifactId>lima-callao</artifactId> + <version>${project.version}</version> </dependency> <dependency> - <groupId>org.apache.pdfbox</groupId> - <artifactId>pdfbox-examples</artifactId> + <groupId>${project.groupId}</groupId> + <artifactId>lima-business-api</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>junit</groupId> @@ -52,67 +57,18 @@ <artifactId>nuiton-utils</artifactId> </dependency> <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - </dependency> - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-persistence</artifactId> - </dependency> - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-service-flyway</artifactId> - </dependency> - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-config</artifactId> - </dependency> - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-csv</artifactId> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - </dependency> - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>javaee-api</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-ejbd</artifactId> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> <dependency> - <groupId>org.jboss.spec.javax.transaction</groupId> - <artifactId>jboss-transaction-api_1.2_spec</artifactId> - </dependency> - <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> </dependency> @@ -121,10 +77,9 @@ <artifactId>jetty-server</artifactId> </dependency> <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> + <groupId>net.sf.jasperreports</groupId> + <artifactId>jasperreports</artifactId> </dependency> - </dependencies> <build> @@ -146,6 +101,24 @@ <pluginManagement> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jasperreports-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>compile-reports</goal> + </goals> + </execution> + </executions> + <dependencies> + <!--note this must be repeated here to pick up correct xml validation --> + <dependency> + <groupId>net.sf.jasperreports</groupId> + <artifactId>jasperreports</artifactId> + </dependency> + </dependencies> + </plugin> + <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> @@ -202,7 +175,7 @@ <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> - <finalName>lima-server-${project.version}</finalName> + <finalName>lima-web-server-${project.version}</finalName> <descriptors> <descriptor>src/main/assembly/bin.xml</descriptor> </descriptors> @@ -258,4 +231,5 @@ </profile> </profiles> -</project> + +</project> \ No newline at end of file diff --git a/lima-web/src/main/assembly/bin.xml b/lima-web/src/main/assembly/bin.xml new file mode 100644 index 0000000..90d5813 --- /dev/null +++ b/lima-web/src/main/assembly/bin.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Lima :: business + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bin</id> + <formats> + <format>zip</format> + </formats> + + <files> + <file> + <source>target/${project.build.finalName}.${project.packaging}</source> + <destName>lima-server.${project.packaging}</destName> + </file> + <file> + <source>src/main/assembly/lima-server</source> + <fileMode>0755</fileMode> + </file> + </files> + <fileSets> + <fileSet> + <directory>target/lib</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + <excludes> + <exclude>junit-*.jar</exclude> + </excludes> + </fileSet> + <fileSet> + <includes> + <include>README*</include> + <include>LICENSE*</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/resources/reports</directory> + <outputDirectory>reports</outputDirectory> + <includes> + <include>*.pdf</include> + </includes> + </fileSet> + </fileSets> +</assembly> diff --git a/lima-web/src/main/assembly/lima-server b/lima-web/src/main/assembly/lima-server new file mode 100755 index 0000000..f79c621 --- /dev/null +++ b/lima-web/src/main/assembly/lima-server @@ -0,0 +1,9 @@ +#!/bin/sh +MX=512M +cd `dirname $0` +if [ -n "$JAVA_HOME" ]; then + $JAVA_HOME/bin/java -Xmx$MX -Xms$MX -jar ./lima-server.jar $* +else + java -Xmx$MX -Xms$MX -jar ./lima-server.jar $* +fi +cd "$OLDPWD" diff --git a/lima-swing/src/main/jasperreports/accounts/AccountReport.jrxml b/lima-web/src/main/jasperreports/accounts/AccountReport.jrxml similarity index 100% rename from lima-swing/src/main/jasperreports/accounts/AccountReport.jrxml rename to lima-web/src/main/jasperreports/accounts/AccountReport.jrxml diff --git a/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml b/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml new file mode 100644 index 0000000..a0339b9 --- /dev/null +++ b/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml @@ -0,0 +1,347 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2014-11-04T17:37:18 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceReport" pageWidth="595" pageHeight="842" columnWidth="575" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" uuid="66929b65-d52d-4e6b-8d8e-8bd4ef5ac821"> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> + <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <style name="Column header" forecolor="#D0B48E" backcolor="#F2EBDF" fontName="Arial" fontSize="12" isBold="true"/> + <style name="Default" isDefault="true" fontName="Arial" /> + <style name="Default oblique" isDefault="true" fontName="Monospaced" /> + <queryString> + <![CDATA[]]> + </queryString> + <field name="fromDate" class="java.util.Date"/> + <field name="toDate" class="java.util.Date"/> + <field name="currency" class="java.lang.String"/> + <field name="fromAccount" class="java.lang.String"/> + <field name="toAccount" class="java.lang.String"/> + <field name="accounts" class="java.util.List"/> + <field name="balanceReportAccountPath" class="java.lang.String"/> + <field name="companyName" class="java.lang.String"/> + <variable name="accounts" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"> + <variableExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource((java.util.List)$F{accounts})]]></variableExpression> + </variable> + <group name="accounts"/> + <background> + <band splitType="Stretch"/> + </background> + <title> + <band height="41" splitType="Stretch"> + <frame> + <reportElement style="Default" mode="Opaque" x="0" y="1" width="578" height="40" forecolor="#D0B48E" backcolor="#F2EBDF" uuid="1aba49d4-0acc-4925-8731-13c1cc1a90f4"/> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textField pattern="dd/MM/yyyy"> + <reportElement style="Default" x="210" y="20" width="80" height="20" forecolor="#736343" uuid="37d0a47c-0197-4f09-8358-823b39a2a42a"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{fromDate}]]></textFieldExpression> + </textField> + <staticText> + <reportElement style="Default" x="0" y="0" width="578" height="20" forecolor="#736343" uuid="e7bf1b4c-d748-4c99-b9e2-838903711b48"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="14" isBold="true" pdfFontName="Times-Roman"/> + </textElement> + <text><![CDATA[Balance]]></text> + </staticText> + <textField pattern="dd/MM/yyyy HH:mm"> + <reportElement style="Default" x="480" y="0" width="98" height="20" forecolor="#736343" uuid="a60d5d40-69ac-4c50-a33a-67c26cce05f3"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="10" isBold="false"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <staticText> + <reportElement style="Default" x="422" y="0" width="58" height="20" forecolor="#736343" uuid="ddf50f55-7669-44be-b427-d03bc72cc264"/> + <textElement textAlignment="Center" verticalAlignment="Middle"/> + <text><![CDATA[Edition du:]]></text> + </staticText> + <staticText> + <reportElement style="Default" x="190" y="20" width="20" height="20" forecolor="#736343" uuid="08282b18-8e67-4bcb-878e-ac97dc0bbc5b"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <text><![CDATA[Du]]></text> + </staticText> + <staticText> + <reportElement style="Default" x="290" y="20" width="20" height="20" forecolor="#736343" uuid="e149a451-2c1c-4d8d-9b01-85e35144eb86"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <text><![CDATA[au]]></text> + </staticText> + <textField pattern="dd/MM/yyyy"> + <reportElement style="Default" x="310" y="20" width="80" height="20" forecolor="#736343" uuid="5fc4df4a-5930-4ccd-b450-cf7aac6be57b"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{toDate}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="0" y="0" width="190" height="20" forecolor="#736343" uuid="5aa3ceb9-e407-42da-bdc3-097875bdd5f5"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle" rotation="None"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{companyName}]]></textFieldExpression> + </textField> + </frame> + </band> + </title> + <pageHeader> + <band height="25" splitType="Stretch"> + <staticText> + <reportElement style="Default oblique" x="0" y="9" width="42" height="16" uuid="33ba6496-bc27-466f-9764-7336b6741c13"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font size="8" isItalic="true"/> + </textElement> + <text><![CDATA[Comptes :]]></text> + </staticText> + <textField isBlankWhenNull="true"> + <reportElement style="Default oblique" x="42" y="9" width="402" height="16" uuid="9db3917c-44e3-46d2-b95a-6463e5eff328"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8" isItalic="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{fromAccount}]]></textFieldExpression> + </textField> + <staticText> + <reportElement style="Default oblique" x="444" y="9" width="30" height="16" forecolor="#000000" uuid="02207af8-5ccd-43c9-b475-acb534bcd6cf"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Devise:]]></text> + </staticText> + <textField> + <reportElement style="Default oblique" x="474" y="9" width="104" height="16" forecolor="#000000" uuid="abcb18cb-7d0e-4eb8-a9f5-aca4baffa9ae"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{currency}]]></textFieldExpression> + </textField> + </band> + </pageHeader> + <columnHeader> + <band height="20"> + <frame> + <reportElement style="Column header" mode="Opaque" x="0" y="0" width="578" height="20" uuid="6c2c2b44-eebf-41d3-8b56-47d4a20a4b24"> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + </reportElement> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <staticText> + <reportElement x="0" y="0" width="40" height="20" uuid="63da28a1-a793-4bf5-81d4-6a4d6fc1e4df"> + <property name="local_mesure_unitwidth" value="pixel"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Compte]]></text> + </staticText> + <staticText> + <reportElement x="40" y="0" width="250" height="20" uuid="da44668c-4f62-4f75-abaf-cb941b73bfcb"> + <property name="local_mesure_unitheight" value="pixel"/> + </reportElement> + <box> + <topPen lineWidth="0.6"/> + <leftPen lineWidth="0.6"/> + <bottomPen lineWidth="0.6"/> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Intitulé]]></text> + </staticText> + <staticText> + <reportElement x="290" y="0" width="144" height="10" uuid="caadc464-ad77-4b53-b5cb-11e29c0a18ce"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Total Période]]></text> + </staticText> + <staticText> + <reportElement x="290" y="10" width="72" height="10" uuid="e6928f86-fe5c-4c14-996c-19728e6abf44"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Débit]]></text> + </staticText> + <staticText> + <reportElement x="362" y="10" width="72" height="10" uuid="13dd0f7b-3331-4ca4-8ef8-5468fb65fc3e"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Crédit]]></text> + </staticText> + <staticText> + <reportElement x="434" y="0" width="144" height="10" uuid="1bc6ab8b-d490-46a2-9a10-8f4c4f219889"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Solde Période]]></text> + </staticText> + <staticText> + <reportElement x="434" y="10" width="72" height="10" uuid="b6ea8597-d637-47d1-9a39-7c99101594e9"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.6"/> + <leftPen lineWidth="0.6"/> + <bottomPen lineWidth="0.6"/> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Débit]]></text> + </staticText> + <staticText> + <reportElement x="506" y="10" width="72" height="10" uuid="c4f9f592-7052-4b66-abc2-f04cc5f3972c"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <rightPen lineWidth="0.6"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="8"/> + </textElement> + <text><![CDATA[Crédit]]></text> + </staticText> + </frame> + </band> + </columnHeader> + <detail> + <band height="20" splitType="Stretch"> + <subreport isUsingCache="false" runToBottom="false"> + <reportElement key="subreport-5" positionType="Float" mode="Transparent" x="0" y="0" width="578" height="20" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"/> + <dataSourceExpression><![CDATA[$V{accounts}]]></dataSourceExpression> + <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{balanceReportAccountPath})]]></subreportExpression> + </subreport> + </band> + </detail> + <pageFooter> + <band height="10" splitType="Stretch"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <textField> + <reportElement x="295" y="0" width="50" height="10" uuid="bbf610ed-68ca-4ff7-992a-b894a61b2379"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="235" y="0" width="50" height="10" uuid="7f4c8e82-7fe3-4207-ab07-1a8c4d977a94"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="285" y="0" width="10" height="10" uuid="2609dfd4-556d-4dbd-8d23-74474c5b344c"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement textAlignment="Center"> + <font size="8"/> + </textElement> + <text><![CDATA[/]]></text> + </staticText> + </band> + </pageFooter> +</jasperReport> diff --git a/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml b/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml new file mode 100644 index 0000000..e16efa2 --- /dev/null +++ b/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2014-11-04T15:21:19 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <style name="Default" isDefault="true" fontName="Arial" /> + <style name="Default oblique" isDefault="true" fontName="Monospaced" /> + <queryString> + <![CDATA[]]> + </queryString> + <field name="accountNumber" class="java.lang.String"/> + <field name="label" class="java.lang.String"/> + <field name="amountDebit" class="java.lang.String"/> + <field name="amountCredit" class="java.lang.String"/> + <field name="soldeDebit" class="java.lang.String"/> + <field name="soldeCredit" class="java.lang.String"/> + <field name="subAccounts" class="java.util.List"/> + <field name="balanceSubAccountsReportPath" class="java.lang.String"/> + <variable name="subAccounts" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"> + <variableExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource((java.util.List)$F{subAccounts})]]></variableExpression> + </variable> + <detail> + <band height="10" splitType="Stretch"> + <subreport isUsingCache="false" runToBottom="false"> + <reportElement key="subreport-5" positionType="Float" mode="Transparent" x="0" y="0" width="578" height="10" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"/> + <dataSourceExpression><![CDATA[$V{subAccounts}]]></dataSourceExpression> + <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{balanceSubAccountsReportPath})]]></subreportExpression> + </subreport> + </band> + <band height="10" splitType="Stretch"> + <textField isBlankWhenNull="true"> + <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <paragraph lineSpacingSize="0.0" leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="40" y="0" width="250" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> + <property name="local_mesure_unity" value="pixel"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <paragraph lineSpacingSize="0.0" leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="290" y="0" width="72" height="10" uuid="e774e638-6353-46d0-9968-15992ef50bd3"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="362" y="0" width="72" height="10" uuid="daac5561-4c81-4582-aabf-e8034c2cf93e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountCredit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + <!--<font fontName="Courier 10 Pitch" size="8" isBold="true"/>--> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> + </textField> + </band> + </detail> + <columnFooter> + <band height="1"> + <line> + <reportElement style="Default" x="0" y="0" width="578" height="1" uuid="ca761e3c-0dba-448f-a60d-afc241c74411"/> + </line> + </band> + </columnFooter> +</jasperReport> diff --git a/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml b/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml new file mode 100644 index 0000000..b6fb933 --- /dev/null +++ b/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2014-11-04T15:21:33 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <style name="Default" isDefault="true" fontName="Arial" /> + <style name="Default oblique" isDefault="true" fontName="Monospaced" /> + <queryString> + <![CDATA[]]> + </queryString> + <field name="accountNumber" class="java.lang.String"/> + <field name="label" class="java.lang.String"/> + <field name="amountDebit" class="java.lang.String"/> + <field name="amountCredit" class="java.lang.String"/> + <field name="soldeDebit" class="java.lang.String"/> + <field name="soldeCredit" class="java.lang.String"/> + <detail> + <band height="10" splitType="Stretch"> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="0" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="40" y="0" width="250" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> + <property name="local_mesure_unity" value="pixel"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="290" y="0" width="72" height="10" uuid="e774e638-6353-46d0-9968-15992ef50bd3"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="362" y="0" width="72" height="10" uuid="daac5561-4c81-4582-aabf-e8034c2cf93e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{amountCredit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#000000"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <!--<font fontName="Courier 10 Pitch" size="8"/>--> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> + </textField> + </band> + </detail> +</jasperReport> diff --git a/lima-web/src/main/java/org/chorem/lima/LimaServer.java b/lima-web/src/main/java/org/chorem/lima/LimaServer.java new file mode 100644 index 0000000..77c24b9 --- /dev/null +++ b/lima-web/src/main/java/org/chorem/lima/LimaServer.java @@ -0,0 +1,75 @@ +/* + * #%L + * Lima :: business + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.lima; + +import org.apache.openejb.core.LocalInitialContextFactory; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import java.util.Properties; + +/** + * Lima server class. + * <p/> + * Starts openejb server. + * + * @author chatellier + * @version $Revision$ + * <p/> + * Last update : $Date$ + * By : $Author$ + */ +public class LimaServer { + + /** + * Lima server. + * + * @param args + * @throws javax.naming.NamingException + */ + public static void main(String... args) throws NamingException { + Properties properties = new Properties(); + properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName()); + properties.setProperty("openejb.embedded.remotable", "true"); + // Uncomment these properties to change the defaults + //properties.setProperty("ejbd.port", "4202"); + properties.setProperty("ejbd.bind", "0.0.0.0"); + //properties.setProperty("ejbd.threads", "200"); + //properties.setProperty("ejbd.disabled", "false"); + //properties.setProperty("ejbd.only_from", "127.0.0.1,192.168.1.1"); + + new InitialContext(properties); + + // block main otherwize, main will end + synchronized (properties) { + try { + properties.wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + System.out.println("Server shutdown"); + } +} diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java b/lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java similarity index 93% rename from lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java rename to lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java index d5ce60c..13171df 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java +++ b/lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java @@ -20,44 +20,44 @@ * #L% */ -package org.chorem.lima.business.ejb; +package org.chorem.lima.web.action; import com.google.common.base.Strings; +import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.pdfbox.examples.fdf.SetField; import org.apache.pdfbox.pdmodel.PDDocument; import org.chorem.lima.LimaTechnicalException; +import org.chorem.lima.business.api.AccountService; +import org.chorem.lima.business.api.ClosedPeriodicEntryBookService; +import org.chorem.lima.business.api.EntryService; +import org.chorem.lima.business.api.FinancialPeriodService; +import org.chorem.lima.business.api.report.BalanceBeanReportService; +import org.chorem.lima.web.action.balance.BalanceReportBuilder; +import org.chorem.lima.beans.BalanceReport; import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.beans.FinancialStatementAmounts; import org.chorem.lima.beans.GeneralEntryBooksDatas; import org.chorem.lima.beans.GeneralEntryBooksDatasImpl; import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.LimaServiceConfig; -import org.chorem.lima.business.api.DocumentService; import org.chorem.lima.business.api.FinancialStatementService; import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.business.api.ReportService; import org.chorem.lima.business.api.VatStatementService; -import org.chorem.lima.business.utils.DocumentsEnum; import org.chorem.lima.business.utils.EntryComparator; import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.AccountTopiaDao; import org.chorem.lima.entity.ClosedPeriodicEntryBook; -import org.chorem.lima.entity.ClosedPeriodicEntryBookTopiaDao; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; -import org.chorem.lima.entity.EntryTopiaDao; import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialPeriodTopiaDao; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.VatStatement; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.web.utils.DocumentsEnum; -import javax.ejb.EJB; -import javax.ejb.Remote; -import javax.ejb.Stateless; -import javax.ejb.TransactionAttribute; import javax.swing.*; import java.io.File; import java.io.FileInputStream; @@ -72,32 +72,47 @@ import java.util.List; import static org.nuiton.i18n.I18n.t; -/** - * TODO david: 17/01/14, Ce service doit être entièrement revue, !!! - */ -@Stateless -@Remote(DocumentService.class) -@TransactionAttribute -public class DocumentServiceImpl extends AbstractLimaService implements DocumentService { - protected static final Log log = LogFactory.getLog(DocumentServiceImpl.class); +public class DocumentService { + + protected static final Log log = LogFactory.getLog(DocumentService.class); - @EJB private IdentityService identityService; - @EJB private FinancialStatementService financialStatementService; - @EJB private ReportService reportService; - @EJB private VatStatementService vatStatementService; + protected BalanceBeanReportService balanceBeanReportService; + + protected ClosedPeriodicEntryBookService closedPeriodicEntryBookService; + + protected FinancialPeriodService financialPeriodService; + + protected EntryService entryService; + protected String path; - public DocumentServiceImpl() { + protected BalanceReportBuilder balanceReportBuilder; + + protected AccountService accountService; + + + public DocumentService() { path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); + identityService = LimaServiceFactory.getService(IdentityService.class); + financialStatementService = LimaServiceFactory.getService(FinancialStatementService.class); + reportService = LimaServiceFactory.getService(ReportService.class); + vatStatementService = LimaServiceFactory.getService(VatStatementService.class); + balanceBeanReportService = LimaServiceFactory.getService(BalanceBeanReportService.class); + closedPeriodicEntryBookService = LimaServiceFactory.getService(ClosedPeriodicEntryBookService.class); + financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class); + entryService = LimaServiceFactory.getService(EntryService.class); + accountService = LimaServiceFactory.getService(AccountService.class); + + balanceReportBuilder = new BalanceReportBuilder(); if (log.isDebugEnabled()) { log.debug("Path : " + path); @@ -105,7 +120,6 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document } - @Override public String createFinancialStatementsDocuments(Date beginDate, Date endDate) { @@ -243,7 +257,6 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document } //############## Ledger ############## - @Override public String createLedgerDocuments(Date beginDate, Date endDate) { @@ -380,7 +393,6 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document return ledgerReport; } - @Override public String createEntryBooksDocuments(Date beginDate, Date endDate) { String entryBookReport; @@ -390,27 +402,19 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document if (beginDate != null && endDate != null) { - ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = - getDaoHelper().getClosedPeriodicEntryBookDao(); - EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); - //Split list by financialstatement type List<ClosedPeriodicEntryBook> closedPeriodicEntryBookList = - closedPeriodicEntryBookTopiaDao.findAllByDates(beginDate, endDate); + closedPeriodicEntryBookService.getAllByDates(beginDate, endDate); String journal = ""; for (ClosedPeriodicEntryBook closedPeriodicEntryBook : closedPeriodicEntryBookList) { // TODO echatellier 20120509, was not about only // balanced transaction here, normal ? - List<Entry> entries = entryTopiaDao.findAllEntryByDateForEntryBook(closedPeriodicEntryBook.getEntryBook(), - closedPeriodicEntryBook.getFinancialPeriod().getBeginDate(), - closedPeriodicEntryBook.getFinancialPeriod().getEndDate()); + List<Entry> entries = entryService.findAllEntryByDateForEntryBook(closedPeriodicEntryBook); if (entries.size() > 0) { - List<Object[]> results = entryTopiaDao.getDebitCreditOfTransaction(closedPeriodicEntryBook.getEntryBook(), - closedPeriodicEntryBook.getFinancialPeriod().getBeginDate(), - closedPeriodicEntryBook.getFinancialPeriod().getEndDate()); + List<Object[]> results = entryService.findDebitCreditOfTransaction(closedPeriodicEntryBook); BigDecimal debit = BigDecimal.ZERO; BigDecimal credit = BigDecimal.ZERO; int nbAmount = results.size(); @@ -477,9 +481,8 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document return entryBookReport; } - //############## Balance ############## + //############## balance ############## - @Override public String createBalanceDocuments(Date beginDate, Date endDate) { @@ -554,10 +557,7 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document return balanceReport; } - //############## General EntryBook ############## - - - @Override + //############## General EntryBook ############# public String createGeneralEntryBooksDocuments(Date beginDate, Date endDate) { @@ -573,21 +573,15 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document simpleDateFormat.format(endDate); entryBookReport += constructSubTitleHtml(subTitle); - FinancialPeriodTopiaDao financialPeriodTopiaDao = - getDaoHelper().getFinancialPeriodDao(); - ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = - getDaoHelper().getClosedPeriodicEntryBookDao(); - EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); - List<FinancialPeriod> financialPeriods = - financialPeriodTopiaDao.findByDates(beginDate, endDate); + financialPeriodService.getFinancialPeriods(beginDate, endDate); List<GeneralEntryBooksDatas> list = new ArrayList<GeneralEntryBooksDatas>(); BigDecimal amountDebit = BigDecimal.ZERO; BigDecimal amountCredit = BigDecimal.ZERO; for (FinancialPeriod financialPeriod : financialPeriods) { List<ClosedPeriodicEntryBook> closedPeriodicEntryBookList = - closedPeriodicEntryBookTopiaDao.findAllByDates( + closedPeriodicEntryBookService.getAllByDates( financialPeriod.getBeginDate(), financialPeriod.getEndDate()); BigDecimal subAmountDebit = BigDecimal.ZERO; @@ -597,9 +591,7 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document BigDecimal debit = BigDecimal.ZERO; BigDecimal credit = BigDecimal.ZERO; - List<Object[]> results = entryTopiaDao.getDebitCreditOfTransaction(closedPeriodicEntryBook.getEntryBook(), - closedPeriodicEntryBook.getFinancialPeriod().getBeginDate(), - closedPeriodicEntryBook.getFinancialPeriod().getEndDate()); + List<Object[]> results = entryService.findDebitCreditOfTransaction(closedPeriodicEntryBook); int nbAmount = results.size(); if (nbAmount == 2) { @@ -706,8 +698,6 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document } //############## VAT ############## - - @Override public void createVatDocuments(Date beginDate, Date endDate, String autocomplete) { @@ -726,7 +716,7 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document String vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl(); if (vatPDFUrl.equals("default")) { - reportsStream = DocumentServiceImpl.class + reportsStream = DocumentService.class .getResourceAsStream("/reports/vat_form_fr.pdf"); if (reportsStream == null) { throw new LimaTechnicalException("Could not find such file " @@ -782,15 +772,14 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document } } - @Override + public String createAccountDocument(Date beginDate, Date endDate, String account) { String accountReport = null; try { - AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao(); - Account accountFormat = accountTopiaDao.forTopiaIdEquals(account).findUniqueOrNull(); + Account accountFormat = accountService.findAccountById(account); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMMM yyyy"); accountReport = constructHtmlHeader(t("lima.reports.accounts")); @@ -982,4 +971,14 @@ public class DocumentServiceImpl extends AbstractLimaService implements Document return headerTitle; } + public BalanceReport buildGeneralEntryBooksDocuments(Date beginDate, Date endDate, String fromToAccount) { + String filePath = path + File.separator + + DocumentsEnum.BALANCE.getFileName() + ".pdf"; + + BalanceReport result = balanceBeanReportService.generateBalanceReportDocument(beginDate, endDate, fromToAccount); + balanceReportBuilder.generateBalanceReport(filePath, Lists.newArrayList(result)); + return result; + } + + } diff --git a/lima-web/src/main/java/org/chorem/lima/web/action/balance/BalanceReportBuilder.java b/lima-web/src/main/java/org/chorem/lima/web/action/balance/BalanceReportBuilder.java new file mode 100644 index 0000000..2cf2eb6 --- /dev/null +++ b/lima-web/src/main/java/org/chorem/lima/web/action/balance/BalanceReportBuilder.java @@ -0,0 +1,60 @@ +package org.chorem.lima.web.action.balance; + +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JasperCompileManager; +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.JasperReport; +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaTechnicalException; +import org.chorem.lima.beans.BalanceReport; + +import java.io.File; +import java.util.HashMap; +import java.util.List; + +/** + * Created by davidcosse on 02/10/14. + */ +public class BalanceReportBuilder { + + private static final Log log = LogFactory.getLog(BalanceReportBuilder.class); + + protected JasperReport accountReport; + protected JasperReport balanceReport; + + // TODO DCossé 02/10/14 remove it as soon as maven jasper plugin works + public BalanceReportBuilder() { + try { + // compile phase + String rootPath = new File("").getAbsolutePath(); + // TODO DCossé 06/11/14 find it from properties + accountReport = JasperCompileManager.compileReport(rootPath + "/lima-web/src/main/jasperreports/accounts/AccountReport.jrxml"); + balanceReport= JasperCompileManager.compileReport(rootPath + "/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml"); + } catch (JRException e) { + throw new LimaTechnicalException(e); + } + } + + + public void generateBalanceReport(String path, List<BalanceReport> reports) { + + try { + // fill up report + JasperPrint jasperPrint = JasperFillManager.fillReport(balanceReport, new HashMap(), new JRBeanCollectionDataSource(reports)); + + // eport to PDF + JasperExportManager.exportReportToPdfFile(jasperPrint, path); + if (log.isInfoEnabled()) { + log.info("Rapport généré:"+path); + } + + } catch (JRException e) { + throw new LimaTechnicalException(e); + } + + } +} diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java b/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java similarity index 90% rename from lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java rename to lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java index cc96876..21a9eb0 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java +++ b/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java @@ -1,26 +1,4 @@ -/* - * #%L - * Lima :: business - * %% - * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.business.ejb; +package org.chorem.lima.web.service; import org.apache.commons.io.Charsets; import org.apache.commons.io.IOUtils; @@ -28,10 +6,12 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.web.action.DocumentService; +import org.chorem.lima.web.action.balance.BalanceReportBuilder; +import org.chorem.lima.beans.BalanceReport; import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; -import org.chorem.lima.business.api.DocumentService; -import org.chorem.lima.business.api.HttpServerService; import org.chorem.lima.business.utils.DocumentsEnum; import org.chorem.lima.business.utils.FormatsEnum; import org.chorem.lima.entity.Account; @@ -42,10 +22,6 @@ import org.hibernate.exception.GenericJDBCException; import org.nuiton.util.FileUtil; import org.nuiton.util.Resource; -import javax.ejb.EJB; -import javax.ejb.Remote; -import javax.ejb.Stateless; -import javax.ejb.TransactionAttribute; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -64,17 +40,12 @@ import java.util.List; import static org.nuiton.i18n.I18n.t; -@Stateless -@Remote(HttpServerService.class) -@TransactionAttribute -public class HttpServerServiceImpl extends AbstractLimaService implements HttpServerService { +public class HttpServerService { - protected static final Log log = LogFactory.getLog(HttpServerServiceImpl.class); + protected static final Log log = LogFactory.getLog(HttpServerService.class); - @EJB private DocumentService documentService; - @EJB private AccountService accountService; protected Server server; @@ -85,13 +56,16 @@ public class HttpServerServiceImpl extends AbstractLimaService implements HttpSe private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd"); - public HttpServerServiceImpl() { + protected BalanceReportBuilder balanceReportBuilder = new BalanceReportBuilder(); + + public HttpServerService() { path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); port = LimaServiceConfig.getInstance().getHttpPort(); + accountService = LimaServiceFactory.getService(AccountService.class); + documentService = new DocumentService(); } /** start the server */ - @Override public void start() { if (server == null) { try { @@ -115,7 +89,6 @@ public class HttpServerServiceImpl extends AbstractLimaService implements HttpSe } } - @Override public int getHttpPort() { return port; } @@ -161,7 +134,7 @@ public class HttpServerServiceImpl extends AbstractLimaService implements HttpSe String accountReport = null; String entryBooksReport = null; String generalEntryBooksReport = null; - String balanceReport = null; + BalanceReport balanceReport = null; String ledgerReport = null; String financialReport = null; @@ -172,8 +145,7 @@ public class HttpServerServiceImpl extends AbstractLimaService implements HttpSe switch (DocumentsEnum.valueOfLink(model)) { case BALANCE: - balanceReport = documentService.createBalanceDocuments( - beginDateFormat, endDateFormat); + documentService.buildGeneralEntryBooksDocuments(beginDateFormat, endDateFormat, null); break; case ACCOUNT: accountReport = documentService.createAccountDocument( @@ -215,7 +187,7 @@ public class HttpServerServiceImpl extends AbstractLimaService implements HttpSe } if ( (accountReport != null || entryBooksReport != null || generalEntryBooksReport != null - || balanceReport != null || ledgerReport != null || financialReport != null)) { + || ledgerReport != null || financialReport != null)) { String report; resp.setContentType(".html"); OutputStream out = resp.getOutputStream(); @@ -225,8 +197,6 @@ public class HttpServerServiceImpl extends AbstractLimaService implements HttpSe report = entryBooksReport; } else if (generalEntryBooksReport != null) { report = generalEntryBooksReport; - } else if (balanceReport != null) { - report = balanceReport; } else if (ledgerReport != null) { report = ledgerReport; } else { diff --git a/lima-web/src/main/java/org/chorem/lima/web/utils/DocumentsEnum.java b/lima-web/src/main/java/org/chorem/lima/web/utils/DocumentsEnum.java new file mode 100644 index 0000000..44e5924 --- /dev/null +++ b/lima-web/src/main/java/org/chorem/lima/web/utils/DocumentsEnum.java @@ -0,0 +1,67 @@ +/* + * #%L + * Lima :: business + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.lima.web.utils; + +import static org.nuiton.i18n.I18n.t; + + +public enum DocumentsEnum { + + GENERAL_ENTRYBOOK(t("lima-business.document.generalentrybook"), "lima_general_entybook"), + ENTRYBOOKS(t("lima-business.document.entrybook"), "lima_entrybooks"), + BALANCE(t("lima-business.document.balance"), "lima_balance"), + LEDGER(t("lima-business.document.ledger"), "lima_ledger"), + FINANCIALSTATEMENT(t("lima-business.document.financialstatement"), "lima_financialstatements"), + VAT(t("lima-business.document.vat"), "lima_vat"), + ACCOUNT(t("lima-business.document.account"), "lima_account"); + + private final String fileName; + + private final String description; + + private DocumentsEnum(String description, String fileName) { + this.description = description; + this.fileName = fileName; + } + + public String getFileName() { + return fileName; + } + + public String getDescription() { + return description; + } + + public static DocumentsEnum valueOfLink(String label) { + DocumentsEnum value = null; + + for (DocumentsEnum documentsEnum : DocumentsEnum.values()) { + if (label.equals(documentsEnum.fileName)) { + value = documentsEnum; + break; + } + } + return value; + } + +} diff --git a/lima-swing/src/test/java/org/chorem/lima/ui/report/ReportTest.java b/lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java similarity index 58% rename from lima-swing/src/test/java/org/chorem/lima/ui/report/ReportTest.java rename to lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java index 0c9936d..e7c8b51 100644 --- a/lima-swing/src/test/java/org/chorem/lima/ui/report/ReportTest.java +++ b/lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java @@ -1,4 +1,4 @@ -package org.chorem.lima.ui.report; +package org.chorem.lima.web.action; /* * #%L @@ -22,35 +22,41 @@ package org.chorem.lima.ui.report; * #L% */ +import com.google.common.collect.Lists; import net.sf.jasperreports.engine.JRException; -import org.chorem.lima.ui.AbstractLimaTest; +import org.chorem.lima.business.api.report.BalanceBeanReportService; +import org.chorem.lima.business.ejb.report.BalanceBeanReportServiceImpl; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; /** * Created by davidcosse on 02/10/14. */ -public class ReportTest extends AbstractLimaTest{ +public class ReportTest { String tmpDir; + protected static String DATE_FORMAT = "dd/MM/yyyy"; + @Before public void initTest() throws Exception { - initTestDefaultAccounts(); tmpDir = System.getProperty("java.io.tmpdir")+"/"; } + @Ignore @Test - public void testAccountReport() throws JRException, IOException { - ReportBuilder builder = new ReportBuilder(); - builder.generateAccountReport(tmpDir + "AccountReport.pdf"); - } - - @Test - public void testBalanceReport() throws JRException, IOException { - ReportBuilder builder = new ReportBuilder(); - builder.generateBalanceReport(tmpDir + "BalanceReport.pdf"); + public void testBalanceReport() throws JRException, IOException, ParseException { + DateFormat df = new SimpleDateFormat(DATE_FORMAT); + Date beginDateFormat = df.parse("01/01/2013"); + Date endDateFormat = df.parse("31/12/2014"); + DocumentService documentService = new DocumentService(); + documentService.buildGeneralEntryBooksDocuments(beginDateFormat, endDateFormat, null); } } diff --git a/pom.xml b/pom.xml index 0bef794..5d82f3a 100644 --- a/pom.xml +++ b/pom.xml @@ -140,6 +140,7 @@ <module>lima-business-api</module> <module>lima-business</module> <module>lima-swing</module> + <module>lima-web</module> </modules> <scm> @@ -180,8 +181,8 @@ <nuitonProfilingVersion>3.0</nuitonProfilingVersion> <nuitonCsvVersion>3.0-rc-4</nuitonCsvVersion> <nuitonConverterVersion>1.0</nuitonConverterVersion> - <eugeneVersion>3.0-SNAPSHOT</eugeneVersion> - <topiaVersion>3.0-SNAPSHOT</topiaVersion> + <eugeneVersion>2.13</eugeneVersion> + <topiaVersion>3.0-beta-14</topiaVersion> <nuitonI18nVersion>3.3</nuitonI18nVersion> <swinglabsVersion>3.0.4</swinglabsVersion> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.