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());
}
private function getClientsWithClientGroupDetails(){
$sql = "SELECT * FROM ".$this->tableprefix."client as client;";
$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'] : '';
}
$client['client_type'] = MultipleFactureTypeConstant::CLIENT_FILTER_TYPE;
}
return $clientsGroupedByClientEntreprise;
private function getClientsWithClientType(){
$sql = "SELECT client.*,'client' as client_type FROM ".$this->tableprefix."client as client;";
$clientsWithClientType = $this->execSQLNoJsonReturn($sql,[]);
return $clientsWithClientType;
}
public function getClientsAndClientGroupFacturations(){
$clients = $this->getClientsWithClientGroupDetails();
$clients = $this->getClientsWithClientType();
$clientGroupFacturations = $this->getClientGroupFacturationsWithType();
$result = [...$clientGroupFacturations,...$clients];
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){
$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, "
@ -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."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]."
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(
sql: $sql,
conditions: $clientIdList );

View File

@ -161,6 +161,7 @@ class InvoiceRecapService {
} catch(\OCP\Files\NotPermittedException $e) { }
$pdf->AddPage();
$pdf->SetLineWidth(0.2);
// on sup les 2 cm en bas
$pdf->SetAutoPagebreak(False);
$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( 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( 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;
@ -474,6 +479,7 @@ class InvoiceRecapService {
} catch(\OCP\Files\NotPermittedException $e) { }
$pdf->AddPage();
$pdf->SetLineWidth(0.2);
// on sup les 2 cm en bas
$pdf->SetAutoPagebreak(False);
$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');
// 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');
// adresse du facture
@ -603,13 +609,19 @@ class InvoiceRecapService {
// le cadre des articles
// ***********************
// 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
$pdf->Line(5, 90, 205, 90);
// les traits verticaux colonnes
$pdf->Line(145, 80, 145, 233); $pdf->Line(163, 80, 163, 233);
if($num_page == $nb_page) $pdf->Line(183, 80, 183, 240);
else $pdf->Line(183, 80, 183, 233);
$pdf->Line(145, 80, 145, 233);
$pdf->Line(163, 80, 163, 233);
if($num_page == $nb_page){
$pdf->Line(183, 80, 183, 240);
}
else{
$pdf->Line(183, 80, 183, 233);
}
// titre colonne
$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');
@ -652,15 +664,20 @@ class InvoiceRecapService {
// si derniere page alors afficher cadre des TVA
if ($num_page == $nb_page)
{
$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','',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( 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( 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;

View File

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

View File

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

View File

@ -122,7 +122,8 @@ document.body.addEventListener('click', e => {
} else if("saveIk" == e.target.id) {
TrajetDetails.saveIkNextcloud();
} 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);
} else if("apercusDevis" === e.target.id) {
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 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">
<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="mail"><?php echo $facture->mail_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="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="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>
@ -140,7 +140,7 @@
<hr/>
<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 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>
</div>
</div>