use of com.axelor.apps.account.db.PaymentScheduleLine in project axelor-open-suite by axelor.
the class CfonbExportService method exportPaymentScheduleCFONB.
/**
* Méthode permettant d'exporter les prélèvements d'échéance de mensu au format CFONB
*
* @param paymentScheduleExport
* @param paymentScheduleLineList
* @param company
* @throws AxelorException
*/
public void exportPaymentScheduleCFONB(ZonedDateTime processingDateTime, LocalDate scheduleDate, List<PaymentScheduleLine> paymentScheduleLineList, Company company, BankDetails bankDetails) throws AxelorException {
if (paymentScheduleLineList == null || paymentScheduleLineList.isEmpty()) {
return;
}
this.testCompanyExportCFONBField(company);
// paramètre obligatoire : au minimum
// un enregistrement emetteur par date de règlement (code 03)
// un enregistrement destinataire (code 06)
// un enregistrement total (code 08)
String senderCFONB = this.createSenderMonthlyExportCFONB(scheduleDate, bankDetails);
List<String> multiRecipientCFONB = new ArrayList<String>();
for (PaymentScheduleLine paymentScheduleLine : paymentScheduleLineList) {
paymentScheduleLine = paymentScheduleLineRepo.find(paymentScheduleLine.getId());
multiRecipientCFONB.add(this.createRecipientCFONB(paymentScheduleLine, true));
}
String totalCFONB = this.createPaymentScheduleTotalCFONB(company, this.getTotalAmountPaymentSchedule(paymentScheduleLineList));
// cfonbToolService.testLength(senderCFONB, totalCFONB, multiRecipientCFONB, company);
// List<String> cFONB = this.createCFONBExport(senderCFONB, multiRecipientCFONB, totalCFONB);
// Mise en majuscule des enregistrement
// cFONB = this.toUpperCase(cFONB);
// this.createCFONBFile(cFONB, processingDateTime,
// company.getAccountConfig().getPaymentScheduleExportFolderPathCFONB(), "prelevement");
}
use of com.axelor.apps.account.db.PaymentScheduleLine in project axelor-open-suite by axelor.
the class PaymentScheduleLineServiceImpl method createPaymentScheduleLines.
/**
* En fonction des infos d'entête d'un échéancier, crée les lignes d'échéances
*
* @param paymentSchedule
*/
@Override
public List<PaymentScheduleLine> createPaymentScheduleLines(PaymentSchedule paymentSchedule) {
List<PaymentScheduleLine> paymentScheduleLines = new ArrayList<PaymentScheduleLine>();
int nbrTerm = paymentSchedule.getNbrTerm();
BigDecimal inTaxAmount = paymentSchedule.getInTaxAmount();
log.debug("Création de lignes pour l'échéancier numéro {} (nombre d'échéance : {}, montant : {})", new Object[] { paymentSchedule.getPaymentScheduleSeq(), nbrTerm, inTaxAmount });
if (nbrTerm > 0 && inTaxAmount.compareTo(BigDecimal.ZERO) == 1) {
BigDecimal termAmount = inTaxAmount.divide(new BigDecimal(nbrTerm), 2, RoundingMode.HALF_UP);
BigDecimal cumul = BigDecimal.ZERO;
for (int i = 1; i < nbrTerm + 1; i++) {
if (i == nbrTerm) {
termAmount = inTaxAmount.subtract(cumul);
} else {
cumul = cumul.add(termAmount);
}
paymentScheduleLines.add(this.createPaymentScheduleLine(paymentSchedule, termAmount, i, paymentSchedule.getStartDate().plusMonths(i - 1)));
}
}
return paymentScheduleLines;
}
use of com.axelor.apps.account.db.PaymentScheduleLine in project axelor-open-suite by axelor.
the class PaymentScheduleLineServiceImpl method createPaymentScheduleLine.
/**
* Création d'une ligne d'échéancier
*
* @param paymentSchedule L'échéancié attaché.
* @param inTaxAmount Le montant TTC.
* @param scheduleLineSeq Le numéro d'échéance.
* @param scheduleDate La date d'échéance.
* @return
*/
@Override
public PaymentScheduleLine createPaymentScheduleLine(PaymentSchedule paymentSchedule, BigDecimal inTaxAmount, int scheduleLineSeq, LocalDate scheduleDate) {
PaymentScheduleLine paymentScheduleLine = new PaymentScheduleLine();
paymentScheduleLine.setScheduleLineSeq(scheduleLineSeq);
paymentScheduleLine.setScheduleDate(scheduleDate);
paymentScheduleLine.setInTaxAmount(inTaxAmount);
paymentScheduleLine.setStatusSelect(PaymentScheduleLineRepository.STATUS_DRAFT);
if (paymentSchedule != null) {
paymentSchedule.addPaymentScheduleLineListItem(paymentScheduleLine);
}
log.debug("Création de la ligne de l'échéancier numéro {} pour la date du {} et la somme de {}", new Object[] { paymentScheduleLine.getScheduleLineSeq(), paymentScheduleLine.getScheduleDate(), paymentScheduleLine.getInTaxAmount() });
return paymentScheduleLine;
}
use of com.axelor.apps.account.db.PaymentScheduleLine in project axelor-open-suite by axelor.
the class PaymentScheduleServiceImpl method closePaymentSchedule.
/**
* Méthode permettant de passer les statuts des lignes d'échéances et de l'échéancier à 'clo' ie
* cloturé
*
* @param paymentSchedule
* @throws AxelorException
*/
@Override
public void closePaymentSchedule(PaymentSchedule paymentSchedule) throws AxelorException {
log.debug("Cloture de l'échéancier");
for (PaymentScheduleLine paymentScheduleLine : paymentSchedule.getPaymentScheduleLineList()) {
paymentScheduleLine.setStatusSelect(PaymentScheduleLineRepository.STATUS_CLOSED);
}
paymentSchedule.setStatusSelect(PaymentScheduleRepository.STATUS_CLOSED);
}
use of com.axelor.apps.account.db.PaymentScheduleLine in project axelor-open-suite by axelor.
the class PaymentScheduleServiceImpl method getInvoiceTermTotal.
/**
* Obtenir le total des factures des lignes d'un échéancier.
*
* @param paymentSchedule L'échéancier cible.
* @return Le somme des montants TTC des lignes de l'échéancier.
*/
@Override
public BigDecimal getInvoiceTermTotal(PaymentSchedule paymentSchedule) {
BigDecimal totalAmount = BigDecimal.ZERO;
if (paymentSchedule != null && paymentSchedule.getPaymentScheduleLineList() != null && !paymentSchedule.getPaymentScheduleLineList().isEmpty()) {
for (PaymentScheduleLine paymentScheduleLine : paymentSchedule.getPaymentScheduleLineList()) {
if (paymentScheduleLine.getInTaxAmount() != null) {
log.debug("Somme TTC des lignes de l'échéancier {} : total = {}, ajout = {}", new Object[] { paymentSchedule.getPaymentScheduleSeq(), totalAmount, paymentScheduleLine.getInTaxAmount() });
totalAmount = totalAmount.add(paymentScheduleLine.getInTaxAmount());
}
}
}
log.debug("Obtention de la somme TTC des lignes de l'échéancier {} : {}", new Object[] { paymentSchedule.getPaymentScheduleSeq(), totalAmount });
return totalAmount;
}
Aggregations