finish releve facture defunt name and client name, line width of recap, wip add configuration adresse in recap and and column in recap

This commit is contained in:
Tiavina 2025-02-04 11:30:11 +03:00
parent 37d70487d1
commit 50fa15de9e
28 changed files with 83 additions and 86 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -324,44 +324,19 @@ class Bdd {
return $this->execSQL($sql, array()); return $this->execSQL($sql, array());
} }
private function getClientsWithClientGroupDetails(){ private function getClientsWithClientType(){
$sql = "SELECT * FROM ".$this->tableprefix."client as client;"; $sql = "SELECT client.*,'client' as client_type FROM ".$this->tableprefix."client as client;";
$clientsGroupedByClientEntreprise = $this->execSQLNoJsonReturn($sql,[]); $clientsWithClientType = $this->execSQLNoJsonReturn($sql,[]);
foreach($clientsGroupedByClientEntreprise as &$client){ return $clientsWithClientType;
if($client['fk_client_group_id'] == null){
$client['client_group_name'] = '';
}
else{
$clientGroup = $this->getClientGroupById($client['fk_client_group_id']);
$client['client_group_name'] = $clientGroup != null ? $clientGroup['client_group_name'] : '';
}
$client['client_type'] = MultipleFactureTypeConstant::CLIENT_FILTER_TYPE;
}
return $clientsGroupedByClientEntreprise;
} }
public function getClientsAndClientGroupFacturations(){ public function getClientsAndClientGroupFacturations(){
$clients = $this->getClientsWithClientGroupDetails(); $clients = $this->getClientsWithClientType();
$clientGroupFacturations = $this->getClientGroupFacturationsWithType(); $clientGroupFacturations = $this->getClientGroupFacturationsWithType();
$result = [...$clientGroupFacturations,...$clients]; $result = [...$clientGroupFacturations,...$clients];
return json_encode($result); return json_encode($result);
} }
public function getClientsGroupedByClientEntreprise(){
$sql = "SELECT * FROM ".$this->tableprefix."client as client GROUP BY client.entreprise;";
$clientsGroupedByClientEntreprise = $this->execSQLNoJsonReturn($sql,[]);
foreach($clientsGroupedByClientEntreprise as &$client){
if($client['fk_client_group_id'] == null){
$client['client_group_name'] = '';
}
else{
$clientGroup = $this->getClientGroupById($client['fk_client_group_id']);
$client['client_group_name'] = $clientGroup != null ? $clientGroup['client_group_name'] : '';
}
}
return json_encode($clientsGroupedByClientEntreprise);
}
public function getFactures($idNextcloud){ public function getFactures($idNextcloud){
$sql = "SELECT ".$this->tableprefix."facture.id, ".$this->tableprefix."facture.user_id, ".$this->tableprefix."facture.num, ".$this->tableprefix."facture.date, " $sql = "SELECT ".$this->tableprefix."facture.id, ".$this->tableprefix."facture.user_id, ".$this->tableprefix."facture.num, ".$this->tableprefix."facture.date, "
.$this->tableprefix."facture.fk_facture_status_key, ".$this->tableprefix."facture.fk_facture_payment_type_id, ".$this->tableprefix."facture.payment_date, " .$this->tableprefix."facture.fk_facture_status_key, ".$this->tableprefix."facture.fk_facture_payment_type_id, ".$this->tableprefix."facture.payment_date, "
@ -416,7 +391,7 @@ class Bdd {
LEFT JOIN ".$this->tableprefix."defunt on ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id LEFT JOIN ".$this->tableprefix."defunt on ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
LEFT JOIN ".$this->tableprefix."client_group_facturation on ".$this->tableprefix."client.fk_client_group_facturation_id = ".$this->tableprefix."client_group_facturation.id LEFT JOIN ".$this->tableprefix."client_group_facturation on ".$this->tableprefix."client.fk_client_group_facturation_id = ".$this->tableprefix."client_group_facturation.id
WHERE YEAR(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[2]." AND MONTH(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[1]." WHERE YEAR(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[2]." AND MONTH(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[1]."
AND ".$this->tableprefix."client.id IN($clientIdsSqlPlaceholder) ORDER BY year DESC, month DESC;"; AND ".$this->tableprefix."client.id IN($clientIdsSqlPlaceholder) ORDER BY date_soin ASC";
$result = $this->execSQL( $result = $this->execSQL(
sql: $sql, sql: $sql,
conditions: $clientIdList ); conditions: $clientIdList );

View File

@ -161,6 +161,7 @@ class InvoiceRecapService {
} catch(\OCP\Files\NotPermittedException $e) { } } catch(\OCP\Files\NotPermittedException $e) { }
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetLineWidth(0.2);
// on sup les 2 cm en bas // on sup les 2 cm en bas
$pdf->SetAutoPagebreak(False); $pdf->SetAutoPagebreak(False);
$pdf->SetMargins(0,0,0); $pdf->SetMargins(0,0,0);
@ -335,9 +336,13 @@ class InvoiceRecapService {
$pdf->SetFont('ComicSans','',8); $pdf->SetXY( 168, 225 ); $pdf->Cell( 10, 8, number_format($montant_tva_total,2,'.','').chr(128), 0, 0, 'C'); $pdf->SetFont('ComicSans','',8); $pdf->SetXY( 168, 225 ); $pdf->Cell( 10, 8, number_format($montant_tva_total,2,'.','').chr(128), 0, 0, 'C');
$pdf->SetFont('ComicSans','',8); $pdf->SetXY( 183, 225 ); $pdf->Cell( 22, 8, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C'); $pdf->SetFont('ComicSans','',8); $pdf->SetXY( 183, 225 ); $pdf->Cell( 22, 8, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C');
$pdf->Rect(145, 233, 60, 7, "D");
$pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 147, 233 ); $pdf->Cell( 30, 6.5, 'TOTAL TTC', 0, 0, 'C'); $pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 147, 233 ); $pdf->Cell( 30, 6.5, 'TOTAL TTC', 0, 0, 'C');
$pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 183, 233 ); $pdf->Cell( 22, 6.5, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C', true); $pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 183, 233 ); $pdf->Cell( 22, 6.5, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C', true);
$pdf->Line(145, 233, 145, 240);
$pdf->Line(183, 233, 183, 240);
$pdf->Line(183, 233, 205, 233);
$pdf->Line(205, 233, 205, 240);
$pdf->Line(145, 240, 205, 240);
} }
$y1 = 245; $y1 = 245;
@ -474,6 +479,7 @@ class InvoiceRecapService {
} catch(\OCP\Files\NotPermittedException $e) { } } catch(\OCP\Files\NotPermittedException $e) { }
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetLineWidth(0.2);
// on sup les 2 cm en bas // on sup les 2 cm en bas
$pdf->SetAutoPagebreak(False); $pdf->SetAutoPagebreak(False);
$pdf->SetMargins(0,0,10); $pdf->SetMargins(0,0,10);
@ -585,7 +591,7 @@ class InvoiceRecapService {
$pdf->Cell( 0, 8,"Saint Senoux, le ".utf8_decode($date_formated), 0, 0, 'R'); $pdf->Cell( 0, 8,"Saint Senoux, le ".utf8_decode($date_formated), 0, 0, 'R');
// n° facture, date echeance et reglement et obs // n° facture, date echeance et reglement et obs
$pdf->SetLineWidth(0.2); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF"); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF");
$pdf->SetXY( 114, 20 ); $pdf->SetFont( "ComicSans", "B", 12 ); $pdf->Cell( 85, 8, 'FACTURE N'.utf8_decode('°').' FAC/'.$key_annee.'/'.strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])), 0, 0, 'C'); $pdf->SetXY( 114, 20 ); $pdf->SetFont( "ComicSans", "B", 12 ); $pdf->Cell( 85, 8, 'FACTURE N'.utf8_decode('°').' FAC/'.$key_annee.'/'.strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])), 0, 0, 'C');
// adresse du facture // adresse du facture
@ -603,13 +609,19 @@ class InvoiceRecapService {
// le cadre des articles // le cadre des articles
// *********************** // ***********************
// cadre avec 18 lignes max ! et 118 de hauteur --> 80 + 118 = 198 pour les traits verticaux // cadre avec 18 lignes max ! et 118 de hauteur --> 80 + 118 = 198 pour les traits verticaux
$pdf->SetLineWidth(0.2); $pdf->Rect(5, 80, 200, 153, "D"); $pdf->Rect(5, 80, 200, 153, "DF");
// cadre titre des colonnes // cadre titre des colonnes
$pdf->Line(5, 90, 205, 90); $pdf->Line(5, 90, 205, 90);
// les traits verticaux colonnes // les traits verticaux colonnes
$pdf->Line(145, 80, 145, 233); $pdf->Line(163, 80, 163, 233); $pdf->Line(145, 80, 145, 233);
if($num_page == $nb_page) $pdf->Line(183, 80, 183, 240); $pdf->Line(163, 80, 163, 233);
else $pdf->Line(183, 80, 183, 233); if($num_page == $nb_page){
$pdf->Line(183, 80, 183, 240);
}
else{
$pdf->Line(183, 80, 183, 233);
}
// titre colonne // titre colonne
$pdf->SetXY( 1, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 140, 8, "OBJET", 0, 0, 'C'); $pdf->SetXY( 1, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 140, 8, "OBJET", 0, 0, 'C');
$pdf->SetXY( 147, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 13, 8, "H.T.", 0, 0, 'C'); $pdf->SetXY( 147, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 13, 8, "H.T.", 0, 0, 'C');
@ -652,15 +664,20 @@ class InvoiceRecapService {
// si derniere page alors afficher cadre des TVA // si derniere page alors afficher cadre des TVA
if ($num_page == $nb_page) if ($num_page == $nb_page)
{ {
$pdf->Line(5, 225, 205, 225); $pdf->Line(5, 225, 205, 225);
$pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 5, 225 ); $pdf->Cell( 140, 8, 'TOTAL', 0, 0, 'C'); $pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 5, 225 ); $pdf->Cell( 140, 8, 'TOTAL', 0, 0, 'C');
$pdf->SetFont('ComicSans','',8); $pdf->SetXY( 147, 225 ); $pdf->Cell( 13, 8, number_format($montant_ht_total,2,'.','').chr(128), 0, 0, 'C'); $pdf->SetFont('ComicSans','',8); $pdf->SetXY( 147, 225 ); $pdf->Cell( 13, 8, number_format($montant_ht_total,2,'.','').chr(128), 0, 0, 'C');
$pdf->SetFont('ComicSans','',8); $pdf->SetXY( 168, 225 ); $pdf->Cell( 10, 8, number_format($montant_tva_total,2,'.','').chr(128), 0, 0, 'C'); $pdf->SetFont('ComicSans','',8); $pdf->SetXY( 168, 225 ); $pdf->Cell( 10, 8, number_format($montant_tva_total,2,'.','').chr(128), 0, 0, 'C');
$pdf->SetFont('ComicSans','',8); $pdf->SetXY( 183, 225 ); $pdf->Cell( 22, 8, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C'); $pdf->SetFont('ComicSans','',8); $pdf->SetXY( 183, 225 ); $pdf->Cell( 22, 8, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C');
$pdf->Rect(145, 233, 60, 7, "D");
$pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 147, 233 ); $pdf->Cell( 30, 6.5, 'TOTAL TTC', 0, 0, 'C'); $pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 147, 233 ); $pdf->Cell( 30, 6.5, 'TOTAL TTC', 0, 0, 'C');
$pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 183, 233 ); $pdf->Cell( 22, 6.5, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C', true); $pdf->SetFont('ComicSans','B',8); $pdf->SetXY( 183, 233 ); $pdf->Cell( 22, 6.5, number_format($montant_ttc_total,2,'.','').chr(128), 0, 0, 'C', true);
$pdf->Line(145, 233, 145, 240);
$pdf->Line(183, 233, 183, 240);
$pdf->Line(183, 233, 205, 233);
$pdf->Line(205, 233, 205, 240);
$pdf->Line(145, 240, 205, 240);
} }
$y1 = 245; $y1 = 245;

