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:
parent
5ff78abe2c
commit
b875c3466c
File diff suppressed because one or more lines are too long
@ -110,8 +110,8 @@ class InvoicePdfHandler extends FPDF {
|
|||||||
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
|
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
|
||||||
$factureDateEcheance = $factureDatePaiement;
|
$factureDateEcheance = $factureDatePaiement;
|
||||||
$factureDatePaiement = $factureDatePaiement->format('d-m-Y');
|
$factureDatePaiement = $factureDatePaiement->format('d-m-Y');
|
||||||
$factureDateEcheance->modify('+1 month');
|
$factureDateEcheance->modify('last day of next month');
|
||||||
$factureDateEcheance = $factureDateEcheance->format('t-m-Y');
|
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
|
||||||
$this->SetFont('Arial', 'B', 11);
|
$this->SetFont('Arial', 'B', 11);
|
||||||
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
|
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
|
||||||
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C');
|
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C');
|
||||||
|
|||||||
@ -4,16 +4,17 @@ import "../css/mycss.css";
|
|||||||
|
|
||||||
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
||||||
import "./listener/main_listener";
|
import "./listener/main_listener";
|
||||||
|
import "./listener/invoiceListener";
|
||||||
import { getPDF } from "./pdf";
|
import { getPDF } from "./pdf";
|
||||||
import { saveDocumentRecap } from "./modules/ajaxRequest.mjs";
|
import { saveDocumentRecap } from "./modules/ajaxRequest.mjs";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", function () {
|
window.addEventListener("DOMContentLoaded", function () {
|
||||||
globalConfiguration();
|
globalConfiguration();
|
||||||
|
|
||||||
var pdf = document.getElementById("pdfFactures");
|
// var pdf = document.getElementById("pdfFactures");
|
||||||
pdf.addEventListener("click",async ()=>{
|
// pdf.addEventListener("click",async ()=>{
|
||||||
getPDF('facture');
|
// getPDF('facture');
|
||||||
});
|
// });
|
||||||
|
|
||||||
var documentRecap = document.getElementById("documentrecap");
|
var documentRecap = document.getElementById("documentrecap");
|
||||||
documentRecap.addEventListener("click", async ()=> {
|
documentRecap.addEventListener("click", async ()=> {
|
||||||
|
|||||||
32
gestion/src/js/listener/invoiceListener.js
Normal file
32
gestion/src/js/listener/invoiceListener.js
Normal 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"));
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@ -58,7 +58,7 @@
|
|||||||
if(sizeof($factures)>0) {
|
if(sizeof($factures)>0) {
|
||||||
?>
|
?>
|
||||||
<?php if($showRecapButton) {?><button class="btn btn-secondary" type="button" id="documentrecap">Generer le document recapitulatif</button><?php }?>
|
<?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
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user