branch feature/1268-vat-statement-usable created (now 5b05f81)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1268-vat-statement-usable in repository lima. See http://git.chorem.org/lima.git at 5b05f81 refs #1268 l'interface de saisie d'un plan de TVA est de nouveau fonctionnelle This branch includes the following new commits: new 5b05f81 refs #1268 l'interface de saisie d'un plan de TVA est de nouveau fonctionnelle The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 5b05f8145d84c4f3bc6d64558fbc1df4849d935c Author: dcosse <cosse@codelutin.com> Date: Wed Jul 22 11:17:26 2015 +0200 refs #1268 l'interface de saisie d'un plan de TVA est de nouveau fonctionnelle -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1268-vat-statement-usable in repository lima. See http://git.chorem.org/lima.git commit 5b05f8145d84c4f3bc6d64558fbc1df4849d935c Author: dcosse <cosse@codelutin.com> Date: Wed Jul 22 11:17:26 2015 +0200 refs #1268 l'interface de saisie d'un plan de TVA est de nouveau fonctionnelle --- .../lima/business/api/VatStatementService.java | 5 +- .../exceptions/AlreadyAffectedVatBoxException.java | 40 +++ .../exceptions/RequiredFieldException.java | 40 +++ .../lima/business/ejb/ImportServiceImpl.java | 17 +- .../lima/business/ejb/VatStatementServiceImpl.java | 74 +++-- .../chorem/lima/enums/VatStatementsChartEnum.java | 5 +- .../chorem/lima/ui/account/AccountViewHandler.java | 3 +- .../chorem/lima/ui/opening/OpeningViewHandler.java | 69 +---- .../lima/ui/vatchart/VatChartMovementForm.css | 2 + .../lima/ui/vatchart/VatChartMovementForm.jaxx | 19 +- .../chorem/lima/ui/vatchart/VatChartTreeTable.java | 6 +- .../lima/ui/vatchart/VatChartTreeTableModel.java | 228 ++++++-------- .../org/chorem/lima/ui/vatchart/VatChartView.jaxx | 27 +- .../lima/ui/vatchart/VatChartViewHandler.java | 330 ++++++++++++--------- .../resources/i18n/lima-swing_en_GB.properties | 2 + .../resources/i18n/lima-swing_fr_FR.properties | 4 +- .../src/main/resources/import/vat_developed.csv | 56 ---- .../src/main/resources/import/vat_shortened.csv | 56 ---- 18 files changed, 477 insertions(+), 506 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/VatStatementService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/VatStatementService.java index aadfb0d..22d8e97 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/VatStatementService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/VatStatementService.java @@ -22,6 +22,7 @@ package org.chorem.lima.business.api; import org.chorem.lima.beans.VatStatementAmounts; +import org.chorem.lima.business.exceptions.AlreadyAffectedVatBoxException; import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; import org.chorem.lima.business.exceptions.LimaException; import org.chorem.lima.business.exceptions.NotAllowedLabelException; @@ -33,7 +34,7 @@ import java.util.List; public interface VatStatementService { VatStatement createVatStatement(VatStatement masterVatStatement, - VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException; + VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException; List<VatStatement> getAllVatStatements(); @@ -42,7 +43,7 @@ public interface VatStatementService { List<VatStatement> getChildrenVatStatement(VatStatement masterVatStatement); - void updateVatStatement(VatStatement vatStatement); + VatStatement updateVatStatement(VatStatement vatStatement) throws AlreadyExistVatStatementException, AlreadyAffectedVatBoxException, NotAllowedLabelException; VatStatementAmounts vatStatementAmounts(VatStatement vatStatement, Date selectedBeginDate, diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyAffectedVatBoxException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyAffectedVatBoxException.java new file mode 100644 index 0000000..0710ad6 --- /dev/null +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/AlreadyAffectedVatBoxException.java @@ -0,0 +1,40 @@ +package org.chorem.lima.business.exceptions; + +/* + * #%L + * Lima :: business API + * %% + * 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% + */ + +/** + * Created by davidcosse on 31/07/14. + */ +public class AlreadyAffectedVatBoxException extends LimaException { + + private static final long serialVersionUID = 1L; + private String boxId; + + public AlreadyAffectedVatBoxException(String boxId) { + this.boxId = boxId; + } + + public String getBoxId() { + return boxId; + } +} diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/RequiredFieldException.java b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/RequiredFieldException.java new file mode 100644 index 0000000..feb8799 --- /dev/null +++ b/lima-business-api/src/main/java/org/chorem/lima/business/exceptions/RequiredFieldException.java @@ -0,0 +1,40 @@ +package org.chorem.lima.business.exceptions; + +/* + * #%L + * Lima :: business API + * %% + * 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% + */ + +/** + * Created by davidcosse on 31/07/14. + */ +public class RequiredFieldException extends LimaException { + + private static final long serialVersionUID = 1L; + private String fieldName; + + public RequiredFieldException(String fieldName) { + this.fieldName = fieldName; + } + + public String getFieldName() { + return fieldName; + } +} diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java index fe199e0..a505e8b 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java @@ -54,6 +54,7 @@ import org.chorem.lima.business.ejb.ebp.AccountEBPModel; import org.chorem.lima.business.ejb.ebp.EntryBookEBPModel; import org.chorem.lima.business.ejb.ebp.EntryEBPModel; import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; +import org.chorem.lima.business.exceptions.AlreadyAffectedVatBoxException; import org.chorem.lima.business.exceptions.AlreadyExistAccountException; import org.chorem.lima.business.exceptions.AlreadyExistEntryBookException; import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatementException; @@ -503,7 +504,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ // explore branches to find the financialStatement's master one FinancialStatement branchesFinancialStatement = rootFinancialStatement; - branchesFinancialStatement = getBrancheFinancialStatement(masterNames, branchesFinancialStatement); + branchesFinancialStatement = getBranchFinancialStatement(masterNames, branchesFinancialStatement); // in case it exist (not ordered import and previously created) values are bind to the previously created one excepted // the sub financial statements @@ -540,7 +541,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ return rootFinancialStatement; } - private FinancialStatement getBrancheFinancialStatement(String[] masterNames, final FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatementException, NotAllowedLabelException { + private FinancialStatement getBranchFinancialStatement(String[] masterNames, final FinancialStatement branchesFinancialStatement) throws AlreadyExistFinancialStatementException, NotAllowedLabelException { FinancialStatement _branchesFinancialStatement = branchesFinancialStatement; if (_branchesFinancialStatement != null) { // 0 is root, start from 1 @@ -587,7 +588,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ return rootFinancialStatement; } - protected VatStatement returnVATStatement (final VatStatement rootVATStatement, String subVATStatementLabel) throws AlreadyExistVatStatementException, NotAllowedLabelException { + protected VatStatement returnVATStatement (final VatStatement rootVATStatement, String subVATStatementLabel) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { VatStatement targetedVATStatement = null; if (rootVATStatement != null) { Collection<VatStatement> subVatStatements = rootVATStatement.getSubVatStatements(); @@ -705,12 +706,12 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ } result.increaseCreated(); - } catch (AlreadyExistVatStatementException | NotAllowedLabelException e) { + } catch (AlreadyExistVatStatementException | AlreadyAffectedVatBoxException | NotAllowedLabelException e) { result.addException(e); } } - private void refreshMasterVATStatement(Map<String, VatStatement> orderedVATStatements, final VatStatement vatStatement, final VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException { + private void refreshMasterVATStatement(Map<String, VatStatement> orderedVATStatements, final VatStatement vatStatement, final VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { // if the master vatStatement has been modified then the current one is replace by the new one. VatStatement _vatStatement = vatStatementService.createVatStatement(branchesVATStatement, vatStatement); VatStatement targetedRootVATStatement = returnRootVATStatement(_vatStatement); @@ -735,7 +736,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ return alreadyCreated; } - private VatStatement getBrancheVatStatement(String[] masterNames, final VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException { + private VatStatement getBrancheVatStatement(String[] masterNames, final VatStatement branchesVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { VatStatement _branchesVATStatement = branchesVATStatement; for (int i = 1; i < masterNames.length; i++) {// 0 is root String masterName = masterNames[i]; @@ -744,7 +745,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ return _branchesVATStatement; } - private VatStatement createRootVATStatement(Map<String, VatStatement> orderedVATStatements, String rootMasterName, final VatStatement rootVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException { + private VatStatement createRootVATStatement(Map<String, VatStatement> orderedVATStatements, String rootMasterName, final VatStatement rootVATStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { VatStatement result = rootVATStatement; if (result == null) { result = vatStatementService.newVatStatement(); @@ -755,7 +756,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ return result; } - private VatStatement getRootVatStatement(Map<String, VatStatement> orderedVATStatements, final VatStatementImport vatStatementBean, final VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException { + private VatStatement getRootVatStatement(Map<String, VatStatement> orderedVATStatements, final VatStatementImport vatStatementBean, final VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { VatStatement rootVATStatement = null; if (vatStatementBean != null) { diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java index 7be9195..cd63bca 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java @@ -24,6 +24,7 @@ package org.chorem.lima.business.ejb; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import org.apache.commons.lang3.StringUtils; import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.beans.VatStatementAmounts; import org.chorem.lima.beans.VatStatementAmountsImpl; @@ -32,12 +33,14 @@ import org.chorem.lima.beans.VatStatementDatasImpl; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ReportService; import org.chorem.lima.business.api.VatStatementService; +import org.chorem.lima.business.exceptions.AlreadyAffectedVatBoxException; import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; import org.chorem.lima.business.exceptions.LimaException; import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.entity.VatStatementTopiaDao; +import org.nuiton.topia.persistence.TopiaNonUniqueResultException; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; @@ -75,8 +78,9 @@ public class VatStatementServiceImpl extends AbstractLimaService implements VatS } }; - protected void validateNewVATStatement(VatStatement masterVatStatement, VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException { - if (vatStatement.getLabel().contains("/")) { + protected void validateNewVATStatement(VatStatement masterVatStatement, VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { + + if (StringUtils.isNotBlank(vatStatement.getLabel()) && vatStatement.getLabel().contains("/")) { throw new NotAllowedLabelException(vatStatement.getLabel()); } if (masterVatStatement != null) { @@ -84,11 +88,26 @@ public class VatStatementServiceImpl extends AbstractLimaService implements VatS if (masterSubVatStatements == null) { masterSubVatStatements = Lists.newArrayList(); } - Map indexedSubVatStatements = Maps.uniqueIndex(masterSubVatStatements, GET_LABEL); - if (indexedSubVatStatements.get(vatStatement.getLabel()) != null){ + Map<String, VatStatement> indexedSubVatStatements = Maps.uniqueIndex(masterSubVatStatements, GET_LABEL); + if (indexedSubVatStatements.get(vatStatement.getLabel()) != null && (!vatStatement.isPersisted() || !indexedSubVatStatements.get(vatStatement.getLabel()).getTopiaId().contentEquals(vatStatement.getTopiaId()))){ throw new AlreadyExistVatStatementException(vatStatement.getLabel(), masterVatStatement.getLabel()); } } + + VatStatementTopiaDao vatStatementTopiaDao = getDaoHelper().getVatStatementDao(); + try { + String boxName = StringUtils.trimToNull(vatStatement.getBoxName()); + vatStatement.setBoxName(boxName); + + if (boxName != null) { + VatStatement vatStatementWithSameBoxName = vatStatementTopiaDao.forBoxNameEquals(vatStatement.getBoxName()).findUniqueOrNull(); + if (vatStatementWithSameBoxName != null && (!vatStatement.isPersisted() || !vatStatementWithSameBoxName.getTopiaId().contentEquals(vatStatement.getTopiaId()))) { + throw new AlreadyAffectedVatBoxException(vatStatement.getBoxName()); + } + } + } catch (TopiaNonUniqueResultException e) { + throw new AlreadyAffectedVatBoxException(vatStatement.getBoxName()); + } } @@ -98,6 +117,7 @@ public class VatStatementServiceImpl extends AbstractLimaService implements VatS VatStatementTopiaDao vatStatementTopiaDao = getDaoHelper().getVatStatementDao(); masterVatStatement.addSubVatStatements(vatStatement); + masterVatStatement.setHeader(true); if (masterVatStatement.isPersisted()) { // update the persisted entity to avoid NonUniqueObjectException: A different object with the same identifier value was already associated with the session @@ -114,20 +134,38 @@ public class VatStatementServiceImpl extends AbstractLimaService implements VatS @Override public VatStatement createVatStatement(VatStatement masterVatStatement, - VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException { + VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { - validateNewVATStatement(masterVatStatement, vatStatement); + VatStatement result = null; + if (StringUtils.isNotBlank(vatStatement.getLabel()) || StringUtils.isNotBlank(vatStatement.getAccounts()) || StringUtils.isNotBlank(vatStatement.getBoxName())) { + validateNewVATStatement(masterVatStatement, vatStatement); - VatStatementTopiaDao vatStatementTopiaDao = getDaoHelper().getVatStatementDao(); + if (!vatStatement.isPersisted()) { + VatStatementTopiaDao vatStatementTopiaDao = getDaoHelper().getVatStatementDao(); + result = vatStatementTopiaDao.create(vatStatement); + } else { + result = vatStatement; + } - VatStatement result; - if (!vatStatement.isPersisted()) { - result = vatStatementTopiaDao.create(vatStatement); - } else { - result = vatStatement; + addVatStatementToMaster(masterVatStatement, result); } - addVatStatementToMaster(masterVatStatement, result); + return result; + } + + @Override + public VatStatement updateVatStatement(VatStatement vatStatement) throws AlreadyExistVatStatementException, AlreadyAffectedVatBoxException, NotAllowedLabelException { + VatStatement result = null; + if (StringUtils.isNotBlank(vatStatement.getLabel()) || StringUtils.isNotBlank(vatStatement.getAccounts()) || StringUtils.isNotBlank(vatStatement.getBoxName())) { + validateNewVATStatement(vatStatement.getMasterVatStatement(), vatStatement); + // TopiaDao + VatStatementTopiaDao vatStatementHeaderTopiaDao = getDaoHelper().getVatStatementDao(); + VatStatement originalVatStatement = vatStatementHeaderTopiaDao.forTopiaIdEquals(vatStatement.getTopiaId()).findUnique(); + Binder<VatStatement, VatStatement> binder = BinderFactory.newBinder(VatStatement.class, VatStatement.class); + binder.copy(vatStatement, originalVatStatement); + //update + result = vatStatementHeaderTopiaDao.update(originalVatStatement); + } return result; } @@ -166,16 +204,6 @@ public class VatStatementServiceImpl extends AbstractLimaService implements VatS } - @Override - public void updateVatStatement(VatStatement vatStatement) { - - // TopiaDao - VatStatementTopiaDao vatStatementHeaderTopiaDao = getDaoHelper().getVatStatementDao(); - //update - vatStatementHeaderTopiaDao.update(vatStatement); - - } - /** * Gives the list of account numbers from a VatStatement. * diff --git a/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java b/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java index 3a6d206..931c501 100644 --- a/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java +++ b/lima-swing/src/main/java/org/chorem/lima/enums/VatStatementsChartEnum.java @@ -30,10 +30,7 @@ import static org.nuiton.i18n.I18n.t; public enum VatStatementsChartEnum implements Labeled { DEFAULT("vat_default.csv", t("lima.vatStatement.default")), - SHORTENED("vat_shortened.csv", t("lima.vatStatement.shortened")), - BASE("vat_base.csv", t("lima.vatStatement.base")), - DEVELOPED("vat_developed.csv", t("lima.vatStatement.developed")), - IMPORT("", t("lima.vatStatement.import")); + IMPORT(null, t("lima.vatStatement.import")); protected final String filePath; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java index 9680deb..8392137 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java @@ -467,8 +467,7 @@ public class AccountViewHandler implements ServiceListener { // if action confirmed if (value != null) { ImportExport importExport = new ImportExport(view); - AccountsChartEnum defaultAccountsChartEnum = - (AccountsChartEnum) value; + AccountsChartEnum defaultAccountsChartEnum = (AccountsChartEnum) value; //Import accounts chart switch (defaultAccountsChartEnum) { case IMPORT_EBP: diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java index fb8079e..f2b5b64 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java @@ -24,16 +24,14 @@ package org.chorem.lima.ui.opening; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.business.exceptions.LimaException; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FiscalPeriodImpl; import org.chorem.lima.enums.AccountsChartEnum; import org.chorem.lima.enums.EntryBooksChartEnum; -import org.chorem.lima.enums.FinancialStatementsChartEnum; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.enums.VatStatementsChartEnum; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import javax.swing.*; @@ -103,61 +101,25 @@ public class OpeningViewHandler { view.repaint(); step++; break; - case 2: Object value = caPanel.getButtonGroup().getSelectedValue(); // if action confirmed if (value != null) { - AccountsChartEnum defaultAccountsChartEnum = - (AccountsChartEnum) value; - //Import accounts chart - switch (defaultAccountsChartEnum) { - case IMPORT_EBP: - importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT, - null, defaultAccountsChartEnum.getDefaultFileURL(), false); - break; - - default: - importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT, - null, defaultAccountsChartEnum.getDefaultFileURL(), false); - break; - } - //Import financialstatement - switch (defaultAccountsChartEnum) { - case SHORTENED: - importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT, - null, defaultAccountsChartEnum.getDefaultFileURL(), false); - break; - case DEVELOPED: - importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT, - null, FinancialStatementsChartEnum.DEVELOPED.getDefaultFileUrl() , false); - break; - default: - importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT, - null, FinancialStatementsChartEnum.BASE.getDefaultFileUrl(), false); - break; + if (value instanceof AccountsChartEnum) { + AccountsChartEnum defaultAccountsChartEnum = (AccountsChartEnum) value; + //Import accounts chart + switch (defaultAccountsChartEnum) { + case IMPORT_EBP: + importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT, + null, defaultAccountsChartEnum.getDefaultFileURL(), false); + break; + + default: + importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT, + null, defaultAccountsChartEnum.getDefaultFileURL(), false); + break; + } } - //Import vatstatement - switch (defaultAccountsChartEnum) { - case SHORTENED: - // TODO DCossé 31/07/14 why vat_base, default developped and shortened file have got same contents ? - importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, - null, VatStatementsChartEnum.SHORTENED.getDefaultFileUrl(), false); - break; - case BASE: - importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, - null, VatStatementsChartEnum.BASE.getDefaultFileUrl(), false); - break; - case DEVELOPED: - importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, - null, VatStatementsChartEnum.DEVELOPED.getDefaultFileUrl(), false); - break; - default: - importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, - null, VatStatementsChartEnum.DEFAULT.getDefaultFileUrl(), false); - break; - } - } view.getAccountsIcon().setBorder(noBorder); view.getEntrybooksIcon().setBorder(BorderFactory.createLineBorder(green, 2)); @@ -166,7 +128,6 @@ public class OpeningViewHandler { view.repaint(); step++; break; - case 3: if (ebPanel.getImportEntryBook().isSelected()) { importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT, diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.css b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.css index 1dfeea2..704f876 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.css @@ -46,6 +46,7 @@ #accountsTextField { text : "{getVatStatement().getAccounts()}"; + enabled : "{!getVatStatement().isHeader()}" } #boxNameLabel { @@ -54,6 +55,7 @@ #boxNameTextField { text : "{getVatStatement().getBoxName()}"; + enabled : "{!getVatStatement().isHeader()}" } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx index cca1dea..ca86500 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx @@ -23,7 +23,7 @@ modal="true" defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}" layout="{new BorderLayout()}" - onWindowClosing="performCancel();"> + onWindowClosing="dispose();"> <import> javax.swing.text.Document @@ -31,19 +31,14 @@ org.chorem.lima.entity.VatStatementImpl </import> + <VatChartViewHandler id='handler' initializer='getContextValue(VatChartView.class,JAXXUtil.PARENT).getHandler()'/> <VatStatement id="vatStatement" javaBean='null'/> <Boolean id="addState" javaBean='true'/> + <Boolean id="isUpdate" javaBean='null'/> <script> <![CDATA[ - - getRootPane().setDefaultButton(ok); - - protected void performCancel() { - setVatStatement(null); - dispose(); - } - + getRootPane().setDefaultButton(ok); ]]> </script> @@ -84,7 +79,7 @@ </cell> <cell fill="horizontal"> <JTextField id="boxNameTextField" - onKeyReleased="getVatStatement().setBoxName(getAccountsTextField().getText())"/> + onKeyReleased="getVatStatement().setBoxName(getBoxNameTextField().getText())"/> </cell> </row> @@ -93,8 +88,8 @@ <JPanel constraints="BorderLayout.SOUTH" layout='{new GridLayout(1,0)}'> <JButton id="cancel" - onActionPerformed="performCancel()"/> - <JButton id="ok" onActionPerformed="dispose()"/> + <JButton id="ok" + onActionPerformed="handler.createOrUpdateVatStatementMovement(this)"/> </JPanel> </JDialog> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java index 6133793..ff1a31c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java @@ -66,9 +66,9 @@ public class VatChartTreeTable extends JXTreeTable @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - JXTreeTable treeTable = handler.view.getTreeTable(); - TreeTableModel treeTableModel = treeTable.getTreeTableModel(); - TreePath treePath = treeTable.getPathForRow(adapter.row); + JXTreeTable vatTreeTable = handler.view.getVatTreeTable(); + TreeTableModel treeTableModel = vatTreeTable.getTreeTableModel(); + TreePath treePath = vatTreeTable.getPathForRow(adapter.row); VatStatement vatStatement = (VatStatement) treePath.getLastPathComponent(); boolean highlighted = false; diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java index 847c1d0..3b067a2 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java @@ -23,21 +23,24 @@ package org.chorem.lima.ui.vatchart; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaSwingConfig; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.VatStatementService; +import org.chorem.lima.business.exceptions.AlreadyAffectedVatBoxException; import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.entity.VatStatement; import org.chorem.lima.entity.VatStatementImpl; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; -import org.jdesktop.swingx.treetable.AbstractTreeTableModel; - -import javax.swing.tree.TreePath; -import java.util.List; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; +import org.jdesktop.swingx.treetable.TreeTableNode; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; import static org.nuiton.i18n.I18n.t; -public class VatChartTreeTableModel extends AbstractTreeTableModel { +public class VatChartTreeTableModel extends DefaultTreeTableModel { /** log. */ private static final Log log = LogFactory.getLog(VatChartViewHandler.class); @@ -48,178 +51,139 @@ public class VatChartTreeTableModel extends AbstractTreeTableModel { protected ErrorHelper errorHelper; /** Model constructor. Initiate account service used here. */ - public VatChartTreeTableModel() { + public VatChartTreeTableModel(TreeTableNode root) { //create root for the tree - super(new VatStatementImpl()); + super(root); // Gets factory service - vatStatementService = - LimaServiceFactory.getService( - VatStatementService.class); - } - - - @Override - public int getColumnCount() { - return 2; - } - - @Override - public String getColumnName(int column) { - String res = null; - switch (column) { - case 0: - res = t("lima.table.label"); - break; - case 1: - res = t("lima.table.account"); - break; - } - return res; - } - - @Override - public int getChildCount(Object node) { - int result; - if (node == getRoot()) { - result = vatStatementService. - getChildrenVatStatement(null).size(); - } else { - VatStatement parentVatStatementHeader = - (VatStatement) node; - result = vatStatementService.getChildrenVatStatement( - parentVatStatementHeader).size(); - } - return result; + vatStatementService = LimaServiceFactory.getService(VatStatementService.class); + errorHelper = new ErrorHelper(LimaSwingConfig.getInstance()); } @Override - public Object getChild(Object parent, int index) { - Object result; - if (parent == getRoot()) { - List<VatStatement> vatStatements = - vatStatementService.getChildrenVatStatement(null); - result = vatStatements.get(index); + public Object getValueAt(Object node, int column) { + Object result = "n/a"; + MutableTreeTableNode treeNode = (MutableTreeTableNode) node; + if (treeNode.getUserObject() instanceof VatStatement) { + VatStatement vatStatement = (VatStatement)treeNode.getUserObject(); + switch (column) { + case 0: + result = vatStatement.getLabel(); + break; + case 1: + result = vatStatement.getAccounts(); + break; + case 2: + result = vatStatement.getBoxName(); + } } else { - VatStatement parentVatStatement = - (VatStatement) parent; - List<VatStatement> vatStatements = vatStatementService. - getChildrenVatStatement(parentVatStatement); - result = vatStatements.get(index); + result = treeNode.getUserObject(); } - return result; - } - @Override - public int getIndexOfChild(Object parent, Object child) { - int result; - if (parent == getRoot()) { - List<VatStatement> vatStatements = - vatStatementService.getChildrenVatStatement(null); - result = vatStatements.indexOf(child); - } else { - VatStatement parentVatStatement = - (VatStatement) parent; - List<VatStatement> vatStatements = vatStatementService. - getChildrenVatStatement(parentVatStatement); - result = vatStatements.indexOf(child); - } - return result; - } - - @Override - public Object getValueAt(Object node, int column) { - Object result = "n/a"; - VatStatement vatStatement = (VatStatement) node; - switch (column) { - case 0: - result = vatStatement.getLabel(); - break; - case 1: - result = vatStatement.getAccounts(); - break; - } return result; } @Override public boolean isCellEditable(Object node, int column) { - return column == 1 && isLeaf(node); + return column >= 1 && isLeaf(node); } @Override - public boolean isLeaf(Object node) { - return getChildCount(node) == 0; - } + public void setValueAt(Object value, Object objectNode, int column) { + MutableTreeTableNode node = (MutableTreeTableNode) objectNode; + VatStatement vatStatement = (VatStatement) node.getUserObject(); - /** Refresh VatStatementChart. */ - public void refreshTree() { + // copy is done in case of exception to keep original object intact + VatStatement copy = getVatStatementCopy(vatStatement); - modelSupport.fireNewRoot(); - } + String newValue = (String) value; + String originalValue = setNewValueToVatStatement(column, copy, newValue); + if (originalValue != null && !originalValue.contentEquals(newValue)) { + newValue = persistValue(node, copy, newValue, originalValue); + super.setValueAt(newValue, node, column); + } + + } /** * Add VatStatement(path can be null). * - * @param path * @param vatStatement */ - public void addVatStatement(TreePath path, VatStatement vatStatement) { - // Calling account service - //fixed bug when path is null - VatStatement parentVatStatementHeader = null; - if (path != null) { - parentVatStatementHeader = - (VatStatement) path.getLastPathComponent(); - } + public VatStatement addVatStatement(VatStatement parentVatStatementHeader, VatStatement vatStatement) { + VatStatement result = null; try { - vatStatementService.createVatStatement( - parentVatStatementHeader, vatStatement); + result = vatStatementService.createVatStatement(parentVatStatementHeader, vatStatement); } catch (AlreadyExistVatStatementException alreadyExistVatStatement) { errorHelper.showErrorMessage(t("lima.financialStatement.error.alreadyExistFinancialStatement", alreadyExistVatStatement.getVatStatementLabel(), alreadyExistVatStatement.getMasterLabel())); } catch (NotAllowedLabelException notAllowedLabel) { - errorHelper.showErrorMessage(t("lima.error.notAllowedLabel", - notAllowedLabel.getLabel())); + errorHelper.showErrorMessage(t("lima.error.notAllowedLabel", notAllowedLabel.getLabel())); + } catch (AlreadyAffectedVatBoxException e) { + errorHelper.showErrorMessage(t("lima.financialStatement.error.alreadyUsedVatBox", + e.getBoxId())); } - modelSupport.fireTreeStructureChanged(path); + return result; } /** * Update vatStatement * - * @param path * @param vatStatement */ - public void updateVatStatement(TreePath path, VatStatement vatStatement) { - - vatStatementService.updateVatStatement(vatStatement); - modelSupport.fireTreeStructureChanged(path); + public VatStatement updateVatStatement(VatStatement vatStatement) { + VatStatement updatedVatStatement = null; + try { + updatedVatStatement = vatStatementService.updateVatStatement(vatStatement); + } catch (AlreadyExistVatStatementException alreadyExistVatStatement) { + errorHelper.showErrorMessage(t("lima.financialStatement.error.alreadyExistFinancialStatement", + alreadyExistVatStatement.getVatStatementLabel(), alreadyExistVatStatement.getMasterLabel())); + } catch (NotAllowedLabelException notAllowedLabel) { + errorHelper.showErrorMessage(t("lima.error.notAllowedLabel", notAllowedLabel.getLabel())); + } catch (AlreadyAffectedVatBoxException e) { + errorHelper.showErrorMessage(t("lima.financialStatement.error.alreadyUsedVatBox", + e.getBoxId())); + } + return updatedVatStatement; } - /** - * Remove vatStatement - * - * @param path - * @param vatStatement - */ - public void removeVatStatementObject(TreePath path, VatStatement vatStatement) { - // Calling account service - int index = getIndexOfChild( - path.getParentPath().getLastPathComponent(), vatStatement); - vatStatementService.removeVatStatement(vatStatement); - modelSupport.fireChildRemoved(path.getParentPath(), index, vatStatement); + protected String persistValue(MutableTreeTableNode node, VatStatement copy, String newValue, String originalValue) { + String cellValue; + VatStatement persistedVatStatement = updateVatStatement(copy); + if (persistedVatStatement != null) { + cellValue = newValue; + node.setUserObject(persistedVatStatement); + } else { + cellValue = originalValue; + } + return cellValue; } + protected String setNewValueToVatStatement(int column, VatStatement copy, String newValue) { + String originalValue = null; + switch (column) { + case 1: + originalValue = copy.getAccounts() == null ? "" : copy.getAccounts(); + copy.setAccounts(newValue); + break; + case 2: + originalValue = copy.getBoxName() == null ? "" : copy.getBoxName(); + copy.setBoxName(newValue); + break; + default: + break; + } + return originalValue; + } - @Override - public void setValueAt(Object value, Object node, int column) { - VatStatement vatStatement = (VatStatement) node; - vatStatement.setAccounts((String) value); - vatStatementService.updateVatStatement(vatStatement); + protected VatStatement getVatStatementCopy(VatStatement vatStatement) { + VatStatement copy = new VatStatementImpl(); + Binder<VatStatement, VatStatement> binder = BinderFactory.newBinder(VatStatement.class, VatStatement.class); + binder.copy(vatStatement, copy); + return copy; } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx index 5d2e05e..2bf5f16 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx @@ -23,16 +23,19 @@ <import> javax.swing.ListSelectionModel + org.jdesktop.swingx.JXTreeTable + org.jdesktop.swingx.decorator.HighlighterFactory </import> - <VatChartViewHandler id="handler" javaBean="new VatChartViewHandler(this)"/> + <!--<VatChartViewHandler id="handler" javaBean="new VatChartViewHandler(this)"/>--> + <VatChartViewHandler id="handler" constructorParams="this"/> <Boolean id="selectedRow" javaBean="false"/> - <script> - <![CDATA[ - //getHandler().init(); - ]]> - </script> + <script><![CDATA[ + void $afterCompleteSetup() { + handler.init(); + } + ]]></script> <JToolBar id="toolbar" constraints="BorderLayout.PAGE_START"> @@ -51,13 +54,9 @@ </JToolBar> - <JScrollPane> - <VatChartTreeTableModel id="vatTreeTableModel"/> - <VatChartTreeTable id="treeTable" - constructorParams="getHandler()" - treeTableModel="{getVatTreeTableModel()}"/> - <ListSelectionModel - javaBean="getTreeTable().getSelectionModel()" - onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/> + <JScrollPane constraints="BorderLayout.CENTER"> + <JXTreeTable id="vatTreeTable"/> + <ListSelectionModel initializer='vatTreeTable.getSelectionModel()' + onValueChanged="setSelectedRow(vatTreeTable.getSelectedRow() != -1)"/> </JScrollPane> </JPanel> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java index 0d255c8..e6e3425 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java @@ -21,6 +21,8 @@ */ package org.chorem.lima.ui.vatchart; +import org.apache.commons.collections4.CollectionUtils; +import org.chorem.lima.LimaSwingConfig; import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.ImportService; @@ -30,17 +32,21 @@ import org.chorem.lima.entity.VatStatementImpl; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.enums.VatStatementsChartEnum; import org.chorem.lima.ui.importexport.ImportExport; +import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; -import javax.swing.AbstractAction; -import javax.swing.ActionMap; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.KeyStroke; +import javax.swing.*; import javax.swing.tree.TreePath; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -50,15 +56,15 @@ public class VatChartViewHandler implements ServiceListener { protected VatChartView view; + protected ErrorHelper errorHelper; + protected VatChartViewHandler(VatChartView view) { this.view = view; - vatStatementService = - LimaServiceFactory.getService( - VatStatementService.class); + vatStatementService = LimaServiceFactory.getService(VatStatementService.class); LimaServiceFactory.addServiceListener(ImportService.class, this); + errorHelper = new ErrorHelper(LimaSwingConfig.getInstance()); - init(); } public void init() { @@ -96,149 +102,129 @@ public class VatChartViewHandler implements ServiceListener { } }); + JXTreeTable table = view.getVatTreeTable(); + table.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + JXTreeTable source = (JXTreeTable) e.getSource(); + if (source.rowAtPoint(e.getPoint()) >= 0 && e.getClickCount() == 2) { + updateVatStatement(); + } + } + }); + + MutableTreeTableNode rootTreeTable = loadAllVatStatements(); + initVatChartTreeTableModel(rootTreeTable); } - public void addVatStatementMovement() { + public void importVatStatementChart() { + final VatChartImportForm importVatForm = new VatChartImportForm(); + displayDialog(importVatForm); - VatChartTreeTableModel treeTableModel = - (VatChartTreeTableModel) view.getTreeTable().getTreeTableModel(); + Object value = importVatForm.getChartVatStatementCombo().getSelectedItem(); + // if action confirmed + if (value != null) { - int selectedRow = view.getTreeTable().getSelectedRow(); - // get current selection path - TreePath treePath; - if (selectedRow == -1) { - treePath = null; - } else { - treePath = view.getTreeTable().getPathForRow(selectedRow); - } + if (importVatForm.getDeleteVatStatementChart().isSelected()) { + vatStatementService.removeAllVatStatement(); + } - VatStatement newVatChartMovement = new VatStatementImpl(); - final VatChartMovementForm vatChartMovementForm = - new VatChartMovementForm(view); - VatStatement masterVatStatement = null; - if (selectedRow != -1) { - masterVatStatement = (VatStatement) treePath.getLastPathComponent(); - } - newVatChartMovement.setMasterVatStatement(masterVatStatement); - vatChartMovementForm.setVatStatement(newVatChartMovement); + VatStatementsChartEnum vatStatementsEnum = (VatStatementsChartEnum) value; - InputMap inputMap = vatChartMovementForm.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - ActionMap actionMap = vatChartMovementForm.getRootPane().getActionMap(); - String binding = "dispose"; - inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding); - actionMap.put(binding, new AbstractAction() { - @Override - public void actionPerformed(ActionEvent e) { - vatChartMovementForm.performCancel(); + ImportExport importExport = new ImportExport(view); + switch (vatStatementsEnum) { + case IMPORT: + importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, + null, + null, + false); + break; + default: + importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, + null, + vatStatementsEnum.getDefaultFileUrl(), + true); } - }); + } - // jaxx constructor don't call super() ? - vatChartMovementForm.setLocationRelativeTo(view); - vatChartMovementForm.setVisible(true); - newVatChartMovement = vatChartMovementForm.getVatStatement(); + MutableTreeTableNode root = loadAllVatStatements(); + initVatChartTreeTableModel(root); + } - // null == cancel action - if (newVatChartMovement != null) { - // add it - treeTableModel.addVatStatement(treePath, newVatChartMovement); - refresh(); - } + public void addVatStatementMovement() { + + final VatChartMovementForm editVatChartForm = new VatChartMovementForm(view); + editVatChartForm.setIsUpdate(false); + + VatStatement masterVatStatement = getMasterVatStatement(); + VatStatement newVatChartMovement = new VatStatementImpl(); + newVatChartMovement.setMasterVatStatement(masterVatStatement); + editVatChartForm.setVatStatement(newVatChartMovement); + + displayDialog(editVatChartForm); } public void updateVatStatement() { - JXTreeTable treeTable = view.getTreeTable(); - VatChartTreeTableModel treeTableModel = - (VatChartTreeTableModel) treeTable.getTreeTableModel(); + JXTreeTable table = view.getVatTreeTable(); + int selectedRow = table.getSelectedRow(); + TreePath treePath = table.getPathForRow(selectedRow); // not null + MutableTreeTableNode vatStatementNode = (MutableTreeTableNode) treePath.getLastPathComponent(); + VatStatement vatStatement = (VatStatement) vatStatementNode.getUserObject(); + + // get current selection path + final VatChartMovementForm editVatChartForm = new VatChartMovementForm(view); + editVatChartForm.setIsUpdate(true); + editVatChartForm.setVatStatement(vatStatement); + + displayDialog(editVatChartForm); - // get selected account - int selectedRow = view.treeTable.getSelectedRow(); - TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null - VatStatement vatStatement = - (VatStatement) treePath.getLastPathComponent(); - //update Account or update SubLedger - if (vatStatement != null) { - // get current selection path - if (selectedRow != -1) { - treePath = view.treeTable.getPathForRow(selectedRow); - } else { - treePath = new TreePath(treeTableModel.getRoot()); - } - final VatChartMovementForm vatChartMovementForm = - new VatChartMovementForm(view); - if (vatStatement.getMasterVatStatement() == null) { - VatStatement masterVatStatement = new VatStatementImpl(); - vatStatement.setMasterVatStatement(masterVatStatement); - } - vatChartMovementForm.setVatStatement(vatStatement); - - InputMap inputMap = vatChartMovementForm.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - ActionMap actionMap = vatChartMovementForm.getRootPane().getActionMap(); - String binding = "dispose"; - inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding); - actionMap.put(binding, new AbstractAction() { - @Override - public void actionPerformed(ActionEvent e) { - vatChartMovementForm.performCancel(); - } - }); - - // jaxx constructor don't call super() ? - vatChartMovementForm.setLocationRelativeTo(view); - vatChartMovementForm.setVisible(true); - // null == cancel action - vatStatement = vatChartMovementForm.getVatStatement(); - //if action confirmed - if (vatStatement != null) { - // update it - treeTableModel.updateVatStatement( - treePath, vatStatement); - } - } } - public void importVatStatementChart() { - final VatChartImportForm form = - new VatChartImportForm(); + public void createOrUpdateVatStatementMovement(VatChartMovementForm dialog) { - InputMap inputMap = form.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - ActionMap actionMap = form.getRootPane().getActionMap(); - String binding = "dispose"; - inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding); - actionMap.put(binding, new AbstractAction() { - @Override - public void actionPerformed(ActionEvent e) { - form.performCancel(); - } - }); + JXTreeTable treeTable = view.getVatTreeTable(); + VatChartTreeTableModel treeTableModel = (VatChartTreeTableModel) treeTable.getTreeTableModel(); + VatStatement vatStatement = dialog.getVatStatement(); - form.setLocationRelativeTo(view); - form.setVisible(true); + try { + int selectedRow = treeTable.getSelectedRow(); + TreePath treePath = treeTable.getPathForRow(selectedRow); - Object value = form.getChartVatStatementCombo().getSelectedItem(); - // if action confirmed - if (value != null) { - if (form.getDeleteVatStatementChart().isSelected()) { - vatStatementService.removeAllVatStatement(); + if (dialog.isIsUpdate()) { + VatStatement updatedVatStatement = createOrUpdateVatStatement(treeTableModel, vatStatement); + if (updatedVatStatement != null) { + treeTableModel.valueForPathChanged(treePath, updatedVatStatement); + } + } else { + if (selectedRow != -1) { + VatStatement persistedVatStatement = createOrUpdateVatStatement(treeTableModel, vatStatement); + + if (persistedVatStatement != null) { + DefaultMutableTreeTableNode newNode = new DefaultMutableTreeTableNode(persistedVatStatement); + DefaultMutableTreeTableNode node = (DefaultMutableTreeTableNode) treePath.getLastPathComponent(); + + treeTableModel.insertNodeInto(newNode, node, node.getChildCount()); + treeTable.expandPath(new TreePath(treeTableModel.getPathToRoot(node))); + } + } } - VatStatementsChartEnum vatStatementsEnum = (VatStatementsChartEnum) value; - ImportExport importExport = new ImportExport(view); - importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, - null, vatStatementsEnum.getDefaultFileUrl(), true); - refresh(); + + } finally { + dialog.dispose(); } + } /** Ask for user to remove for selected account, and remove it if confirmed. */ public void removeVatStatement() { - JXTreeTable treeTable = view.getTreeTable(); + JXTreeTable treeTable = view.getVatTreeTable(); VatChartTreeTableModel treeTableModel = (VatChartTreeTableModel) treeTable.getTreeTableModel(); // Any row selected - int selectedRow = view.treeTable.getSelectedRow(); + int selectedRow = treeTable.getSelectedRow(); if (selectedRow != -1) { int n = JOptionPane.showConfirmDialog(view, t("lima.vatStatement.remove.confirm"), @@ -248,40 +234,106 @@ public class VatChartViewHandler implements ServiceListener { if (n == JOptionPane.YES_OPTION) { // update view of treetable TreePath treePath = treeTable.getPathForRow(selectedRow); - VatStatement vatStatement = - (VatStatement) treePath.getLastPathComponent(); - if (!treeTableModel.isLeaf(vatStatement)) { + MutableTreeTableNode child = (MutableTreeTableNode) treePath.getLastPathComponent(); + if (!treeTableModel.isLeaf(child)) { JOptionPane.showMessageDialog( view, t("lima.vatStatement.delete.parent"), t("lima.info"), JOptionPane.INFORMATION_MESSAGE); } else { - treeTableModel.removeVatStatementObject( - treePath, vatStatement); + VatStatement vatStatement = (VatStatement) child.getUserObject(); + vatStatementService.removeVatStatement(vatStatement); + treeTableModel.removeNodeFromParent(child); } } - refresh(); } } - public void refresh() { - JXTreeTable treeTable = view.getTreeTable(); - VatChartTreeTableModel treeTableModel = - (VatChartTreeTableModel) treeTable.getTreeTableModel(); - treeTableModel.refreshTree(); - //refresh view - view.repaint(); - } - @Override public void notifyMethod(String serviceName, String methodeName) { if (methodeName.contains("VatStatements") || methodeName.contains("importAll") || methodeName.contains("importAs")) { - refresh(); } } + protected void displayDialog(final JDialog dialog) { + InputMap inputMap = dialog.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + ActionMap actionMap = dialog.getRootPane().getActionMap(); + String binding = "dispose"; + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding); + actionMap.put(binding, new AbstractAction() { + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + }); + + // jaxx constructor don't call super() ? + dialog.setLocationRelativeTo(view); + dialog.setVisible(true); + } + + protected void addChildToParentsNode(DefaultMutableTreeTableNode parent, Collection<VatStatement> childs) { + if (CollectionUtils.isNotEmpty(childs)) { + for (VatStatement subStatement : childs) { + DefaultMutableTreeTableNode subNodes = new DefaultMutableTreeTableNode(subStatement); + parent.add(subNodes); + if (subStatement.isHeader()) { + addChildToParentsNode(subNodes, subStatement.getSubVatStatements()); + } + } + } + } + + protected MutableTreeTableNode loadAllVatStatements() { + List<VatStatement> rootStatements = vatStatementService.getRootVatStatements(); + + DefaultMutableTreeTableNode rootTreeTable = new DefaultMutableTreeTableNode(null); + for (VatStatement rootStatement : rootStatements) { + DefaultMutableTreeTableNode rootNode = new DefaultMutableTreeTableNode(rootStatement); + rootTreeTable.add(rootNode); + + Collection<VatStatement> subVatStatements = rootStatement.getSubVatStatements(); + addChildToParentsNode(rootNode, subVatStatements); + } + return rootTreeTable; + } + + protected void initVatChartTreeTableModel(MutableTreeTableNode root) { + // refreshing tree's model + DefaultTreeTableModel model = new VatChartTreeTableModel(root); + + model.setColumnIdentifiers(Arrays.asList(t("lima.table.label"), t("lima.table.account"), t("lima.table.boxName"))); + JXTreeTable table = view.getVatTreeTable(); + table.setTreeTableModel(model); + } + + protected VatStatement getMasterVatStatement() { + VatStatement masterVatStatement = null; + JXTreeTable table = view.getVatTreeTable(); + int selectedRow = table.getSelectedRow(); + if (selectedRow != -1) { + TreePath treePath = table.getPathForRow(selectedRow); + MutableTreeTableNode node = (MutableTreeTableNode) treePath.getLastPathComponent(); + masterVatStatement = (VatStatement) node.getUserObject(); + } + return masterVatStatement; + } + + protected VatStatement createOrUpdateVatStatement(VatChartTreeTableModel treeTableModel, VatStatement vatStatement) { + VatStatement persistedVatStatement; + + if (vatStatement.isPersisted()) { + persistedVatStatement = treeTableModel.updateVatStatement(vatStatement); + } else { + persistedVatStatement = treeTableModel.addVatStatement(vatStatement.getMasterVatStatement(), vatStatement); + } + + return persistedVatStatement; + } } 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 1bfb522..91da579 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 @@ -264,6 +264,7 @@ lima.financialStatement.creditAccounts=Account credit list lima.financialStatement.debitAccounts=Account debit list lima.financialStatement.developed=Developped financial statement chart lima.financialStatement.error.alreadyExistFinancialStatement=Failed\! Financial statement %s already exist +lima.financialStatement.error.alreadyUsedVatBox=Failed\! VAT box with name '%s' is already used \! lima.financialStatement.header.add=Add category lima.financialStatement.header.form=Category lima.financialStatement.headerAmount=Calculate amount on header @@ -488,6 +489,7 @@ lima.search=Search lima.structure=Structure lima.table.account=Account lima.table.balance=Balance +lima.table.boxName=PDF box name lima.table.credit=Credit lima.table.date=Date lima.table.debit=Debit 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 54a9304..9ef0f57 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 @@ -274,7 +274,8 @@ lima.financialStatement.check=Vérification des comptes (Ctrl+F) lima.financialStatement.creditAccounts=Au crédit lima.financialStatement.debitAccounts=Au débit lima.financialStatement.developed=Développé -lima.financialStatement.error.alreadyExistFinancialStatement=u00C9chec \: Le mouvement %s exist déjà \! +lima.financialStatement.error.alreadyExistFinancialStatement=Échec \: Le mouvement '%s' existe déjà \! +lima.financialStatement.error.alreadyUsedVatBox=Échec \: Le identifiant de box PDF '%s' est déjà utilisé \! lima.financialStatement.header.add=Ajouter une catégorie (Ctrl+Maj+N) lima.financialStatement.header.form=Catégorie lima.financialStatement.headerAmount=Afficher le total en en-tete @@ -495,6 +496,7 @@ lima.search=Rechercher lima.structure=Structure lima.table.account=Compte lima.table.balance=Solde +lima.table.boxName=Nom de boite PDF lima.table.credit=Crédit lima.table.date=Date lima.table.debit=Débit diff --git a/lima-swing/src/main/resources/import/vat_developed.csv b/lima-swing/src/main/resources/import/vat_developed.csv deleted file mode 100644 index 7fafb1e..0000000 --- a/lima-swing/src/main/resources/import/vat_developed.csv +++ /dev/null @@ -1,56 +0,0 @@ -label;header;accounts;boxName;masterVATStatement -A. MONTANT DES OPERATIONS REALISEES;O;;; -OPERATIONS IMPOSABLES (H.T.);O;;;A. MONTANT DES OPERATIONS REALISEES -Acquisitions intracommunautaires;N;;b4.b4;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -Livraisons de gaz naturel ou d'électricité imposables en France;N;;b5.b5;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -Achats de biens ou de prestations de services réalisées auprès d'un assujetti non établi en France;N;;b6.b6;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -Régularisations (imposables);N;;b7.b7;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -"Ventes, prestations de services";N;;b1.b1;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -B. DECOMPTE DE LA TVA A PAYER;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services" -TVA BRUTE;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER" -Opérations réalisées en France métropolitaine;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -"Taux normal 19,6% (Base hors taxe)";N;;b15.b15;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -"Taux normal 19,6% (Taxe due)";N;;b23.b23;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -"Taux réduit 5,5% (Base hors taxe)";N;;b16.b16;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -"Taux réduit 5,5% (Taxe due)";N;;b24.b24;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -Opérations réalisées dans les DOM;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -"Taux normal 8,5% (Base hors taxe)";N;;b18.b18;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -"Taux normal 8,5% (Taxe due)";N;;b26.b26;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -"Taux réduit 2,1% (Base hors taxe)";N;;b19.b19;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -"Taux réduit 2,1% (Taxe due)";N;;b27.b27;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -Opérations imposables à un autre taux (France métropolitaine ou DOM);O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Ancien taux (Base hors taxe);N;;b21.b21;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -Ancien taux (Taxe due);N;;b29.b29;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -Opérations imposables à un taux particulier (Base hors taxe);N;;b22.b22;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -Opérations imposables à un taux particulier (Taxe due);N;;b30.b30;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -TVA antérieurement déduite à reverser;N;;b31.b31;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Total de le TVA brute due;N;;b32.b32;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Dont TVA sur acquisitions intracommunautaires;N;;b33.b33;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Dont TVA sur opérations à destination de Monaco;N;;b34.b34;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -TVA DEDUCTIBLE;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER" -Biens constituant des immobilisations;N;;b35.b35;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Autres biens et services;N;;b36.b36;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Autre TVA à déduire;N;;b37.b37;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Report du crédit apparaissant ligne 27 de la précédente déclaration;N;;b38.b38;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Total TVA déductible;N;;total1.total1;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Dont TVA non perçue récupérable par les assujettis disposant d'un établissement stable dans les DOM;N;;b39.b39;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Autres opérations imposables;N;;b2.b2;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -CREDIT;O;;;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables -Crédit de TVA;N;;b40.b40;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables/CREDIT -Remboursement demandé sur formulaire n°3519;N;;b41.b41;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables/CREDIT -Crédit à reporter;N;;b42.b42;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables/CREDIT -Achats de prestations de services intracommunautaires;N;;b3.b3;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -TAXE A PAYER;O;;;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires -TVA nette due;N;;b43.b43;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -Taxes assimilées calculées sur annexe n°3310 A;N;;b44.b44;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -"Sommes à imputer, exprimées en euros, y compris acompte congés";N;;b45.b45;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -"Sommes à ajouter, exprimées en euros, y compris acompte congés";N;;b46.b46;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -Total à payer;N;;b47.b47;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -OPERATIONS NON IMPOSABLES;O;;;A. MONTANT DES OPERATIONS REALISEES -Exportations hors CE;N;;b8.b8;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Autres opérations non imposables;N;;b9.b9;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Livraisons intracommunautaires;N;;b10.b10;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Livraisons de gaz naturel ou d'électricité non imposables en France;N;;b11.b11;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Achats de franchise;N;;b12.b12;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Ventes de biens ou prestations de services réalisées aurpès d'un assujetti non établi en France;N;;b13.b13;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Régularisations (non imposables);N;;b14.b14;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES diff --git a/lima-swing/src/main/resources/import/vat_shortened.csv b/lima-swing/src/main/resources/import/vat_shortened.csv deleted file mode 100644 index 7340721..0000000 --- a/lima-swing/src/main/resources/import/vat_shortened.csv +++ /dev/null @@ -1,56 +0,0 @@ -gijava label;header;accounts;boxName;masterVATStatement -A. MONTANT DES OPERATIONS REALISEES;O;;; -OPERATIONS IMPOSABLES (H.T.);O;;;A. MONTANT DES OPERATIONS REALISEES -Acquisitions intracommunautaires;N;;b4.b4;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -Livraisons de gaz naturel ou d'électricité imposables en France;N;;b5.b5;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -Achats de biens ou de prestations de services réalisées auprès d'un assujetti non établi en France;N;;b6.b6;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -Régularisations (imposables);N;;b7.b7;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -"Ventes, prestations de services";N;;b1.b1;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -B. DECOMPTE DE LA TVA A PAYER;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services" -TVA BRUTE;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER" -Opérations réalisées en France métropolitaine;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -"Taux normal 19,6% (Base hors taxe)";N;;b15.b15;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -"Taux normal 19,6% (Taxe due)";N;;b23.b23;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -"Taux réduit 5,5% (Base hors taxe)";N;;b16.b16;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -"Taux réduit 5,5% (Taxe due)";N;;b24.b24;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées en France métropolitaine" -Opérations réalisées dans les DOM;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -"Taux normal 8,5% (Base hors taxe)";N;;b18.b18;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -"Taux normal 8,5% (Taxe due)";N;;b26.b26;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -"Taux réduit 2,1% (Base hors taxe)";N;;b19.b19;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -"Taux réduit 2,1% (Taxe due)";N;;b27.b27;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations réalisées dans les DOM" -Opérations imposables à un autre taux (France métropolitaine ou DOM);O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Ancien taux (Base hors taxe);N;;b21.b21;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -Ancien taux (Taxe due);N;;b29.b29;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -Opérations imposables à un taux particulier (Base hors taxe);N;;b22.b22;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -Opérations imposables à un taux particulier (Taxe due);N;;b30.b30;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE/Opérations imposables à un autre taux (France métropolitaine ou DOM)" -TVA antérieurement déduite à reverser;N;;b31.b31;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Total de le TVA brute due;N;;b32.b32;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Dont TVA sur acquisitions intracommunautaires;N;;b33.b33;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -Dont TVA sur opérations à destination de Monaco;N;;b34.b34;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA BRUTE" -TVA DEDUCTIBLE;O;;;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER" -Biens constituant des immobilisations;N;;b35.b35;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Autres biens et services;N;;b36.b36;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Autre TVA à déduire;N;;b37.b37;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Report du crédit apparaissant ligne 27 de la précédente déclaration;N;;b38.b38;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Total TVA déductible;N;;total1.total1;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Dont TVA non perçue récupérable par les assujettis disposant d'un établissement stable dans les DOM;N;;b39.b39;"A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Ventes, prestations de services/B. DECOMPTE DE LA TVA A PAYER/TVA DEDUCTIBLE" -Autres opérations imposables;N;;b2.b2;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -CREDIT;O;;;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables -Crédit de TVA;N;;b40.b40;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables/CREDIT -Remboursement demandé sur formulaire n°3519;N;;b41.b41;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables/CREDIT -Crédit à reporter;N;;b42.b42;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Autres opérations imposables/CREDIT -Achats de prestations de services intracommunautaires;N;;b3.b3;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.) -TAXE A PAYER;O;;;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires -TVA nette due;N;;b43.b43;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -Taxes assimilées calculées sur annexe n°3310 A;N;;b44.b44;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -"Sommes à imputer, exprimées en euros, y compris acompte congés";N;;b45.b45;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -"Sommes à ajouter, exprimées en euros, y compris acompte congés";N;;b46.b46;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -Total à payer;N;;b47.b47;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS IMPOSABLES (H.T.)/Achats de prestations de services intracommunautaires/TAXE A PAYER -OPERATIONS NON IMPOSABLES;O;;;A. MONTANT DES OPERATIONS REALISEES -Exportations hors CE;N;;b8.b8;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Autres opérations non imposables;N;;b9.b9;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Livraisons intracommunautaires;N;;b10.b10;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Livraisons de gaz naturel ou d'électricité non imposables en France;N;;b11.b11;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Achats de franchise;N;;b12.b12;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Ventes de biens ou prestations de services réalisées aurpès d'un assujetti non établi en France;N;;b13.b13;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -Régularisations (non imposables);N;;b14.b14;A. MONTANT DES OPERATIONS REALISEES/OPERATIONS NON IMPOSABLES -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm