First commit (wating to add alerts in budget)
This commit is contained in:
@@ -797,4 +797,8 @@ public interface IExceptionMessage {
|
||||
|
||||
static final String CLOSE_NO_REPORTED_BALANCE_DATE = /*$$(*/
|
||||
"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;
|
||||
|
||||
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.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -7,75 +23,128 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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 {
|
||||
|
||||
@Transactional
|
||||
public void initThetoricalSoldeInWords(CashInventory cashInventory) {
|
||||
CashInventoryRepository cashInventoryRepository = Beans.get(CashInventoryRepository.class);
|
||||
CashInventory lastCashInventory = cashInventoryRepository.all().order("-createdOn").fetchOne();
|
||||
BigDecimal theoricalSolde = BigDecimal.ZERO;
|
||||
if(lastCashInventory == null){
|
||||
theoricalSolde = BigDecimal.ZERO;
|
||||
}else{
|
||||
theoricalSolde = lastCashInventory.getTheoricalSolde();
|
||||
}
|
||||
cashInventory.setTheoricalSolde(theoricalSolde);
|
||||
cashInventory.setRealDate(LocalDateTime.now());
|
||||
cashInventoryRepository.save(cashInventory);
|
||||
private SequenceService sequenceService;
|
||||
|
||||
@Inject
|
||||
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;
|
||||
if (cashRegister == null) {
|
||||
theoricalSolde = BigDecimal.ZERO;
|
||||
} else {
|
||||
theoricalSolde = cashRegister.getTheoricalSolde();
|
||||
}
|
||||
return theoricalSolde;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
HashMap<String, BigDecimal> map = new HashMap<>();
|
||||
|
||||
List<CashInventoryLine> cashInventoryLines = cashInventory.getCashInventoryLines();
|
||||
|
||||
BigDecimal theoricalSolde = cashInventory.getTheoricalSolde();
|
||||
|
||||
BigDecimal totalBankNotes = BigDecimal.ZERO;
|
||||
BigDecimal totalCoins = BigDecimal.ZERO;
|
||||
BigDecimal physicalSolde = BigDecimal.ZERO;
|
||||
BigDecimal gap = BigDecimal.ZERO;
|
||||
|
||||
for (CashInventoryLine cashInventoryLine : cashInventoryLines) {
|
||||
switch (cashInventoryLine.getCashDenomination().getTypeSelect()) {
|
||||
case CashDenominationRepository.BANK_NOTE_TYPE:
|
||||
totalBankNotes = totalBankNotes.add(cashInventoryLine.getTotalCashCount());
|
||||
break;
|
||||
case CashDenominationRepository.COINT_TYPE:
|
||||
totalCoins = totalCoins.add(cashInventoryLine.getTotalCashCount());
|
||||
break;
|
||||
|
||||
default:
|
||||
totalBankNotes = BigDecimal.ZERO;
|
||||
totalCoins = BigDecimal.ZERO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
physicalSolde = physicalSolde.add(totalBankNotes).add(totalCoins);
|
||||
gap = physicalSolde.subtract(theoricalSolde);
|
||||
|
||||
public Map<String, BigDecimal> computeToTals(CashInventory cashInventory){
|
||||
map.put("totalCoinsAmount", totalCoins);
|
||||
map.put("totalBankNotesAmount", totalBankNotes);
|
||||
map.put("totalCash", totalBankNotes);
|
||||
map.put("physicalSolde", physicalSolde);
|
||||
map.put("gap", gap);
|
||||
|
||||
HashMap<String, BigDecimal> map = new HashMap<>();
|
||||
return map;
|
||||
}
|
||||
|
||||
List<CashInventoryLine> cashInventoryLines = cashInventory.getCashInventoryLines();
|
||||
|
||||
BigDecimal theoricalSolde = cashInventory.getTheoricalSolde();
|
||||
public String getCashInventorySequence(CashInventory cashInventory) throws AxelorException {
|
||||
Integer operationTypeSelect = cashInventory.getOperationTypeSelect();
|
||||
Company company = cashInventory.getCompany();
|
||||
String sequence = null;
|
||||
|
||||
BigDecimal totalBankNotes = BigDecimal.ZERO;
|
||||
BigDecimal totalCoins = BigDecimal.ZERO;
|
||||
BigDecimal physicalSolde = BigDecimal.ZERO;
|
||||
BigDecimal gap = BigDecimal.ZERO;
|
||||
|
||||
for (CashInventoryLine cashInventoryLine : cashInventoryLines) {
|
||||
switch (cashInventoryLine.getCashDenomination().getTypeSelect()) {
|
||||
case CashDenominationRepository.BANK_NOTE_TYPE:
|
||||
totalBankNotes = totalBankNotes.add(cashInventoryLine.getTotalCashCount());
|
||||
break;
|
||||
case CashDenominationRepository.COINT_TYPE:
|
||||
totalCoins = totalCoins.add(cashInventoryLine.getTotalCashCount());
|
||||
break;
|
||||
|
||||
default:
|
||||
totalBankNotes = BigDecimal.ZERO;
|
||||
totalCoins = BigDecimal.ZERO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
physicalSolde = physicalSolde.add(totalBankNotes).add(totalCoins);
|
||||
gap = physicalSolde.subtract(theoricalSolde);
|
||||
|
||||
map.put("totalCoinsAmount", totalCoins);
|
||||
map.put("totalBankNotesAmount", totalBankNotes);
|
||||
map.put("totalCash", totalBankNotes);
|
||||
map.put("physicalSolde", physicalSolde);
|
||||
map.put("gap", gap);
|
||||
|
||||
return map;
|
||||
|
||||
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;
|
||||
|
||||
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.InvoiceLine;
|
||||
import com.axelor.apps.account.db.InvoiceTemplate;
|
||||
@@ -16,21 +10,22 @@ import com.axelor.apps.account.service.invoice.generator.InvoiceLineGenerator;
|
||||
import com.axelor.apps.base.db.Company;
|
||||
import com.axelor.apps.base.db.Partner;
|
||||
import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.service.app.AppBaseService;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InvoiceTemplateService {
|
||||
|
||||
@Transactional
|
||||
public Invoice generateInvoiceFromTemplate(InvoiceTemplate invoiceTemplate) throws AxelorException {
|
||||
public Invoice generateInvoiceFromTemplate(InvoiceTemplate invoiceTemplate)
|
||||
throws AxelorException {
|
||||
|
||||
Partner partner = invoiceTemplate.getPartner();
|
||||
Company company = invoiceTemplate.getCompany();
|
||||
InvoiceGenerator invoiceGenerator =
|
||||
InvoiceGenerator invoiceGenerator =
|
||||
new InvoiceGenerator(
|
||||
InvoiceRepository.OPERATION_TYPE_SUPPLIER_PURCHASE,
|
||||
company,
|
||||
@@ -56,26 +51,23 @@ public class InvoiceTemplateService {
|
||||
|
||||
List<InvoiceLine> invoiceLineList = new ArrayList<>();
|
||||
|
||||
|
||||
Invoice invoice = invoiceGenerator.generate();
|
||||
|
||||
int priority = 0;
|
||||
for (InvoiceTemplateLine invoiceTemplateLine : invoiceTemplate.getMoveTemplateLineList()) {
|
||||
invoiceLineList.addAll(createInvoiceLine(invoice, invoiceTemplateLine, priority));
|
||||
priority++;
|
||||
invoiceLineList.addAll(createInvoiceLine(invoice, invoiceTemplateLine, priority));
|
||||
priority++;
|
||||
}
|
||||
invoiceGenerator.populate(invoice, invoiceLineList);
|
||||
|
||||
Invoice returnInvoiced = Beans.get(InvoiceRepository.class).save(invoice);
|
||||
|
||||
return returnInvoiced;
|
||||
|
||||
Invoice returnInvoiced = Beans.get(InvoiceRepository.class).save(invoice);
|
||||
|
||||
return returnInvoiced;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected List<InvoiceLine> createInvoiceLine(
|
||||
Invoice invoice, InvoiceTemplateLine invoiceTemplateLine, int priority) throws AxelorException {
|
||||
protected List<InvoiceLine> createInvoiceLine(
|
||||
Invoice invoice, InvoiceTemplateLine invoiceTemplateLine, int priority)
|
||||
throws AxelorException {
|
||||
|
||||
Product product = invoiceTemplateLine.getProduct();
|
||||
|
||||
@@ -117,7 +109,4 @@ public class InvoiceTemplateService {
|
||||
|
||||
return invoiceLineGenerator.creates();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ public interface ReconcileService {
|
||||
public Reconcile confirmReconcile(Reconcile reconcile, boolean updateInvoicePayments)
|
||||
throws AxelorException;
|
||||
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public Reconcile confirmPaymentVoucherReconcile(
|
||||
Reconcile reconcile, boolean updateInvoicePayments) throws AxelorException;
|
||||
|
||||
public void reconcilePreconditions(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);
|
||||
}
|
||||
|
||||
@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 {
|
||||
Move debitMove = reconcile.getDebitMoveLine().getMove();
|
||||
Move creditMove = reconcile.getCreditMoveLine().getMove();
|
||||
@@ -556,4 +580,41 @@ public class ReconcileServiceImpl implements ReconcileService {
|
||||
}
|
||||
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++,
|
||||
origin,
|
||||
invoiceLine.getProductName());
|
||||
|
||||
moveLine.setAnalyticDistributionTemplate(invoiceLine.getAnalyticDistributionTemplate());
|
||||
if(invoiceLine.getAnalyticDistributionTemplate() != null)
|
||||
moveLine.setAnalyticDistributionTemplate(invoiceLine.getAnalyticDistributionTemplate());
|
||||
if (invoiceLine.getAnalyticMoveLineList() != null
|
||||
&& !invoiceLine.getAnalyticMoveLineList().isEmpty()) {
|
||||
for (AnalyticMoveLine invoiceAnalyticMoveLine : invoiceLine.getAnalyticMoveLineList()) {
|
||||
System.out.println("-----------------invoiceAnalyticMoveLine.getAccount().getName()----------------------------");
|
||||
System.out.println(invoiceAnalyticMoveLine.getAccount());
|
||||
AnalyticMoveLine analyticMoveLine =
|
||||
analyticMoveLineRepository.copy(invoiceAnalyticMoveLine, false);
|
||||
analyticMoveLine.setTypeSelect(AnalyticMoveLineRepository.STATUS_REAL_ACCOUNTING);
|
||||
|
||||
@@ -185,11 +185,20 @@ public class MoveServiceImpl implements MoveService {
|
||||
isPurchase,
|
||||
isDebitCustomer));
|
||||
|
||||
log.debug("Saving account move..............");
|
||||
|
||||
moveRepository.save(move);
|
||||
|
||||
log.debug("saved account move..............");
|
||||
|
||||
|
||||
invoice.setMove(move);
|
||||
|
||||
invoice.setCompanyInTaxTotalRemaining(moveToolService.getInTaxTotalRemaining(invoice));
|
||||
|
||||
log.debug("loading account move.............. {}",move);
|
||||
|
||||
|
||||
moveValidateService.validate(move);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,9 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
log.debug(
|
||||
"Emploie du trop perçu : ligne en crédit (restant à payer): {})",
|
||||
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) {
|
||||
|
||||
@@ -136,7 +138,9 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
log.debug(
|
||||
"Emploie du trop perçu : ligne en débit (restant à payer): {})",
|
||||
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) {
|
||||
@@ -148,7 +152,10 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
&& (creditMoveLine.getAmountRemaining().compareTo(BigDecimal.ZERO) == 1)) {
|
||||
try {
|
||||
createReconcile(
|
||||
debitMoveLine, creditMoveLine, debitTotalRemaining.setScale(4), creditTotalRemaining.setScale(4));
|
||||
debitMoveLine,
|
||||
creditMoveLine,
|
||||
debitTotalRemaining.setScale(4),
|
||||
creditTotalRemaining.setScale(4));
|
||||
} catch (Exception e) {
|
||||
if (dontThrow) {
|
||||
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.AccountConfig;
|
||||
import com.axelor.apps.account.db.CashRegister;
|
||||
import com.axelor.apps.account.db.Invoice;
|
||||
import com.axelor.apps.account.db.Journal;
|
||||
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.PaymentVoucher;
|
||||
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.MoveRepository;
|
||||
import com.axelor.apps.account.db.repo.PayVoucherElementToPayRepository;
|
||||
import com.axelor.apps.account.db.repo.PaymentVoucherRepository;
|
||||
import com.axelor.apps.account.exception.IExceptionMessage;
|
||||
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.app.AppAccountService;
|
||||
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.Company;
|
||||
import com.axelor.apps.base.db.Partner;
|
||||
import com.axelor.apps.purchase.db.PurchaseOrder;
|
||||
import com.axelor.auth.AuthUtils;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||
@@ -66,7 +64,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -131,26 +128,25 @@ public class PaymentVoucherConfirmService {
|
||||
Company company = paymentVoucher.getCompany();
|
||||
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
||||
Journal journal;
|
||||
|
||||
|
||||
if (paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) {
|
||||
if(paymentVoucher.getPartner().getAccountingManagementList().size() == 0){
|
||||
|
||||
if (paymentVoucher.getPaymentMode().getId() == 12
|
||||
|| paymentVoucher.getPaymentMode().getId() == 23) {
|
||||
if (paymentVoucher.getPartner().getAccountingManagementList().size() == 0) {
|
||||
throw new AxelorException(
|
||||
paymentVoucher,
|
||||
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||
I18n.get("Journal manquant !!"),
|
||||
I18n.get(com.axelor.apps.base.exceptions.IExceptionMessage.EXCEPTION));
|
||||
}else{
|
||||
paymentVoucher,
|
||||
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||
I18n.get("Journal manquant !!"),
|
||||
I18n.get(com.axelor.apps.base.exceptions.IExceptionMessage.EXCEPTION));
|
||||
} else {
|
||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||
}
|
||||
}else{
|
||||
journal =
|
||||
paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||
} else {
|
||||
journal = paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||
Account paymentModeAccount =
|
||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||
|
||||
paymentVoucherControlService.checkPaymentVoucherField(
|
||||
paymentVoucher, company, paymentModeAccount, journal);
|
||||
paymentVoucherControlService.checkPaymentVoucherField(
|
||||
paymentVoucher, company, paymentModeAccount, journal);
|
||||
}
|
||||
|
||||
if (paymentVoucher.getRemainingAmount().compareTo(BigDecimal.ZERO) > 0
|
||||
@@ -176,7 +172,9 @@ public class PaymentVoucherConfirmService {
|
||||
if (!isConfirmed && paymentVoucher.getGeneratedMoveList().size() == 0) {
|
||||
createMoveAndConfirm(paymentVoucher);
|
||||
}
|
||||
if ((paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) && isConfirmed) {
|
||||
if ((paymentVoucher.getPaymentMode().getId() == 12
|
||||
|| paymentVoucher.getPaymentMode().getId() == 23)
|
||||
&& isConfirmed) {
|
||||
confirmBankMove(paymentVoucher);
|
||||
}
|
||||
}
|
||||
@@ -210,22 +208,22 @@ public class PaymentVoucherConfirmService {
|
||||
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
||||
Company company = paymentVoucher.getCompany();
|
||||
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
||||
Journal journal;
|
||||
Journal journal;
|
||||
// LocalDate paymentDate = paymentVoucher.getPaymentDate();
|
||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||
|
||||
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 =
|
||||
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||
}else{
|
||||
journal =
|
||||
paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||
paymentModeAccount =
|
||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||
} else {
|
||||
journal = paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||
paymentModeAccount =
|
||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||
}
|
||||
|
||||
// If paid by a moveline check if all the lines selected have the same account + company
|
||||
@@ -283,7 +281,7 @@ public class PaymentVoucherConfirmService {
|
||||
|
||||
MoveLine moveLineInvoices = null;
|
||||
|
||||
if(paymentVoucher.getOperationTypeSelect() == 6){
|
||||
if (paymentVoucher.getOperationTypeSelect() == 6) {
|
||||
|
||||
moveLineInvoices =
|
||||
moveLineService.createMoveLine(
|
||||
@@ -296,67 +294,65 @@ public class PaymentVoucherConfirmService {
|
||||
moveLineNo++,
|
||||
paymentVoucher.getRef(),
|
||||
null);
|
||||
paidLineTotal = paymentVoucher.getPaidAmount();
|
||||
paidLineTotal = paymentVoucher.getPaidAmount();
|
||||
|
||||
move.getMoveLineList().add(moveLineInvoices);
|
||||
move.getMoveLineList().add(moveLineInvoices);
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
|
||||
for (PayVoucherElementToPay payVoucherElementToPay : payVoucherElementToPayList) {
|
||||
MoveLine moveLineToPay = payVoucherElementToPay.getMoveLine();
|
||||
log.debug("PV moveLineToPay debit : {}", moveLineToPay.getDebit());
|
||||
log.debug("PV moveLineToPay credit : {}", moveLineToPay.getCredit());
|
||||
log.debug("PV moveLineToPay amountPaid : {}", moveLineToPay.getAmountPaid());
|
||||
MoveLine moveLineToPay = payVoucherElementToPay.getMoveLine();
|
||||
log.debug("PV moveLineToPay debit : {}", moveLineToPay.getDebit());
|
||||
log.debug("PV moveLineToPay credit : {}", moveLineToPay.getCredit());
|
||||
log.debug("PV moveLineToPay amountPaid : {}", moveLineToPay.getAmountPaid());
|
||||
|
||||
BigDecimal amountToPay = payVoucherElementToPay.getAmountToPayCurrency();
|
||||
log.debug(">>>> PV amountToPay : {}", amountToPay);
|
||||
BigDecimal amountToPay = payVoucherElementToPay.getAmountToPayCurrency();
|
||||
log.debug(">>>> PV amountToPay : {}", amountToPay);
|
||||
|
||||
Invoice invoice = payVoucherElementToPay.getMoveLine().getMove().getInvoice();
|
||||
isDebitToPay = paymentVoucherToolService.isDebitToPay(invoice);
|
||||
Invoice invoice = payVoucherElementToPay.getMoveLine().getMove().getInvoice();
|
||||
isDebitToPay = paymentVoucherToolService.isDebitToPay(invoice);
|
||||
|
||||
boolean isRefundInvoice = false;
|
||||
if (invoice.getOperationTypeSelect()
|
||||
== InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND) {
|
||||
isRefundInvoice = true;
|
||||
}
|
||||
|
||||
log.debug("heyyyyyyyyyyyyyyyyy : {}", isRefundInvoice);
|
||||
|
||||
if (amountToPay.compareTo(BigDecimal.ZERO) > 0 || isRefundInvoice) {
|
||||
|
||||
if (isRefundInvoice
|
||||
// || paymentVoucher.getOperationTypeSelect()
|
||||
// == PaymentVoucherRepository.OPERATION_TYPE_CLIENT_SALE_CLIENT_REFUND
|
||||
// || paymentVoucher.getOperationTypeSelect()
|
||||
// == PaymentVoucherRepository.OPERATION_TYPE_SUPPLIER_PURCHASE_SUPPLIER_REFUND
|
||||
) {
|
||||
amountToPay = payVoucherElementToPay.getTotalAmount();
|
||||
log.debug(
|
||||
"**** getInvoiceId {} *** isDebitToPay {} **** amountToPay {}",
|
||||
invoice.getInvoiceId(),
|
||||
isDebitToPay,
|
||||
amountToPay);
|
||||
boolean isRefundInvoice = false;
|
||||
if (invoice.getOperationTypeSelect() == InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND) {
|
||||
isRefundInvoice = true;
|
||||
}
|
||||
|
||||
paidLineTotal = paidLineTotal.add(amountToPay);
|
||||
log.debug("heyyyyyyyyyyyyyyyyy : {}", isRefundInvoice);
|
||||
|
||||
log.debug("amountToPay >>>>>>>>>>> {}", amountToPay);
|
||||
if (amountToPay.compareTo(BigDecimal.ZERO) > 0 || isRefundInvoice) {
|
||||
|
||||
this.payMoveLine(
|
||||
move,
|
||||
moveLineNo++,
|
||||
payerPartner,
|
||||
moveLineToPay,
|
||||
amountToPay,
|
||||
amountToPay,
|
||||
// isRefundInvoice ? amountToPay : payVoucherElementToPay.getAmountToPayCurrency(),
|
||||
payVoucherElementToPay,
|
||||
isDebitToPay,
|
||||
paymentDate);
|
||||
if (isRefundInvoice
|
||||
// || paymentVoucher.getOperationTypeSelect()
|
||||
// == PaymentVoucherRepository.OPERATION_TYPE_CLIENT_SALE_CLIENT_REFUND
|
||||
// || paymentVoucher.getOperationTypeSelect()
|
||||
// == PaymentVoucherRepository.OPERATION_TYPE_SUPPLIER_PURCHASE_SUPPLIER_REFUND
|
||||
) {
|
||||
amountToPay = payVoucherElementToPay.getTotalAmount();
|
||||
log.debug(
|
||||
"**** getInvoiceId {} *** isDebitToPay {} **** amountToPay {}",
|
||||
invoice.getInvoiceId(),
|
||||
isDebitToPay,
|
||||
amountToPay);
|
||||
}
|
||||
|
||||
paidLineTotal = paidLineTotal.add(amountToPay);
|
||||
|
||||
log.debug("amountToPay >>>>>>>>>>> {}", amountToPay);
|
||||
|
||||
this.payMoveLine(
|
||||
move,
|
||||
moveLineNo++,
|
||||
payerPartner,
|
||||
moveLineToPay,
|
||||
amountToPay,
|
||||
amountToPay,
|
||||
// isRefundInvoice ? amountToPay : payVoucherElementToPay.getAmountToPayCurrency(),
|
||||
payVoucherElementToPay,
|
||||
isDebitToPay,
|
||||
paymentDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create move line for the payment amount
|
||||
MoveLine moveLine = null;
|
||||
isDebitToPay = paymentVoucherToolService.isDebitToPay(paymentVoucher);
|
||||
@@ -477,9 +473,9 @@ public class PaymentVoucherConfirmService {
|
||||
// LocalDate paymentDate = paymentVoucher.getPaymentDate();
|
||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||
LocalDate paymentDateEchance = paymentVoucher.getDueDate();
|
||||
|
||||
if(paymentVoucher.getSort() == 3){
|
||||
paymentDateEchance = paymentVoucher.getCreditDate();
|
||||
|
||||
if (paymentVoucher.getSort() == 3) {
|
||||
paymentDateEchance = paymentVoucher.getCreditDate();
|
||||
}
|
||||
|
||||
boolean scheduleToBePaid = false;
|
||||
@@ -556,9 +552,9 @@ public class PaymentVoucherConfirmService {
|
||||
// LocalDate paymentDate = paymentVoucher.getPaymentDate();
|
||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||
LocalDate paymentDateEchance = paymentVoucher.getDueDate();
|
||||
|
||||
if(paymentVoucher.getSort() == 3){
|
||||
paymentDateEchance = paymentVoucher.getCreditDate();
|
||||
|
||||
if (paymentVoucher.getSort() == 3) {
|
||||
paymentDateEchance = paymentVoucher.getCreditDate();
|
||||
}
|
||||
|
||||
boolean scheduleToBePaid = false;
|
||||
@@ -576,7 +572,7 @@ public class PaymentVoucherConfirmService {
|
||||
paymentDate,
|
||||
paymentMode,
|
||||
MoveRepository.TECHNICAL_ORIGIN_AUTOMATIC);
|
||||
|
||||
|
||||
move.setPaymentVoucher(paymentVoucher);
|
||||
|
||||
List<? extends PayVoucherElementToPay> payVoucherElementToPayList =
|
||||
@@ -586,15 +582,20 @@ public class PaymentVoucherConfirmService {
|
||||
|
||||
Account accountToPay = null;
|
||||
|
||||
if(paymentModeAccount.getIsOriginRequired()){
|
||||
if (paymentModeAccount.getIsOriginRequired()) {
|
||||
MoveLine moveLineToPay = payVoucherElementToPayList.get(0).getMoveLine();
|
||||
|
||||
if(moveLineToPay.getCredit().compareTo(BigDecimal.ZERO) > 0){
|
||||
|
||||
if (moveLineToPay.getCredit().compareTo(BigDecimal.ZERO) > 0) {
|
||||
isDebitToPay = true;
|
||||
}
|
||||
accountToPay = moveLineToPay.getAccount();
|
||||
}else{
|
||||
accountToPay = paymentVoucher.getPartner().getAccountingSituationList().get(0).getPartnerPaymentAccount();
|
||||
} else {
|
||||
accountToPay =
|
||||
paymentVoucher
|
||||
.getPartner()
|
||||
.getAccountingSituationList()
|
||||
.get(0)
|
||||
.getPartnerPaymentAccount();
|
||||
}
|
||||
|
||||
BigDecimal paidAmount = paymentVoucher.getPaidAmount();
|
||||
@@ -631,14 +632,18 @@ public class PaymentVoucherConfirmService {
|
||||
moveService.getMoveValidateService().validate(move);
|
||||
paymentVoucher.setGeneratedMove(move);
|
||||
paymentVoucher.addGeneratedMoveListItem(move);
|
||||
paymentVoucher.setConfirmationDate(LocalDate.now());
|
||||
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||
|
||||
if (isDebitToPay) {
|
||||
reconcileService.balanceCredit(moveLine);
|
||||
}
|
||||
if(paymentVoucher.getPartner().getId() == 2040L){
|
||||
this.updateCashRegisterTheoricalSolde(paymentVoucher, isDebitToPay,paidAmount);
|
||||
}
|
||||
// Beans.get(PaymentVoucherLoadService.class).updateVoucher(paymentVoucher);
|
||||
}
|
||||
|
||||
|
||||
public void deleteUnPaidLines(PaymentVoucher paymentVoucher) {
|
||||
|
||||
if (paymentVoucher.getPayVoucherElementToPayList() == null) {
|
||||
@@ -750,13 +755,13 @@ public class PaymentVoucherConfirmService {
|
||||
|
||||
BigDecimal amountInCompanyCurrency = moveLine.getDebit().add(moveLine.getCredit());
|
||||
|
||||
Reconcile reconcile =
|
||||
reconcileService.createReconcile(moveLineToPay, moveLine, amountToPayReel, true);
|
||||
reconciles.add(reconcile);
|
||||
if (reconcile != null) {
|
||||
log.debug("Reconcile : : : {}", reconcile);
|
||||
reconcileService.confirmReconcile(reconcile, true);
|
||||
}
|
||||
// Reconcile reconcile =
|
||||
// reconcileService.createReconcile(moveLineToPay, moveLine, amountToPayReel, true);
|
||||
// reconciles.add(reconcile);
|
||||
// if (reconcile != null) {
|
||||
// log.debug("Reconcile : : : {}", reconcile);
|
||||
// reconcileService.confirmPaymentVoucherReconcile(reconcile, true);
|
||||
// // }
|
||||
return moveLine;
|
||||
}
|
||||
|
||||
@@ -865,7 +870,9 @@ public class PaymentVoucherConfirmService {
|
||||
log.debug("Rejecting move : : : {} **********", move);
|
||||
|
||||
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);
|
||||
// moveCancelService.cancel(move);
|
||||
} catch (AxelorException e) {
|
||||
@@ -880,119 +887,128 @@ public class PaymentVoucherConfirmService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public Move confirmMultipleVoucher(List<PaymentVoucher> voucherList, List<PayVoucherElementToPay> elementToPays, boolean b) throws AxelorException {
|
||||
if(voucherList != null && voucherList.size() > 0 ){
|
||||
if(!samePaymentVoucherSelect(voucherList) || voucherAlreadyInMove(voucherList)){
|
||||
throw new AxelorException(
|
||||
public Move confirmMultipleVoucher(
|
||||
List<PaymentVoucher> voucherList, List<PayVoucherElementToPay> elementToPays, boolean b)
|
||||
throws AxelorException {
|
||||
if (voucherList != null && voucherList.size() > 0) {
|
||||
if (!samePaymentVoucherSelect(voucherList) || voucherAlreadyInMove(voucherList)) {
|
||||
throw new AxelorException(
|
||||
voucherList.get(0),
|
||||
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||
"Not the same operation type"
|
||||
);
|
||||
"Not the same operation type");
|
||||
}
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
totalAmount = voucherList.stream().map(PaymentVoucher::getPaidAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
totalAmount =
|
||||
voucherList
|
||||
.stream()
|
||||
.map(PaymentVoucher::getPaidAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
PaymentVoucher paymentVoucher = voucherList.get(0);
|
||||
Partner payerPartner = paymentVoucher.getPartner();
|
||||
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
||||
Company company = paymentVoucher.getCompany();
|
||||
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
||||
Journal journal = paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||
PaymentVoucher paymentVoucher = voucherList.get(0);
|
||||
Partner payerPartner = paymentVoucher.getPartner();
|
||||
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
||||
Company company = paymentVoucher.getCompany();
|
||||
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
|
||||
Journal journal =
|
||||
paymentModeService.getPaymentModeJournal(paymentMode, company, companyBankDetails);
|
||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||
|
||||
Account paymentModeAccount =
|
||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||
Account paymentModeAccount =
|
||||
paymentModeService.getPaymentModeAccount(paymentMode, company, companyBankDetails);
|
||||
|
||||
if (paymentVoucher.getPaymentMode().getId() == 12 || paymentVoucher.getPaymentMode().getId() == 23) {
|
||||
paymentModeAccount =
|
||||
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||
}
|
||||
if (paymentVoucher.getPaymentMode().getId() == 12
|
||||
|| paymentVoucher.getPaymentMode().getId() == 23) {
|
||||
paymentModeAccount =
|
||||
paymentVoucher.getPartner().getAccountingManagementList().get(0).getCashAccount();
|
||||
journal = paymentVoucher.getPartner().getAccountingManagementList().get(0).getJournal();
|
||||
}
|
||||
|
||||
Move move =
|
||||
moveService
|
||||
.getMoveCreateService()
|
||||
.createMoveWithPaymentVoucher(
|
||||
journal,
|
||||
company,
|
||||
paymentVoucher,
|
||||
payerPartner,
|
||||
paymentDate,
|
||||
paymentMode,
|
||||
MoveRepository.TECHNICAL_ORIGIN_AUTOMATIC);
|
||||
Move move =
|
||||
moveService
|
||||
.getMoveCreateService()
|
||||
.createMoveWithPaymentVoucher(
|
||||
journal,
|
||||
company,
|
||||
paymentVoucher,
|
||||
payerPartner,
|
||||
paymentDate,
|
||||
paymentMode,
|
||||
MoveRepository.TECHNICAL_ORIGIN_AUTOMATIC);
|
||||
|
||||
// move.addPaymentVoucherListItem(paymentVoucher);
|
||||
// paymentVoucher.setGeneratedMove(move);
|
||||
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||
paymentVoucher.setConfirmationDate(LocalDate.now());
|
||||
|
||||
// move.addPaymentVoucherListItem(paymentVoucher);
|
||||
// paymentVoucher.setGeneratedMove(move);
|
||||
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||
paymentVoucher.setConfirmationDate(LocalDate.now());
|
||||
boolean isDebitToPay = paymentVoucherToolService.isDebitToPay(paymentVoucher);
|
||||
int moveLineNo = 0;
|
||||
|
||||
boolean isDebitToPay = paymentVoucherToolService.isDebitToPay(paymentVoucher);
|
||||
int moveLineNo = 0;
|
||||
MoveLine moveLineAll =
|
||||
moveLineService.createMoveLine(
|
||||
move,
|
||||
payerPartner,
|
||||
paymentModeAccount,
|
||||
totalAmount,
|
||||
isDebitToPay,
|
||||
paymentDate,
|
||||
moveLineNo++,
|
||||
paymentVoucher.getRef(),
|
||||
null);
|
||||
move.getMoveLineList().add(moveLineAll);
|
||||
|
||||
MoveLine moveLineAll =
|
||||
moveLineService.createMoveLine(
|
||||
move,
|
||||
payerPartner,
|
||||
paymentModeAccount,
|
||||
totalAmount,
|
||||
isDebitToPay,
|
||||
paymentDate,
|
||||
moveLineNo++,
|
||||
paymentVoucher.getRef(),
|
||||
null);
|
||||
move.getMoveLineList().add(moveLineAll);
|
||||
Set<Long> paymentVoucherIds = new HashSet<Long>();
|
||||
|
||||
Set<Long> paymentVoucherIds = new HashSet<Long>();
|
||||
|
||||
for (PayVoucherElementToPay voucherElementToPay : elementToPays) {
|
||||
MoveLine line = moveLineService.createMoveLine(
|
||||
move,
|
||||
payerPartner,
|
||||
voucherElementToPay.getMoveLine().getAccount(),
|
||||
voucherElementToPay.getAmountToPay(),
|
||||
!isDebitToPay,
|
||||
paymentDate,
|
||||
moveLineNo++,
|
||||
voucherElementToPay.getPaymentVoucher().getRef(),
|
||||
null);
|
||||
move.addMoveLineListItem(line);
|
||||
paymentVoucherIds.add(voucherElementToPay.getPaymentVoucher().getId());
|
||||
}
|
||||
for (Long voucherId : paymentVoucherIds) {
|
||||
PaymentVoucher voucher = Beans.get(PaymentVoucherRepository.class).find(voucherId);
|
||||
System.out.println(":::::::::::::::::::>");
|
||||
System.out.println(paymentVoucherIds);
|
||||
System.out.println(voucher.getGeneratedMoveList());
|
||||
System.out.println(":::::::::::::::::::>");
|
||||
move.addPaymentVoucherListItem(voucher);
|
||||
// voucher.addGeneratedMoveListItem(move);
|
||||
voucher.setConfirmedByUser(AuthUtils.getUser());
|
||||
voucher.setConfirmationDate(LocalDate.now());
|
||||
paymentVoucher.setStatusSelect(PaymentVoucherRepository.STATUS_CONFIRMED);
|
||||
}
|
||||
return move;
|
||||
for (PayVoucherElementToPay voucherElementToPay : elementToPays) {
|
||||
MoveLine line =
|
||||
moveLineService.createMoveLine(
|
||||
move,
|
||||
payerPartner,
|
||||
voucherElementToPay.getMoveLine().getAccount(),
|
||||
voucherElementToPay.getAmountToPay(),
|
||||
!isDebitToPay,
|
||||
paymentDate,
|
||||
moveLineNo++,
|
||||
voucherElementToPay.getPaymentVoucher().getRef(),
|
||||
null);
|
||||
move.addMoveLineListItem(line);
|
||||
paymentVoucherIds.add(voucherElementToPay.getPaymentVoucher().getId());
|
||||
}
|
||||
for (Long voucherId : paymentVoucherIds) {
|
||||
PaymentVoucher voucher = Beans.get(PaymentVoucherRepository.class).find(voucherId);
|
||||
System.out.println(":::::::::::::::::::>");
|
||||
System.out.println(paymentVoucherIds);
|
||||
System.out.println(voucher.getGeneratedMoveList());
|
||||
System.out.println(":::::::::::::::::::>");
|
||||
move.addPaymentVoucherListItem(voucher);
|
||||
// voucher.addGeneratedMoveListItem(move);
|
||||
voucher.setConfirmedByUser(AuthUtils.getUser());
|
||||
voucher.setConfirmationDate(LocalDate.now());
|
||||
paymentVoucher.setStatusSelect(PaymentVoucherRepository.STATUS_CONFIRMED);
|
||||
}
|
||||
return move;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean samePaymentVoucherSelect(List<PaymentVoucher> voucherList){
|
||||
Integer operationTypeSelect = voucherList.get(0).getOperationTypeSelect();
|
||||
BankDetails bankDetails = voucherList.get(0).getCompanyBankDetails();
|
||||
Partner partner = voucherList.get(0).getPartner();
|
||||
for (int index = 1; index < voucherList.size(); index++) {
|
||||
PaymentVoucher paymentVoucher = voucherList.get(index);
|
||||
if(paymentVoucher.getOperationTypeSelect() != operationTypeSelect || paymentVoucher.getPartner() != partner || paymentVoucher.getCompanyBankDetails() != bankDetails){
|
||||
return false;
|
||||
}
|
||||
public boolean samePaymentVoucherSelect(List<PaymentVoucher> voucherList) {
|
||||
Integer operationTypeSelect = voucherList.get(0).getOperationTypeSelect();
|
||||
BankDetails bankDetails = voucherList.get(0).getCompanyBankDetails();
|
||||
Partner partner = voucherList.get(0).getPartner();
|
||||
for (int index = 1; index < voucherList.size(); index++) {
|
||||
PaymentVoucher paymentVoucher = voucherList.get(index);
|
||||
if (paymentVoucher.getOperationTypeSelect() != operationTypeSelect
|
||||
|| paymentVoucher.getPartner() != partner
|
||||
|| paymentVoucher.getCompanyBankDetails() != bankDetails) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean voucherAlreadyInMove(List<PaymentVoucher> voucherList) {
|
||||
if(voucherList != null){
|
||||
if (voucherList != null) {
|
||||
for (PaymentVoucher voucher : voucherList) {
|
||||
if(voucher.getGeneratedMoveList().size() > 0){
|
||||
if (voucher.getGeneratedMoveList().size() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1000,11 +1016,20 @@ public class PaymentVoucherConfirmService {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Cash mvt
|
||||
|
||||
/**
|
||||
* Confirm cash payment voucher and create move.
|
||||
*
|
||||
* @param paymentVoucher
|
||||
* @throws AxelorException
|
||||
*/
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public void confirmCashPayment(PaymentVoucher paymentVoucher) throws AxelorException {
|
||||
if(paymentVoucher.getGeneratedMoveList().size() > 0){
|
||||
throw new AxelorException(
|
||||
TraceBackRepository.CATEGORY_INCONSISTENCY,
|
||||
"Already ventilated.");
|
||||
}
|
||||
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
|
||||
Company company = paymentVoucher.getCompany();
|
||||
AccountConfig accountConfig = Beans.get(AccountConfigService.class).getAccountConfig(company);
|
||||
@@ -1012,11 +1037,9 @@ public class PaymentVoucherConfirmService {
|
||||
Journal journal = accountConfig.getCashJournal();
|
||||
// LocalDate paymentDate = paymentVoucher.getPaymentDate();
|
||||
LocalDate paymentDate = paymentVoucher.getPaymentEmissionDate();
|
||||
|
||||
|
||||
|
||||
boolean scheduleToBePaid = false;
|
||||
Account paymentModeAccount = paymentVoucher.getPartner().getAccountingSituationList().get(0).getPartnerPaymentAccount();
|
||||
Account paymentModeAccount =
|
||||
paymentVoucher.getCashAccountConfig().getAccount();
|
||||
|
||||
Move move =
|
||||
moveService
|
||||
@@ -1034,15 +1057,10 @@ public class PaymentVoucherConfirmService {
|
||||
|
||||
Boolean isDebitToPay = false;
|
||||
|
||||
if(Integer.parseInt(paymentVoucher.getDebitCreditSelect()) == 1){
|
||||
if (Integer.parseInt(paymentVoucher.getDebitCreditSelect()) == 1) {
|
||||
isDebitToPay = true;
|
||||
}
|
||||
|
||||
System.out.println(paymentVoucher.getDebitCreditSelect().toString());
|
||||
System.out.println(isDebitToPay);
|
||||
System.out.println("*******************999*********");
|
||||
|
||||
|
||||
Account accountToPay = accountConfig.getCashAccount();
|
||||
|
||||
BigDecimal paidAmount = paymentVoucher.getPaidAmount();
|
||||
@@ -1059,7 +1077,7 @@ public class PaymentVoucherConfirmService {
|
||||
paymentDate,
|
||||
moveLineNo++,
|
||||
paymentVoucher.getRef(),
|
||||
null);
|
||||
paymentVoucher.getLabel());
|
||||
|
||||
MoveLine moveLine =
|
||||
moveLineService.createMoveLine(
|
||||
@@ -1071,21 +1089,125 @@ public class PaymentVoucherConfirmService {
|
||||
paymentDate,
|
||||
moveLineNo++,
|
||||
paymentVoucher.getRef(),
|
||||
null);
|
||||
paymentVoucher.getLabel());
|
||||
|
||||
move.getMoveLineList().add(moveLine);
|
||||
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);
|
||||
paymentVoucher.setGeneratedMove(move);
|
||||
paymentVoucher.addGeneratedMoveListItem(move);
|
||||
|
||||
// confirmed is ventilation equivalent
|
||||
paymentVoucher.setConfirmedByUser(AuthUtils.getUser());
|
||||
paymentVoucher.setConfirmationDate(LocalDate.now());
|
||||
|
||||
if (isDebitToPay) {
|
||||
reconcileService.balanceCredit(moveLine);
|
||||
}
|
||||
// updateCashRegisterTheoricalSolde(paymentVoucher, isDebitToPay,paidAmount);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -88,27 +88,27 @@ public class PaymentVoucherLoadService {
|
||||
List<MoveLine> moveLines = null;
|
||||
|
||||
String query =
|
||||
"self.account.useForPartnerBalance = 't' "
|
||||
"self.account.useForPartnerBalance = 't' "
|
||||
+ "and self.amountRemaining > 0 "
|
||||
+ "and (self.move.statusSelect = ?3 OR self.move.statusSelect = ?4)"
|
||||
+ "and self.move.ignoreInDebtRecoveryOk = 'f' "
|
||||
+ "and self.move.company = ?2 ";
|
||||
|
||||
|
||||
if (paymentVoucher.getOperationTypeSelect() == PaymentVoucherRepository.OTHER){
|
||||
AccountingSituation accountingSituation = paymentVoucher.getPartner().getAccountingSituationList().get(0);
|
||||
query += " and self.account.id = "+accountingSituation.getPartnerPaymentAccount().getId();
|
||||
if(accountingSituation.getDiretion() == 1){
|
||||
query += " and self.debit > 0";
|
||||
}else{
|
||||
query += " and self.credit > 0";
|
||||
}
|
||||
}else{
|
||||
query += " and self.move.invoice.pfpValidateStatusSelect != ?5 AND self.partner = ?1";
|
||||
if (paymentVoucher.getOperationTypeSelect() == PaymentVoucherRepository.OTHER) {
|
||||
AccountingSituation accountingSituation =
|
||||
paymentVoucher.getPartner().getAccountingSituationList().get(0);
|
||||
query += " and self.account.id = " + accountingSituation.getPartnerPaymentAccount().getId();
|
||||
if (accountingSituation.getDiretion() == 1) {
|
||||
query += " and self.debit > 0";
|
||||
} else {
|
||||
query += " and self.credit > 0";
|
||||
}
|
||||
} else {
|
||||
query += " and self.move.invoice.pfpValidateStatusSelect != ?5 AND self.partner = ?1";
|
||||
if (paymentVoucher.getOperationTypeSelect()
|
||||
!= PaymentVoucherRepository.OPERATION_TYPE_CLIENT_SALE_CLIENT_REFUND
|
||||
&& paymentVoucher.getOperationTypeSelect()
|
||||
!= PaymentVoucherRepository.OPERATION_TYPE_SUPPLIER_PURCHASE_SUPPLIER_REFUND) {
|
||||
!= PaymentVoucherRepository.OPERATION_TYPE_CLIENT_SALE_CLIENT_REFUND
|
||||
&& paymentVoucher.getOperationTypeSelect()
|
||||
!= PaymentVoucherRepository.OPERATION_TYPE_SUPPLIER_PURCHASE_SUPPLIER_REFUND) {
|
||||
if (paymentVoucherToolService.isDebitToPay(paymentVoucher)) {
|
||||
query += " and self.debit > 0 ";
|
||||
} else {
|
||||
@@ -221,11 +221,22 @@ public class PaymentVoucherLoadService {
|
||||
int sequence = paymentVoucher.getPayVoucherElementToPayList().size() + 1;
|
||||
BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
||||
List<PayVoucherDueElement> dueElements = paymentVoucherContext.getPayVoucherDueElementList();
|
||||
|
||||
int sizeInvoiced = dueElements.stream().filter(t -> t.getMoveLine().getMove().getInvoice() == null).collect(Collectors.toList()).size();
|
||||
System.out.println("sizeInvoiced : {}"+sizeInvoiced);
|
||||
if(sizeInvoiced == 0){
|
||||
dueElements.sort((o1, o2) -> o2.getMoveLine().getMove().getInvoice().getInvoiceId().compareTo(o1.getMoveLine().getMove().getInvoice().getInvoiceId()));
|
||||
|
||||
int sizeInvoiced =
|
||||
dueElements
|
||||
.stream()
|
||||
.filter(t -> t.getMoveLine().getMove().getInvoice() == null)
|
||||
.collect(Collectors.toList())
|
||||
.size();
|
||||
System.out.println("sizeInvoiced : {}" + sizeInvoiced);
|
||||
if (sizeInvoiced == 0) {
|
||||
dueElements.sort(
|
||||
(o1, o2) ->
|
||||
o2.getMoveLine()
|
||||
.getMove()
|
||||
.getInvoice()
|
||||
.getInvoiceId()
|
||||
.compareTo(o1.getMoveLine().getMove().getInvoice().getInvoiceId()));
|
||||
}
|
||||
|
||||
for (PayVoucherDueElement payVoucherDueElementContext : dueElements) {
|
||||
@@ -235,9 +246,11 @@ public class PaymentVoucherLoadService {
|
||||
if (payVoucherDueElementContext.isSelected()) {
|
||||
|
||||
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
|
||||
paymentVoucher.removePayVoucherDueElementListItem(payVoucherDueElement);
|
||||
@@ -246,7 +259,8 @@ public class PaymentVoucherLoadService {
|
||||
}
|
||||
|
||||
public PayVoucherElementToPay createPayVoucherElementToPay(
|
||||
PayVoucherDueElement payVoucherDueElement, int sequence,BigDecimal amountRemaining) throws AxelorException {
|
||||
PayVoucherDueElement payVoucherDueElement, int sequence, BigDecimal amountRemaining)
|
||||
throws AxelorException {
|
||||
|
||||
PaymentVoucher paymentVoucher = payVoucherDueElement.getPaymentVoucher();
|
||||
// BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
||||
@@ -420,7 +434,6 @@ public class PaymentVoucherLoadService {
|
||||
int sequence = 0;
|
||||
BigDecimal amountRemaining = paymentVoucher.getRemainingAmount();
|
||||
|
||||
|
||||
for (Iterator<PayVoucherDueElement> it =
|
||||
paymentVoucher.getPayVoucherDueElementList().iterator();
|
||||
it.hasNext(); ) {
|
||||
@@ -429,49 +442,54 @@ public class PaymentVoucherLoadService {
|
||||
if (invoice.equals(payVoucherDueElement.getMoveLine().getMove().getInvoice())
|
||||
&& paymentVoucher.getCurrency().equals(payVoucherDueElement.getCurrency())) {
|
||||
paymentVoucher.addPayVoucherElementToPayListItem(
|
||||
createPayVoucherElementToPay(payVoucherDueElement, ++sequence,amountRemaining));
|
||||
amountRemaining = amountRemaining.subtract(amountRemaining.min(payVoucherDueElement.getAmountRemaining()));
|
||||
createPayVoucherElementToPay(payVoucherDueElement, ++sequence, amountRemaining));
|
||||
amountRemaining =
|
||||
amountRemaining.subtract(
|
||||
amountRemaining.min(payVoucherDueElement.getAmountRemaining()));
|
||||
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public void updateVoucher(PaymentVoucher paymentVoucher) throws AxelorException{
|
||||
public void updateVoucher(PaymentVoucher paymentVoucher) throws AxelorException {
|
||||
List<MoveLine> moveLines = new ArrayList<>();
|
||||
List<PayVoucherElementToPay> payVoucherElementToPayList = paymentVoucher.getPayVoucherElementToPayList();
|
||||
List<PayVoucherElementToPay> payVoucherElementToPayList =
|
||||
paymentVoucher.getPayVoucherElementToPayList();
|
||||
|
||||
for (PayVoucherElementToPay elementToPay : payVoucherElementToPayList) {
|
||||
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) {
|
||||
Move move = payVoucherElementToPay.getMoveLine().getMove();
|
||||
MoveLine moveLine = payVoucherElementToPay.getMoveLine();
|
||||
|
||||
payVoucherElementToPay.setTotalAmount(moveLine.getCurrencyAmount());
|
||||
Move move = payVoucherElementToPay.getMoveLine().getMove();
|
||||
MoveLine moveLine = payVoucherElementToPay.getMoveLine();
|
||||
|
||||
BigDecimal paidAmountInElementCurrency =
|
||||
currencyService
|
||||
.getAmountCurrencyConvertedAtDate(
|
||||
move.getCompanyCurrency(),
|
||||
move.getCurrency(),
|
||||
moveLine.getAmountPaid(),
|
||||
moveLine.getDate())
|
||||
.setScale(2, RoundingMode.HALF_EVEN);
|
||||
|
||||
|
||||
|
||||
payVoucherElementToPay.setRemainingAmount(
|
||||
moveLine.getCurrencyAmount().subtract(paidAmountInElementCurrency));
|
||||
payVoucherElementToPay.setTotalAmount(moveLine.getCurrencyAmount());
|
||||
|
||||
elementToPayRepository.save(payVoucherElementToPay);
|
||||
}
|
||||
|
||||
BigDecimal paidAmountInElementCurrency =
|
||||
currencyService
|
||||
.getAmountCurrencyConvertedAtDate(
|
||||
move.getCompanyCurrency(),
|
||||
move.getCurrency(),
|
||||
moveLine.getAmountPaid(),
|
||||
moveLine.getDate())
|
||||
.setScale(2, RoundingMode.HALF_EVEN);
|
||||
|
||||
payVoucherElementToPay.setRemainingAmount(
|
||||
moveLine.getCurrencyAmount().subtract(paidAmountInElementCurrency));
|
||||
|
||||
elementToPayRepository.save(payVoucherElementToPay);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
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.account.db.CashInventory;
|
||||
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.ActionResponse;
|
||||
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 {
|
||||
|
||||
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)
|
||||
throws AxelorException {
|
||||
|
||||
@@ -38,72 +52,109 @@ public class CashInventoryController {
|
||||
name += " " + cashInventory.getRef();
|
||||
}
|
||||
|
||||
String fileLink =
|
||||
ReportFactory.createReport(String.format(IReport.CASH_INVENTORY, cashInventory.getOperationTypeSelect()), name + "-${date}")
|
||||
.addParam("cashInventoryId", cashInventory.getId())
|
||||
.generate()
|
||||
.getFileLink();
|
||||
String fileLink = ReportFactory.createReport(
|
||||
String.format(IReport.CASH_INVENTORY, cashInventory.getOperationTypeSelect()),
|
||||
name + "-${date}")
|
||||
.addParam("cashInventoryId", cashInventory.getId())
|
||||
.generate()
|
||||
.getFileLink();
|
||||
|
||||
logger.debug("Printing " + name);
|
||||
|
||||
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);
|
||||
|
||||
String[] arrOfStr = cashInventory.getTheoricalSolde().toString().split("\\.");
|
||||
|
||||
String left = 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+" Cts";
|
||||
String[] arrOfStr = cashInventory.getPhysicalSolde().toString().split("\\.");
|
||||
|
||||
String left = convertService.convert(Long.parseLong(arrOfStr[0]));
|
||||
String right = convertService.convert(Long.parseLong(arrOfStr[1]));
|
||||
String number = left + " dinars algériens et " + right + " Cts";
|
||||
|
||||
response.setValue("theoricalSoldeInWords", number);
|
||||
}
|
||||
|
||||
|
||||
public void initThetoricalSoldeInWords(ActionRequest request, ActionResponse response){
|
||||
|
||||
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
||||
Beans.get(CashInventoryService.class).initThetoricalSoldeInWords(cashInventory);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void computeToTals(ActionRequest request, ActionResponse response){
|
||||
|
||||
CashInventory cashInventory = request.getContext().asType(CashInventory.class);
|
||||
Map<String, BigDecimal> map = Beans.get(CashInventoryService.class).computeToTals(cashInventory);
|
||||
response.setValues(map);
|
||||
|
||||
/**
|
||||
* Initializes 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 value.
|
||||
*/
|
||||
public void initThetoricalSolde(ActionRequest request, ActionResponse response) {
|
||||
BigDecimal theoricalSolde = Beans.get(CashInventoryService.class).initThetoricalSolde();
|
||||
response.setValue("theoricalSolde", theoricalSolde);
|
||||
}
|
||||
|
||||
public void getLastCashData(ActionRequest request, ActionResponse response){
|
||||
CashInventory lastCashInventory = Beans.get(CashInventoryRepository.class).all().order("-id").fetchOne();
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
List<PaymentVoucher> cashVouchers = Beans.get(PaymentVoucherRepository.class).all().filter("self.operationTypeSelect = 9 and self.cashStatusSelect = 3").fetch();
|
||||
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);
|
||||
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) {
|
||||
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();
|
||||
|
||||
BigDecimal totalSolde = lastCashInventory.getPhysicalSolde();
|
||||
|
||||
for (PaymentVoucher paymentVoucher : cashVouchers) {
|
||||
switch (paymentVoucher.getDebitCreditSelect()) {
|
||||
case "1":
|
||||
totalSolde = totalSolde.subtract(paymentVoucher.getPaidAmount());
|
||||
totalSolde = totalSolde.subtract(paymentVoucher.getPaidAmount());
|
||||
break;
|
||||
case "2":
|
||||
totalSolde = totalSolde.add(paymentVoucher.getPaidAmount());
|
||||
totalSolde = totalSolde.add(paymentVoucher.getPaidAmount());
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
import com.axelor.apps.ReportFactory;
|
||||
import com.axelor.apps.account.db.AccountingSituation;
|
||||
import com.axelor.apps.account.db.Invoice;
|
||||
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.PaymentMode;
|
||||
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.exception.IExceptionMessage;
|
||||
import com.axelor.apps.account.report.IReport;
|
||||
import com.axelor.apps.account.service.AccountingSituationService;
|
||||
import com.axelor.apps.account.service.IrrecoverableService;
|
||||
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.Currency;
|
||||
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.PrintingSettings;
|
||||
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.service.AddressService;
|
||||
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.PartnerService;
|
||||
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.ActionResponse;
|
||||
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.Joiner;
|
||||
import com.google.inject.Singleton;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.HashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -962,72 +959,89 @@ public class InvoiceController {
|
||||
}
|
||||
response.setAttr("partner", "domain", domain);
|
||||
}
|
||||
|
||||
|
||||
public void printInvoicePayment(ActionRequest request, ActionResponse response)
|
||||
throws AxelorException {
|
||||
|
||||
String name = I18n.get("Payment voucher");
|
||||
String AmountToPay = request.getContext().get("amount").toString();
|
||||
String[] arrOfStr = AmountToPay.split("\\.");
|
||||
|
||||
|
||||
String left = 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 chequeModelBank = request.getContext().get("chequeModelBank").toString();
|
||||
BigDecimal amount = new BigDecimal(AmountToPay);
|
||||
|
||||
String fileLink =
|
||||
ReportFactory.createReport("chequeModelBank.rptdesign", name + "-${date}")
|
||||
.addParam("NumberToWords", number)
|
||||
.addParam("Wilaya", request.getContext().get("wilaya").toString())
|
||||
.addParam("amount", amount)
|
||||
.addParam("date", request.getContext().get("date").toString() )
|
||||
.addParam("name", request.getContext().get("PartnerName"))
|
||||
.addParam("chequeModelBank", chequeModelBank)
|
||||
.generate()
|
||||
.getFileLink();
|
||||
|
||||
logger.debug("Printing " + name);
|
||||
|
||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
||||
|
||||
String name = I18n.get("Payment voucher");
|
||||
String AmountToPay = request.getContext().get("amount").toString();
|
||||
String[] arrOfStr = AmountToPay.split("\\.");
|
||||
|
||||
String left =
|
||||
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 chequeModelBank = request.getContext().get("chequeModelBank").toString();
|
||||
BigDecimal amount = new BigDecimal(AmountToPay);
|
||||
|
||||
String fileLink =
|
||||
ReportFactory.createReport("chequeModelBank.rptdesign", name + "-${date}")
|
||||
.addParam("NumberToWords", number)
|
||||
.addParam("Wilaya", request.getContext().get("wilaya").toString())
|
||||
.addParam("amount", amount)
|
||||
.addParam("date", request.getContext().get("date").toString())
|
||||
.addParam("name", request.getContext().get("PartnerName"))
|
||||
.addParam("chequeModelBank", chequeModelBank)
|
||||
.generate()
|
||||
.getFileLink();
|
||||
|
||||
logger.debug("Printing " + name);
|
||||
|
||||
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 {
|
||||
|
||||
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
|
||||
|
||||
|
||||
String name = I18n.get("Payment voucher");
|
||||
String AmountToPay = paymentVoucher.getPaidAmount().toString();
|
||||
String[] arrOfStr = AmountToPay.split("\\.");
|
||||
|
||||
String left = 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[] arrOfStr = AmountToPay.split("\\.");
|
||||
|
||||
String left =
|
||||
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 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 =
|
||||
ReportFactory.createReport("PaymentRequest.rptdesign", name + "-${date}")
|
||||
ReportFactory.createReport(reportType, name + "-${date}")
|
||||
.addParam("PaymentVoucherId", paymentVoucher.getId())
|
||||
.addParam("NumberToWords", number)
|
||||
.generate()
|
||||
.getFileLink();
|
||||
|
||||
logger.debug("Printing " + name);
|
||||
|
||||
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)
|
||||
throws AxelorException {
|
||||
|
||||
public void showInvoice2(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||
|
||||
Context context = request.getContext();
|
||||
|
||||
Invoice invoice = Beans.get(InvoiceRepository.class)
|
||||
.find(Long.parseLong(context.get("id").toString()));
|
||||
|
||||
String name = I18n.get("Invoice");
|
||||
Invoice invoice =
|
||||
Beans.get(InvoiceRepository.class).find(Long.parseLong(context.get("id").toString()));
|
||||
|
||||
String name = I18n.get("Invoice");
|
||||
|
||||
String format = context.get("format") != null ? context.get("format").toString() : "pdf";
|
||||
Integer reportType =
|
||||
@@ -1048,14 +1062,16 @@ public class InvoiceController {
|
||||
.getCode()
|
||||
: 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);
|
||||
|
||||
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
|
||||
*
|
||||
@@ -1067,23 +1083,21 @@ public class InvoiceController {
|
||||
Invoice invoice = request.getContext().asType(Invoice.class);
|
||||
Company company = invoice.getCompany();
|
||||
Partner partner = invoice.getPartner();
|
||||
Journal journal = null ;
|
||||
Journal journal = null;
|
||||
Integer operationTypeSelect = invoice.getOperationTypeSelect();
|
||||
|
||||
if (company != null && partner != null && operationTypeSelect != null ) {
|
||||
if (operationTypeSelect.intValue() == InvoiceRepository.OPERATION_TYPE_SUPPLIER_PURCHASE) {
|
||||
if( partner.getTypeOfSupplier() != null){
|
||||
if(partner.getTypeOfSupplier().equals("1")){
|
||||
journal = company.getAccountConfig().getSupplierPurchaseJournalForeigners();
|
||||
}
|
||||
if(partner.getTypeOfSupplier().equals("2")){
|
||||
journal = company.getAccountConfig().getSupplierPurchaseJournalLocal();
|
||||
}
|
||||
}
|
||||
response.setValue("journal", journal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (company != null && partner != null && operationTypeSelect != null) {
|
||||
if (operationTypeSelect.intValue() == InvoiceRepository.OPERATION_TYPE_SUPPLIER_PURCHASE) {
|
||||
if (partner.getTypeOfSupplier() != null) {
|
||||
if (partner.getTypeOfSupplier().equals("1")) {
|
||||
journal = company.getAccountConfig().getSupplierPurchaseJournalForeigners();
|
||||
}
|
||||
if (partner.getTypeOfSupplier().equals("2")) {
|
||||
journal = company.getAccountConfig().getSupplierPurchaseJournalLocal();
|
||||
}
|
||||
}
|
||||
response.setValue("journal", journal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,22 +403,24 @@ public class InvoiceLineController {
|
||||
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();
|
||||
InvoiceLine invoiceLine = context.asType(InvoiceLine.class);
|
||||
|
||||
|
||||
BigDecimal qtyUg = invoiceLine.getProduct().getUg();
|
||||
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();
|
||||
if(product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0){
|
||||
BigDecimal ug = 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));
|
||||
if (product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0) {
|
||||
BigDecimal ug =
|
||||
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("discountAmount", ugAmount);
|
||||
response.setValue("qty", totalQty);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,52 +1,43 @@
|
||||
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.InvoiceTemplate;
|
||||
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
||||
import com.axelor.apps.account.db.repo.InvoiceTemplateRepository;
|
||||
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.i18n.I18n;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.meta.schema.actions.ActionView;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
import com.axelor.rpc.Context;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class InvoiceTemplateControlller {
|
||||
|
||||
public void showInvoice2(ActionRequest request, ActionResponse response)
|
||||
throws AxelorException {
|
||||
public void showInvoice2(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||
|
||||
Context context = request.getContext();
|
||||
|
||||
InvoiceTemplate invoiceTemplate = Beans.get(InvoiceTemplateRepository.class)
|
||||
.find(Long.parseLong(context.get("id").toString()));
|
||||
|
||||
|
||||
Invoice invoice = Beans.get(InvoiceTemplateService.class).generateInvoiceFromTemplate(invoiceTemplate);
|
||||
InvoiceTemplate invoiceTemplate =
|
||||
Beans.get(InvoiceTemplateRepository.class)
|
||||
.find(Long.parseLong(context.get("id").toString()));
|
||||
|
||||
System.out.println("*********************Invoice***********************");
|
||||
System.out.println(invoice);
|
||||
System.out.println("*********************Invoice***********************");
|
||||
|
||||
response.setView(
|
||||
ActionView.define("Invoice")
|
||||
.model(Invoice.class.getName())
|
||||
.add("grid", "invoice-grid")
|
||||
.add("form", "invoice-form")
|
||||
.param("forceEdit", "true")
|
||||
.context("_showRecord", String.valueOf(invoice.getId()))
|
||||
.context("_operationTypeSelect", invoice.getOperationTypeSelect())
|
||||
.context("todayDate", LocalDate.now())
|
||||
.map());
|
||||
|
||||
Invoice invoice =
|
||||
Beans.get(InvoiceTemplateService.class).generateInvoiceFromTemplate(invoiceTemplate);
|
||||
|
||||
System.out.println("*********************Invoice***********************");
|
||||
System.out.println(invoice);
|
||||
System.out.println("*********************Invoice***********************");
|
||||
|
||||
response.setView(
|
||||
ActionView.define("Invoice")
|
||||
.model(Invoice.class.getName())
|
||||
.add("grid", "invoice-grid")
|
||||
.add("form", "invoice-form")
|
||||
.param("forceEdit", "true")
|
||||
.context("_showRecord", String.valueOf(invoice.getId()))
|
||||
.context("_operationTypeSelect", invoice.getOperationTypeSelect())
|
||||
.context("todayDate", LocalDate.now())
|
||||
.map());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,12 +65,14 @@ public class PaymentVoucherController {
|
||||
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
|
||||
|
||||
if (Strings.isNullOrEmpty(paymentVoucher.getRef())) {
|
||||
if(paymentVoucher.getOperationTypeSelect() == 9){
|
||||
if (paymentVoucher.getOperationTypeSelect() == 9) {
|
||||
response.setValue(
|
||||
"ref", Beans.get(SequenceService.class).getSequenceNumber("CashSequence", paymentVoucher.getCompany()));
|
||||
}else{
|
||||
"ref",
|
||||
Beans.get(SequenceService.class)
|
||||
.getSequenceNumber("CashSequence", paymentVoucher.getCompany()));
|
||||
} else {
|
||||
response.setValue(
|
||||
"ref", Beans.get(PaymentVoucherSequenceService.class).getReference(paymentVoucher));
|
||||
"ref", Beans.get(PaymentVoucherSequenceService.class).getReference(paymentVoucher));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,8 +216,9 @@ public class PaymentVoucherController {
|
||||
paymentVoucher,
|
||||
rejectionInstance);
|
||||
|
||||
PaymentVoucher paymentVoucher2 =Beans.get(PaymentVoucherConfirmService.class)
|
||||
.rejectPaymentVoucher(paymentVoucher, rejectionRaison);
|
||||
PaymentVoucher paymentVoucher2 =
|
||||
Beans.get(PaymentVoucherConfirmService.class)
|
||||
.rejectPaymentVoucher(paymentVoucher, rejectionRaison);
|
||||
|
||||
// response.setReload(true);
|
||||
response.setView(
|
||||
@@ -327,9 +330,24 @@ public class PaymentVoucherController {
|
||||
if (!Strings.isNullOrEmpty(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 =
|
||||
ReportFactory.createReport(IReport.PAYMENT_VOUCHER, name + "-${date}")
|
||||
ReportFactory.createReport(reportType, name + "-${date}")
|
||||
.addParam("PaymentVoucherId", paymentVoucher.getId())
|
||||
.generate()
|
||||
.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<PayVoucherElementToPay> elementToPays = new ArrayList<>();
|
||||
|
||||
@@ -388,22 +407,26 @@ public class PaymentVoucherController {
|
||||
List<Integer> idList = (List<Integer>) request.getContext().get("_ids");
|
||||
|
||||
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);
|
||||
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(
|
||||
ActionView.define(I18n.get("Move"))
|
||||
.model(Move.class.getName())
|
||||
.add("grid", "move-grid")
|
||||
.add("form", "move-form")
|
||||
.context("_showRecord", String.valueOf(move.getId()))
|
||||
.map());
|
||||
ActionView.define(I18n.get("Move"))
|
||||
.model(Move.class.getName())
|
||||
.add("grid", "move-grid")
|
||||
.add("form", "move-form")
|
||||
.context("_showRecord", String.valueOf(move.getId()))
|
||||
.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<PayVoucherElementToPay> elementToPays = new ArrayList<>();
|
||||
|
||||
@@ -419,47 +442,83 @@ public class PaymentVoucherController {
|
||||
BigDecimal totalRemainingAmountAfterPaymentRefund = BigDecimal.ZERO;
|
||||
|
||||
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);
|
||||
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();
|
||||
|
||||
if( invoice.getOperationSubTypeSelect() == InvoiceRepository.OPERATION_SUB_TYPE_FINANCIAL_REFUNDS
|
||||
|| invoice.getOperationSubTypeSelect() == InvoiceRepository.OPERATION_TYPE_SUPPLIER_REFUND){
|
||||
totalImputedAmountRefund = totalImputedAmount.add(elementPay.getAmountToPay());
|
||||
totalRemainingAmountAfterPaymentRefund = totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
||||
totalAmountRefund = totalAmount.add(elementPay.getTotalAmount());
|
||||
}else{
|
||||
totalImputedAmount = totalImputedAmount.add(elementPay.getAmountToPay());
|
||||
totalRemainingAmountAfterPayment = totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
||||
totalAmount = totalAmount.add(elementPay.getTotalAmount());
|
||||
}
|
||||
if (invoice.getOperationSubTypeSelect()
|
||||
== InvoiceRepository.OPERATION_SUB_TYPE_FINANCIAL_REFUNDS
|
||||
|| invoice.getOperationSubTypeSelect()
|
||||
== InvoiceRepository.OPERATION_TYPE_SUPPLIER_REFUND) {
|
||||
totalImputedAmountRefund = totalImputedAmount.add(elementPay.getAmountToPay());
|
||||
totalRemainingAmountAfterPaymentRefund =
|
||||
totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
||||
totalAmountRefund = totalAmount.add(elementPay.getTotalAmount());
|
||||
} else {
|
||||
totalImputedAmount = totalImputedAmount.add(elementPay.getAmountToPay());
|
||||
totalRemainingAmountAfterPayment =
|
||||
totalRemainingAmountAfterPayment.add(elementPay.getRemainingAmountAfterPayment());
|
||||
totalAmount = totalAmount.add(elementPay.getTotalAmount());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
response.setView(
|
||||
ActionView.define("Calculation")
|
||||
.model(Wizard.class.getName())
|
||||
.add("form", "account-payment-voucher-calculation-wizard-form")
|
||||
.param("popup", "true")
|
||||
.param("show-toolbar", "false")
|
||||
.param("show-confirm", "false")
|
||||
.param("width", "800")
|
||||
.param("popup-save", "false")
|
||||
.context("_totalVoucher", totalVoucher)
|
||||
.context("_totalImputedAmount", totalImputedAmount)
|
||||
.context("_totalRemainingAmountAfterPayment", totalRemainingAmountAfterPayment)
|
||||
.context("_totalAmount", totalAmount)
|
||||
.context("_totalImputedAmountRefund", totalImputedAmountRefund)
|
||||
.context("_totalRemainingAmountAfterPaymentRefund", totalRemainingAmountAfterPaymentRefund)
|
||||
.context("_totalAmountRefund", totalAmountRefund)
|
||||
.map());
|
||||
|
||||
ActionView.define("Calculation")
|
||||
.model(Wizard.class.getName())
|
||||
.add("form", "account-payment-voucher-calculation-wizard-form")
|
||||
.param("popup", "true")
|
||||
.param("show-toolbar", "false")
|
||||
.param("show-confirm", "false")
|
||||
.param("width", "800")
|
||||
.param("popup-save", "false")
|
||||
.context("_totalVoucher", totalVoucher)
|
||||
.context("_totalImputedAmount", totalImputedAmount)
|
||||
.context("_totalRemainingAmountAfterPayment", totalRemainingAmountAfterPayment)
|
||||
.context("_totalAmount", totalAmount)
|
||||
.context("_totalImputedAmountRefund", totalImputedAmountRefund)
|
||||
.context(
|
||||
"_totalRemainingAmountAfterPaymentRefund", totalRemainingAmountAfterPaymentRefund)
|
||||
.context("_totalAmountRefund", totalAmountRefund)
|
||||
.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.repo.ReconcileRepository;
|
||||
import com.axelor.apps.account.service.ReconcileService;
|
||||
import com.axelor.apps.account.service.ReconcileServiceImpl;
|
||||
import com.axelor.exception.service.TraceBackService;
|
||||
import com.axelor.inject.Beans;
|
||||
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
|
||||
public void reconcile(ActionRequest request, ActionResponse response) {
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ public class ImportPaymentVoucher {
|
||||
PayVoucherDueElement payVoucherDueElement =
|
||||
paymentVoucherLoadService.createPayVoucherDueElement(moveLineToPay);
|
||||
paymentVoucher.addPayVoucherElementToPayListItem(
|
||||
paymentVoucherLoadService.createPayVoucherElementToPay(payVoucherDueElement, 1,paymentVoucher.getRemainingAmount()));
|
||||
paymentVoucherLoadService.createPayVoucherElementToPay(
|
||||
payVoucherDueElement, 1, paymentVoucher.getRemainingAmount()));
|
||||
}
|
||||
|
||||
if (paymentVoucher.getStatusSelect() == PaymentVoucherRepository.STATUS_CONFIRMED) {
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
|
||||
<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"/>
|
||||
|
||||
<extra-code><![CDATA[
|
||||
|
||||
@@ -3,15 +3,65 @@
|
||||
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"/>
|
||||
<module name="account" package="com.axelor.apps.account.db" />
|
||||
|
||||
<entity name="AnalyticAccount" lang="java">
|
||||
|
||||
<string name="code" title="Code" required="true"/>
|
||||
<string name="name" title="Name" required="true"/>
|
||||
<many-to-one 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."/>
|
||||
<unique-constraint columns="code,name,analyticAxis"/>
|
||||
|
||||
<string name="code" title="Code" required="true" />
|
||||
<string name="name" title="Name"
|
||||
required="true" />
|
||||
<many-to-one 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>
|
||||
|
||||
</domain-models>
|
||||
</domain-models>
|
||||
@@ -8,10 +8,12 @@
|
||||
<entity name="AppBudget" lang="java" extends="App">
|
||||
<boolean name="checkAvailableBudget" title="Check Available Budget"/>
|
||||
<boolean name="manageMultiBudget" title="Manage multi budgets on lines"/>
|
||||
<boolean name="budgetRequiredOnPO" title="Budget required on purchase order lines"/>
|
||||
|
||||
<track>
|
||||
<field name="checkAvailableBudget" on="UPDATE"/>
|
||||
<field name="manageMultiBudget" on="UPDATE"/>
|
||||
<field name="budgetRequiredOnPO" on="UPDATE"/>
|
||||
</track>
|
||||
</entity>
|
||||
</domain-models>
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
<integer name="periodDurationSelect" title="Period duration" selection="account.year.period.duration.select"/>
|
||||
<decimal name="amountForGeneration" title="Amount for each line"/>
|
||||
<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[
|
||||
|
||||
// STATUS SELECT
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<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"/>
|
||||
<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>
|
||||
|
||||
</domain-models>
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
<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="toDate" title="To"/>
|
||||
<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"/>
|
||||
<decimal name="gap" title="Gap" />
|
||||
<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"/>
|
||||
<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"/>
|
||||
<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="totalBankNotesAmount" title="Total bank notes amount" />
|
||||
<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"/>
|
||||
<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="dueDate" title="Due Date" />
|
||||
@@ -106,6 +109,13 @@
|
||||
|
||||
<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="receiptNo,company"/>
|
||||
|
||||
@@ -135,6 +145,7 @@
|
||||
|
||||
<track>
|
||||
<field name="statusSelect"/>
|
||||
<field name="cashStatusSelect"/>
|
||||
<message if="true" on="CREATE">Voucher created</message>
|
||||
<message if="statusSelect == 3" tag="important">Confirmed</message>
|
||||
</track>
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
</ex-property>
|
||||
</list-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>
|
||||
<encrypted-property name="odaPassword" encryptionID="base64">SWpsdj1iQl5oU0dAUFYkLDlqa2hIek8qNzQ=</encrypted-property>
|
||||
</oda-data-source>
|
||||
@@ -187,6 +187,24 @@
|
||||
<text-property name="displayName">product_code</text-property>
|
||||
<text-property name="heading">product_code</text-property>
|
||||
</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>
|
||||
<property name="columnName">account_code</property>
|
||||
<property name="analysis">dimension</property>
|
||||
@@ -251,6 +269,26 @@
|
||||
<property name="isInput">true</property>
|
||||
<property name="isOutput">false</property>
|
||||
</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>
|
||||
<structure name="cachedMetaData">
|
||||
<list-property name="resultSet">
|
||||
@@ -261,36 +299,51 @@
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">2</property>
|
||||
<property name="name">account_code</property>
|
||||
<property name="name">product_name</property>
|
||||
<property name="dataType">string</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<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="dataType">decimal</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">4</property>
|
||||
<property name="position">7</property>
|
||||
<property name="name">initial_value</property>
|
||||
<property name="dataType">decimal</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">5</property>
|
||||
<property name="position">8</property>
|
||||
<property name="name">qty_in</property>
|
||||
<property name="dataType">decimal</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">6</property>
|
||||
<property name="position">9</property>
|
||||
<property name="name">val_in</property>
|
||||
<property name="dataType">decimal</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">7</property>
|
||||
<property name="position">10</property>
|
||||
<property name="name">qty_out</property>
|
||||
<property name="dataType">decimal</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">8</property>
|
||||
<property name="position">11</property>
|
||||
<property name="name">val_out</property>
|
||||
<property name="dataType">decimal</property>
|
||||
</structure>
|
||||
@@ -308,48 +361,69 @@
|
||||
</structure>
|
||||
<structure>
|
||||
<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="nativeName">account_code</property>
|
||||
<property name="dataType">string</property>
|
||||
<property name="nativeDataType">12</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">3</property>
|
||||
<property name="position">6</property>
|
||||
<property name="name">initial_qty</property>
|
||||
<property name="nativeName">initial_qty</property>
|
||||
<property name="dataType">decimal</property>
|
||||
<property name="nativeDataType">2</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">4</property>
|
||||
<property name="position">7</property>
|
||||
<property name="name">initial_value</property>
|
||||
<property name="nativeName">initial_value</property>
|
||||
<property name="dataType">decimal</property>
|
||||
<property name="nativeDataType">2</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">5</property>
|
||||
<property name="position">8</property>
|
||||
<property name="name">qty_in</property>
|
||||
<property name="nativeName">qty_in</property>
|
||||
<property name="dataType">decimal</property>
|
||||
<property name="nativeDataType">2</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">6</property>
|
||||
<property name="position">9</property>
|
||||
<property name="name">val_in</property>
|
||||
<property name="nativeName">val_in</property>
|
||||
<property name="dataType">decimal</property>
|
||||
<property name="nativeDataType">2</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">7</property>
|
||||
<property name="position">10</property>
|
||||
<property name="name">qty_out</property>
|
||||
<property name="nativeName">qty_out</property>
|
||||
<property name="dataType">decimal</property>
|
||||
<property name="nativeDataType">2</property>
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="position">8</property>
|
||||
<property name="position">11</property>
|
||||
<property name="name">val_out</property>
|
||||
<property name="nativeName">val_out</property>
|
||||
<property name="dataType">decimal</property>
|
||||
@@ -357,35 +431,55 @@
|
||||
</structure>
|
||||
</list-property>
|
||||
<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(initial_qty,0) as initial_qty,
|
||||
coalesce(initial_value,0) as initial_value,
|
||||
coalesce(qty_in,0) as qty_in,
|
||||
coalesce(val_in,0) as val_in,
|
||||
coalesce(qty_out,0) as qty_out,
|
||||
coalesce(val_out,0) as val_out
|
||||
from
|
||||
(coalesce(initial_qty,0)) as initial_qty,
|
||||
(coalesce(initial_value,0)) as initial_value,
|
||||
(coalesce(qty_in,0)) as qty_in,
|
||||
(coalesce(val_in,0)) as val_in,
|
||||
(coalesce(qty_out,0)) as qty_out,
|
||||
(coalesce(val_out,0)) as val_out
|
||||
from
|
||||
(SELECT *
|
||||
FROM
|
||||
(SELECT
|
||||
_PRODUCT.ID AS PRODUCT_ID,
|
||||
_PRODUCT.name AS PRODUCT_NAME,
|
||||
_ACCOUNT.CODE AS ACCOUNT_CODE,
|
||||
_PRODUCT.CODE AS PRODUCT_CODE,
|
||||
_famille.name as category,
|
||||
_sous_famille.name as sub_category
|
||||
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 base_famille_produit _famille on _famille.id = _product.famille_produit
|
||||
left join base_famille_produit _sous_famille on _sous_famille.id = _product.sous_famille_produit
|
||||
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 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
|
||||
(select
|
||||
_ACCOUNT.code as account_code,
|
||||
_product.code as product_code,
|
||||
sum(real_qty) as initial_qty,
|
||||
sum(real_qty) * avg(gap_value) as initial_value
|
||||
from account_accounting_report AccountingReport
|
||||
left join base_product _product on AccountingReport.id = ?
|
||||
left join stock_inventory_line inventory_line on inventory_line.product = _product.id
|
||||
left join stock_inventory inventory on inventory.id = inventory_line.inventory
|
||||
LEFT JOIN ACCOUNT_ACCOUNT_MANAGEMENT _MANAGEMENT ON _MANAGEMENT.PRODUCT = _product.id
|
||||
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)
|
||||
and inventory.stock_location not in (5,6)
|
||||
group by _ACCOUNT.code,product_code
|
||||
) as s1
|
||||
full outer join
|
||||
(select a.CODE,
|
||||
a.CODE,
|
||||
a.NAME,
|
||||
a.product_code,
|
||||
a.qty_in,
|
||||
coalesce(a.product_code,b.product_code) as productcode,
|
||||
a.qty_in,
|
||||
val_in,
|
||||
b.qty_out,
|
||||
val_out
|
||||
@@ -395,11 +489,11 @@ group by _ACCOUNT.code,product_code
|
||||
_PRODUCT.CODE as product_code,
|
||||
sum(real_qty) as qty_in,
|
||||
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.wap_price,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,2) * _line.real_qty
|
||||
else 0 end) val_in
|
||||
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 BASE_PRODUCT _PRODUCT ON _PRODUCT.ID = _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 _MOVE.type_select = 3
|
||||
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
|
||||
_ACCOUNT.CODE,
|
||||
_ACCOUNT.NAME,
|
||||
_PRODUCT.CODE as product_code,
|
||||
sum(real_qty) as qty_out,
|
||||
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
|
||||
from account_accounting_report AccountingReport
|
||||
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.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
|
||||
order by a.code) as s2 on s1.product_code = s2.product_code
|
||||
where account_code like '3%']]></xml-property>
|
||||
order by a.code)
|
||||
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 extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="AccountingReportDS" id="489">
|
||||
<property name="nullsOrdering">nulls lowest</property>
|
||||
@@ -1735,7 +1837,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
</structure>
|
||||
<structure>
|
||||
<property name="name">sumSoldeQtyAgg</property>
|
||||
<text-property name="displayName">sumSoldeQty</text-property>
|
||||
<text-property name="displayName">sumSoldeVal</text-property>
|
||||
<property name="dataType">float</property>
|
||||
<simple-property-list name="aggregateOn">
|
||||
<value>NewTableGroup1</value>
|
||||
@@ -1749,9 +1851,136 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
</list-property>
|
||||
<property name="allowExport">true</property>
|
||||
</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>
|
||||
<column id="4664"/>
|
||||
<column id="4665"/>
|
||||
<column id="5142"/>
|
||||
<column id="4666"/>
|
||||
<column id="4667"/>
|
||||
<column id="4668"/>
|
||||
@@ -1795,6 +2024,22 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<text-property name="text">CODE PRODUIT</text-property>
|
||||
</label>
|
||||
</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">
|
||||
<property name="colSpan">2</property>
|
||||
<property name="rowSpan">1</property>
|
||||
@@ -1810,7 +2055,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<label id="4678">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">12pt</property>
|
||||
<text-property name="text">INITIALE</text-property>
|
||||
<text-property name="text">INITIAL</text-property>
|
||||
</label>
|
||||
</cell>
|
||||
<cell id="4630">
|
||||
@@ -1846,7 +2091,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<label id="5081">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">12pt</property>
|
||||
<text-property name="text">SOLDE</text-property>
|
||||
<text-property name="text">SOLDE FINAL</text-property>
|
||||
</label>
|
||||
</cell>
|
||||
</row>
|
||||
@@ -1874,6 +2119,17 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderTopWidth">thin</property>
|
||||
<property name="verticalAlign">middle</property>
|
||||
</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">
|
||||
<property name="borderBottomStyle">solid</property>
|
||||
<property name="borderBottomWidth">thin</property>
|
||||
@@ -2023,6 +2279,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
</data>
|
||||
</cell>
|
||||
<cell id="5086"/>
|
||||
<cell id="5138"/>
|
||||
<cell id="5087"/>
|
||||
<cell id="5088"/>
|
||||
<cell id="5089"/>
|
||||
@@ -2050,13 +2307,19 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderTopStyle">solid</property>
|
||||
<property name="borderTopWidth">thin</property>
|
||||
</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">
|
||||
<property name="borderBottomStyle">solid</property>
|
||||
<property name="borderBottomWidth">thin</property>
|
||||
<property name="borderTopStyle">solid</property>
|
||||
<property name="borderTopWidth">thin</property>
|
||||
<data id="5105">
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="fontSize">8pt</property>
|
||||
<property name="fontWeight">bold</property>
|
||||
<structure name="numberFormat">
|
||||
<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="borderTopWidth">thin</property>
|
||||
<data id="5106">
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="fontSize">8pt</property>
|
||||
<property name="fontWeight">bold</property>
|
||||
<structure name="numberFormat">
|
||||
<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="borderTopWidth">thin</property>
|
||||
<data id="5107">
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="fontSize">8pt</property>
|
||||
<property name="fontWeight">bold</property>
|
||||
<structure name="numberFormat">
|
||||
<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="borderTopWidth">thin</property>
|
||||
<data id="5128">
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="fontSize">8pt</property>
|
||||
<property name="fontWeight">bold</property>
|
||||
<structure name="numberFormat">
|
||||
<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="borderTopWidth">thin</property>
|
||||
<data id="5129">
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="fontSize">8pt</property>
|
||||
<property name="fontWeight">bold</property>
|
||||
<structure name="numberFormat">
|
||||
<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="borderTopWidth">thin</property>
|
||||
<data id="5130">
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="fontSize">8pt</property>
|
||||
<property name="fontWeight">bold</property>
|
||||
<structure name="numberFormat">
|
||||
<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="borderTopStyle">solid</property>
|
||||
<property name="borderTopWidth">thin</property>
|
||||
<data id="5131">
|
||||
<property name="fontSize">9pt</property>
|
||||
<data id="5135">
|
||||
<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>
|
||||
<property name="resultSetColumn">Aggregation_6</property>
|
||||
</data>
|
||||
</cell>
|
||||
<cell id="5111">
|
||||
@@ -2169,6 +2432,16 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderRightWidth">thin</property>
|
||||
<property name="borderTopStyle">solid</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>
|
||||
</row>
|
||||
</footer>
|
||||
@@ -2186,6 +2459,7 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderTopWidth">thin</property>
|
||||
<data id="4642">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="resultSetColumn">account_code</property>
|
||||
</data>
|
||||
</cell>
|
||||
@@ -2200,9 +2474,25 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderTopWidth">thin</property>
|
||||
<data id="4640">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="resultSetColumn">product_code</property>
|
||||
</data>
|
||||
</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">
|
||||
<property name="borderBottomStyle">solid</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="borderTopWidth">thin</property>
|
||||
<data id="4644">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<structure name="numberFormat">
|
||||
<property name="category">Currency</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="borderTopWidth">thin</property>
|
||||
<data id="4646">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<structure name="numberFormat">
|
||||
<property name="category">Currency</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="borderTopWidth">thin</property>
|
||||
<data id="4648">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<structure name="numberFormat">
|
||||
<property name="category">Currency</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="borderTopWidth">thin</property>
|
||||
<data id="4650">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<structure name="numberFormat">
|
||||
<property name="category">Currency</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="borderTopWidth">thin</property>
|
||||
<data id="4652">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<structure name="numberFormat">
|
||||
<property name="category">Currency</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="borderTopWidth">thin</property>
|
||||
<data id="4654">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<structure name="numberFormat">
|
||||
<property name="category">Currency</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="borderTopWidth">thin</property>
|
||||
<text id="5082">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="textAlign">right</property>
|
||||
<property name="dataSet">MoveLineDS</property>
|
||||
<list-property name="boundDataColumns">
|
||||
@@ -2357,6 +2661,8 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderTopStyle">solid</property>
|
||||
<property name="borderTopWidth">thin</property>
|
||||
<text id="5114">
|
||||
<property name="fontFamily">"Tw Cen MT"</property>
|
||||
<property name="fontSize">9pt</property>
|
||||
<property name="textAlign">right</property>
|
||||
<property name="dataSet">MoveLineDS</property>
|
||||
<list-property name="boundDataColumns">
|
||||
@@ -2407,6 +2713,16 @@ where LangTranslate.message_key = ? and LangTranslate.language = ?]]></xml-prope
|
||||
<property name="borderTopStyle">solid</property>
|
||||
<property name="borderTopWidth">thin</property>
|
||||
</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">
|
||||
<property name="borderBottomStyle">solid</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="borderTopStyle">solid</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 id="4659">
|
||||
<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="borderTopStyle">solid</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 id="4660">
|
||||
<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="borderTopStyle">solid</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 id="4661">
|
||||
<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="borderTopStyle">solid</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 id="4662">
|
||||
<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="borderTopStyle">solid</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 id="4663">
|
||||
<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="borderTopStyle">solid</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 id="5079">
|
||||
<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="borderTopStyle">solid</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 id="5112">
|
||||
<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="borderTopStyle">solid</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>
|
||||
</row>
|
||||
</footer>
|
||||
|
||||
@@ -285,7 +285,9 @@
|
||||
<xml-property name="queryText"><![CDATA[SELECT
|
||||
account_journal.code,
|
||||
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(credit) as credit
|
||||
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 join account_journal on account_journal.id = Move.journal
|
||||
where
|
||||
(AccountingReport.date_from IS NULL OR MoveLine.origin_date >= AccountingReport.date_from) AND
|
||||
(AccountingReport.date_to IS NULL OR MoveLine.origin_date <= AccountingReport.date_to) AND
|
||||
MoveLine.origin_date <= AccountingReport.date_val
|
||||
AND Move.company = AccountingReport.company and Move.status_select = 3
|
||||
(AccountingReport.date_from IS NULL OR MoveLine.date_val >= AccountingReport.date_from) AND
|
||||
(AccountingReport.date_to IS NULL OR MoveLine.date_val <= AccountingReport.date_to) AND
|
||||
MoveLine.date_val <= AccountingReport.date_val
|
||||
AND Move.company = AccountingReport.company and Move.status_select = 3
|
||||
group by
|
||||
to_char(origin_date ,'YYYY-MM'),
|
||||
to_char(MoveLine.date_val ,'YYYY-MM'),
|
||||
account_journal.code,
|
||||
account_journal.name
|
||||
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 extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="AccountingReportDS" id="489">
|
||||
<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="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.password" value="" />
|
||||
<property name="javax.persistence.jdbc.user" value="postgres" />
|
||||
<property name="javax.persistence.jdbc.password" value="root" />
|
||||
|
||||
<!--
|
||||
value="create" to build a new database on each run;
|
||||
|
||||
Reference in New Issue
Block a user