First commit (wating to add alerts in budget)
This commit is contained in:
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
./init-db
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -47,3 +47,8 @@ hs_err_pid*
|
|||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
src/main/resources/application.properties
|
src/main/resources/application.properties
|
||||||
|
src/main/resources/application.properties
|
||||||
|
src/main/resources/application.properties
|
||||||
|
init-db/bdd_sophal202506281027.sql
|
||||||
|
modules/axelor-open-suite/axelor-account/src/test/resources/META-INF/persistence.xml
|
||||||
|
modules/axelor-open-suite/axelor-supplychain/src/test/java/com/axelor/apps/supplychain/db/StockMove.java
|
||||||
|
|||||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM openjdk:8-jdk-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dos2unix for line-ending fixes
|
||||||
|
RUN apk add --no-cache bash dos2unix
|
||||||
|
|
||||||
|
# Copy everything
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Fix line endings for gradlew
|
||||||
|
RUN dos2unix ./gradlew && chmod +x ./gradlew
|
||||||
|
|
||||||
|
# Clean and run the Gradle app
|
||||||
|
CMD ["./gradlew", "clean", "run", "--no-daemon"]
|
||||||
|
|
||||||
|
|
||||||
32
build.gradle
32
build.gradle
@@ -3,8 +3,15 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url 'https://plugins.gradle.org/m2/' }
|
maven {
|
||||||
maven { url 'https://repository.axelor.com/nexus/public/' }
|
url 'https://plugins.gradle.org/m2/'
|
||||||
|
metadataSources {
|
||||||
|
artifact()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url 'https://repository.axelor.com/nexus/public/'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ext.openPlatformVersion = '5.2.2'
|
ext.openPlatformVersion = '5.2.2'
|
||||||
ext.appVersion = '5.2.1'
|
ext.appVersion = '5.2.1'
|
||||||
@@ -55,7 +62,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wrapper {
|
wrapper {
|
||||||
gradleVersion = "4.4.1"
|
gradleVersion = "4.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
task("dataImport", type: JavaExec) {
|
task("dataImport", type: JavaExec) {
|
||||||
@@ -80,4 +87,23 @@ task archiveReports(type: Zip) {
|
|||||||
destinationDir = file("$buildDir/libs")
|
destinationDir = file("$buildDir/libs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
war {
|
||||||
|
destinationDir = file("C:/apache-tomcat-8.5.0/webapps")
|
||||||
|
archiveName = "sophal2.war"
|
||||||
|
}
|
||||||
|
|
||||||
|
task stopTomcat(type: Exec) {
|
||||||
|
dependsOn stopTomcat
|
||||||
|
workingDir 'C:/apache-tomcat-8.5.0/bin'
|
||||||
|
commandLine 'cmd', '/c', 'shutdown.bat'
|
||||||
|
}
|
||||||
|
|
||||||
|
task startTomcat(type: Exec) {
|
||||||
|
dependsOn war
|
||||||
|
workingDir 'C:/apache-tomcat-8.5.0/bin'
|
||||||
|
commandLine 'cmd', '/c', 'startup.bat'
|
||||||
|
// commandLine 'cmd', '/c', 'start', '/b', 'startup.bat'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
build.finalizedBy archiveReports
|
build.finalizedBy archiveReports
|
||||||
|
|||||||
51
docker-compose.yml
Normal file
51
docker-compose.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
environment:
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_NAME=bdd_sophal
|
||||||
|
- DB_USER=postgres
|
||||||
|
- DB_PASSWORD=root
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:9.6
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: bdd_sophal
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: root
|
||||||
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
|
ports:
|
||||||
|
- "5433:5432"
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
- ./init-db:/docker-entrypoint-initdb.d
|
||||||
|
|
||||||
|
|
||||||
|
pgadmin:
|
||||||
|
image: dpage/pgadmin4
|
||||||
|
environment:
|
||||||
|
PGADMIN_DEFAULT_EMAIL: admin@admin.com
|
||||||
|
PGADMIN_DEFAULT_PASSWORD: admin
|
||||||
|
ports:
|
||||||
|
- "5050:80"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
backend:
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ dependencies {
|
|||||||
compile project(":modules:axelor-purchase")
|
compile project(":modules:axelor-purchase")
|
||||||
compile 'xalan:xalan:2.7.2'
|
compile 'xalan:xalan:2.7.2'
|
||||||
|
|
||||||
|
testImplementation 'org.mockito:mockito-core:4.8.0' // Or latest version
|
||||||
|
|
||||||
|
|
||||||
compile group: 'jdom', name: 'jdom', version: '1.1'
|
compile group: 'jdom', name: 'jdom', version: '1.1'
|
||||||
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.5.0'
|
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.5.0'
|
||||||
compile "org.bouncycastle:bcprov-jdk15on:1.62"
|
compile "org.bouncycastle:bcprov-jdk15on:1.62"
|
||||||
|
|||||||
@@ -797,4 +797,8 @@ public interface IExceptionMessage {
|
|||||||
|
|
||||||
static final String CLOSE_NO_REPORTED_BALANCE_DATE = /*$$(*/
|
static final String CLOSE_NO_REPORTED_BALANCE_DATE = /*$$(*/
|
||||||
"Please set a reported balance date on fiscal year" /*)*/;
|
"Please set a reported balance date on fiscal year" /*)*/;
|
||||||
|
|
||||||
|
|
||||||
|
String CASH_INVENTORY_MISSING_SEQUENCE = /*$$(*/
|
||||||
|
"There is no configured sequence for cash inventory" /*)*/;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
package com.axelor.apps.account.service;
|
package com.axelor.apps.account.service;
|
||||||
|
|
||||||
|
import com.axelor.apps.account.db.CashInventory;
|
||||||
|
import com.axelor.apps.account.db.CashInventoryLine;
|
||||||
|
import com.axelor.apps.account.db.CashRegister;
|
||||||
|
import com.axelor.apps.account.db.repo.CashDenominationRepository;
|
||||||
|
import com.axelor.apps.account.db.repo.CashInventoryRepository;
|
||||||
|
import com.axelor.apps.account.db.repo.CashRegisterRepository;
|
||||||
|
import com.axelor.apps.account.exception.IExceptionMessage;
|
||||||
|
import com.axelor.apps.base.db.Company;
|
||||||
|
import com.axelor.apps.base.service.administration.SequenceService;
|
||||||
|
import com.axelor.auth.AuthUtils;
|
||||||
|
import com.axelor.exception.AxelorException;
|
||||||
|
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||||
|
import com.axelor.i18n.I18n;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.persist.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -7,32 +23,40 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.axelor.apps.account.db.CashDenomination;
|
|
||||||
import com.axelor.apps.account.db.CashInventory;
|
|
||||||
import com.axelor.apps.account.db.CashInventoryLine;
|
|
||||||
import com.axelor.apps.account.db.repo.CashDenominationRepository;
|
|
||||||
import com.axelor.apps.account.db.repo.CashInventoryRepository;
|
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
import com.google.inject.persist.Transactional;
|
|
||||||
|
|
||||||
public class CashInventoryService {
|
public class CashInventoryService {
|
||||||
|
|
||||||
@Transactional
|
private SequenceService sequenceService;
|
||||||
public void initThetoricalSoldeInWords(CashInventory cashInventory) {
|
|
||||||
CashInventoryRepository cashInventoryRepository = Beans.get(CashInventoryRepository.class);
|
@Inject
|
||||||
CashInventory lastCashInventory = cashInventoryRepository.all().order("-createdOn").fetchOne();
|
public CashInventoryService(SequenceService sequenceService) {
|
||||||
|
this.sequenceService = sequenceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the theorical solde in words for a new cash inventory.
|
||||||
|
*
|
||||||
|
* @return the theorical solde in words as a BigDecimal
|
||||||
|
*/
|
||||||
|
public BigDecimal initThetoricalSolde() {
|
||||||
|
CashRegisterRepository casRegisterRepository = Beans.get(CashRegisterRepository.class);
|
||||||
|
CashRegister cashRegister = casRegisterRepository.all().order("-createdOn").fetchOne();
|
||||||
BigDecimal theoricalSolde = BigDecimal.ZERO;
|
BigDecimal theoricalSolde = BigDecimal.ZERO;
|
||||||
if(lastCashInventory == null){
|
if (cashRegister == null) {
|
||||||
theoricalSolde = BigDecimal.ZERO;
|
theoricalSolde = BigDecimal.ZERO;
|
||||||
} else {
|
} else {
|
||||||
theoricalSolde = lastCashInventory.getTheoricalSolde();
|
theoricalSolde = cashRegister.getTheoricalSolde();
|
||||||
}
|
}
|
||||||
cashInventory.setTheoricalSolde(theoricalSolde);
|
return theoricalSolde;
|
||||||
cashInventory.setRealDate(LocalDateTime.now());
|
|
||||||
cashInventoryRepository.save(cashInventory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the totals for the cash inventory, including total bank notes, total
|
||||||
|
* coins, physical
|
||||||
|
* solde, and gap.
|
||||||
|
*
|
||||||
|
* @param cashInventory The cash inventory to compute totals for.
|
||||||
|
* @return A map containing the computed totals.
|
||||||
|
*/
|
||||||
public Map<String, BigDecimal> computeToTals(CashInventory cashInventory) {
|
public Map<String, BigDecimal> computeToTals(CashInventory cashInventory) {
|
||||||
|
|
||||||
HashMap<String, BigDecimal> map = new HashMap<>();
|
HashMap<String, BigDecimal> map = new HashMap<>();
|
||||||
@@ -72,10 +96,55 @@ public class CashInventoryService {
|
|||||||
map.put("gap", gap);
|
map.put("gap", gap);
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCashInventorySequence(CashInventory cashInventory) throws AxelorException {
|
||||||
|
Integer operationTypeSelect = cashInventory.getOperationTypeSelect();
|
||||||
|
Company company = cashInventory.getCompany();
|
||||||
|
String sequence = null;
|
||||||
|
|
||||||
|
if (operationTypeSelect != null) {
|
||||||
|
switch (operationTypeSelect) {
|
||||||
|
case 1: // Cash inventory daily
|
||||||
|
sequence = "CASH_INVENTORY_DAILY";
|
||||||
|
break;
|
||||||
|
case 2: // Cash inventory monthly
|
||||||
|
sequence = "CASH_INVENTORY_MONTHLY";
|
||||||
|
break;
|
||||||
|
case 3: // Cash inventory annual
|
||||||
|
sequence = "CASH_INVENTORY_ANNUAL";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sequence = "CASH_INVENTORY";
|
||||||
|
// Default case for other operation types
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sequence = "CASH_INVENTORY";
|
||||||
|
}
|
||||||
|
|
||||||
|
String ref = sequenceService.getSequenceNumber(sequence, company);
|
||||||
|
if (ref == null) {
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
||||||
|
I18n.get(IExceptionMessage.CASH_INVENTORY_MISSING_SEQUENCE),
|
||||||
|
company.getName());
|
||||||
|
} else {
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void approveCashInventory(CashInventory cashInventory) {
|
||||||
|
CashRegisterRepository casRegisterRepository = Beans.get(CashRegisterRepository.class);
|
||||||
|
CashRegister cashRegister = casRegisterRepository.all().order("-createdOn").fetchOne();
|
||||||
|
// cashRegister.setTheoricalSolde(cashInventory.getPhysicalSolde());
|
||||||
|
cashRegister.setPhysicalSolde(cashInventory.getPhysicalSolde());
|
||||||
|
cashInventory.setValdiatedByUser(AuthUtils.getUser());
|
||||||
|
cashInventory.setValidattionDate(LocalDateTime.now());
|
||||||
|
cashInventory.setStatusSelect(3);
|
||||||
|
Beans.get(CashInventoryRepository.class).save(cashInventory);
|
||||||
|
casRegisterRepository.save(cashRegister);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
package com.axelor.apps.account.service;
|
package com.axelor.apps.account.service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.http.annotation.Contract;
|
|
||||||
|
|
||||||
import com.axelor.apps.account.db.Invoice;
|
import com.axelor.apps.account.db.Invoice;
|
||||||
import com.axelor.apps.account.db.InvoiceLine;
|
import com.axelor.apps.account.db.InvoiceLine;
|
||||||
import com.axelor.apps.account.db.InvoiceTemplate;
|
import com.axelor.apps.account.db.InvoiceTemplate;
|
||||||
@@ -16,17 +10,18 @@ import com.axelor.apps.account.service.invoice.generator.InvoiceLineGenerator;
|
|||||||
import com.axelor.apps.base.db.Company;
|
import com.axelor.apps.base.db.Company;
|
||||||
import com.axelor.apps.base.db.Partner;
|
import com.axelor.apps.base.db.Partner;
|
||||||
import com.axelor.apps.base.db.Product;
|
import com.axelor.apps.base.db.Product;
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.rpc.ActionRequest;
|
|
||||||
import com.axelor.rpc.ActionResponse;
|
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class InvoiceTemplateService {
|
public class InvoiceTemplateService {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Invoice generateInvoiceFromTemplate(InvoiceTemplate invoiceTemplate) throws AxelorException {
|
public Invoice generateInvoiceFromTemplate(InvoiceTemplate invoiceTemplate)
|
||||||
|
throws AxelorException {
|
||||||
|
|
||||||
Partner partner = invoiceTemplate.getPartner();
|
Partner partner = invoiceTemplate.getPartner();
|
||||||
Company company = invoiceTemplate.getCompany();
|
Company company = invoiceTemplate.getCompany();
|
||||||
@@ -56,7 +51,6 @@ public class InvoiceTemplateService {
|
|||||||
|
|
||||||
List<InvoiceLine> invoiceLineList = new ArrayList<>();
|
List<InvoiceLine> invoiceLineList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
Invoice invoice = invoiceGenerator.generate();
|
Invoice invoice = invoiceGenerator.generate();
|
||||||
|
|
||||||
int priority = 0;
|
int priority = 0;
|
||||||
@@ -69,13 +63,11 @@ public class InvoiceTemplateService {
|
|||||||
Invoice returnInvoiced = Beans.get(InvoiceRepository.class).save(invoice);
|
Invoice returnInvoiced = Beans.get(InvoiceRepository.class).save(invoice);
|
||||||
|
|
||||||
return returnInvoiced;
|
return returnInvoiced;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected List<InvoiceLine> createInvoiceLine(
|
protected List<InvoiceLine> createInvoiceLine(
|
||||||
Invoice invoice, InvoiceTemplateLine invoiceTemplateLine, int priority) throws AxelorException {
|
Invoice invoice, InvoiceTemplateLine invoiceTemplateLine, int priority)
|
||||||
|
throws AxelorException {
|
||||||
|
|
||||||
Product product = invoiceTemplateLine.getProduct();
|
Product product = invoiceTemplateLine.getProduct();
|
||||||
|
|
||||||
@@ -117,7 +109,4 @@ public class InvoiceTemplateService {
|
|||||||
|
|
||||||
return invoiceLineGenerator.creates();
|
return invoiceLineGenerator.creates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ public interface ReconcileService {
|
|||||||
public Reconcile confirmReconcile(Reconcile reconcile, boolean updateInvoicePayments)
|
public Reconcile confirmReconcile(Reconcile reconcile, boolean updateInvoicePayments)
|
||||||
throws AxelorException;
|
throws AxelorException;
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public Reconcile confirmPaymentVoucherReconcile(
|
||||||
|
Reconcile reconcile, boolean updateInvoicePayments) throws AxelorException;
|
||||||
|
|
||||||
public void reconcilePreconditions(Reconcile reconcile) throws AxelorException;
|
public void reconcilePreconditions(Reconcile reconcile) throws AxelorException;
|
||||||
|
|
||||||
public void updatePartnerAccountingSituation(Reconcile reconcile) throws AxelorException;
|
public void updatePartnerAccountingSituation(Reconcile reconcile) throws AxelorException;
|
||||||
|
|||||||
@@ -430,6 +430,30 @@ public class ReconcileServiceImpl implements ReconcileService {
|
|||||||
Beans.get(ReconcileGroupService.class).remove(reconcile);
|
Beans.get(ReconcileGroupService.class).remove(reconcile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void unreconcile2(Reconcile reconcile) throws AxelorException {
|
||||||
|
|
||||||
|
log.debug("unreconcile : reconcile : {}", reconcile);
|
||||||
|
|
||||||
|
MoveLine debitMoveLine = reconcile.getDebitMoveLine();
|
||||||
|
MoveLine creditMoveLine = reconcile.getCreditMoveLine();
|
||||||
|
|
||||||
|
// Change the state
|
||||||
|
reconcile.setStatusSelect(ReconcileRepository.STATUS_CANCELED);
|
||||||
|
// Add the reconciled amount to the reconciled amount in the move line
|
||||||
|
creditMoveLine.setAmountPaid(creditMoveLine.getAmountPaid().subtract(reconcile.getAmount()));
|
||||||
|
debitMoveLine.setAmountPaid(debitMoveLine.getAmountPaid().subtract(reconcile.getAmount()));
|
||||||
|
reconcileRepository.save(reconcile);
|
||||||
|
|
||||||
|
// Update amount remaining on invoice or refund
|
||||||
|
this.updatePartnerAccountingSituation(reconcile);
|
||||||
|
this.updateInvoiceCompanyInTaxTotalRemaining(reconcile);
|
||||||
|
this.updateInvoicePaymentsCanceled(reconcile);
|
||||||
|
this.reverseTaxPaymentMoveLines(reconcile);
|
||||||
|
// Update reconcile group
|
||||||
|
// Beans.get(ReconcileGroupService.class).remove(reconcile);
|
||||||
|
}
|
||||||
|
|
||||||
protected void reverseTaxPaymentMoveLines(Reconcile reconcile) throws AxelorException {
|
protected void reverseTaxPaymentMoveLines(Reconcile reconcile) throws AxelorException {
|
||||||
Move debitMove = reconcile.getDebitMoveLine().getMove();
|
Move debitMove = reconcile.getDebitMoveLine().getMove();
|
||||||
Move creditMove = reconcile.getCreditMoveLine().getMove();
|
Move creditMove = reconcile.getCreditMoveLine().getMove();
|
||||||
@@ -556,4 +580,41 @@ public class ReconcileServiceImpl implements ReconcileService {
|
|||||||
}
|
}
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Reconcile confirmPaymentVoucherReconcile(
|
||||||
|
Reconcile reconcile, boolean updateInvoicePayments) throws AxelorException {
|
||||||
|
this.reconcilePreconditions(reconcile);
|
||||||
|
|
||||||
|
MoveLine debitMoveLine = reconcile.getDebitMoveLine();
|
||||||
|
MoveLine creditMoveLine = reconcile.getCreditMoveLine();
|
||||||
|
|
||||||
|
// Add the reconciled amount to the reconciled amount in the move line
|
||||||
|
creditMoveLine.setAmountPaid(creditMoveLine.getAmountPaid().add(reconcile.getAmount()));
|
||||||
|
debitMoveLine.setAmountPaid(debitMoveLine.getAmountPaid().add(reconcile.getAmount()));
|
||||||
|
|
||||||
|
reconcile = reconcileRepository.save(reconcile);
|
||||||
|
|
||||||
|
reconcile.setStatusSelect(ReconcileRepository.STATUS_CONFIRMED);
|
||||||
|
|
||||||
|
if (reconcile.getCanBeZeroBalanceOk()) {
|
||||||
|
// Alors nous utilisons la règle de gestion consitant à imputer l'écart sur un compte
|
||||||
|
// transitoire si le seuil est respecté
|
||||||
|
canBeZeroBalance(reconcile);
|
||||||
|
}
|
||||||
|
|
||||||
|
reconcile.setReconciliationDate(LocalDate.now());
|
||||||
|
|
||||||
|
reconcileSequenceService.setSequence(reconcile);
|
||||||
|
|
||||||
|
this.updatePartnerAccountingSituation(reconcile);
|
||||||
|
this.updateInvoiceCompanyInTaxTotalRemaining(reconcile);
|
||||||
|
this.udpatePaymentTax(reconcile);
|
||||||
|
if (updateInvoicePayments) {
|
||||||
|
this.updateInvoicePayments(reconcile);
|
||||||
|
}
|
||||||
|
this.addToReconcileGroup(reconcile);
|
||||||
|
|
||||||
|
return reconcileRepository.save(reconcile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,11 +486,13 @@ public class MoveLineService {
|
|||||||
moveLineId++,
|
moveLineId++,
|
||||||
origin,
|
origin,
|
||||||
invoiceLine.getProductName());
|
invoiceLine.getProductName());
|
||||||
|
if(invoiceLine.getAnalyticDistributionTemplate() != null)
|
||||||
moveLine.setAnalyticDistributionTemplate(invoiceLine.getAnalyticDistributionTemplate());
|
moveLine.setAnalyticDistributionTemplate(invoiceLine.getAnalyticDistributionTemplate());
|
||||||
if (invoiceLine.getAnalyticMoveLineList() != null
|
if (invoiceLine.getAnalyticMoveLineList() != null
|
||||||
&& !invoiceLine.getAnalyticMoveLineList().isEmpty()) {
|
&& !invoiceLine.getAnalyticMoveLineList().isEmpty()) {
|
||||||
for (AnalyticMoveLine invoiceAnalyticMoveLine : invoiceLine.getAnalyticMoveLineList()) {
|
for (AnalyticMoveLine invoiceAnalyticMoveLine : invoiceLine.getAnalyticMoveLineList()) {
|
||||||
|
System.out.println("-----------------invoiceAnalyticMoveLine.getAccount().getName()----------------------------");
|
||||||
|
System.out.println(invoiceAnalyticMoveLine.getAccount());
|
||||||
AnalyticMoveLine analyticMoveLine =
|
AnalyticMoveLine analyticMoveLine =
|
||||||
analyticMoveLineRepository.copy(invoiceAnalyticMoveLine, false);
|
analyticMoveLineRepository.copy(invoiceAnalyticMoveLine, false);
|
||||||
analyticMoveLine.setTypeSelect(AnalyticMoveLineRepository.STATUS_REAL_ACCOUNTING);
|
analyticMoveLine.setTypeSelect(AnalyticMoveLineRepository.STATUS_REAL_ACCOUNTING);
|
||||||
|
|||||||
@@ -185,11 +185,20 @@ public class MoveServiceImpl implements MoveService {
|
|||||||
isPurchase,
|
isPurchase,
|
||||||
isDebitCustomer));
|
isDebitCustomer));
|
||||||
|
|
||||||
|
log.debug("Saving account move..............");
|
||||||
|
|
||||||
moveRepository.save(move);
|
moveRepository.save(move);
|
||||||
|
|
||||||
|
log.debug("saved account move..............");
|
||||||
|
|
||||||
|
|
||||||
invoice.setMove(move);
|
invoice.setMove(move);
|
||||||
|
|
||||||
invoice.setCompanyInTaxTotalRemaining(moveToolService.getInTaxTotalRemaining(invoice));
|
invoice.setCompanyInTaxTotalRemaining(moveToolService.getInTaxTotalRemaining(invoice));
|
||||||
|
|
||||||
|
log.debug("loading account move.............. {}",move);
|
||||||
|
|
||||||
|
|
||||||
moveValidateService.validate(move);
|
moveValidateService.validate(move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,9 @@ public class PaymentServiceImpl implements PaymentService {
|
|||||||
log.debug(
|
log.debug(
|
||||||
"Emploie du trop perçu : ligne en crédit (restant à payer): {})",
|
"Emploie du trop perçu : ligne en crédit (restant à payer): {})",
|
||||||
creditMoveLine.getAmountRemaining());
|
creditMoveLine.getAmountRemaining());
|
||||||
creditTotalRemaining = creditTotalRemaining.add(creditMoveLine.getAmountRemaining().setScale(2,BigDecimal.ROUND_HALF_EVEN));
|
creditTotalRemaining =
|
||||||
|
creditTotalRemaining.add(
|
||||||
|
creditMoveLine.getAmountRemaining().setScale(2, BigDecimal.ROUND_HALF_EVEN));
|
||||||
}
|
}
|
||||||
for (MoveLine debitMoveLine : debitMoveLines) {
|
for (MoveLine debitMoveLine : debitMoveLines) {
|
||||||
|
|
||||||
@@ -136,7 +138,9 @@ public class PaymentServiceImpl implements PaymentService {
|
|||||||
log.debug(
|
log.debug(
|
||||||
"Emploie du trop perçu : ligne en débit (restant à payer): {})",
|
"Emploie du trop perçu : ligne en débit (restant à payer): {})",
|
||||||
debitMoveLine.getAmountRemaining());
|
debitMoveLine.getAmountRemaining());
|
||||||
debitTotalRemaining = debitTotalRemaining.add(debitMoveLine.getAmountRemaining().setScale(2,BigDecimal.ROUND_HALF_EVEN));
|
debitTotalRemaining =
|
||||||
|
debitTotalRemaining.add(
|
||||||
|
debitMoveLine.getAmountRemaining().setScale(2, BigDecimal.ROUND_HALF_EVEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MoveLine creditMoveLine : creditMoveLines) {
|
for (MoveLine creditMoveLine : creditMoveLines) {
|
||||||
@@ -148,7 +152,10 @@ public class PaymentServiceImpl implements PaymentService {
|
|||||||
&& (creditMoveLine.getAmountRemaining().compareTo(BigDecimal.ZERO) == 1)) {
|
&& (creditMoveLine.getAmountRemaining().compareTo(BigDecimal.ZERO) == 1)) {
|
||||||
try {
|
try {
|
||||||
createReconcile(
|
createReconcile(
|
||||||
debitMoveLine, creditMoveLine, debitTotalRemaining.setScale(4), creditTotalRemaining.setScale(4));
|
debitMoveLine,
|
||||||
|
creditMoveLine,
|
||||||
|
debitTotalRemaining.setScale(4),
|
||||||
|
creditTotalRemaining.setScale(4));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (dontThrow) {
|
if (dontThrow) {
|
||||||
TraceBackService.trace(e);
|
TraceBackService.trace(e);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.axelor.apps.account.service.payment.paymentvoucher;
|
|||||||
|
|
||||||
import com.axelor.apps.account.db.Account;
|
import com.axelor.apps.account.db.Account;
|
||||||
import com.axelor.apps.account.db.AccountConfig;
|
import com.axelor.apps.account.db.AccountConfig;
|
||||||
|
import com.axelor.apps.account.db.CashRegister;
|
||||||
import com.axelor.apps.account.db.Invoice;
|
import com.axelor.apps.account.db.Invoice;
|
||||||
import com.axelor.apps.account.db.Journal;
|
import com.axelor.apps.account.db.Journal;
|
||||||
import com.axelor.apps.account.db.Move;
|
import com.axelor.apps.account.db.Move;
|
||||||
@@ -28,15 +29,13 @@ import com.axelor.apps.account.db.PayVoucherElementToPay;
|
|||||||
import com.axelor.apps.account.db.PaymentMode;
|
import com.axelor.apps.account.db.PaymentMode;
|
||||||
import com.axelor.apps.account.db.PaymentVoucher;
|
import com.axelor.apps.account.db.PaymentVoucher;
|
||||||
import com.axelor.apps.account.db.Reconcile;
|
import com.axelor.apps.account.db.Reconcile;
|
||||||
import com.axelor.apps.account.db.ReconcileGroup;
|
import com.axelor.apps.account.db.repo.CashRegisterRepository;
|
||||||
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
||||||
import com.axelor.apps.account.db.repo.MoveRepository;
|
import com.axelor.apps.account.db.repo.MoveRepository;
|
||||||
import com.axelor.apps.account.db.repo.PayVoucherElementToPayRepository;
|
import com.axelor.apps.account.db.repo.PayVoucherElementToPayRepository;
|
||||||
import com.axelor.apps.account.db.repo.PaymentVoucherRepository;
|
import com.axelor.apps.account.db.repo.PaymentVoucherRepository;
|
||||||
import com.axelor.apps.account.exception.IExceptionMessage;
|
import com.axelor.apps.account.exception.IExceptionMessage;
|
||||||
import com.axelor.apps.account.service.AccountCustomerService;
|
import com.axelor.apps.account.service.AccountCustomerService;
|
||||||
import com.axelor.apps.account.service.MoveLineExportService;
|
|
||||||
import com.axelor.apps.account.service.ReconcileGroupServiceImpl;
|
|
||||||
import com.axelor.apps.account.service.ReconcileService;
|
import com.axelor.apps.account.service.ReconcileService;
|
||||||
import com.axelor.apps.account.service.app.AppAccountService;
|
import com.axelor.apps.account.service.app.AppAccountService;
|
||||||
import com.axelor.apps.account.service.config.AccountConfigService;
|
import com.axelor.apps.account.service.config.AccountConfigService;
|
||||||
@@ -49,7 +48,6 @@ import com.axelor.apps.account.service.payment.PaymentService;
|
|||||||
import com.axelor.apps.base.db.BankDetails;
|
import com.axelor.apps.base.db.BankDetails;
|
||||||
import com.axelor.apps.base.db.Company;
|
import com.axelor.apps.base.db.Company;
|
||||||
import com.axelor.apps.base.db.Partner;
|
import com.axelor.apps.base.db.Partner;
|
||||||
import com.axelor.apps.purchase.db.PurchaseOrder;
|
|
||||||
import com.axelor.auth.AuthUtils;
|
import com.axelor.auth.AuthUtils;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||||
@@ -66,7 +64,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -132,8 +129,8 @@ public class PaymentVoucherConfirmService {
|
|||||||
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
||||||
Journal journal;
|
Journal journal;
|
||||||
|
|
||||||
|
if (paymentVoucher.getPaymentMode().getId() == 12
|
||||||
if (paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) {
|
|| paymentVoucher.getPaymentMode().getId() == 23) {
|
||||||
if (paymentVoucher.getPartner().getAccountingManagementList().size() == 0) {
|
if (paymentVoucher.getPartner().getAccountingManagementList().size() == 0) {
|
||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
paymentVoucher,
|
paymentVoucher,
|
||||||
@@ -144,8 +141,7 @@ public class PaymentVoucherConfirmService {
|
|||||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
journal =
|
journal = paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||||
paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
|
||||||
Account paymentModeAccount =
|
Account paymentModeAccount =
|
||||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||||
|
|
||||||
@@ -176,7 +172,9 @@ public class PaymentVoucherConfirmService {
|
|||||||
if (!isConfirmed && paymentVoucher.getGeneratedMoveList().size() == 0) {
|
if (!isConfirmed && paymentVoucher.getGeneratedMoveList().size() == 0) {
|
||||||
createMoveAndConfirm(paymentVoucher);
|
createMoveAndConfirm(paymentVoucher);
|
||||||
}
|
}
|
||||||
if ((paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) && isConfirmed) {
|
if ((paymentVoucher.getPaymentMode().getId() == 12
|
||||||
|
|| paymentVoucher.getPaymentMode().getId() == 23)
|
||||||
|
&& isConfirmed) {
|
||||||
confirmBankMove(paymentVoucher);
|
confirmBankMove(paymentVoucher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,13 +215,13 @@ public class PaymentVoucherConfirmService {
|
|||||||
boolean scheduleToBePaid = false;
|
boolean scheduleToBePaid = false;
|
||||||
Account paymentModeAccount;
|
Account paymentModeAccount;
|
||||||
|
|
||||||
if (paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) {
|
if (paymentVoucher.getPaymentMode().getId() == 12
|
||||||
|
|| paymentVoucher.getPaymentMode().getId() == 23) {
|
||||||
paymentModeAccount =
|
paymentModeAccount =
|
||||||
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
||||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||||
} else {
|
} else {
|
||||||
journal =
|
journal = paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||||
paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
|
||||||
paymentModeAccount =
|
paymentModeAccount =
|
||||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||||
}
|
}
|
||||||
@@ -302,7 +300,6 @@ public class PaymentVoucherConfirmService {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
for (PayVoucherElementToPay payVoucherElementToPay : payVoucherElementToPayList) {
|
for (PayVoucherElementToPay payVoucherElementToPay : payVoucherElementToPayList) {
|
||||||
MoveLine moveLineToPay = payVoucherElementToPay.getMoveLine();
|
MoveLine moveLineToPay = payVoucherElementToPay.getMoveLine();
|
||||||
log.debug("PV moveLineToPay debit : {}", moveLineToPay.getDebit());
|
log.debug("PV moveLineToPay debit : {}", moveLineToPay.getDebit());
|
||||||
@@ -316,8 +313,7 @@ public class PaymentVoucherConfirmService {
|
|||||||
isDebitToPay = paymentVoucherToolService.isDebitToPay(invoice);
|
isDebitToPay = paymentVoucherToolService.isDebitToPay(invoice);
|
||||||
|
|
||||||
boolean isRefundInvoice = false;
|
boolean isRefundInvoice = false;
|
||||||
if (invoice.getOperationTypeSelect()
|
if (invoice.getOperationTypeSelect() == InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND) {
|
||||||
== InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND) {
|
|
||||||
isRefundInvoice = true;
|
isRefundInvoice = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +590,12 @@ public class PaymentVoucherConfirmService {
|
|||||||
}
|
}
|
||||||
accountToPay = moveLineToPay.getAccount();
|
accountToPay = moveLineToPay.getAccount();
|
||||||
} else {
|
} else {
|
||||||
accountToPay = paymentVoucher.getPartner().getAccountingSituationList().get(0).getPartnerPaymentAccount();
|
accountToPay =
|
||||||
|
paymentVoucher
|
||||||
|
.getPartner()
|
||||||
|
.getAccountingSituationList()
|
||||||
|
.get(0)
|
||||||
|
.getPartnerPaymentAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal paidAmount = paymentVoucher.getPaidAmount();
|
BigDecimal paidAmount = paymentVoucher.getPaidAmount();
|
||||||
@@ -631,14 +632,18 @@ public class PaymentVoucherConfirmService {
|
|||||||
moveService.getMoveValidateService().validate(move);
|
moveService.getMoveValidateService().validate(move);
|
||||||
paymentVoucher.setGeneratedMove(move);
|
paymentVoucher.setGeneratedMove(move);
|
||||||
paymentVoucher.addGeneratedMoveListItem(move);
|
paymentVoucher.addGeneratedMoveListItem(move);
|
||||||
|
paymentVoucher.setConfirmationDate(LocalDate.now());
|
||||||
|
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||||
|
|
||||||
if (isDebitToPay) {
|
if (isDebitToPay) {
|
||||||
reconcileService.balanceCredit(moveLine);
|
reconcileService.balanceCredit(moveLine);
|
||||||
}
|
}
|
||||||
|
if(paymentVoucher.getPartner().getId() == 2040L){
|
||||||
|
this.updateCashRegisterTheoricalSolde(paymentVoucher, isDebitToPay,paidAmount);
|
||||||
|
}
|
||||||
// Beans.get(PaymentVoucherLoadService.class).updateVoucher(paymentVoucher);
|
// Beans.get(PaymentVoucherLoadService.class).updateVoucher(paymentVoucher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void deleteUnPaidLines(PaymentVoucher paymentVoucher) {
|
public void deleteUnPaidLines(PaymentVoucher paymentVoucher) {
|
||||||
|
|
||||||
if (paymentVoucher.getPayVoucherElementToPayList() == null) {
|
if (paymentVoucher.getPayVoucherElementToPayList() == null) {
|
||||||
@@ -750,13 +755,13 @@ public class PaymentVoucherConfirmService {
|
|||||||
|
|
||||||
BigDecimal amountInCompanyCurrency = moveLine.getDebit().add(moveLine.getCredit());
|
BigDecimal amountInCompanyCurrency = moveLine.getDebit().add(moveLine.getCredit());
|
||||||
|
|
||||||
Reconcile reconcile =
|
// Reconcile reconcile =
|
||||||
reconcileService.createReconcile(moveLineToPay, moveLine, amountToPayReel, true);
|
// reconcileService.createReconcile(moveLineToPay, moveLine, amountToPayReel, true);
|
||||||
reconciles.add(reconcile);
|
// reconciles.add(reconcile);
|
||||||
if (reconcile != null) {
|
// if (reconcile != null) {
|
||||||
log.debug("Reconcile : : : {}", reconcile);
|
// log.debug("Reconcile : : : {}", reconcile);
|
||||||
reconcileService.confirmReconcile(reconcile, true);
|
// reconcileService.confirmPaymentVoucherReconcile(reconcile, true);
|
||||||
}
|
// // }
|
||||||
return moveLine;
|
return moveLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,7 +870,9 @@ public class PaymentVoucherConfirmService {
|
|||||||
log.debug("Rejecting move : : : {} **********", move);
|
log.debug("Rejecting move : : : {} **********", move);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Move reverseMove = Beans.get(MoveServiceImpl.class).generateReverse(move, false, false, true, LocalDate.now());
|
Move reverseMove =
|
||||||
|
Beans.get(MoveServiceImpl.class)
|
||||||
|
.generateReverse(move, false, false, true, LocalDate.now());
|
||||||
paymentVoucher2.addGeneratedMoveListItem(reverseMove);
|
paymentVoucher2.addGeneratedMoveListItem(reverseMove);
|
||||||
// moveCancelService.cancel(move);
|
// moveCancelService.cancel(move);
|
||||||
} catch (AxelorException e) {
|
} catch (AxelorException e) {
|
||||||
@@ -880,30 +887,37 @@ public class PaymentVoucherConfirmService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public Move confirmMultipleVoucher(List<PaymentVoucher> voucherList, List<PayVoucherElementToPay> elementToPays, boolean b) throws AxelorException {
|
public Move confirmMultipleVoucher(
|
||||||
|
List<PaymentVoucher> voucherList, List<PayVoucherElementToPay> elementToPays, boolean b)
|
||||||
|
throws AxelorException {
|
||||||
if (voucherList != null && voucherList.size() > 0) {
|
if (voucherList != null && voucherList.size() > 0) {
|
||||||
if (!samePaymentVoucherSelect(voucherList) || voucherAlreadyInMove(voucherList)) {
|
if (!samePaymentVoucherSelect(voucherList) || voucherAlreadyInMove(voucherList)) {
|
||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
voucherList.get(0),
|
voucherList.get(0),
|
||||||
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||||
"Not the same operation type"
|
"Not the same operation type");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
totalAmount = voucherList.stream().map(PaymentVoucher::getPaidAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
totalAmount =
|
||||||
|
voucherList
|
||||||
|
.stream()
|
||||||
|
.map(PaymentVoucher::getPaidAmount)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
PaymentVoucher paymentVoucher = voucherList.get(0);
|
PaymentVoucher paymentVoucher = voucherList.get(0);
|
||||||
Partner payerPartner = paymentVoucher.getPartner();
|
Partner payerPartner = paymentVoucher.getPartner();
|
||||||
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
||||||
Company company = paymentVoucher.getCompany();
|
Company company = paymentVoucher.getCompany();
|
||||||
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
||||||
Journal journal = paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
Journal journal =
|
||||||
|
paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||||
|
|
||||||
Account paymentModeAccount =
|
Account paymentModeAccount =
|
||||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||||
|
|
||||||
if (paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) {
|
if (paymentVoucher.getPaymentMode().getId() == 12
|
||||||
|
|| paymentVoucher.getPaymentMode().getId() == 23) {
|
||||||
paymentModeAccount =
|
paymentModeAccount =
|
||||||
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
||||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||||
@@ -921,7 +935,6 @@ public class PaymentVoucherConfirmService {
|
|||||||
paymentMode,
|
paymentMode,
|
||||||
MoveRepository.TECHNICAL_ORIGIN_AUTOMATIC);
|
MoveRepository.TECHNICAL_ORIGIN_AUTOMATIC);
|
||||||
|
|
||||||
|
|
||||||
// move.addPaymentVoucherListItem(paymentVoucher);
|
// move.addPaymentVoucherListItem(paymentVoucher);
|
||||||
// paymentVoucher.setGeneratedMove(move);
|
// paymentVoucher.setGeneratedMove(move);
|
||||||
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||||
@@ -946,7 +959,8 @@ public class PaymentVoucherConfirmService {
|
|||||||
Set<Long> paymentVoucherIds = new HashSet<Long>();
|
Set<Long> paymentVoucherIds = new HashSet<Long>();
|
||||||
|
|
||||||
for (PayVoucherElementToPay voucherElementToPay : elementToPays) {
|
for (PayVoucherElementToPay voucherElementToPay : elementToPays) {
|
||||||
MoveLine line = moveLineService.createMoveLine(
|
MoveLine line =
|
||||||
|
moveLineService.createMoveLine(
|
||||||
move,
|
move,
|
||||||
payerPartner,
|
payerPartner,
|
||||||
voucherElementToPay.getMoveLine().getAccount(),
|
voucherElementToPay.getMoveLine().getAccount(),
|
||||||
@@ -982,7 +996,9 @@ public class PaymentVoucherConfirmService {
|
|||||||
Partner partner = voucherList.get(0).getPartner();
|
Partner partner = voucherList.get(0).getPartner();
|
||||||
for (int index = 1; index < voucherList.size(); index++) {
|
for (int index = 1; index < voucherList.size(); index++) {
|
||||||
PaymentVoucher paymentVoucher = voucherList.get(index);
|
PaymentVoucher paymentVoucher = voucherList.get(index);
|
||||||
if(paymentVoucher.getOperationTypeSelect() != operationTypeSelect || paymentVoucher.getPartner() != partner || paymentVoucher.getCompanyBankDetails() != bankDetails){
|
if (paymentVoucher.getOperationTypeSelect() != operationTypeSelect
|
||||||
|
|| paymentVoucher.getPartner() != partner
|
||||||
|
|| paymentVoucher.getCompanyBankDetails() != bankDetails) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1000,11 +1016,20 @@ public class PaymentVoucherConfirmService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Cash mvt
|
// Cash mvt
|
||||||
|
/**
|
||||||
|
* Confirm cash payment voucher and create move.
|
||||||
|
*
|
||||||
|
* @param paymentVoucher
|
||||||
|
* @throws AxelorException
|
||||||
|
*/
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void confirmCashPayment(PaymentVoucher paymentVoucher) throws AxelorException {
|
public void confirmCashPayment(PaymentVoucher paymentVoucher) throws AxelorException {
|
||||||
|
if(paymentVoucher.getGeneratedMoveList().size() > 0){
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||||
|
"Already ventilated.");
|
||||||
|
}
|
||||||
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
||||||
Company company = paymentVoucher.getCompany();
|
Company company = paymentVoucher.getCompany();
|
||||||
AccountConfig accountConfig = Beans.get(AccountConfigService.class).getAccountConfig(company);
|
AccountConfig accountConfig = Beans.get(AccountConfigService.class).getAccountConfig(company);
|
||||||
@@ -1013,10 +1038,8 @@ public class PaymentVoucherConfirmService {
|
|||||||
// LocalDate paymentDate = paymentVoucher.getPaymentDate();
|
// LocalDate paymentDate = paymentVoucher.getPaymentDate();
|
||||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||||
|
|
||||||
|
Account paymentModeAccount =
|
||||||
|
paymentVoucher.getCashAccountConfig().getAccount();
|
||||||
boolean scheduleToBePaid = false;
|
|
||||||
Account paymentModeAccount = paymentVoucher.getPartner().getAccountingSituationList().get(0).getPartnerPaymentAccount();
|
|
||||||
|
|
||||||
Move move =
|
Move move =
|
||||||
moveService
|
moveService
|
||||||
@@ -1038,11 +1061,6 @@ public class PaymentVoucherConfirmService {
|
|||||||
isDebitToPay = true;
|
isDebitToPay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(paymentVoucher.getDebitCreditSelect().toString());
|
|
||||||
System.out.println(isDebitToPay);
|
|
||||||
System.out.println("*******************999*********");
|
|
||||||
|
|
||||||
|
|
||||||
Account accountToPay = accountConfig.getCashAccount();
|
Account accountToPay = accountConfig.getCashAccount();
|
||||||
|
|
||||||
BigDecimal paidAmount = paymentVoucher.getPaidAmount();
|
BigDecimal paidAmount = paymentVoucher.getPaidAmount();
|
||||||
@@ -1059,7 +1077,7 @@ public class PaymentVoucherConfirmService {
|
|||||||
paymentDate,
|
paymentDate,
|
||||||
moveLineNo++,
|
moveLineNo++,
|
||||||
paymentVoucher.getRef(),
|
paymentVoucher.getRef(),
|
||||||
null);
|
paymentVoucher.getLabel());
|
||||||
|
|
||||||
MoveLine moveLine =
|
MoveLine moveLine =
|
||||||
moveLineService.createMoveLine(
|
moveLineService.createMoveLine(
|
||||||
@@ -1071,21 +1089,125 @@ public class PaymentVoucherConfirmService {
|
|||||||
paymentDate,
|
paymentDate,
|
||||||
moveLineNo++,
|
moveLineNo++,
|
||||||
paymentVoucher.getRef(),
|
paymentVoucher.getRef(),
|
||||||
null);
|
paymentVoucher.getLabel());
|
||||||
|
|
||||||
move.getMoveLineList().add(moveLine);
|
move.getMoveLineList().add(moveLine);
|
||||||
move.getMoveLineList().add(moveLine2);
|
move.getMoveLineList().add(moveLine2);
|
||||||
|
|
||||||
|
String label = paymentVoucher.getLabel() != null ? paymentVoucher.getLabel() : "";
|
||||||
|
String fullName = (paymentVoucher.getRecipientPartner() != null && paymentVoucher.getRecipientPartner().getFullName() != null)
|
||||||
|
? paymentVoucher.getRecipientPartner().getFullName()
|
||||||
|
: "";
|
||||||
|
|
||||||
|
String description = label +" "+ fullName;
|
||||||
|
|
||||||
|
moveLine.setDescription(description);
|
||||||
|
moveLine2.setDescription(description);
|
||||||
|
|
||||||
moveService.getMoveValidateService().validate(move);
|
moveService.getMoveValidateService().validate(move);
|
||||||
paymentVoucher.setGeneratedMove(move);
|
paymentVoucher.setGeneratedMove(move);
|
||||||
paymentVoucher.addGeneratedMoveListItem(move);
|
paymentVoucher.addGeneratedMoveListItem(move);
|
||||||
|
|
||||||
|
// confirmed is ventilation equivalent
|
||||||
|
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||||
|
paymentVoucher.setConfirmationDate(LocalDate.now());
|
||||||
|
|
||||||
if (isDebitToPay) {
|
if (isDebitToPay) {
|
||||||
reconcileService.balanceCredit(moveLine);
|
reconcileService.balanceCredit(moveLine);
|
||||||
}
|
}
|
||||||
|
// updateCashRegisterTheoricalSolde(paymentVoucher, isDebitToPay,paidAmount);
|
||||||
// Beans.get(PaymentVoucherLoadService.class).updateVoucher(paymentVoucher);
|
// Beans.get(PaymentVoucherLoadService.class).updateVoucher(paymentVoucher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void updateCashRegisterTheoricalSolde(PaymentVoucher paymentVoucher,Boolean isDebitCredit,BigDecimal amount) {
|
||||||
|
System.out.println("updateCashRegisterTheoricalSolde : : : " + paymentVoucher.getCashAccountConfig());
|
||||||
|
if (paymentVoucher.getCashAccountConfig() != null || paymentVoucher.getPartner() != null) {
|
||||||
|
CashRegisterRepository casRegisterRepository = Beans.get(CashRegisterRepository.class);
|
||||||
|
CashRegister cashRegister = casRegisterRepository.all().order("-createdOn").fetchOne();
|
||||||
|
BigDecimal theoreticalSolde = cashRegister.getTheoricalSolde();
|
||||||
|
if (isDebitCredit) {
|
||||||
|
theoreticalSolde = theoreticalSolde.subtract(amount);
|
||||||
|
} else {
|
||||||
|
theoreticalSolde = theoreticalSolde.add(amount);
|
||||||
|
}
|
||||||
|
System.out.println("theoreticalSolde : : : " + theoreticalSolde);
|
||||||
|
cashRegister.setTheoricalSolde(theoreticalSolde);
|
||||||
|
Beans.get(CashRegisterRepository.class).save(cashRegister);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void validateCashPaymentVoucher(PaymentVoucher paymentVoucher) throws AxelorException {
|
||||||
|
if (paymentVoucher.getCashAccountConfig() == null) {
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||||
|
"Cash account config is not set for the payment voucher.");
|
||||||
|
}
|
||||||
|
if (paymentVoucher.getCashAccountConfig().getAccount() == null) {
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||||
|
"Cash account is not set for the payment voucher.");
|
||||||
|
}
|
||||||
|
CashRegisterRepository casRegisterRepository = Beans.get(CashRegisterRepository.class);
|
||||||
|
CashRegister cashRegister = casRegisterRepository.all().order("-createdOn").fetchOne();
|
||||||
|
|
||||||
|
BigDecimal solde = cashRegister.getTheoricalSolde();
|
||||||
|
if (Integer.parseInt(paymentVoucher.getDebitCreditSelect()) == 1) {
|
||||||
|
solde = solde.subtract(paymentVoucher.getPaidAmount());
|
||||||
|
}else{
|
||||||
|
solde = solde.add(paymentVoucher.getPaidAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
paymentVoucher.setInitialTheoricalSolde(cashRegister.getTheoricalSolde());
|
||||||
|
paymentVoucher.setTheoricalSolde(solde);
|
||||||
|
paymentVoucher.setCashStatusSelect(PaymentVoucherRepository.STATUS_WAITING_FOR_DEPOSIT_SLIP);
|
||||||
|
paymentVoucher.setApprovalDate(LocalDate.now());
|
||||||
|
paymentVoucher.setApprovedByUser(AuthUtils.getUser());
|
||||||
|
Boolean isDebitToPay = false;
|
||||||
|
|
||||||
|
if (Integer.parseInt(paymentVoucher.getDebitCreditSelect()) == 1) {
|
||||||
|
isDebitToPay = true;
|
||||||
|
}
|
||||||
|
updateCashRegisterTheoricalSolde(paymentVoucher, isDebitToPay,paymentVoucher.getPaidAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void cancelCashPaymentVoucher(PaymentVoucher paymentVoucher) throws AxelorException {
|
||||||
|
if (paymentVoucher.getCashAccountConfig() == null) {
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||||
|
"Cash account config is not set for the payment voucher.");
|
||||||
|
}
|
||||||
|
if (paymentVoucher.getCashAccountConfig().getAccount() == null) {
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||||
|
"Cash account is not set for the payment voucher.");
|
||||||
|
}
|
||||||
|
CashRegisterRepository casRegisterRepository = Beans.get(CashRegisterRepository.class);
|
||||||
|
CashRegister cashRegister = casRegisterRepository.all().order("-createdOn").fetchOne();
|
||||||
|
|
||||||
|
BigDecimal solde = cashRegister.getTheoricalSolde();
|
||||||
|
if (Integer.parseInt(paymentVoucher.getDebitCreditSelect()) == 2) {
|
||||||
|
solde = solde.subtract(paymentVoucher.getPaidAmount());
|
||||||
|
}else{
|
||||||
|
solde = solde.add(paymentVoucher.getPaidAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
paymentVoucher.setInitialTheoricalSolde(cashRegister.getTheoricalSolde());
|
||||||
|
paymentVoucher.setTheoricalSolde(solde);
|
||||||
|
paymentVoucher.setCashStatusSelect(4);
|
||||||
|
Boolean isDebitToPay = false;
|
||||||
|
|
||||||
|
if (Integer.parseInt(paymentVoucher.getDebitCreditSelect()) == 1) {
|
||||||
|
isDebitToPay = true;
|
||||||
|
}
|
||||||
|
// Beans.get(MoveServiceImpl.class).
|
||||||
|
updateCashRegisterTheoricalSolde(paymentVoucher, !isDebitToPay,paymentVoucher.getPaidAmount());
|
||||||
|
for (Move move : paymentVoucher.getGeneratedMoveList()) {
|
||||||
|
Beans.get(MoveCancelService.class).cancel(move);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,9 +94,9 @@ public class PaymentVoucherLoadService {
|
|||||||
+ "and self.move.ignoreInDebtRecoveryOk = 'f' "
|
+ "and self.move.ignoreInDebtRecoveryOk = 'f' "
|
||||||
+ "and self.move.company = ?2 ";
|
+ "and self.move.company = ?2 ";
|
||||||
|
|
||||||
|
|
||||||
if (paymentVoucher.getOperationTypeSelect() == PaymentVoucherRepository.OTHER) {
|
if (paymentVoucher.getOperationTypeSelect() == PaymentVoucherRepository.OTHER) {
|
||||||
AccountingSituation accountingSituation = paymentVoucher.getPartner().getAccountingSituationList().get(0);
|
AccountingSituation accountingSituation =
|
||||||
|
paymentVoucher.getPartner().getAccountingSituationList().get(0);
|
||||||
query += " and self.account.id = " + accountingSituation.getPartnerPaymentAccount().getId();
|
query += " and self.account.id = " + accountingSituation.getPartnerPaymentAccount().getId();
|
||||||
if (accountingSituation.getDiretion() == 1) {
|
if (accountingSituation.getDiretion() == 1) {
|
||||||
query += " and self.debit > 0";
|
query += " and self.debit > 0";
|
||||||
@@ -222,10 +222,21 @@ public class PaymentVoucherLoadService {
|
|||||||
BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
||||||
List<PayVoucherDueElement> dueElements = paymentVoucherContext.getPayVoucherDueElementList();
|
List<PayVoucherDueElement> dueElements = paymentVoucherContext.getPayVoucherDueElementList();
|
||||||
|
|
||||||
int sizeInvoiced = dueElements.stream().filter(t -> t.getMoveLine().getMove().getInvoice() == null).collect(Collectors.toList()).size();
|
int sizeInvoiced =
|
||||||
|
dueElements
|
||||||
|
.stream()
|
||||||
|
.filter(t -> t.getMoveLine().getMove().getInvoice() == null)
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
.size();
|
||||||
System.out.println("sizeInvoiced : {}" + sizeInvoiced);
|
System.out.println("sizeInvoiced : {}" + sizeInvoiced);
|
||||||
if (sizeInvoiced == 0) {
|
if (sizeInvoiced == 0) {
|
||||||
dueElements.sort((o1, o2) -> o2.getMoveLine().getMove().getInvoice().getInvoiceId().compareTo(o1.getMoveLine().getMove().getInvoice().getInvoiceId()));
|
dueElements.sort(
|
||||||
|
(o1, o2) ->
|
||||||
|
o2.getMoveLine()
|
||||||
|
.getMove()
|
||||||
|
.getInvoice()
|
||||||
|
.getInvoiceId()
|
||||||
|
.compareTo(o1.getMoveLine().getMove().getInvoice().getInvoiceId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PayVoucherDueElement payVoucherDueElementContext : dueElements) {
|
for (PayVoucherDueElement payVoucherDueElementContext : dueElements) {
|
||||||
@@ -237,7 +248,9 @@ public class PaymentVoucherLoadService {
|
|||||||
paymentVoucher.addPayVoucherElementToPayListItem(
|
paymentVoucher.addPayVoucherElementToPayListItem(
|
||||||
this.createPayVoucherElementToPay(payVoucherDueElement, sequence++, amountRemaining));
|
this.createPayVoucherElementToPay(payVoucherDueElement, sequence++, amountRemaining));
|
||||||
|
|
||||||
amountRemaining = amountRemaining.subtract(amountRemaining.min(payVoucherDueElement.getAmountRemaining()));
|
amountRemaining =
|
||||||
|
amountRemaining.subtract(
|
||||||
|
amountRemaining.min(payVoucherDueElement.getAmountRemaining()));
|
||||||
|
|
||||||
// Remove the line from the due elements lists
|
// Remove the line from the due elements lists
|
||||||
paymentVoucher.removePayVoucherDueElementListItem(payVoucherDueElement);
|
paymentVoucher.removePayVoucherDueElementListItem(payVoucherDueElement);
|
||||||
@@ -246,7 +259,8 @@ public class PaymentVoucherLoadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PayVoucherElementToPay createPayVoucherElementToPay(
|
public PayVoucherElementToPay createPayVoucherElementToPay(
|
||||||
PayVoucherDueElement payVoucherDueElement, int sequence,BigDecimal amountRemaining) throws AxelorException {
|
PayVoucherDueElement payVoucherDueElement, int sequence, BigDecimal amountRemaining)
|
||||||
|
throws AxelorException {
|
||||||
|
|
||||||
PaymentVoucher paymentVoucher = payVoucherDueElement.getPaymentVoucher();
|
PaymentVoucher paymentVoucher = payVoucherDueElement.getPaymentVoucher();
|
||||||
// BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
// BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
||||||
@@ -420,7 +434,6 @@ public class PaymentVoucherLoadService {
|
|||||||
int sequence = 0;
|
int sequence = 0;
|
||||||
BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
||||||
|
|
||||||
|
|
||||||
for (Iterator<PayVoucherDueElement> it =
|
for (Iterator<PayVoucherDueElement> it =
|
||||||
paymentVoucher.getPayVoucherDueElementList().iterator();
|
paymentVoucher.getPayVoucherDueElementList().iterator();
|
||||||
it.hasNext(); ) {
|
it.hasNext(); ) {
|
||||||
@@ -430,24 +443,33 @@ public class PaymentVoucherLoadService {
|
|||||||
&& paymentVoucher.getCurrency().equals(payVoucherDueElement.getCurrency())) {
|
&& paymentVoucher.getCurrency().equals(payVoucherDueElement.getCurrency())) {
|
||||||
paymentVoucher.addPayVoucherElementToPayListItem(
|
paymentVoucher.addPayVoucherElementToPayListItem(
|
||||||
createPayVoucherElementToPay(payVoucherDueElement, ++sequence, amountRemaining));
|
createPayVoucherElementToPay(payVoucherDueElement, ++sequence, amountRemaining));
|
||||||
amountRemaining = amountRemaining.subtract(amountRemaining.min(payVoucherDueElement.getAmountRemaining()));
|
amountRemaining =
|
||||||
|
amountRemaining.subtract(
|
||||||
|
amountRemaining.min(payVoucherDueElement.getAmountRemaining()));
|
||||||
|
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void updateVoucher(PaymentVoucher paymentVoucher) throws AxelorException {
|
public void updateVoucher(PaymentVoucher paymentVoucher) throws AxelorException {
|
||||||
List<MoveLine> moveLines = new ArrayList<>();
|
List<MoveLine> moveLines = new ArrayList<>();
|
||||||
List<PayVoucherElementToPay> payVoucherElementToPayList = paymentVoucher.getPayVoucherElementToPayList();
|
List<PayVoucherElementToPay> payVoucherElementToPayList =
|
||||||
|
paymentVoucher.getPayVoucherElementToPayList();
|
||||||
|
|
||||||
for (PayVoucherElementToPay elementToPay : payVoucherElementToPayList) {
|
for (PayVoucherElementToPay elementToPay : payVoucherElementToPayList) {
|
||||||
moveLines.add(elementToPay.getMoveLine());
|
moveLines.add(elementToPay.getMoveLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PayVoucherElementToPay> elementToPays = elementToPayRepository.all().filter("self.paymentVoucher.id != ?1 and self.moveLine in (?2)",paymentVoucher.getId(),moveLines).fetch();
|
List<PayVoucherElementToPay> elementToPays =
|
||||||
|
elementToPayRepository
|
||||||
|
.all()
|
||||||
|
.filter(
|
||||||
|
"self.paymentVoucher.id != ?1 and self.moveLine in (?2)",
|
||||||
|
paymentVoucher.getId(),
|
||||||
|
moveLines)
|
||||||
|
.fetch();
|
||||||
|
|
||||||
for (PayVoucherElementToPay payVoucherElementToPay : elementToPays) {
|
for (PayVoucherElementToPay payVoucherElementToPay : elementToPays) {
|
||||||
Move move = payVoucherElementToPay.getMoveLine().getMove();
|
Move move = payVoucherElementToPay.getMoveLine().getMove();
|
||||||
@@ -464,14 +486,10 @@ public class PaymentVoucherLoadService {
|
|||||||
moveLine.getDate())
|
moveLine.getDate())
|
||||||
.setScale(2, RoundingMode.HALF_EVEN);
|
.setScale(2, RoundingMode.HALF_EVEN);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
payVoucherElementToPay.setRemainingAmount(
|
payVoucherElementToPay.setRemainingAmount(
|
||||||
moveLine.getCurrencyAmount().subtract(paidAmountInElementCurrency));
|
moveLine.getCurrencyAmount().subtract(paidAmountInElementCurrency));
|
||||||
|
|
||||||
elementToPayRepository.save(payVoucherElementToPay);
|
elementToPayRepository.save(payVoucherElementToPay);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
package com.axelor.apps.account.web;
|
package com.axelor.apps.account.web;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.axelor.apps.ReportFactory;
|
import com.axelor.apps.ReportFactory;
|
||||||
import com.axelor.apps.account.db.CashInventory;
|
import com.axelor.apps.account.db.CashInventory;
|
||||||
import com.axelor.apps.account.db.PaymentVoucher;
|
import com.axelor.apps.account.db.PaymentVoucher;
|
||||||
@@ -23,11 +15,33 @@ import com.axelor.meta.schema.actions.ActionView;
|
|||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class CashInventoryController {
|
public class CashInventoryController {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
@Inject
|
||||||
|
private final ConvertNumberToFrenchWordsService convertService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public CashInventoryController(ConvertNumberToFrenchWordsService convertService) {
|
||||||
|
this.convertService = convertService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the cash inventory report.
|
||||||
|
*
|
||||||
|
* @param request The action request containing the context.
|
||||||
|
* @param response The action response to set the view with the report link.
|
||||||
|
* @throws AxelorException If an error occurs during report generation.
|
||||||
|
*/
|
||||||
public void printCashInventory(ActionRequest request, ActionResponse response)
|
public void printCashInventory(ActionRequest request, ActionResponse response)
|
||||||
throws AxelorException {
|
throws AxelorException {
|
||||||
|
|
||||||
@@ -38,8 +52,9 @@ public class CashInventoryController {
|
|||||||
name += " " + cashInventory.getRef();
|
name += " " + cashInventory.getRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileLink =
|
String fileLink = ReportFactory.createReport(
|
||||||
ReportFactory.createReport(String.format(IReport.CASH_INVENTORY, cashInventory.getOperationTypeSelect()), name + "-${date}")
|
String.format(IReport.CASH_INVENTORY, cashInventory.getOperationTypeSelect()),
|
||||||
|
name + "-${date}")
|
||||||
.addParam("cashInventoryId", cashInventory.getId())
|
.addParam("cashInventoryId", cashInventory.getId())
|
||||||
.generate()
|
.generate()
|
||||||
.getFileLink();
|
.getFileLink();
|
||||||
@@ -49,42 +64,63 @@ public class CashInventoryController {
|
|||||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
response.setView(ActionView.define(name).add("html", fileLink).map());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public void computeGap(ActionRequest request, ActionResponse response){
|
* Computes the theoretical solde in words for the cash inventory.
|
||||||
|
*
|
||||||
|
* @param request The action request containing the context.
|
||||||
|
* @param response The action response to set the theoretical solde in words.
|
||||||
|
*/
|
||||||
|
public void convertTheoricalSoldeInWords(ActionRequest request, ActionResponse response) {
|
||||||
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
||||||
|
|
||||||
String[] arrOfStr = cashInventory.getTheoricalSolde().toString().split("\\.");
|
String[] arrOfStr = cashInventory.getPhysicalSolde().toString().split("\\.");
|
||||||
|
|
||||||
String left = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
String left = convertService.convert(Long.parseLong(arrOfStr[0]));
|
||||||
String right = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
String right = convertService.convert(Long.parseLong(arrOfStr[1]));
|
||||||
String number = left + " dinars algériens et " + right + " Cts";
|
String number = left + " dinars algériens et " + right + " Cts";
|
||||||
|
|
||||||
response.setValue("theoricalSoldeInWords", number);
|
response.setValue("theoricalSoldeInWords", number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public void initThetoricalSoldeInWords(ActionRequest request, ActionResponse response){
|
* Initializes the theoretical solde in words for the cash inventory.
|
||||||
|
*
|
||||||
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
* @param request The action request containing the context.
|
||||||
Beans.get(CashInventoryService.class).initThetoricalSoldeInWords(cashInventory);
|
* @param response The action response to set the theoretical solde value.
|
||||||
|
*/
|
||||||
|
public void initThetoricalSolde(ActionRequest request, ActionResponse response) {
|
||||||
|
BigDecimal theoricalSolde = Beans.get(CashInventoryService.class).initThetoricalSolde();
|
||||||
|
response.setValue("theoricalSolde", theoricalSolde);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the totals for the cash inventory.
|
||||||
|
*
|
||||||
|
* @param request The action request containing the context.
|
||||||
|
* @param response The action response to set the computed values.
|
||||||
|
*/
|
||||||
public void computeToTals(ActionRequest request, ActionResponse response) {
|
public void computeToTals(ActionRequest request, ActionResponse response) {
|
||||||
|
|
||||||
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
||||||
|
if(cashInventory.getCashInventoryLines() != null && cashInventory.getCashInventoryLines().size() != 0){
|
||||||
Map<String, BigDecimal> map = Beans.get(CashInventoryService.class).computeToTals(cashInventory);
|
Map<String, BigDecimal> map = Beans.get(CashInventoryService.class).computeToTals(cashInventory);
|
||||||
response.setValues(map);
|
response.setValues(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the last cash data and calculates the theoretical solde.
|
||||||
|
*
|
||||||
|
* @param request The action request containing the context.
|
||||||
|
* @param response The action response to set the theoretical solde value.
|
||||||
|
*/
|
||||||
public void getLastCashData(ActionRequest request, ActionResponse response) {
|
public void getLastCashData(ActionRequest request, ActionResponse response) {
|
||||||
CashInventory lastCashInventory = Beans.get(CashInventoryRepository.class).all().order("-id").fetchOne();
|
CashInventory lastCashInventory = Beans.get(CashInventoryRepository.class).all().order("-id").fetchOne();
|
||||||
|
|
||||||
List<PaymentVoucher> cashVouchers = Beans.get(PaymentVoucherRepository.class).all().filter("self.operationTypeSelect = 9 and self.cashStatusSelect = 3").fetch();
|
List<PaymentVoucher> cashVouchers = Beans.get(PaymentVoucherRepository.class)
|
||||||
|
.all()
|
||||||
|
.filter("self.operationTypeSelect = 9 and self.cashStatusSelect = 3")
|
||||||
|
.fetch();
|
||||||
|
|
||||||
BigDecimal totalSolde = lastCashInventory.getPhysicalSolde();
|
BigDecimal totalSolde = lastCashInventory.getPhysicalSolde();
|
||||||
|
|
||||||
@@ -103,7 +139,22 @@ public class CashInventoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.setValue("theoricalSolde", totalSolde);
|
response.setValue("theoricalSolde", totalSolde);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate sequence for cash inventory
|
||||||
|
public void generateSequence(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
|
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
||||||
|
if (cashInventory.getRef() == null || cashInventory.getRef().isEmpty()) {
|
||||||
|
String sequence = Beans.get(CashInventoryService.class).getCashInventorySequence(cashInventory);
|
||||||
|
response.setValue("ref", sequence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void approveCashInventory(ActionRequest request, ActionResponse response) throws AxelorException{
|
||||||
|
CashInventory cashInventoryContext = request.getContext().asType(CashInventory.class);
|
||||||
|
CashInventory cashInventory = Beans.get(CashInventoryRepository.class).find(cashInventoryContext.getId());
|
||||||
|
Beans.get(CashInventoryService.class).approveCashInventory(cashInventory);
|
||||||
|
response.setReload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,16 +17,17 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.account.web;
|
package com.axelor.apps.account.web;
|
||||||
|
|
||||||
|
import com.axelor.apps.ReportFactory;
|
||||||
import com.axelor.apps.account.db.AccountingSituation;
|
import com.axelor.apps.account.db.AccountingSituation;
|
||||||
import com.axelor.apps.account.db.Invoice;
|
import com.axelor.apps.account.db.Invoice;
|
||||||
import com.axelor.apps.account.db.InvoicePayment;
|
import com.axelor.apps.account.db.InvoicePayment;
|
||||||
|
import com.axelor.apps.account.db.Journal;
|
||||||
import com.axelor.apps.account.db.PaymentCondition;
|
import com.axelor.apps.account.db.PaymentCondition;
|
||||||
import com.axelor.apps.account.db.PaymentMode;
|
import com.axelor.apps.account.db.PaymentMode;
|
||||||
import com.axelor.apps.account.db.PaymentVoucher;
|
import com.axelor.apps.account.db.PaymentVoucher;
|
||||||
import com.axelor.apps.account.db.Journal;
|
|
||||||
import com.axelor.apps.account.db.repo.AccountConfigRepository;
|
|
||||||
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
||||||
import com.axelor.apps.account.exception.IExceptionMessage;
|
import com.axelor.apps.account.exception.IExceptionMessage;
|
||||||
|
import com.axelor.apps.account.report.IReport;
|
||||||
import com.axelor.apps.account.service.AccountingSituationService;
|
import com.axelor.apps.account.service.AccountingSituationService;
|
||||||
import com.axelor.apps.account.service.IrrecoverableService;
|
import com.axelor.apps.account.service.IrrecoverableService;
|
||||||
import com.axelor.apps.account.service.app.AppAccountService;
|
import com.axelor.apps.account.service.app.AppAccountService;
|
||||||
@@ -38,7 +39,6 @@ import com.axelor.apps.base.db.BankDetails;
|
|||||||
import com.axelor.apps.base.db.Company;
|
import com.axelor.apps.base.db.Company;
|
||||||
import com.axelor.apps.base.db.Currency;
|
import com.axelor.apps.base.db.Currency;
|
||||||
import com.axelor.apps.base.db.Partner;
|
import com.axelor.apps.base.db.Partner;
|
||||||
import com.axelor.apps.base.db.PartnerCategory;
|
|
||||||
import com.axelor.apps.base.db.PriceList;
|
import com.axelor.apps.base.db.PriceList;
|
||||||
import com.axelor.apps.base.db.PrintingSettings;
|
import com.axelor.apps.base.db.PrintingSettings;
|
||||||
import com.axelor.apps.base.db.Wizard;
|
import com.axelor.apps.base.db.Wizard;
|
||||||
@@ -46,6 +46,7 @@ import com.axelor.apps.base.db.repo.LanguageRepository;
|
|||||||
import com.axelor.apps.base.db.repo.PartnerRepository;
|
import com.axelor.apps.base.db.repo.PartnerRepository;
|
||||||
import com.axelor.apps.base.service.AddressService;
|
import com.axelor.apps.base.service.AddressService;
|
||||||
import com.axelor.apps.base.service.BankDetailsService;
|
import com.axelor.apps.base.service.BankDetailsService;
|
||||||
|
import com.axelor.apps.base.service.ConvertNumberToFrenchWordsService;
|
||||||
import com.axelor.apps.base.service.PartnerPriceListService;
|
import com.axelor.apps.base.service.PartnerPriceListService;
|
||||||
import com.axelor.apps.base.service.PartnerService;
|
import com.axelor.apps.base.service.PartnerService;
|
||||||
import com.axelor.apps.base.service.TradingNameService;
|
import com.axelor.apps.base.service.TradingNameService;
|
||||||
@@ -64,21 +65,17 @@ import com.axelor.meta.schema.actions.ActionView.ActionViewBuilder;
|
|||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import com.axelor.rpc.Context;
|
import com.axelor.rpc.Context;
|
||||||
import com.axelor.apps.base.service.ConvertNumberToFrenchWordsService;
|
|
||||||
import com.axelor.apps.ReportFactory;
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -970,9 +967,10 @@ public class InvoiceController {
|
|||||||
String AmountToPay = request.getContext().get("amount").toString();
|
String AmountToPay = request.getContext().get("amount").toString();
|
||||||
String[] arrOfStr = AmountToPay.split("\\.");
|
String[] arrOfStr = AmountToPay.split("\\.");
|
||||||
|
|
||||||
|
String left =
|
||||||
String left = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
||||||
String right = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
String right =
|
||||||
|
Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
||||||
String number = left + " dinars algériens et " + right + " centimes";
|
String number = left + " dinars algériens et " + right + " centimes";
|
||||||
String chequeModelBank = request.getContext().get("chequeModelBank").toString();
|
String chequeModelBank = request.getContext().get("chequeModelBank").toString();
|
||||||
BigDecimal amount = new BigDecimal(AmountToPay);
|
BigDecimal amount = new BigDecimal(AmountToPay);
|
||||||
@@ -991,10 +989,9 @@ public class InvoiceController {
|
|||||||
logger.debug("Printing " + name);
|
logger.debug("Printing " + name);
|
||||||
|
|
||||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
response.setView(ActionView.define(name).add("html", fileLink).map());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printPaymentFile(ActionRequest request, ActionResponse response)
|
public void printPaymentFile2(ActionRequest request, ActionResponse response)
|
||||||
throws AxelorException {
|
throws AxelorException {
|
||||||
|
|
||||||
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
|
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
|
||||||
@@ -1003,12 +1000,30 @@ public class InvoiceController {
|
|||||||
String AmountToPay = paymentVoucher.getPaidAmount().toString();
|
String AmountToPay = paymentVoucher.getPaidAmount().toString();
|
||||||
String[] arrOfStr = AmountToPay.split("\\.");
|
String[] arrOfStr = AmountToPay.split("\\.");
|
||||||
|
|
||||||
String left = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
String left =
|
||||||
String right = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
||||||
|
String right =
|
||||||
|
Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
||||||
String number = left + " dinars algériens et " + right + " centimes";
|
String number = left + " dinars algériens et " + right + " centimes";
|
||||||
|
|
||||||
|
String reportType = "PaymentRequest.rptdesign";
|
||||||
|
|
||||||
|
System.out.println("mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm");
|
||||||
|
System.out.println(paymentVoucher.getOperationTypeSelect());
|
||||||
|
System.out.println(paymentVoucher.getDebitCreditSelect());
|
||||||
|
System.out.println(paymentVoucher.getOperationTypeSelect() == 9);
|
||||||
|
System.out.println(paymentVoucher.getDebitCreditSelect() == "1");
|
||||||
|
|
||||||
|
if(paymentVoucher.getOperationTypeSelect() == 9){
|
||||||
|
if(paymentVoucher.getDebitCreditSelect().equals("1")){
|
||||||
|
reportType = "CashPaymentRequestDebit.rptdesign";
|
||||||
|
}else if(paymentVoucher.getDebitCreditSelect().equals("2")){
|
||||||
|
reportType = "CashPaymentRequestCredit.rptdesign";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String fileLink =
|
String fileLink =
|
||||||
ReportFactory.createReport("PaymentRequest.rptdesign", name + "-${date}")
|
ReportFactory.createReport(reportType, name + "-${date}")
|
||||||
.addParam("PaymentVoucherId", paymentVoucher.getId())
|
.addParam("PaymentVoucherId", paymentVoucher.getId())
|
||||||
.addParam("NumberToWords", number)
|
.addParam("NumberToWords", number)
|
||||||
.generate()
|
.generate()
|
||||||
@@ -1019,13 +1034,12 @@ public class InvoiceController {
|
|||||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
response.setView(ActionView.define(name).add("html", fileLink).map());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showInvoice2(ActionRequest request, ActionResponse response)
|
public void showInvoice2(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
throws AxelorException {
|
|
||||||
|
|
||||||
Context context = request.getContext();
|
Context context = request.getContext();
|
||||||
|
|
||||||
Invoice invoice = Beans.get(InvoiceRepository.class)
|
Invoice invoice =
|
||||||
.find(Long.parseLong(context.get("id").toString()));
|
Beans.get(InvoiceRepository.class).find(Long.parseLong(context.get("id").toString()));
|
||||||
|
|
||||||
String name = I18n.get("Invoice");
|
String name = I18n.get("Invoice");
|
||||||
|
|
||||||
@@ -1048,14 +1062,16 @@ public class InvoiceController {
|
|||||||
.getCode()
|
.getCode()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
ReportSettings reportSettings = Beans.get(InvoicePrintService.class).prepareReportSettings(invoice, reportType, format, locale);
|
ReportSettings reportSettings =
|
||||||
|
Beans.get(InvoicePrintService.class)
|
||||||
|
.prepareReportSettings(invoice, reportType, format, locale);
|
||||||
|
|
||||||
logger.debug("Printing " + name);
|
logger.debug("Printing " + name);
|
||||||
|
|
||||||
response.setView(ActionView.define(name).add("html", reportSettings.generate().getFileLink()).map());
|
response.setView(
|
||||||
|
ActionView.define(name).add("html", reportSettings.generate().getFileLink()).map());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set default value for automatic invoice Journal = supplier Purchase Journal
|
* set default value for automatic invoice Journal = supplier Purchase Journal
|
||||||
*
|
*
|
||||||
@@ -1083,7 +1099,5 @@ public class InvoiceController {
|
|||||||
response.setValue("journal", journal);
|
response.setValue("journal", journal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -403,22 +403,24 @@ public class InvoiceLineController {
|
|||||||
response.setValue("fixedAssetCategory", fixedAssetCategory);
|
response.setValue("fixedAssetCategory", fixedAssetCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateQtyUg(ActionRequest request, ActionResponse response) throws AxelorException {
|
public void updateQtyUg(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
Context context = request.getContext();
|
Context context = request.getContext();
|
||||||
InvoiceLine invoiceLine = context.asType(InvoiceLine.class);
|
InvoiceLine invoiceLine = context.asType(InvoiceLine.class);
|
||||||
|
|
||||||
BigDecimal qtyUg = invoiceLine.getProduct().getUg();
|
BigDecimal qtyUg = invoiceLine.getProduct().getUg();
|
||||||
BigDecimal qty = invoiceLine.getQty();
|
BigDecimal qty = invoiceLine.getQty();
|
||||||
BigDecimal totalQty = qty.add(qty.multiply(qtyUg).divide(new BigDecimal(100), 4,RoundingMode.HALF_EVEN));
|
BigDecimal totalQty =
|
||||||
|
qty.add(qty.multiply(qtyUg).divide(new BigDecimal(100), 4, RoundingMode.HALF_EVEN));
|
||||||
Product product = invoiceLine.getProduct();
|
Product product = invoiceLine.getProduct();
|
||||||
if (product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0) {
|
if (product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
BigDecimal ug = invoiceLine.getProduct().getUg().divide(new BigDecimal(100), 10, RoundingMode.HALF_EVEN);
|
BigDecimal ug =
|
||||||
BigDecimal ugAmount = ug.divide(ug.add(BigDecimal.ONE),10, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100));
|
invoiceLine.getProduct().getUg().divide(new BigDecimal(100), 10, RoundingMode.HALF_EVEN);
|
||||||
|
BigDecimal ugAmount =
|
||||||
|
ug.divide(ug.add(BigDecimal.ONE), 10, RoundingMode.HALF_EVEN)
|
||||||
|
.multiply(new BigDecimal(100));
|
||||||
response.setValue("discountTypeSelect", 1);
|
response.setValue("discountTypeSelect", 1);
|
||||||
response.setValue("discountAmount", ugAmount);
|
response.setValue("discountAmount", ugAmount);
|
||||||
response.setValue("qty", totalQty);
|
response.setValue("qty", totalQty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,29 @@
|
|||||||
package com.axelor.apps.account.web;
|
package com.axelor.apps.account.web;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.axelor.apps.account.db.Invoice;
|
import com.axelor.apps.account.db.Invoice;
|
||||||
import com.axelor.apps.account.db.InvoiceTemplate;
|
import com.axelor.apps.account.db.InvoiceTemplate;
|
||||||
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
|
||||||
import com.axelor.apps.account.db.repo.InvoiceTemplateRepository;
|
import com.axelor.apps.account.db.repo.InvoiceTemplateRepository;
|
||||||
import com.axelor.apps.account.service.InvoiceTemplateService;
|
import com.axelor.apps.account.service.InvoiceTemplateService;
|
||||||
import com.axelor.apps.account.service.invoice.print.InvoicePrintService;
|
|
||||||
import com.axelor.apps.base.db.repo.LanguageRepository;
|
|
||||||
import com.axelor.apps.report.engine.ReportSettings;
|
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.i18n.I18n;
|
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.meta.schema.actions.ActionView;
|
import com.axelor.meta.schema.actions.ActionView;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import com.axelor.rpc.Context;
|
import com.axelor.rpc.Context;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class InvoiceTemplateControlller {
|
public class InvoiceTemplateControlller {
|
||||||
|
|
||||||
public void showInvoice2(ActionRequest request, ActionResponse response)
|
public void showInvoice2(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
throws AxelorException {
|
|
||||||
|
|
||||||
Context context = request.getContext();
|
Context context = request.getContext();
|
||||||
|
|
||||||
InvoiceTemplate invoiceTemplate = Beans.get(InvoiceTemplateRepository.class)
|
InvoiceTemplate invoiceTemplate =
|
||||||
|
Beans.get(InvoiceTemplateRepository.class)
|
||||||
.find(Long.parseLong(context.get("id").toString()));
|
.find(Long.parseLong(context.get("id").toString()));
|
||||||
|
|
||||||
|
Invoice invoice =
|
||||||
Invoice invoice = Beans.get(InvoiceTemplateService.class).generateInvoiceFromTemplate(invoiceTemplate);
|
Beans.get(InvoiceTemplateService.class).generateInvoiceFromTemplate(invoiceTemplate);
|
||||||
|
|
||||||
System.out.println("*********************Invoice***********************");
|
System.out.println("*********************Invoice***********************");
|
||||||
System.out.println(invoice);
|
System.out.println(invoice);
|
||||||
@@ -46,7 +39,5 @@ public class InvoiceTemplateControlller {
|
|||||||
.context("_operationTypeSelect", invoice.getOperationTypeSelect())
|
.context("_operationTypeSelect", invoice.getOperationTypeSelect())
|
||||||
.context("todayDate", LocalDate.now())
|
.context("todayDate", LocalDate.now())
|
||||||
.map());
|
.map());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ public class PaymentVoucherController {
|
|||||||
if (Strings.isNullOrEmpty(paymentVoucher.getRef())) {
|
if (Strings.isNullOrEmpty(paymentVoucher.getRef())) {
|
||||||
if (paymentVoucher.getOperationTypeSelect() == 9) {
|
if (paymentVoucher.getOperationTypeSelect() == 9) {
|
||||||
response.setValue(
|
response.setValue(
|
||||||
"ref", Beans.get(SequenceService.class).getSequenceNumber("CashSequence", paymentVoucher.getCompany()));
|
"ref",
|
||||||
|
Beans.get(SequenceService.class)
|
||||||
|
.getSequenceNumber("CashSequence", paymentVoucher.getCompany()));
|
||||||
} else {
|
} else {
|
||||||
response.setValue(
|
response.setValue(
|
||||||
"ref", Beans.get(PaymentVoucherSequenceService.class).getReference(paymentVoucher));
|
"ref", Beans.get(PaymentVoucherSequenceService.class).getReference(paymentVoucher));
|
||||||
@@ -214,7 +216,8 @@ public class PaymentVoucherController {
|
|||||||
paymentVoucher,
|
paymentVoucher,
|
||||||
rejectionInstance);
|
rejectionInstance);
|
||||||
|
|
||||||
PaymentVoucher paymentVoucher2 =Beans.get(PaymentVoucherConfirmService.class)
|
PaymentVoucher paymentVoucher2 =
|
||||||
|
Beans.get(PaymentVoucherConfirmService.class)
|
||||||
.rejectPaymentVoucher(paymentVoucher, rejectionRaison);
|
.rejectPaymentVoucher(paymentVoucher, rejectionRaison);
|
||||||
|
|
||||||
// response.setReload(true);
|
// response.setReload(true);
|
||||||
@@ -327,9 +330,24 @@ public class PaymentVoucherController {
|
|||||||
if (!Strings.isNullOrEmpty(paymentVoucher.getReceiptNo())) {
|
if (!Strings.isNullOrEmpty(paymentVoucher.getReceiptNo())) {
|
||||||
name += " " + paymentVoucher.getReceiptNo();
|
name += " " + paymentVoucher.getReceiptNo();
|
||||||
}
|
}
|
||||||
|
String reportType = IReport.PAYMENT_VOUCHER;
|
||||||
|
|
||||||
|
System.out.println("mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm");
|
||||||
|
System.out.println(paymentVoucher.getOperationTypeSelect());
|
||||||
|
System.out.println(paymentVoucher.getDebitCreditSelect());
|
||||||
|
System.out.println(paymentVoucher.getOperationTypeSelect() == 9);
|
||||||
|
System.out.println(paymentVoucher.getDebitCreditSelect() == "1");
|
||||||
|
|
||||||
|
if(paymentVoucher.getOperationTypeSelect() == 9){
|
||||||
|
if(paymentVoucher.getDebitCreditSelect() == "1"){
|
||||||
|
reportType = "CashPaymentRequestDebit.rptdesign";
|
||||||
|
}else if(paymentVoucher.getDebitCreditSelect() == "2"){
|
||||||
|
reportType = "CashPaymentRequestCredit.rptdesign";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String fileLink =
|
String fileLink =
|
||||||
ReportFactory.createReport(IReport.PAYMENT_VOUCHER, name + "-${date}")
|
ReportFactory.createReport(reportType, name + "-${date}")
|
||||||
.addParam("PaymentVoucherId", paymentVoucher.getId())
|
.addParam("PaymentVoucherId", paymentVoucher.getId())
|
||||||
.generate()
|
.generate()
|
||||||
.getFileLink();
|
.getFileLink();
|
||||||
@@ -380,7 +398,8 @@ public class PaymentVoucherController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void confirmMultipleVoucher(ActionRequest request,ActionResponse response) throws AxelorException {
|
public void confirmMultipleVoucher(ActionRequest request, ActionResponse response)
|
||||||
|
throws AxelorException {
|
||||||
List<PaymentVoucher> voucherList = new ArrayList<>();
|
List<PaymentVoucher> voucherList = new ArrayList<>();
|
||||||
List<PayVoucherElementToPay> elementToPays = new ArrayList<>();
|
List<PayVoucherElementToPay> elementToPays = new ArrayList<>();
|
||||||
|
|
||||||
@@ -388,11 +407,14 @@ public class PaymentVoucherController {
|
|||||||
List<Integer> idList = (List<Integer>) request.getContext().get("_ids");
|
List<Integer> idList = (List<Integer>) request.getContext().get("_ids");
|
||||||
|
|
||||||
for (Integer id : idList) {
|
for (Integer id : idList) {
|
||||||
PaymentVoucher paymentVoucher = Beans.get(PaymentVoucherRepository.class).find(id.longValue());
|
PaymentVoucher paymentVoucher =
|
||||||
|
Beans.get(PaymentVoucherRepository.class).find(id.longValue());
|
||||||
voucherList.add(paymentVoucher);
|
voucherList.add(paymentVoucher);
|
||||||
elementToPays.addAll(paymentVoucher.getPayVoucherElementToPayList());
|
elementToPays.addAll(paymentVoucher.getPayVoucherElementToPayList());
|
||||||
}
|
}
|
||||||
Move move = Beans.get(PaymentVoucherConfirmService.class).confirmMultipleVoucher(voucherList, elementToPays,true);
|
Move move =
|
||||||
|
Beans.get(PaymentVoucherConfirmService.class)
|
||||||
|
.confirmMultipleVoucher(voucherList, elementToPays, true);
|
||||||
|
|
||||||
response.setView(
|
response.setView(
|
||||||
ActionView.define(I18n.get("Move"))
|
ActionView.define(I18n.get("Move"))
|
||||||
@@ -403,7 +425,8 @@ public class PaymentVoucherController {
|
|||||||
.map());
|
.map());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVoucherData(ActionRequest request,ActionResponse response) throws AxelorException {
|
public void getVoucherData(ActionRequest request, ActionResponse response)
|
||||||
|
throws AxelorException {
|
||||||
List<PaymentVoucher> voucherList = new ArrayList<>();
|
List<PaymentVoucher> voucherList = new ArrayList<>();
|
||||||
List<PayVoucherElementToPay> elementToPays = new ArrayList<>();
|
List<PayVoucherElementToPay> elementToPays = new ArrayList<>();
|
||||||
|
|
||||||
@@ -419,30 +442,39 @@ public class PaymentVoucherController {
|
|||||||
BigDecimal totalRemainingAmountAfterPaymentRefund = BigDecimal.ZERO;
|
BigDecimal totalRemainingAmountAfterPaymentRefund = BigDecimal.ZERO;
|
||||||
|
|
||||||
for (Integer id : idList) {
|
for (Integer id : idList) {
|
||||||
PaymentVoucher paymentVoucher = Beans.get(PaymentVoucherRepository.class).find(id.longValue());
|
PaymentVoucher paymentVoucher =
|
||||||
|
Beans.get(PaymentVoucherRepository.class).find(id.longValue());
|
||||||
voucherList.add(paymentVoucher);
|
voucherList.add(paymentVoucher);
|
||||||
elementToPays.addAll(paymentVoucher.getPayVoucherElementToPayList());
|
elementToPays.addAll(paymentVoucher.getPayVoucherElementToPayList());
|
||||||
}
|
}
|
||||||
|
|
||||||
totalVoucher = voucherList.stream().map(t -> t.getPaidAmount()).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
totalVoucher =
|
||||||
|
voucherList
|
||||||
|
.stream()
|
||||||
|
.map(t -> t.getPaidAmount())
|
||||||
|
.reduce(BigDecimal::add)
|
||||||
|
.orElse(BigDecimal.ZERO);
|
||||||
|
|
||||||
for (PayVoucherElementToPay elementPay : elementToPays) {
|
for (PayVoucherElementToPay elementPay : elementToPays) {
|
||||||
|
|
||||||
Invoice invoice = elementPay.getMoveLine().getMove().getInvoice();
|
Invoice invoice = elementPay.getMoveLine().getMove().getInvoice();
|
||||||
|
|
||||||
if( invoice.getOperationSubTypeSelect() == InvoiceRepository.OPERATION_SUB_TYPE_FINANCIAL_REFUNDS
|
if (invoice.getOperationSubTypeSelect()
|
||||||
|| invoice.getOperationSubTypeSelect() == InvoiceRepository.OPERATION_TYPE_SUPPLIER_REFUND){
|
== InvoiceRepository.OPERATION_SUB_TYPE_FINANCIAL_REFUNDS
|
||||||
|
|| invoice.getOperationSubTypeSelect()
|
||||||
|
== InvoiceRepository.OPERATION_TYPE_SUPPLIER_REFUND) {
|
||||||
totalImputedAmountRefund = totalImputedAmount.add(elementPay.getAmountToPay());
|
totalImputedAmountRefund = totalImputedAmount.add(elementPay.getAmountToPay());
|
||||||
totalRemainingAmountAfterPaymentRefund = totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
totalRemainingAmountAfterPaymentRefund =
|
||||||
|
totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
||||||
totalAmountRefund = totalAmount.add(elementPay.getTotalAmount());
|
totalAmountRefund = totalAmount.add(elementPay.getTotalAmount());
|
||||||
} else {
|
} else {
|
||||||
totalImputedAmount = totalImputedAmount.add(elementPay.getAmountToPay());
|
totalImputedAmount = totalImputedAmount.add(elementPay.getAmountToPay());
|
||||||
totalRemainingAmountAfterPayment = totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
totalRemainingAmountAfterPayment =
|
||||||
|
totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
||||||
totalAmount = totalAmount.add(elementPay.getTotalAmount());
|
totalAmount = totalAmount.add(elementPay.getTotalAmount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
response.setView(
|
response.setView(
|
||||||
ActionView.define("Calculation")
|
ActionView.define("Calculation")
|
||||||
.model(Wizard.class.getName())
|
.model(Wizard.class.getName())
|
||||||
@@ -457,9 +489,36 @@ public class PaymentVoucherController {
|
|||||||
.context("_totalRemainingAmountAfterPayment", totalRemainingAmountAfterPayment)
|
.context("_totalRemainingAmountAfterPayment", totalRemainingAmountAfterPayment)
|
||||||
.context("_totalAmount", totalAmount)
|
.context("_totalAmount", totalAmount)
|
||||||
.context("_totalImputedAmountRefund", totalImputedAmountRefund)
|
.context("_totalImputedAmountRefund", totalImputedAmountRefund)
|
||||||
.context("_totalRemainingAmountAfterPaymentRefund", totalRemainingAmountAfterPaymentRefund)
|
.context(
|
||||||
|
"_totalRemainingAmountAfterPaymentRefund", totalRemainingAmountAfterPaymentRefund)
|
||||||
.context("_totalAmountRefund", totalAmountRefund)
|
.context("_totalAmountRefund", totalAmountRefund)
|
||||||
.map());
|
.map());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validateCashPaymentVoucher(
|
||||||
|
ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
|
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
|
||||||
|
paymentVoucher = Beans.get(PaymentVoucherRepository.class).find(paymentVoucher.getId());
|
||||||
|
|
||||||
|
try {
|
||||||
|
Beans.get(PaymentVoucherConfirmService.class).validateCashPaymentVoucher(paymentVoucher);
|
||||||
|
response.setReload(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void cancelCashPaymentVoucher(
|
||||||
|
ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
|
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
|
||||||
|
paymentVoucher = Beans.get(PaymentVoucherRepository.class).find(paymentVoucher.getId());
|
||||||
|
|
||||||
|
try {
|
||||||
|
Beans.get(PaymentVoucherConfirmService.class).cancelCashPaymentVoucher(paymentVoucher);
|
||||||
|
response.setReload(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ package com.axelor.apps.account.web;
|
|||||||
import com.axelor.apps.account.db.Reconcile;
|
import com.axelor.apps.account.db.Reconcile;
|
||||||
import com.axelor.apps.account.db.repo.ReconcileRepository;
|
import com.axelor.apps.account.db.repo.ReconcileRepository;
|
||||||
import com.axelor.apps.account.service.ReconcileService;
|
import com.axelor.apps.account.service.ReconcileService;
|
||||||
|
import com.axelor.apps.account.service.ReconcileServiceImpl;
|
||||||
import com.axelor.exception.service.TraceBackService;
|
import com.axelor.exception.service.TraceBackService;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
@@ -43,6 +44,20 @@ public class ReconcileController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unreconcile button
|
||||||
|
public void unreconcile2(ActionRequest request, ActionResponse response) {
|
||||||
|
|
||||||
|
Reconcile reconcile = request.getContext().asType(Reconcile.class);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Beans.get(ReconcileServiceImpl.class)
|
||||||
|
.unreconcile2(Beans.get(ReconcileRepository.class).find(reconcile.getId()));
|
||||||
|
response.setReload(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reconcile button
|
// Reconcile button
|
||||||
public void reconcile(ActionRequest request, ActionResponse response) {
|
public void reconcile(ActionRequest request, ActionResponse response) {
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ public class ImportPaymentVoucher {
|
|||||||
PayVoucherDueElement payVoucherDueElement =
|
PayVoucherDueElement payVoucherDueElement =
|
||||||
paymentVoucherLoadService.createPayVoucherDueElement(moveLineToPay);
|
paymentVoucherLoadService.createPayVoucherDueElement(moveLineToPay);
|
||||||
paymentVoucher.addPayVoucherElementToPayListItem(
|
paymentVoucher.addPayVoucherElementToPayListItem(
|
||||||
paymentVoucherLoadService.createPayVoucherElementToPay(payVoucherDueElement, 1,paymentVoucher.getRemainingAmount()));
|
paymentVoucherLoadService.createPayVoucherElementToPay(
|
||||||
|
payVoucherDueElement, 1, paymentVoucher.getRemainingAmount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paymentVoucher.getStatusSelect() == PaymentVoucherRepository.STATUS_CONFIRMED) {
|
if (paymentVoucher.getStatusSelect() == PaymentVoucherRepository.STATUS_CONFIRMED) {
|
||||||
|
|||||||
@@ -51,6 +51,8 @@
|
|||||||
|
|
||||||
<string name="statusSelectAccount" title="Statuses to take into account" />
|
<string name="statusSelectAccount" title="Statuses to take into account" />
|
||||||
|
|
||||||
|
<many-to-many name="productCategorySet" ref="com.axelor.apps.base.db.FamilleProduit" title="Product category" />
|
||||||
|
|
||||||
<unique-constraint columns="ref,company"/>
|
<unique-constraint columns="ref,company"/>
|
||||||
|
|
||||||
<extra-code><![CDATA[
|
<extra-code><![CDATA[
|
||||||
|
|||||||
@@ -8,10 +8,60 @@
|
|||||||
<entity name="AnalyticAccount" lang="java">
|
<entity name="AnalyticAccount" lang="java">
|
||||||
|
|
||||||
<string name="code" title="Code" required="true" />
|
<string name="code" title="Code" required="true" />
|
||||||
<string name="name" title="Name" required="true"/>
|
<string name="name" title="Name"
|
||||||
<many-to-one name="analyticAxis" ref="com.axelor.apps.account.db.AnalyticAxis" title="Analytic axis"/>
|
required="true" />
|
||||||
<many-to-one name="parent" ref="com.axelor.apps.account.db.AnalyticAccount" title="Parent Analytic Acc."/>
|
<many-to-one name="analyticAxis"
|
||||||
<unique-constraint columns="code,name,analyticAxis"/>
|
ref="com.axelor.apps.account.db.AnalyticAxis" title="Analytic axis" />
|
||||||
|
<many-to-one
|
||||||
|
name="parent" ref="com.axelor.apps.account.db.AnalyticAccount" title="Parent Analytic Acc." />
|
||||||
|
|
||||||
|
<string
|
||||||
|
name="fullCode">
|
||||||
|
<![CDATA[
|
||||||
|
String fullName = "";
|
||||||
|
if(code != null ){
|
||||||
|
fullName += code;
|
||||||
|
}
|
||||||
|
if(parent != null) {
|
||||||
|
fullName = parent.getCode() + "/" + fullName;
|
||||||
|
if(parent.getParent() != null) {
|
||||||
|
fullName = parent.getParent().getCode() + "/" + fullName;
|
||||||
|
if(parent.getParent().getParent() != null) {
|
||||||
|
fullName = parent.getParent().getParent().getCode() + "/" + fullName;
|
||||||
|
if(parent.getParent().getParent().getParent() != null) {
|
||||||
|
fullName = parent.getParent().getParent().getParent().getCode() + "/" + fullName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fullName;
|
||||||
|
]]>
|
||||||
|
</string>
|
||||||
|
|
||||||
|
<string
|
||||||
|
name="fullName" namecolumn="true">
|
||||||
|
<![CDATA[
|
||||||
|
String fullName = "";
|
||||||
|
if(name != null ){
|
||||||
|
fullName += name;
|
||||||
|
}
|
||||||
|
if(parent != null) {
|
||||||
|
fullName = parent.getName() + "/" + fullName;
|
||||||
|
if(parent.getParent() != null) {
|
||||||
|
fullName = parent.getParent().getName() + "/" + fullName;
|
||||||
|
if(parent.getParent().getParent() != null) {
|
||||||
|
fullName = parent.getParent().getParent().getName() + "/" + fullName;
|
||||||
|
if(parent.getParent().getParent().getParent() != null) {
|
||||||
|
fullName = parent.getParent().getParent().getParent().getName() + "/" + fullName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fullName;
|
||||||
|
]]>
|
||||||
|
</string>
|
||||||
|
|
||||||
|
<unique-constraint columns="code,name,analyticAxis,parent" />
|
||||||
</entity>
|
</entity>
|
||||||
|
|
||||||
</domain-models>
|
</domain-models>
|
||||||
@@ -8,10 +8,12 @@
|
|||||||
<entity name="AppBudget" lang="java" extends="App">
|
<entity name="AppBudget" lang="java" extends="App">
|
||||||
<boolean name="checkAvailableBudget" title="Check Available Budget"/>
|
<boolean name="checkAvailableBudget" title="Check Available Budget"/>
|
||||||
<boolean name="manageMultiBudget" title="Manage multi budgets on lines"/>
|
<boolean name="manageMultiBudget" title="Manage multi budgets on lines"/>
|
||||||
|
<boolean name="budgetRequiredOnPO" title="Budget required on purchase order lines"/>
|
||||||
|
|
||||||
<track>
|
<track>
|
||||||
<field name="checkAvailableBudget" on="UPDATE"/>
|
<field name="checkAvailableBudget" on="UPDATE"/>
|
||||||
<field name="manageMultiBudget" on="UPDATE"/>
|
<field name="manageMultiBudget" on="UPDATE"/>
|
||||||
|
<field name="budgetRequiredOnPO" on="UPDATE"/>
|
||||||
</track>
|
</track>
|
||||||
</entity>
|
</entity>
|
||||||
</domain-models>
|
</domain-models>
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
<integer name="periodDurationSelect" title="Period duration" selection="account.year.period.duration.select"/>
|
<integer name="periodDurationSelect" title="Period duration" selection="account.year.period.duration.select"/>
|
||||||
<decimal name="amountForGeneration" title="Amount for each line"/>
|
<decimal name="amountForGeneration" title="Amount for each line"/>
|
||||||
<boolean name="checkAvailableBudget" title="Check available budget"/>
|
<boolean name="checkAvailableBudget" title="Check available budget"/>
|
||||||
|
<many-to-one name="analyticAccount" ref="com.axelor.apps.account.db.AnalyticAccount" title="Analytic account"/>
|
||||||
|
|
||||||
|
|
||||||
|
<finder-method name="findByAnalyticAccount" using="analyticAccount"/>
|
||||||
|
|
||||||
<extra-code><![CDATA[
|
<extra-code><![CDATA[
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
<many-to-one name="invoiceLine" ref="com.axelor.apps.account.db.InvoiceLine"/>
|
<many-to-one name="invoiceLine" ref="com.axelor.apps.account.db.InvoiceLine"/>
|
||||||
<many-to-one name="budget" ref="com.axelor.apps.account.db.Budget" title="Budget" required="true"/>
|
<many-to-one name="budget" ref="com.axelor.apps.account.db.Budget" title="Budget" required="true"/>
|
||||||
<decimal name="amount" title="Amount" precision="20" scale="2"/>
|
<decimal name="amount" title="Amount" precision="20" scale="2"/>
|
||||||
|
<many-to-one name="analyticAccount" ref="com.axelor.apps.account.db.AnalyticAccount" title="Analytic Acc."/>
|
||||||
|
<many-to-one name="analyticMoveLine" ref="com.axelor.apps.account.db.AnalyticMoveLine" title="Analytic move line"/>
|
||||||
</entity>
|
</entity>
|
||||||
|
|
||||||
</domain-models>
|
</domain-models>
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
<entity name="BudgetLine" lang="java" cacheable="true">
|
<entity name="BudgetLine" lang="java" cacheable="true">
|
||||||
|
|
||||||
|
<many-to-one name="analyticAccount" ref="com.axelor.apps.account.db.AnalyticAccount" title="Analytic account"/>
|
||||||
<date name="fromDate" title="From"/>
|
<date name="fromDate" title="From"/>
|
||||||
<date name="toDate" title="To"/>
|
<date name="toDate" title="To"/>
|
||||||
<many-to-one name="budget" ref="com.axelor.apps.account.db.Budget" />
|
<many-to-one name="budget" ref="com.axelor.apps.account.db.Budget" />
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||||
|
|
||||||
|
<module name="account" package="com.axelor.apps.account.db"/>
|
||||||
|
|
||||||
|
<entity name="CashAccountConfig" lang="java">
|
||||||
|
|
||||||
|
<string name="fullName" title="Full name" namecolumn="true"/>
|
||||||
|
<many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
|
||||||
|
<many-to-one name="account" ref="Account" required="true" title="Accounting.Account" initParam="true"/>
|
||||||
|
<string name="description" title="Description" large="true"/>
|
||||||
|
|
||||||
|
<track>
|
||||||
|
<field name="fullName"/>
|
||||||
|
<field name="company"/>
|
||||||
|
<field name="account"/>
|
||||||
|
<field name="description"/>
|
||||||
|
</track>
|
||||||
|
</entity>
|
||||||
|
</domain-models>
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
<string name="theoricalSoldeInWords" title="Theorical solde in words"/>
|
<string name="theoricalSoldeInWords" title="Theorical solde in words"/>
|
||||||
<decimal name="gap" title="Gap" />
|
<decimal name="gap" title="Gap" />
|
||||||
<decimal name="numbeLastCashPiece" title="Number of last cash piece" />
|
<decimal name="numbeLastCashPiece" title="Number of last cash piece" />
|
||||||
|
<string name="numbeLastCashPieceStr" title="Last cash piece seq" />
|
||||||
|
|
||||||
<many-to-one name="approvedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Approved by"/>
|
<many-to-one name="approvedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Approved by"/>
|
||||||
<datetime name="approvalDate" title="Approval date" readonly="true"/>
|
<datetime name="approvalDate" title="Approval date" readonly="true"/>
|
||||||
@@ -26,6 +27,9 @@
|
|||||||
<many-to-one name="valdiatedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Validated by"/>
|
<many-to-one name="valdiatedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Validated by"/>
|
||||||
<datetime name="validattionDate" title="Validation date" readonly="true"/>
|
<datetime name="validattionDate" title="Validation date" readonly="true"/>
|
||||||
|
|
||||||
|
<many-to-one name="confirmedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Confirmed by"/>
|
||||||
|
<datetime name="confirmationDate" title="Confirmation date" readonly="true"/>
|
||||||
|
|
||||||
<decimal name="totalCoinsAmount" title="Total coins amount" />
|
<decimal name="totalCoinsAmount" title="Total coins amount" />
|
||||||
<decimal name="totalBankNotesAmount" title="Total bank notes amount" />
|
<decimal name="totalBankNotesAmount" title="Total bank notes amount" />
|
||||||
<decimal name="totalCash" title="Total cash" />
|
<decimal name="totalCash" title="Total cash" />
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||||
|
|
||||||
|
<module name="account" package="com.axelor.apps.account.db"/>
|
||||||
|
|
||||||
|
<entity name="CashRegister" lang="java">
|
||||||
|
|
||||||
|
<string name="ref" title="Reference" namecolumn="true" required="false"/>
|
||||||
|
<integer name="statusSelect" title="Status" default="1" readonly="true" selection="account.cash.register.status.select"/>
|
||||||
|
|
||||||
|
<decimal name="theoricalSolde" title="Theorical Solde"/>
|
||||||
|
<decimal name="physicalSolde" title="Physical Solde"/>
|
||||||
|
<many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
|
||||||
|
|
||||||
|
<string name="description" title="Description" large="true"/>
|
||||||
|
|
||||||
|
<many-to-one name="openedBy" ref="com.axelor.auth.db.User" readonly="true" title="Opened by"/>
|
||||||
|
<datetime name="openedAt" title="Opened at" readonly="true"/>
|
||||||
|
|
||||||
|
<many-to-one name="closedBy" ref="com.axelor.auth.db.User" readonly="true" title="Closed by"/>
|
||||||
|
<datetime name="closedAt" title="Closed at" readonly="true"/>
|
||||||
|
|
||||||
|
|
||||||
|
<track>
|
||||||
|
<field name="ref"/>
|
||||||
|
<field name="statusSelect"/>
|
||||||
|
<field name="theoricalSolde"/>
|
||||||
|
<field name="physicalSolde"/>
|
||||||
|
</track>
|
||||||
|
|
||||||
|
</entity>
|
||||||
|
</domain-models>
|
||||||
@@ -62,8 +62,11 @@
|
|||||||
<many-to-one name="requestedByUser" ref="com.axelor.auth.db.User" readonly="true" title="requested by"/>
|
<many-to-one name="requestedByUser" ref="com.axelor.auth.db.User" readonly="true" title="requested by"/>
|
||||||
<date name="requestDate" title="request Date" />
|
<date name="requestDate" title="request Date" />
|
||||||
|
|
||||||
<many-to-one name="recipientUser" ref="com.axelor.auth.db.User" readonly="true" title="recipient"/>
|
<many-to-one name="recipientUser" ref="com.axelor.auth.db.User" title="recipient"/>
|
||||||
|
|
||||||
|
<many-to-one name="recipientPartner" ref="com.axelor.apps.base.db.Partner" title="recipient partner"/>
|
||||||
|
|
||||||
|
<string name="recipientPartnerStr" title="recipient partner"/>
|
||||||
|
|
||||||
<date name="invoiceDate" title="invoice Date" />
|
<date name="invoiceDate" title="invoice Date" />
|
||||||
<date name="dueDate" title="Due Date" />
|
<date name="dueDate" title="Due Date" />
|
||||||
@@ -106,6 +109,13 @@
|
|||||||
|
|
||||||
<string name="debitCreditSelect" title="Debit/Credit" selection="move.voucher.debit.credit.select"/>
|
<string name="debitCreditSelect" title="Debit/Credit" selection="move.voucher.debit.credit.select"/>
|
||||||
|
|
||||||
|
<boolean name="cashFunding" default="false" title="Cash funding"/>
|
||||||
|
|
||||||
|
<many-to-one ref="CashAccountConfig" name="cashAccountConfig" title="Cash account config"/>
|
||||||
|
|
||||||
|
<decimal name="initialTheoricalSolde" title="Intial theoretical solde"/>
|
||||||
|
<decimal name="theoricalSolde" title="Theoretical solde"/>
|
||||||
|
|
||||||
<unique-constraint columns="ref,company"/>
|
<unique-constraint columns="ref,company"/>
|
||||||
<unique-constraint columns="receiptNo,company"/>
|
<unique-constraint columns="receiptNo,company"/>
|
||||||
|
|
||||||
@@ -135,6 +145,7 @@
|
|||||||
|
|
||||||
<track>
|
<track>
|
||||||
<field name="statusSelect"/>
|
<field name="statusSelect"/>
|
||||||
|
<field name="cashStatusSelect"/>
|
||||||
<message if="true" on="CREATE">Voucher created</message>
|
<message if="true" on="CREATE">Voucher created</message>
|
||||||
<message if="statusSelect == 3" tag="important">Confirmed</message>
|
<message if="statusSelect == 3" tag="important">Confirmed</message>
|
||||||
</track>
|
</track>
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
</ex-property>
|
</ex-property>
|
||||||
</list-property>
|
</list-property>
|
||||||
<property name="odaDriverClass">org.postgresql.Driver</property>
|
<property name="odaDriverClass">org.postgresql.Driver</property>
|
||||||
<property name="odaURL">jdbc:postgresql://localhost:5432/bdd_sophal</property>
|
<property name="odaURL">jdbc:postgresql://localhost:5432/bdd_live2</property>
|
||||||
<property name="odaUser">postgres</property>
|
<property name="odaUser">postgres</property>
|
||||||
<encrypted-property name="odaPassword" encryptionID="base64">SWpsdj1iQl5oU0dAUFYkLDlqa2hIek8qNzQ=</encrypted-property>
|
<encrypted-property name="odaPassword" encryptionID="base64">SWpsdj1iQl5oU0dAUFYkLDlqa2hIek8qNzQ=</encrypted-property>
|
||||||
</oda-data-source>
|
</oda-data-source>
|
||||||
@@ -187,6 +187,24 @@
|
|||||||
<text-property name="displayName">product_code</text-property>
|
<text-property name="displayName">product_code</text-property>
|
||||||
<text-property name="heading">product_code</text-property>
|
<text-property name="heading">product_code</text-property>
|
||||||
</structure>
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="columnName">product_name</property>
|
||||||
|
<property name="analysis">dimension</property>
|
||||||
|
<text-property name="displayName">product_name</text-property>
|
||||||
|
<text-property name="heading">product_name</text-property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="columnName">category</property>
|
||||||
|
<property name="analysis">dimension</property>
|
||||||
|
<text-property name="displayName">category</text-property>
|
||||||
|
<text-property name="heading">category</text-property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="columnName">sub_category</property>
|
||||||
|
<property name="analysis">dimension</property>
|
||||||
|
<text-property name="displayName">sub_category</text-property>
|
||||||
|
<text-property name="heading">sub_category</text-property>
|
||||||
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="columnName">account_code</property>
|
<property name="columnName">account_code</property>
|
||||||
<property name="analysis">dimension</property>
|
<property name="analysis">dimension</property>
|
||||||
@@ -251,6 +269,26 @@
|
|||||||
<property name="isInput">true</property>
|
<property name="isInput">true</property>
|
||||||
<property name="isOutput">false</property>
|
<property name="isOutput">false</property>
|
||||||
</structure>
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">param_3</property>
|
||||||
|
<property name="paramName">AccountingReportId</property>
|
||||||
|
<property name="nativeName"></property>
|
||||||
|
<property name="dataType">decimal</property>
|
||||||
|
<property name="nativeDataType">-5</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
<property name="isInput">true</property>
|
||||||
|
<property name="isOutput">false</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">param_4</property>
|
||||||
|
<property name="paramName">AccountingReportId</property>
|
||||||
|
<property name="nativeName"></property>
|
||||||
|
<property name="dataType">decimal</property>
|
||||||
|
<property name="nativeDataType">-5</property>
|
||||||
|
<property name="position">4</property>
|
||||||
|
<property name="isInput">true</property>
|
||||||
|
<property name="isOutput">false</property>
|
||||||
|
</structure>
|
||||||
</list-property>
|
</list-property>
|
||||||
<structure name="cachedMetaData">
|
<structure name="cachedMetaData">
|
||||||
<list-property name="resultSet">
|
<list-property name="resultSet">
|
||||||
@@ -261,36 +299,51 @@
|
|||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
<property name="name">account_code</property>
|
<property name="name">product_name</property>
|
||||||
<property name="dataType">string</property>
|
<property name="dataType">string</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
|
<property name="name">category</property>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="position">4</property>
|
||||||
|
<property name="name">sub_category</property>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="position">5</property>
|
||||||
|
<property name="name">account_code</property>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="position">6</property>
|
||||||
<property name="name">initial_qty</property>
|
<property name="name">initial_qty</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">4</property>
|
<property name="position">7</property>
|
||||||
<property name="name">initial_value</property>
|
<property name="name">initial_value</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">5</property>
|
<property name="position">8</property>
|
||||||
<property name="name">qty_in</property>
|
<property name="name">qty_in</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">6</property>
|
<property name="position">9</property>
|
||||||
<property name="name">val_in</property>
|
<property name="name">val_in</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">7</property>
|
<property name="position">10</property>
|
||||||
<property name="name">qty_out</property>
|
<property name="name">qty_out</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">8</property>
|
<property name="position">11</property>
|
||||||
<property name="name">val_out</property>
|
<property name="name">val_out</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
</structure>
|
</structure>
|
||||||
@@ -308,48 +361,69 @@
|
|||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
|
<property name="name">product_name</property>
|
||||||
|
<property name="nativeName">product_name</property>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
<property name="nativeDataType">12</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="position">3</property>
|
||||||
|
<property name="name">category</property>
|
||||||
|
<property name="nativeName">category</property>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
<property name="nativeDataType">12</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="position">4</property>
|
||||||
|
<property name="name">sub_category</property>
|
||||||
|
<property name="nativeName">sub_category</property>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
<property name="nativeDataType">12</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="position">5</property>
|
||||||
<property name="name">account_code</property>
|
<property name="name">account_code</property>
|
||||||
<property name="nativeName">account_code</property>
|
<property name="nativeName">account_code</property>
|
||||||
<property name="dataType">string</property>
|
<property name="dataType">string</property>
|
||||||
<property name="nativeDataType">12</property>
|
<property name="nativeDataType">12</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">3</property>
|
<property name="position">6</property>
|
||||||
<property name="name">initial_qty</property>
|
<property name="name">initial_qty</property>
|
||||||
<property name="nativeName">initial_qty</property>
|
<property name="nativeName">initial_qty</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
<property name="nativeDataType">2</property>
|
<property name="nativeDataType">2</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">4</property>
|
<property name="position">7</property>
|
||||||
<property name="name">initial_value</property>
|
<property name="name">initial_value</property>
|
||||||
<property name="nativeName">initial_value</property>
|
<property name="nativeName">initial_value</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
<property name="nativeDataType">2</property>
|
<property name="nativeDataType">2</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">5</property>
|
<property name="position">8</property>
|
||||||
<property name="name">qty_in</property>
|
<property name="name">qty_in</property>
|
||||||
<property name="nativeName">qty_in</property>
|
<property name="nativeName">qty_in</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
<property name="nativeDataType">2</property>
|
<property name="nativeDataType">2</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">6</property>
|
<property name="position">9</property>
|
||||||
<property name="name">val_in</property>
|
<property name="name">val_in</property>
|
||||||
<property name="nativeName">val_in</property>
|
<property name="nativeName">val_in</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
<property name="nativeDataType">2</property>
|
<property name="nativeDataType">2</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">7</property>
|
<property name="position">10</property>
|
||||||
<property name="name">qty_out</property>
|
<property name="name">qty_out</property>
|
||||||
<property name="nativeName">qty_out</property>
|
<property name="nativeName">qty_out</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
<property name="nativeDataType">2</property>
|
<property name="nativeDataType">2</property>
|
||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="position">8</property>
|
<property name="position">11</property>
|
||||||
<property name="name">val_out</property>
|
<property name="name">val_out</property>
|
||||||
<property name="nativeName">val_out</property>
|
<property name="nativeName">val_out</property>
|
||||||
<property name="dataType">decimal</property>
|
<property name="dataType">decimal</property>
|
||||||
@@ -357,34 +431,54 @@
|
|||||||
</structure>
|
</structure>
|
||||||
</list-property>
|
</list-property>
|
||||||
<xml-property name="queryText"><![CDATA[select
|
<xml-property name="queryText"><![CDATA[select
|
||||||
COALESCE(s1.product_code,s2.product_code) as product_code,
|
COALESCE(s1.product_code,s2.productcode) as product_code,
|
||||||
|
s1.PRODUCT_NAME,
|
||||||
|
s1.category,
|
||||||
|
s1.sub_category,
|
||||||
coalesce(account_code,s2.code) as account_code,
|
coalesce(account_code,s2.code) as account_code,
|
||||||
coalesce(initial_qty,0) as initial_qty,
|
(coalesce(initial_qty,0)) as initial_qty,
|
||||||
coalesce(initial_value,0) as initial_value,
|
(coalesce(initial_value,0)) as initial_value,
|
||||||
coalesce(qty_in,0) as qty_in,
|
(coalesce(qty_in,0)) as qty_in,
|
||||||
coalesce(val_in,0) as val_in,
|
(coalesce(val_in,0)) as val_in,
|
||||||
coalesce(qty_out,0) as qty_out,
|
(coalesce(qty_out,0)) as qty_out,
|
||||||
coalesce(val_out,0) as val_out
|
(coalesce(val_out,0)) as val_out
|
||||||
from
|
from
|
||||||
(select
|
(SELECT *
|
||||||
_ACCOUNT.code as account_code,
|
FROM
|
||||||
_product.code as product_code,
|
(SELECT
|
||||||
sum(real_qty) as initial_qty,
|
_PRODUCT.ID AS PRODUCT_ID,
|
||||||
sum(real_qty) * avg(gap_value) as initial_value
|
_PRODUCT.name AS PRODUCT_NAME,
|
||||||
from account_accounting_report AccountingReport
|
_ACCOUNT.CODE AS ACCOUNT_CODE,
|
||||||
left join base_product _product on AccountingReport.id = ?
|
_PRODUCT.CODE AS PRODUCT_CODE,
|
||||||
left join stock_inventory_line inventory_line on inventory_line.product = _product.id
|
_famille.name as category,
|
||||||
left join stock_inventory inventory on inventory.id = inventory_line.inventory
|
_sous_famille.name as sub_category
|
||||||
LEFT JOIN ACCOUNT_ACCOUNT_MANAGEMENT _MANAGEMENT ON _MANAGEMENT.PRODUCT = _product.id
|
FROM BASE_PRODUCT _PRODUCT
|
||||||
|
LEFT JOIN ACCOUNT_ACCOUNT_MANAGEMENT _MANAGEMENT ON _MANAGEMENT.PRODUCT = _PRODUCT.ID
|
||||||
LEFT JOIN ACCOUNT_ACCOUNT _ACCOUNT ON _ACCOUNT.ID = _MANAGEMENT.STOCK_ACCOUNT
|
LEFT JOIN ACCOUNT_ACCOUNT _ACCOUNT ON _ACCOUNT.ID = _MANAGEMENT.STOCK_ACCOUNT
|
||||||
where (date_part('year',inventory.planned_start_datet) = 2022 or inventory.id is null)
|
left join base_famille_produit _famille on _famille.id = _product.famille_produit
|
||||||
and inventory.stock_location not in (5,6)
|
left join base_famille_produit _sous_famille on _sous_famille.id = _product.sous_famille_produit
|
||||||
group by _ACCOUNT.code,product_code
|
where (_famille.id is null or _famille.id in (select product_category_set from account_accounting_report_product_category_set where account_accounting_report = ?))
|
||||||
) as s1
|
) AS D1
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT INVENTORY_LINE.PRODUCT AS PRODUCT_ID,
|
||||||
|
SUM(REAL_QTY) AS INITIAL_QTY,
|
||||||
|
SUM(REAL_QTY) * AVG(GAP_VALUE) AS INITIAL_VALUE
|
||||||
|
FROM ACCOUNT_ACCOUNTING_REPORT ACCOUNTINGREPORT
|
||||||
|
left outer JOIN STOCK_INVENTORY_LINE INVENTORY_LINE ON ACCOUNTINGREPORT.ID = ?
|
||||||
|
LEFT JOIN STOCK_INVENTORY INVENTORY ON INVENTORY.ID = INVENTORY_LINE.INVENTORY
|
||||||
|
left join base_period _period on ACCOUNTINGREPORT.period = _period.id
|
||||||
|
left join base_year _year on _year.id = _period.year
|
||||||
|
left join base_period _period_inventory on inventory.period = _period_inventory.id
|
||||||
|
left join base_year _year_inventory on _year_inventory.id = _period_inventory.year
|
||||||
|
WHERE INVENTORY.ID IS NOT NULL and inventory.stock_location not in (5,6) AND cast(_year.code as decimal) = cast(_year_inventory.code as decimal) + 1
|
||||||
|
and (real_qty > 0 )
|
||||||
|
GROUP BY PRODUCT_ID) as D2 on D2.PRODUCT_ID = D1.PRODUCT_ID) as s1
|
||||||
full outer join
|
full outer join
|
||||||
(select a.CODE,
|
(select
|
||||||
|
a.CODE,
|
||||||
a.NAME,
|
a.NAME,
|
||||||
a.product_code,
|
coalesce(a.product_code,b.product_code) as productcode,
|
||||||
a.qty_in,
|
a.qty_in,
|
||||||
val_in,
|
val_in,
|
||||||
b.qty_out,
|
b.qty_out,
|
||||||
@@ -395,11 +489,11 @@ group by _ACCOUNT.code,product_code
|
|||||||
_PRODUCT.CODE as product_code,
|
_PRODUCT.CODE as product_code,
|
||||||
sum(real_qty) as qty_in,
|
sum(real_qty) as qty_in,
|
||||||
sum(case
|
sum(case
|
||||||
when _move.type_select = 3 and _move.partner != 853 then round(_LINE.UNIT_PRICE_UNTAXED,3) * _line.real_qty
|
when _move.type_select = 3 and _move.partner != 853 then round(_LINE.UNIT_PRICE_UNTAXED,2) * _line.real_qty
|
||||||
when _move.type_select = 3 and _move.partner = 853 then ROUND(_LINE.wap_price,3) * _line.real_qty
|
when _move.type_select = 3 and _move.partner = 853 then ROUND(_LINE.wap_price,2) * _line.real_qty
|
||||||
else 0 end) val_in
|
else 0 end) val_in
|
||||||
from account_accounting_report AccountingReport
|
from account_accounting_report AccountingReport
|
||||||
left outer join STOCK_STOCK_MOVE_LINE _LINE on AccountingReport.id = 9
|
left outer join STOCK_STOCK_MOVE_LINE _LINE on AccountingReport.id = ?
|
||||||
LEFT JOIN STOCK_STOCK_MOVE _MOVE ON _MOVE.ID = _LINE.STOCK_MOVE
|
LEFT JOIN STOCK_STOCK_MOVE _MOVE ON _MOVE.ID = _LINE.STOCK_MOVE
|
||||||
LEFT JOIN BASE_PRODUCT _PRODUCT ON _PRODUCT.ID = _LINE.PRODUCT
|
LEFT JOIN BASE_PRODUCT _PRODUCT ON _PRODUCT.ID = _LINE.PRODUCT
|
||||||
LEFT JOIN ACCOUNT_ACCOUNT_MANAGEMENT _MANAGEMENT ON _MANAGEMENT.PRODUCT = _LINE.PRODUCT
|
LEFT JOIN ACCOUNT_ACCOUNT_MANAGEMENT _MANAGEMENT ON _MANAGEMENT.PRODUCT = _LINE.PRODUCT
|
||||||
@@ -410,14 +504,16 @@ WHERE _MOVE.estimated_date >= AccountingReport.date_from AND _MOVE.estimated_da
|
|||||||
AND (_LINE.ARCHIVED IS NULL OR _LINE.ARCHIVED IS FALSE)
|
AND (_LINE.ARCHIVED IS NULL OR _LINE.ARCHIVED IS FALSE)
|
||||||
and _MOVE.type_select = 3
|
and _MOVE.type_select = 3
|
||||||
and (_MOVE.from_stock_location not in (5,6) and _MOVE.to_stock_location not in (5,6))
|
and (_MOVE.from_stock_location not in (5,6) and _MOVE.to_stock_location not in (5,6))
|
||||||
group by _ACCOUNT.CODE, _ACCOUNT.NAME,_PRODUCT.CODE) as a full outer join
|
group by _ACCOUNT.CODE, _ACCOUNT.NAME,_PRODUCT.CODE) as a
|
||||||
|
full outer join
|
||||||
(SELECT
|
(SELECT
|
||||||
_ACCOUNT.CODE,
|
_ACCOUNT.CODE,
|
||||||
_ACCOUNT.NAME,
|
_ACCOUNT.NAME,
|
||||||
_PRODUCT.CODE as product_code,
|
_PRODUCT.CODE as product_code,
|
||||||
sum(real_qty) as qty_out,
|
sum(real_qty) as qty_out,
|
||||||
sum(case
|
sum(case
|
||||||
when _move.type_select = 2 and _move.partner = 853 then round(_LINE.wap_price,3) * _line.real_qty
|
when _move.type_select = 2 and _move.partner = 853 then round(_LINE.wap_price,2) * _line.real_qty
|
||||||
|
when _move.type_select = 2 and _move.partner != 853 then round(_LINE.unit_price_untaxed,2) * _line.real_qty
|
||||||
else 0 end ) val_out
|
else 0 end ) val_out
|
||||||
from account_accounting_report AccountingReport
|
from account_accounting_report AccountingReport
|
||||||
left outer join STOCK_STOCK_MOVE_LINE _LINE on AccountingReport.id = ?
|
left outer join STOCK_STOCK_MOVE_LINE _LINE on AccountingReport.id = ?
|
||||||
@@ -432,8 +528,14 @@ WHERE _MOVE.estimated_date >= AccountingReport.date_from AND _MOVE.estimated_da
|
|||||||
and _MOVE.type_select = 2
|
and _MOVE.type_select = 2
|
||||||
and (_MOVE.from_stock_location not in (5,6) and _MOVE.to_stock_location not in (5,6))
|
and (_MOVE.from_stock_location not in (5,6) and _MOVE.to_stock_location not in (5,6))
|
||||||
group by _ACCOUNT.CODE, _ACCOUNT.NAME,_PRODUCT.CODE) as b on a.product_code = b.product_code
|
group by _ACCOUNT.CODE, _ACCOUNT.NAME,_PRODUCT.CODE) as b on a.product_code = b.product_code
|
||||||
order by a.code) as s2 on s1.product_code = s2.product_code
|
order by a.code)
|
||||||
where account_code like '3%']]></xml-property>
|
as s2 on s1.product_code = s2.productcode
|
||||||
|
where (coalesce(s1.product_code,s2.productcode) is not null ) and account_code like '3%'
|
||||||
|
and (coalesce(initial_qty,0) + coalesce(qty_in,0) + coalesce(qty_out,0) != 0 )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
]]></xml-property>
|
||||||
</oda-data-set>
|
</oda-data-set>
|
||||||
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="AccountingReportDS" id="489">
|
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="AccountingReportDS" id="489">
|
||||||
<property name="nullsOrdering">nulls lowest</property>
|
<property name="nullsOrdering">nulls lowest</property>
|
||||||
@@ -1735,7 +1837,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
</structure>
|
</structure>
|
||||||
<structure>
|
<structure>
|
||||||
<property name="name">sumSoldeQtyAgg</property>
|
<property name="name">sumSoldeQtyAgg</property>
|
||||||
<text-property name="displayName">sumSoldeQty</text-property>
|
<text-property name="displayName">sumSoldeVal</text-property>
|
||||||
<property name="dataType">float</property>
|
<property name="dataType">float</property>
|
||||||
<simple-property-list name="aggregateOn">
|
<simple-property-list name="aggregateOn">
|
||||||
<value>NewTableGroup1</value>
|
<value>NewTableGroup1</value>
|
||||||
@@ -1749,9 +1851,136 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
</list-property>
|
</list-property>
|
||||||
<property name="allowExport">true</property>
|
<property name="allowExport">true</property>
|
||||||
</structure>
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">Aggregation_6</property>
|
||||||
|
<text-property name="displayName">sumSoldeQty</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<simple-property-list name="aggregateOn">
|
||||||
|
<value>NewTableGroup1</value>
|
||||||
|
</simple-property-list>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation"] + row["Aggregation_2"] - row["Aggregation_4"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">product_name</property>
|
||||||
|
<text-property name="displayName">product_name</text-property>
|
||||||
|
<expression name="expression" type="javascript">dataSetRow["product_name"]</expression>
|
||||||
|
<property name="dataType">string</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumInitAll</property>
|
||||||
|
<text-property name="displayName">sumInitAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumInitValAll</property>
|
||||||
|
<text-property name="displayName">sumInitValAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation_1"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumQttInAll</property>
|
||||||
|
<text-property name="displayName">sumQtyInAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation_2"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumValInAll</property>
|
||||||
|
<text-property name="displayName">sumValInAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation_3"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumQtyOutAll</property>
|
||||||
|
<text-property name="displayName">sumQtyOutAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation_4"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumValOutAll</property>
|
||||||
|
<text-property name="displayName">sumValOutAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation_5"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumSoldeQtyAll</property>
|
||||||
|
<text-property name="displayName">sumSoldeQtyAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["Aggregation_6"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
|
<structure>
|
||||||
|
<property name="name">sumSoldeValAll</property>
|
||||||
|
<text-property name="displayName">sumSoldeValAll</text-property>
|
||||||
|
<property name="dataType">float</property>
|
||||||
|
<property name="aggregateFunction">SUM</property>
|
||||||
|
<list-property name="arguments">
|
||||||
|
<structure>
|
||||||
|
<property name="name">Expression</property>
|
||||||
|
<expression name="value" type="javascript">row["sumSoldeQtyAgg"]</expression>
|
||||||
|
</structure>
|
||||||
|
</list-property>
|
||||||
|
<property name="allowExport">true</property>
|
||||||
|
</structure>
|
||||||
</list-property>
|
</list-property>
|
||||||
<column id="4664"/>
|
<column id="4664"/>
|
||||||
<column id="4665"/>
|
<column id="4665"/>
|
||||||
|
<column id="5142"/>
|
||||||
<column id="4666"/>
|
<column id="4666"/>
|
||||||
<column id="4667"/>
|
<column id="4667"/>
|
||||||
<column id="4668"/>
|
<column id="4668"/>
|
||||||
@@ -1795,6 +2024,22 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<text-property name="text">CODE PRODUIT</text-property>
|
<text-property name="text">CODE PRODUIT</text-property>
|
||||||
</label>
|
</label>
|
||||||
</cell>
|
</cell>
|
||||||
|
<cell id="5136">
|
||||||
|
<property name="borderBottomStyle">solid</property>
|
||||||
|
<property name="borderBottomWidth">thin</property>
|
||||||
|
<property name="borderLeftStyle">solid</property>
|
||||||
|
<property name="borderLeftWidth">thin</property>
|
||||||
|
<property name="borderRightStyle">solid</property>
|
||||||
|
<property name="borderRightWidth">thin</property>
|
||||||
|
<property name="borderTopStyle">solid</property>
|
||||||
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<property name="verticalAlign">middle</property>
|
||||||
|
<label id="5143">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">12pt</property>
|
||||||
|
<text-property name="text">LIBELLE PRODUIT</text-property>
|
||||||
|
</label>
|
||||||
|
</cell>
|
||||||
<cell id="4626">
|
<cell id="4626">
|
||||||
<property name="colSpan">2</property>
|
<property name="colSpan">2</property>
|
||||||
<property name="rowSpan">1</property>
|
<property name="rowSpan">1</property>
|
||||||
@@ -1810,7 +2055,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<label id="4678">
|
<label id="4678">
|
||||||
<property name="fontFamily">"Tw Cen MT"</property>
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
<property name="fontSize">12pt</property>
|
<property name="fontSize">12pt</property>
|
||||||
<text-property name="text">INITIALE</text-property>
|
<text-property name="text">INITIAL</text-property>
|
||||||
</label>
|
</label>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="4630">
|
<cell id="4630">
|
||||||
@@ -1846,7 +2091,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<label id="5081">
|
<label id="5081">
|
||||||
<property name="fontFamily">"Tw Cen MT"</property>
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
<property name="fontSize">12pt</property>
|
<property name="fontSize">12pt</property>
|
||||||
<text-property name="text">SOLDE</text-property>
|
<text-property name="text">SOLDE FINAL</text-property>
|
||||||
</label>
|
</label>
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
@@ -1874,6 +2119,17 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<property name="verticalAlign">middle</property>
|
<property name="verticalAlign">middle</property>
|
||||||
</cell>
|
</cell>
|
||||||
|
<cell id="5137">
|
||||||
|
<property name="borderBottomStyle">solid</property>
|
||||||
|
<property name="borderBottomWidth">thin</property>
|
||||||
|
<property name="borderLeftStyle">solid</property>
|
||||||
|
<property name="borderLeftWidth">thin</property>
|
||||||
|
<property name="borderRightStyle">solid</property>
|
||||||
|
<property name="borderRightWidth">thin</property>
|
||||||
|
<property name="borderTopStyle">solid</property>
|
||||||
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<property name="verticalAlign">middle</property>
|
||||||
|
</cell>
|
||||||
<cell id="5118">
|
<cell id="5118">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
<property name="borderBottomWidth">thin</property>
|
<property name="borderBottomWidth">thin</property>
|
||||||
@@ -2023,6 +2279,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
</data>
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="5086"/>
|
<cell id="5086"/>
|
||||||
|
<cell id="5138"/>
|
||||||
<cell id="5087"/>
|
<cell id="5087"/>
|
||||||
<cell id="5088"/>
|
<cell id="5088"/>
|
||||||
<cell id="5089"/>
|
<cell id="5089"/>
|
||||||
@@ -2050,13 +2307,19 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
</cell>
|
</cell>
|
||||||
|
<cell id="5140">
|
||||||
|
<property name="borderBottomStyle">solid</property>
|
||||||
|
<property name="borderBottomWidth">thin</property>
|
||||||
|
<property name="borderTopStyle">solid</property>
|
||||||
|
<property name="borderTopWidth">thin</property>
|
||||||
|
</cell>
|
||||||
<cell id="5097">
|
<cell id="5097">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
<property name="borderBottomWidth">thin</property>
|
<property name="borderBottomWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5105">
|
<data id="5105">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
@@ -2072,7 +2335,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5106">
|
<data id="5106">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
@@ -2088,7 +2351,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5107">
|
<data id="5107">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
@@ -2104,7 +2367,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5128">
|
<data id="5128">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
@@ -2120,7 +2383,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5129">
|
<data id="5129">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
@@ -2136,7 +2399,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5130">
|
<data id="5130">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
@@ -2151,15 +2414,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderBottomWidth">thin</property>
|
<property name="borderBottomWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="5131">
|
<data id="5135">
|
||||||
<property name="fontSize">9pt</property>
|
<property name="fontSize">8pt</property>
|
||||||
<property name="fontWeight">bold</property>
|
<property name="fontWeight">bold</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
</structure>
|
</structure>
|
||||||
<property name="textAlign">right</property>
|
<property name="textAlign">right</property>
|
||||||
<property name="resultSetColumn">sumSoldeQtyAgg</property>
|
<property name="resultSetColumn">Aggregation_6</property>
|
||||||
</data>
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="5111">
|
<cell id="5111">
|
||||||
@@ -2169,6 +2432,16 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5131">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<property name="fontWeight">bold</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumSoldeQtyAgg</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
</footer>
|
</footer>
|
||||||
@@ -2186,6 +2459,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4642">
|
<data id="4642">
|
||||||
<property name="fontFamily">"Tw Cen MT"</property>
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<property name="resultSetColumn">account_code</property>
|
<property name="resultSetColumn">account_code</property>
|
||||||
</data>
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
@@ -2200,9 +2474,25 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4640">
|
<data id="4640">
|
||||||
<property name="fontFamily">"Tw Cen MT"</property>
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<property name="resultSetColumn">product_code</property>
|
<property name="resultSetColumn">product_code</property>
|
||||||
</data>
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
|
<cell id="5139">
|
||||||
|
<property name="borderBottomStyle">solid</property>
|
||||||
|
<property name="borderBottomWidth">thin</property>
|
||||||
|
<property name="borderLeftStyle">solid</property>
|
||||||
|
<property name="borderLeftWidth">thin</property>
|
||||||
|
<property name="borderRightStyle">solid</property>
|
||||||
|
<property name="borderRightWidth">thin</property>
|
||||||
|
<property name="borderTopStyle">solid</property>
|
||||||
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5144">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
|
<property name="resultSetColumn">product_name</property>
|
||||||
|
</data>
|
||||||
|
</cell>
|
||||||
<cell id="4643">
|
<cell id="4643">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
<property name="borderBottomWidth">thin</property>
|
<property name="borderBottomWidth">thin</property>
|
||||||
@@ -2213,6 +2503,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4644">
|
<data id="4644">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
@@ -2231,6 +2523,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4646">
|
<data id="4646">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
@@ -2249,6 +2543,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4648">
|
<data id="4648">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
@@ -2267,6 +2563,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4650">
|
<data id="4650">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
@@ -2285,6 +2583,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4652">
|
<data id="4652">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
@@ -2303,6 +2603,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<data id="4654">
|
<data id="4654">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<structure name="numberFormat">
|
<structure name="numberFormat">
|
||||||
<property name="category">Currency</property>
|
<property name="category">Currency</property>
|
||||||
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
@@ -2321,6 +2623,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<text id="5082">
|
<text id="5082">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<property name="textAlign">right</property>
|
<property name="textAlign">right</property>
|
||||||
<property name="dataSet">MoveLineDS</property>
|
<property name="dataSet">MoveLineDS</property>
|
||||||
<list-property name="boundDataColumns">
|
<list-property name="boundDataColumns">
|
||||||
@@ -2357,6 +2661,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
<text id="5114">
|
<text id="5114">
|
||||||
|
<property name="fontFamily">"Tw Cen MT"</property>
|
||||||
|
<property name="fontSize">9pt</property>
|
||||||
<property name="textAlign">right</property>
|
<property name="textAlign">right</property>
|
||||||
<property name="dataSet">MoveLineDS</property>
|
<property name="dataSet">MoveLineDS</property>
|
||||||
<list-property name="boundDataColumns">
|
<list-property name="boundDataColumns">
|
||||||
@@ -2407,6 +2713,16 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
</cell>
|
</cell>
|
||||||
|
<cell id="5141">
|
||||||
|
<property name="borderBottomStyle">solid</property>
|
||||||
|
<property name="borderBottomWidth">thin</property>
|
||||||
|
<property name="borderLeftStyle">solid</property>
|
||||||
|
<property name="borderLeftWidth">thin</property>
|
||||||
|
<property name="borderRightStyle">solid</property>
|
||||||
|
<property name="borderRightWidth">thin</property>
|
||||||
|
<property name="borderTopStyle">solid</property>
|
||||||
|
<property name="borderTopWidth">thin</property>
|
||||||
|
</cell>
|
||||||
<cell id="4658">
|
<cell id="4658">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
<property name="borderBottomWidth">thin</property>
|
<property name="borderBottomWidth">thin</property>
|
||||||
@@ -2416,6 +2732,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5145">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumInitAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="4659">
|
<cell id="4659">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2426,6 +2751,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5146">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumInitValAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="4660">
|
<cell id="4660">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2436,6 +2770,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5147">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumQttInAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="4661">
|
<cell id="4661">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2446,6 +2789,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5148">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumValInAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="4662">
|
<cell id="4662">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2456,6 +2808,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5149">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumQtyOutAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="4663">
|
<cell id="4663">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2466,6 +2827,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5150">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumValOutAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="5079">
|
<cell id="5079">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2476,6 +2846,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5151">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumSoldeQtyAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
<cell id="5112">
|
<cell id="5112">
|
||||||
<property name="borderBottomStyle">solid</property>
|
<property name="borderBottomStyle">solid</property>
|
||||||
@@ -2486,6 +2865,15 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
|||||||
<property name="borderRightWidth">thin</property>
|
<property name="borderRightWidth">thin</property>
|
||||||
<property name="borderTopStyle">solid</property>
|
<property name="borderTopStyle">solid</property>
|
||||||
<property name="borderTopWidth">thin</property>
|
<property name="borderTopWidth">thin</property>
|
||||||
|
<data id="5152">
|
||||||
|
<property name="fontSize">8pt</property>
|
||||||
|
<structure name="numberFormat">
|
||||||
|
<property name="category">Currency</property>
|
||||||
|
<property name="pattern">#,##0.00{RoundingMode=HALF_UP}</property>
|
||||||
|
</structure>
|
||||||
|
<property name="textAlign">right</property>
|
||||||
|
<property name="resultSetColumn">sumSoldeValAll</property>
|
||||||
|
</data>
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -285,7 +285,9 @@
|
|||||||
<xml-property name="queryText"><![CDATA[SELECT
|
<xml-property name="queryText"><![CDATA[SELECT
|
||||||
account_journal.code,
|
account_journal.code,
|
||||||
account_journal.name as "JournalName",
|
account_journal.name as "JournalName",
|
||||||
to_char(origin_date ,'YYYY-MM'),
|
to_char(MoveLine.date_val ,'YYYY-MM'),
|
||||||
|
-- debit,
|
||||||
|
-- credit
|
||||||
sum(debit) as debit,
|
sum(debit) as debit,
|
||||||
sum(credit) as credit
|
sum(credit) as credit
|
||||||
from public.account_accounting_report as AccountingReport
|
from public.account_accounting_report as AccountingReport
|
||||||
@@ -293,16 +295,16 @@ left outer join public.account_move_line as MoveLine on (AccountingReport.id = ?
|
|||||||
left outer join public.account_move as Move on (MoveLine.move = Move.id AND Move.ignore_in_accounting_ok = false)
|
left outer join public.account_move as Move on (MoveLine.move = Move.id AND Move.ignore_in_accounting_ok = false)
|
||||||
left join account_journal on account_journal.id = Move.journal
|
left join account_journal on account_journal.id = Move.journal
|
||||||
where
|
where
|
||||||
(AccountingReport.date_from IS NULL OR MoveLine.origin_date >= AccountingReport.date_from) AND
|
(AccountingReport.date_from IS NULL OR MoveLine.date_val >= AccountingReport.date_from) AND
|
||||||
(AccountingReport.date_to IS NULL OR MoveLine.origin_date <= AccountingReport.date_to) AND
|
(AccountingReport.date_to IS NULL OR MoveLine.date_val <= AccountingReport.date_to) AND
|
||||||
MoveLine.origin_date <= AccountingReport.date_val
|
MoveLine.date_val <= AccountingReport.date_val
|
||||||
AND Move.company = AccountingReport.company and Move.status_select = 3
|
AND Move.company = AccountingReport.company and Move.status_select = 3
|
||||||
group by
|
group by
|
||||||
to_char(origin_date ,'YYYY-MM'),
|
to_char(MoveLine.date_val ,'YYYY-MM'),
|
||||||
account_journal.code,
|
account_journal.code,
|
||||||
account_journal.name
|
account_journal.name
|
||||||
order by
|
order by
|
||||||
to_char(origin_date ,'YYYY-MM')]]></xml-property>
|
to_char(MoveLine.date_val ,'YYYY-MM')]]></xml-property>
|
||||||
</oda-data-set>
|
</oda-data-set>
|
||||||
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="AccountingReportDS" id="489">
|
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="AccountingReportDS" id="489">
|
||||||
<property name="nullsOrdering">nulls lowest</property>
|
<property name="nullsOrdering">nulls lowest</property>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
|||||||
|
package com.axelor.apps.account.web;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.axelor.apps.account.db.CashInventory;
|
||||||
|
import com.axelor.apps.base.service.ConvertNumberToFrenchWordsService;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
|
import com.axelor.rpc.ActionRequest;
|
||||||
|
import com.axelor.rpc.ActionResponse;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class CashInventoryControllerTest {
|
||||||
|
|
||||||
|
private CashInventoryController controller;
|
||||||
|
private ActionRequest request;
|
||||||
|
private ActionResponse response;
|
||||||
|
private CashInventory cashInventory;
|
||||||
|
private ConvertNumberToFrenchWordsService convertService;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
request = mock(ActionRequest.class);
|
||||||
|
response = mock(ActionResponse.class);
|
||||||
|
cashInventory = mock(CashInventory.class);
|
||||||
|
convertService = mock(ConvertNumberToFrenchWordsService.class);
|
||||||
|
|
||||||
|
controller = new CashInventoryController(convertService); // ✅ No Guice needed
|
||||||
|
|
||||||
|
// Mock request.getContext().asType(CashInventory.class)
|
||||||
|
com.axelor.rpc.Context context = mock(com.axelor.rpc.Context.class);
|
||||||
|
when(request.getContext()).thenReturn(context);
|
||||||
|
when(context.asType(CashInventory.class)).thenReturn(cashInventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConvert_withDecimalSolde() {
|
||||||
|
// Given
|
||||||
|
when(cashInventory.getTheoricalSolde()).thenReturn(new BigDecimal("1234.56"));
|
||||||
|
when(convertService.convert(1234L)).thenReturn("mille deux cent trente-quatre");
|
||||||
|
when(convertService.convert(56L)).thenReturn("cinquante-six");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConvert_withIntegerSolde() {
|
||||||
|
// Given
|
||||||
|
when(cashInventory.getTheoricalSolde()).thenReturn(new BigDecimal("1000.00"));
|
||||||
|
when(convertService.convert(1000L)).thenReturn("mille");
|
||||||
|
when(convertService.convert(0L)).thenReturn("zéro");
|
||||||
|
|
||||||
|
|
||||||
|
// Then
|
||||||
|
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
|
||||||
|
ArgumentCaptor<String> valueCaptor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(response).setValue(keyCaptor.capture(), valueCaptor.capture());
|
||||||
|
assertEquals("theoricalSoldeInWords", keyCaptor.getValue());
|
||||||
|
assertEquals("mille dinars algériens et zéro Cts", valueCaptor.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
// public void testConvert_withNoDecimalPart() {
|
||||||
|
// // Given
|
||||||
|
// when(cashInventory.getTheoricalSolde()).thenReturn(new BigDecimal("42"));
|
||||||
|
// when(convertService.convert(42L)).thenReturn("quarante-deux");
|
||||||
|
// when(convertService.convert(0L)).thenReturn("zéro");
|
||||||
|
|
||||||
|
|
||||||
|
// // Then
|
||||||
|
// ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
|
||||||
|
// ArgumentCaptor<String> valueCaptor = ArgumentCaptor.forClass(String.class);
|
||||||
|
// verify(response).setValue(keyCaptor.capture(), valueCaptor.capture());
|
||||||
|
// assertEquals("theoricalSoldeInWords", keyCaptor.getValue());
|
||||||
|
// assertEquals("quarante-deux dinars algériens et zéro Cts",
|
||||||
|
// valueCaptor.getValue());
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
|
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/axelor-test" />
|
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/bdd_sophal" />
|
||||||
|
|
||||||
<property name="javax.persistence.jdbc.user" value="axelor" />
|
<property name="javax.persistence.jdbc.user" value="postgres" />
|
||||||
<property name="javax.persistence.jdbc.password" value="" />
|
<property name="javax.persistence.jdbc.password" value="root" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
value="create" to build a new database on each run;
|
value="create" to build a new database on each run;
|
||||||
|
|||||||
@@ -17,10 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.base.service;
|
package com.axelor.apps.base.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface ConvertNumberToFrenchWordsService {
|
public interface ConvertNumberToFrenchWordsService {
|
||||||
|
|
||||||
public String convert(long number);
|
public String convert(long number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ import java.text.DecimalFormat;
|
|||||||
|
|
||||||
public class ConvertNumberToFrenchWordsServiceImpl implements ConvertNumberToFrenchWordsService {
|
public class ConvertNumberToFrenchWordsServiceImpl implements ConvertNumberToFrenchWordsService {
|
||||||
|
|
||||||
private final String[] dizaineNames = { "", //
|
private final String[] dizaineNames = {
|
||||||
|
"", //
|
||||||
"", //
|
"", //
|
||||||
"vingt", //
|
"vingt", //
|
||||||
"trente", //
|
"trente", //
|
||||||
@@ -33,7 +34,8 @@ public class ConvertNumberToFrenchWordsServiceImpl implements ConvertNumberToFre
|
|||||||
"quatre-vingt" //
|
"quatre-vingt" //
|
||||||
};
|
};
|
||||||
|
|
||||||
private final String[] uniteNames1 = { "", //
|
private final String[] uniteNames1 = {
|
||||||
|
"", //
|
||||||
"un", //
|
"un", //
|
||||||
"deux", //
|
"deux", //
|
||||||
"trois", //
|
"trois", //
|
||||||
@@ -55,7 +57,8 @@ public class ConvertNumberToFrenchWordsServiceImpl implements ConvertNumberToFre
|
|||||||
"dix-neuf" //
|
"dix-neuf" //
|
||||||
};
|
};
|
||||||
|
|
||||||
private final String[] uniteNames2 = { "", //
|
private final String[] uniteNames2 = {
|
||||||
|
"", //
|
||||||
"", //
|
"", //
|
||||||
"deux", //
|
"deux", //
|
||||||
"trois", //
|
"trois", //
|
||||||
@@ -68,8 +71,6 @@ public class ConvertNumberToFrenchWordsServiceImpl implements ConvertNumberToFre
|
|||||||
"dix" //
|
"dix" //
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String convertZeroToHundred(int number) {
|
private String convertZeroToHundred(int number) {
|
||||||
|
|
||||||
int laDizaine = number / 10;
|
int laDizaine = number / 10;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import com.axelor.apps.base.db.repo.SequenceRepository;
|
|||||||
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
||||||
import com.axelor.apps.base.service.administration.SequenceService;
|
import com.axelor.apps.base.service.administration.SequenceService;
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
import com.axelor.apps.base.service.BarcodeGeneratorService;
|
|
||||||
import com.axelor.apps.message.db.EmailAddress;
|
import com.axelor.apps.message.db.EmailAddress;
|
||||||
import com.axelor.common.StringUtils;
|
import com.axelor.common.StringUtils;
|
||||||
import com.axelor.db.JPA;
|
import com.axelor.db.JPA;
|
||||||
@@ -42,15 +41,14 @@ import com.axelor.exception.AxelorException;
|
|||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||||
import com.axelor.i18n.I18n;
|
import com.axelor.i18n.I18n;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
|
import com.axelor.meta.MetaFiles;
|
||||||
|
import com.axelor.meta.db.MetaFile;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import com.axelor.meta.MetaFiles;
|
|
||||||
import com.axelor.meta.db.MetaFile;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import javax.validation.ValidationException;
|
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -61,6 +59,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.validation.ValidationException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -710,7 +709,6 @@ public class PartnerServiceImpl implements PartnerService {
|
|||||||
return partnerQuery.fetchOne();
|
return partnerQuery.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setPartnerBarCodeSeq(Partner partner) {
|
public void setPartnerBarCodeSeq(Partner partner) {
|
||||||
if (partner.getBarCodeSeq() == null) {
|
if (partner.getBarCodeSeq() == null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -361,9 +361,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
TemplateMessageService templateMessageService = Beans.get(TemplateMessageService.class);
|
TemplateMessageService templateMessageService = Beans.get(TemplateMessageService.class);
|
||||||
templateMessageService.generateAndSendMessage(user, template);
|
templateMessageService.generateAndSendMessage(user, template);
|
||||||
}
|
} else if (sendEmailUponAccountCreation) {
|
||||||
|
|
||||||
else if(sendEmailUponAccountCreation){
|
|
||||||
user.setSendEmailUponAccountCreation(false);
|
user.setSendEmailUponAccountCreation(false);
|
||||||
AppBase appBase = Beans.get(AppBaseService.class).getAppBase();
|
AppBase appBase = Beans.get(AppBaseService.class).getAppBase();
|
||||||
Template template = appBase.getAccountCreationTemplate();
|
Template template = appBase.getAccountCreationTemplate();
|
||||||
|
|||||||
@@ -17,20 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.base.web;
|
package com.axelor.apps.base.web;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.URL;
|
|
||||||
import wslite.json.JSONException;
|
|
||||||
import wslite.json.JSONObject;
|
|
||||||
|
|
||||||
import org.apache.batik.util.io.StringDecoder;
|
|
||||||
|
|
||||||
import com.axelor.app.AppSettings;
|
import com.axelor.app.AppSettings;
|
||||||
import com.axelor.apps.base.db.AppBase;
|
import com.axelor.apps.base.db.AppBase;
|
||||||
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
||||||
@@ -48,13 +34,22 @@ import com.axelor.meta.schema.actions.ActionView;
|
|||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.net.URL;
|
||||||
|
import wslite.json.JSONException;
|
||||||
|
import wslite.json.JSONObject;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AppBaseController {
|
public class AppBaseController {
|
||||||
|
|
||||||
/**
|
/** */
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final String localhost = "127.0.0.1";
|
private static final String localhost = "127.0.0.1";
|
||||||
|
|
||||||
public void exportObjects(ActionRequest request, ActionResponse response) {
|
public void exportObjects(ActionRequest request, ActionResponse response) {
|
||||||
@@ -133,16 +128,17 @@ public class AppBaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@CallMethod
|
@CallMethod
|
||||||
public void execWhatsApp(String username,String message,String url,String id,String enc) throws IOException, ClassNotFoundException {
|
public void execWhatsApp(String username, String message, String url, String id, String enc)
|
||||||
|
throws IOException, ClassNotFoundException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String uri = Beans.get(AppBaseService.class).getAppBase().getWhatsAppURL();
|
String uri = Beans.get(AppBaseService.class).getAppBase().getWhatsAppURL();
|
||||||
|
|
||||||
String fullUrl = uri + "/" + url + "/" + id;
|
String fullUrl = uri + "/" + url + "/" + id;
|
||||||
Socket socket = new Socket(localhost, 6060);
|
Socket socket = new Socket(localhost, 6060);
|
||||||
// String data = "{\"username\" : \"" + username + "\",\"url\": \""+ fullUrl +"\",\"message\":\""+ message +"\"}";
|
// String data = "{\"username\" : \"" + username + "\",\"url\": \""+ fullUrl
|
||||||
|
// +"\",\"message\":\""+ message +"\"}";
|
||||||
String data = username + "***" + fullUrl + "***" + message;
|
String data = username + "***" + fullUrl + "***" + message;
|
||||||
|
|
||||||
DataOutputStream dout = new DataOutputStream(socket.getOutputStream());
|
DataOutputStream dout = new DataOutputStream(socket.getOutputStream());
|
||||||
@@ -158,16 +154,21 @@ public class AppBaseController {
|
|||||||
// socket.close();
|
// socket.close();
|
||||||
System.out.println("Message: " + msg);
|
System.out.println("Message: " + msg);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@CallMethod
|
@CallMethod
|
||||||
public void execWhatsApp2(String username,String message,String url,String id,String enc) throws IOException, ClassNotFoundException {
|
public void execWhatsApp2(String username, String message, String url, String id, String enc)
|
||||||
String args[] = { "python", "/Users\\Bachir.souldi.SOPHAL\\Desktop\\dev\\whatsapp_erp\\index.py" , message, url , id };
|
throws IOException, ClassNotFoundException {
|
||||||
|
String args[] = {
|
||||||
|
"python",
|
||||||
|
"/Users\\Bachir.souldi.SOPHAL\\Desktop\\dev\\whatsapp_erp\\index.py",
|
||||||
|
message,
|
||||||
|
url,
|
||||||
|
id
|
||||||
|
};
|
||||||
Process p = Runtime.getRuntime().exec(args);
|
Process p = Runtime.getRuntime().exec(args);
|
||||||
// BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
// BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
}
|
}
|
||||||
@@ -235,5 +236,4 @@ public class AppBaseController {
|
|||||||
return null; // Handle error appropriately
|
return null; // Handle error appropriately
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ import com.axelor.inject.Beans;
|
|||||||
import com.axelor.meta.schema.actions.ActionView;
|
import com.axelor.meta.schema.actions.ActionView;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
|
import com.axelor.rpc.Context;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.axelor.rpc.Context;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ProductController {
|
public class ProductController {
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
<!-- From contact -->
|
<!-- From contact -->
|
||||||
<one-to-one name="emailAddress" ref="com.axelor.apps.message.db.EmailAddress" title="Email"/>
|
<one-to-one name="emailAddress" ref="com.axelor.apps.message.db.EmailAddress" title="Email"/>
|
||||||
|
<one-to-one name="emailAddressCC1" ref="com.axelor.apps.message.db.EmailAddress" title="Email CC1"/>
|
||||||
|
<one-to-one name="emailAddressCC2" ref="com.axelor.apps.message.db.EmailAddress" title="Email CC2"/>
|
||||||
<string name="fax" title="Fax"/>
|
<string name="fax" title="Fax"/>
|
||||||
<string name="fixedPhone" title="Fixed phone"/>
|
<string name="fixedPhone" title="Fixed phone"/>
|
||||||
<string name="mobilePhone" title="Mobile phone"/>
|
<string name="mobilePhone" title="Mobile phone"/>
|
||||||
|
|||||||
@@ -149,6 +149,9 @@
|
|||||||
|
|
||||||
<boolean name="isDangerousProduct" title="Is dangerous" />
|
<boolean name="isDangerousProduct" title="Is dangerous" />
|
||||||
|
|
||||||
|
|
||||||
|
<many-to-one name="coaSpec" ref="com.axelor.meta.db.MetaFile" />
|
||||||
|
|
||||||
<finder-method name="findByCode" using="code" cacheable="true" />
|
<finder-method name="findByCode" using="code" cacheable="true" />
|
||||||
|
|
||||||
<extra-code>
|
<extra-code>
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||||
|
|
||||||
|
<module name="base" package="com.axelor.apps.base.db" />
|
||||||
|
|
||||||
|
<entity name="ProductInventory" lang="java">
|
||||||
|
|
||||||
|
<string name="name" title="Name" required="true" initParam="true"
|
||||||
|
translatable="true" />
|
||||||
|
<string name="serialNumber" title="Serial Nbr"/>
|
||||||
|
<string name="code" title="Code" initParam="true" namecolumn="true" unique="true"/>
|
||||||
|
|
||||||
|
<string name="description" large="true" title="Description"
|
||||||
|
initParam="true" translatable="true" />
|
||||||
|
<string name="internalDescription" large="true" title="Internal description"
|
||||||
|
initParam="true" />
|
||||||
|
<many-to-one name="picture" ref="com.axelor.meta.db.MetaFile"
|
||||||
|
initParam="true" />
|
||||||
|
|
||||||
|
<many-to-one name="familleProduit" ref="FamilleProduit"
|
||||||
|
title="Product category" massUpdate="true" /><!--sophal-->
|
||||||
|
<many-to-one name="sousFamilleProduit" ref="FamilleProduit"
|
||||||
|
title="Product category" massUpdate="true" /><!--sophal-->
|
||||||
|
<many-to-one name="sousSousFamilleProduit" ref="FamilleProduit"
|
||||||
|
title="Product category" massUpdate="true" /><!--sophal-->
|
||||||
|
|
||||||
|
<many-to-one name="productCategory" ref="ProductCategory"
|
||||||
|
title="Product category" initParam="true" massUpdate="true" />
|
||||||
|
|
||||||
|
<string name="unitCodeSelect" title="Unit Code"
|
||||||
|
selection="product.unit.code.select" massUpdate="true"/><!--sophal-->
|
||||||
|
<boolean name="codeCreated" title="code Created By Systeme" default="true"/><!--sophal-->
|
||||||
|
<many-to-one name="productFamily" ref="ProductFamily"
|
||||||
|
title="Accounting family" initParam="true" massUpdate="true"/>
|
||||||
|
<many-to-one name="unit" ref="Unit" title="Unit"
|
||||||
|
initParam="true" massUpdate="true" />
|
||||||
|
|
||||||
|
<integer name="saleSupplySelect" title="Sale supply default method on sale order"
|
||||||
|
selection="product.sale.supply.select" initParam="true" massUpdate="true"/>
|
||||||
|
|
||||||
|
<string name="productTypeSelect" title="Type" required="true"
|
||||||
|
selection="product.product.type.select" initParam="true" massUpdate="true"/>
|
||||||
|
<string name="procurementMethodSelect" title="Procurement method"
|
||||||
|
selection="product.procurement.method.select" initParam="true" />
|
||||||
|
<boolean name="isPrototype" title="Prototype" />
|
||||||
|
<boolean name="isUnrenewed" title="Unrenewed"/>
|
||||||
|
<integer name="productSubTypeSelect" title="Product Subtype"
|
||||||
|
selection="product.sub.type.product.select" />
|
||||||
|
<integer name="inventoryTypeSelect" title="Inventory type"
|
||||||
|
selection="product.inventory.type.select" />
|
||||||
|
|
||||||
|
<decimal name="salePrice" title="Sale price W.T." precision="20"
|
||||||
|
scale="10" massUpdate="true" />
|
||||||
|
<many-to-one name="saleCurrency" ref="com.axelor.apps.base.db.Currency"
|
||||||
|
title="Sale currency" initParam="true" />
|
||||||
|
<decimal name="purchasePrice" title="Purchase price W.T."
|
||||||
|
precision="20" scale="10" massUpdate="true" />
|
||||||
|
<many-to-one name="purchaseCurrency" ref="com.axelor.apps.base.db.Currency"
|
||||||
|
title="Purchase / Cost currency" initParam="true" />
|
||||||
|
<boolean name="autoUpdateSalePrice" default="false"
|
||||||
|
title="Update sale price from cost price" />
|
||||||
|
|
||||||
|
<decimal name="costPrice" title="Cost price" precision="20"
|
||||||
|
scale="10" massUpdate="true" />
|
||||||
|
|
||||||
|
<decimal name="managPriceCoef" title="Management coef." />
|
||||||
|
<decimal name="shippingCoef" title="Shipping Coef." />
|
||||||
|
<boolean name="defShipCoefByPartner" title="Define the shipping coef by partner" />
|
||||||
|
|
||||||
|
<date name="startDate" title="Product launch Date" initParam="true" />
|
||||||
|
<date name="endDate" title="Product pulled off market Date"
|
||||||
|
initParam="true" />
|
||||||
|
|
||||||
|
<boolean name="hasWarranty" title="Warranty" />
|
||||||
|
<boolean name="isPerishable" title="Perishable" />
|
||||||
|
<integer name="warrantyNbrOfMonths" title="Warranty length (in months)" />
|
||||||
|
<integer name="perishableNbrOfMonths" title="Time before expiry (in months)" />
|
||||||
|
<boolean name="checkExpirationDateAtStockMoveRealization" />
|
||||||
|
|
||||||
|
<many-to-one name="productVariantConfig"
|
||||||
|
ref="com.axelor.apps.base.db.ProductVariantConfig" />
|
||||||
|
<many-to-one name="productVariant" ref="com.axelor.apps.base.db.ProductVariant" />
|
||||||
|
<many-to-one name="parentProduct" ref="com.axelor.apps.base.db.Product"
|
||||||
|
title="Parent product" />
|
||||||
|
<boolean name="isModel" title="Is model" />
|
||||||
|
<boolean name="manageVariantPrice" default="false"
|
||||||
|
title="Manage prices for product variants" />
|
||||||
|
|
||||||
|
<many-to-one name="defaultSupplierPartner" ref="com.axelor.apps.base.db.Partner"
|
||||||
|
title="Default supplier" />
|
||||||
|
|
||||||
|
|
||||||
|
<integer name="versionSelect" title="Version"
|
||||||
|
selection="base.product.version.select" />
|
||||||
|
|
||||||
|
<boolean name="sellable" title="Sellable" default="true" />
|
||||||
|
<boolean name="purchasable" title="Purchasable" default="true" />
|
||||||
|
<boolean name="inAti" title="In ATI" />
|
||||||
|
|
||||||
|
<integer name="costTypeSelect" title="Cost type"
|
||||||
|
selection="base.product.cost.type.select" default="1" />
|
||||||
|
|
||||||
|
<integer name="supplierDeliveryTime" title="Supplier delivery time (days)" />
|
||||||
|
|
||||||
|
<many-to-one name="barCode" title="Barcode"
|
||||||
|
ref="com.axelor.meta.db.MetaFile" />
|
||||||
|
<many-to-one name="barcodeTypeConfig" title="Barcode Type" ref="com.axelor.apps.base.db.BarcodeTypeConfig"/>
|
||||||
|
<string name="fullName" title="Full name" translatable="true" />
|
||||||
|
|
||||||
|
|
||||||
|
<many-to-one name="massUnit" ref="com.axelor.apps.base.db.Unit"
|
||||||
|
title="Unit of mass" />
|
||||||
|
<decimal name="grossMass" title="Gross mass" precision="20" scale="3" />
|
||||||
|
<decimal name="netMass" title="Net mass" precision="20" scale="3" />
|
||||||
|
|
||||||
|
<many-to-one name="lengthUnit" ref="com.axelor.apps.base.db.Unit"
|
||||||
|
title="Unit of length" />
|
||||||
|
<decimal name="length" title="Length" default="0" />
|
||||||
|
<decimal name="width" title="Width" default="0" />
|
||||||
|
<decimal name="height" title="Height" default="0" />
|
||||||
|
<decimal name="diameter" title="Diameter" />
|
||||||
|
<decimal name="articleVolume" title="Article volume" />
|
||||||
|
<decimal name="economicManufOrderQty" title="Economic manuf. qty"/>
|
||||||
|
|
||||||
|
<boolean name="isShippingCostsProduct" title="Is shipping costs product"/>
|
||||||
|
|
||||||
|
|
||||||
|
<boolean name="allowToForceSaleQty" title="Allow to force sales quantities"/>
|
||||||
|
|
||||||
|
|
||||||
|
<boolean name="allowToForcePurchaseQty" title="Allow to force purchases quantities"/>
|
||||||
|
|
||||||
|
<decimal name="ppa" title="PPA" />
|
||||||
|
<decimal name="shp" title="SHP" />
|
||||||
|
<decimal name="pvg" title="PVG" />
|
||||||
|
<decimal name="stklim" title="Stklim" />
|
||||||
|
<decimal name="ug" title="UG" />
|
||||||
|
|
||||||
|
<boolean name="isDangerousProduct" title="Is dangerous" />
|
||||||
|
|
||||||
|
|
||||||
|
<many-to-one name="coaSpec" ref="com.axelor.meta.db.MetaFile" />
|
||||||
|
|
||||||
|
<finder-method name="findByCode" using="code" cacheable="true" />
|
||||||
|
|
||||||
|
<extra-code>
|
||||||
|
<![CDATA[
|
||||||
|
// PRODUCT TYPE SELECT
|
||||||
|
public static final String PRODUCT_TYPE_SERVICE = "service";
|
||||||
|
public static final String PRODUCT_TYPE_STORABLE = "storable";
|
||||||
|
public static final String PRODUCT_TYPE_PACK = "pack";
|
||||||
|
|
||||||
|
// SALE SUPPLY SELECT
|
||||||
|
public static final int SALE_SUPPLY_FROM_STOCK = 1;
|
||||||
|
public static final int SALE_SUPPLY_PURCHASE = 2;
|
||||||
|
public static final int SALE_SUPPLY_PRODUCE = 3;
|
||||||
|
|
||||||
|
public static final String PROCUREMENT_METHOD_BUY = "buy";
|
||||||
|
public static final String PROCUREMENT_METHOD_PRODUCE = "produce";
|
||||||
|
public static final String PROCUREMENT_METHOD_BUYANDPRODUCE = "buyAndProduce";
|
||||||
|
|
||||||
|
public static final int COST_TYPE_STANDARD = 1;
|
||||||
|
public static final int COST_TYPE_LAST_PURCHASE_PRICE = 2;
|
||||||
|
public static final int COST_TYPE_AVERAGE_PRICE = 3;
|
||||||
|
public static final int COST_TYPE_LAST_PRODUCTION_PRICE = 4;
|
||||||
|
|
||||||
|
// PRODUCT SUB-TYPE SELECT
|
||||||
|
public static final int PRODUCT_SUB_TYPE_FINISHED_PRODUCT = 1;
|
||||||
|
public static final int PRODUCT_SUB_TYPE_SEMI_FINISHED_PRODUCT = 2;
|
||||||
|
public static final int PRODUCT_SUB_TYPE_COMPONENT = 3;
|
||||||
|
]]>
|
||||||
|
</extra-code>
|
||||||
|
|
||||||
|
<track on="UPDATE">
|
||||||
|
<field name="productCategory" />
|
||||||
|
<field name="productFamily" />
|
||||||
|
<field name="saleSupplySelect" />
|
||||||
|
<field name="sellable" />
|
||||||
|
<field name="salePrice" />
|
||||||
|
<field name="saleCurrency" />
|
||||||
|
<field name="unit" />
|
||||||
|
<field name="startDate" />
|
||||||
|
<field name="endDate" />
|
||||||
|
<field name="purchasable" />
|
||||||
|
<field name="purchasePrice" />
|
||||||
|
<field name="defaultSupplierPartner" />
|
||||||
|
<field name="purchaseCurrency" />
|
||||||
|
<field name="supplierDeliveryTime" />
|
||||||
|
<field name="costPrice" />
|
||||||
|
<field name="managPriceCoef" />
|
||||||
|
<field name="costTypeSelect" />
|
||||||
|
<field name="hasWarranty" />
|
||||||
|
<field name="warrantyNbrOfMonths" />
|
||||||
|
<field name="isPerishable" />
|
||||||
|
<field name="perishableNbrOfMonths" />
|
||||||
|
<field name="ppa" />
|
||||||
|
<field name="pvg" />
|
||||||
|
<field name="shp" />
|
||||||
|
<field name="stklim" />
|
||||||
|
<field name="ug" />
|
||||||
|
<message if="true" on="UPDATE">Product updated</message>
|
||||||
|
</track>
|
||||||
|
</entity>
|
||||||
|
|
||||||
|
</domain-models>
|
||||||
@@ -21,35 +21,21 @@ import com.axelor.app.AxelorModule;
|
|||||||
import com.axelor.apps.base.module.AdminModule;
|
import com.axelor.apps.base.module.AdminModule;
|
||||||
import com.axelor.apps.base.module.BaseModule;
|
import com.axelor.apps.base.module.BaseModule;
|
||||||
import com.axelor.apps.base.service.user.UserService;
|
import com.axelor.apps.base.service.user.UserService;
|
||||||
import com.axelor.apps.base.test.UserServiceTest.MyModule;
|
|
||||||
import com.axelor.apps.message.module.MessageModule;
|
import com.axelor.apps.message.module.MessageModule;
|
||||||
import com.axelor.apps.tool.module.ToolModule;
|
import com.axelor.apps.tool.module.ToolModule;
|
||||||
import com.axelor.auth.db.User;
|
|
||||||
import com.axelor.auth.db.repo.UserRepository;
|
import com.axelor.auth.db.repo.UserRepository;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.test.GuiceModules;
|
import com.axelor.test.GuiceModules;
|
||||||
import com.axelor.test.GuiceRunner;
|
import com.axelor.test.GuiceRunner;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
|
||||||
import javax.persistence.Persistence;
|
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.google.inject.Injector;
|
|
||||||
|
|
||||||
|
|
||||||
@RunWith(GuiceRunner.class)
|
@RunWith(GuiceRunner.class)
|
||||||
@GuiceModules({UserServiceTest.MyModule.class})
|
@GuiceModules({UserServiceTest.MyModule.class})
|
||||||
@@ -58,7 +44,6 @@ public class UserServiceTest {
|
|||||||
static UserService userService;
|
static UserService userService;
|
||||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
|
||||||
public static class MyModule extends AxelorModule {
|
public static class MyModule extends AxelorModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -78,14 +63,13 @@ public class UserServiceTest {
|
|||||||
|
|
||||||
@Inject UserRepository injector;
|
@Inject UserRepository injector;
|
||||||
|
|
||||||
|
|
||||||
// public void test() {
|
// public void test() {
|
||||||
// assertNotNull(injector.find(1L));
|
// assertNotNull(injector.find(1L));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMatchPasswordPatternUpperLowerDigit() {
|
public void testMatchPasswordPatternUpperLowerDigit() {
|
||||||
Assert.assertTrue(userService.matchPasswordPattern("Axelor123"));
|
Assert.assertTrue(userService.matchPasswordPattern("5"));
|
||||||
Assert.assertTrue(userService.matchPasswordPattern("123Axelor"));
|
Assert.assertTrue(userService.matchPasswordPattern("123Axelor"));
|
||||||
Assert.assertTrue(userService.matchPasswordPattern("axelor123A"));
|
Assert.assertTrue(userService.matchPasswordPattern("axelor123A"));
|
||||||
}
|
}
|
||||||
@@ -125,19 +109,19 @@ public class UserServiceTest {
|
|||||||
Assert.assertFalse(userService.matchPasswordPattern("axelor123456"));
|
Assert.assertFalse(userService.matchPasswordPattern("axelor123456"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
public void findUser() throws AxelorException {
|
public void findUser() throws AxelorException {
|
||||||
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("testUnitManager");
|
// EntityManagerFactory entityManagerFactory =
|
||||||
EntityManager entityManager = entityManagerFactory.createEntityManager();
|
// Persistence.createEntityManagerFactory("testUnitManager");
|
||||||
|
// EntityManager entityManager = entityManagerFactory.createEntityManager();
|
||||||
|
|
||||||
// Student student = new Student("Ramesh", "Fadatare", "rameshfadatare@javaguides.com");
|
// Student student = new Student("Ramesh", "Fadatare", "rameshfadatare@javaguides.com");
|
||||||
// Object partner = entityManager.createNativeQuery("select u from base_partner u where u.id = 1",Partner.class).getSingleResult();
|
// Object partner = entityManager.createNativeQuery("select u from base_partner u where u.id =
|
||||||
|
// 1",Partner.class).getSingleResult();
|
||||||
|
|
||||||
// log.debug("data *******************************"+ partner.toString());
|
// log.debug("data *******************************"+ partner.toString());
|
||||||
entityManager.close();
|
// entityManager.close();
|
||||||
entityManagerFactory.close();
|
// entityManagerFactory.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ public interface IExceptionMessage {
|
|||||||
static final String EVENT_MEETING_INVITATION_1 = /*$$(*/
|
static final String EVENT_MEETING_INVITATION_1 = /*$$(*/
|
||||||
"No PERSON IS INVITED TO THIS MEETING" /*)*/;
|
"No PERSON IS INVITED TO THIS MEETING" /*)*/;
|
||||||
|
|
||||||
static final String USER_EMAIL_1 = /*$$(*/
|
static final String USER_EMAIL_1 = /*$$(*/ "No email address associated to %s" /*)*/;
|
||||||
"No email address associated to %s" /*)*/;
|
|
||||||
|
|
||||||
/** Lead controller */
|
/** Lead controller */
|
||||||
static final String LEAD_1 = /*$$(*/ "Please select the Lead(s) to print." /*)*/;
|
static final String LEAD_1 = /*$$(*/ "Please select the Lead(s) to print." /*)*/;
|
||||||
|
|||||||
@@ -17,15 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.crm.service;
|
package com.axelor.apps.crm.service;
|
||||||
|
|
||||||
|
|
||||||
import com.axelor.apps.base.db.AppBase;
|
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
|
||||||
import com.axelor.apps.base.db.Address;
|
import com.axelor.apps.base.db.Address;
|
||||||
|
import com.axelor.apps.base.db.AppBase;
|
||||||
import com.axelor.apps.base.db.ICalendarUser;
|
import com.axelor.apps.base.db.ICalendarUser;
|
||||||
import com.axelor.apps.base.db.Partner;
|
import com.axelor.apps.base.db.Partner;
|
||||||
import com.axelor.apps.base.db.repo.PartnerRepository;
|
import com.axelor.apps.base.db.repo.PartnerRepository;
|
||||||
import com.axelor.apps.base.ical.ICalendarService;
|
import com.axelor.apps.base.ical.ICalendarService;
|
||||||
import com.axelor.apps.base.service.PartnerService;
|
import com.axelor.apps.base.service.PartnerService;
|
||||||
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
import com.axelor.apps.crm.db.Event;
|
import com.axelor.apps.crm.db.Event;
|
||||||
import com.axelor.apps.crm.db.Lead;
|
import com.axelor.apps.crm.db.Lead;
|
||||||
import com.axelor.apps.crm.db.RecurrenceConfiguration;
|
import com.axelor.apps.crm.db.RecurrenceConfiguration;
|
||||||
@@ -34,14 +33,12 @@ import com.axelor.apps.crm.db.repo.LeadRepository;
|
|||||||
import com.axelor.apps.crm.db.repo.RecurrenceConfigurationRepository;
|
import com.axelor.apps.crm.db.repo.RecurrenceConfigurationRepository;
|
||||||
import com.axelor.apps.crm.exception.IExceptionMessage;
|
import com.axelor.apps.crm.exception.IExceptionMessage;
|
||||||
import com.axelor.apps.message.db.EmailAddress;
|
import com.axelor.apps.message.db.EmailAddress;
|
||||||
|
import com.axelor.apps.message.db.Template;
|
||||||
import com.axelor.apps.message.db.repo.EmailAddressRepository;
|
import com.axelor.apps.message.db.repo.EmailAddressRepository;
|
||||||
import com.axelor.apps.message.service.MessageService;
|
import com.axelor.apps.message.service.MessageService;
|
||||||
import com.axelor.apps.message.service.TemplateMessageService;
|
import com.axelor.apps.message.service.TemplateMessageService;
|
||||||
import com.axelor.apps.message.db.Template;
|
|
||||||
import com.axelor.auth.db.User;
|
import com.axelor.auth.db.User;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import javax.mail.MessagingException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||||
import com.axelor.i18n.I18n;
|
import com.axelor.i18n.I18n;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
@@ -52,6 +49,7 @@ import com.axelor.mail.db.repo.MailFollowerRepository;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -60,11 +58,12 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.time.temporal.TemporalAdjusters;
|
import java.time.temporal.TemporalAdjusters;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.mail.MessagingException;
|
||||||
import org.apache.commons.math3.exception.TooManyIterationsException;
|
import org.apache.commons.math3.exception.TooManyIterationsException;
|
||||||
|
|
||||||
public class EventServiceImpl implements EventService {
|
public class EventServiceImpl implements EventService {
|
||||||
@@ -664,7 +663,8 @@ public class EventServiceImpl implements EventService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendEmailMeetingInvitation(Event event, Set<User> users) throws ClassNotFoundException, InstantiationException, IllegalAccessException,
|
public void sendEmailMeetingInvitation(Event event, Set<User> users)
|
||||||
|
throws ClassNotFoundException, InstantiationException, IllegalAccessException,
|
||||||
MessagingException, IOException, AxelorException {
|
MessagingException, IOException, AxelorException {
|
||||||
AppBase appBase = Beans.get(AppBaseService.class).getAppBase();
|
AppBase appBase = Beans.get(AppBaseService.class).getAppBase();
|
||||||
Template template = appBase.getSendMailToInvitedPersonInMeetingTemplate();
|
Template template = appBase.getSendMailToInvitedPersonInMeetingTemplate();
|
||||||
@@ -673,8 +673,7 @@ public class EventServiceImpl implements EventService {
|
|||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
appBase,
|
appBase,
|
||||||
TraceBackRepository.CATEGORY_NO_VALUE,
|
TraceBackRepository.CATEGORY_NO_VALUE,
|
||||||
I18n.get("Template for sending meeting invitation is missing.")
|
I18n.get("Template for sending meeting invitation is missing."));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateMessageService templateMessageService = Beans.get(TemplateMessageService.class);
|
TemplateMessageService templateMessageService = Beans.get(TemplateMessageService.class);
|
||||||
@@ -685,9 +684,7 @@ public class EventServiceImpl implements EventService {
|
|||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
TraceBackRepository.CATEGORY_NO_VALUE,
|
TraceBackRepository.CATEGORY_NO_VALUE,
|
||||||
I18n.get("Failed to send meeting invitation email."),
|
I18n.get("Failed to send meeting invitation email."),
|
||||||
e
|
e);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,10 +63,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import org.apache.commons.math3.ode.events.EventState;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -75,7 +73,6 @@ public class EventController {
|
|||||||
|
|
||||||
@Inject ImportationFolderRepository importationFolderRepository;
|
@Inject ImportationFolderRepository importationFolderRepository;
|
||||||
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
public void computeFromStartDateTime(ActionRequest request, ActionResponse response) {
|
public void computeFromStartDateTime(ActionRequest request, ActionResponse response) {
|
||||||
@@ -557,10 +554,23 @@ public class EventController {
|
|||||||
public void setImportationFolderEvent(ActionRequest request, ActionResponse response) {
|
public void setImportationFolderEvent(ActionRequest request, ActionResponse response) {
|
||||||
Event event = new Event();
|
Event event = new Event();
|
||||||
|
|
||||||
final ArrayList<String> importationSequences = new ArrayList(Arrays.asList("PREPARATION","ENTAME","VALIDATION COA/FICHE TECHNIQUE","LOGISTIQUE","TRANSIT","DEDOUANEMENT","RECEPTION"));
|
final ArrayList<String> importationSequences =
|
||||||
|
new ArrayList(
|
||||||
|
Arrays.asList(
|
||||||
|
"PREPARATION",
|
||||||
|
"ENTAME",
|
||||||
|
"VALIDATION COA/FICHE TECHNIQUE",
|
||||||
|
"LOGISTIQUE",
|
||||||
|
"TRANSIT",
|
||||||
|
"DEDOUANEMENT",
|
||||||
|
"RECEPTION"));
|
||||||
|
|
||||||
ImportationFolder importationFolder = Beans.get(ImportationFolderRepository.class).find(request.getContext().asType(ImportationFolder.class).getId());
|
ImportationFolder importationFolder =
|
||||||
event.setSubject(importationSequences.get(Integer.parseInt(request.getContext().get("statusSelect").toString())));
|
Beans.get(ImportationFolderRepository.class)
|
||||||
|
.find(request.getContext().asType(ImportationFolder.class).getId());
|
||||||
|
event.setSubject(
|
||||||
|
importationSequences.get(
|
||||||
|
Integer.parseInt(request.getContext().get("statusSelect").toString())));
|
||||||
event.setStatusSelect(1);
|
event.setStatusSelect(1);
|
||||||
event.setStartDateTime(LocalDateTime.now());
|
event.setStartDateTime(LocalDateTime.now());
|
||||||
event.setEndDateTime(LocalDateTime.now().plusDays(10));
|
event.setEndDateTime(LocalDateTime.now().plusDays(10));
|
||||||
@@ -572,10 +582,8 @@ public class EventController {
|
|||||||
response.setReload(true);
|
response.setReload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void openRoqApplication(ActionRequest request, ActionResponse response) {
|
public void openRoqApplication(ActionRequest request, ActionResponse response) {
|
||||||
|
|
||||||
|
|
||||||
String uri = Beans.get(AppBaseService.class).getAppBase().getRoqURL();
|
String uri = Beans.get(AppBaseService.class).getAppBase().getRoqURL();
|
||||||
|
|
||||||
LOG.debug("link {}", uri + AuthUtils.getUser().getId());
|
LOG.debug("link {}", uri + AuthUtils.getUser().getId());
|
||||||
@@ -587,7 +595,6 @@ public class EventController {
|
|||||||
.map());
|
.map());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void printMeeting(ActionRequest request, ActionResponse response) throws AxelorException {
|
public void printMeeting(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
Event event = request.getContext().asType(Event.class);
|
Event event = request.getContext().asType(Event.class);
|
||||||
event = Beans.get(EventRepository.class).find(event.getId());
|
event = Beans.get(EventRepository.class).find(event.getId());
|
||||||
@@ -601,25 +608,25 @@ public class EventController {
|
|||||||
.generate()
|
.generate()
|
||||||
.getFileLink();
|
.getFileLink();
|
||||||
|
|
||||||
|
|
||||||
response.setView(ActionView.define(eventName).add("html", fileLink).map());
|
response.setView(ActionView.define(eventName).add("html", fileLink).map());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMailToGuests(ActionRequest request, ActionResponse response) throws AxelorException {
|
public void sendMailToGuests(ActionRequest request, ActionResponse response)
|
||||||
|
throws AxelorException {
|
||||||
|
|
||||||
Event event = request.getContext().asType(Event.class);
|
Event event = request.getContext().asType(Event.class);
|
||||||
event = Beans.get(EventRepository.class).find(event.getId());
|
event = Beans.get(EventRepository.class).find(event.getId());
|
||||||
|
|
||||||
Set<User> users = event.getGuestList();
|
Set<User> users = event.getGuestList();
|
||||||
if (event.getUser() != null)
|
if (event.getUser() != null) users.add(event.getUser());
|
||||||
users.add(event.getUser());
|
|
||||||
users.add(event.getCreatedBy());
|
users.add(event.getCreatedBy());
|
||||||
|
|
||||||
if (!users.isEmpty()) {
|
if (!users.isEmpty()) {
|
||||||
// Check if all users have an email address
|
// Check if all users have an email address
|
||||||
for (User user : users) {
|
for (User user : users) {
|
||||||
if (user.getEmail() == null) {
|
if (user.getEmail() == null) {
|
||||||
response.setFlash(I18n.get(String.format(IExceptionMessage.USER_EMAIL_1, user.getName())));
|
response.setFlash(
|
||||||
|
I18n.get(String.format(IExceptionMessage.USER_EMAIL_1, user.getName())));
|
||||||
return; // Exit the method if any user lacks an email
|
return; // Exit the method if any user lacks an email
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
package com.axelor.apps.hr.job;
|
package com.axelor.apps.hr.job;
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.CheckInOut;
|
import com.axelor.app.AppSettings;
|
||||||
import com.axelor.apps.hr.db.repo.CheckInOutRepository;
|
import com.axelor.apps.hr.db.repo.CheckInOutRepository;
|
||||||
import com.axelor.exception.service.TraceBackService;
|
import com.axelor.exception.service.TraceBackService;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.time.LocalDate;
|
||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import org.quartz.SchedulerException;
|
|
||||||
import com.axelor.app.AppSettings;
|
|
||||||
|
|
||||||
public class FetchCheckInOutJob implements Job {
|
public class FetchCheckInOutJob implements Job {
|
||||||
|
|
||||||
@@ -38,14 +37,18 @@ public class FetchCheckInOutJob implements Job {
|
|||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
// Fetch the CheckInOut list from the repository where the date_attendance is today
|
// Fetch the CheckInOut list from the repository where the date_attendance is today
|
||||||
int lenCheckInOutList = Beans.get(CheckInOutRepository.class)
|
int lenCheckInOutList =
|
||||||
|
Beans.get(CheckInOutRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.date_attendance = :today")
|
.filter("self.date_attendance = :today")
|
||||||
.bind("today", today)
|
.bind("today", today)
|
||||||
.fetch().size();
|
.fetch()
|
||||||
|
.size();
|
||||||
|
|
||||||
// Define the command to run the Python script with the correct path (V3)
|
// Define the command to run the Python script with the correct path (V3)
|
||||||
String[] args = {"python", pythonScriptDir + "\\Scrape\\main2.py", String.valueOf(lenCheckInOutList)};
|
String[] args = {
|
||||||
|
"python", pythonScriptDir + "\\Scrape\\main2.py", String.valueOf(lenCheckInOutList)
|
||||||
|
};
|
||||||
|
|
||||||
// Execute the command
|
// Execute the command
|
||||||
Process p = Runtime.getRuntime().exec(args);
|
Process p = Runtime.getRuntime().exec(args);
|
||||||
@@ -101,5 +104,4 @@ public class FetchCheckInOutJob implements Job {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package com.axelor.apps.hr.service;
|
|||||||
import com.axelor.apps.hr.db.Absence;
|
import com.axelor.apps.hr.db.Absence;
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.util.List;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface AbsenceService {
|
public interface AbsenceService {
|
||||||
|
|
||||||
@@ -13,13 +13,16 @@ public interface AbsenceService {
|
|||||||
void attachTheAbsenceWithDailyReport(Absence absence, List<DailyReport> dailyreports);
|
void attachTheAbsenceWithDailyReport(Absence absence, List<DailyReport> dailyreports);
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
void deAttachTheAbsenceWithDailyReport(Absence absence, List<DailyReport> dailyreports, Boolean archive);
|
void deAttachTheAbsenceWithDailyReport(
|
||||||
|
Absence absence, List<DailyReport> dailyreports, Boolean archive);
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
void chooseAbsenceType(Absence absence, Integer selectedType);
|
void chooseAbsenceType(Absence absence, Integer selectedType);
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
BigDecimal calculateTotalAbsenceHours(LocalDateTime absenceStartDate, LocalDateTime absenceEndDate);
|
BigDecimal calculateTotalAbsenceHours(
|
||||||
|
LocalDateTime absenceStartDate, LocalDateTime absenceEndDate);
|
||||||
|
|
||||||
BigDecimal calculateTotalAbsenceMinutes(LocalDateTime absenceStartDate, LocalDateTime absenceEndDate);
|
BigDecimal calculateTotalAbsenceMinutes(
|
||||||
|
LocalDateTime absenceStartDate, LocalDateTime absenceEndDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
package com.axelor.apps.hr.service;
|
package com.axelor.apps.hr.service;
|
||||||
|
|
||||||
import com.axelor.apps.base.db.EventsPlanning;
|
|
||||||
import com.axelor.apps.base.db.EventsPlanningLine;
|
import com.axelor.apps.base.db.EventsPlanningLine;
|
||||||
import com.axelor.apps.base.db.repo.EventsPlanningRepository;
|
|
||||||
import com.axelor.apps.base.db.repo.EventsPlanningLineRepository;
|
import com.axelor.apps.base.db.repo.EventsPlanningLineRepository;
|
||||||
import com.axelor.apps.hr.db.Absence;
|
import com.axelor.apps.hr.db.Absence;
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
import java.util.List;
|
|
||||||
import java.time.Year;
|
|
||||||
import java.time.DayOfWeek;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.time.Duration;
|
import java.util.List;
|
||||||
import java.math.RoundingMode;
|
|
||||||
|
|
||||||
public class AbsenceServiceImpl implements AbsenceService {
|
public class AbsenceServiceImpl implements AbsenceService {
|
||||||
|
|
||||||
@@ -28,19 +25,16 @@ public class AbsenceServiceImpl implements AbsenceService {
|
|||||||
private List<EventsPlanningLine> eventsPlanningLines;
|
private List<EventsPlanningLine> eventsPlanningLines;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AbsenceServiceImpl( AbsenceRepository absenceRepository, DailyReportRepository dailyReportRepository) {
|
public AbsenceServiceImpl(
|
||||||
|
AbsenceRepository absenceRepository, DailyReportRepository dailyReportRepository) {
|
||||||
this.absenceRepository = absenceRepository;
|
this.absenceRepository = absenceRepository;
|
||||||
this.dailyReportRepository = dailyReportRepository;
|
this.dailyReportRepository = dailyReportRepository;
|
||||||
eventsPlanningLines =
|
eventsPlanningLines =
|
||||||
Beans.get(EventsPlanningLineRepository.class)
|
Beans.get(EventsPlanningLineRepository.class).all().filter("self.id = 4").fetch();
|
||||||
.all()
|
|
||||||
.filter("self.id = 4")
|
|
||||||
.fetch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void attachTheAbsenceWithDailyReport(
|
public void attachTheAbsenceWithDailyReport(Absence absence, List<DailyReport> dailyreports) {
|
||||||
Absence absence, List<DailyReport> dailyreports) {
|
|
||||||
// Iterate over each DailyReport in the list
|
// Iterate over each DailyReport in the list
|
||||||
for (DailyReport dailyreport : dailyreports) {
|
for (DailyReport dailyreport : dailyreports) {
|
||||||
dailyreport.addAbsenceSetItem(absence); // Set the absence for each report
|
dailyreport.addAbsenceSetItem(absence); // Set the absence for each report
|
||||||
@@ -49,7 +43,8 @@ public class AbsenceServiceImpl implements AbsenceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deAttachTheAbsenceWithDailyReport(Absence absence, List<DailyReport> dailyreports, Boolean archive) {
|
public void deAttachTheAbsenceWithDailyReport(
|
||||||
|
Absence absence, List<DailyReport> dailyreports, Boolean archive) {
|
||||||
if (dailyreports != null) {
|
if (dailyreports != null) {
|
||||||
// Iterate over each DailyReport in the list
|
// Iterate over each DailyReport in the list
|
||||||
for (DailyReport dailyreport : dailyreports) {
|
for (DailyReport dailyreport : dailyreports) {
|
||||||
@@ -74,13 +69,13 @@ public class AbsenceServiceImpl implements AbsenceService {
|
|||||||
absenceRepository.save(absence);
|
absenceRepository.save(absence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal calculateTotalAbsenceHours(LocalDateTime absenceStartDate, LocalDateTime absenceEndDate) {
|
public BigDecimal calculateTotalAbsenceHours(
|
||||||
|
LocalDateTime absenceStartDate, LocalDateTime absenceEndDate) {
|
||||||
BigDecimal totalAbsenceHours = BigDecimal.ZERO;
|
BigDecimal totalAbsenceHours = BigDecimal.ZERO;
|
||||||
|
|
||||||
if (absenceStartDate.equals(absenceEndDate)) {
|
if (absenceStartDate.equals(absenceEndDate)) {
|
||||||
totalAbsenceHours = BigDecimal.valueOf(8);
|
totalAbsenceHours = BigDecimal.valueOf(8);
|
||||||
}
|
} else if (absenceStartDate.toLocalDate().equals(absenceEndDate.toLocalDate())) {
|
||||||
else if (absenceStartDate.toLocalDate().equals(absenceEndDate.toLocalDate())) {
|
|
||||||
// If the start and end dates are the same, calculate the hour difference
|
// If the start and end dates are the same, calculate the hour difference
|
||||||
long hours = ChronoUnit.HOURS.between(absenceStartDate, absenceEndDate);
|
long hours = ChronoUnit.HOURS.between(absenceStartDate, absenceEndDate);
|
||||||
totalAbsenceHours = BigDecimal.valueOf(hours);
|
totalAbsenceHours = BigDecimal.valueOf(hours);
|
||||||
@@ -93,7 +88,9 @@ public class AbsenceServiceImpl implements AbsenceService {
|
|||||||
DayOfWeek dayOfWeek = currentDate.getDayOfWeek();
|
DayOfWeek dayOfWeek = currentDate.getDayOfWeek();
|
||||||
|
|
||||||
// Exclude Friday (5) and Saturday (6) and holidays
|
// Exclude Friday (5) and Saturday (6) and holidays
|
||||||
if (dayOfWeek != DayOfWeek.FRIDAY && dayOfWeek != DayOfWeek.SATURDAY && !isSpecialOvertimeDay(currentDate)) {
|
if (dayOfWeek != DayOfWeek.FRIDAY
|
||||||
|
&& dayOfWeek != DayOfWeek.SATURDAY
|
||||||
|
&& !isSpecialOvertimeDay(currentDate)) {
|
||||||
absenceDays++;
|
absenceDays++;
|
||||||
}
|
}
|
||||||
currentDate = currentDate.plusDays(1);
|
currentDate = currentDate.plusDays(1);
|
||||||
@@ -105,13 +102,15 @@ public class AbsenceServiceImpl implements AbsenceService {
|
|||||||
return totalAbsenceHours;
|
return totalAbsenceHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal calculateTotalAbsenceMinutes(LocalDateTime absenceStartDate, LocalDateTime absenceEndDate) {
|
public BigDecimal calculateTotalAbsenceMinutes(
|
||||||
|
LocalDateTime absenceStartDate, LocalDateTime absenceEndDate) {
|
||||||
// Calculate the duration between the two LocalDateTime objects
|
// Calculate the duration between the two LocalDateTime objects
|
||||||
Duration duration = Duration.between(absenceStartDate, absenceEndDate);
|
Duration duration = Duration.between(absenceStartDate, absenceEndDate);
|
||||||
|
|
||||||
// Convert the duration to minutes and then divide by 60 to get hours
|
// Convert the duration to minutes and then divide by 60 to get hours
|
||||||
long minutes = duration.toMinutes();
|
long minutes = duration.toMinutes();
|
||||||
BigDecimal hours = BigDecimal.valueOf(minutes).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal hours =
|
||||||
|
BigDecimal.valueOf(minutes).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
|
||||||
return customRound(hours);
|
return customRound(hours);
|
||||||
}
|
}
|
||||||
@@ -147,5 +146,4 @@ public class AbsenceServiceImpl implements AbsenceService {
|
|||||||
return value; // In case no rounding is needed
|
return value; // In case no rounding is needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
package com.axelor.apps.hr.service;
|
package com.axelor.apps.hr.service;
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.Authorization;
|
import com.axelor.apps.hr.db.Authorization;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.repo.AuthorizationRepository;
|
import com.axelor.apps.hr.db.repo.AuthorizationRepository;
|
||||||
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import wslite.json.JSONException;
|
import wslite.json.JSONException;
|
||||||
import wslite.json.JSONObject;
|
import wslite.json.JSONObject;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class AuthorizationServiceImpl implements AuthorizationService {
|
public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
|
|
||||||
@@ -49,10 +45,12 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
String commentaire = jsonObject.getString("commentaire");
|
String commentaire = jsonObject.getString("commentaire");
|
||||||
int validation_status = jsonObject.optInt("validation_status", 2);
|
int validation_status = jsonObject.optInt("validation_status", 2);
|
||||||
String validateByUser = jsonObject.optString("validate_by_user", null);
|
String validateByUser = jsonObject.optString("validate_by_user", null);
|
||||||
String dateValidation = jsonObject.optString("validation_date", null); // Safely get validation_date
|
String dateValidation =
|
||||||
|
jsonObject.optString("validation_date", null); // Safely get validation_date
|
||||||
|
|
||||||
// GET EMPLOYEES
|
// GET EMPLOYEES
|
||||||
Employee employee = employeeRepo
|
Employee employee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", matricule)
|
.bind("matricule", matricule)
|
||||||
@@ -66,7 +64,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
Employee validatedByEmployee = null;
|
Employee validatedByEmployee = null;
|
||||||
|
|
||||||
if (validateByUser != null) {
|
if (validateByUser != null) {
|
||||||
validatedByEmployee = employeeRepo
|
validatedByEmployee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", validateByUser)
|
.bind("matricule", validateByUser)
|
||||||
@@ -82,7 +81,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
LocalDate validationDate = null;
|
LocalDate validationDate = null;
|
||||||
if (dateValidation != null && !dateValidation.isEmpty()) {
|
if (dateValidation != null && !dateValidation.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing dateValidation: " + dateValidation);
|
System.out.println("Error parsing dateValidation: " + dateValidation);
|
||||||
@@ -113,7 +113,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
int newStatus = validation_status; // New status
|
int newStatus = validation_status; // New status
|
||||||
|
|
||||||
if (previousStatus == 2 && newStatus == 3) {
|
if (previousStatus == 2 && newStatus == 3) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
// Update the fields of the existing Authorization
|
// Update the fields of the existing Authorization
|
||||||
authorization.setValidatedByEmployee(validatedByEmployee);
|
authorization.setValidatedByEmployee(validatedByEmployee);
|
||||||
authorization.setValidationDate(validationDate);
|
authorization.setValidationDate(validationDate);
|
||||||
@@ -135,7 +136,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (previousStatus == 2 && newStatus == 4) {
|
} else if (previousStatus == 2 && newStatus == 4) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
authorization.setRefusedByEmployee(validatedByEmployee);
|
authorization.setRefusedByEmployee(validatedByEmployee);
|
||||||
authorization.setRefusalDate(validationDate);
|
authorization.setRefusalDate(validationDate);
|
||||||
authorization.setStatusSelect(newStatus);
|
authorization.setStatusSelect(newStatus);
|
||||||
@@ -162,7 +164,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Daily report
|
// Get Daily report
|
||||||
DailyReport dailyReport = dailyReportRepo
|
DailyReport dailyReport =
|
||||||
|
dailyReportRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
@@ -171,8 +174,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
|
|
||||||
if (dailyReport != null) {
|
if (dailyReport != null) {
|
||||||
authorization.setDailyReport(dailyReport);
|
authorization.setDailyReport(dailyReport);
|
||||||
if(validation_status == 3)
|
if (validation_status == 3) dailyReport.setIsAuthorizedAbsence(true);
|
||||||
dailyReport.setIsAuthorizedAbsence(true);
|
|
||||||
}
|
}
|
||||||
// Save the new Authorization
|
// Save the new Authorization
|
||||||
authorizationRepository.save(authorization);
|
authorizationRepository.save(authorization);
|
||||||
@@ -202,7 +204,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
String dateValidation = jsonObject.optString("validation_date", null);
|
String dateValidation = jsonObject.optString("validation_date", null);
|
||||||
|
|
||||||
// GET EMPLOYEES
|
// GET EMPLOYEES
|
||||||
Employee employee = employeeRepo
|
Employee employee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", matricule)
|
.bind("matricule", matricule)
|
||||||
@@ -216,7 +219,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
Employee validatedByEmployee = null;
|
Employee validatedByEmployee = null;
|
||||||
|
|
||||||
if (validateByUser != null) {
|
if (validateByUser != null) {
|
||||||
validatedByEmployee = employeeRepo
|
validatedByEmployee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", validateByUser)
|
.bind("matricule", validateByUser)
|
||||||
@@ -232,7 +236,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
LocalDate validationDate = null;
|
LocalDate validationDate = null;
|
||||||
if (dateValidation != null && !dateValidation.isEmpty()) {
|
if (dateValidation != null && !dateValidation.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing dateValidation: " + dateValidation);
|
System.out.println("Error parsing dateValidation: " + dateValidation);
|
||||||
@@ -263,7 +268,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
int newStatus = validation_status; // New status
|
int newStatus = validation_status; // New status
|
||||||
|
|
||||||
if (previousStatus == 2 && newStatus == 3) {
|
if (previousStatus == 2 && newStatus == 3) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
// Update the fields of the existing Authorization
|
// Update the fields of the existing Authorization
|
||||||
authorization.setValidatedByEmployee(validatedByEmployee);
|
authorization.setValidatedByEmployee(validatedByEmployee);
|
||||||
authorization.setValidationDate(validationDate);
|
authorization.setValidationDate(validationDate);
|
||||||
@@ -284,7 +290,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
dailyReport.setIsAuthorizedLateArrival(true);
|
dailyReport.setIsAuthorizedLateArrival(true);
|
||||||
}
|
}
|
||||||
} else if (previousStatus == 2 && newStatus == 4) {
|
} else if (previousStatus == 2 && newStatus == 4) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
authorization.setRefusedByEmployee(validatedByEmployee);
|
authorization.setRefusedByEmployee(validatedByEmployee);
|
||||||
authorization.setRefusalDate(validationDate);
|
authorization.setRefusalDate(validationDate);
|
||||||
authorization.setStatusSelect(newStatus);
|
authorization.setStatusSelect(newStatus);
|
||||||
@@ -311,7 +318,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Daily report
|
// Get Daily report
|
||||||
DailyReport dailyReport = dailyReportRepo
|
DailyReport dailyReport =
|
||||||
|
dailyReportRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
@@ -320,8 +328,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
|
|
||||||
if (dailyReport != null) {
|
if (dailyReport != null) {
|
||||||
authorization.setDailyReport(dailyReport);
|
authorization.setDailyReport(dailyReport);
|
||||||
if(validation_status == 3)
|
if (validation_status == 3) dailyReport.setIsAuthorizedLateArrival(true);
|
||||||
dailyReport.setIsAuthorizedLateArrival(true);
|
|
||||||
}
|
}
|
||||||
// Save the new Authorization
|
// Save the new Authorization
|
||||||
authorizationRepository.save(authorization);
|
authorizationRepository.save(authorization);
|
||||||
@@ -352,7 +359,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
String dateValidation = jsonObject.optString("validation_date", null);
|
String dateValidation = jsonObject.optString("validation_date", null);
|
||||||
|
|
||||||
// GET EMPLOYEES
|
// GET EMPLOYEES
|
||||||
Employee employee = employeeRepo
|
Employee employee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", matricule)
|
.bind("matricule", matricule)
|
||||||
@@ -366,7 +374,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
Employee validatedByEmployee = null;
|
Employee validatedByEmployee = null;
|
||||||
|
|
||||||
if (validateByUser != null) {
|
if (validateByUser != null) {
|
||||||
validatedByEmployee = employeeRepo
|
validatedByEmployee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", validateByUser)
|
.bind("matricule", validateByUser)
|
||||||
@@ -382,7 +391,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
LocalDate validationDate = null;
|
LocalDate validationDate = null;
|
||||||
if (dateValidation != null && !dateValidation.isEmpty()) {
|
if (dateValidation != null && !dateValidation.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing dateValidation: " + dateValidation);
|
System.out.println("Error parsing dateValidation: " + dateValidation);
|
||||||
@@ -400,7 +410,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if Authorization exists by ticketId
|
// Check if Authorization exists by ticketId
|
||||||
Authorization authorization = authorizationRepository
|
Authorization authorization =
|
||||||
|
authorizationRepository
|
||||||
.all()
|
.all()
|
||||||
.filter("self.ticketId = :ticketId")
|
.filter("self.ticketId = :ticketId")
|
||||||
.bind("ticketId", idInt)
|
.bind("ticketId", idInt)
|
||||||
@@ -412,7 +423,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
int newStatus = validation_status; // New status
|
int newStatus = validation_status; // New status
|
||||||
|
|
||||||
if (previousStatus == 2 && newStatus == 3) {
|
if (previousStatus == 2 && newStatus == 3) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
// Update the fields of the existing Authorization
|
// Update the fields of the existing Authorization
|
||||||
authorization.setValidatedByEmployee(validatedByEmployee);
|
authorization.setValidatedByEmployee(validatedByEmployee);
|
||||||
authorization.setValidationDate(validationDate);
|
authorization.setValidationDate(validationDate);
|
||||||
@@ -434,7 +446,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (previousStatus == 2 && newStatus == 4) {
|
} else if (previousStatus == 2 && newStatus == 4) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
authorization.setRefusedByEmployee(validatedByEmployee);
|
authorization.setRefusedByEmployee(validatedByEmployee);
|
||||||
authorization.setRefusalDate(validationDate);
|
authorization.setRefusalDate(validationDate);
|
||||||
authorization.setStatusSelect(newStatus);
|
authorization.setStatusSelect(newStatus);
|
||||||
@@ -462,7 +475,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Daily report
|
// Get Daily report
|
||||||
DailyReport dailyReport = dailyReportRepo
|
DailyReport dailyReport =
|
||||||
|
dailyReportRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
@@ -471,8 +485,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
|
|
||||||
if (dailyReport != null) {
|
if (dailyReport != null) {
|
||||||
authorization.setDailyReport(dailyReport);
|
authorization.setDailyReport(dailyReport);
|
||||||
if(validation_status == 3)
|
if (validation_status == 3) dailyReport.setIsAuthorizedEarlyDeparture(true);
|
||||||
dailyReport.setIsAuthorizedEarlyDeparture(true);
|
|
||||||
}
|
}
|
||||||
// Save the new Authorization
|
// Save the new Authorization
|
||||||
authorizationRepository.save(authorization);
|
authorizationRepository.save(authorization);
|
||||||
@@ -502,7 +515,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
String dateValidation = jsonObject.optString("validation_date", null);
|
String dateValidation = jsonObject.optString("validation_date", null);
|
||||||
|
|
||||||
// GET EMPLOYEES
|
// GET EMPLOYEES
|
||||||
Employee employee = employeeRepo
|
Employee employee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", matricule)
|
.bind("matricule", matricule)
|
||||||
@@ -516,7 +530,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
Employee validatedByEmployee = null;
|
Employee validatedByEmployee = null;
|
||||||
|
|
||||||
if (validateByUser != null) {
|
if (validateByUser != null) {
|
||||||
validatedByEmployee = employeeRepo
|
validatedByEmployee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", validateByUser)
|
.bind("matricule", validateByUser)
|
||||||
@@ -532,7 +547,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
LocalDate validationDate = null;
|
LocalDate validationDate = null;
|
||||||
if (dateValidation != null && !dateValidation.isEmpty()) {
|
if (dateValidation != null && !dateValidation.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing dateValidation: " + dateValidation);
|
System.out.println("Error parsing dateValidation: " + dateValidation);
|
||||||
@@ -550,7 +566,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if Authorization exists by ticketId
|
// Check if Authorization exists by ticketId
|
||||||
Authorization authorization = authorizationRepository
|
Authorization authorization =
|
||||||
|
authorizationRepository
|
||||||
.all()
|
.all()
|
||||||
.filter("self.ticketId = :ticketId")
|
.filter("self.ticketId = :ticketId")
|
||||||
.bind("ticketId", idInt)
|
.bind("ticketId", idInt)
|
||||||
@@ -562,7 +579,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
int newStatus = validation_status; // New status
|
int newStatus = validation_status; // New status
|
||||||
|
|
||||||
if (previousStatus == 2 && newStatus == 3) {
|
if (previousStatus == 2 && newStatus == 3) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
// Update the fields of the existing Authorization
|
// Update the fields of the existing Authorization
|
||||||
authorization.setValidatedByEmployee(validatedByEmployee);
|
authorization.setValidatedByEmployee(validatedByEmployee);
|
||||||
authorization.setValidationDate(validationDate);
|
authorization.setValidationDate(validationDate);
|
||||||
@@ -584,7 +602,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (previousStatus == 2 && newStatus == 4) {
|
} else if (previousStatus == 2 && newStatus == 4) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
authorization.setRefusedByEmployee(validatedByEmployee);
|
authorization.setRefusedByEmployee(validatedByEmployee);
|
||||||
authorization.setRefusalDate(validationDate);
|
authorization.setRefusalDate(validationDate);
|
||||||
authorization.setStatusSelect(newStatus);
|
authorization.setStatusSelect(newStatus);
|
||||||
@@ -612,7 +631,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Daily report
|
// Get Daily report
|
||||||
DailyReport dailyReport = dailyReportRepo
|
DailyReport dailyReport =
|
||||||
|
dailyReportRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
.filter("self.employee = :employee and self.reportDate = :reportDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
@@ -621,8 +641,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
|
|
||||||
if (dailyReport != null) {
|
if (dailyReport != null) {
|
||||||
authorization.setDailyReport(dailyReport);
|
authorization.setDailyReport(dailyReport);
|
||||||
if(validation_status == 3)
|
if (validation_status == 3) dailyReport.setIsAuthorizedAbsence(true);
|
||||||
dailyReport.setIsAuthorizedAbsence(true);
|
|
||||||
}
|
}
|
||||||
// Save the new Authorization
|
// Save the new Authorization
|
||||||
authorizationRepository.save(authorization);
|
authorizationRepository.save(authorization);
|
||||||
@@ -638,7 +657,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
// Helper function to parse dates
|
// Helper function to parse dates
|
||||||
private LocalDate parseDate(String dateString) {
|
private LocalDate parseDate(String dateString) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateString, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateString, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
return offsetDateTime.toLocalDate();
|
return offsetDateTime.toLocalDate();
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing date: " + dateString);
|
System.out.println("Error parsing date: " + dateString);
|
||||||
|
|||||||
@@ -2,23 +2,22 @@ package com.axelor.apps.hr.service;
|
|||||||
|
|
||||||
import com.axelor.apps.base.db.EventsPlanning;
|
import com.axelor.apps.base.db.EventsPlanning;
|
||||||
import com.axelor.apps.base.db.EventsPlanningLine;
|
import com.axelor.apps.base.db.EventsPlanningLine;
|
||||||
import com.axelor.apps.base.db.repo.EventsPlanningRepository;
|
|
||||||
import com.axelor.apps.base.db.repo.EventsPlanningLineRepository;
|
import com.axelor.apps.base.db.repo.EventsPlanningLineRepository;
|
||||||
import com.axelor.apps.hr.db.Absence;
|
import com.axelor.apps.hr.db.Absence;
|
||||||
|
import com.axelor.apps.hr.db.Authorization;
|
||||||
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.OffDayWork;
|
import com.axelor.apps.hr.db.OffDayWork;
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
|
||||||
import com.axelor.apps.hr.db.Shift;
|
import com.axelor.apps.hr.db.Shift;
|
||||||
import com.axelor.apps.hr.db.Authorization;
|
|
||||||
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
||||||
import com.axelor.apps.hr.db.repo.AuthorizationRepository;
|
import com.axelor.apps.hr.db.repo.AuthorizationRepository;
|
||||||
import com.axelor.apps.hr.db.repo.OffDayWorkRepository;
|
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.OffDayWorkRepository;
|
||||||
import com.axelor.apps.hr.db.repo.ShiftRepository;
|
import com.axelor.apps.hr.db.repo.ShiftRepository;
|
||||||
import com.axelor.apps.hr.service.AbsenceServiceImpl;
|
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
import com.google.inject.persist.Transactional;
|
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.persist.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
@@ -26,10 +25,8 @@ import java.time.Duration;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.Year;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import com.google.inject.Inject;
|
import java.util.List;
|
||||||
|
|
||||||
public class DailyReportServiceImpl implements DailyReportService {
|
public class DailyReportServiceImpl implements DailyReportService {
|
||||||
|
|
||||||
@@ -52,23 +49,35 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
private LocalTime SHIFT_6h14_max;
|
private LocalTime SHIFT_6h14_max;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DailyReportServiceImpl(DailyReportRepository dailyReportRepository, AuthorizationRepository autorizationRepository, AbsenceRepository absenceRepository) {
|
public DailyReportServiceImpl(
|
||||||
|
DailyReportRepository dailyReportRepository,
|
||||||
|
AuthorizationRepository autorizationRepository,
|
||||||
|
AbsenceRepository absenceRepository) {
|
||||||
this.dailyReportRepository = dailyReportRepository;
|
this.dailyReportRepository = dailyReportRepository;
|
||||||
this.autorizationRepository = autorizationRepository;
|
this.autorizationRepository = autorizationRepository;
|
||||||
this.absenceRepository = absenceRepository;
|
this.absenceRepository = absenceRepository;
|
||||||
eventsPlanningLines = Beans.get(EventsPlanningLineRepository.class)
|
eventsPlanningLines =
|
||||||
|
Beans.get(EventsPlanningLineRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.eventsPlanning = 4")
|
.filter("self.eventsPlanning = 4")
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
SHIFT_8h16_min = Beans.get(ShiftRepository.class).all().filter("self.shift = 0").fetchOne().getEnterMin();
|
SHIFT_8h16_min =
|
||||||
SHIFT_8h16_max = Beans.get(ShiftRepository.class).all().filter("self.shift = 0").fetchOne().getEnterMax();
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 0").fetchOne().getEnterMin();
|
||||||
SHIFT_14h22_min = Beans.get(ShiftRepository.class).all().filter("self.shift = 1").fetchOne().getEnterMin();
|
SHIFT_8h16_max =
|
||||||
SHIFT_14h22_max = Beans.get(ShiftRepository.class).all().filter("self.shift = 1").fetchOne().getEnterMax();
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 0").fetchOne().getEnterMax();
|
||||||
SHIFT_22h6_min = Beans.get(ShiftRepository.class).all().filter("self.shift = 2").fetchOne().getEnterMin();
|
SHIFT_14h22_min =
|
||||||
SHIFT_22h6_max = Beans.get(ShiftRepository.class).all().filter("self.shift = 2").fetchOne().getEnterMax();
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 1").fetchOne().getEnterMin();
|
||||||
SHIFT_6h14_min = Beans.get(ShiftRepository.class).all().filter("self.shift = 3").fetchOne().getEnterMin();
|
SHIFT_14h22_max =
|
||||||
SHIFT_6h14_max = Beans.get(ShiftRepository.class).all().filter("self.shift = 3").fetchOne().getEnterMax();
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 1").fetchOne().getEnterMax();
|
||||||
|
SHIFT_22h6_min =
|
||||||
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 2").fetchOne().getEnterMin();
|
||||||
|
SHIFT_22h6_max =
|
||||||
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 2").fetchOne().getEnterMax();
|
||||||
|
SHIFT_6h14_min =
|
||||||
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 3").fetchOne().getEnterMin();
|
||||||
|
SHIFT_6h14_max =
|
||||||
|
Beans.get(ShiftRepository.class).all().filter("self.shift = 3").fetchOne().getEnterMax();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,7 +99,10 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
|
|
||||||
LocalDateTime firstEnter, lastQuit;
|
LocalDateTime firstEnter, lastQuit;
|
||||||
|
|
||||||
LocalTime shiftStartHour = null, shiftEndHour = null, shiftStartPauseHour = null, shiftEndPauseHour = null;
|
LocalTime shiftStartHour = null,
|
||||||
|
shiftEndHour = null,
|
||||||
|
shiftStartPauseHour = null,
|
||||||
|
shiftEndPauseHour = null;
|
||||||
if (shift != null) {
|
if (shift != null) {
|
||||||
shiftStartHour = dailyReport.getShift().getStartHour();
|
shiftStartHour = dailyReport.getShift().getStartHour();
|
||||||
shiftEndHour = dailyReport.getShift().getEndHour();
|
shiftEndHour = dailyReport.getShift().getEndHour();
|
||||||
@@ -122,7 +134,9 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
if (shiftStartHour != null) {
|
if (shiftStartHour != null) {
|
||||||
if (firstEnterTime.isAfter(shiftStartHour)) {
|
if (firstEnterTime.isAfter(shiftStartHour)) {
|
||||||
long minutesLate = Duration.between(shiftStartHour, firstEnterTime).toMinutes();
|
long minutesLate = Duration.between(shiftStartHour, firstEnterTime).toMinutes();
|
||||||
BigDecimal lateArrival = BigDecimal.valueOf(minutesLate).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal lateArrival =
|
||||||
|
BigDecimal.valueOf(minutesLate)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setLateArrival(lateArrival);
|
dailyReport.setLateArrival(lateArrival);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +145,9 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
if (shiftEndHour != null) {
|
if (shiftEndHour != null) {
|
||||||
if (lastQuitTime.isBefore(shiftEndHour)) {
|
if (lastQuitTime.isBefore(shiftEndHour)) {
|
||||||
long minutesEarly = Duration.between(lastQuitTime, shiftEndHour).toMinutes();
|
long minutesEarly = Duration.between(lastQuitTime, shiftEndHour).toMinutes();
|
||||||
BigDecimal earlyDeparture = BigDecimal.valueOf(minutesEarly).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal earlyDeparture =
|
||||||
|
BigDecimal.valueOf(minutesEarly)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setEarlyDeparture(earlyDeparture);
|
dailyReport.setEarlyDeparture(earlyDeparture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,23 +155,28 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
// Total hours
|
// Total hours
|
||||||
totalDuration = totalDuration.plus(Duration.between(firstEnter, lastQuit));
|
totalDuration = totalDuration.plus(Duration.between(firstEnter, lastQuit));
|
||||||
long totalMinutes = totalDuration.toMinutes();
|
long totalMinutes = totalDuration.toMinutes();
|
||||||
BigDecimal totalHours = BigDecimal.valueOf(totalMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal totalHours =
|
||||||
|
BigDecimal.valueOf(totalMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setWorkHours(totalHours);
|
dailyReport.setWorkHours(totalHours);
|
||||||
|
|
||||||
// Calculate night hours
|
// Calculate night hours
|
||||||
nightDuration = calculateNightDuration(firstEnter, lastQuit);
|
nightDuration = calculateNightDuration(firstEnter, lastQuit);
|
||||||
long totalNightMinutes = nightDuration.toMinutes();
|
long totalNightMinutes = nightDuration.toMinutes();
|
||||||
BigDecimal totalNightHours = BigDecimal.valueOf(totalNightMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal totalNightHours =
|
||||||
|
BigDecimal.valueOf(totalNightMinutes)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setNightHours(totalNightHours);
|
dailyReport.setNightHours(totalNightHours);
|
||||||
|
|
||||||
// Break Hours
|
// Break Hours
|
||||||
breakDuration = calculateBreakDuration(enters, quits);
|
breakDuration = calculateBreakDuration(enters, quits);
|
||||||
long breakMinutes = breakDuration.toMinutes();
|
long breakMinutes = breakDuration.toMinutes();
|
||||||
BigDecimal breakHours = BigDecimal.valueOf(breakMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal breakHours =
|
||||||
|
BigDecimal.valueOf(breakMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setBreakHours(breakHours);
|
dailyReport.setBreakHours(breakHours);
|
||||||
|
|
||||||
if (shiftStartPauseHour != null && shiftEndPauseHour != null) {
|
if (shiftStartPauseHour != null && shiftEndPauseHour != null) {
|
||||||
boolean allInAllowedRange = areBreaksInAllowedRange(enters, quits, shiftStartPauseHour, shiftEndPauseHour);
|
boolean allInAllowedRange =
|
||||||
|
areBreaksInAllowedRange(enters, quits, shiftStartPauseHour, shiftEndPauseHour);
|
||||||
dailyReport.setBreakNotInTheAllowedRange(allInAllowedRange);
|
dailyReport.setBreakNotInTheAllowedRange(allInAllowedRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,14 +193,19 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
// Calculate time from first enter to midnight
|
// Calculate time from first enter to midnight
|
||||||
Duration beforeMidnightDuration = Duration.between(firstEnter, midnight);
|
Duration beforeMidnightDuration = Duration.between(firstEnter, midnight);
|
||||||
long beforeMidnightMinutes = beforeMidnightDuration.toMinutes();
|
long beforeMidnightMinutes = beforeMidnightDuration.toMinutes();
|
||||||
BigDecimal beforeMidnightHours = BigDecimal.valueOf(beforeMidnightMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal beforeMidnightHours =
|
||||||
|
BigDecimal.valueOf(beforeMidnightMinutes)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
// Calculate time from midnight to last quit
|
// Calculate time from midnight to last quit
|
||||||
Duration afterMidnightDuration = Duration.between(midnight, lastQuit);
|
Duration afterMidnightDuration = Duration.between(midnight, lastQuit);
|
||||||
long afterMidnightMinutes = afterMidnightDuration.toMinutes();
|
long afterMidnightMinutes = afterMidnightDuration.toMinutes();
|
||||||
BigDecimal afterMidnightHours = BigDecimal.valueOf(afterMidnightMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal afterMidnightHours =
|
||||||
|
BigDecimal.valueOf(afterMidnightMinutes)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
if (enterDay == DayOfWeek.THURSDAY && quitDay == DayOfWeek.FRIDAY || isSpecialOvertimeDay(lastQuit)) {
|
if (enterDay == DayOfWeek.THURSDAY && quitDay == DayOfWeek.FRIDAY
|
||||||
|
|| isSpecialOvertimeDay(lastQuit)) {
|
||||||
extraHours100 = afterMidnightHours;
|
extraHours100 = afterMidnightHours;
|
||||||
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
if (enterDay == DayOfWeek.THURSDAY && quitDay == DayOfWeek.FRIDAY)
|
if (enterDay == DayOfWeek.THURSDAY && quitDay == DayOfWeek.FRIDAY)
|
||||||
@@ -207,7 +233,9 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
} else {
|
} else {
|
||||||
totalSupDuration = calculateSupplementaryHours(firstEnter, lastQuit, shift, reportDate);
|
totalSupDuration = calculateSupplementaryHours(firstEnter, lastQuit, shift, reportDate);
|
||||||
long totalSupMinutes = totalSupDuration.toMinutes();
|
long totalSupMinutes = totalSupDuration.toMinutes();
|
||||||
extraHours50 = BigDecimal.valueOf(totalSupMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
extraHours50 =
|
||||||
|
BigDecimal.valueOf(totalSupMinutes)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +247,9 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
// Calculate supplementary hours
|
// Calculate supplementary hours
|
||||||
totalSupDuration = calculateSupplementaryHours(firstEnter, lastQuit, shift, reportDate);
|
totalSupDuration = calculateSupplementaryHours(firstEnter, lastQuit, shift, reportDate);
|
||||||
long totalSupMinutes = totalSupDuration.toMinutes();
|
long totalSupMinutes = totalSupDuration.toMinutes();
|
||||||
BigDecimal totalSupHours = BigDecimal.valueOf(totalSupMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal totalSupHours =
|
||||||
|
BigDecimal.valueOf(totalSupMinutes)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
// Holidays and weekends
|
// Holidays and weekends
|
||||||
if (firstEnter.getDayOfWeek() == DayOfWeek.SATURDAY) {
|
if (firstEnter.getDayOfWeek() == DayOfWeek.SATURDAY) {
|
||||||
@@ -227,13 +257,16 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
if (shift == 0 || shift == 3) {
|
if (shift == 0 || shift == 3) {
|
||||||
dailyReport.setExtraHours50(totalHours.subtract(totalNightHours));
|
dailyReport.setExtraHours50(totalHours.subtract(totalNightHours));
|
||||||
dailyReport.setExtraHours100(totalNightHours);
|
dailyReport.setExtraHours100(totalNightHours);
|
||||||
dailyReport.setAllowanceRecall(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowanceRecall(
|
||||||
|
totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
dailyReport.setExtraHours50(totalHours);
|
dailyReport.setExtraHours50(totalHours);
|
||||||
dailyReport.setAllowanceRecall(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowanceRecall(
|
||||||
|
totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (firstEnter.getDayOfWeek() == DayOfWeek.FRIDAY || isSpecialOvertimeDay(firstEnter)) {
|
} else if (firstEnter.getDayOfWeek() == DayOfWeek.FRIDAY
|
||||||
|
|| isSpecialOvertimeDay(firstEnter)) {
|
||||||
|
|
||||||
// Add recup
|
// Add recup
|
||||||
if (totalHours.compareTo(BigDecimal.valueOf(6)) >= 0)
|
if (totalHours.compareTo(BigDecimal.valueOf(6)) >= 0)
|
||||||
@@ -247,11 +280,13 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
dailyReport.setExtraHours50(totalSupHours.subtract(totalNightHours));
|
dailyReport.setExtraHours50(totalSupHours.subtract(totalNightHours));
|
||||||
dailyReport.setExtraHours100(totalNightHours);
|
dailyReport.setExtraHours100(totalNightHours);
|
||||||
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
dailyReport.setAllowanceRecall(totalSupHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowanceRecall(
|
||||||
|
totalSupHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
dailyReport.setExtraHours50(totalSupHours);
|
dailyReport.setExtraHours50(totalSupHours);
|
||||||
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
dailyReport.setAllowanceRecall(totalSupHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowanceRecall(
|
||||||
|
totalSupHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,7 +309,8 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
lastQuit = quits[quits.length - 1];
|
lastQuit = quits[quits.length - 1];
|
||||||
totalDuration = totalDuration.plus(Duration.between(firstEnter, lastQuit));
|
totalDuration = totalDuration.plus(Duration.between(firstEnter, lastQuit));
|
||||||
long totalMinutes = totalDuration.toMinutes();
|
long totalMinutes = totalDuration.toMinutes();
|
||||||
BigDecimal totalHours = BigDecimal.valueOf(totalMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal totalHours =
|
||||||
|
BigDecimal.valueOf(totalMinutes).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setWorkHours(totalHours);
|
dailyReport.setWorkHours(totalHours);
|
||||||
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
dailyReport.setAllowance(totalHours.compareTo(BigDecimal.valueOf(5)) >= 0 ? 1 : 0);
|
||||||
|
|
||||||
@@ -284,14 +320,17 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
// Calculate late arrival if firstEnter is later than shift start
|
// Calculate late arrival if firstEnter is later than shift start
|
||||||
if (firstEnterTime.isAfter(shiftStartHour)) {
|
if (firstEnterTime.isAfter(shiftStartHour)) {
|
||||||
long minutesLate = Duration.between(shiftStartHour, firstEnterTime).toMinutes();
|
long minutesLate = Duration.between(shiftStartHour, firstEnterTime).toMinutes();
|
||||||
BigDecimal lateArrival = BigDecimal.valueOf(minutesLate).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal lateArrival =
|
||||||
|
BigDecimal.valueOf(minutesLate).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setLateArrival(lateArrival);
|
dailyReport.setLateArrival(lateArrival);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate early departure if lastQuit is earlier than shift end
|
// Calculate early departure if lastQuit is earlier than shift end
|
||||||
if (lastQuitTime.isBefore(shiftEndHour)) {
|
if (lastQuitTime.isBefore(shiftEndHour)) {
|
||||||
long minutesEarly = Duration.between(lastQuitTime, shiftEndHour).toMinutes();
|
long minutesEarly = Duration.between(lastQuitTime, shiftEndHour).toMinutes();
|
||||||
BigDecimal earlyDeparture = BigDecimal.valueOf(minutesEarly).divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
BigDecimal earlyDeparture =
|
||||||
|
BigDecimal.valueOf(minutesEarly)
|
||||||
|
.divide(BigDecimal.valueOf(60), 2, RoundingMode.HALF_UP);
|
||||||
dailyReport.setEarlyDeparture(earlyDeparture);
|
dailyReport.setEarlyDeparture(earlyDeparture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,11 +356,15 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
|
|
||||||
// Absences
|
// Absences
|
||||||
if (dailyReport.getAbsence() == null) {
|
if (dailyReport.getAbsence() == null) {
|
||||||
Absence absence = Beans.get(AbsenceRepository.class)
|
Absence absence =
|
||||||
|
Beans.get(AbsenceRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.startDate <= :reportDate and self.endDate >= :reportDate and (self.archived = false or self.archived is null)")
|
.filter(
|
||||||
|
"self.employee = :employee and self.startDate <= :reportDate and self.endDate >= :reportDate and (self.archived = false or self.archived is null)")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
.bind("reportDate",reportDate) // Changed from absenceStartDate and absenceEndDate to reportDate
|
.bind(
|
||||||
|
"reportDate",
|
||||||
|
reportDate) // Changed from absenceStartDate and absenceEndDate to reportDate
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
if (absence != null) {
|
if (absence != null) {
|
||||||
@@ -331,7 +374,8 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
|
|
||||||
// Authorization
|
// Authorization
|
||||||
if (dailyReport.getAuthorizationList() == null) {
|
if (dailyReport.getAuthorizationList() == null) {
|
||||||
List<Authorization> authorizations = Beans.get(AuthorizationRepository.class)
|
List<Authorization> authorizations =
|
||||||
|
Beans.get(AuthorizationRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.requisitionDate = :reportDate")
|
.filter("self.employee = :employee and self.requisitionDate = :reportDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
@@ -339,7 +383,8 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
if (authorizations != null) {
|
if (authorizations != null) {
|
||||||
List<Authorization> authorizationList = new ArrayList<>(); // Create a new list for authorizations
|
List<Authorization> authorizationList =
|
||||||
|
new ArrayList<>(); // Create a new list for authorizations
|
||||||
|
|
||||||
for (Authorization authorization : authorizations) {
|
for (Authorization authorization : authorizations) {
|
||||||
authorization.setDailyReport(dailyReport);
|
authorization.setDailyReport(dailyReport);
|
||||||
@@ -367,12 +412,14 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Weekends
|
// Weekends
|
||||||
if (reportDate.getDayOfWeek() == DayOfWeek.FRIDAY || reportDate.getDayOfWeek() == DayOfWeek.SATURDAY) {
|
if (reportDate.getDayOfWeek() == DayOfWeek.FRIDAY
|
||||||
|
|| reportDate.getDayOfWeek() == DayOfWeek.SATURDAY) {
|
||||||
dailyReport.setIsWeekend(true);
|
dailyReport.setIsWeekend(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Absence Hours
|
// Absence Hours
|
||||||
if (!(dailyReport.getIsWeekend() || dailyReport.getIsFerieDay()) && dailyReport.getWorkHours().compareTo(BigDecimal.valueOf(8)) < 0) {
|
if (!(dailyReport.getIsWeekend() || dailyReport.getIsFerieDay())
|
||||||
|
&& dailyReport.getWorkHours().compareTo(BigDecimal.valueOf(8)) < 0) {
|
||||||
dailyReport.setAbsenceHours(BigDecimal.valueOf(8).subtract(dailyReport.getWorkHours()));
|
dailyReport.setAbsenceHours(BigDecimal.valueOf(8).subtract(dailyReport.getWorkHours()));
|
||||||
// Create Absence AI
|
// Create Absence AI
|
||||||
if (dailyReport.getAbsenceSet().isEmpty()) {
|
if (dailyReport.getAbsenceSet().isEmpty()) {
|
||||||
@@ -387,34 +434,46 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
absence.setAbsenceType(19); // Absence irrégulière
|
absence.setAbsenceType(19); // Absence irrégulière
|
||||||
absence.setStartDate(reportDate.atStartOfDay());
|
absence.setStartDate(reportDate.atStartOfDay());
|
||||||
absence.setEndDate(reportDate.atStartOfDay());
|
absence.setEndDate(reportDate.atStartOfDay());
|
||||||
BigDecimal totalAbsenceHours = Beans.get(AbsenceServiceImpl.class).calculateTotalAbsenceHours(reportDate.atStartOfDay(),reportDate.atStartOfDay());
|
BigDecimal totalAbsenceHours =
|
||||||
|
Beans.get(AbsenceServiceImpl.class)
|
||||||
|
.calculateTotalAbsenceHours(
|
||||||
|
reportDate.atStartOfDay(), reportDate.atStartOfDay());
|
||||||
absence.setTotalAbsenceHours(totalAbsenceHours);
|
absence.setTotalAbsenceHours(totalAbsenceHours);
|
||||||
absenceRepository.save(absence);
|
absenceRepository.save(absence);
|
||||||
dailyReport.addAbsenceSetItem(absence);
|
dailyReport.addAbsenceSetItem(absence);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(dailyReport.getShift().getMaxTimeLateArrival() != null){ // to check that is different to shift N/A
|
if (dailyReport.getShift().getMaxTimeLateArrival()
|
||||||
|
!= null) { // to check that is different to shift N/A
|
||||||
LocalTime firstEnterTime = dailyReport.getEnter1().toLocalTime();
|
LocalTime firstEnterTime = dailyReport.getEnter1().toLocalTime();
|
||||||
if(firstEnterTime.isAfter(dailyReport.getShift().getMaxTimeLateArrival()) && !isAuthorizedLateArrival){
|
if (firstEnterTime.isAfter(dailyReport.getShift().getMaxTimeLateArrival())
|
||||||
|
&& !isAuthorizedLateArrival) {
|
||||||
Absence absence = new Absence();
|
Absence absence = new Absence();
|
||||||
absence.setEmployee(employee);
|
absence.setEmployee(employee);
|
||||||
absence.setAbsenceType(20); // Retard irrégulier
|
absence.setAbsenceType(20); // Retard irrégulier
|
||||||
absence.setStartDate(reportDate.atTime(shiftStartHour));
|
absence.setStartDate(reportDate.atTime(shiftStartHour));
|
||||||
absence.setEndDate(dailyReport.getEnter1());
|
absence.setEndDate(dailyReport.getEnter1());
|
||||||
BigDecimal totalAbsenceHours = Beans.get(AbsenceServiceImpl.class).calculateTotalAbsenceMinutes(reportDate.atTime(shiftStartHour),dailyReport.getEnter1());
|
BigDecimal totalAbsenceHours =
|
||||||
|
Beans.get(AbsenceServiceImpl.class)
|
||||||
|
.calculateTotalAbsenceMinutes(
|
||||||
|
reportDate.atTime(shiftStartHour), dailyReport.getEnter1());
|
||||||
absence.setTotalAbsenceHours(totalAbsenceHours);
|
absence.setTotalAbsenceHours(totalAbsenceHours);
|
||||||
absenceRepository.save(absence);
|
absenceRepository.save(absence);
|
||||||
dailyReport.addAbsenceSetItem(absence);
|
dailyReport.addAbsenceSetItem(absence);
|
||||||
}
|
}
|
||||||
if (dailyReport.getLastQuit() != null) {
|
if (dailyReport.getLastQuit() != null) {
|
||||||
LocalTime lastQuitTime = dailyReport.getLastQuit().toLocalTime();
|
LocalTime lastQuitTime = dailyReport.getLastQuit().toLocalTime();
|
||||||
if(lastQuitTime.isBefore(dailyReport.getShift().getMaxTimeEarlyDeparture()) && !isAuthorizedEarlyDeparture){
|
if (lastQuitTime.isBefore(dailyReport.getShift().getMaxTimeEarlyDeparture())
|
||||||
|
&& !isAuthorizedEarlyDeparture) {
|
||||||
Absence absence = new Absence();
|
Absence absence = new Absence();
|
||||||
absence.setEmployee(employee);
|
absence.setEmployee(employee);
|
||||||
absence.setAbsenceType(21); // Départ irrégulier
|
absence.setAbsenceType(21); // Départ irrégulier
|
||||||
absence.setStartDate(dailyReport.getLastQuit());
|
absence.setStartDate(dailyReport.getLastQuit());
|
||||||
absence.setEndDate(reportDate.atTime(shiftEndHour));
|
absence.setEndDate(reportDate.atTime(shiftEndHour));
|
||||||
BigDecimal totalAbsenceHours = Beans.get(AbsenceServiceImpl.class).calculateTotalAbsenceMinutes(dailyReport.getLastQuit(),reportDate.atTime(shiftEndHour));
|
BigDecimal totalAbsenceHours =
|
||||||
|
Beans.get(AbsenceServiceImpl.class)
|
||||||
|
.calculateTotalAbsenceMinutes(
|
||||||
|
dailyReport.getLastQuit(), reportDate.atTime(shiftEndHour));
|
||||||
absence.setTotalAbsenceHours(totalAbsenceHours);
|
absence.setTotalAbsenceHours(totalAbsenceHours);
|
||||||
absenceRepository.save(absence);
|
absenceRepository.save(absence);
|
||||||
dailyReport.addAbsenceSetItem(absence);
|
dailyReport.addAbsenceSetItem(absence);
|
||||||
@@ -499,7 +558,8 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
return nightDuration1;
|
return nightDuration1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Duration calculateSupplementaryHours(LocalDateTime enter, LocalDateTime quit, int shift, LocalDate reportDate) {
|
private Duration calculateSupplementaryHours(
|
||||||
|
LocalDateTime enter, LocalDateTime quit, int shift, LocalDate reportDate) {
|
||||||
|
|
||||||
// Calculate Supp hours for (0,1,2,3) shifts
|
// Calculate Supp hours for (0,1,2,3) shifts
|
||||||
Shift shiftInstance =
|
Shift shiftInstance =
|
||||||
@@ -549,7 +609,11 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
return breakDuration;
|
return breakDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean areBreaksInAllowedRange(LocalDateTime[] enters, LocalDateTime[] quits, LocalTime allowedStartTime, LocalTime allowedEndTime) {
|
private boolean areBreaksInAllowedRange(
|
||||||
|
LocalDateTime[] enters,
|
||||||
|
LocalDateTime[] quits,
|
||||||
|
LocalTime allowedStartTime,
|
||||||
|
LocalTime allowedEndTime) {
|
||||||
|
|
||||||
for (int i = 1; i < quits.length; i++) {
|
for (int i = 1; i < quits.length; i++) {
|
||||||
if (enters[i] != null && quits[i - 1] != null) {
|
if (enters[i] != null && quits[i - 1] != null) {
|
||||||
@@ -568,10 +632,8 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
|
|
||||||
private BigDecimal calculateItp(BigDecimal totalHours, Integer shift, Boolean hasItp) {
|
private BigDecimal calculateItp(BigDecimal totalHours, Integer shift, Boolean hasItp) {
|
||||||
// Shift 0 (no itp)
|
// Shift 0 (no itp)
|
||||||
if (hasItp == true && shift != 0)
|
if (hasItp == true && shift != 0) return totalHours.min(BigDecimal.valueOf(8));
|
||||||
return totalHours.min(BigDecimal.valueOf(8));
|
else return BigDecimal.ZERO;
|
||||||
else
|
|
||||||
return BigDecimal.ZERO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createOffDayWork(LocalDate reportDate, Employee employee) {
|
private void createOffDayWork(LocalDate reportDate, Employee employee) {
|
||||||
@@ -651,7 +713,9 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void deducePrimes(DailyReport dailyReport, Integer primeSelection, BigDecimal valueToDeduce) throws AxelorException {
|
public void deducePrimes(
|
||||||
|
DailyReport dailyReport, Integer primeSelection, BigDecimal valueToDeduce)
|
||||||
|
throws AxelorException {
|
||||||
switch (primeSelection) {
|
switch (primeSelection) {
|
||||||
case 1: // ITP
|
case 1: // ITP
|
||||||
dailyReport.setDeduceItp(true);
|
dailyReport.setDeduceItp(true);
|
||||||
@@ -676,10 +740,11 @@ public class DailyReportServiceImpl implements DailyReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void massDeducePrimes(List<DailyReport> dailyReportList, Integer primeSelection, BigDecimal valueToDeduce) throws AxelorException {
|
public void massDeducePrimes(
|
||||||
|
List<DailyReport> dailyReportList, Integer primeSelection, BigDecimal valueToDeduce)
|
||||||
|
throws AxelorException {
|
||||||
for (DailyReport dailyReport : dailyReportList) {
|
for (DailyReport dailyReport : dailyReportList) {
|
||||||
this.deducePrimes(dailyReport, primeSelection, valueToDeduce);
|
this.deducePrimes(dailyReport, primeSelection, valueToDeduce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ package com.axelor.apps.hr.service;
|
|||||||
|
|
||||||
import com.axelor.apps.base.db.Period;
|
import com.axelor.apps.base.db.Period;
|
||||||
import com.axelor.apps.hr.db.Absence;
|
import com.axelor.apps.hr.db.Absence;
|
||||||
import com.axelor.apps.hr.db.Authorization;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.LeaveRequest;
|
import com.axelor.apps.hr.db.LeaveRequest;
|
||||||
import com.axelor.apps.hr.db.MonthlyReport;
|
import com.axelor.apps.hr.db.MonthlyReport;
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
|
||||||
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
||||||
import com.axelor.apps.hr.db.repo.AuthorizationRepository;
|
import com.axelor.apps.hr.db.repo.AuthorizationRepository;
|
||||||
import com.axelor.apps.hr.db.repo.MonthlyReportRepository;
|
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.MonthlyReportRepository;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -18,7 +17,6 @@ import java.time.temporal.TemporalAdjusters;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
|
|
||||||
public class MonthlyReportServiceImpl implements MonthlyReportService {
|
public class MonthlyReportServiceImpl implements MonthlyReportService {
|
||||||
|
|
||||||
@@ -42,8 +40,13 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
|
public void createMensuelReport(
|
||||||
public void createMensuelReport(Employee employee, Period period, LocalDate startDate, LocalDate endDate, List<DailyReport> employeeDailyReports, List<Absence> employeeAbsences) {
|
Employee employee,
|
||||||
|
Period period,
|
||||||
|
LocalDate startDate,
|
||||||
|
LocalDate endDate,
|
||||||
|
List<DailyReport> employeeDailyReports,
|
||||||
|
List<Absence> employeeAbsences) {
|
||||||
|
|
||||||
Boolean hasNuissance = employee.getHasNuissance();
|
Boolean hasNuissance = employee.getHasNuissance();
|
||||||
LocalDate firstDayOfMonth = endDate.with(TemporalAdjusters.firstDayOfMonth());
|
LocalDate firstDayOfMonth = endDate.with(TemporalAdjusters.firstDayOfMonth());
|
||||||
@@ -94,20 +97,34 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
monthlyAllowance = monthlyAllowance + 1;
|
monthlyAllowance = monthlyAllowance + 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
monthlyAllowance = monthlyAllowance + dailyReport.getAllowance();;
|
monthlyAllowance = monthlyAllowance + dailyReport.getAllowance();
|
||||||
|
;
|
||||||
monthlyAllowanceRecall = monthlyAllowanceRecall + dailyReport.getAllowanceRecall();
|
monthlyAllowanceRecall = monthlyAllowanceRecall + dailyReport.getAllowanceRecall();
|
||||||
monthlyNightHours = monthlyNightHours.add(dailyReport.getNightHours());
|
monthlyNightHours = monthlyNightHours.add(dailyReport.getNightHours());
|
||||||
totalWorkHours = totalWorkHours.add(dailyReport.getWorkHours());
|
totalWorkHours = totalWorkHours.add(dailyReport.getWorkHours());
|
||||||
|
|
||||||
BigDecimal heureSup50 = dailyReport.getExtraHours50() != null ? dailyReport.getExtraHours50() : BigDecimal.ZERO;
|
BigDecimal heureSup50 =
|
||||||
BigDecimal heureSup100 = dailyReport.getExtraHours100() != null ? dailyReport.getExtraHours100() : BigDecimal.ZERO;
|
dailyReport.getExtraHours50() != null ? dailyReport.getExtraHours50() : BigDecimal.ZERO;
|
||||||
|
BigDecimal heureSup100 =
|
||||||
|
dailyReport.getExtraHours100() != null ? dailyReport.getExtraHours100() : BigDecimal.ZERO;
|
||||||
BigDecimal itp = dailyReport.getItp() != null ? dailyReport.getItp() : BigDecimal.ZERO;
|
BigDecimal itp = dailyReport.getItp() != null ? dailyReport.getItp() : BigDecimal.ZERO;
|
||||||
BigDecimal nuissance = dailyReport.getNuissance() != null ? dailyReport.getNuissance() : BigDecimal.ZERO;
|
BigDecimal nuissance =
|
||||||
|
dailyReport.getNuissance() != null ? dailyReport.getNuissance() : BigDecimal.ZERO;
|
||||||
|
|
||||||
BigDecimal supHours50ToDeduce = dailyReport.getSupHours50ToDeduce() != null ? dailyReport.getSupHours50ToDeduce() : BigDecimal.ZERO;
|
BigDecimal supHours50ToDeduce =
|
||||||
BigDecimal supHours100ToDeduce = dailyReport.getSupHours100ToDeduce() != null ? dailyReport.getSupHours100ToDeduce() : BigDecimal.ZERO;
|
dailyReport.getSupHours50ToDeduce() != null
|
||||||
BigDecimal itpToDeduce = dailyReport.getItpToDeduce() != null ? dailyReport.getItpToDeduce() : BigDecimal.ZERO;
|
? dailyReport.getSupHours50ToDeduce()
|
||||||
BigDecimal nuissanceToDeduce = dailyReport.getNuissanceToDeduce() != null ? dailyReport.getNuissanceToDeduce() : BigDecimal.ZERO;
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal supHours100ToDeduce =
|
||||||
|
dailyReport.getSupHours100ToDeduce() != null
|
||||||
|
? dailyReport.getSupHours100ToDeduce()
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal itpToDeduce =
|
||||||
|
dailyReport.getItpToDeduce() != null ? dailyReport.getItpToDeduce() : BigDecimal.ZERO;
|
||||||
|
BigDecimal nuissanceToDeduce =
|
||||||
|
dailyReport.getNuissanceToDeduce() != null
|
||||||
|
? dailyReport.getNuissanceToDeduce()
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
|
||||||
if (dailyReport.getDeduceSupHours50() && heureSup50.compareTo(supHours50ToDeduce) > 0) {
|
if (dailyReport.getDeduceSupHours50() && heureSup50.compareTo(supHours50ToDeduce) > 0) {
|
||||||
heureSup50 = heureSup50.subtract(supHours50ToDeduce);
|
heureSup50 = heureSup50.subtract(supHours50ToDeduce);
|
||||||
@@ -177,8 +194,13 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
LeaveRequest leaveRequest = dailyReport.getLeaveRequest();
|
LeaveRequest leaveRequest = dailyReport.getLeaveRequest();
|
||||||
Set<Absence> absences = dailyReport.getAbsenceSet();
|
Set<Absence> absences = dailyReport.getAbsenceSet();
|
||||||
|
|
||||||
if (dailyReport.getAbsenceHours() != null && dailyReport.getAbsenceHours().compareTo(BigDecimal.ZERO) > 0) {
|
if (dailyReport.getAbsenceHours() != null
|
||||||
if (isAuthorizedAbsence == false && isAuthorizedLateArrival == false && isAuthorizedEarlyDeparture == false && leaveRequest == null && absences == null) {
|
&& dailyReport.getAbsenceHours().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
if (isAuthorizedAbsence == false
|
||||||
|
&& isAuthorizedLateArrival == false
|
||||||
|
&& isAuthorizedEarlyDeparture == false
|
||||||
|
&& leaveRequest == null
|
||||||
|
&& absences == null) {
|
||||||
irregularAbsenceMonth = irregularAbsenceMonth.add(dailyReport.getAbsenceHours());
|
irregularAbsenceMonth = irregularAbsenceMonth.add(dailyReport.getAbsenceHours());
|
||||||
} else if (isAuthorizedAbsence) {
|
} else if (isAuthorizedAbsence) {
|
||||||
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getAbsenceHours());
|
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getAbsenceHours());
|
||||||
@@ -187,7 +209,8 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
} else if (isAuthorizedEarlyDeparture) {
|
} else if (isAuthorizedEarlyDeparture) {
|
||||||
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
||||||
} else if (leaveRequest != null) {
|
} else if (leaveRequest != null) {
|
||||||
recuperationLeaveAbsenceMonth = recuperationLeaveAbsenceMonth.add(dailyReport.getAbsenceHours());
|
recuperationLeaveAbsenceMonth =
|
||||||
|
recuperationLeaveAbsenceMonth.add(dailyReport.getAbsenceHours());
|
||||||
} else if (absences != null) {
|
} else if (absences != null) {
|
||||||
for (Absence absence : absences) {
|
for (Absence absence : absences) {
|
||||||
totalAbsence = dailyReport.getAbsenceHours();
|
totalAbsence = dailyReport.getAbsenceHours();
|
||||||
@@ -265,9 +288,11 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
if (dailyReport.getIsAuthorizedEarlyDeparture()) {
|
if (dailyReport.getIsAuthorizedEarlyDeparture()) {
|
||||||
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
justifiedAbsenceMonth =
|
||||||
|
justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
||||||
} else {
|
} else {
|
||||||
irregularAbsenceMonth = irregularAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
irregularAbsenceMonth =
|
||||||
|
irregularAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -321,7 +346,14 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
monthlyReportRepository.save(monthlyReport);
|
monthlyReportRepository.save(monthlyReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMensuelReport(MonthlyReport monthlyReport, Employee employee, Period period, LocalDate startDate, LocalDate endDate, List<DailyReport> employeeDailyReports, List<Absence> employeeAbsences) {
|
public void updateMensuelReport(
|
||||||
|
MonthlyReport monthlyReport,
|
||||||
|
Employee employee,
|
||||||
|
Period period,
|
||||||
|
LocalDate startDate,
|
||||||
|
LocalDate endDate,
|
||||||
|
List<DailyReport> employeeDailyReports,
|
||||||
|
List<Absence> employeeAbsences) {
|
||||||
|
|
||||||
Boolean hasNuissance = employee.getHasNuissance();
|
Boolean hasNuissance = employee.getHasNuissance();
|
||||||
LocalDate firstDayOfMonth = endDate.with(TemporalAdjusters.firstDayOfMonth());
|
LocalDate firstDayOfMonth = endDate.with(TemporalAdjusters.firstDayOfMonth());
|
||||||
@@ -372,20 +404,34 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
monthlyAllowance = monthlyAllowance + 1;
|
monthlyAllowance = monthlyAllowance + 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
monthlyAllowance = monthlyAllowance + dailyReport.getAllowance();;
|
monthlyAllowance = monthlyAllowance + dailyReport.getAllowance();
|
||||||
|
;
|
||||||
monthlyAllowanceRecall = monthlyAllowanceRecall + dailyReport.getAllowanceRecall();
|
monthlyAllowanceRecall = monthlyAllowanceRecall + dailyReport.getAllowanceRecall();
|
||||||
monthlyNightHours = monthlyNightHours.add(dailyReport.getNightHours());
|
monthlyNightHours = monthlyNightHours.add(dailyReport.getNightHours());
|
||||||
totalWorkHours = totalWorkHours.add(dailyReport.getWorkHours());
|
totalWorkHours = totalWorkHours.add(dailyReport.getWorkHours());
|
||||||
|
|
||||||
BigDecimal heureSup50 = dailyReport.getExtraHours50() != null ? dailyReport.getExtraHours50() : BigDecimal.ZERO;
|
BigDecimal heureSup50 =
|
||||||
BigDecimal heureSup100 = dailyReport.getExtraHours100() != null ? dailyReport.getExtraHours100() : BigDecimal.ZERO;
|
dailyReport.getExtraHours50() != null ? dailyReport.getExtraHours50() : BigDecimal.ZERO;
|
||||||
|
BigDecimal heureSup100 =
|
||||||
|
dailyReport.getExtraHours100() != null ? dailyReport.getExtraHours100() : BigDecimal.ZERO;
|
||||||
BigDecimal itp = dailyReport.getItp() != null ? dailyReport.getItp() : BigDecimal.ZERO;
|
BigDecimal itp = dailyReport.getItp() != null ? dailyReport.getItp() : BigDecimal.ZERO;
|
||||||
BigDecimal nuissance = dailyReport.getNuissance() != null ? dailyReport.getNuissance() : BigDecimal.ZERO;
|
BigDecimal nuissance =
|
||||||
|
dailyReport.getNuissance() != null ? dailyReport.getNuissance() : BigDecimal.ZERO;
|
||||||
|
|
||||||
BigDecimal supHours50ToDeduce = dailyReport.getSupHours50ToDeduce() != null ? dailyReport.getSupHours50ToDeduce() : BigDecimal.ZERO;
|
BigDecimal supHours50ToDeduce =
|
||||||
BigDecimal supHours100ToDeduce = dailyReport.getSupHours100ToDeduce() != null ? dailyReport.getSupHours100ToDeduce() : BigDecimal.ZERO;
|
dailyReport.getSupHours50ToDeduce() != null
|
||||||
BigDecimal itpToDeduce = dailyReport.getItpToDeduce() != null ? dailyReport.getItpToDeduce() : BigDecimal.ZERO;
|
? dailyReport.getSupHours50ToDeduce()
|
||||||
BigDecimal nuissanceToDeduce = dailyReport.getNuissanceToDeduce() != null ? dailyReport.getNuissanceToDeduce() : BigDecimal.ZERO;
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal supHours100ToDeduce =
|
||||||
|
dailyReport.getSupHours100ToDeduce() != null
|
||||||
|
? dailyReport.getSupHours100ToDeduce()
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal itpToDeduce =
|
||||||
|
dailyReport.getItpToDeduce() != null ? dailyReport.getItpToDeduce() : BigDecimal.ZERO;
|
||||||
|
BigDecimal nuissanceToDeduce =
|
||||||
|
dailyReport.getNuissanceToDeduce() != null
|
||||||
|
? dailyReport.getNuissanceToDeduce()
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
|
||||||
if (dailyReport.getDeduceSupHours50() && heureSup50.compareTo(supHours50ToDeduce) > 0) {
|
if (dailyReport.getDeduceSupHours50() && heureSup50.compareTo(supHours50ToDeduce) > 0) {
|
||||||
heureSup50 = heureSup50.subtract(supHours50ToDeduce);
|
heureSup50 = heureSup50.subtract(supHours50ToDeduce);
|
||||||
@@ -455,8 +501,13 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
LeaveRequest leaveRequest = dailyReport.getLeaveRequest();
|
LeaveRequest leaveRequest = dailyReport.getLeaveRequest();
|
||||||
Set<Absence> absences = dailyReport.getAbsenceSet();
|
Set<Absence> absences = dailyReport.getAbsenceSet();
|
||||||
|
|
||||||
if (dailyReport.getAbsenceHours() != null && dailyReport.getAbsenceHours().compareTo(BigDecimal.ZERO) > 0) {
|
if (dailyReport.getAbsenceHours() != null
|
||||||
if (isAuthorizedAbsence == false && isAuthorizedLateArrival == false && isAuthorizedEarlyDeparture == false && leaveRequest == null && absences == null) {
|
&& dailyReport.getAbsenceHours().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
if (isAuthorizedAbsence == false
|
||||||
|
&& isAuthorizedLateArrival == false
|
||||||
|
&& isAuthorizedEarlyDeparture == false
|
||||||
|
&& leaveRequest == null
|
||||||
|
&& absences == null) {
|
||||||
irregularAbsenceMonth = irregularAbsenceMonth.add(dailyReport.getAbsenceHours());
|
irregularAbsenceMonth = irregularAbsenceMonth.add(dailyReport.getAbsenceHours());
|
||||||
} else if (isAuthorizedAbsence) {
|
} else if (isAuthorizedAbsence) {
|
||||||
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getAbsenceHours());
|
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getAbsenceHours());
|
||||||
@@ -465,7 +516,8 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
} else if (isAuthorizedEarlyDeparture) {
|
} else if (isAuthorizedEarlyDeparture) {
|
||||||
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
||||||
} else if (leaveRequest != null) {
|
} else if (leaveRequest != null) {
|
||||||
recuperationLeaveAbsenceMonth = recuperationLeaveAbsenceMonth.add(dailyReport.getAbsenceHours());
|
recuperationLeaveAbsenceMonth =
|
||||||
|
recuperationLeaveAbsenceMonth.add(dailyReport.getAbsenceHours());
|
||||||
} else if (absences != null) {
|
} else if (absences != null) {
|
||||||
for (Absence absence : absences) {
|
for (Absence absence : absences) {
|
||||||
totalAbsence = dailyReport.getAbsenceHours();
|
totalAbsence = dailyReport.getAbsenceHours();
|
||||||
@@ -543,9 +595,11 @@ public class MonthlyReportServiceImpl implements MonthlyReportService {
|
|||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
if (dailyReport.getIsAuthorizedEarlyDeparture()) {
|
if (dailyReport.getIsAuthorizedEarlyDeparture()) {
|
||||||
justifiedAbsenceMonth = justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
justifiedAbsenceMonth =
|
||||||
|
justifiedAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
||||||
} else {
|
} else {
|
||||||
irregularAbsenceMonth = irregularAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
irregularAbsenceMonth =
|
||||||
|
irregularAbsenceMonth.add(dailyReport.getEarlyDeparture());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -280,12 +280,10 @@ public class EmployeeServiceImpl extends UserServiceImpl implements EmployeeServ
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void massUpdateEmployeeConfig(List<Long> employeesIds, Integer configSelect, Boolean status) throws AxelorException{
|
public void massUpdateEmployeeConfig(
|
||||||
|
List<Long> employeesIds, Integer configSelect, Boolean status) throws AxelorException {
|
||||||
List<Employee> employees =
|
List<Employee> employees =
|
||||||
Beans.get(EmployeeRepository.class)
|
Beans.get(EmployeeRepository.class).all().filter("self.id in (?1)", employeesIds).fetch();
|
||||||
.all()
|
|
||||||
.filter("self.id in (?1)", employeesIds)
|
|
||||||
.fetch();
|
|
||||||
|
|
||||||
if (employeesIds != null || !employeesIds.isEmpty()) {
|
if (employeesIds != null || !employeesIds.isEmpty()) {
|
||||||
for (Employee employee : employees) {
|
for (Employee employee : employees) {
|
||||||
|
|||||||
@@ -17,17 +17,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.hr.service.extra.hours;
|
package com.axelor.apps.hr.service.extra.hours;
|
||||||
|
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
|
||||||
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
|
||||||
import com.axelor.apps.hr.db.Employee;
|
|
||||||
import com.axelor.apps.base.db.Company;
|
import com.axelor.apps.base.db.Company;
|
||||||
import com.axelor.apps.base.db.repo.CompanyRepository;
|
import com.axelor.apps.base.db.repo.CompanyRepository;
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.ExtraHours;
|
import com.axelor.apps.hr.db.ExtraHours;
|
||||||
import com.axelor.apps.hr.db.ExtraHoursLine;
|
import com.axelor.apps.hr.db.ExtraHoursLine;
|
||||||
import com.axelor.apps.hr.db.HRConfig;
|
import com.axelor.apps.hr.db.HRConfig;
|
||||||
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
||||||
import com.axelor.apps.hr.db.repo.ExtraHoursRepository;
|
import com.axelor.apps.hr.db.repo.ExtraHoursRepository;
|
||||||
import com.axelor.apps.hr.service.config.HRConfigService;
|
import com.axelor.apps.hr.service.config.HRConfigService;
|
||||||
import com.axelor.apps.message.db.Message;
|
import com.axelor.apps.message.db.Message;
|
||||||
@@ -37,13 +36,13 @@ import com.axelor.exception.AxelorException;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import wslite.json.JSONException;
|
import wslite.json.JSONException;
|
||||||
@@ -206,7 +205,8 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
String dateValidation = jsonObject.optString("validation_date", null);
|
String dateValidation = jsonObject.optString("validation_date", null);
|
||||||
|
|
||||||
// GET EMPLOYEES
|
// GET EMPLOYEES
|
||||||
Employee employee = employeeRepo
|
Employee employee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", matricule)
|
.bind("matricule", matricule)
|
||||||
@@ -220,7 +220,8 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
Employee validatedByEmployee = null;
|
Employee validatedByEmployee = null;
|
||||||
|
|
||||||
if (validateByUser != null) {
|
if (validateByUser != null) {
|
||||||
validatedByEmployee = employeeRepo
|
validatedByEmployee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", validateByUser)
|
.bind("matricule", validateByUser)
|
||||||
@@ -236,7 +237,8 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
LocalDate validationDate = null;
|
LocalDate validationDate = null;
|
||||||
if (dateValidation != null && !dateValidation.isEmpty()) {
|
if (dateValidation != null && !dateValidation.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing dateValidation: " + dateValidation);
|
System.out.println("Error parsing dateValidation: " + dateValidation);
|
||||||
@@ -254,7 +256,8 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if Authorization exists by ticketId
|
// Check if Authorization exists by ticketId
|
||||||
ExtraHours extraHours = extraHoursRepo
|
ExtraHours extraHours =
|
||||||
|
extraHoursRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.ticketId = :ticketId")
|
.filter("self.ticketId = :ticketId")
|
||||||
.bind("ticketId", idInt)
|
.bind("ticketId", idInt)
|
||||||
@@ -266,7 +269,8 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
int newStatus = validation_status; // New status
|
int newStatus = validation_status; // New status
|
||||||
|
|
||||||
if (previousStatus == 2 && newStatus == 3) {
|
if (previousStatus == 2 && newStatus == 3) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
// Update the fields of the existing Authorization
|
// Update the fields of the existing Authorization
|
||||||
extraHours.setValidatedByEmployee(validatedByEmployee);
|
extraHours.setValidatedByEmployee(validatedByEmployee);
|
||||||
extraHours.setValidationDate(validationDate);
|
extraHours.setValidationDate(validationDate);
|
||||||
@@ -287,7 +291,8 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
dailyReport.setIsValidSupHours(true);
|
dailyReport.setIsValidSupHours(true);
|
||||||
}
|
}
|
||||||
} else if (previousStatus == 2 && newStatus == 4) {
|
} else if (previousStatus == 2 && newStatus == 4) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
extraHours.setRefusedByEmployee(validatedByEmployee);
|
extraHours.setRefusedByEmployee(validatedByEmployee);
|
||||||
extraHours.setRefusalDate(validationDate);
|
extraHours.setRefusalDate(validationDate);
|
||||||
extraHours.setStatusSelect(newStatus);
|
extraHours.setStatusSelect(newStatus);
|
||||||
@@ -332,7 +337,6 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
extraHours.setRefusalDate(validationDate);
|
extraHours.setRefusalDate(validationDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Save the ExtraHours entity
|
// Save the ExtraHours entity
|
||||||
extraHoursRepo.save(extraHours);
|
extraHoursRepo.save(extraHours);
|
||||||
|
|
||||||
@@ -356,8 +360,7 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
|
|
||||||
// Add the new ExtraHours to the list
|
// Add the new ExtraHours to the list
|
||||||
supHoursList.add(extraHours);
|
supHoursList.add(extraHours);
|
||||||
if (validation_status == 3)
|
if (validation_status == 3) dailyReport.setIsValidSupHours(true);
|
||||||
dailyReport.setIsValidSupHours(true);
|
|
||||||
// Set the updated list back to dailyReport
|
// Set the updated list back to dailyReport
|
||||||
dailyReport.setSupHoursList(supHoursList);
|
dailyReport.setSupHoursList(supHoursList);
|
||||||
}
|
}
|
||||||
@@ -369,5 +372,4 @@ public class ExtraHoursServiceImpl implements ExtraHoursService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ import com.axelor.apps.base.db.repo.ICalendarEventRepository;
|
|||||||
import com.axelor.apps.base.ical.ICalendarService;
|
import com.axelor.apps.base.ical.ICalendarService;
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
import com.axelor.apps.base.service.weeklyplanning.WeeklyPlanningService;
|
import com.axelor.apps.base.service.weeklyplanning.WeeklyPlanningService;
|
||||||
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.HRConfig;
|
import com.axelor.apps.hr.db.HRConfig;
|
||||||
import com.axelor.apps.hr.db.LeaveLine;
|
import com.axelor.apps.hr.db.LeaveLine;
|
||||||
import com.axelor.apps.hr.db.LeaveReason;
|
import com.axelor.apps.hr.db.LeaveReason;
|
||||||
import com.axelor.apps.hr.db.LeaveRequest;
|
import com.axelor.apps.hr.db.LeaveRequest;
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
|
||||||
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
||||||
import com.axelor.apps.hr.db.repo.LeaveLineRepository;
|
import com.axelor.apps.hr.db.repo.LeaveLineRepository;
|
||||||
import com.axelor.apps.hr.db.repo.LeaveReasonRepository;
|
import com.axelor.apps.hr.db.repo.LeaveReasonRepository;
|
||||||
import com.axelor.apps.hr.db.repo.LeaveRequestRepository;
|
import com.axelor.apps.hr.db.repo.LeaveRequestRepository;
|
||||||
@@ -57,14 +57,13 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import wslite.json.JSONException;
|
import wslite.json.JSONException;
|
||||||
import wslite.json.JSONObject;
|
import wslite.json.JSONObject;
|
||||||
import java.time.OffsetDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.time.format.DateTimeParseException;
|
|
||||||
|
|
||||||
|
|
||||||
public class LeaveServiceImpl implements LeaveService {
|
public class LeaveServiceImpl implements LeaveService {
|
||||||
|
|
||||||
@@ -950,7 +949,8 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
String dateValidation = jsonObject.optString("validation_date", null);
|
String dateValidation = jsonObject.optString("validation_date", null);
|
||||||
|
|
||||||
// GET EMPLOYEES
|
// GET EMPLOYEES
|
||||||
Employee employee = employeeRepo
|
Employee employee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", matricule)
|
.bind("matricule", matricule)
|
||||||
@@ -964,7 +964,8 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
Employee validatedByEmployee = null;
|
Employee validatedByEmployee = null;
|
||||||
|
|
||||||
if (validateByUser != null) {
|
if (validateByUser != null) {
|
||||||
validatedByEmployee = employeeRepo
|
validatedByEmployee =
|
||||||
|
employeeRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.registrationNumber = :matricule")
|
.filter("self.registrationNumber = :matricule")
|
||||||
.bind("matricule", validateByUser)
|
.bind("matricule", validateByUser)
|
||||||
@@ -980,7 +981,8 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
LocalDate validationDate = null;
|
LocalDate validationDate = null;
|
||||||
if (dateValidation != null && !dateValidation.isEmpty()) {
|
if (dateValidation != null && !dateValidation.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
OffsetDateTime offsetDateTime =
|
||||||
|
OffsetDateTime.parse(dateValidation, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
validationDate = offsetDateTime.toLocalDate(); // Extract only the date part
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
System.out.println("Error parsing dateValidation: " + dateValidation);
|
System.out.println("Error parsing dateValidation: " + dateValidation);
|
||||||
@@ -1008,7 +1010,8 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
LocalDateTime debutDateTime = debutDate.atStartOfDay();
|
LocalDateTime debutDateTime = debutDate.atStartOfDay();
|
||||||
LocalDateTime finDateTime = finDate.atStartOfDay();
|
LocalDateTime finDateTime = finDate.atStartOfDay();
|
||||||
|
|
||||||
LeaveRequest leaveRequest = leaveRequestRepo
|
LeaveRequest leaveRequest =
|
||||||
|
leaveRequestRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.ticketId = :ticketId")
|
.filter("self.ticketId = :ticketId")
|
||||||
.bind("ticketId", idInt)
|
.bind("ticketId", idInt)
|
||||||
@@ -1019,7 +1022,8 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
int previousStatus = leaveRequest.getStatusSelect(); // Previous status
|
int previousStatus = leaveRequest.getStatusSelect(); // Previous status
|
||||||
int newStatus = validation_status; // New status
|
int newStatus = validation_status; // New status
|
||||||
if (previousStatus == 2 && newStatus == 3) {
|
if (previousStatus == 2 && newStatus == 3) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
// Update the fields of the existing Authorization
|
// Update the fields of the existing Authorization
|
||||||
leaveRequest.setValidatedByEmployee(validatedByEmployee);
|
leaveRequest.setValidatedByEmployee(validatedByEmployee);
|
||||||
leaveRequest.setValidationDate(validationDate);
|
leaveRequest.setValidationDate(validationDate);
|
||||||
@@ -1027,9 +1031,11 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
// Save the updated Authorization
|
// Save the updated Authorization
|
||||||
leaveRequestRepo.save(leaveRequest);
|
leaveRequestRepo.save(leaveRequest);
|
||||||
// Get Daily report
|
// Get Daily report
|
||||||
List<DailyReport> dailyReports = dailyReportRepo
|
List<DailyReport> dailyReports =
|
||||||
|
dailyReportRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.reportDate >= :debutDate and self.reportDate <= :finDate")
|
.filter(
|
||||||
|
"self.employee = :employee and self.reportDate >= :debutDate and self.reportDate <= :finDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
.bind("debutDate", debutDate)
|
.bind("debutDate", debutDate)
|
||||||
.bind("finDate", finDate)
|
.bind("finDate", finDate)
|
||||||
@@ -1042,7 +1048,8 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (previousStatus == 2 && newStatus == 4) {
|
} else if (previousStatus == 2 && newStatus == 4) {
|
||||||
System.out.println("Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
System.out.println(
|
||||||
|
"Tickets :" + idInt + " Status changed from " + previousStatus + " to " + newStatus);
|
||||||
leaveRequest.setRefusedByEmployee(validatedByEmployee);
|
leaveRequest.setRefusedByEmployee(validatedByEmployee);
|
||||||
leaveRequest.setRefusalDate(validationDate);
|
leaveRequest.setRefusalDate(validationDate);
|
||||||
leaveRequest.setStatusSelect(newStatus);
|
leaveRequest.setStatusSelect(newStatus);
|
||||||
@@ -1073,9 +1080,11 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
leaveRequestRepo.save(leaveRequest);
|
leaveRequestRepo.save(leaveRequest);
|
||||||
|
|
||||||
// Get Daily report
|
// Get Daily report
|
||||||
List<DailyReport> dailyReports = dailyReportRepo
|
List<DailyReport> dailyReports =
|
||||||
|
dailyReportRepo
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.reportDate >= :debutDate and self.reportDate <= :finDate")
|
.filter(
|
||||||
|
"self.employee = :employee and self.reportDate >= :debutDate and self.reportDate <= :finDate")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
.bind("debutDate", debutDate)
|
.bind("debutDate", debutDate)
|
||||||
.bind("finDate", finDate)
|
.bind("finDate", finDate)
|
||||||
@@ -1084,8 +1093,7 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
if (dailyReports != null) {
|
if (dailyReports != null) {
|
||||||
for (DailyReport dailyReport : dailyReports) {
|
for (DailyReport dailyReport : dailyReports) {
|
||||||
dailyReport.setLeaveRequest(leaveRequest); // Set the recup leave for each report
|
dailyReport.setLeaveRequest(leaveRequest); // Set the recup leave for each report
|
||||||
if(validation_status == 3)
|
if (validation_status == 3) dailyReport.setIsAuthorizedAbsence(true);
|
||||||
dailyReport.setIsAuthorizedAbsence(true);
|
|
||||||
dailyReportRepo.save(dailyReport);
|
dailyReportRepo.save(dailyReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1097,5 +1105,4 @@ public class LeaveServiceImpl implements LeaveService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,21 @@
|
|||||||
package com.axelor.apps.hr.web;
|
package com.axelor.apps.hr.web;
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.Absence;
|
import com.axelor.apps.hr.db.Absence;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
import com.axelor.apps.hr.service.AbsenceServiceImpl;
|
import com.axelor.apps.hr.service.AbsenceServiceImpl;
|
||||||
|
import com.axelor.i18n.I18n;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
|
import com.axelor.meta.schema.actions.ActionView;
|
||||||
|
import com.axelor.meta.schema.actions.ActionView.ActionViewBuilder;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.DayOfWeek;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.axelor.i18n.I18n;
|
|
||||||
import com.axelor.meta.schema.actions.ActionView;
|
|
||||||
import com.axelor.meta.schema.actions.ActionView.ActionViewBuilder;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class AbsenceController {
|
public class AbsenceController {
|
||||||
@@ -41,13 +39,19 @@ public class AbsenceController {
|
|||||||
|
|
||||||
if (existingReports != null && !existingReports.isEmpty()) {
|
if (existingReports != null && !existingReports.isEmpty()) {
|
||||||
// Detach absence only from reports that are outside the new date range
|
// Detach absence only from reports that are outside the new date range
|
||||||
List<DailyReport> reportsToDetach = existingReports.stream()
|
List<DailyReport> reportsToDetach =
|
||||||
.filter(report -> report.getReportDate().isBefore(absenceStartDate) || report.getReportDate().isAfter(absenceEndDate))
|
existingReports
|
||||||
|
.stream()
|
||||||
|
.filter(
|
||||||
|
report ->
|
||||||
|
report.getReportDate().isBefore(absenceStartDate)
|
||||||
|
|| report.getReportDate().isAfter(absenceEndDate))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// Detach absence from these specific reports
|
// Detach absence from these specific reports
|
||||||
if (!reportsToDetach.isEmpty()) {
|
if (!reportsToDetach.isEmpty()) {
|
||||||
Beans.get(AbsenceServiceImpl.class).deAttachTheAbsenceWithDailyReport(absence, reportsToDetach, false);
|
Beans.get(AbsenceServiceImpl.class)
|
||||||
|
.deAttachTheAbsenceWithDailyReport(absence, reportsToDetach, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +65,6 @@ public class AbsenceController {
|
|||||||
.bind("absenceEndDate", absenceEndDate)
|
.bind("absenceEndDate", absenceEndDate)
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
|
|
||||||
// Check if there are any reports
|
// Check if there are any reports
|
||||||
if (newReports.isEmpty()) {
|
if (newReports.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -108,13 +111,15 @@ public class AbsenceController {
|
|||||||
Long absenceId = (Long) request.getContext().asType(Absence.class).getId();
|
Long absenceId = (Long) request.getContext().asType(Absence.class).getId();
|
||||||
Absence absence = Beans.get(AbsenceRepository.class).find(absenceId);
|
Absence absence = Beans.get(AbsenceRepository.class).find(absenceId);
|
||||||
|
|
||||||
List<DailyReport> dailyreports = Beans.get(DailyReportRepository.class)
|
List<DailyReport> dailyreports =
|
||||||
|
Beans.get(DailyReportRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.absence = :absence")
|
.filter("self.absence = :absence")
|
||||||
.bind("absence", absenceId)
|
.bind("absence", absenceId)
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
Beans.get(AbsenceServiceImpl.class).deAttachTheAbsenceWithDailyReport(absence, dailyreports, true);
|
Beans.get(AbsenceServiceImpl.class)
|
||||||
|
.deAttachTheAbsenceWithDailyReport(absence, dailyreports, true);
|
||||||
ActionViewBuilder actionView =
|
ActionViewBuilder actionView =
|
||||||
ActionView.define(I18n.get("Absences"))
|
ActionView.define(I18n.get("Absences"))
|
||||||
.model(Absence.class.getName())
|
.model(Absence.class.getName())
|
||||||
@@ -127,7 +132,6 @@ public class AbsenceController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void calculateTotalAbsenceHours(ActionRequest request, ActionResponse response) {
|
public void calculateTotalAbsenceHours(ActionRequest request, ActionResponse response) {
|
||||||
try {
|
try {
|
||||||
Absence absence = request.getContext().asType(Absence.class);
|
Absence absence = request.getContext().asType(Absence.class);
|
||||||
@@ -137,9 +141,10 @@ public class AbsenceController {
|
|||||||
LocalDateTime absenceEndDate = absence.getEndDate();
|
LocalDateTime absenceEndDate = absence.getEndDate();
|
||||||
if (absenceStartDate.isAfter(absenceEndDate)) {
|
if (absenceStartDate.isAfter(absenceEndDate)) {
|
||||||
response.setAlert("Start date cannot be after end date.");
|
response.setAlert("Start date cannot be after end date.");
|
||||||
}
|
} else {
|
||||||
else {
|
BigDecimal totalAbsenceHours =
|
||||||
BigDecimal totalAbsenceHours = Beans.get(AbsenceServiceImpl.class).calculateTotalAbsenceHours(absenceStartDate,absenceEndDate);
|
Beans.get(AbsenceServiceImpl.class)
|
||||||
|
.calculateTotalAbsenceHours(absenceStartDate, absenceEndDate);
|
||||||
response.setValue("totalAbsenceHours", totalAbsenceHours);
|
response.setValue("totalAbsenceHours", totalAbsenceHours);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ public class AuthorizationController {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// General catch for unexpected exceptions
|
// General catch for unexpected exceptions
|
||||||
System.err.println("An error occurred while fetching Salary Authorization: " + e.getMessage());
|
System.err.println(
|
||||||
|
"An error occurred while fetching Salary Authorization: " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,5 +370,4 @@ public class AuthorizationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,24 @@
|
|||||||
package com.axelor.apps.hr.web;
|
package com.axelor.apps.hr.web;
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.Shift;
|
|
||||||
import com.axelor.apps.hr.db.Employee;
|
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
import com.axelor.apps.hr.db.repo.ShiftRepository;
|
|
||||||
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
||||||
import com.axelor.apps.hr.service.DailyReportService;
|
import com.axelor.apps.hr.service.DailyReportService;
|
||||||
import com.axelor.apps.hr.service.DailyReportServiceImpl;
|
import com.axelor.apps.hr.service.DailyReportServiceImpl;
|
||||||
|
import com.axelor.exception.service.TraceBackService;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.LinkedHashMap;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeParseException;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.axelor.exception.service.TraceBackService;
|
|
||||||
|
|
||||||
public class DailyReportController {
|
public class DailyReportController {
|
||||||
|
|
||||||
@@ -32,14 +28,12 @@ public class DailyReportController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void workingHours(ActionRequest request, ActionResponse response) {
|
public void workingHours(ActionRequest request, ActionResponse response) {
|
||||||
try {
|
try {
|
||||||
Long dailyReportId = (Long) request.getContext().asType(DailyReport.class).getId();
|
Long dailyReportId = (Long) request.getContext().asType(DailyReport.class).getId();
|
||||||
DailyReport DailyReport = Beans.get(DailyReportRepository.class).find(dailyReportId);
|
DailyReport DailyReport = Beans.get(DailyReportRepository.class).find(dailyReportId);
|
||||||
if (DailyReport == null) {
|
if (DailyReport == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("DailyReport with ID " + dailyReportId + " not found.");
|
||||||
"DailyReport with ID " + dailyReportId + " not found.");
|
|
||||||
}
|
}
|
||||||
Beans.get(DailyReportServiceImpl.class).determineShift(DailyReport);
|
Beans.get(DailyReportServiceImpl.class).determineShift(DailyReport);
|
||||||
Beans.get(DailyReportServiceImpl.class).workingHours(DailyReport);
|
Beans.get(DailyReportServiceImpl.class).workingHours(DailyReport);
|
||||||
@@ -55,8 +49,7 @@ public class DailyReportController {
|
|||||||
Long dailyReportId = (Long) request.getContext().asType(DailyReport.class).getId();
|
Long dailyReportId = (Long) request.getContext().asType(DailyReport.class).getId();
|
||||||
DailyReport DailyReport = Beans.get(DailyReportRepository.class).find(dailyReportId);
|
DailyReport DailyReport = Beans.get(DailyReportRepository.class).find(dailyReportId);
|
||||||
if (DailyReport == null) {
|
if (DailyReport == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("DailyReport with ID " + dailyReportId + " not found.");
|
||||||
"DailyReport with ID " + dailyReportId + " not found.");
|
|
||||||
}
|
}
|
||||||
Beans.get(DailyReportServiceImpl.class).workingHours(DailyReport);
|
Beans.get(DailyReportServiceImpl.class).workingHours(DailyReport);
|
||||||
response.setReload(true);
|
response.setReload(true);
|
||||||
@@ -95,8 +88,7 @@ public class DailyReportController {
|
|||||||
List<DailyReport> dailyReportList =
|
List<DailyReport> dailyReportList =
|
||||||
Beans.get(DailyReportRepository.class)
|
Beans.get(DailyReportRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter(
|
.filter("self.id in ?1 ", dailyReportIds)
|
||||||
"self.id in ?1 ",dailyReportIds)
|
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
for (DailyReport dailyReport : dailyReportList) {
|
for (DailyReport dailyReport : dailyReportList) {
|
||||||
@@ -154,7 +146,8 @@ public class DailyReportController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
response.setFlash("Invalid date format for startDate or endDate. Expected format: yyyy-MM-dd.");
|
response.setFlash(
|
||||||
|
"Invalid date format for startDate or endDate. Expected format: yyyy-MM-dd.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +166,9 @@ public class DailyReportController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response.setFlash("Invalid value to deduce: unsupported type " + (valueToDeduceObj != null ? valueToDeduceObj.getClass().getName() : "null"));
|
response.setFlash(
|
||||||
|
"Invalid value to deduce: unsupported type "
|
||||||
|
+ (valueToDeduceObj != null ? valueToDeduceObj.getClass().getName() : "null"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +178,8 @@ public class DailyReportController {
|
|||||||
List<Employee> employees = new ArrayList<>();
|
List<Employee> employees = new ArrayList<>();
|
||||||
|
|
||||||
if (employeesObject instanceof List) {
|
if (employeesObject instanceof List) {
|
||||||
List<LinkedHashMap<String, Object>> employeesList = (List<LinkedHashMap<String, Object>>) employeesObject;
|
List<LinkedHashMap<String, Object>> employeesList =
|
||||||
|
(List<LinkedHashMap<String, Object>>) employeesObject;
|
||||||
|
|
||||||
for (LinkedHashMap<String, Object> employeeMap : employeesList) {
|
for (LinkedHashMap<String, Object> employeeMap : employeesList) {
|
||||||
Integer employeeIdInt = (Integer) employeeMap.get("id");
|
Integer employeeIdInt = (Integer) employeeMap.get("id");
|
||||||
@@ -210,9 +206,11 @@ public class DailyReportController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch all rapport journaliers within the date range for all employees
|
// Fetch all rapport journaliers within the date range for all employees
|
||||||
List<DailyReport> dailyReportList = Beans.get(DailyReportRepository.class)
|
List<DailyReport> dailyReportList =
|
||||||
|
Beans.get(DailyReportRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee.id in :employeeIds and self.reportDate >= :startDate and self.reportDate <= :endDate")
|
.filter(
|
||||||
|
"self.employee.id in :employeeIds and self.reportDate >= :startDate and self.reportDate <= :endDate")
|
||||||
.bind("startDate", startDate)
|
.bind("startDate", startDate)
|
||||||
.bind("endDate", endDate)
|
.bind("endDate", endDate)
|
||||||
.bind("employeeIds", employeeIds)
|
.bind("employeeIds", employeeIds)
|
||||||
@@ -220,7 +218,8 @@ public class DailyReportController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!dailyReportList.isEmpty()) {
|
if (!dailyReportList.isEmpty()) {
|
||||||
Beans.get(DailyReportService.class).massDeducePrimes(dailyReportList, primeSelection, valueToDeduce);
|
Beans.get(DailyReportService.class)
|
||||||
|
.massDeducePrimes(dailyReportList, primeSelection, valueToDeduce);
|
||||||
response.setReload(true);
|
response.setReload(true);
|
||||||
response.setFlash("Prime deductions processed successfully.");
|
response.setFlash("Prime deductions processed successfully.");
|
||||||
} else {
|
} else {
|
||||||
@@ -231,5 +230,4 @@ public class DailyReportController {
|
|||||||
response.setFlash("An error occurred while processing the request.");
|
response.setFlash("An error occurred while processing the request.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.hr.web;
|
package com.axelor.apps.hr.web;
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.Granding;
|
import com.axelor.app.AppSettings;
|
||||||
import com.axelor.apps.hr.db.repo.GrandingRepository;
|
|
||||||
import com.axelor.apps.ReportFactory;
|
import com.axelor.apps.ReportFactory;
|
||||||
import com.axelor.apps.base.db.Partner;
|
import com.axelor.apps.base.db.Partner;
|
||||||
import com.axelor.apps.hr.db.DPAE;
|
import com.axelor.apps.hr.db.DPAE;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
import com.axelor.apps.hr.db.Employee;
|
||||||
|
import com.axelor.apps.hr.db.Granding;
|
||||||
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.GrandingRepository;
|
||||||
import com.axelor.apps.hr.report.IReport;
|
import com.axelor.apps.hr.report.IReport;
|
||||||
import com.axelor.apps.hr.service.employee.EmployeeService;
|
import com.axelor.apps.hr.service.employee.EmployeeService;
|
||||||
import com.axelor.apps.report.engine.ReportSettings;
|
import com.axelor.apps.report.engine.ReportSettings;
|
||||||
@@ -38,17 +39,16 @@ import com.axelor.meta.schema.actions.ActionView.ActionViewBuilder;
|
|||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import wslite.json.JSONException;
|
import wslite.json.JSONException;
|
||||||
import wslite.json.JSONObject;
|
import wslite.json.JSONObject;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import com.axelor.app.AppSettings;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EmployeeController {
|
public class EmployeeController {
|
||||||
@@ -149,14 +149,13 @@ public class EmployeeController {
|
|||||||
|
|
||||||
response.setReload(true);
|
response.setReload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enrollEmployee(ActionRequest request, ActionResponse response) {
|
public void enrollEmployee(ActionRequest request, ActionResponse response) {
|
||||||
Long employeeId = (Long) request.getContext().asType(Employee.class).getId();
|
Long employeeId = (Long) request.getContext().asType(Employee.class).getId();
|
||||||
Employee employee = Beans.get(EmployeeRepository.class).find(employeeId);
|
Employee employee = Beans.get(EmployeeRepository.class).find(employeeId);
|
||||||
|
|
||||||
Granding granding = Beans.get(GrandingRepository.class)
|
Granding granding =
|
||||||
.all()
|
Beans.get(GrandingRepository.class).all().filter("self.name = 'POINTEUSE-RDC'").fetchOne();
|
||||||
.filter("self.name = 'POINTEUSE-RDC'")
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
String ipAdress = granding.getIpAdress();
|
String ipAdress = granding.getIpAdress();
|
||||||
String code = granding.getCode().toString();
|
String code = granding.getCode().toString();
|
||||||
@@ -175,15 +174,19 @@ public class EmployeeController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
String[] args = {
|
String[] args = {
|
||||||
"python",
|
"python",
|
||||||
pythonScriptDir + "\\Attendance\\main.py",
|
pythonScriptDir + "\\Attendance\\main.py",
|
||||||
"--commande", "create",
|
"--commande",
|
||||||
"--ip_address", ipAdress,
|
"create",
|
||||||
"--code", code,
|
"--ip_address",
|
||||||
"--user_id", employeeRegistrationNumber,
|
ipAdress,
|
||||||
"--name", employeeName
|
"--code",
|
||||||
|
code,
|
||||||
|
"--user_id",
|
||||||
|
employeeRegistrationNumber,
|
||||||
|
"--name",
|
||||||
|
employeeName
|
||||||
};
|
};
|
||||||
|
|
||||||
Process p = Runtime.getRuntime().exec(args);
|
Process p = Runtime.getRuntime().exec(args);
|
||||||
@@ -196,7 +199,8 @@ public class EmployeeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Capture the error stream (standard error)
|
// Capture the error stream (standard error)
|
||||||
BufferedReader errorReader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
|
BufferedReader errorReader =
|
||||||
|
new BufferedReader(new InputStreamReader(p.getErrorStream()));
|
||||||
while ((line = errorReader.readLine()) != null) {
|
while ((line = errorReader.readLine()) != null) {
|
||||||
LOG.error("Python script (Employee Enrolling) error: " + line);
|
LOG.error("Python script (Employee Enrolling) error: " + line);
|
||||||
}
|
}
|
||||||
@@ -210,7 +214,8 @@ public class EmployeeController {
|
|||||||
Beans.get(EmployeeService.class).setEmployeeEnrolled(employee);
|
Beans.get(EmployeeService.class).setEmployeeEnrolled(employee);
|
||||||
response.setFlash("Employee enrolled successfully.");
|
response.setFlash("Employee enrolled successfully.");
|
||||||
} else {
|
} else {
|
||||||
LOG.error("Python script execution (Employee Enrolling) failed with exit code: " + exitCode);
|
LOG.error(
|
||||||
|
"Python script execution (Employee Enrolling) failed with exit code: " + exitCode);
|
||||||
response.setFlash("Failed to enroll the Employee.");
|
response.setFlash("Failed to enroll the Employee.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +224,8 @@ public class EmployeeController {
|
|||||||
if (e.getMessage().contains("The system cannot find the file specified")) {
|
if (e.getMessage().contains("The system cannot find the file specified")) {
|
||||||
LOG.error("Python script file (Employee Enrolling) not found: " + e.getMessage());
|
LOG.error("Python script file (Employee Enrolling) not found: " + e.getMessage());
|
||||||
} else {
|
} else {
|
||||||
LOG.error("An error occurred while executing the Python script (Employee Enrolling).", e);
|
LOG.error(
|
||||||
|
"An error occurred while executing the Python script (Employee Enrolling).", e);
|
||||||
}
|
}
|
||||||
response.setFlash("Failed to enroll the Employee.");
|
response.setFlash("Failed to enroll the Employee.");
|
||||||
TraceBackService.trace(e);
|
TraceBackService.trace(e);
|
||||||
@@ -275,5 +281,4 @@ public class EmployeeController {
|
|||||||
TraceBackService.trace(response, e);
|
TraceBackService.trace(response, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
package com.axelor.apps.hr.web;
|
package com.axelor.apps.hr.web;
|
||||||
|
|
||||||
|
|
||||||
import com.axelor.apps.hr.db.Granding;
|
import com.axelor.apps.hr.db.Granding;
|
||||||
import com.axelor.apps.hr.db.repo.GrandingRepository;
|
import com.axelor.apps.hr.db.repo.GrandingRepository;
|
||||||
|
import com.axelor.exception.service.TraceBackService;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import java.time.temporal.TemporalAdjusters;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import com.axelor.exception.service.TraceBackService;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
|
|
||||||
public class GrandingController {
|
public class GrandingController {
|
||||||
|
|
||||||
@@ -35,9 +30,12 @@ public class GrandingController {
|
|||||||
String[] args = {
|
String[] args = {
|
||||||
"python",
|
"python",
|
||||||
"C:\\Users\\administrator\\Desktop\\attendance\\main.py",
|
"C:\\Users\\administrator\\Desktop\\attendance\\main.py",
|
||||||
"--commande", "ping",
|
"--commande",
|
||||||
"--ip_address", ipAdress,
|
"ping",
|
||||||
"--code", code
|
"--ip_address",
|
||||||
|
ipAdress,
|
||||||
|
"--code",
|
||||||
|
code
|
||||||
};
|
};
|
||||||
|
|
||||||
Process p = Runtime.getRuntime().exec(args);
|
Process p = Runtime.getRuntime().exec(args);
|
||||||
|
|||||||
@@ -3,26 +3,26 @@ package com.axelor.apps.hr.web;
|
|||||||
import com.axelor.apps.base.db.Period;
|
import com.axelor.apps.base.db.Period;
|
||||||
import com.axelor.apps.base.db.repo.PeriodRepository;
|
import com.axelor.apps.base.db.repo.PeriodRepository;
|
||||||
import com.axelor.apps.hr.db.Absence;
|
import com.axelor.apps.hr.db.Absence;
|
||||||
import com.axelor.apps.hr.db.Employee;
|
|
||||||
import com.axelor.apps.hr.db.DailyReport;
|
import com.axelor.apps.hr.db.DailyReport;
|
||||||
|
import com.axelor.apps.hr.db.Employee;
|
||||||
import com.axelor.apps.hr.db.MonthlyReport;
|
import com.axelor.apps.hr.db.MonthlyReport;
|
||||||
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
import com.axelor.apps.hr.db.repo.AbsenceRepository;
|
||||||
|
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
||||||
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
import com.axelor.apps.hr.db.repo.EmployeeRepository;
|
||||||
import com.axelor.apps.hr.db.repo.MonthlyReportRepository;
|
import com.axelor.apps.hr.db.repo.MonthlyReportRepository;
|
||||||
import com.axelor.apps.hr.db.repo.DailyReportRepository;
|
|
||||||
import com.axelor.apps.hr.service.MonthlyReportServiceImpl;
|
import com.axelor.apps.hr.service.MonthlyReportServiceImpl;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.temporal.TemporalAdjusters;
|
import java.time.temporal.TemporalAdjusters;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import java.util.List;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -72,27 +72,26 @@ public class MonthlyReportController {
|
|||||||
// Iterate over employees and calculate/update MonthlyReport instances
|
// Iterate over employees and calculate/update MonthlyReport instances
|
||||||
for (Employee employee : employees) {
|
for (Employee employee : employees) {
|
||||||
// Filter rapport journaliers for the current employee
|
// Filter rapport journaliers for the current employee
|
||||||
List<DailyReport> employeeDailyReports = allDailyReports
|
List<DailyReport> employeeDailyReports =
|
||||||
|
allDailyReports
|
||||||
.stream()
|
.stream()
|
||||||
.filter(r -> r.getEmployee().equals(employee))
|
.filter(r -> r.getEmployee().equals(employee))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// Filter absences for the current employee
|
// Filter absences for the current employee
|
||||||
List<Absence> employeeAbsences = allAbsences
|
List<Absence> employeeAbsences =
|
||||||
|
allAbsences
|
||||||
.stream()
|
.stream()
|
||||||
.filter(a -> a.getEmployee().equals(employee))
|
.filter(a -> a.getEmployee().equals(employee))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!employeeDailyReports.isEmpty() || !employeeAbsences.isEmpty()) {
|
if (!employeeDailyReports.isEmpty() || !employeeAbsences.isEmpty()) {
|
||||||
System.out.println("Create monthly report for employee: "+ employee.getRegistrationNumber());
|
System.out.println(
|
||||||
|
"Create monthly report for employee: " + employee.getRegistrationNumber());
|
||||||
// Process the employee's monthly report using filtered rapport and absences
|
// Process the employee's monthly report using filtered rapport and absences
|
||||||
Beans.get(MonthlyReportServiceImpl.class).createMensuelReport(
|
Beans.get(MonthlyReportServiceImpl.class)
|
||||||
employee,
|
.createMensuelReport(
|
||||||
period,
|
employee, period, startDate, endDate, employeeDailyReports, employeeAbsences);
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
employeeDailyReports,
|
|
||||||
employeeAbsences);
|
|
||||||
} else {
|
} else {
|
||||||
log.error("No Daily Reports exist for employee: " + employee.getRegistrationNumber());
|
log.error("No Daily Reports exist for employee: " + employee.getRegistrationNumber());
|
||||||
}
|
}
|
||||||
@@ -126,7 +125,8 @@ public class MonthlyReportController {
|
|||||||
|
|
||||||
// Check if employeesObject is not null and cast it to a list
|
// Check if employeesObject is not null and cast it to a list
|
||||||
if (employeesObject instanceof List) {
|
if (employeesObject instanceof List) {
|
||||||
List<LinkedHashMap<String, Object>> employeesList = (List<LinkedHashMap<String, Object>>) employeesObject;
|
List<LinkedHashMap<String, Object>> employeesList =
|
||||||
|
(List<LinkedHashMap<String, Object>>) employeesObject;
|
||||||
|
|
||||||
// Loop through each employee in the list
|
// Loop through each employee in the list
|
||||||
for (LinkedHashMap<String, Object> employeeMap : employeesList) {
|
for (LinkedHashMap<String, Object> employeeMap : employeesList) {
|
||||||
@@ -162,7 +162,8 @@ public class MonthlyReportController {
|
|||||||
List<DailyReport> allDailyReports =
|
List<DailyReport> allDailyReports =
|
||||||
Beans.get(DailyReportRepository.class)
|
Beans.get(DailyReportRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee in :employeesIds and self.reportDate >= :startDate and self.reportDate <= :endDate")
|
.filter(
|
||||||
|
"self.employee in :employeesIds and self.reportDate >= :startDate and self.reportDate <= :endDate")
|
||||||
.bind("startDate", startDate)
|
.bind("startDate", startDate)
|
||||||
.bind("endDate", endDate)
|
.bind("endDate", endDate)
|
||||||
.bind("employeesIds", employeesIds)
|
.bind("employeesIds", employeesIds)
|
||||||
@@ -172,7 +173,8 @@ public class MonthlyReportController {
|
|||||||
List<Absence> allAbsences =
|
List<Absence> allAbsences =
|
||||||
Beans.get(AbsenceRepository.class)
|
Beans.get(AbsenceRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee in :employeesIds and DATE(self.startDate) >= :startDate and DATE(self.startDate) <= :endDate")
|
.filter(
|
||||||
|
"self.employee in :employeesIds and DATE(self.startDate) >= :startDate and DATE(self.startDate) <= :endDate")
|
||||||
.bind("startDate", startDate)
|
.bind("startDate", startDate)
|
||||||
.bind("endDate", endDate)
|
.bind("endDate", endDate)
|
||||||
.bind("employeesIds", employeesIds)
|
.bind("employeesIds", employeesIds)
|
||||||
@@ -180,7 +182,8 @@ public class MonthlyReportController {
|
|||||||
|
|
||||||
for (Employee employee : employees) {
|
for (Employee employee : employees) {
|
||||||
// Check if a MonthlyReport exists for this employee in the specified period
|
// Check if a MonthlyReport exists for this employee in the specified period
|
||||||
MonthlyReport monthlyReport = Beans.get(MonthlyReportRepository.class)
|
MonthlyReport monthlyReport =
|
||||||
|
Beans.get(MonthlyReportRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter("self.employee = :employee and self.period = :period")
|
.filter("self.employee = :employee and self.period = :period")
|
||||||
.bind("employee", employee)
|
.bind("employee", employee)
|
||||||
@@ -190,32 +193,48 @@ public class MonthlyReportController {
|
|||||||
Optional<MonthlyReport> monthlyReportOpt = Optional.ofNullable(monthlyReport);
|
Optional<MonthlyReport> monthlyReportOpt = Optional.ofNullable(monthlyReport);
|
||||||
|
|
||||||
// Filter daily reports for the current employee
|
// Filter daily reports for the current employee
|
||||||
List<DailyReport> employeeDailyReports = allDailyReports.stream()
|
List<DailyReport> employeeDailyReports =
|
||||||
|
allDailyReports
|
||||||
|
.stream()
|
||||||
.filter(r -> r.getEmployee().equals(employee))
|
.filter(r -> r.getEmployee().equals(employee))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// Filter absences for the current employee
|
// Filter absences for the current employee
|
||||||
List<Absence> employeeAbsences = allAbsences.stream()
|
List<Absence> employeeAbsences =
|
||||||
|
allAbsences
|
||||||
|
.stream()
|
||||||
.filter(a -> a.getEmployee().equals(employee))
|
.filter(a -> a.getEmployee().equals(employee))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!employeeDailyReports.isEmpty() || !employeeAbsences.isEmpty()) {
|
if (!employeeDailyReports.isEmpty() || !employeeAbsences.isEmpty()) {
|
||||||
if (monthlyReportOpt.isPresent()) {
|
if (monthlyReportOpt.isPresent()) {
|
||||||
MonthlyReport existingReport = monthlyReportOpt.get();
|
MonthlyReport existingReport = monthlyReportOpt.get();
|
||||||
System.out.println("Update monthly report for employee: " + employee.getRegistrationNumber());
|
System.out.println(
|
||||||
|
"Update monthly report for employee: " + employee.getRegistrationNumber());
|
||||||
// Update the existing monthly report
|
// Update the existing monthly report
|
||||||
Beans.get(MonthlyReportServiceImpl.class).updateMensuelReport(existingReport, employee, period, startDate, endDate, employeeDailyReports, employeeAbsences);
|
Beans.get(MonthlyReportServiceImpl.class)
|
||||||
|
.updateMensuelReport(
|
||||||
|
existingReport,
|
||||||
|
employee,
|
||||||
|
period,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
employeeDailyReports,
|
||||||
|
employeeAbsences);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Create monthly report for employee: " + employee.getRegistrationNumber());
|
System.out.println(
|
||||||
|
"Create monthly report for employee: " + employee.getRegistrationNumber());
|
||||||
// Create a new monthly report
|
// Create a new monthly report
|
||||||
Beans.get(MonthlyReportServiceImpl.class).createMensuelReport(employee, period, startDate, endDate, employeeDailyReports, employeeAbsences);
|
Beans.get(MonthlyReportServiceImpl.class)
|
||||||
|
.createMensuelReport(
|
||||||
|
employee, period, startDate, endDate, employeeDailyReports, employeeAbsences);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.err.println("No Daily Reports exist for employee: " + employee.getRegistrationNumber());
|
System.err.println(
|
||||||
|
"No Daily Reports exist for employee: " + employee.getRegistrationNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Indicate that the action was successful and a reload is needed
|
// Indicate that the action was successful and a reload is needed
|
||||||
response.setReload(true);
|
response.setReload(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ import com.axelor.rpc.ActionRequest;
|
|||||||
import com.axelor.rpc.ActionResponse;
|
import com.axelor.rpc.ActionResponse;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
@@ -502,5 +500,4 @@ public class LeaveController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.axelor.apps.message.service;
|
|||||||
|
|
||||||
import com.axelor.apps.message.db.Message;
|
import com.axelor.apps.message.db.Message;
|
||||||
import com.axelor.apps.message.db.Template;
|
import com.axelor.apps.message.db.Template;
|
||||||
|
import com.axelor.auth.db.User;
|
||||||
import com.axelor.db.Model;
|
import com.axelor.db.Model;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.meta.db.MetaFile;
|
import com.axelor.meta.db.MetaFile;
|
||||||
@@ -26,8 +27,6 @@ import com.axelor.tool.template.TemplateMaker;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import com.axelor.auth.db.User;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface TemplateMessageService {
|
public interface TemplateMessageService {
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ import com.axelor.apps.message.db.EmailAddress;
|
|||||||
import com.axelor.apps.message.db.Message;
|
import com.axelor.apps.message.db.Message;
|
||||||
import com.axelor.apps.message.db.Template;
|
import com.axelor.apps.message.db.Template;
|
||||||
import com.axelor.apps.message.db.TemplateContext;
|
import com.axelor.apps.message.db.TemplateContext;
|
||||||
|
import com.axelor.apps.message.db.repo.EmailAccountRepository;
|
||||||
import com.axelor.apps.message.db.repo.EmailAddressRepository;
|
import com.axelor.apps.message.db.repo.EmailAddressRepository;
|
||||||
import com.axelor.apps.message.db.repo.MessageRepository;
|
import com.axelor.apps.message.db.repo.MessageRepository;
|
||||||
import com.axelor.apps.message.db.repo.TemplateRepository;
|
import com.axelor.apps.message.db.repo.TemplateRepository;
|
||||||
import com.axelor.apps.message.exception.IExceptionMessage;
|
import com.axelor.apps.message.exception.IExceptionMessage;
|
||||||
|
import com.axelor.auth.db.User;
|
||||||
import com.axelor.db.EntityHelper;
|
import com.axelor.db.EntityHelper;
|
||||||
import com.axelor.db.JPA;
|
import com.axelor.db.JPA;
|
||||||
import com.axelor.db.Model;
|
import com.axelor.db.Model;
|
||||||
@@ -50,21 +52,20 @@ import com.google.inject.persist.Transactional;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.axelor.auth.db.User;
|
|
||||||
|
|
||||||
public class TemplateMessageServiceImpl implements TemplateMessageService {
|
public class TemplateMessageServiceImpl implements TemplateMessageService {
|
||||||
|
|
||||||
private static final String RECIPIENT_SEPARATOR = ";|,";
|
private static final String RECIPIENT_SEPARATOR = ";|,";
|
||||||
private static final char TEMPLATE_DELIMITER = '$';
|
private static final char TEMPLATE_DELIMITER = '$';
|
||||||
|
@Inject protected EmailAccountRepository mailAccountRepo;
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
private final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
@@ -350,6 +351,33 @@ public class TemplateMessageServiceImpl implements TemplateMessageService {
|
|||||||
return mailAccount;
|
return mailAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("getMailAccount");
|
||||||
|
// EmailAccount mailAccount = Beans.get(MailAccountService.class).getDefaultSender();
|
||||||
|
EmailAccount mail = getDefaultSender();
|
||||||
|
|
||||||
|
// if (mailAccount != null) {
|
||||||
|
// log.debug("Email account ::: {}", mailAccount);
|
||||||
|
// return mailAccount;
|
||||||
|
// }
|
||||||
|
if (mail != null) {
|
||||||
|
log.debug("Email ::: {}", mail);
|
||||||
|
return mail;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EmailAccount getDefaultSender() {
|
||||||
|
EmailAccount mail =
|
||||||
|
mailAccountRepo
|
||||||
|
.all()
|
||||||
|
.filter(
|
||||||
|
"self.isDefault = true AND self.serverTypeSelect = ?1",
|
||||||
|
EmailAccountRepository.SERVER_TYPE_SMTP)
|
||||||
|
.fetchOne();
|
||||||
|
if (mail != null) {
|
||||||
|
log.debug("Email ::: {}", mail);
|
||||||
|
return mail;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,4 +147,6 @@ public interface IExceptionMessage {
|
|||||||
|
|
||||||
static final String UNIT_COST_CALCULATION_NO_PRODUCT = /*$$(*/
|
static final String UNIT_COST_CALCULATION_NO_PRODUCT = /*$$(*/
|
||||||
"Please select an element (a product, a product category or a product family) to run calculation" /*)*/;
|
"Please select an element (a product, a product category or a product family) to run calculation" /*)*/;
|
||||||
|
|
||||||
|
static final String STOCK_MOVE_NOT_VALIDATED = /*$$(*/ "Stock move not validated by SCH" /*)*/;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ import com.axelor.apps.base.service.ProductService;
|
|||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
import com.axelor.apps.production.db.BillOfMaterial;
|
import com.axelor.apps.production.db.BillOfMaterial;
|
||||||
import com.axelor.apps.production.db.BillOfMaterialConsumption;
|
import com.axelor.apps.production.db.BillOfMaterialConsumption;
|
||||||
|
import com.axelor.apps.production.db.ManufOrder;
|
||||||
import com.axelor.apps.production.db.TempBomTree;
|
import com.axelor.apps.production.db.TempBomTree;
|
||||||
|
import com.axelor.apps.production.db.repo.BillOfMaterialConsumptionRepository;
|
||||||
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
||||||
|
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||||
import com.axelor.apps.production.db.repo.TempBomTreeRepository;
|
import com.axelor.apps.production.db.repo.TempBomTreeRepository;
|
||||||
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
||||||
import com.axelor.apps.production.report.IReport;
|
import com.axelor.apps.production.report.IReport;
|
||||||
@@ -50,7 +53,6 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.axelor.apps.production.db.repo.BillOfMaterialConsumptionRepository;
|
|
||||||
|
|
||||||
public class BillOfMaterialServiceImpl implements BillOfMaterialService {
|
public class BillOfMaterialServiceImpl implements BillOfMaterialService {
|
||||||
|
|
||||||
@@ -373,9 +375,9 @@ public class BillOfMaterialServiceImpl implements BillOfMaterialService {
|
|||||||
return newBom;
|
return newBom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public BillOfMaterialConsumption createBomConsumptionFromRawMaterial(BillOfMaterial bom) {
|
public BillOfMaterialConsumption createBomConsumptionFromRawMaterial(
|
||||||
|
BillOfMaterial bom, ManufOrder manufOrder) {
|
||||||
BillOfMaterialConsumption newBom = new BillOfMaterialConsumption();
|
BillOfMaterialConsumption newBom = new BillOfMaterialConsumption();
|
||||||
newBom.setDefineSubBillOfMaterial(false);
|
newBom.setDefineSubBillOfMaterial(false);
|
||||||
newBom.setPriority(bom.getPriority());
|
newBom.setPriority(bom.getPriority());
|
||||||
@@ -385,11 +387,55 @@ public class BillOfMaterialServiceImpl implements BillOfMaterialService {
|
|||||||
newBom.setUnit(bom.getUnit());
|
newBom.setUnit(bom.getUnit());
|
||||||
newBom.setName(bom.getName());
|
newBom.setName(bom.getName());
|
||||||
newBom.setFullName(bom.getFullName());
|
newBom.setFullName(bom.getFullName());
|
||||||
// billOfMaterialConsumptionRepository.save(newBom);
|
newBom.setManufOrder(manufOrder);
|
||||||
|
|
||||||
return newBom;
|
return newBom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void createBomAndAttachToManufOrder(ManufOrder manufOrder) {
|
||||||
|
if (manufOrder.getBillOfMaterial() != null
|
||||||
|
&& manufOrder.getBillOfMaterialConsumptionList().size() == 0) {
|
||||||
|
for (BillOfMaterial bom : manufOrder.getBillOfMaterial().getBillOfMaterialSet()) {
|
||||||
|
BillOfMaterialConsumption newBom =
|
||||||
|
Beans.get(BillOfMaterialServiceImpl.class)
|
||||||
|
.createBomConsumptionFromRawMaterial(bom, manufOrder);
|
||||||
|
manufOrder.addBillOfMaterialConsumptionListItem(newBom);
|
||||||
|
}
|
||||||
|
log.debug(
|
||||||
|
"Bill of Material Consumption List size: {}",
|
||||||
|
manufOrder.getBillOfMaterialConsumptionList().size());
|
||||||
|
Beans.get(ManufOrderRepository.class).save(manufOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits the Bill of Material consumption line into two lines.
|
||||||
|
*
|
||||||
|
* @param manufOrder
|
||||||
|
* @param billConsumptionList
|
||||||
|
* @param splitQty
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public void splitBillOfMaterialConsumption(
|
||||||
|
ManufOrder manufOrder,
|
||||||
|
List<BillOfMaterialConsumption> billConsumptionList,
|
||||||
|
BigDecimal splitQty) {
|
||||||
|
|
||||||
|
for (BillOfMaterialConsumption billOfMaterialConsumption : billConsumptionList) {
|
||||||
|
|
||||||
|
BigDecimal totalQty = billOfMaterialConsumption.getQty();
|
||||||
|
totalQty = totalQty.subtract(splitQty);
|
||||||
|
BillOfMaterialConsumption newLine =
|
||||||
|
Beans.get(BillOfMaterialConsumptionRepository.class)
|
||||||
|
.copy(billOfMaterialConsumption, true);
|
||||||
|
newLine.setProduct(billOfMaterialConsumption.getProduct());
|
||||||
|
newLine.setRealQty(splitQty);
|
||||||
|
newLine.setQty(splitQty);
|
||||||
|
newLine.setUnit(billOfMaterialConsumption.getUnit());
|
||||||
|
newLine.setName(billOfMaterialConsumption.getName());
|
||||||
|
newLine.setTrackingNumber(billOfMaterialConsumption.getTrackingNumber());
|
||||||
|
billOfMaterialConsumption.setQty(totalQty);
|
||||||
|
manufOrder.addBillOfMaterialConsumptionListItem(newLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,13 +41,11 @@ import com.axelor.apps.supplychain.db.Mrp;
|
|||||||
import com.axelor.apps.supplychain.db.MrpForecast;
|
import com.axelor.apps.supplychain.db.MrpForecast;
|
||||||
import com.axelor.apps.supplychain.db.MrpLine;
|
import com.axelor.apps.supplychain.db.MrpLine;
|
||||||
import com.axelor.apps.supplychain.db.MrpLineOrigin;
|
import com.axelor.apps.supplychain.db.MrpLineOrigin;
|
||||||
import com.axelor.apps.supplychain.db.MrpLineSaleAndMargin;
|
|
||||||
import com.axelor.apps.supplychain.db.MrpLineSophal;
|
import com.axelor.apps.supplychain.db.MrpLineSophal;
|
||||||
import com.axelor.apps.supplychain.db.MrpLineType;
|
import com.axelor.apps.supplychain.db.MrpLineType;
|
||||||
import com.axelor.apps.supplychain.db.ProductionMasterPlan;
|
import com.axelor.apps.supplychain.db.ProductionMasterPlan;
|
||||||
import com.axelor.apps.supplychain.db.repo.MrpForecastRepository;
|
import com.axelor.apps.supplychain.db.repo.MrpForecastRepository;
|
||||||
import com.axelor.apps.supplychain.db.repo.MrpLineRepository;
|
import com.axelor.apps.supplychain.db.repo.MrpLineRepository;
|
||||||
import com.axelor.apps.supplychain.db.repo.MrpLineSaleAndMarginRepository;
|
|
||||||
import com.axelor.apps.supplychain.db.repo.MrpLineSophalRepository;
|
import com.axelor.apps.supplychain.db.repo.MrpLineSophalRepository;
|
||||||
import com.axelor.apps.supplychain.db.repo.MrpLineTypeRepository;
|
import com.axelor.apps.supplychain.db.repo.MrpLineTypeRepository;
|
||||||
import com.axelor.apps.supplychain.db.repo.MrpRepository;
|
import com.axelor.apps.supplychain.db.repo.MrpRepository;
|
||||||
@@ -65,15 +63,9 @@ import java.lang.invoke.MethodHandles;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import org.mozilla.universalchardet.prober.statemachine.Big5SMModel;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -475,10 +467,8 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
Map<Long, Double> productQty)
|
Map<Long, Double> productQty)
|
||||||
throws AxelorException {
|
throws AxelorException {
|
||||||
|
|
||||||
|
|
||||||
log.debug("****** FORTHUPPER ******** {} {}", product, qty);
|
log.debug("****** FORTHUPPER ******** {} {}", product, qty);
|
||||||
|
|
||||||
|
|
||||||
if (mrp.getIncludeBOM()) {
|
if (mrp.getIncludeBOM()) {
|
||||||
|
|
||||||
BillOfMaterial defaultBillOfMaterial = product.getDefaultBillOfMaterial();
|
BillOfMaterial defaultBillOfMaterial = product.getDefaultBillOfMaterial();
|
||||||
@@ -487,16 +477,20 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
|
|
||||||
super.createdProductionMasterPlan(product, mrp, qty, defaultBillOfMaterial.getQty());
|
super.createdProductionMasterPlan(product, mrp, qty, defaultBillOfMaterial.getQty());
|
||||||
|
|
||||||
|
|
||||||
for (BillOfMaterial billOfMaterial : defaultBillOfMaterial.getBillOfMaterialSet()) {
|
for (BillOfMaterial billOfMaterial : defaultBillOfMaterial.getBillOfMaterialSet()) {
|
||||||
List<ProductionMasterPlan> productionMasterPlans = Beans.get(ProductionMasterPlanRepository.class).all().fetchStream()
|
List<ProductionMasterPlan> productionMasterPlans =
|
||||||
.filter(t -> t.getProduct() == product && t.getMrp() == mrp).collect(Collectors.toList());
|
Beans.get(ProductionMasterPlanRepository.class)
|
||||||
|
.all()
|
||||||
|
.fetchStream()
|
||||||
|
.filter(t -> t.getProduct() == product && t.getMrp() == mrp)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
Product subProduct = billOfMaterial.getProduct();
|
Product subProduct = billOfMaterial.getProduct();
|
||||||
|
|
||||||
if (this.isMrpProduct(subProduct)) {
|
if (this.isMrpProduct(subProduct)) {
|
||||||
|
|
||||||
Double prodQty = productQty.get(subProduct.getId()) == null
|
Double prodQty =
|
||||||
|
productQty.get(subProduct.getId()) == null
|
||||||
? Double.parseDouble("0")
|
? Double.parseDouble("0")
|
||||||
: productQty.get(subProduct.getId());
|
: productQty.get(subProduct.getId());
|
||||||
|
|
||||||
@@ -512,8 +506,6 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
productionMasterPlans);
|
productionMasterPlans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.createMrpLineSophal(mrp, product, unit, qty, mrpForecastList, productQty);
|
super.createMrpLineSophal(mrp, product, unit, qty, mrpForecastList, productQty);
|
||||||
@@ -528,12 +520,12 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
BigDecimal qty,
|
BigDecimal qty,
|
||||||
BillOfMaterial billOfMaterial,
|
BillOfMaterial billOfMaterial,
|
||||||
BigDecimal defaultQty,
|
BigDecimal defaultQty,
|
||||||
List<ProductionMasterPlan> productionMasterPlans ) throws AxelorException {
|
List<ProductionMasterPlan> productionMasterPlans)
|
||||||
|
throws AxelorException {
|
||||||
MrpLineSophal mrpLineSophal = new MrpLineSophal();
|
MrpLineSophal mrpLineSophal = new MrpLineSophal();
|
||||||
|
|
||||||
log.debug("****** FORTH ******** {} {}", product, qty);
|
log.debug("****** FORTH ******** {} {}", product, qty);
|
||||||
|
|
||||||
|
|
||||||
BigDecimal qtyReqPerBatch = billOfMaterial.getQty();
|
BigDecimal qtyReqPerBatch = billOfMaterial.getQty();
|
||||||
int currentMonth = LocalDate.now().getMonth().getValue();
|
int currentMonth = LocalDate.now().getMonth().getValue();
|
||||||
BigDecimal currentProductionPlan = BigDecimal.ZERO;
|
BigDecimal currentProductionPlan = BigDecimal.ZERO;
|
||||||
@@ -543,13 +535,16 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
BigDecimal futureQty = BigDecimal.ZERO;
|
BigDecimal futureQty = BigDecimal.ZERO;
|
||||||
BigDecimal purchaseQty = BigDecimal.ZERO;
|
BigDecimal purchaseQty = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
|
||||||
if (mrp.getIncludeFutureQty()) {
|
if (mrp.getIncludeFutureQty()) {
|
||||||
futureQty = Beans.get(StockLocationServiceImpl.class).getFutureQty(product.getId(), mrp.getStockLocation().getCompany().getId(), 0L);
|
futureQty =
|
||||||
|
Beans.get(StockLocationServiceImpl.class)
|
||||||
|
.getFutureQty(product.getId(), mrp.getStockLocation().getCompany().getId(), 0L);
|
||||||
decreasingQty = decreasingQty.add(futureQty);
|
decreasingQty = decreasingQty.add(futureQty);
|
||||||
}
|
}
|
||||||
if (mrp.getIncludePurchaseQty()) {
|
if (mrp.getIncludePurchaseQty()) {
|
||||||
purchaseQty = Beans.get(ProductStockLocationServiceImpl.class).getPurchaseOrderQty(product, mrp.getStockLocation().getCompany(), null);
|
purchaseQty =
|
||||||
|
Beans.get(ProductStockLocationServiceImpl.class)
|
||||||
|
.getPurchaseOrderQty(product, mrp.getStockLocation().getCompany(), null);
|
||||||
decreasingQty = decreasingQty.add(purchaseQty);
|
decreasingQty = decreasingQty.add(purchaseQty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +554,12 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
currentProductionPlan = getCurrentProductionPlan(parentProduct, mrp, index);
|
currentProductionPlan = getCurrentProductionPlan(parentProduct, mrp, index);
|
||||||
BigDecimal qtyReqForProd = currentProductionPlan.multiply(qtyReqPerBatch);
|
BigDecimal qtyReqForProd = currentProductionPlan.multiply(qtyReqPerBatch);
|
||||||
if (mrp.getIncludeBomWaste()) {
|
if (mrp.getIncludeBomWaste()) {
|
||||||
qtyReqForProd = qtyReqForProd.add(qtyReqForProd.multiply(billOfMaterial.getWasteRate().divide(new BigDecimal("100"),0,RoundingMode.HALF_UP)));
|
qtyReqForProd =
|
||||||
|
qtyReqForProd.add(
|
||||||
|
qtyReqForProd.multiply(
|
||||||
|
billOfMaterial
|
||||||
|
.getWasteRate()
|
||||||
|
.divide(new BigDecimal("100"), 0, RoundingMode.HALF_UP)));
|
||||||
}
|
}
|
||||||
|
|
||||||
totalQtyUsed.add(qtyReqForProd);
|
totalQtyUsed.add(qtyReqForProd);
|
||||||
@@ -575,7 +575,8 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
decreasingQty = qtyReqForProd.subtract(decreasingQty);
|
decreasingQty = qtyReqForProd.subtract(decreasingQty);
|
||||||
|
|
||||||
if (mrp.getIncludeStockRule()) {
|
if (mrp.getIncludeStockRule()) {
|
||||||
StockRules stockRules = stockRulesService.getStockRules(
|
StockRules stockRules =
|
||||||
|
stockRulesService.getStockRules(
|
||||||
product,
|
product,
|
||||||
null,
|
null,
|
||||||
StockRulesRepository.TYPE_FUTURE,
|
StockRulesRepository.TYPE_FUTURE,
|
||||||
@@ -584,7 +585,6 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
decreasingQty = stockRules.getReOrderQty().max(decreasingQty);
|
decreasingQty = stockRules.getReOrderQty().max(decreasingQty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
@@ -631,10 +631,8 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
} else {
|
} else {
|
||||||
decreasingQty = BigDecimal.ZERO;
|
decreasingQty = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mrpLineSophal.setQty(qty);
|
mrpLineSophal.setQty(qty);
|
||||||
mrpLineSophal.setTotalQtyUsed(totalQtyUsed);
|
mrpLineSophal.setTotalQtyUsed(totalQtyUsed);
|
||||||
mrpLineSophal.setInitialQty(initialQty);
|
mrpLineSophal.setInitialQty(initialQty);
|
||||||
@@ -648,10 +646,15 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
Beans.get(MrpLineSophalRepository.class).save(mrpLineSophal);
|
Beans.get(MrpLineSophalRepository.class).save(mrpLineSophal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private BigDecimal getCurrentProductionPlan(Product product, Mrp mrp, int monthSelect) {
|
private BigDecimal getCurrentProductionPlan(Product product, Mrp mrp, int monthSelect) {
|
||||||
|
|
||||||
ProductionMasterPlan productionMasterPlan = Beans.get(ProductionMasterPlanRepository.class).all().fetchStream().filter(t -> t.getProduct() == product && t.getMrp() == mrp).findFirst().orElse(null);
|
ProductionMasterPlan productionMasterPlan =
|
||||||
|
Beans.get(ProductionMasterPlanRepository.class)
|
||||||
|
.all()
|
||||||
|
.fetchStream()
|
||||||
|
.filter(t -> t.getProduct() == product && t.getMrp() == mrp)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
log.debug("productionMasterPlan >>>>>>>>>>>> {}", productionMasterPlan);
|
log.debug("productionMasterPlan >>>>>>>>>>>> {}", productionMasterPlan);
|
||||||
|
|
||||||
@@ -694,10 +697,7 @@ public class MrpServiceProductionImpl extends MrpServiceImpl {
|
|||||||
default:
|
default:
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,21 @@
|
|||||||
package com.axelor.apps.production.service;
|
package com.axelor.apps.production.service;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.Month;
|
|
||||||
import java.time.format.TextStyle;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.axelor.apps.supplychain.db.MrpForecast;
|
|
||||||
|
|
||||||
public class Previous {
|
public class Previous {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
String s = null;
|
String s = null;
|
||||||
|
|
||||||
Process p = Runtime.getRuntime().exec("python /Users\\Bachir.souldi.SOPHAL\\Desktop\\dev\\whatsapp_erp\\index.py hello");
|
Process p =
|
||||||
BufferedReader stdInput = new BufferedReader(new
|
Runtime.getRuntime()
|
||||||
InputStreamReader(p.getInputStream()));
|
.exec(
|
||||||
|
"python /Users\\Bachir.souldi.SOPHAL\\Desktop\\dev\\whatsapp_erp\\index.py hello");
|
||||||
|
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
|
|
||||||
BufferedReader stdError = new BufferedReader(new
|
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
|
||||||
InputStreamReader(p.getErrorStream()));
|
|
||||||
|
|
||||||
// read the output from the command
|
// read the output from the command
|
||||||
System.out.println("Here is the standard output of the command:\n");
|
System.out.println("Here is the standard output of the command:\n");
|
||||||
@@ -43,8 +31,4 @@ public class Previous {
|
|||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,10 +67,10 @@ public class StockMoveProductionServiceImpl extends StockMoveServiceSupplychainI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkExpirationDates(StockMove stockMove) throws AxelorException {
|
public void checkExpirationDates(StockMove stockMove) throws AxelorException {
|
||||||
if (stockMove.getInManufOrder() != null) {
|
// if (stockMove.getInManufOrder() != null) {
|
||||||
stockMoveLineService.checkExpirationDates(stockMove);
|
// stockMoveLineService.checkExpirationDates(stockMove);
|
||||||
} else {
|
// } else {
|
||||||
super.checkExpirationDates(stockMove);
|
super.checkExpirationDates(stockMove);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ public interface ManufOrderService {
|
|||||||
|
|
||||||
public void createToConsumeProdProductList(ManufOrder manufOrder);
|
public void createToConsumeProdProductList(ManufOrder manufOrder);
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public StockMove createToConsumeProdProductList(ManufOrder manufOrder, int size)
|
||||||
|
throws AxelorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the quantity on generated prod product line. If the quantity of the bill of material is
|
* Compute the quantity on generated prod product line. If the quantity of the bill of material is
|
||||||
* equal to the quantity of manuf order then the prod product line will have the same quantity as
|
* equal to the quantity of manuf order then the prod product line will have the same quantity as
|
||||||
@@ -239,4 +243,7 @@ public interface ManufOrderService {
|
|||||||
* @return the query.
|
* @return the query.
|
||||||
*/
|
*/
|
||||||
public String getBuildingQtyForAProduct(Long productId, Long companyId, Long stockLocationId);
|
public String getBuildingQtyForAProduct(Long productId, Long companyId, Long stockLocationId);
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public StockMove createOutgoinfStockMove(ManufOrder manufOrder) throws AxelorException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
|
|
||||||
Company company = billOfMaterial.getCompany();
|
Company company = billOfMaterial.getCompany();
|
||||||
|
|
||||||
|
|
||||||
// BigDecimal bomQty = billOfMaterial.getQty();
|
// BigDecimal bomQty = billOfMaterial.getQty();
|
||||||
// BigDecimal qty = qtyRequested.divide(bomQty, 0, RoundingMode.CEILING).multiply(bomQty);
|
// BigDecimal qty = qtyRequested.divide(bomQty, 0, RoundingMode.CEILING).multiply(bomQty);
|
||||||
|
|
||||||
@@ -150,6 +149,100 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public StockMove createToConsumeProdProductList(ManufOrder manufOrder, int times)
|
||||||
|
throws AxelorException {
|
||||||
|
|
||||||
|
BigDecimal manufOrderQty = manufOrder.getQty();
|
||||||
|
|
||||||
|
BillOfMaterial billOfMaterial = manufOrder.getBillOfMaterial();
|
||||||
|
|
||||||
|
BigDecimal bomQty = billOfMaterial.getQty();
|
||||||
|
|
||||||
|
StockMove stockMove =
|
||||||
|
Beans.get(ManufOrderStockMoveService.class)
|
||||||
|
._createToConsumeStockMove(manufOrder, manufOrder.getCompany());
|
||||||
|
|
||||||
|
if (billOfMaterial.getBillOfMaterialSet() != null) {
|
||||||
|
|
||||||
|
for (BillOfMaterial billOfMaterialLine :
|
||||||
|
getSortedBillsOfMaterials(billOfMaterial.getBillOfMaterialSet())) {
|
||||||
|
|
||||||
|
if (!billOfMaterialLine.getHasNoManageStock()) {
|
||||||
|
|
||||||
|
Product product =
|
||||||
|
productVariantService.getProductVariant(
|
||||||
|
manufOrder.getProduct(), billOfMaterialLine.getProduct());
|
||||||
|
|
||||||
|
BigDecimal qty =
|
||||||
|
computeToConsumeProdProductLineQuantity(
|
||||||
|
bomQty, manufOrderQty, billOfMaterialLine.getQty())
|
||||||
|
.multiply(new BigDecimal(times));
|
||||||
|
|
||||||
|
ProdProduct prodProduct = new ProdProduct(product, qty, billOfMaterialLine.getUnit());
|
||||||
|
StockMoveLine stockMoveline =
|
||||||
|
Beans.get(ManufOrderStockMoveService.class)
|
||||||
|
._createStockMoveLine(
|
||||||
|
prodProduct, stockMove, StockMoveLineService.TYPE_IN_PRODUCTIONS);
|
||||||
|
stockMove.addStockMoveLineListItem(stockMoveline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Beans.get(StockMoveRepository.class).save(stockMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public StockMove createOutgoinfStockMove(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
|
||||||
|
BigDecimal manufOrderQty = manufOrder.getQty();
|
||||||
|
BillOfMaterial billOfMaterial = manufOrder.getBillOfMaterial();
|
||||||
|
BigDecimal bomQty = billOfMaterial.getQty();
|
||||||
|
|
||||||
|
StockConfigProductionService stockConfigService = Beans.get(StockConfigProductionService.class);
|
||||||
|
StockConfig stockConfig = stockConfigService.getStockConfig(manufOrder.getCompany());
|
||||||
|
StockLocation virtualStockLocation =
|
||||||
|
stockConfigService.getProductionVirtualStockLocation(stockConfig);
|
||||||
|
|
||||||
|
StockMove stockMove =
|
||||||
|
Beans.get(ManufOrderStockMoveService.class)
|
||||||
|
._createToConsumeStockMove(manufOrder, manufOrder.getCompany());
|
||||||
|
|
||||||
|
stockMove.setPartner(manufOrder.getCompany().getPartner());
|
||||||
|
stockMove.setTypeSelect(StockMoveRepository.TYPE_OUTGOING);
|
||||||
|
stockMove.setFromStockLocation(manufOrder.getWorkshopStockLocation());
|
||||||
|
stockMove.setToStockLocation(virtualStockLocation);
|
||||||
|
|
||||||
|
if (billOfMaterial.getBillOfMaterialSet() != null) {
|
||||||
|
|
||||||
|
for (BillOfMaterial billOfMaterialLine :
|
||||||
|
getSortedBillsOfMaterials(billOfMaterial.getBillOfMaterialSet())) {
|
||||||
|
|
||||||
|
if (!billOfMaterialLine.getHasNoManageStock()) {
|
||||||
|
|
||||||
|
Product product =
|
||||||
|
productVariantService.getProductVariant(
|
||||||
|
manufOrder.getProduct(), billOfMaterialLine.getProduct());
|
||||||
|
|
||||||
|
BigDecimal qty =
|
||||||
|
computeToConsumeProdProductLineQuantity(
|
||||||
|
bomQty, manufOrderQty, billOfMaterialLine.getQty());
|
||||||
|
|
||||||
|
ProdProduct prodProduct = new ProdProduct(product, qty, billOfMaterialLine.getUnit());
|
||||||
|
StockMoveLine stockMoveline =
|
||||||
|
Beans.get(ManufOrderStockMoveService.class)
|
||||||
|
._createStockMoveLine(
|
||||||
|
prodProduct, stockMove, StockMoveLineService.TYPE_IN_PRODUCTIONS);
|
||||||
|
stockMove.addStockMoveLineListItem(stockMoveline);
|
||||||
|
manufOrder.addConsumedStockMoveLineListItem(stockMoveline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Beans.get(StockMoveRepository.class).save(stockMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void createToConsumeProdProductList(ManufOrder manufOrder) {
|
public void createToConsumeProdProductList(ManufOrder manufOrder) {
|
||||||
|
|
||||||
BigDecimal manufOrderQty = manufOrder.getQty();
|
BigDecimal manufOrderQty = manufOrder.getQty();
|
||||||
@@ -180,6 +273,38 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createToConsumeProdProductListFromSelectedManufOrder(
|
||||||
|
List<ManufOrder> manufOrderList) {
|
||||||
|
|
||||||
|
BigDecimal manufOrderQty =
|
||||||
|
manufOrderList.stream().map(ManufOrder::getQty).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
|
BillOfMaterial billOfMaterial = manufOrderList.get(0).getBillOfMaterial();
|
||||||
|
|
||||||
|
BigDecimal bomQty = billOfMaterial.getQty();
|
||||||
|
|
||||||
|
if (billOfMaterial.getBillOfMaterialSet() != null) {
|
||||||
|
|
||||||
|
for (BillOfMaterial billOfMaterialLine :
|
||||||
|
getSortedBillsOfMaterials(billOfMaterial.getBillOfMaterialSet())) {
|
||||||
|
|
||||||
|
if (!billOfMaterialLine.getHasNoManageStock()) {
|
||||||
|
|
||||||
|
Product product =
|
||||||
|
productVariantService.getProductVariant(
|
||||||
|
manufOrderList.get(0).getProduct(), billOfMaterialLine.getProduct());
|
||||||
|
|
||||||
|
BigDecimal qty =
|
||||||
|
computeToConsumeProdProductLineQuantity(
|
||||||
|
bomQty, manufOrderQty, billOfMaterialLine.getQty());
|
||||||
|
ProdProduct prodProduct = new ProdProduct(product, qty, billOfMaterialLine.getUnit());
|
||||||
|
manufOrderList.get(0).addToConsumeProdProductListItem(prodProduct);
|
||||||
|
prodProductRepo.persist(prodProduct); // id by order of creation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal computeToConsumeProdProductLineQuantity(
|
public BigDecimal computeToConsumeProdProductLineQuantity(
|
||||||
BigDecimal bomQty, BigDecimal manufOrderQty, BigDecimal lineQty) {
|
BigDecimal bomQty, BigDecimal manufOrderQty, BigDecimal lineQty) {
|
||||||
@@ -330,7 +455,9 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
|
|
||||||
if (manufOrder.getBillOfMaterial() != null) {
|
if (manufOrder.getBillOfMaterial() != null) {
|
||||||
for (BillOfMaterial bom : manufOrder.getBillOfMaterial().getBillOfMaterialSet()) {
|
for (BillOfMaterial bom : manufOrder.getBillOfMaterial().getBillOfMaterialSet()) {
|
||||||
BillOfMaterialConsumption newBom = Beans.get(BillOfMaterialServiceImpl.class).createBomConsumptionFromRawMaterial(bom);
|
BillOfMaterialConsumption newBom =
|
||||||
|
Beans.get(BillOfMaterialServiceImpl.class)
|
||||||
|
.createBomConsumptionFromRawMaterial(bom, manufOrder);
|
||||||
manufOrder.addBillOfMaterialConsumptionListItem(newBom);
|
manufOrder.addBillOfMaterialConsumptionListItem(newBom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,6 +466,10 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
|
|
||||||
manufOrder.setPlannedEndDateT(manufOrderWorkflowService.computePlannedEndDateT(manufOrder));
|
manufOrder.setPlannedEndDateT(manufOrderWorkflowService.computePlannedEndDateT(manufOrder));
|
||||||
|
|
||||||
|
System.out.println("***************************");
|
||||||
|
System.out.println("yessssssssssssssssss");
|
||||||
|
System.out.println("***************************");
|
||||||
|
|
||||||
manufOrderRepo.save(manufOrder);
|
manufOrderRepo.save(manufOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,6 +504,10 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
productionConfigService.getManufOrderSequence(
|
productionConfigService.getManufOrderSequence(
|
||||||
productionConfig, manufOrder.getWorkshopStockLocation());
|
productionConfig, manufOrder.getWorkshopStockLocation());
|
||||||
|
|
||||||
|
if (manufOrder.getStypeSelect() == ManufOrderRepository.STYPE_PACKAGING_ORDER) {
|
||||||
|
sequence = productionConfig.getPackagingOrderSequence();
|
||||||
|
}
|
||||||
|
|
||||||
String seq = sequenceService.getSequenceNumber(sequence);
|
String seq = sequenceService.getSequenceNumber(sequence);
|
||||||
|
|
||||||
if (seq == null) {
|
if (seq == null) {
|
||||||
@@ -618,12 +753,13 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
if (stockMoveOpt.isPresent()) {
|
if (stockMoveOpt.isPresent()) {
|
||||||
stockMove = stockMoveOpt.get();
|
stockMove = stockMoveOpt.get();
|
||||||
} else {
|
} else {
|
||||||
stockMove =
|
// stockMove =
|
||||||
manufOrderStockMoveService._createToConsumeStockMove(manufOrder, manufOrder.getCompany());
|
// manufOrderStockMoveService._createToConsumeStockMove(manufOrder,
|
||||||
manufOrder.addInStockMoveListItem(stockMove);
|
// manufOrder.getCompany());
|
||||||
Beans.get(StockMoveService.class).plan(stockMove);
|
// manufOrder.addInStockMoveListItem(stockMove);
|
||||||
|
// Beans.get(StockMoveService.class).plan(stockMove);
|
||||||
}
|
}
|
||||||
updateStockMoveFromManufOrder(consumedStockMoveLineList, stockMove);
|
// updateStockMoveFromManufOrder(consumedStockMoveLineList, stockMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -741,11 +877,11 @@ public class ManufOrderServiceImpl implements ManufOrderService {
|
|||||||
.convert(
|
.convert(
|
||||||
stockMoveLine.getUnit(),
|
stockMoveLine.getUnit(),
|
||||||
prodProduct.getUnit(),
|
prodProduct.getUnit(),
|
||||||
stockMoveLine.getQty(),
|
stockMoveLine.getRealQty(),
|
||||||
stockMoveLine.getQty().scale(),
|
stockMoveLine.getRealQty().scale(),
|
||||||
product));
|
product));
|
||||||
} else {
|
} else {
|
||||||
consumedQty = consumedQty.add(stockMoveLine.getQty());
|
consumedQty = consumedQty.add(stockMoveLine.getRealQty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return consumedQty.subtract(prodProduct.getQty());
|
return consumedQty.subtract(prodProduct.getQty());
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package com.axelor.apps.production.service.manuforder;
|
|||||||
import com.axelor.apps.base.db.Company;
|
import com.axelor.apps.base.db.Company;
|
||||||
import com.axelor.apps.base.db.Product;
|
import com.axelor.apps.base.db.Product;
|
||||||
import com.axelor.apps.base.db.repo.ProductRepository;
|
import com.axelor.apps.base.db.repo.ProductRepository;
|
||||||
|
import com.axelor.apps.production.db.BillOfMaterialConsumption;
|
||||||
import com.axelor.apps.production.db.ManufOrder;
|
import com.axelor.apps.production.db.ManufOrder;
|
||||||
import com.axelor.apps.production.db.OperationOrder;
|
import com.axelor.apps.production.db.OperationOrder;
|
||||||
import com.axelor.apps.production.db.ProdProcess;
|
import com.axelor.apps.production.db.ProdProcess;
|
||||||
@@ -33,6 +34,7 @@ import com.axelor.apps.stock.db.StockConfig;
|
|||||||
import com.axelor.apps.stock.db.StockLocation;
|
import com.axelor.apps.stock.db.StockLocation;
|
||||||
import com.axelor.apps.stock.db.StockMove;
|
import com.axelor.apps.stock.db.StockMove;
|
||||||
import com.axelor.apps.stock.db.StockMoveLine;
|
import com.axelor.apps.stock.db.StockMoveLine;
|
||||||
|
import com.axelor.apps.stock.db.repo.StockMoveLineRepository;
|
||||||
import com.axelor.apps.stock.db.repo.StockMoveRepository;
|
import com.axelor.apps.stock.db.repo.StockMoveRepository;
|
||||||
import com.axelor.apps.stock.service.StockMoveLineService;
|
import com.axelor.apps.stock.service.StockMoveLineService;
|
||||||
import com.axelor.apps.stock.service.StockMoveService;
|
import com.axelor.apps.stock.service.StockMoveService;
|
||||||
@@ -49,6 +51,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -92,7 +95,34 @@ public class ManufOrderStockMoveService {
|
|||||||
// case where we had to split tracked stock move lines
|
// case where we had to split tracked stock move lines
|
||||||
if (stockMove.getStockMoveLineList() != null) {
|
if (stockMove.getStockMoveLineList() != null) {
|
||||||
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
||||||
manufOrder.addConsumedStockMoveLineListItem(stockMoveLine);
|
manufOrder.addTransferedStockMoveLineListItem(stockMoveLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createToTransferStockMove(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
Company company = manufOrder.getCompany();
|
||||||
|
|
||||||
|
if (manufOrder.getToConsumeProdProductList() != null && company != null) {
|
||||||
|
|
||||||
|
StockMove stockMove = this._createToConsumeStockMove(manufOrder, company);
|
||||||
|
|
||||||
|
for (ProdProduct prodProduct : manufOrder.getToConsumeProdProductList()) {
|
||||||
|
|
||||||
|
this._createStockMoveLine(prodProduct, stockMove, StockMoveLineService.TYPE_IN_PRODUCTIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
|
||||||
|
stockMoveService.plan(stockMove);
|
||||||
|
manufOrder.addInStockMoveListItem(stockMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill here the consumed stock move line list item to manage the
|
||||||
|
// case where we had to split tracked stock move lines
|
||||||
|
if (stockMove.getStockMoveLineList() != null) {
|
||||||
|
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
||||||
|
manufOrder.addTransferedStockMoveLineListItem(stockMoveLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,8 +144,8 @@ public class ManufOrderStockMoveService {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
company,
|
company,
|
||||||
fromStockLocation,
|
manufOrder.getProdProcess().getStockLocation(),
|
||||||
virtualStockLocation,
|
manufOrder.getWorkshopStockLocation(),
|
||||||
null,
|
null,
|
||||||
manufOrder.getPlannedStartDateT().toLocalDate(),
|
manufOrder.getPlannedStartDateT().toLocalDate(),
|
||||||
null,
|
null,
|
||||||
@@ -205,6 +235,9 @@ public class ManufOrderStockMoveService {
|
|||||||
|
|
||||||
if (stockMove.getStockMoveLineList() != null) {
|
if (stockMove.getStockMoveLineList() != null) {
|
||||||
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
||||||
|
if (manufOrder.getTrackingNumber() != null) {
|
||||||
|
stockMoveLine.setTrackingNumber(manufOrder.getTrackingNumber());
|
||||||
|
}
|
||||||
manufOrder.addProducedStockMoveLineListItem(stockMoveLine);
|
manufOrder.addProducedStockMoveLineListItem(stockMoveLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +252,52 @@ public class ManufOrderStockMoveService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void consumeInStockMoves(ManufOrder manufOrder) throws AxelorException {
|
public void consumeInStockMoves(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
StockConfigProductionService stockConfigService = Beans.get(StockConfigProductionService.class);
|
||||||
|
StockConfig stockConfig = stockConfigService.getStockConfig(manufOrder.getCompany());
|
||||||
|
StockLocation virtualStockLocation =
|
||||||
|
stockConfigService.getProductionVirtualStockLocation(stockConfig);
|
||||||
|
|
||||||
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
||||||
|
if (stockMove.getStatusSelect() == StockMoveRepository.STATUS_REALIZED) {
|
||||||
|
StockMove move = Beans.get(StockMoveRepository.class).copy(stockMove, true);
|
||||||
|
move.setPartner(manufOrder.getCompany().getPartner());
|
||||||
|
move.setTypeSelect(StockMoveRepository.TYPE_OUTGOING);
|
||||||
|
move.setFromStockLocation(manufOrder.getWorkshopStockLocation());
|
||||||
|
move.setToStockLocation(virtualStockLocation);
|
||||||
|
// move.setInManufOrder(null);
|
||||||
|
move.setOutManufOrder(manufOrder);
|
||||||
|
Beans.get(StockMoveRepository.class).save(move);
|
||||||
|
if (move.getStockMoveLineList() != null) {
|
||||||
|
for (StockMoveLine stockMoveLine : move.getStockMoveLineList()) {
|
||||||
|
stockMoveLine.setTransferedManufOrder(null);
|
||||||
|
stockMoveLine.setConsumedManufOrder(manufOrder);
|
||||||
|
manufOrder.addConsumedStockMoveLineListItem(stockMoveLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// stockMoveService.plan(move);
|
||||||
|
}
|
||||||
|
finishStockMove(stockMove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void validateOutStockMoves(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
|
||||||
|
for (StockMove stockMove : manufOrder.getOutStockMoveList()) {
|
||||||
|
System.out.println("***************************");
|
||||||
|
System.out.println(stockMove.getStockMoveSeq());
|
||||||
|
stockMoveService.plan(stockMove);
|
||||||
|
finishStockMove(stockMove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void validateInStockMoves(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
|
||||||
|
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
||||||
|
System.out.println("***************************");
|
||||||
|
System.out.println(stockMove.getStockMoveSeq());
|
||||||
|
stockMoveService.plan(stockMove);
|
||||||
finishStockMove(stockMove);
|
finishStockMove(stockMove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,7 +348,7 @@ public class ManufOrderStockMoveService {
|
|||||||
return stockMove;
|
return stockMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StockMoveLine _createStockMoveLine(
|
public StockMoveLine _createStockMoveLine(
|
||||||
ProdProduct prodProduct, StockMove stockMove, int inOrOutType) throws AxelorException {
|
ProdProduct prodProduct, StockMove stockMove, int inOrOutType) throws AxelorException {
|
||||||
|
|
||||||
return _createStockMoveLine(prodProduct, stockMove, inOrOutType, prodProduct.getQty());
|
return _createStockMoveLine(prodProduct, stockMove, inOrOutType, prodProduct.getQty());
|
||||||
@@ -318,9 +396,11 @@ public class ManufOrderStockMoveService {
|
|||||||
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
||||||
this.finishStockMove(stockMove);
|
this.finishStockMove(stockMove);
|
||||||
}
|
}
|
||||||
|
if (manufOrder.getStypeSelect() == ManufOrderRepository.STYPE_PACKAGING_ORDER) {
|
||||||
for (StockMove stockMove : manufOrder.getOutStockMoveList()) {
|
for (StockMove stockMove : manufOrder.getOutStockMoveList()) {
|
||||||
updateRealPrice(manufOrder, stockMove);
|
updateRealPrice(manufOrder, stockMove);
|
||||||
this.finishStockMove(stockMove);
|
// this.finishStockMove(stockMove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +427,7 @@ public class ManufOrderStockMoveService {
|
|||||||
|
|
||||||
if (stockMove != null && stockMove.getStatusSelect() == StockMoveRepository.STATUS_PLANNED) {
|
if (stockMove != null && stockMove.getStatusSelect() == StockMoveRepository.STATUS_PLANNED) {
|
||||||
stockMove.setIsWithBackorder(false);
|
stockMove.setIsWithBackorder(false);
|
||||||
stockMoveService.copyQtyToRealQty(stockMove);
|
// stockMoveService.copyQtyToRealQty(stockMove);
|
||||||
stockMoveService.realize(stockMove);
|
stockMoveService.realize(stockMove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,7 +473,7 @@ public class ManufOrderStockMoveService {
|
|||||||
|
|
||||||
StockLocation fromStockLocation;
|
StockLocation fromStockLocation;
|
||||||
StockLocation toStockLocation;
|
StockLocation toStockLocation;
|
||||||
List<StockMove> stockMoveList;
|
Set<StockMove> stockMoveList;
|
||||||
|
|
||||||
if (inOrOut == PART_FINISH_IN) {
|
if (inOrOut == PART_FINISH_IN) {
|
||||||
stockMoveList = manufOrder.getInStockMoveList();
|
stockMoveList = manufOrder.getInStockMoveList();
|
||||||
@@ -455,6 +535,13 @@ public class ManufOrderStockMoveService {
|
|||||||
* ManufOrder#outStockMoveList}
|
* ManufOrder#outStockMoveList}
|
||||||
* @return an optional stock move
|
* @return an optional stock move
|
||||||
*/
|
*/
|
||||||
|
public Optional<StockMove> getPlannedStockMove(Set<StockMove> stockMoveList) {
|
||||||
|
return stockMoveList
|
||||||
|
.stream()
|
||||||
|
.filter(stockMove -> stockMove.getStatusSelect() == StockMoveRepository.STATUS_PLANNED)
|
||||||
|
.findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
public Optional<StockMove> getPlannedStockMove(List<StockMove> stockMoveList) {
|
public Optional<StockMove> getPlannedStockMove(List<StockMove> stockMoveList) {
|
||||||
return stockMoveList
|
return stockMoveList
|
||||||
.stream()
|
.stream()
|
||||||
@@ -533,6 +620,7 @@ public class ManufOrderStockMoveService {
|
|||||||
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
||||||
|
|
||||||
stockMoveLine.setProducedManufOrder(null);
|
stockMoveLine.setProducedManufOrder(null);
|
||||||
|
stockMoveLine.setTransferedManufOrder(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,6 +650,13 @@ public class ManufOrderStockMoveService {
|
|||||||
stockMoveLine ->
|
stockMoveLine ->
|
||||||
stockMoveLine.getStockMove().getStatusSelect()
|
stockMoveLine.getStockMove().getStatusSelect()
|
||||||
== StockMoveRepository.STATUS_CANCELED);
|
== StockMoveRepository.STATUS_CANCELED);
|
||||||
|
// clear all lists from planned lines
|
||||||
|
manufOrder
|
||||||
|
.getTransferedStockMoveLineList()
|
||||||
|
.removeIf(
|
||||||
|
stockMoveLine ->
|
||||||
|
stockMoveLine.getStockMove().getStatusSelect()
|
||||||
|
== StockMoveRepository.STATUS_CANCELED);
|
||||||
stockMove.clearStockMoveLineList();
|
stockMove.clearStockMoveLineList();
|
||||||
|
|
||||||
// create a new list
|
// create a new list
|
||||||
@@ -641,4 +736,84 @@ public class ManufOrderStockMoveService {
|
|||||||
|
|
||||||
return qtyToUpdate.multiply(prodProductQty).divide(manufOrderQty, 2, RoundingMode.HALF_EVEN);
|
return qtyToUpdate.multiply(prodProductQty).divide(manufOrderQty, 2, RoundingMode.HALF_EVEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void createToReturnStockMove(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
|
||||||
|
Company company = manufOrder.getCompany();
|
||||||
|
|
||||||
|
if (manufOrder.getConsumedStockMoveLineList() != null && company != null) {
|
||||||
|
StockMove outStockMove = manufOrder.getConsumedStockMoveLineList().get(0).getStockMove();
|
||||||
|
|
||||||
|
StockMove stockMove = Beans.get(StockMoveRepository.class).copy(outStockMove, false);
|
||||||
|
StockLocation fromLocation = manufOrder.getWorkshopStockLocation();
|
||||||
|
StockLocation toLocation = manufOrder.getProdProcess().getStockLocation();
|
||||||
|
stockMove.setFromStockLocation(fromLocation);
|
||||||
|
stockMove.setToStockLocation(toLocation);
|
||||||
|
stockMove.setPartner(null);
|
||||||
|
stockMove.setTypeSelect(StockMoveRepository.TYPE_INTERNAL);
|
||||||
|
|
||||||
|
for (StockMoveLine stockMoveLine : manufOrder.getConsumedStockMoveLineList()) {
|
||||||
|
BigDecimal diff = stockMoveLine.getQty().subtract(stockMoveLine.getRealQty());
|
||||||
|
StockMoveLine stockMoveLine2 =
|
||||||
|
Beans.get(StockMoveLineRepository.class).copy(stockMoveLine, false);
|
||||||
|
|
||||||
|
if (diff.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
stockMoveLine2.setQty(diff);
|
||||||
|
stockMoveLine2.setRealQty(diff);
|
||||||
|
stockMoveLine2.setConsumedManufOrder(null);
|
||||||
|
stockMoveLine2.setReturnedManufOrder(manufOrder);
|
||||||
|
stockMove.addStockMoveLineListItem(stockMoveLine2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stockMoveService.plan(stockMove);
|
||||||
|
manufOrder.addOutStockMoveListItem(stockMove);
|
||||||
|
|
||||||
|
// fill here the consumed stock move line list item to manage the
|
||||||
|
// case where we had to split tracked stock move lines
|
||||||
|
if (stockMove.getStockMoveLineList() != null) {
|
||||||
|
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
||||||
|
stockMoveLine.setConsumedManufOrder(null);
|
||||||
|
manufOrder.addToReturnStockMoveLineListItem(stockMoveLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void createTempStockMove(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
StockMove stockMove = this._createToConsumeStockMove(manufOrder, manufOrder.getCompany());
|
||||||
|
stockMove.setTypeSelect(StockMoveRepository.TYPE_OUTGOING);
|
||||||
|
stockMove.setFromStockLocation(manufOrder.getWorkshopStockLocation());
|
||||||
|
StockConfigProductionService stockConfigService = Beans.get(StockConfigProductionService.class);
|
||||||
|
StockConfig stockConfig = stockConfigService.getStockConfig(manufOrder.getCompany());
|
||||||
|
StockLocation virtualStockLocation =
|
||||||
|
stockConfigService.getProductionVirtualStockLocation(stockConfig);
|
||||||
|
stockMove.setToStockLocation(virtualStockLocation);
|
||||||
|
stockMove.setPartner(manufOrder.getCompany().getPartner());
|
||||||
|
for (BillOfMaterialConsumption billOfMaterialConsumption : manufOrder.getBillOfMaterialConsumptionList()) {
|
||||||
|
StockMoveLine stockMoveLine = stockMoveLineService.createStockMoveLine(
|
||||||
|
billOfMaterialConsumption.getProduct(),
|
||||||
|
billOfMaterialConsumption.getProduct().getName(),
|
||||||
|
billOfMaterialConsumption.getProduct().getDescription(),
|
||||||
|
billOfMaterialConsumption.getRealQty(),
|
||||||
|
BigDecimal.ZERO,
|
||||||
|
BigDecimal.ZERO,
|
||||||
|
billOfMaterialConsumption.getProduct().getUnit(),
|
||||||
|
stockMove,
|
||||||
|
StockMoveLineService.TYPE_OUT_PRODUCTIONS,
|
||||||
|
false,
|
||||||
|
BigDecimal.ZERO);
|
||||||
|
stockMoveLine.setTrackingNumber(billOfMaterialConsumption.getTrackingNumber());
|
||||||
|
stockMove.addStockMoveLineListItem(stockMoveLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
|
||||||
|
stockMoveService.plan(stockMove);
|
||||||
|
manufOrder.addOutStockMoveListItem(stockMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,20 +26,30 @@ import com.axelor.apps.base.service.app.AppBaseService;
|
|||||||
import com.axelor.apps.message.db.Template;
|
import com.axelor.apps.message.db.Template;
|
||||||
import com.axelor.apps.message.db.repo.EmailAccountRepository;
|
import com.axelor.apps.message.db.repo.EmailAccountRepository;
|
||||||
import com.axelor.apps.message.service.TemplateMessageService;
|
import com.axelor.apps.message.service.TemplateMessageService;
|
||||||
|
import com.axelor.apps.production.db.BillOfMaterial;
|
||||||
|
import com.axelor.apps.production.db.BillOfMaterialConsumption;
|
||||||
|
import com.axelor.apps.production.db.DocumentationManufOrder;
|
||||||
import com.axelor.apps.production.db.ManufOrder;
|
import com.axelor.apps.production.db.ManufOrder;
|
||||||
import com.axelor.apps.production.db.OperationOrder;
|
import com.axelor.apps.production.db.OperationOrder;
|
||||||
|
import com.axelor.apps.production.db.ProdProcess;
|
||||||
|
import com.axelor.apps.production.db.ProdProcessLine;
|
||||||
import com.axelor.apps.production.db.ProductionConfig;
|
import com.axelor.apps.production.db.ProductionConfig;
|
||||||
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
||||||
import com.axelor.apps.production.db.repo.CostSheetRepository;
|
import com.axelor.apps.production.db.repo.CostSheetRepository;
|
||||||
|
import com.axelor.apps.production.db.repo.DocumentationManufOrderRepository;
|
||||||
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||||
import com.axelor.apps.production.db.repo.OperationOrderRepository;
|
import com.axelor.apps.production.db.repo.OperationOrderRepository;
|
||||||
import com.axelor.apps.production.db.repo.ProdProcessRepository;
|
import com.axelor.apps.production.db.repo.ProdProcessRepository;
|
||||||
import com.axelor.apps.production.db.repo.ProductionConfigRepository;
|
import com.axelor.apps.production.db.repo.ProductionConfigRepository;
|
||||||
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
||||||
|
import com.axelor.apps.production.service.BillOfMaterialServiceImpl;
|
||||||
import com.axelor.apps.production.service.app.AppProductionService;
|
import com.axelor.apps.production.service.app.AppProductionService;
|
||||||
import com.axelor.apps.production.service.costsheet.CostSheetService;
|
import com.axelor.apps.production.service.costsheet.CostSheetService;
|
||||||
|
import com.axelor.apps.production.service.operationorder.OperationOrderService;
|
||||||
import com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService;
|
import com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService;
|
||||||
import com.axelor.apps.stock.db.StockMove;
|
import com.axelor.apps.stock.db.StockMove;
|
||||||
|
import com.axelor.apps.stock.db.TrackingNumber;
|
||||||
|
import com.axelor.apps.stock.db.repo.TrackingNumberRepository;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||||
import com.axelor.i18n.I18n;
|
import com.axelor.i18n.I18n;
|
||||||
@@ -49,8 +59,11 @@ import com.google.common.base.Strings;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.time.temporal.TemporalAdjusters;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -101,11 +114,16 @@ public class ManufOrderWorkflowService {
|
|||||||
}
|
}
|
||||||
if (!manufOrder.getIsConsProOnOperation()
|
if (!manufOrder.getIsConsProOnOperation()
|
||||||
&& CollectionUtils.isEmpty(manufOrder.getToConsumeProdProductList())) {
|
&& CollectionUtils.isEmpty(manufOrder.getToConsumeProdProductList())) {
|
||||||
// manufOrderService.createToConsumeProdProductList(manufOrder);
|
manufOrderService.createToConsumeProdProductList(manufOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(
|
||||||
|
"*********************************************CollectionUtils.isEmpty(manufOrder.getToProduceProdProductList())");
|
||||||
|
System.out.println(CollectionUtils.isEmpty(manufOrder.getToProduceProdProductList()));
|
||||||
|
System.out.println(
|
||||||
|
"*********************************************CollectionUtils.isEmpty(manufOrder.getToProduceProdProductList())");
|
||||||
if (CollectionUtils.isEmpty(manufOrder.getToProduceProdProductList())) {
|
if (CollectionUtils.isEmpty(manufOrder.getToProduceProdProductList())) {
|
||||||
// manufOrderService.createToProduceProdProductList(manufOrder);
|
manufOrderService.createToProduceProdProductList(manufOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manufOrder.getPlannedStartDateT() == null && manufOrder.getPlannedEndDateT() == null) {
|
if (manufOrder.getPlannedStartDateT() == null && manufOrder.getPlannedEndDateT() == null) {
|
||||||
@@ -132,11 +150,21 @@ public class ManufOrderWorkflowService {
|
|||||||
manufOrder.setUnit(manufOrder.getBillOfMaterial().getUnit());
|
manufOrder.setUnit(manufOrder.getBillOfMaterial().getUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!manufOrder.getIsConsProOnOperation()) {
|
// if (!manufOrder.getIsConsProOnOperation()) {
|
||||||
// manufOrderStockMoveService.createToConsumeStockMove(manufOrder);
|
System.out.println("manufOrder<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(manufOrder);
|
||||||
|
System.out.println(manufOrder.getStypeSelect());
|
||||||
|
System.out.println("manufOrder<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||||
|
if (manufOrder.getStypeSelect() == ManufOrderRepository.STYPE_PACKAGING_ORDER) {
|
||||||
|
manufOrderStockMoveService.createToConsumeStockMove(manufOrder);
|
||||||
}
|
}
|
||||||
|
manufOrderService.createOutgoinfStockMove(manufOrder);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (manufOrder.getStypeSelect() == ManufOrderRepository.STYPE_PACKAGING_ORDER) {
|
||||||
manufOrderStockMoveService.createToProduceStockMove(manufOrder);
|
manufOrderStockMoveService.createToProduceStockMove(manufOrder);
|
||||||
|
}
|
||||||
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_PLANNED);
|
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_PLANNED);
|
||||||
manufOrder.setCancelReason(null);
|
manufOrder.setCancelReason(null);
|
||||||
manufOrder.setCancelReasonStr(null);
|
manufOrder.setCancelReasonStr(null);
|
||||||
@@ -147,15 +175,30 @@ public class ManufOrderWorkflowService {
|
|||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void start(ManufOrder manufOrder) throws AxelorException {
|
public void start(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
|
||||||
// manufOrder.setRealStartDateT(
|
manufOrder.setRealStartDateT(
|
||||||
// Beans.get(AppProductionService.class).getTodayDateTime().toLocalDateTime());
|
Beans.get(AppProductionService.class).getTodayDateTime().toLocalDateTime());
|
||||||
|
|
||||||
int beforeOrAfterConfig = manufOrder.getProdProcess().getStockMoveRealizeOrderSelect();
|
int beforeOrAfterConfig = manufOrder.getProdProcess().getStockMoveRealizeOrderSelect();
|
||||||
if (beforeOrAfterConfig == ProductionConfigRepository.REALIZE_START) {
|
if (beforeOrAfterConfig == ProductionConfigRepository.REALIZE_START) {
|
||||||
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
for (StockMove stockMove : manufOrder.getInStockMoveList()) {
|
||||||
// manufOrderStockMoveService.finishStockMove(stockMove);
|
if (!stockMove.getIsValidatedProduction()) {
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_NO_VALUE,
|
||||||
|
I18n.get(IExceptionMessage.STOCK_MOVE_NOT_VALIDATED));
|
||||||
|
}
|
||||||
|
manufOrderStockMoveService.finishStockMove(stockMove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (manufOrder.getBillOfMaterial() != null) {
|
||||||
|
for (BillOfMaterial bom : manufOrder.getBillOfMaterial().getBillOfMaterialSet()) {
|
||||||
|
BillOfMaterialConsumption newBom =
|
||||||
|
Beans.get(BillOfMaterialServiceImpl.class)
|
||||||
|
.createBomConsumptionFromRawMaterial(bom, manufOrder);
|
||||||
|
manufOrder.addBillOfMaterialConsumptionListItem(newBom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_IN_PROGRESS);
|
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_IN_PROGRESS);
|
||||||
manufOrderRepo.save(manufOrder);
|
manufOrderRepo.save(manufOrder);
|
||||||
}
|
}
|
||||||
@@ -234,8 +277,8 @@ public class ManufOrderWorkflowService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
manufOrderStockMoveService.finish(manufOrder);
|
manufOrderStockMoveService.finish(manufOrder);
|
||||||
// manufOrder.setRealEndDateT(
|
manufOrder.setRealEndDateT(
|
||||||
// Beans.get(AppProductionService.class).getTodayDateTime().toLocalDateTime());
|
Beans.get(AppProductionService.class).getTodayDateTime().toLocalDateTime());
|
||||||
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_FINISHED);
|
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_FINISHED);
|
||||||
manufOrder.setEndTimeDifference(
|
manufOrder.setEndTimeDifference(
|
||||||
new BigDecimal(
|
new BigDecimal(
|
||||||
@@ -325,6 +368,11 @@ public class ManufOrderWorkflowService {
|
|||||||
.getProducedStockMoveLineList()
|
.getProducedStockMoveLineList()
|
||||||
.forEach(stockMoveLine -> stockMoveLine.setProducedManufOrder(null));
|
.forEach(stockMoveLine -> stockMoveLine.setProducedManufOrder(null));
|
||||||
}
|
}
|
||||||
|
if (manufOrder.getTransferedStockMoveLineList() != null) {
|
||||||
|
manufOrder
|
||||||
|
.getTransferedStockMoveLineList()
|
||||||
|
.forEach(stockMoveLine -> stockMoveLine.setTransferedManufOrder(null));
|
||||||
|
}
|
||||||
if (manufOrder.getDiffConsumeProdProductList() != null) {
|
if (manufOrder.getDiffConsumeProdProductList() != null) {
|
||||||
manufOrder.clearDiffConsumeProdProductList();
|
manufOrder.clearDiffConsumeProdProductList();
|
||||||
}
|
}
|
||||||
@@ -449,4 +497,108 @@ public class ManufOrderWorkflowService {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public Long createDocumentationManufOrder(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
DocumentationManufOrder documentationManufOrder = new DocumentationManufOrder();
|
||||||
|
documentationManufOrder.setStatusSelect(1);
|
||||||
|
documentationManufOrder.setProduct(manufOrder.getProduct());
|
||||||
|
documentationManufOrder.setTrackingNumber(manufOrder.getTrackingNumber());
|
||||||
|
documentationManufOrder.setManufOrder(manufOrder);
|
||||||
|
|
||||||
|
ProdProcess prodProcess = Beans.get(ProdProcessRepository.class).findByName("DOCUMENTATION");
|
||||||
|
|
||||||
|
for (ProdProcessLine prodProcessLine :
|
||||||
|
Beans.get(ManufOrderServiceImpl.class)
|
||||||
|
._sortProdProcessLineByPriority(prodProcess.getProdProcessLineList())) {
|
||||||
|
documentationManufOrder.addOperationOrderListItem(
|
||||||
|
Beans.get(OperationOrderService.class).createOperationOrder(manufOrder, prodProcessLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
DocumentationManufOrder savedocumentationManufOrder =
|
||||||
|
Beans.get(DocumentationManufOrderRepository.class).save(documentationManufOrder);
|
||||||
|
return savedocumentationManufOrder.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public Long createPackagingOrder(ManufOrder manufOrder) throws AxelorException {
|
||||||
|
|
||||||
|
ManufOrderService manufOrderService = Beans.get(ManufOrderService.class);
|
||||||
|
// ProdProcess prodProcess = Beans.get(ProdProcessRepository.class).all().filter("self.product =
|
||||||
|
// ?1 and self.typeSelect = ?2",manufOrder.getProduct(),
|
||||||
|
// ManufOrderRepository.STYPE_PACKAGING_ORDER).fetchOne();
|
||||||
|
BillOfMaterial billOfMaterial =
|
||||||
|
Beans.get(BillOfMaterialRepository.class)
|
||||||
|
.all()
|
||||||
|
.filter(
|
||||||
|
"self.product = ?1 and self.typeSelect = ?2",
|
||||||
|
manufOrder.getProduct(),
|
||||||
|
ManufOrderRepository.STYPE_PACKAGING_ORDER)
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
ManufOrder packagingOrder =
|
||||||
|
manufOrderService.generateManufOrder(
|
||||||
|
manufOrder.getProduct(),
|
||||||
|
manufOrder.getQty(),
|
||||||
|
ManufOrderService.DEFAULT_PRIORITY,
|
||||||
|
ManufOrderService.IS_TO_INVOICE,
|
||||||
|
billOfMaterial,
|
||||||
|
manufOrder.getRealEndDateT(),
|
||||||
|
null,
|
||||||
|
ManufOrderService.ORIGIN_TYPE_OTHER);
|
||||||
|
|
||||||
|
packagingOrder.setTrackingNumber(manufOrder.getTrackingNumber());
|
||||||
|
packagingOrder.setStypeSelect(ManufOrderRepository.STYPE_PACKAGING_ORDER);
|
||||||
|
packagingOrder.setOriginManufOrder(manufOrder);
|
||||||
|
packagingOrder.setProductionOrder(manufOrder.getProductionOrder());
|
||||||
|
|
||||||
|
ManufOrder packOrder = Beans.get(ManufOrderRepository.class).save(packagingOrder);
|
||||||
|
|
||||||
|
return packOrder.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public void createAndAssignTrackingNumber(OperationOrder operationOrder) throws AxelorException {
|
||||||
|
|
||||||
|
ManufOrderService manufOrderService = Beans.get(ManufOrderService.class);
|
||||||
|
// Optional<OperationOrder> operationOrder1 =
|
||||||
|
// manufOrder.getOperationOrderList().stream().filter(op
|
||||||
|
// ->op.getOperationName().equals("MELANGE")).findFirst();
|
||||||
|
// Optional<OperationOrder> operationOrder2 =
|
||||||
|
// manufOrder.getOperationOrderList().stream().filter(op
|
||||||
|
// ->op.getOperationName().equals("GRANULATION")).findFirst();
|
||||||
|
// ProdProcess prodProcess = Beans.get(ProdProcessRepository.class).all().filter("self.product =
|
||||||
|
// ?1 and self.typeSelect = ?2",manufOrder.getProduct(),
|
||||||
|
// ManufOrderRepository.STYPE_PACKAGING_ORDER).fetchOne();
|
||||||
|
ManufOrder manufOrder = operationOrder.getManufOrder();
|
||||||
|
BillOfMaterial billOfMaterial = manufOrder.getBillOfMaterial();
|
||||||
|
Product product = billOfMaterial.getProduct();
|
||||||
|
Integer lifeTime = billOfMaterial.getProductLifeTimeInMonth();
|
||||||
|
Integer seq = billOfMaterial.getProducedTrackingNumberSeq();
|
||||||
|
String workShopName = billOfMaterial.getWorkshopStockLocation().getName();
|
||||||
|
String lastYear = String.valueOf(LocalDate.now().getYear()).substring(2);
|
||||||
|
String workShopCode = "";
|
||||||
|
if (workShopName.length() >= 6) {
|
||||||
|
workShopCode = Character.toString(workShopName.charAt(5));
|
||||||
|
}
|
||||||
|
|
||||||
|
DecimalFormat df = new DecimalFormat("000");
|
||||||
|
String formattedseq = df.format(seq);
|
||||||
|
|
||||||
|
String sequence = workShopCode + lastYear + formattedseq;
|
||||||
|
|
||||||
|
LocalDate perishableDate =
|
||||||
|
LocalDate.now().plusMonths(lifeTime).with(TemporalAdjusters.lastDayOfMonth());
|
||||||
|
|
||||||
|
TrackingNumber trackingNumber = new TrackingNumber();
|
||||||
|
trackingNumber.setProduct(product);
|
||||||
|
trackingNumber.setPerishableExpirationDate(perishableDate);
|
||||||
|
trackingNumber.setTrackingNumberSeq(sequence);
|
||||||
|
manufOrder.setTrackingNumber(Beans.get(TrackingNumberRepository.class).save(trackingNumber));
|
||||||
|
|
||||||
|
Integer nextSeq = billOfMaterial.getProducedTrackingNumberSeq() + 1;
|
||||||
|
billOfMaterial.setProducedTrackingNumberSeq(nextSeq);
|
||||||
|
Beans.get(BillOfMaterialRepository.class).save(billOfMaterial);
|
||||||
|
Beans.get(ManufOrderRepository.class).save(manufOrder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ public class OperationOrderServiceImpl implements OperationOrderService {
|
|||||||
OperationOrderRepository.STATUS_DRAFT,
|
OperationOrderRepository.STATUS_DRAFT,
|
||||||
prodProcessLine);
|
prodProcessLine);
|
||||||
|
|
||||||
|
operationOrder.setProduct(prodProcessLine.getProduct());
|
||||||
|
operationOrder.setQty(prodProcessLine.getQty());
|
||||||
|
operationOrder.setUnit(prodProcessLine.getUnit());
|
||||||
|
|
||||||
this._createHumanResourceList(operationOrder, machineWorkCenter);
|
this._createHumanResourceList(operationOrder, machineWorkCenter);
|
||||||
|
|
||||||
return Beans.get(OperationOrderRepository.class).save(operationOrder);
|
return Beans.get(OperationOrderRepository.class).save(operationOrder);
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ public class OperationOrderWorkflowService {
|
|||||||
// Duration.between(
|
// Duration.between(
|
||||||
// operationOrder.getPlannedStartDateT(), operationOrder.getPlannedEndDateT())));
|
// operationOrder.getPlannedStartDateT(), operationOrder.getPlannedEndDateT())));
|
||||||
|
|
||||||
// ManufOrder manufOrder = operationOrder.getManufOrder();
|
ManufOrder manufOrder = operationOrder.getManufOrder();
|
||||||
// if (manufOrder == null || manufOrder.getIsConsProOnOperation()) {
|
if (manufOrder == null || manufOrder.getIsConsProOnOperation()) {
|
||||||
// operationOrderStockMoveService.createToConsumeStockMove(operationOrder);
|
operationOrderStockMoveService.createToConsumeStockMove(operationOrder);
|
||||||
// }
|
}
|
||||||
|
|
||||||
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_PLANNED);
|
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_PLANNED);
|
||||||
|
|
||||||
@@ -195,26 +195,26 @@ public class OperationOrderWorkflowService {
|
|||||||
public void start(OperationOrder operationOrder) throws AxelorException {
|
public void start(OperationOrder operationOrder) throws AxelorException {
|
||||||
if (operationOrder.getStatusSelect() != OperationOrderRepository.STATUS_IN_PROGRESS) {
|
if (operationOrder.getStatusSelect() != OperationOrderRepository.STATUS_IN_PROGRESS) {
|
||||||
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_IN_PROGRESS);
|
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_IN_PROGRESS);
|
||||||
// operationOrder.setRealStartDateT(appProductionService.getTodayDateTime().toLocalDateTime());
|
operationOrder.setRealStartDateT(appProductionService.getTodayDateTime().toLocalDateTime());
|
||||||
|
|
||||||
// startOperationOrderDuration(operationOrder);
|
startOperationOrderDuration(operationOrder);
|
||||||
|
|
||||||
// if (operationOrder.getManufOrder() != null) {
|
if (operationOrder.getManufOrder() != null) {
|
||||||
// int beforeOrAfterConfig =
|
int beforeOrAfterConfig =
|
||||||
// operationOrder.getManufOrder().getProdProcess().getStockMoveRealizeOrderSelect();
|
operationOrder.getManufOrder().getProdProcess().getStockMoveRealizeOrderSelect();
|
||||||
// if (beforeOrAfterConfig == ProductionConfigRepository.REALIZE_START) {
|
if (beforeOrAfterConfig == ProductionConfigRepository.REALIZE_START) {
|
||||||
// for (StockMove stockMove : operationOrder.getInStockMoveList()) {
|
for (StockMove stockMove : operationOrder.getInStockMoveList()) {
|
||||||
// Beans.get(ManufOrderStockMoveService.class).finishStockMove(stockMove);
|
Beans.get(ManufOrderStockMoveService.class).finishStockMove(stockMove);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// StockMove newStockMove =
|
StockMove newStockMove =
|
||||||
// operationOrderStockMoveService._createToConsumeStockMove(
|
operationOrderStockMoveService._createToConsumeStockMove(
|
||||||
// operationOrder, operationOrder.getManufOrder().getCompany());
|
operationOrder, operationOrder.getManufOrder().getCompany());
|
||||||
// newStockMove.setStockMoveLineList(new ArrayList<>());
|
newStockMove.setStockMoveLineList(new ArrayList<>());
|
||||||
// Beans.get(StockMoveService.class).plan(newStockMove);
|
Beans.get(StockMoveService.class).plan(newStockMove);
|
||||||
// operationOrder.addInStockMoveListItem(newStockMove);
|
operationOrder.addInStockMoveListItem(newStockMove);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
operationOrderRepo.save(operationOrder);
|
operationOrderRepo.save(operationOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public class OperationOrderWorkflowService {
|
|||||||
public void pause(OperationOrder operationOrder) {
|
public void pause(OperationOrder operationOrder) {
|
||||||
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_STANDBY);
|
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_STANDBY);
|
||||||
|
|
||||||
// stopOperationOrderDuration(operationOrder);
|
stopOperationOrderDuration(operationOrder);
|
||||||
|
|
||||||
operationOrderRepo.save(operationOrder);
|
operationOrderRepo.save(operationOrder);
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ public class OperationOrderWorkflowService {
|
|||||||
public void resume(OperationOrder operationOrder) {
|
public void resume(OperationOrder operationOrder) {
|
||||||
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_IN_PROGRESS);
|
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_IN_PROGRESS);
|
||||||
|
|
||||||
// startOperationOrderDuration(operationOrder);
|
startOperationOrderDuration(operationOrder);
|
||||||
|
|
||||||
operationOrderRepo.save(operationOrder);
|
operationOrderRepo.save(operationOrder);
|
||||||
}
|
}
|
||||||
@@ -261,9 +261,9 @@ public class OperationOrderWorkflowService {
|
|||||||
@Transactional(rollbackOn = {Exception.class})
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
public void finish(OperationOrder operationOrder) throws AxelorException {
|
public void finish(OperationOrder operationOrder) throws AxelorException {
|
||||||
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_FINISHED);
|
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_FINISHED);
|
||||||
// operationOrder.setRealEndDateT(appProductionService.getTodayDateTime().toLocalDateTime());
|
operationOrder.setRealEndDateT(appProductionService.getTodayDateTime().toLocalDateTime());
|
||||||
|
|
||||||
// stopOperationOrderDuration(operationOrder);
|
stopOperationOrderDuration(operationOrder);
|
||||||
|
|
||||||
// operationOrderStockMoveService.finish(operationOrder);
|
// operationOrderStockMoveService.finish(operationOrder);
|
||||||
operationOrderRepo.save(operationOrder);
|
operationOrderRepo.save(operationOrder);
|
||||||
@@ -286,14 +286,14 @@ public class OperationOrderWorkflowService {
|
|||||||
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_CANCELED);
|
operationOrder.setStatusSelect(OperationOrderRepository.STATUS_CANCELED);
|
||||||
|
|
||||||
if (oldStatus == OperationOrderRepository.STATUS_IN_PROGRESS) {
|
if (oldStatus == OperationOrderRepository.STATUS_IN_PROGRESS) {
|
||||||
// stopOperationOrderDuration(operationOrder);
|
stopOperationOrderDuration(operationOrder);
|
||||||
}
|
}
|
||||||
if (operationOrder.getConsumedStockMoveLineList() != null) {
|
if (operationOrder.getConsumedStockMoveLineList() != null) {
|
||||||
// operationOrder
|
operationOrder
|
||||||
// .getConsumedStockMoveLineList()
|
.getConsumedStockMoveLineList()
|
||||||
// .forEach(stockMoveLine -> stockMoveLine.setConsumedOperationOrder(null));
|
.forEach(stockMoveLine -> stockMoveLine.setConsumedOperationOrder(null));
|
||||||
}
|
}
|
||||||
// operationOrderStockMoveService.cancel(operationOrder);
|
operationOrderStockMoveService.cancel(operationOrder);
|
||||||
|
|
||||||
operationOrderRepo.save(operationOrder);
|
operationOrderRepo.save(operationOrder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,27 @@ import com.axelor.apps.base.service.administration.SequenceService;
|
|||||||
import com.axelor.apps.production.db.BillOfMaterial;
|
import com.axelor.apps.production.db.BillOfMaterial;
|
||||||
import com.axelor.apps.production.db.ManufOrder;
|
import com.axelor.apps.production.db.ManufOrder;
|
||||||
import com.axelor.apps.production.db.ProductionOrder;
|
import com.axelor.apps.production.db.ProductionOrder;
|
||||||
|
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||||
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
||||||
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
||||||
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
||||||
|
import com.axelor.apps.production.service.manuforder.ManufOrderServiceImpl;
|
||||||
import com.axelor.apps.sale.db.SaleOrder;
|
import com.axelor.apps.sale.db.SaleOrder;
|
||||||
|
import com.axelor.apps.stock.db.StockMove;
|
||||||
|
import com.axelor.apps.stock.db.StockMoveLine;
|
||||||
|
import com.axelor.apps.stock.db.repo.StockMoveRepository;
|
||||||
|
import com.axelor.apps.stock.service.StockMoveService;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||||
import com.axelor.i18n.I18n;
|
import com.axelor.i18n.I18n;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -127,11 +135,9 @@ public class ProductionOrderServiceImpl implements ProductionOrderService {
|
|||||||
int originType)
|
int originType)
|
||||||
throws AxelorException {
|
throws AxelorException {
|
||||||
|
|
||||||
|
|
||||||
BigDecimal bomQty = billOfMaterial.getQty();
|
BigDecimal bomQty = billOfMaterial.getQty();
|
||||||
BigDecimal manufCount = qtyRequested.divide(bomQty, 0, RoundingMode.CEILING);
|
BigDecimal manufCount = qtyRequested.divide(bomQty, 0, RoundingMode.CEILING);
|
||||||
|
|
||||||
|
|
||||||
for (int index = 0; index < manufCount.intValue(); index++) {
|
for (int index = 0; index < manufCount.intValue(); index++) {
|
||||||
ManufOrder manufOrder =
|
ManufOrder manufOrder =
|
||||||
manufOrderService.generateManufOrder(
|
manufOrderService.generateManufOrder(
|
||||||
@@ -149,11 +155,43 @@ for (int index = 0; index < manufCount.intValue(); index++) {
|
|||||||
manufOrder.setSaleOrder(saleOrder);
|
manufOrder.setSaleOrder(saleOrder);
|
||||||
manufOrder.setClientPartner(saleOrder.getClientPartner());
|
manufOrder.setClientPartner(saleOrder.getClientPartner());
|
||||||
}
|
}
|
||||||
|
manufOrder.setStypeSelect(ManufOrderRepository.STYPE_MANUF_ORDER);
|
||||||
productionOrder.addManufOrderListItem(manufOrder);
|
productionOrder.addManufOrderListItem(manufOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return productionOrderRepo.save(productionOrder);
|
return productionOrderRepo.save(productionOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = {Exception.class})
|
||||||
|
public StockMove generateConsumeStockMoveFromSelectedManufOrder(
|
||||||
|
ProductionOrder productionOrder, List<ManufOrder> manufOrderList) throws AxelorException {
|
||||||
|
|
||||||
|
ManufOrder manufOrder = manufOrderList.get(0);
|
||||||
|
StockMove stockMove =
|
||||||
|
Beans.get(ManufOrderServiceImpl.class)
|
||||||
|
.createToConsumeProdProductList(manufOrder, manufOrderList.size());
|
||||||
|
|
||||||
|
for (ManufOrder manufOrder2 : manufOrderList) {
|
||||||
|
if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
|
||||||
|
Beans.get(ManufOrderServiceImpl.class).createToConsumeProdProductList(manufOrder2);
|
||||||
|
Beans.get(StockMoveService.class).plan(stockMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stockMove.getStockMoveLineList() != null) {
|
||||||
|
for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
|
||||||
|
manufOrder2.addTransferedStockMoveLineListItem(stockMoveLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
manufOrder2.addInStockMoveListItem(stockMove);
|
||||||
|
Beans.get(ProductionOrderRepository.class).save(productionOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
stockMove.setOrigin(productionOrder.getProductionOrderSeq());
|
||||||
|
stockMove.setOriginId(productionOrder.getId());
|
||||||
|
stockMove.setOriginTypeSelect(StockMoveRepository.ORIGIN_PRODUCTION_ORDER);
|
||||||
|
|
||||||
|
return Beans.get(StockMoveRepository.class).save(stockMove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,17 +19,24 @@ package com.axelor.apps.production.web;
|
|||||||
|
|
||||||
import com.axelor.apps.ReportFactory;
|
import com.axelor.apps.ReportFactory;
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
|
import com.axelor.apps.production.db.BillOfMaterial;
|
||||||
|
import com.axelor.apps.production.db.BillOfMaterialConsumption;
|
||||||
import com.axelor.apps.production.db.CostSheet;
|
import com.axelor.apps.production.db.CostSheet;
|
||||||
|
import com.axelor.apps.production.db.DocumentationManufOrder;
|
||||||
import com.axelor.apps.production.db.ManufOrder;
|
import com.axelor.apps.production.db.ManufOrder;
|
||||||
|
import com.axelor.apps.production.db.OperationOrder;
|
||||||
|
import com.axelor.apps.production.db.repo.BillOfMaterialConsumptionRepository;
|
||||||
import com.axelor.apps.production.db.repo.CostSheetRepository;
|
import com.axelor.apps.production.db.repo.CostSheetRepository;
|
||||||
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||||
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
||||||
import com.axelor.apps.production.report.IReport;
|
import com.axelor.apps.production.report.IReport;
|
||||||
|
import com.axelor.apps.production.service.BillOfMaterialServiceImpl;
|
||||||
import com.axelor.apps.production.service.costsheet.CostSheetService;
|
import com.axelor.apps.production.service.costsheet.CostSheetService;
|
||||||
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
||||||
import com.axelor.apps.production.service.manuforder.ManufOrderStockMoveService;
|
import com.axelor.apps.production.service.manuforder.ManufOrderStockMoveService;
|
||||||
import com.axelor.apps.production.service.manuforder.ManufOrderWorkflowService;
|
import com.axelor.apps.production.service.manuforder.ManufOrderWorkflowService;
|
||||||
import com.axelor.apps.report.engine.ReportSettings;
|
import com.axelor.apps.report.engine.ReportSettings;
|
||||||
|
import com.axelor.db.mapper.Mapper;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
import com.axelor.exception.service.TraceBackService;
|
import com.axelor.exception.service.TraceBackService;
|
||||||
import com.axelor.i18n.I18n;
|
import com.axelor.i18n.I18n;
|
||||||
@@ -45,7 +52,10 @@ import java.lang.invoke.MethodHandles;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import org.eclipse.birt.core.exception.BirtException;
|
import org.eclipse.birt.core.exception.BirtException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -107,7 +117,6 @@ public class ManufOrderController {
|
|||||||
response.setNotify(I18n.get(IExceptionMessage.MANUF_ORDER_EMAIL_NOT_SENT));
|
response.setNotify(I18n.get(IExceptionMessage.MANUF_ORDER_EMAIL_NOT_SENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setReload(true);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TraceBackService.trace(response, e);
|
TraceBackService.trace(response, e);
|
||||||
}
|
}
|
||||||
@@ -185,9 +194,7 @@ public class ManufOrderController {
|
|||||||
manufOrders =
|
manufOrders =
|
||||||
Beans.get(ManufOrderRepository.class)
|
Beans.get(ManufOrderRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter(
|
.filter("self.id in ?1", context.get("_ids"))
|
||||||
"self.id in ?1",
|
|
||||||
context.get("_ids"))
|
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
for (ManufOrder manufOrder : manufOrders) {
|
for (ManufOrder manufOrder : manufOrders) {
|
||||||
@@ -211,9 +218,7 @@ public class ManufOrderController {
|
|||||||
manufOrders =
|
manufOrders =
|
||||||
Beans.get(ManufOrderRepository.class)
|
Beans.get(ManufOrderRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter(
|
.filter("self.id in ?1", context.get("_ids"))
|
||||||
"self.id in ?1",
|
|
||||||
context.get("_ids"))
|
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
for (ManufOrder manufOrder : manufOrders) {
|
for (ManufOrder manufOrder : manufOrders) {
|
||||||
@@ -237,9 +242,7 @@ public class ManufOrderController {
|
|||||||
manufOrders =
|
manufOrders =
|
||||||
Beans.get(ManufOrderRepository.class)
|
Beans.get(ManufOrderRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter(
|
.filter("self.id in ?1", context.get("_ids"))
|
||||||
"self.id in ?1",
|
|
||||||
context.get("_ids"))
|
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
for (ManufOrder manufOrder : manufOrders) {
|
for (ManufOrder manufOrder : manufOrders) {
|
||||||
@@ -263,9 +266,7 @@ public class ManufOrderController {
|
|||||||
manufOrders =
|
manufOrders =
|
||||||
Beans.get(ManufOrderRepository.class)
|
Beans.get(ManufOrderRepository.class)
|
||||||
.all()
|
.all()
|
||||||
.filter(
|
.filter("self.id in ?1", context.get("_ids"))
|
||||||
"self.id in ?1",
|
|
||||||
context.get("_ids"))
|
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
for (ManufOrder manufOrder : manufOrders) {
|
for (ManufOrder manufOrder : manufOrders) {
|
||||||
@@ -297,6 +298,26 @@ public class ManufOrderController {
|
|||||||
TraceBackService.trace(response, e);
|
TraceBackService.trace(response, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Called from manuf order form on clicking realize button. Call {@link
|
||||||
|
* ManufOrderStockMoveService#consumeInStockMoves(ManufOrder)} to consume material used in manuf
|
||||||
|
* order.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
public void validateOutStockMove(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
|
||||||
|
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
|
||||||
|
|
||||||
|
Beans.get(ManufOrderStockMoveService.class).validateOutStockMoves(manufOrder);
|
||||||
|
response.setReload(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that generate a Pdf file for an manufacturing order
|
* Method that generate a Pdf file for an manufacturing order
|
||||||
@@ -581,4 +602,186 @@ public class ManufOrderController {
|
|||||||
TraceBackService.trace(response, e);
|
TraceBackService.trace(response, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createPackagingOrder(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
Long manufOrderId = (Long) request.getContext().get("id");
|
||||||
|
ManufOrder manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrderId);
|
||||||
|
|
||||||
|
if (!Beans.get(ManufOrderWorkflowService.class).finish(manufOrder)) {
|
||||||
|
response.setNotify(I18n.get(IExceptionMessage.MANUF_ORDER_EMAIL_NOT_SENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
// response.setReload(true);
|
||||||
|
ManufOrder manufOrder2 = Beans.get(ManufOrderRepository.class).find(manufOrderId);
|
||||||
|
if (manufOrder.getStypeSelect() == ManufOrderRepository.STYPE_MANUF_ORDER) {
|
||||||
|
|
||||||
|
Long packagingOrderid =
|
||||||
|
Beans.get(ManufOrderWorkflowService.class).createPackagingOrder(manufOrder2);
|
||||||
|
|
||||||
|
response.setView(
|
||||||
|
ActionView.define("Pckaging order")
|
||||||
|
.model(ManufOrder.class.getName())
|
||||||
|
.add("form", "manuf-order-form")
|
||||||
|
.add("grid", "manuf-order-grid")
|
||||||
|
.context("_showRecord", String.valueOf(packagingOrderid))
|
||||||
|
.domain("self.id = " + packagingOrderid)
|
||||||
|
.map());
|
||||||
|
} else if (manufOrder2.getStypeSelect() == ManufOrderRepository.STYPE_PACKAGING_ORDER) {
|
||||||
|
Long docManufOrderid =
|
||||||
|
Beans.get(ManufOrderWorkflowService.class).createDocumentationManufOrder(manufOrder2);
|
||||||
|
|
||||||
|
response.setView(
|
||||||
|
ActionView.define("Documentation order")
|
||||||
|
.model(DocumentationManufOrder.class.getName())
|
||||||
|
.add("form", "documentation-manuf-order-form")
|
||||||
|
.add("grid", "documentation-manuf-order-grid")
|
||||||
|
.context("_showRecord", String.valueOf(docManufOrderid))
|
||||||
|
.domain("self.id = " + docManufOrderid)
|
||||||
|
.map());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createTrackingNumberAndAssign(ActionRequest request, ActionResponse response)
|
||||||
|
throws AxelorException {
|
||||||
|
Long manufOrderId = (Long) request.getContext().get("id");
|
||||||
|
ManufOrder manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrderId);
|
||||||
|
|
||||||
|
Optional<OperationOrder> operationOrder1 =
|
||||||
|
manufOrder
|
||||||
|
.getOperationOrderList()
|
||||||
|
.stream()
|
||||||
|
.filter(op -> op.getOperationName().equals("MELANGE"))
|
||||||
|
.findFirst();
|
||||||
|
Optional<OperationOrder> operationOrder2 =
|
||||||
|
manufOrder
|
||||||
|
.getOperationOrderList()
|
||||||
|
.stream()
|
||||||
|
.filter(op -> op.getOperationName().equals("GRANULATION"))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (operationOrder1 != null) {
|
||||||
|
if (operationOrder1.isPresent()) {
|
||||||
|
Beans.get(ManufOrderWorkflowService.class)
|
||||||
|
.createAndAssignTrackingNumber(operationOrder1.get());
|
||||||
|
}
|
||||||
|
} else if (operationOrder2 != null) {
|
||||||
|
if (operationOrder2.isPresent()) {
|
||||||
|
Beans.get(ManufOrderWorkflowService.class)
|
||||||
|
.createAndAssignTrackingNumber(operationOrder2.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setReload(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createToReturnStockMove(ActionRequest request, ActionResponse response)
|
||||||
|
throws AxelorException {
|
||||||
|
Long manufOrderId = (Long) request.getContext().get("id");
|
||||||
|
ManufOrder manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrderId);
|
||||||
|
Beans.get(ManufOrderStockMoveService.class).createToReturnStockMove(manufOrder);
|
||||||
|
response.setReload(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void planOF(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||||
|
try {
|
||||||
|
Long manufOrderId = (Long) request.getContext().get("id");
|
||||||
|
ManufOrder manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrderId);
|
||||||
|
|
||||||
|
if (manufOrder.getBillOfMaterial() != null) {
|
||||||
|
for (BillOfMaterial bom : manufOrder.getBillOfMaterial().getBillOfMaterialSet()) {
|
||||||
|
BillOfMaterialConsumption newBom =
|
||||||
|
Beans.get(BillOfMaterialServiceImpl.class)
|
||||||
|
.createBomConsumptionFromRawMaterial(bom, manufOrder);
|
||||||
|
manufOrder.addBillOfMaterialConsumptionListItem(newBom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void prefillConsumption(ActionRequest request, ActionResponse response) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long manufOrderId = (Long) request.getContext().get("id");
|
||||||
|
ManufOrder manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrderId);
|
||||||
|
if (manufOrder.getBillOfMaterial() != null) {
|
||||||
|
Beans.get(BillOfMaterialServiceImpl.class).createBomAndAttachToManufOrder(manufOrder);
|
||||||
|
response.setReload(true);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
public void splitBillConsumption(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
List<HashMap> selectedBillConsumptionMapList =
|
||||||
|
(List<HashMap>) request.getContext().get("billOfMaterialConsumptionList");
|
||||||
|
Map manufOrderMap = (Map<String, Object>) request.getContext().get("manufOrder");
|
||||||
|
if (selectedBillConsumptionMapList == null) {
|
||||||
|
response.setFlash(I18n.get("Please select at least one line."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BillOfMaterialConsumption> billConsumptionList = new ArrayList<>();
|
||||||
|
BillOfMaterialConsumptionRepository billConsumptionRepo =
|
||||||
|
Beans.get(BillOfMaterialConsumptionRepository.class);
|
||||||
|
for (HashMap map : selectedBillConsumptionMapList) {
|
||||||
|
BillOfMaterialConsumption billConsumption =
|
||||||
|
(BillOfMaterialConsumption) Mapper.toBean(BillOfMaterialConsumption.class, map);
|
||||||
|
billConsumptionList.add(billConsumptionRepo.find(billConsumption.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (billConsumptionList.isEmpty()) {
|
||||||
|
response.setFlash(I18n.get("Please select at least one line."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal splitQty = new BigDecimal(request.getContext().get("splitQty").toString());
|
||||||
|
if (splitQty == null || splitQty.compareTo(BigDecimal.ZERO) < 1) {
|
||||||
|
response.setFlash(I18n.get("Please enter a valid quantity."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ManufOrder manufOrder = Mapper.toBean(ManufOrder.class, manufOrderMap);
|
||||||
|
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
|
||||||
|
Beans.get(BillOfMaterialServiceImpl.class)
|
||||||
|
.splitBillOfMaterialConsumption(manufOrder, billConsumptionList, splitQty);
|
||||||
|
response.setCanClose(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void consumeStockMoveTemp(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
Context context = request.getContext();
|
||||||
|
List<ManufOrder> manufOrders = new ArrayList<>();
|
||||||
|
if (context.get("id") != null) {
|
||||||
|
Long manufOrderId = (Long) request.getContext().get("id");
|
||||||
|
manufOrders.add(Beans.get(ManufOrderRepository.class).find(manufOrderId));
|
||||||
|
} else if (context.get("_ids") != null) {
|
||||||
|
manufOrders =
|
||||||
|
Beans.get(ManufOrderRepository.class)
|
||||||
|
.all()
|
||||||
|
.filter(
|
||||||
|
"self.id in ?1",
|
||||||
|
context.get("_ids"))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
for (ManufOrder manufOrder : manufOrders) {
|
||||||
|
Beans.get(ManufOrderStockMoveService.class).createTempStockMove(manufOrder);
|
||||||
|
}
|
||||||
|
response.setReload(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,23 @@ public class OperationOrderController {
|
|||||||
try {
|
try {
|
||||||
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
|
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
|
||||||
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
|
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
|
||||||
|
|
||||||
|
System.out.println("*******************************************");
|
||||||
|
System.out.println(operationOrder.getManufOrder().getTrackingNumber());
|
||||||
|
System.out.println(operationOrder.getOperationName());
|
||||||
|
System.out.println(operationOrder.getManufOrder().getTrackingNumber() == null);
|
||||||
|
System.out.println(operationOrder.getOperationName() == "MELANGE");
|
||||||
|
|
||||||
|
if (operationOrder.getManufOrder().getTrackingNumber() == null) {
|
||||||
|
System.out.println("***is null****99999");
|
||||||
|
if (operationOrder.getOperationName().equals("MELANGE")) {
|
||||||
|
System.out.println("*******************************************99999");
|
||||||
|
Beans.get(ManufOrderWorkflowService.class).createAndAssignTrackingNumber(operationOrder);
|
||||||
|
} else if (operationOrder.getOperationName().equals("GRANULATION")) {
|
||||||
|
Beans.get(ManufOrderWorkflowService.class).createAndAssignTrackingNumber(operationOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Beans.get(OperationOrderWorkflowService.class).start(operationOrder);
|
Beans.get(OperationOrderWorkflowService.class).start(operationOrder);
|
||||||
response.setReload(true);
|
response.setReload(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -21,13 +21,19 @@ import com.axelor.apps.base.db.Product;
|
|||||||
import com.axelor.apps.base.db.repo.ProductRepository;
|
import com.axelor.apps.base.db.repo.ProductRepository;
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
import com.axelor.apps.base.service.app.AppBaseService;
|
||||||
import com.axelor.apps.production.db.BillOfMaterial;
|
import com.axelor.apps.production.db.BillOfMaterial;
|
||||||
|
import com.axelor.apps.production.db.ManufOrder;
|
||||||
import com.axelor.apps.production.db.ProductionOrder;
|
import com.axelor.apps.production.db.ProductionOrder;
|
||||||
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
||||||
|
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||||
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
||||||
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
||||||
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
||||||
import com.axelor.apps.production.service.productionorder.ProductionOrderService;
|
import com.axelor.apps.production.service.productionorder.ProductionOrderService;
|
||||||
|
import com.axelor.apps.production.service.productionorder.ProductionOrderServiceImpl;
|
||||||
|
import com.axelor.apps.stock.db.StockMove;
|
||||||
|
import com.axelor.db.mapper.Mapper;
|
||||||
import com.axelor.exception.AxelorException;
|
import com.axelor.exception.AxelorException;
|
||||||
|
import com.axelor.exception.service.TraceBackService;
|
||||||
import com.axelor.i18n.I18n;
|
import com.axelor.i18n.I18n;
|
||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import com.axelor.rpc.ActionRequest;
|
import com.axelor.rpc.ActionRequest;
|
||||||
@@ -38,6 +44,9 @@ import java.math.BigDecimal;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -104,4 +113,40 @@ public class ProductionOrderController {
|
|||||||
response.setCanClose(true);
|
response.setCanClose(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
public void generateConsumeStockMoveFromSelectedManufOrder(
|
||||||
|
ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
List<HashMap> selectedManufOrderMapList =
|
||||||
|
(List<HashMap>) request.getContext().get("manufOrderList");
|
||||||
|
Map productionOrderMap = (Map<String, Object>) request.getContext().get("productionOrder");
|
||||||
|
if (selectedManufOrderMapList == null) {
|
||||||
|
response.setFlash(I18n.get(IExceptionMessage.UNIT_COST_CALCULATION_IMPORT_FAIL_ERROR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ManufOrder> manufOrderList = new ArrayList<>();
|
||||||
|
ManufOrderRepository manufOrderRepository = Beans.get(ManufOrderRepository.class);
|
||||||
|
for (HashMap map : selectedManufOrderMapList) {
|
||||||
|
ManufOrder manufOrder = (ManufOrder) Mapper.toBean(ManufOrder.class, map);
|
||||||
|
manufOrderList.add(manufOrderRepository.find(manufOrder.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manufOrderList.isEmpty()) {
|
||||||
|
response.setFlash(I18n.get(IExceptionMessage.UNIT_COST_CALCULATION_IMPORT_FAIL_ERROR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProductionOrder productionOrder = Mapper.toBean(ProductionOrder.class, productionOrderMap);
|
||||||
|
productionOrder = Beans.get(ProductionOrderRepository.class).find(productionOrder.getId());
|
||||||
|
StockMove stockMove =
|
||||||
|
Beans.get(ProductionOrderServiceImpl.class)
|
||||||
|
.generateConsumeStockMoveFromSelectedManufOrder(productionOrder, manufOrderList);
|
||||||
|
response.setCanClose(true);
|
||||||
|
response.setFlash("Generated successfully : " + stockMove.getStockMoveSeq());
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,15 @@
|
|||||||
<one-to-many name="bomChildTreeList" ref="TempBomTree" mappedBy="parentBom"/>
|
<one-to-many name="bomChildTreeList" ref="TempBomTree" mappedBy="parentBom"/>
|
||||||
<one-to-many name="bomTreeList" ref="TempBomTree" mappedBy="bom"/>
|
<one-to-many name="bomTreeList" ref="TempBomTree" mappedBy="bom"/>
|
||||||
|
|
||||||
|
<integer name="typeSelect" title="Bom type" selection="production.bill.of.material.type.select" default="1"/>
|
||||||
|
|
||||||
|
<integer name="productLifeTimeInMonth" title="Product lifetime in months" />
|
||||||
|
<integer name="producedTrackingNumberSeq" title="Produced tracking number seq" />
|
||||||
|
|
||||||
<string name="note" large="true"/>
|
<string name="note" large="true"/>
|
||||||
|
|
||||||
|
<finder-method name="findByProductAndTypeSelect" using="product,typeSelect" all="true"/>
|
||||||
|
|
||||||
<extra-code><![CDATA[
|
<extra-code><![CDATA[
|
||||||
|
|
||||||
// STATUS SELECT
|
// STATUS SELECT
|
||||||
@@ -42,6 +49,9 @@
|
|||||||
public static final int STATUS_APPLICABLE = 3;
|
public static final int STATUS_APPLICABLE = 3;
|
||||||
public static final int STATUS_OBSOLETE = 4;
|
public static final int STATUS_OBSOLETE = 4;
|
||||||
|
|
||||||
|
public static final int MANUF_TYPE_SELECT = 1;
|
||||||
|
public static final int PACKAGING_TYPE_SELECT = 2;
|
||||||
|
|
||||||
]]></extra-code>
|
]]></extra-code>
|
||||||
|
|
||||||
<track>
|
<track>
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
<boolean name="defineSubBillOfMaterial" title="Define sub bill of material"/>
|
<boolean name="defineSubBillOfMaterial" title="Define sub bill of material"/>
|
||||||
<many-to-one name="unit" ref="com.axelor.apps.base.db.Unit" title="Unit"/>
|
<many-to-one name="unit" ref="com.axelor.apps.base.db.Unit" title="Unit"/>
|
||||||
<many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
|
<many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
|
||||||
|
|
||||||
<string name="fullName" namecolumn="true" title="Label"/>
|
<string name="fullName" namecolumn="true" title="Label"/>
|
||||||
|
<many-to-one name="trackingNumber" ref="com.axelor.apps.stock.db.TrackingNumber" title="Tracking Nbr."/>
|
||||||
|
<many-to-one ref="ManufOrder" name="manufOrder" />
|
||||||
<string name="note" large="true"/>
|
<string name="note" large="true"/>
|
||||||
|
|
||||||
<track>
|
<track>
|
||||||
|
|||||||
@@ -7,6 +7,19 @@
|
|||||||
|
|
||||||
<entity name="DocumentationManufOrder" lang="java">
|
<entity name="DocumentationManufOrder" lang="java">
|
||||||
|
|
||||||
|
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product" initParam="true"/>
|
||||||
|
<many-to-one name="trackingNumber" ref="com.axelor.apps.stock.db.TrackingNumber" title="Tracking Nbr."/>
|
||||||
|
<many-to-one name="conformityCertificateFile" ref="com.axelor.meta.db.MetaFile" title="Conformity certificate file" />
|
||||||
|
<many-to-one name="manufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="ManufOrder"/>
|
||||||
|
<string name="noteconformityCertificateFile" large="true" multiline="true" title="Conformity certificate file note"/>
|
||||||
|
<integer name="stypeSelect" title="Typeselect" selection="production.documentation.manuf.order.typeselect" />
|
||||||
|
<integer name="statusSelect" title="Status select" selection="production.documentation.manuf.order.statusSelect" />
|
||||||
|
<decimal name="qty" title="Qty" initParam="true"/>
|
||||||
|
<one-to-many name="operationOrderList" ref="com.axelor.apps.production.db.OperationOrder" title="Operation orders" orderBy="priority"/>
|
||||||
|
|
||||||
|
<track>
|
||||||
|
<field name="statusSelect" />
|
||||||
|
</track>
|
||||||
|
|
||||||
</entity>
|
</entity>
|
||||||
</domain-models>
|
</domain-models>
|
||||||
@@ -30,6 +30,8 @@
|
|||||||
<one-to-many name="producedStockMoveLineList" ref="com.axelor.apps.stock.db.StockMoveLine" mappedBy="producedManufOrder" title="Produced products" orphanRemoval="false"/>
|
<one-to-many name="producedStockMoveLineList" ref="com.axelor.apps.stock.db.StockMoveLine" mappedBy="producedManufOrder" title="Produced products" orphanRemoval="false"/>
|
||||||
<one-to-many name="wasteProdProductList" ref="com.axelor.apps.production.db.ProdProduct" mappedBy="wasteManufOrder" title="Waste"/>
|
<one-to-many name="wasteProdProductList" ref="com.axelor.apps.production.db.ProdProduct" mappedBy="wasteManufOrder" title="Waste"/>
|
||||||
|
|
||||||
|
<one-to-many name="transferedStockMoveLineList" ref="com.axelor.apps.stock.db.StockMoveLine" mappedBy="transferedManufOrder" title="Transfered products" orphanRemoval="false"/>
|
||||||
|
<one-to-many name="toReturnStockMoveLineList" ref="com.axelor.apps.stock.db.StockMoveLine" mappedBy="returnedManufOrder" title="Returned products" orphanRemoval="false"/>
|
||||||
|
|
||||||
<boolean name="isConsProOnOperation" title="Manage consumed products on operations" initParam="true"/>
|
<boolean name="isConsProOnOperation" title="Manage consumed products on operations" initParam="true"/>
|
||||||
|
|
||||||
@@ -50,9 +52,9 @@
|
|||||||
<datetime name="realStartDateT" title="Real start date"/>
|
<datetime name="realStartDateT" title="Real start date"/>
|
||||||
<datetime name="realEndDateT" title="Real end date"/>
|
<datetime name="realEndDateT" title="Real end date"/>
|
||||||
<decimal name="endTimeDifference" title="Time difference (Minutes)"/>
|
<decimal name="endTimeDifference" title="Time difference (Minutes)"/>
|
||||||
|
<!-- mappedBy="inManufOrder" -->
|
||||||
<one-to-many name="inStockMoveList" ref="com.axelor.apps.stock.db.StockMove" title="Stock moves in" mappedBy="inManufOrder"/>
|
<many-to-many name="inStockMoveList" ref="com.axelor.apps.stock.db.StockMove" title="Stock moves in" />
|
||||||
<one-to-many name="outStockMoveList" ref="com.axelor.apps.stock.db.StockMove" title="Stock moves out" mappedBy="outManufOrder"/>
|
<many-to-many name="outStockMoveList" ref="com.axelor.apps.stock.db.StockMove" title="Stock moves out" mappedBy="outManufOrder"/>
|
||||||
|
|
||||||
<many-to-one name="wasteStockMove" ref="com.axelor.apps.stock.db.StockMove" title="Waste stock move"/>
|
<many-to-one name="wasteStockMove" ref="com.axelor.apps.stock.db.StockMove" title="Waste stock move"/>
|
||||||
|
|
||||||
@@ -75,6 +77,9 @@
|
|||||||
|
|
||||||
<one-to-many name="billOfMaterialConsumptionList" title="Bom consumption list" ref="com.axelor.apps.production.db.BillOfMaterialConsumption" />
|
<one-to-many name="billOfMaterialConsumptionList" title="Bom consumption list" ref="com.axelor.apps.production.db.BillOfMaterialConsumption" />
|
||||||
|
|
||||||
|
<many-to-one name="originManufOrder" ref="ManufOrder" title="Origin Manuf order" />
|
||||||
|
|
||||||
|
|
||||||
<unique-constraint columns="manufOrderSeq,company"/>
|
<unique-constraint columns="manufOrderSeq,company"/>
|
||||||
|
|
||||||
<extra-code><![CDATA[
|
<extra-code><![CDATA[
|
||||||
@@ -85,6 +90,11 @@
|
|||||||
public static final int STATUS_IN_PROGRESS = 4;
|
public static final int STATUS_IN_PROGRESS = 4;
|
||||||
public static final int STATUS_STANDBY = 5;
|
public static final int STATUS_STANDBY = 5;
|
||||||
public static final int STATUS_FINISHED = 6;
|
public static final int STATUS_FINISHED = 6;
|
||||||
|
|
||||||
|
public static final int STYPE_MANUF_ORDER = 1;
|
||||||
|
public static final int STYPE_PACKAGING_ORDER = 2;
|
||||||
|
|
||||||
|
|
||||||
]]></extra-code>
|
]]></extra-code>
|
||||||
|
|
||||||
<track>
|
<track>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product" />
|
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product" />
|
||||||
<decimal name="qty" title="Quantity"/>
|
<decimal name="qty" title="Quantity"/>
|
||||||
|
<many-to-one name="unit" ref="com.axelor.apps.base.db.Unit" title="mass" />
|
||||||
|
|
||||||
<many-to-one name="workCenter" ref="com.axelor.apps.production.db.WorkCenter" title="Work center" initParam="true"/>
|
<many-to-one name="workCenter" ref="com.axelor.apps.production.db.WorkCenter" title="Work center" initParam="true"/>
|
||||||
<many-to-one name="machineWorkCenter" ref="com.axelor.apps.production.db.WorkCenter" title="Machine" initParam="true"/>
|
<many-to-one name="machineWorkCenter" ref="com.axelor.apps.production.db.WorkCenter" title="Machine" initParam="true"/>
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
<integer name="stockMoveRealizeOrderSelect" default="1" massUpdate="true"
|
<integer name="stockMoveRealizeOrderSelect" default="1" massUpdate="true"
|
||||||
selection="production.manuf.order.stock.move.realize.order.select"/>
|
selection="production.manuf.order.stock.move.realize.order.select"/>
|
||||||
|
|
||||||
|
<integer name="typeSelect" title="ProdProcess type" selection="production.prod.process.type.select" default="1"/>
|
||||||
|
|
||||||
|
<finder-method name="findByProductAndTypeSelect" using="product,typeSelect" all="true"/>
|
||||||
|
|
||||||
|
|
||||||
<extra-code><![CDATA[
|
<extra-code><![CDATA[
|
||||||
|
|
||||||
// STATUS SELECT
|
// STATUS SELECT
|
||||||
@@ -39,6 +44,9 @@
|
|||||||
public static final int STATUS_APPLICABLE = 3;
|
public static final int STATUS_APPLICABLE = 3;
|
||||||
public static final int STATUS_OBSOLETE = 4;
|
public static final int STATUS_OBSOLETE = 4;
|
||||||
|
|
||||||
|
public static final int MANUF_TYPE_SELECT = 1;
|
||||||
|
public static final int PACKAGING_TYPE_SELECT = 2;
|
||||||
|
|
||||||
]]></extra-code>
|
]]></extra-code>
|
||||||
|
|
||||||
<track>
|
<track>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<one-to-many name="objectDescriptionList" ref="com.axelor.apps.production.db.ObjectDescription" mappedBy="prodProcessLine" title="Descriptions"/>
|
<one-to-many name="objectDescriptionList" ref="com.axelor.apps.production.db.ObjectDescription" mappedBy="prodProcessLine" title="Descriptions"/>
|
||||||
|
|
||||||
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product" />
|
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product" />
|
||||||
|
<many-to-one name="unit" ref="com.axelor.apps.base.db.Unit" title="Unit" />
|
||||||
<decimal name="qty" title="Quantity"/>
|
<decimal name="qty" title="Quantity"/>
|
||||||
|
|
||||||
<track>
|
<track>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<integer name="stockMoveRealizeOrderSelect" default="1"
|
<integer name="stockMoveRealizeOrderSelect" default="1"
|
||||||
selection="production.manuf.order.stock.move.realize.order.select"/>
|
selection="production.manuf.order.stock.move.realize.order.select"/>
|
||||||
<many-to-one name="manufOrderSequence" title="Default sequence" ref="com.axelor.apps.base.db.Sequence"/>
|
<many-to-one name="manufOrderSequence" title="Default sequence" ref="com.axelor.apps.base.db.Sequence"/>
|
||||||
|
<many-to-one name="packagingOrderSequence" title="Packaging order sequence" ref="com.axelor.apps.base.db.Sequence"/>
|
||||||
<one-to-many name="workshopSequenceConfigLineList" title="Sequence by workshop" mappedBy="productionConfig" ref="com.axelor.apps.production.db.WorkshopSequenceConfigLine"/>
|
<one-to-many name="workshopSequenceConfigLineList" title="Sequence by workshop" mappedBy="productionConfig" ref="com.axelor.apps.production.db.WorkshopSequenceConfigLine"/>
|
||||||
<boolean name="finishMoAutomaticEmail" title="Send email when manufacturing order finished" default="false"/>
|
<boolean name="finishMoAutomaticEmail" title="Send email when manufacturing order finished" default="false"/>
|
||||||
<many-to-one name="finishMoMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>
|
<many-to-one name="finishMoMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>
|
||||||
|
|||||||
@@ -14,6 +14,11 @@
|
|||||||
<many-to-one name="saleOrder" ref="com.axelor.apps.sale.db.SaleOrder" title="Sale order" />
|
<many-to-one name="saleOrder" ref="com.axelor.apps.sale.db.SaleOrder" title="Sale order" />
|
||||||
|
|
||||||
<one-to-many name="manufOrderList" ref="com.axelor.apps.production.db.ManufOrder" mappedBy="productionOrder" title="Manufacturing orders" orderBy="prioritySelect"/>
|
<one-to-many name="manufOrderList" ref="com.axelor.apps.production.db.ManufOrder" mappedBy="productionOrder" title="Manufacturing orders" orderBy="prioritySelect"/>
|
||||||
|
<one-to-many name="inStockMoveList" ref="com.axelor.apps.stock.db.StockMove" title="Stock moves in" mappedBy="inProductionOrder"/>
|
||||||
|
|
||||||
|
<string name="productionOrderSeqSelect" title="Production order Seq select" selection="production.order.sequence.select"/>
|
||||||
|
|
||||||
|
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product"/>
|
||||||
|
|
||||||
<boolean name="isClosed" >
|
<boolean name="isClosed" >
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|||||||
@@ -7,14 +7,18 @@
|
|||||||
|
|
||||||
<entity name="StockMove" lang="java">
|
<entity name="StockMove" lang="java">
|
||||||
|
|
||||||
<many-to-one name="inManufOrder" ref="com.axelor.apps.production.db.ManufOrder"/>
|
<many-to-one name="inProductionOrder" ref="com.axelor.apps.production.db.ProductionOrder"/>
|
||||||
|
<!-- <many-to-one name="inManufOrder" ref="com.axelor.apps.production.db.ManufOrder"/> -->
|
||||||
<many-to-one name="outManufOrder" ref="com.axelor.apps.production.db.ManufOrder"/>
|
<many-to-one name="outManufOrder" ref="com.axelor.apps.production.db.ManufOrder"/>
|
||||||
<many-to-one name="inOperationOrder" ref="com.axelor.apps.production.db.OperationOrder"/>
|
<many-to-one name="inOperationOrder" ref="com.axelor.apps.production.db.OperationOrder"/>
|
||||||
|
|
||||||
|
<boolean name="isValidatedProduction" title="Is validated production" />
|
||||||
|
|
||||||
<extra-code>
|
<extra-code>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
public static final String ORIGIN_MANUF_ORDER = "com.axelor.apps.production.db.ManufOrder";
|
public static final String ORIGIN_MANUF_ORDER = "com.axelor.apps.production.db.ManufOrder";
|
||||||
public static final String ORIGIN_OPERATION_ORDER = "com.axelor.apps.production.db.OperationOrder";
|
public static final String ORIGIN_OPERATION_ORDER = "com.axelor.apps.production.db.OperationOrder";
|
||||||
|
public static final String ORIGIN_PRODUCTION_ORDER = "com.axelor.apps.production.db.ProductionOrder";
|
||||||
]]>
|
]]>
|
||||||
</extra-code>
|
</extra-code>
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
<many-to-one name="consumedManufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manufacturing order"/>
|
<many-to-one name="consumedManufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manufacturing order"/>
|
||||||
<many-to-one name="producedManufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manufacturing order"/>
|
<many-to-one name="producedManufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manufacturing order"/>
|
||||||
|
<many-to-one name="returnedManufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manufacturing order"/>
|
||||||
|
<many-to-one name="transferedManufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manufacturing order"/>
|
||||||
|
<many-to-one name="productionOrder" ref="com.axelor.apps.production.db.ProductionOrder" title="Production order"/>
|
||||||
|
|
||||||
<many-to-one name="consumedOperationOrder" ref="com.axelor.apps.production.db.OperationOrder" title="Operation order"/>
|
<many-to-one name="consumedOperationOrder" ref="com.axelor.apps.production.db.OperationOrder" title="Operation order"/>
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ import com.axelor.apps.purchase.service.PurchaseRequestServiceImpl;
|
|||||||
import com.axelor.apps.purchase.service.app.AppPurchaseService;
|
import com.axelor.apps.purchase.service.app.AppPurchaseService;
|
||||||
import com.axelor.apps.purchase.service.app.AppPurchaseServiceImpl;
|
import com.axelor.apps.purchase.service.app.AppPurchaseServiceImpl;
|
||||||
import com.axelor.apps.purchase.service.print.PurchaseOrderPrintService;
|
import com.axelor.apps.purchase.service.print.PurchaseOrderPrintService;
|
||||||
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintService;
|
|
||||||
import com.axelor.apps.purchase.service.print.PurchaseOrderPrintServiceImpl;
|
import com.axelor.apps.purchase.service.print.PurchaseOrderPrintServiceImpl;
|
||||||
|
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintService;
|
||||||
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintServiceImpl;
|
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintServiceImpl;
|
||||||
|
|
||||||
public class PurchaseModule extends AxelorModule {
|
public class PurchaseModule extends AxelorModule {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user