This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 9a297abd96f72ce21857cec80d89618097081050 Author: dcosse <cosse@codelutin.com> Date: Thu Jul 23 18:47:02 2015 +0200 refs #1268 permet la saisie des informations concernant le trésor public et affichage de ses infos lors de l'export TVA --- .../chorem/lima/business/api/TreasuryService.java | 13 + .../lima/business/ejb/TreasuryServiceImpl.java | 69 ++++++ .../lima/business/ejb/csv/IdentityModel.java | 4 +- .../resources/i18n/lima-business_fr_FR.properties | 2 + .../V0_8_6_0__1241_create_table_TREASURY.sql | 54 ++++ .../src/main/xmi/lima-callao-model.properties | 2 +- lima-callao/src/main/xmi/lima-callao-model.zargo | Bin 59242 -> 60092 bytes .../lima/report/service/DocumentService.java | 63 +++-- .../java/org/chorem/lima/ui/MainViewHandler.java | 13 +- .../org/chorem/lima/ui/identity/IdentityForm.css | 149 +++++++++-- .../org/chorem/lima/ui/identity/IdentityForm.jaxx | 274 ++++++++++++++------- .../chorem/lima/ui/identity/IdentityHandler.java | 32 ++- .../chorem/lima/ui/opening/CreateIdentityPanel.css | 95 ++++++- .../lima/ui/opening/CreateIdentityPanel.jaxx | 105 +++++++- .../ui/opening/CreateIdentityPanelHandler.java | 16 +- .../resources/i18n/lima-swing_en_GB.properties | 13 + .../resources/i18n/lima-swing_fr_FR.properties | 15 +- .../src/main/resources/import/vat_default.csv | 4 +- 18 files changed, 736 insertions(+), 187 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/TreasuryService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/TreasuryService.java new file mode 100644 index 0000000..4551d55 --- /dev/null +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/TreasuryService.java @@ -0,0 +1,13 @@ +package org.chorem.lima.business.api; + +import org.chorem.lima.entity.Treasury; + +/** + * Created by davidcosse on 22/07/15. + */ +public interface TreasuryService { + + Treasury getTreasury(); + + Treasury updateTreasury(Treasury treasury); +} diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/TreasuryServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/TreasuryServiceImpl.java new file mode 100644 index 0000000..3a7cf26 --- /dev/null +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/TreasuryServiceImpl.java @@ -0,0 +1,69 @@ +package org.chorem.lima.business.ejb; + +import com.google.common.base.Preconditions; +import org.chorem.lima.business.api.TreasuryService; +import org.chorem.lima.entity.Treasury; +import org.chorem.lima.entity.TreasuryTopiaDao; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +import javax.ejb.Remote; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import java.util.List; + +/** + * Created by davidcosse on 22/07/15. + */ +@Stateless +@Remote(TreasuryService.class) +@TransactionAttribute +public class TreasuryServiceImpl extends AbstractLimaService implements TreasuryService { + + @Override + public Treasury getTreasury() { + Treasury treasury; + + TreasuryTopiaDao dao = getDaoHelper().getTreasuryDao(); + List<Treasury> treasuries = dao.findAll(); + if (treasuries.size() == 0) { + treasury = dao.create( + Treasury.PROPERTY_ADDRESS, "", + Treasury.PROPERTY_ZIP_CODE, "", + Treasury.PROPERTY_CITY, "", + Treasury.PROPERTY_SYSTEM_TYPE, "", + Treasury.PROPERTY_DOSSIER_NUMBER, "", + Treasury.PROPERTY_KEY, "", + Treasury.PROPERTY_CDI, "", + Treasury.PROPERTY_SERVICE_CODE, "" + ); + } else { + treasury = treasuries.get(0); + } + return treasury; + } + + @Override + public Treasury updateTreasury(Treasury treasury) { + Preconditions.checkArgument(treasury != null); + + Treasury originalTreasury = getTreasury(); + + bindData(treasury, originalTreasury); + + Treasury updatedTreasury = doUpdate(originalTreasury); + + return updatedTreasury; + } + + protected Treasury doUpdate(Treasury originalTreasury) { + TreasuryTopiaDao dao = getDaoHelper().getTreasuryDao(); + return dao.update(originalTreasury); + } + + protected void bindData(Treasury treasury, Treasury originalTreasury) { + Binder<Treasury, Treasury> binder = BinderFactory.newBinder(Treasury.class); + binder.copyExcluding(treasury, originalTreasury, + Treasury.PROPERTY_TOPIA_ID); + } +} diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/IdentityModel.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/IdentityModel.java index 719582f..9a2a80b 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/IdentityModel.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/csv/IdentityModel.java @@ -43,7 +43,7 @@ public class IdentityModel extends AbstractLimaModel<Identity> implements Export newOptionalColumn("phoneNumber", Identity.PROPERTY_PHONE_NUMBER); newOptionalColumn("email", Identity.PROPERTY_EMAIL); newOptionalColumn("zipCode", Identity.PROPERTY_ZIP_CODE); - newOptionalColumn("vatNumber", Identity.PROPERTY_VAT_NUMBER); + //newOptionalColumn("vatNumber", Identity.PROPERTY_VAT_NUMBER); newOptionalColumn("classificationCode", Identity.PROPERTY_CLASSIFICATION_CODE); newOptionalColumn("buisinessNumber", Identity.PROPERTY_BUSINESS_NUMBER); } @@ -59,7 +59,7 @@ public class IdentityModel extends AbstractLimaModel<Identity> implements Export modelBuilder.newColumnForExport("phoneNumber", Identity.PROPERTY_PHONE_NUMBER); modelBuilder.newColumnForExport("email", Identity.PROPERTY_EMAIL); modelBuilder.newColumnForExport("zipCode", Identity.PROPERTY_ZIP_CODE); - modelBuilder.newColumnForExport("vatNumber", Identity.PROPERTY_VAT_NUMBER); + //modelBuilder.newColumnForExport("vatNumber", Identity.PROPERTY_VAT_NUMBER); modelBuilder.newColumnForExport("classificationCode", Identity.PROPERTY_CLASSIFICATION_CODE); modelBuilder.newColumnForExport("buisinessNumber", Identity.PROPERTY_BUSINESS_NUMBER); return (Iterable) modelBuilder.getColumnsForExport(); diff --git a/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties b/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties index 778321c..da69ed6 100644 --- a/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties +++ b/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties @@ -39,7 +39,9 @@ lima-business.document.society=Nom lima-business.document.solde=Solde lima-business.document.soldecredit=Solde Créditeur lima-business.document.soldedebit=Solde Débiteur +lima-business.document.treasuryPeriod=%1$te%1$tm%1$tY lima-business.document.vat=Déclaration de TVA +lima-business.document.vatPeriod1=%1$tM %1$tY lima-business.document.vatnumber=N° TVA lima-business.document.voucher=Pièce comptable lima-business.document.zipcode=Code postal diff --git a/lima-callao/src/main/resources/db/migration/V0_8_6_0__1241_create_table_TREASURY.sql b/lima-callao/src/main/resources/db/migration/V0_8_6_0__1241_create_table_TREASURY.sql new file mode 100644 index 0000000..644dddd --- /dev/null +++ b/lima-callao/src/main/resources/db/migration/V0_8_6_0__1241_create_table_TREASURY.sql @@ -0,0 +1,54 @@ +--- +-- #%L +-- Lima :: callao +-- %% +-- Copyright (C) 2008 - 2015 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% +--- + -- migration Lima data base from 0.6 to 0.8.6 + +-- migration from h2 to 1.3.166 not supporting index on clob +--CREATE TABLE TREASURY ( +-- TOPIAID varchar (255), +-- TOPIAVERSION bigint(19), +-- TOPIACREATEDATE timestamp(23), +-- ADDRESS varchar (255), +-- ADDRESS2 varchar (255), +-- CDI varchar (2), +-- CITY varchar (30), +-- KEY varchar (2), +-- SERVICECODE varchar (3), +-- SIE varchar (7), +-- SYSTEMTYPE varchar (3), +-- VATNUMBER varchar (6), +-- ZIPCODE varchar (5) +--); +CREATE TABLE TREASURY ( + TOPIAID varchar (255), + TOPIAVERSION bigint(19), + TOPIACREATEDATE timestamp(23), + DOSSIERNUMBER varchar (30), + ADDRESS varchar (255), + ADDRESS2 varchar (255), + ZIPCODE varchar (30), + CITY varchar (30), + CDI varchar (30), + KEY varchar (30), + SERVICECODE varchar (30), + SIE varchar (30), + SYSTEMTYPE varchar (30) +); \ No newline at end of file diff --git a/lima-callao/src/main/xmi/lima-callao-model.properties b/lima-callao/src/main/xmi/lima-callao-model.properties index c8a2519..88531f1 100644 --- a/lima-callao/src/main/xmi/lima-callao-model.properties +++ b/lima-callao/src/main/xmi/lima-callao-model.properties @@ -21,7 +21,7 @@ ### # Precise l'entete de l'ensemble des fichiers generes model.tagvalue.copyright=/*\n Copyright (C) 2009-2012 Lima Callao\n */ -model.tagvalue.version=0.6 +model.tagvalue.version=0.8.6.0 model.tagvalue.constantPrefix=PROPERTY_ model.tagValue.notGenerateToString=true model.tagValue.hibernateAttributeType.String=text diff --git a/lima-callao/src/main/xmi/lima-callao-model.zargo b/lima-callao/src/main/xmi/lima-callao-model.zargo index 8633e8e..4bb153c 100644 Binary files a/lima-callao/src/main/xmi/lima-callao-model.zargo and b/lima-callao/src/main/xmi/lima-callao-model.zargo differ diff --git a/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java b/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java index 982a34e..40ef663 100644 --- a/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java +++ b/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java @@ -24,8 +24,6 @@ package org.chorem.lima.report.service; import com.google.common.base.Strings; import com.google.common.collect.Lists; -import com.itextpdf.text.pdf.AcroFields; -import com.itextpdf.text.pdf.PdfReader; import net.sf.jasperreports.engine.JasperReport; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -40,6 +38,7 @@ import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.FinancialStatementService; import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.business.api.OptionsService; +import org.chorem.lima.business.api.TreasuryService; import org.chorem.lima.business.api.VatStatementService; import org.chorem.lima.business.api.report.AccountReportService; import org.chorem.lima.business.api.report.BalanceReportService; @@ -49,6 +48,7 @@ import org.chorem.lima.business.api.report.ProvisionalEntryBookReportService; import org.chorem.lima.business.utils.BigDecimalToString; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Identity; +import org.chorem.lima.entity.Treasury; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.report.DocumentsEnum; import org.chorem.lima.report.LimaReportConfig; @@ -65,7 +65,6 @@ import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.Set; import static org.nuiton.i18n.I18n.t; @@ -74,21 +73,23 @@ public class DocumentService { protected static final Log log = LogFactory.getLog(DocumentService.class); - private IdentityService identityService; - - private FinancialStatementService financialStatementService; + protected AccountService accountService; protected AccountReportService accountReportService; protected BalanceReportService balanceReportService; + protected ProvisionalEntryBookReportService entryBookReportService; + + protected FinancialStatementService financialStatementService; + protected GeneralEntryBookReportService generalEntryBookReportService; - protected ProvisionalEntryBookReportService entryBookReportService; + protected IdentityService identityService; protected LedgerReportService ledgerReportService; - protected AccountService accountService; + protected TreasuryService treasuryService; protected VatStatementService vatStatementService; @@ -102,14 +103,15 @@ public class DocumentService { protected String vat_default_formFilePath; public DocumentService() { - identityService = LimaServiceFactory.getService(IdentityService.class); - financialStatementService = LimaServiceFactory.getService(FinancialStatementService.class); accountService = LimaServiceFactory.getService(AccountService.class); - accountReportService = LimaServiceFactory.getService(AccountReportService.class); balanceReportService = LimaServiceFactory.getService(BalanceReportService.class); - generalEntryBookReportService = LimaServiceFactory.getService(GeneralEntryBookReportService.class); entryBookReportService = LimaServiceFactory.getService(ProvisionalEntryBookReportService.class); + financialStatementService = LimaServiceFactory.getService(FinancialStatementService.class); + generalEntryBookReportService = LimaServiceFactory.getService(GeneralEntryBookReportService.class); + identityService = LimaServiceFactory.getService(IdentityService.class); + treasuryService = LimaServiceFactory.getService(TreasuryService.class); + ledgerReportService = LimaServiceFactory.getService(LedgerReportService.class); vatStatementService = LimaServiceFactory.getService(VatStatementService.class); @@ -289,20 +291,10 @@ public class DocumentService { String vatPDFUrl = LimaReportConfig.getInstance().getVatPDFUrl(); - AcroFields pdfFields; if (vatPDFUrl.equals("default")) { reportsStream = DocumentService.class.getResourceAsStream("/reports/vat_form_fr.pdf"); - try { - PdfReader reader = new PdfReader("/reports/vat_form_fr.pdf"); - pdfFields = reader.getAcroFields(); - Set<String> fldNames = pdfFields.getFields().keySet(); - - } catch (IOException e) { - e.printStackTrace(); - } if (reportsStream == null) { - throw new LimaTechnicalException("Could not find such file " - + "/reports/vat_form_fr.pdf"); + throw new LimaTechnicalException("Could not find such file " + "/reports/vat_form_fr.pdf"); } } else { try { @@ -340,6 +332,25 @@ public class DocumentService { fields.setField(doc, vatStatement.getBoxName(), amount.toString()); } } + + Identity identity = identityService.getIdentity(); + Treasury treasury = treasuryService.getTreasury(); + + String ident = identity.getName() + "\n" + identity.getAddress() + "\n" + identity.getAddress2() + "\n" + identity.getZipCode() + " " + identity.getCity(); + String treasuryAddress = treasury.getAddress() + '\n' + treasury.getZipCode() + " " + treasury.getCity(); + + fields.setField(doc, "a1", t("lima-business.document.vatPeriod1", beginDate)); + fields.setField(doc, "a2", treasuryAddress); + fields.setField(doc, "a4", ident); + fields.setField(doc, "a6", treasury.getSie()); + fields.setField(doc, "a7", treasury.getDossierNumber()); + fields.setField(doc, "a8", treasury.getKey()); + fields.setField(doc, "a9", t("lima-business.document.treasuryPeriod", beginDate)); + fields.setField(doc, "a10", treasury.getCdi()); + fields.setField(doc, "a11", treasury.getServiceCode()); + fields.setField(doc, "a12", treasury.getSystemType()); + fields.setField(doc, "a13", "FR" + identity.getVatNumber() + identity.getBusinessNumber()); + } } @@ -425,9 +436,9 @@ public class DocumentService { boldItalicEnd, "<i>" + (StringUtils.isNotEmpty(identity.getClassificationCode()) ? identity.getClassificationCode() : " - ") + "</i>"}; headerTitle += constructTableLine(columnsClassifCode); - String[] columnsVatNumber = {boldItalicBegin + t("lima-business.document.vatnumber") + boldItalicEnd, - "<i>" + (StringUtils.isNotEmpty(identity.getVatNumber()) ? identity.getVatNumber() : " - ") + "</i>",}; - headerTitle += constructTableLine(columnsVatNumber); +// String[] columnsVatNumber = {boldItalicBegin + t("lima-business.document.vatnumber") + boldItalicEnd, +// "<i>" + (StringUtils.isNotEmpty(identity.getVatNumber()) ? identity.getVatNumber() : " - ") + "</i>",}; +// headerTitle += constructTableLine(columnsVatNumber); } String[] columnsPeriodOne = {boldItalicBegin + t("lima-business.document.period1") + boldItalicEnd, "<i>" 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 8b53397..2d1d1e4 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 @@ -52,19 +52,12 @@ import org.chorem.lima.ui.vatchart.VatChartView; import org.nuiton.util.DesktopUtil; import org.nuiton.widget.SwingSession; -import javax.swing.DefaultCellEditor; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JEditorPane; -import javax.swing.JScrollPane; -import javax.swing.JTabbedPane; -import javax.swing.UIManager; +import javax.swing.*; import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.BorderUIResource; -import java.awt.Component; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -554,7 +547,7 @@ public class MainViewHandler { boolean canClose) { final JTabbedPane contentTabbedPane = ui.getContentTabbedPane(); - // if contentTabbedPane doesnot yet contains tab + // if contentTabbedPane does not yet contains tab if (contentTabbedPane.indexOfTab(name) == -1) { ClosableTabHeader closableHeader = new ClosableTabHeader(); closableHeader.setTitle(name); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.css b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.css index 8675205..c46af39 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.css @@ -30,7 +30,7 @@ } #nameTextField { - text : {handler.getIdentity().getName()}; + text : {identity.getName()}; columns : 20; } @@ -39,8 +39,9 @@ } #descriptionTextField { - text : {handler.getIdentity().getDescription()}; + text : {identity.getDescription()}; columns : 30; + rows : 5; } #addressLabel { @@ -48,13 +49,9 @@ } #addressTextField { - text : {handler.getIdentity().getAddress()}; - columns : 30; -} - -#address2TextField { - text : {handler.getIdentity().getAddress2()}; + text : {identity.getAddress()}; columns : 30; + rows : 5; } #zipCodeLabel { @@ -62,7 +59,7 @@ } #zipCodeTextField { - text : {handler.getIdentity().getZipCode()}; + text : {identity.getZipCode()}; columns : 5; } @@ -71,7 +68,7 @@ } #cityTextField { - text : {handler.getIdentity().getCity()}; + text : {identity.getCity()}; columns : 20; } @@ -80,16 +77,7 @@ } #businessNumberTextField { - text : {handler.getIdentity().getBusinessNumber()}; - columns : 20; -} - -#vatNumberLabel { - text : "lima.identity.vatNumber"; -} - -#vatNumberTextField { - text : {handler.getIdentity().getVatNumber()}; + text : {identity.getBusinessNumber()}; columns : 20; } @@ -98,7 +86,7 @@ } #classificationCodeTextField { - text : {handler.getIdentity().getClassificationCode()}; + text : {identity.getClassificationCode()}; columns : 5; } @@ -107,7 +95,7 @@ } #phoneNumberTextField { - text : {handler.getIdentity().getPhoneNumber()}; + text : {identity.getPhoneNumber()}; columns : 20; } @@ -116,10 +104,123 @@ } #emailTextField { - text : {handler.getIdentity().getEmail()}; + text : {identity.getEmail()}; columns : 20; } +#vatNumberLabel { + text : "lima.identity.vatNumber"; +} + +#vatNumberTextField { + text : {identity.getVatNumber()}; + columns : 2; +} + +#treasuryAddressLabel { + text : "lima.treasury.address"; +} + +#treasuryAddressTextField { + text : {treasury.getAddress()}; + columns : 30; + rows : 5; +} + +#treasuryAddress2Label { + text : "lima.treasury.address2"; +} + +#address2TextField { + text : {treasury.getAddress2()}; + columns : 30; +} + +#treasuryZipCodeLabel { + text : "lima.treasury.zipCode"; +} + +#treasuryZipCodeTextField { + text : {treasury.getZipCode()}; + columns : 5; +} + +#treasuryCityLabel { + text : "lima.treasury.city"; +} + +#treasuryCityTextField { + text : {treasury.getCity()}; + columns : 20; +} + +#treasurySystemTypeLabel { + text : "lima.treasury.systemType"; +} + +#treasurySystemTypeTextField { + text : {treasury.getSystemType()}; + columns : 3; +} + +#treasurySystemTypeLabel { + text : "lima.treasury.systemType"; +} + +#treasurySieTextField { + text : {treasury.getSie()}; + columns : 7; +} + +#treasurySieLabel { + text : "lima.treasury.sie"; +} + +#treasuryVatNumberTextField { + text : {treasury.getVatNumber()}; + columns : 6; +} + +#treasuryVatNumberLabel { + text : "lima.treasury.vatNumber"; +} + +#treasuryKeyTextField { + text : {treasury.getKey()}; + columns : 2; +} + +#treasuryKeyLabel { + text : "lima.treasury.key"; +} + +#treasuryCdiTextField { + text : {treasury.getKey()}; + columns : 2; +} + +#treasuryCdiLabel { + text : "lima.treasury.cdi"; +} + +#treasuryServiceCodeTextField { + text : {treasury.getServiceCode()}; + columns : 3; +} + +#treasuryServiceCodeLabel { + text : "lima.treasury.serviceCode"; +} + +#dossierNumberLabel { + text : "lima.treasury.dossierNumber"; +} + +#dossierNumberTextField { + text : {treasury.getDossierNumber()}; + columns : 3; +} + #cancel { text : "lima.cancel"; actionIcon : cancel; @@ -128,4 +229,4 @@ #ok { text : "lima.ok"; actionIcon : ok; -} +} \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx index b050d35..9d53d7f 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx @@ -27,6 +27,8 @@ <IdentityHandler id="handler" javaBean="new IdentityHandler(this)"/> <org.chorem.lima.entity.Identity id="identity" javaBean='handler.getIdentity()'/> + <org.chorem.lima.entity.Treasury id="treasury" + javaBean='handler.getTreasury()'/> <import> java.awt.Dimension </import> @@ -37,101 +39,183 @@ ]]> </script> - <Table constraints="BorderLayout.CENTER" - border="{BorderFactory.createEmptyBorder(10, 10, 10, 10)}" > - <row> - <cell anchor="east"> - <JLabel id="nameLabel" /> - </cell> - <cell anchor="west" - columns="3"> - <JTextField id="nameTextField" /> - </cell> - - <cell rows="5"> - <JPanel minimumSize="{new Dimension(20, 20)}"> - </JPanel> - </cell> - - <cell anchor="east"> - <JLabel id="phoneNumberLabel"/> - </cell> - <cell anchor="west"> - <JTextField id="phoneNumberTextField"/> - </cell> - </row> - - <row> - <cell anchor="east"> - <JLabel id="descriptionLabel"/> - </cell> - <cell anchor="west" - columns="3"> - <JTextField id="descriptionTextField"/> - </cell> - - <cell anchor="east"> - <JLabel id="emailLabel"/> - </cell> - <cell anchor="west"> - <JTextField id="emailTextField" /> - </cell> - </row> - - <row> - <cell anchor="east"> - <JLabel id="addressLabel"/> - </cell> - <cell anchor="west" - columns="3"> - <JTextField id="addressTextField" /> - </cell> - - <cell anchor="east"> - <JLabel id="businessNumberLabel"/> - </cell> - <cell anchor="west"> - <JTextField id="businessNumberTextField"/> - </cell> - </row> - - <row> - <cell/> - <cell anchor="west" - columns="3"> - <JTextField id="address2TextField"/> - </cell> - - <cell anchor="east"> - <JLabel id="vatNumberLabel"/> - </cell> - <cell anchor="west"> - <JTextField id="vatNumberTextField"/> - </cell> - </row> - - <row> - <cell anchor="east"> - <JLabel id="zipCodeLabel"/> - </cell> - <cell anchor="west"> - <JTextField id="zipCodeTextField"/> - </cell> - <cell anchor="east"> - <JLabel text="lima.identity.city"/> - </cell> - <cell fill="horizontal"> - <JTextField id="cityTextField" /> - </cell> - - <cell anchor="east"> - <JLabel id="classificationCodeLabel"/> - </cell> - <cell anchor="west"> - <JTextField id="classificationCodeTextField"/> - </cell> - </row> - </Table> + <JTabbedPane id="identityContentTabbedPane" + constraints="BorderLayout.CENTER"> + + <tab id="identityTab" title="Identité" layout='{new GridLayout(0,1)}'> + <Table id="identityTable"> + <row> + <cell anchor="east"> + <JLabel id="nameLabel" /> + </cell> + <cell anchor="west"> + <JTextField id="nameTextField" /> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="phoneNumberLabel"/> + </cell> + <cell anchor="west" > + <JTextField id="phoneNumberTextField"/> + </cell> + </row> + + <row> + <cell anchor="east" rows="5"> + <JLabel id="addressLabel"/> + </cell> + <cell anchor="west" + rows="5"> + <JTextArea id="addressTextField" /> + </cell> + </row> + + <row> + <cell anchor="east" rows="5"> + <JLabel id="descriptionLabel"/> + </cell> + <cell anchor="west" + rows="5"> + <JTextArea id="descriptionTextField"/> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="zipCodeLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="zipCodeTextField"/> + </cell> + <cell anchor="east"> + <JLabel text="lima.identity.city"/> + </cell> + <cell anchor="west"> + <JTextField id="cityTextField" /> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="emailLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="emailTextField" /> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="businessNumberLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="businessNumberTextField"/> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="classificationCodeLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="classificationCodeTextField"/> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="vatNumberLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="vatNumberTextField"/> + </cell> + </row> + + </Table> + </tab> + + <tab id="treasuryTab" title="Trésor Public" layout='{new GridLayout(0,1)}'> + <JPanel layout='{new GridLayout(0,1)}'> + <Table id="treasuryTable" layout='{new GridLayout(3,1)}'> + <row> + <cell anchor="east" rows="5"> + <JLabel id="treasuryAddressLabel" /> + </cell> + <cell anchor="west" + rows="5"> + <JTextArea id="treasuryAddressTextField" /> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="treasuryZipCodeLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasuryZipCodeTextField" /> + </cell> + </row> + + <row> + <cell anchor="east"> + <JLabel id="treasuryCityLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasuryCityTextField"/> + </cell> + </row> + </Table> + + <Table layout='{new GridLayout(1,1)}'> + <row> + <cell anchor="east"> + <JLabel id="treasurySieLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasurySieTextField"/> + </cell> + + <cell anchor="east"> + <JLabel id="dossierNumberLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="dossierNumberTextField" /> + </cell> + + <cell anchor="east"> + <JLabel id="treasuryKeyLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasuryKeyTextField"/> + </cell> + + <cell anchor="east"> + <JLabel id="treasuryCdiLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasuryCdiTextField" /> + </cell> + + <cell anchor="east"> + <JLabel id="treasuryServiceCodeLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasuryServiceCodeTextField"/> + </cell> + + <cell anchor="east"> + <JLabel id="treasurySystemTypeLabel"/> + </cell> + <cell anchor="west"> + <JTextField id="treasurySystemTypeTextField" /> + </cell> + </row> + </Table> + </JPanel> + </tab> + </JTabbedPane> <JPanel constraints="BorderLayout.SOUTH" layout='{new GridLayout(1,0)}'> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java index f0bcc1f..c0d2e18 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java @@ -24,15 +24,19 @@ package org.chorem.lima.ui.identity; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.IdentityService; +import org.chorem.lima.business.api.TreasuryService; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.IdentityImpl; -import org.chorem.lima.business.LimaServiceFactory; +import org.chorem.lima.entity.Treasury; public class IdentityHandler { protected IdentityService identityService; + protected TreasuryService treasuryService; + protected IdentityForm view; private static final Log log = LogFactory.getLog(IdentityHandler.class); @@ -40,9 +44,8 @@ public class IdentityHandler { public IdentityHandler(IdentityForm view) { this.view = view; - identityService = - LimaServiceFactory.getService( - IdentityService.class); + identityService = LimaServiceFactory.getService(IdentityService.class); + treasuryService = LimaServiceFactory.getService(TreasuryService.class); } public Identity getIdentity() { @@ -53,21 +56,38 @@ public class IdentityHandler { return identity; } + public Treasury getTreasury() { + Treasury treasury = treasuryService.getTreasury(); + return treasury; + } + public void updateIdentity(){ Identity identity = getIdentity(); identity.setName(view.getNameTextField().getText()); identity.setDescription(view.getDescriptionTextField().getText()); identity.setAddress(view.getAddressTextField().getText()); - identity.setAddress2(view.getAddress2TextField().getText()); identity.setZipCode(view.getZipCodeTextField().getText()); identity.setCity(view.getCityTextField().getText()); identity.setBusinessNumber(view.getBusinessNumberTextField().getText()); - identity.setVatNumber(view.getVatNumberTextField().getText()); identity.setClassificationCode(view.getClassificationCodeTextField().getText()); identity.setPhoneNumber(view.getPhoneNumberTextField().getText()); identity.setEmail(view.getEmailTextField().getText()); + identity.setVatNumber(view.getVatNumberTextField().getText()); identityService.updateIdentity(identity); + + Treasury treasury = treasuryService.getTreasury(); + treasury.setAddress(view.getTreasuryAddressTextField().getText()); + treasury.setCdi(view.getTreasuryCdiTextField().getText()); + treasury.setCity(view.getTreasuryCityTextField().getText()); + treasury.setKey(view.getTreasuryKeyTextField().getText()); + treasury.setServiceCode(view.getTreasuryServiceCodeTextField().getText()); + treasury.setDossierNumber(view.getDossierNumberLabel().getText()); + treasury.setSie(view.getTreasurySieTextField().getText()); + treasury.setZipCode(view.getTreasuryZipCodeTextField().getText()); + treasury.setSystemType(view.getTreasurySystemTypeTextField().getText()); + + treasuryService.updateTreasury(treasury); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css index 7d8da6b..ab1c561 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css @@ -75,14 +75,6 @@ text : {handler.getIdentity().getBusinessNumber()}; } -#vatNumberLabel { - text : "lima.identity.vatNumber"; -} - -#vatNumberTextField { - text : {handler.getIdentity().getVatNumber()}; -} - #classificationCodeLabel { text : "lima.identity.classificationCode"; } @@ -106,3 +98,90 @@ #emailTextField { text : {handler.getIdentity().getEmail()}; } + +#vatNumberLabel { + text : "lima.identity.vatNumber"; +} + +#vatNumberTextField { + text : {handler.getIdentity().getVatNumber()}; +} + +#treasuryAddressLabel { + text : "lima.treasury.address"; +} + +#treasuryAddressTextField { + text : {handler.getTreasury().getAddress()}; +} + +#treasuryAddress2Label { + text : "lima.treasury.address2"; +} + +#treasuryAddress2TextField { + text : {handler.getTreasury().getAddress2()}; +} + +#treasuryCdiLabel { + text : "lima.treasury.cdi"; +} + +#treasuryCdiTextField { + text : {handler.getTreasury().getCdi()}; +} + +#treasuryCityLabel { + text : "lima.treasury.city"; +} +#treasuryCityTextField { + text : {handler.getTreasury().getCity()}; +} + +#treasuryKeyLabel { + text : "lima.treasury.key"; +} + +#treasuryKeyTextField { + text : {handler.getTreasury().getKey()}; +} + +#treasuryServiceCodeLabel { + text : "lima.treasury.serviceCode"; +} + +#treasuryServiceCodeTextField { + text : {handler.getTreasury().getServiceCode()}; +} + +#treasurySieLabel { + text : "lima.treasury.sie"; +} + +#treasurySieTextField { + text : {handler.getTreasury().getSie()}; +} + +#treasuryDossierNumberLabel { + text : "lima.treasury.dossierNumber"; +} + +#treasuryDossierNumberTextField { + text : {handler.getTreasury().getDossierNumber()}; +} + +#treasuryZipCodeLabel { + text : "lima.treasury.zipCode"; +} + +#treasuryZipCodeTextField { + text : {handler.getTreasury().getZipCode()}; +} + +#treasurySystemTypeLabel { + text : "lima.treasury.systemType"; +} + +#treasurySystemTypeTextField { + text : {handler.getTreasury().getSystemType()}; +} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx index d99f7f9..50235f8 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx @@ -85,14 +85,6 @@ </row> <row> <cell fill="horizontal"> - <JLabel id="vatNumberLabel"/> - </cell> - <cell fill="horizontal"> - <JTextField id="vatNumberTextField"/> - </cell> - </row> - <row> - <cell fill="horizontal"> <JLabel id="classificationCodeLabel"/> </cell> <cell fill="horizontal"> @@ -115,5 +107,102 @@ <JTextField id="emailTextField" /> </cell> </row> + <row> + <cell fill="horizontal"> + <JLabel id="vatNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="vatNumberTextField" /> + </cell> + </row> + + <row> + <cell fill="horizontal"> + <JLabel id="treasuryAddressLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryAddressTextField"/> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel id="treasuryAddress2Label"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryAddress2TextField"/> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel id="treasuryZipCodeLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryZipCodeTextField"/> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel id="treasuryCityLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryCityTextField"/> + </cell> + </row> + + <row> + <cell fill="horizontal"> + <JLabel id="treasurySieLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasurySieTextField"/> + </cell> + </row> + + <row> + <cell fill="horizontal"> + <JLabel id="treasuryVatNumberLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryDossierNumberTextField"/> + </cell> + </row> + + <row> + <cell fill="horizontal"> + <JLabel id="treasuryKeyLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryKeyTextField"/> + </cell> + </row> + + <row> + <cell fill="horizontal"> + <JLabel id="treasuryCdiLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryCdiTextField"/> + </cell> + </row> + + + <row> + <cell fill="horizontal"> + <JLabel id="treasuryServiceCodeLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasuryServiceCodeTextField"/> + </cell> + </row> + + <row> + <cell fill="horizontal"> + <JLabel id="treasurySystemTypeLabel"/> + </cell> + <cell fill="horizontal"> + <JTextField id="treasurySystemTypeTextField"/> + </cell> + </row> + </Table> </JPanel> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java index 97a5f0d..830d8f9 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java @@ -24,8 +24,10 @@ package org.chorem.lima.ui.opening; import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.IdentityService; +import org.chorem.lima.business.api.TreasuryService; import org.chorem.lima.entity.Identity; import org.chorem.lima.entity.IdentityImpl; +import org.chorem.lima.entity.Treasury; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com @@ -34,14 +36,15 @@ public class CreateIdentityPanelHandler { protected IdentityService identityService; + protected TreasuryService treasuryService; + protected CreateIdentityPanel view; public CreateIdentityPanelHandler(CreateIdentityPanel view) { this.view = view; - identityService = - LimaServiceFactory.getService( - IdentityService.class); + identityService = LimaServiceFactory.getService(IdentityService.class); + treasuryService = LimaServiceFactory.getService(TreasuryService.class); } public Identity getIdentity() { @@ -52,6 +55,11 @@ public class CreateIdentityPanelHandler { return identity; } + public Treasury getTreasury() { + Treasury treasury = treasuryService.getTreasury(); + return treasury; + } + public void updateIdentity(){ Identity identity = getIdentity(); @@ -62,7 +70,7 @@ public class CreateIdentityPanelHandler { identity.setZipCode(view.getZipCodeTextField().getText()); identity.setCity(view.getCityTextField().getText()); identity.setBusinessNumber(view.getBusinessNumberTextField().getText()); - identity.setVatNumber(view.getVatNumberTextField().getText()); + //identity.setVatNumber(view.getVatNumberTextField().getText()); identity.setClassificationCode(view.getClassificationCodeTextField().getText()); identity.setPhoneNumber(view.getPhoneNumberTextField().getText()); identity.setEmail(view.getEmailTextField().getText()); diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index 4c6de4d..e0fa104 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -1,3 +1,5 @@ +Identit\\u00e9= +Tr\\u00e9sor\ Public= lima.account=Account lima.account.add=Add account (Ctrl+A) lima.account.add.error.InvalidAccountNumber=Invalid account number\:%1$s @@ -524,6 +526,17 @@ lima.table.provisionDeprecation=Provision Deprecation lima.table.voucher=Voucher lima.title=Lutin Invoice Monitoring and Accounting lima.transaction=Transaction +lima.treasury.address= +lima.treasury.address2= +lima.treasury.cdi= +lima.treasury.city= +lima.treasury.dossierNumber= +lima.treasury.key= +lima.treasury.serviceCode= +lima.treasury.sie= +lima.treasury.systemType= +lima.treasury.vatNumber= +lima.treasury.zipCode= lima.update=Modify lima.update.shortcut=Update (Ctrl+M) lima.vatStatement=VAT statement chart diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index 6440893..094f9ad 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -1,3 +1,5 @@ +Identit\\u00e9= +Tr\\u00e9sor\ Public= blima.config.documentReport.generalEntrybook.generalEntryBookEntryModelPath.description= lima.account=Compte lima.account.add=Nouveau compte (Ctrl+A) @@ -420,7 +422,7 @@ lima.identity.description=Description lima.identity.email=Courriel lima.identity.name=Nom lima.identity.phoneNumber=n° Tel -lima.identity.vatNumber=n° TVA +lima.identity.vatNumber=Numéro TVA\: FR lima.identity.zipCode=Code Postal lima.import.error=Une erreur est survenue lors de l'import lima.import.error.extractFile=Le fichier n'est correct @@ -530,6 +532,17 @@ lima.table.provisionDeprecation=Amortissements et provisions lima.table.voucher=Pièce comptable lima.title=Lutin Invoice Monitoring and Accounting lima.transaction=Transaction +lima.treasury=Trésor Public +lima.treasury.address=Adresse +lima.treasury.address2=Adresse (suite) +lima.treasury.cdi=CDI +lima.treasury.city=Ville +lima.treasury.dossierNumber=Numéro de dossier +lima.treasury.key=Clé +lima.treasury.serviceCode=Code service +lima.treasury.sie=SIE +lima.treasury.systemType=Régime +lima.treasury.zipCode=Code Postal lima.update=Modifier lima.update.shortcut=Modifier (Ctrl+M) lima.vatStatement=Plan TVA diff --git a/lima-swing/src/main/resources/import/vat_default.csv b/lima-swing/src/main/resources/import/vat_default.csv index 4da2dfb..96a0242 100644 --- a/lima-swing/src/main/resources/import/vat_default.csv +++ b/lima-swing/src/main/resources/import/vat_default.csv @@ -1,7 +1,7 @@ label;header;accounts;boxName;masterVATStatement A. MONTANT DES OPERATIONS REALISEES;O;;; OPERATIONS IMPOSABLES (H.T.);O;;;A. MONTANT DES OPERATIONS REALISEES -Ventes, prestations de services;N;;b1;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) +Ventes, prestations de services;N;701, 702, 703, 704, 705, 706, 707, 708, 7091, 7092, 7094, 7095, 7096, 7097, 7098;b1;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) Autres opérations imposables;N;;b2;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) Achats de prestations de services intracommunautaires;N;;b3;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) Importations (entreprises ayant opté pour le dispositif d’autoliquidation de la TVA à l’importation);N;;b4;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) @@ -43,7 +43,7 @@ Dont TVA sur importations bénéficiant du dispositif d’autoliquidation;N;;b35 Dont TVA sur acquisitions intracommunautaires;N;;b36;B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM) Dont TVA sur opérations à destination de Monaco;N;;b37;B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM) TVA DEDUCTIBLE;O;;;B. DECOMPTE DE LA TVA A PAYER -Biens constituant des immobilisations;N;;b38;B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE +Biens constituant des immobilisations;N;211, 212, 213, 214;b38;B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE Autres biens et services;N;;b39;B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE Autre TVA à déduire;N;;b40;B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE Report du crédit apparaissant ligne 27 de la précédente déclaration;N;;b41;B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.