From 2341da9cef5376834f3f350975e68ade8bcb3752 Mon Sep 17 00:00:00 2001 From: yamelsenih Date: Mon, 19 Aug 2024 12:36:21 -0400 Subject: [PATCH 1/4] Soporte Extracto Bancario Bancaribe .csv formato ";" #61 Referencia: https://github.com/adempiere/LVE/issues/61 --- .../lve/bank/imp/Bancaribe_Loader_Ssv.java | 32 +++ .../org/erpya/lve/bank/imp/Bancaribe_Ssv.java | 31 +++ .../org/erpya/lve/bank/imp/Bancaribe_v1.java | 214 ++++++++++++++++++ 3 files changed, 277 insertions(+) create mode 100644 financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Loader_Ssv.java create mode 100644 financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Ssv.java create mode 100644 financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_v1.java diff --git a/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Loader_Ssv.java b/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Loader_Ssv.java new file mode 100644 index 0000000..fd8d86f --- /dev/null +++ b/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Loader_Ssv.java @@ -0,0 +1,32 @@ +/************************************************************************************* + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012-2018 E.R.P. Consultores y Asociados, C.A. * + * Contributor(s): Yamel Senih ysenih@erpya.com * + * 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 . * + ************************************************************************************/ +package org.erpya.lve.bank.imp; + +import org.spin.util.impexp.BankStatementHandler; +import org.spin.util.impexp.BankTransactionAbstract; + +/** + * Bancaribe separado por punto y coma + * @author Yamel Senih, ysenih@erpya.com , http://www.erpya.com + *
  • + * @see https://github.com/adempiere/adempiere/issues/1701 + */ +public final class Bancaribe_Loader_Ssv extends BankStatementHandler { + @Override + protected BankTransactionAbstract getBankTransactionInstance() { + return new Bancaribe_Ssv(); + } +} diff --git a/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Ssv.java b/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Ssv.java new file mode 100644 index 0000000..e7c278c --- /dev/null +++ b/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_Ssv.java @@ -0,0 +1,31 @@ +/************************************************************************************* + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012-2018 E.R.P. Consultores y Asociados, C.A. * + * Contributor(s): Yamel Senih ysenih@erpya.com * + * 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 . * + ************************************************************************************/ +package org.erpya.lve.bank.imp; + +/** + * Formato de Bancaribe separado por punto y coma ";" + * @author Yamel Senih, ysenih@erpya.com , http://www.erpya.com + * @see https://github.com/adempiere/LVE/issues/61 + */ +public class Bancaribe_Ssv extends Bancaribe_v1 { + /** Start Column Index */ + private static final String SEPARATOR = ";"; + + @Override + public String getSeparator() { + return SEPARATOR; + } +} diff --git a/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_v1.java b/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_v1.java new file mode 100644 index 0000000..6c3081c --- /dev/null +++ b/financial/src/main/java/base/org/erpya/lve/bank/imp/Bancaribe_v1.java @@ -0,0 +1,214 @@ +/************************************************************************************* + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012-2018 E.R.P. Consultores y Asociados, C.A. * + * Contributor(s): Yamel Senih ysenih@erpya.com * + * 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 . * + ************************************************************************************/ +package org.erpya.lve.bank.imp; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import org.compiere.util.Env; +import org.compiere.util.Util; +import org.spin.util.impexp.BankTransactionAbstract; + +/** + * Se agrega cargador de extracto genĂ©rico Bancaribe + * @author Yamel Senih, ysenih@erpya.com , http://www.erpya.com + * @see https://github.com/adempiere/LVE/issues/61 + */ +public abstract class Bancaribe_v1 extends BankTransactionAbstract { + /** Value Date [dddMMyyyy] */ + private static final String LINE_TRANSACTION_Date = "TrxDate"; + /** Transaction type Transaction type (description) */ + private static final String LINE_TRANSACTION_Type = "Type"; + /** Memo of transaction */ + private static final String LINE_TRANSACTION_Memo = "Memo"; + /** Concept of transaction */ + private static final String LINE_TRANSACTION_Concept = "Concept"; + /** Sequence number [35x] Sequential number of transaction on account */ + private static final String LINE_TRANSACTION_ReferenceNo = "ReferenceNo"; + /** Amount */ + private static final String LINE_TRANSACTION_Amount = "Amount"; + /** Is a transaction */ + private boolean isTransaction = false; + /** Maximum columns */ + private final int COLUMN_SIZE = 9; + /** Date Column */ + private final int COLUMN_DATE = 0; + /** Reference Column */ + private final int COLUMN_REFERENCE = 1; + /** Concept Column */ + private final int COLUMN_CONCEPT = 2; + /** Type Column */ + private final int COLUMN_TYPE = 3; + /** Debit Column */ + private final int COLUMN_DEBIT = 4; + /** Credit Column */ + private final int COLUMN_CREDIT = 5; + + public abstract String getSeparator(); + + private boolean isValidLine(String[] columns) { + if(columns == null + || columns.length != COLUMN_SIZE) { + return false; + } + return true; + } + + /** + * Parse Line + * @param line + */ + public void parseLine(String line) throws Exception { + if(Util.isEmpty(line)) { + return; + } + // Validate + line = processValue(line); + if(Util.isEmpty(line)) { + return; + } + // Replace bad characters + line = line.replaceAll("\"", ""); + String[] columns = line.split(getSeparator()); + if(!isValidLine(columns)) { + isTransaction = false; + return; + } + // + addValue(LINE_TRANSACTION_Date, getDate("dd/MM/yy", columns[COLUMN_DATE])); + addValue(LINE_TRANSACTION_ReferenceNo, getNumber('.', "#,###,###,###,###,###.##", columns[COLUMN_REFERENCE].replaceAll(",", "").trim())); + addValue(LINE_TRANSACTION_Memo, columns[COLUMN_CONCEPT].replaceAll(",", "").trim()); + String transactionType = columns[COLUMN_TYPE].replaceAll(",", "").trim(); + addValue(LINE_TRANSACTION_Type, transactionType); + BigDecimal debit = getNumber('.', "#,###,###,###,###,###.##", columns[COLUMN_DEBIT].trim()); + if(debit != null + && debit.compareTo(Env.ZERO) > 0) { + addValue(LINE_TRANSACTION_Amount, debit.negate()); + addValue(LINE_TRANSACTION_Type, transactionType); + } + BigDecimal credit = getNumber('.', "#,###,###,###,###,###.##", columns[COLUMN_CREDIT].trim()); + if(credit != null + && credit.compareTo(Env.ZERO) > 0) { + addValue(LINE_TRANSACTION_Amount, credit); + addValue(LINE_TRANSACTION_Type, transactionType); + } + // fine + isTransaction = true; + } + + /** + * Get Bank Transaction Date + * @return + */ + public Timestamp getTrxDate() { + return getDate(LINE_TRANSACTION_Date); + } + + /** + * Get Amount of transaction + * @return + */ + public BigDecimal getAmount() { + return getNumber(LINE_TRANSACTION_Amount); + } + + /** + * Get Payee Account + * @return + */ + public String getPayeeAccountNo() { + return null; + } + + /** + * Get Memo of Transaction + * @return + */ + public String getMemo() { + return getString(LINE_TRANSACTION_Memo); + } + + /** + * Get Category + * @return + */ + public String getTrxType() { + return getString(LINE_TRANSACTION_Type); + } + + /** + * Get Check Numbers + * @return + */ + public String getCheckNo() { + return getString(LINE_TRANSACTION_ReferenceNo); + } + + /** + * Process or change value for import + * you can implement it method for replace special characters + * @param value + * @return + */ + protected String processValue(String value) { + return value; + } + + @Override + public boolean isEndTransactionLine(String line) { + return true; + } + + @Override + public boolean isCompleteData() { + return isTransaction; + } + + @Override + public String getCurrency() { + return null; + } + + @Override + public Timestamp getValueDate() { + return getDate(LINE_TRANSACTION_Date); + } + + @Override + public Timestamp getStatementDate() { + return getDate(LINE_TRANSACTION_Date); + } + + @Override + public String getReferenceNo() { + return getString(LINE_TRANSACTION_ReferenceNo); + } + + @Override + public String getTrxCode() { + return null; + } + + @Override + public String getPayeeName() { + return null; + } + + @Override + public String getPayeeDescription() { + return getString(LINE_TRANSACTION_Concept); + } +} From c2d550f1e64a3f198cdf7c0489dd4850f8799956 Mon Sep 17 00:00:00 2001 From: yamelsenih Date: Mon, 19 Aug 2024 12:47:34 -0400 Subject: [PATCH 2/4] Add github build and publish --- .github/workflows/build_with_gradle.yml | 38 ------------ .github/workflows/ci.yml | 44 ++++++++++++++ .github/workflows/publish.yml | 69 +++++++++++++++++++++ .github/workflows/publish_with_gradle.yml | 38 ------------ build.gradle | 74 +++++++++++++++-------- 5 files changed, 161 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/build_with_gradle.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/publish_with_gradle.yml diff --git a/.github/workflows/build_with_gradle.yml b/.github/workflows/build_with_gradle.yml deleted file mode 100644 index f8013bb..0000000 --- a/.github/workflows/build_with_gradle.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This is a basic workflow to help you get started with Actions -# This file was contributed by Carlos Parada and Yamel Senih from ERP Consultores y Asociados, C.A - -name: ADempiere Build With gradle - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the develop branch - push: - branches: [ "master", "develop", "bugfix/*", "feature/*" ] - pull_request: - branches: [ "master", "develop", "bugfix/*", "feature/*" ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - - # Build dist application backend - build-app: - name: Build with gradle - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: 'adopt-hotspot' - java-version: 11 - - - name: Build with Gradle - run: gradle build - env: - ADEMPIERE_LIBRARY_VERSION: 'test-version' - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_TOKEN }} - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ab98f6f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +# This is a basic workflow to help you get started with Actions +# This file was contributed by Carlos Parada and Yamel Senih from ERP Consultores y Asociados, C.A + +name: Continuous Integration with Gradle + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the develop branch + push: + branches: + - '*' # matches every branch that doesn't contain a '/' + - '*/*' # matches every branch containing a single '/' + - '**' # matches every branch + pull_request: + branches: + - '*' # matches every branch that doesn't contain a '/' + - '*/*' # matches every branch containing a single '/' + - '**' # matches every branch + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + build-ci: + name: Build Project + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up Java JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-package: 'jdk' + java-version: 11 + architecture: x64 + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.0.1 + arguments: build + env: + ADEMPIERE_LIBRARY_VERSION: 'build' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f17bc91 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions +# This file was contributed by Carlos Parada and Yamel Senih from ERP Consultores y Asociados, C.A + +name: Publish With gradle to maven central + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the develop branch + release: + types: + - published + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + publish-sonatype: + name: Publish Project (Sonatype) + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Java JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-package: 'jdk' + java-version: 11 + architecture: x64 + + - name: Build with Gradle + uses: gradle/gradle-build-action@v3 + with: + gradle-version: 8.0.2 + arguments: publish + env: + ORG_GRADLE_PROJECT_deployVersion: ${{ github.event.release.tag_name }} + ORG_GRADLE_PROJECT_deployPublishUrl: ${{ secrets.DEPLOY_PUBLISH_SONATYPE_URL }} + ORG_GRADLE_PROJECT_deploySigningKey: ${{ secrets.PGP_SECRET }} + ORG_GRADLE_PROJECT_deploySigningPassword: ${{ secrets.PGP_PASSPHRASE }} + ORG_GRADLE_PROJECT_deployUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_deployPassword: ${{ secrets.OSSRH_TOKEN }} + publish-github: + name: Publish Project (Github) + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Java JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-package: 'jdk' + java-version: 11 + architecture: x64 + + - name: Build with Gradle + uses: gradle/gradle-build-action@v3 + with: + gradle-version: 8.0.2 + arguments: publish + env: + ORG_GRADLE_PROJECT_deployVersion: ${{ github.event.release.tag_name }} + ORG_GRADLE_PROJECT_deployPublishUrl: ${{ secrets.DEPLOY_PUBLISH_GITHUB_URL }} + ORG_GRADLE_PROJECT_deploySigningKey: ${{ secrets.PGP_SECRET }} + ORG_GRADLE_PROJECT_deploySigningPassword: ${{ secrets.PGP_PASSPHRASE }} + ORG_GRADLE_PROJECT_deployUsername: "${{ github.actor }}" + ORG_GRADLE_PROJECT_deployPassword: "${{ secrets.DEPLOY_TOKEN }}" diff --git a/.github/workflows/publish_with_gradle.yml b/.github/workflows/publish_with_gradle.yml deleted file mode 100644 index cd6a3f8..0000000 --- a/.github/workflows/publish_with_gradle.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This is a basic workflow to help you get started with Actions -# This file was contributed by Carlos Parada and Yamel Senih from ERP Consultores y Asociados, C.A - -name: Publish With gradle to maven central - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the develop branch - release: - types: - - published - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - - # Build dist application backend - build-app: - name: Publish with gradle to maven central - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: 'adopt-hotspot' - java-version: 11 - - - name: Publish with Gradle - run: gradle publish - env: - ADEMPIERE_LIBRARY_VERSION: ${{ github.event.release.tag_name }} - ADEMPIERE_LIBRARY_GROUP: ${{ secrets.ADEMPIERE_LIBRARY_GROUP }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_TOKEN }} - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} diff --git a/build.gradle b/build.gradle index d046684..93e448c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,12 @@ -apply plugin: 'java-library' -apply plugin: 'maven-publish' -apply plugin: 'signing' +plugins { + id 'java-library' + id 'maven-publish' + id 'signing' +} +sourceCompatibility = 1.11 +def baseVersion = '3.9.4' +def baseGroupId = 'io.github.adempiere' repositories { mavenLocal() @@ -15,26 +20,22 @@ allprojects { sourceCompatibility = 1.11 targetCompatibility = 1.11 -def baseVersion = '3.9.4' -def baseGroupId = 'io.github.adempiere' -def customGroupId = System.getenv("ADEMPIERE_LIBRARY_GROUP") - dependencies { - implementation fileTree( + api fileTree( dir: 'lib', include: [ '*.jar' ] ) // ADempiere Core - implementation "${baseGroupId}:human-resource-and-payroll:${baseVersion}" - implementation "${baseGroupId}:store:${baseVersion}" + api "${baseGroupId}:human-resource-and-payroll:${baseVersion}" + api "${baseGroupId}:store:${baseVersion}" // https://search.maven.org/artifact/javax.mail/javax.mail-api/1.6.2/jar - implementation 'javax.mail:javax.mail-api:1.6.2' + api 'javax.mail:javax.mail-api:1.6.2' // http://xml.apache.org/commons/#external - implementation 'xml-apis:xml-apis:2.0.2' - implementation "${baseGroupId}:withholding-engine:adempiere-3.9.4-1.3.2" - implementation 'io.vavr:vavr:0.10.4' + api 'xml-apis:xml-apis:2.0.2' + api "${baseGroupId}:withholding-engine:adempiere-3.9.4-1.3.2" + api 'io.vavr:vavr:0.10.4' } sourceSets { @@ -50,8 +51,10 @@ java { withSourcesJar() } + def entityType = 'LVE' -version = System.getenv("ADEMPIERE_LIBRARY_VERSION") ?: "local-1.0.0" +group = "io.github.adempiere" +version = findProperty("deployVersion") ?: "local-1.0.0" jar { manifest { @@ -63,19 +66,21 @@ jar { publishing { repositories { + mavenLocal() + maven { - url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + url = findProperty("deployPublishUrl") ?: System.properties['deploy.publish_url'] credentials { - username = findProperty("sonatypeUsername") - password = findProperty("sonatypePassword") + username = findProperty("deployUsername") ?: System.properties['deploy.user'] + password = findProperty("deployPassword") ?: System.properties['deploy.token'] } } } publications { mavenJava(MavenPublication) { - groupId 'io.github.adempiere' - artifactId 'location-venezuela' - version + groupId = group + artifactId = 'location-venezuela' + version = version from components.java pom { name = 'ADempiere Venezuela Location' @@ -95,18 +100,35 @@ publishing { } } scm { - connection = 'scm:git:git://github.com/adempiere/LVE.git' - developerConnection = 'scm:git:ssh://github.com/adempiere/LVE.git' - url = 'http://github.com/adempiere/LVE' + connection = 'scm:git:git://github.com/adempiere/adempiere-s3-connector.git' + developerConnection = 'scm:git:ssh://github.com/adempiere/adempiere-s3-connector.git' + url = 'http://github.com/adempiere/adempiere-s3-connector' } } } } } + +task cleanBuildPublishLocal(type: GradleBuild) { + tasks = ['clean', 'build', 'publishToMavenLocal'] +} + + signing { - def signingKey = findProperty("signingKey") - def signingPassword = findProperty("signingPassword") + def isReleaseVersion = !version.toString().startsWith("local") && !version.toString().endsWith("-SNAPSHOT") + + sign configurations.archives + + setRequired { + // signing is required if this is a release version and the artifacts are to be published + // do not use hasTask() as this require realization of the tasks that maybe are not necessary + (isReleaseVersion || version.toString().equals("build")) && gradle.taskGraph.allTasks.any { + it.equals(PublishToMavenRepository) + } + } + def signingKey = findProperty("deploySigningKey") + def signingPassword = findProperty("deploySigningPassword") useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.mavenJava } From 4a1954691a4027897db7f813f3b02cc9284b59aa Mon Sep 17 00:00:00 2001 From: yamelsenih Date: Mon, 19 Aug 2024 16:34:58 -0400 Subject: [PATCH 3/4] =?UTF-8?q?Se=20agrega=20soporte=20para=20la=20moneda?= =?UTF-8?q?=20fiscal=20en=20la=20informaci=C3=B3n=20de=20organizaci=C3=B3n?= =?UTF-8?q?=20para=20que=20se=20pueda=20tomar=20la=20referencia=20de=20la?= =?UTF-8?q?=20moneda=20de=20c=C3=A1lculo=20en=20las=20retenciones=20de=20I?= =?UTF-8?q?SLR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lve/model/FinancialBigTransactionTax.java | 14 +++++++++++++- .../erpya/lve/process/ProcessPaymentForFBTT.java | 13 ++++++++++++- .../base/org/erpya/lve/util/APInvoiceISLR.java | 7 ++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/financial/src/main/java/base/org/erpya/lve/model/FinancialBigTransactionTax.java b/financial/src/main/java/base/org/erpya/lve/model/FinancialBigTransactionTax.java index ceebd59..bb60afd 100644 --- a/financial/src/main/java/base/org/erpya/lve/model/FinancialBigTransactionTax.java +++ b/financial/src/main/java/base/org/erpya/lve/model/FinancialBigTransactionTax.java @@ -17,6 +17,7 @@ import java.math.BigDecimal; import java.math.MathContext; +import java.util.Properties; import org.adempiere.core.domains.models.I_C_Payment; import org.compiere.model.MBPartner; @@ -24,6 +25,7 @@ import org.compiere.model.MBankAccount; import org.compiere.model.MClient; import org.compiere.model.MClientInfo; +import org.compiere.model.MOrgInfo; import org.compiere.model.MPayment; import org.compiere.model.ModelValidationEngine; import org.compiere.model.ModelValidator; @@ -33,6 +35,7 @@ import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.erpya.lve.util.LVEUtil; /** * Class added from standard values @@ -95,6 +98,15 @@ public String modelChange(PO po, int type) throws Exception { return null; } + private int getDefaultcurrencyId(Properties context, int organizationId) { + MOrgInfo info = MOrgInfo.get(context, organizationId, null); + int currencyId = info.get_ValueAsInt(LVEUtil.COLUMNNAME_LVE_FiscalCurrency_ID); + if(currencyId <= 0) { + currencyId = MClient.get(context).getC_Currency_ID(); + } + return currencyId; + } + /** * Process source payment * @param sourcePayment @@ -120,7 +132,7 @@ private String createFBTTForPayment(MPayment sourcePayment) { return null; } // Validate currency - int defaultCurrencyId = MClient.get(sourcePayment.getCtx()).getC_Currency_ID(); + int defaultCurrencyId = getDefaultcurrencyId(sourcePayment.getCtx(), sourcePayment.getAD_Org_ID()); MBankAccount bankAccount = MBankAccount.get(sourcePayment.getCtx(), sourcePayment.getC_BankAccount_ID()); if(bankAccount == null) { return null; diff --git a/financial/src/main/java/base/org/erpya/lve/process/ProcessPaymentForFBTT.java b/financial/src/main/java/base/org/erpya/lve/process/ProcessPaymentForFBTT.java index bcbf120..5fa915f 100644 --- a/financial/src/main/java/base/org/erpya/lve/process/ProcessPaymentForFBTT.java +++ b/financial/src/main/java/base/org/erpya/lve/process/ProcessPaymentForFBTT.java @@ -24,6 +24,7 @@ import org.compiere.model.MClient; import org.compiere.model.MClientInfo; import org.compiere.model.MDocType; +import org.compiere.model.MOrgInfo; import org.compiere.model.MPayment; import org.compiere.model.MSequence; import org.compiere.model.PO; @@ -33,6 +34,7 @@ import org.erpya.lve.model.I_LVE_List; import org.erpya.lve.model.I_LVE_ListLine; import org.erpya.lve.model.MLVEList; +import org.erpya.lve.util.LVEUtil; /** * Process for generate FBTT from unprocessed payments @@ -50,6 +52,15 @@ protected void prepare() { super.prepare(); } + private int getDefaultcurrencyId(int organizationId) { + MOrgInfo info = MOrgInfo.get(getCtx(), organizationId, null); + int currencyId = info.get_ValueAsInt(LVEUtil.COLUMNNAME_LVE_FiscalCurrency_ID); + if(currencyId <= 0) { + currencyId = MClient.get(getCtx()).getC_Currency_ID(); + } + return currencyId; + } + @Override protected String doIt() { // Iterate @@ -58,7 +69,6 @@ protected String doIt() { BigDecimal sourcePayAmt = Env.ZERO; MPayment fbttPayment = new MPayment(getCtx(), 0, get_TrxName()); // Validate currency - int defaultCurrencyId = MClient.get(getCtx()).getC_Currency_ID(); for(int key : getSelectionKeys()) { MPayment sourcePayment = new MPayment(getCtx(), key, get_TrxName()); // Validate FBTT reversed @@ -82,6 +92,7 @@ protected String doIt() { // Validate Account bankAccountId = sourcePayment.getC_BankAccount_ID(); MBankAccount bankAccount = MBankAccount.get(getCtx(), bankAccountId); + int defaultCurrencyId = getDefaultcurrencyId(sourcePayment.getAD_Org_ID()); // Verify currency if(bankAccount.getC_Currency_ID() != defaultCurrencyId) { continue; diff --git a/withholding/src/main/java/base/org/erpya/lve/util/APInvoiceISLR.java b/withholding/src/main/java/base/org/erpya/lve/util/APInvoiceISLR.java index 4264392..5c7d472 100644 --- a/withholding/src/main/java/base/org/erpya/lve/util/APInvoiceISLR.java +++ b/withholding/src/main/java/base/org/erpya/lve/util/APInvoiceISLR.java @@ -401,8 +401,13 @@ class WHConceptSetting{ * @param amtBase */ public WHConceptSetting(MInvoice invoice,BigDecimal amtBase) { + MOrgInfo info = MOrgInfo.get(invoice.getCtx(), invoice.getAD_Org_ID(), null); + int currencyId = info.get_ValueAsInt(LVEUtil.COLUMNNAME_LVE_FiscalCurrency_ID); + if(currencyId <= 0) { + currencyId = MClient.get(invoice.getCtx()).getC_Currency_ID(); + } currencyRate = MConversionRate.getRate(invoice.getC_Currency_ID(), - MClient.get(invoice.getCtx()).getC_Currency_ID(), + currencyId, invoice.getDateAcct(), invoice.getC_ConversionType_ID(), invoice.getAD_Client_ID(), From b58ceca5ce6bf578fabbb9f1d564ccbfc2364b27 Mon Sep 17 00:00:00 2001 From: yamelsenih Date: Mon, 19 Aug 2024 16:43:38 -0400 Subject: [PATCH 4/4] change source project --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 93e448c..470c94f 100644 --- a/build.gradle +++ b/build.gradle @@ -100,9 +100,9 @@ publishing { } } scm { - connection = 'scm:git:git://github.com/adempiere/adempiere-s3-connector.git' - developerConnection = 'scm:git:ssh://github.com/adempiere/adempiere-s3-connector.git' - url = 'http://github.com/adempiere/adempiere-s3-connector' + connection = 'scm:git:git://github.com/adempiere/lve.git' + developerConnection = 'scm:git:ssh://github.com/adempiere/lve.git' + url = 'http://github.com/adempiere/lve' } } }