View File

@ -15,18 +15,20 @@ window.addEventListener("DOMContentLoaded", function () {
$('#clientselector').select2(); $('#clientselector').select2();
var documentRecap = document.getElementById("documentrecap"); var documentRecap = document.getElementById("documentrecap");
documentRecap.addEventListener("click", async ()=> { if(documentRecap){
const urlParams = new URLSearchParams(window.location.search); documentRecap.addEventListener("click", async ()=> {
const filter = urlParams.get('cli'); const urlParams = new URLSearchParams(window.location.search);
const year = urlParams.get('annee'); const filter = urlParams.get('cli');
const month = urlParams.get('mois'); const year = urlParams.get('annee');
const filterType = urlParams.get('filterType') ?? 'client'; const month = urlParams.get('mois');
const filterType = urlParams.get('filterType') ?? 'client';
saveDocumentRecap({
filter: filter, saveDocumentRecap({
year: year, filter: filter,
month: month, year: year,
filterType: filterType month: month,
}); filterType: filterType
}) });
})
}
}); });

View File

@ -7,7 +7,9 @@ window.addEventListener("DOMContentLoaded", function () {
const today = new Date(); const today = new Date();
const formattedDate = today.toISOString().split('T')[0]; const formattedDate = today.toISOString().split('T')[0];
const dateInput = document.getElementById('facturePaymentDate'); const dateInput = document.getElementById('facturePaymentDate');
dateInput.value = formattedDate; if(dateInput){
dateInput.value = formattedDate;
}
}); });
$('body').on('click', '#showFacturePaymentModal', function () { $('body').on('click', '#showFacturePaymentModal', function () {
@ -106,15 +108,15 @@ $('body').on('click', '#exportMultipleFactureToPdf', function () {
}); });
let clientSelector = document.getElementById('clientselector'); document.onchange = function(event) {
if (clientSelector) { if (event.target && event.target.id === 'clientselector') {
clientSelector.addEventListener('change', function() { let selectedOption = event.target.options[event.target.selectedIndex];
let selectedOption = this.options[this.selectedIndex];
let filterType = selectedOption.getAttribute('data-type'); let filterType = selectedOption.getAttribute('data-type');
let filterTypeInput = document.getElementById('filterType'); let filterTypeInput = document.getElementById('filterType');
console.log("filterTypeInput", filterTypeInput);
if (filterTypeInput) { if (filterTypeInput) {
filterTypeInput.value = filterType; filterTypeInput.value = filterType;
} }
}); }
} };

View File

@ -122,7 +122,8 @@ document.body.addEventListener('click', e => {
} else if("saveIk" == e.target.id) { } else if("saveIk" == e.target.id) {
TrajetDetails.saveIkNextcloud(); TrajetDetails.saveIkNextcloud();
} else if("apercusFactures" === e.target.id) { } else if("apercusFactures" === e.target.id) {
let url = generateUrl(`/apps/gestion/factures/apercus?cli=&annee=${(new Date()).getFullYear()}&mois=${(new Date()).getMonth()}&filterType=client`); let url = generateUrl(`/apps/gestion/factures/apercus?cli=&annee=${(new Date()).getFullYear()}&mois=${(new Date()).getMonth()}&filterType=group`);
console.log(url);
window.location.replace(url); window.location.replace(url);
} else if("apercusDevis" === e.target.id) { } else if("apercusDevis" === e.target.id) {
window.location.replace(generateUrl(`/apps/gestion/devis/apercus?cli=&annee=${(new Date()).getFullYear()}&mois=${(new Date()).getMonth()}`)); window.location.replace(generateUrl(`/apps/gestion/devis/apercus?cli=&annee=${(new Date()).getFullYear()}&mois=${(new Date()).getMonth()}`));

View File

@ -120,15 +120,15 @@
?> ?>
</div> </div>
<div class="col-5 h-100 m-0" style="min-height:250px;"> <div class="col-5 h-100 m-0" style="min-height:250px;">
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO'));?> <span id="entreprise"><?php echo $facture->entreprise ?></span></h6> <h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO'));?> <span id="entreprise"><?php echo $facture->nom ?></span></h6>
<p class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark"> <p class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark">
<span id="nomprenom" data-id="0" data-table="devis" data-column="id_client"><?php echo $facture->prenom.' '.$facture->nom ?></span><br /> <span id="nomprenom" data-id="0" data-table="devis" data-column="id_client"><?php echo $facture->nom ?></span><br />
<span id="adresse"><?php echo $facture->adresse_cli ?></span><br /> <span id="adresse"><?php echo $facture->adresse_cli ?></span><br />
<span id="mail"><?php echo $facture->mail_cli ?></span><br /> <span id="mail"><?php echo $facture->mail_cli ?></span><br />
<span id="telephone"><?php echo $facture->telephone_cli ?></span><br /> <span id="telephone"><?php echo $facture->telephone_cli ?></span><br />
<span id="legal_one"><?php echo $facture->legalone_cli ?></span><br /> <span id="legal_one"><?php echo $facture->legalone_cli ?></span><br />
<span id="dateContext" style="display: none"><?php echo $facture->date ?></span> <span id="dateContext" style="display: none"><?php echo $facture->date ?></span>
<span id="nomcli" style="display: none"><?php echo $facture->prenom.' '.$facture->nom ?></span> <span id="nomcli" style="display: none"><?php echo $facture->nom ?></span>
<span id="idcli" style="display: none"><?php echo $facture->id_cli ?></span> <span id="idcli" style="display: none"><?php echo $facture->id_cli ?></span>
<span id="etp" style="display: none"><?php echo $facture->entreprise ?></span> <span id="etp" style="display: none"><?php echo $facture->entreprise ?></span>
<span class="pdf" style="display: none"><?php echo $facture->entreprise."_".$facture->id."_v".$facture->version?></span> <span class="pdf" style="display: none"><?php echo $facture->entreprise."_".$facture->id."_v".$facture->version?></span>
@ -140,7 +140,7 @@
<hr/> <hr/>
<div class="col col-xl text-center"> <div class="col col-xl text-center">
<span>Date de facture : <b><?php echo (new DateTime($facture->date_paiement))->format('d-m-Y');?></b>, </span><span><?php p($l->t('Date of service'));?> : <b><?php echo (new DateTime($facture->date))->format('d-m-Y');?></b></span><br/> <span>Date de facture : <b><?php echo (new DateTime($facture->date_paiement))->format('d-m-Y');?></b>, </span><span><?php p($l->t('Date of service'));?> : <b><?php echo (new DateTime($facture->date))->format('d-m-Y');?></b></span><br/>
<span id="devisid" data-id=<?php echo $facture->id_devis;?>>Défunt associé : <b><?php echo $facture->dnum;?></b>, </span><span><?php p($l->t('Means of payment'));?> : <b><?php echo $facture->type_paiement;?></b></span><br/> <span id="devisid" data-id=<?php echo $facture->id_devis;?>>Défunt associé : <b><?php echo $facture->nom_defunt;?></b>, </span><span><?php p($l->t('Means of payment'));?> : <b><?php echo $facture->facture_payment_type_label ?? "Aucun";?></b></span><br/>
<span>Lieu : <b><?php echo $facture->lieu;?> (<?php echo $facture->adresse_soin;?>)</b> <span>Lieu : <b><?php echo $facture->lieu;?> (<?php echo $facture->adresse_soin;?>)</b>
</div> </div>
</div> </div>