generating multiple factures from the backend in apercustoutesfacture, update facture date echeance to take the last day of next month

This commit is contained in:
Tiavina 2025-01-06 11:52:58 +03:00
parent 5ff78abe2c
commit b875c3466c
5 changed files with 42 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -110,8 +110,8 @@ class InvoicePdfHandler extends FPDF {
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
$factureDateEcheance = $factureDatePaiement;
$factureDatePaiement = $factureDatePaiement->format('d-m-Y');
$factureDateEcheance->modify('+1 month');
$factureDateEcheance = $factureDateEcheance->format('t-m-Y');
$factureDateEcheance->modify('last day of next month');
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
$this->SetFont('Arial', 'B', 11);
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C');

View File

@ -4,22 +4,23 @@ import "../css/mycss.css";
import { globalConfiguration } from "./modules/mainFunction.mjs";
import "./listener/main_listener";
import "./listener/invoiceListener";
import { getPDF } from "./pdf";
import { saveDocumentRecap } from "./modules/ajaxRequest.mjs";
window.addEventListener("DOMContentLoaded", function () {
globalConfiguration();
var pdf = document.getElementById("pdfFactures");
pdf.addEventListener("click",async ()=>{
getPDF('facture');
});
// var pdf = document.getElementById("pdfFactures");
// pdf.addEventListener("click",async ()=>{
// getPDF('facture');
// });
var documentRecap = document.getElementById("documentrecap");
documentRecap.addEventListener("click", async ()=> {
// Get the URL parameters
const urlParams = new URLSearchParams(window.location.search);
// Access specific parameter values
const idclient = urlParams.get('cli');
const annee = urlParams.get('annee');

View File

@ -0,0 +1,32 @@
import {showError, showSuccess } from "@nextcloud/dialogs";
import {baseUrl} from "../modules/mainFunction.mjs";
$('body').on('click', '#exportMultipleFactureToPdf', function () {
// Access specific parameter values
const urlParams = new URLSearchParams(window.location.search);
const clientId = urlParams.get('cli');
const year = urlParams.get('annee');
const month = urlParams.get('mois');
var exportMultipleFacturePayload = {
clientId : clientId,
month : month,
year : year
};
$.ajax({
url: baseUrl + '/facture/exportFactureByClientAndMonthYearToPdf',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(exportMultipleFacturePayload)
}).done(function (response) {
var fileName = response;
if(fileName != null){
showSuccess('Sauvegardé dans' + fileName);
return;
}
showError(t('gestion', "Les données pour sauvegarde sont vides"));
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans la génération de facture multiple"));
});
});

View File

@ -58,7 +58,7 @@
if(sizeof($factures)>0) {
?>
<?php if($showRecapButton) {?><button class="btn btn-secondary" type="button" id="documentrecap">Generer le document recapitulatif</button><?php }?>
<button class="btn btn-secondary ml-2" type="button" id="pdfFactures"><?php p($l->t('Save in Nextcloud'));?></button>
<button class="btn btn-secondary ml-2" type="button" id="exportMultipleFactureToPdf"><?php p($l->t('Save in Nextcloud'));?></button>
<?php
}
}