Merge branch 'fixes/fix-facture-design' into staging

This commit is contained in:
Tiavina 2025-02-04 12:09:21 +03:00
commit e19a01d0de
29 changed files with 254 additions and 155 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

@ -839,7 +839,7 @@ class PageController extends Controller {
$pdf->SetMargins(0,0,0); $pdf->SetMargins(0,0,0);
// logo : 80 de largeur et 55 de hauteur // logo : 80 de largeur et 55 de hauteur
$pdf->Image($this->src_path."logo.png", 10, 10, 55, 30); $pdf->Image($this->src_path."logo.png", 10, 10, 55, 30);
// adresse du facture // adresse du facture
$pdf->SetFont('ComicSans','B',11); $_x = 122 ; $_y = 40; $pdf->SetFont('ComicSans','B',11); $_x = 122 ; $_y = 40;
$pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode($current_client), 0, 0, ''); $_y += 8; $pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode($current_client), 0, 0, ''); $_y += 8;

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 );
@ -447,7 +422,7 @@ class Bdd {
LEFT JOIN ".$this->tableprefix."client on ".$this->tableprefix."devis.id_client = ".$this->tableprefix."client.id LEFT JOIN ".$this->tableprefix."client on ".$this->tableprefix."devis.id_client = ".$this->tableprefix."client.id
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
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 = ? ORDER BY year DESC, month DESC;"; AND ".$this->tableprefix."client.id = ? ORDER BY date_soin ASC";
$result = $this->execSQL($sql, array($clientId)); $result = $this->execSQL($sql, array($clientId));
return $result; return $result;
} }

View File

@ -94,6 +94,9 @@ class InvoiceRecapService {
$tvaIntraCommuValue = $firstClient["legal_one"]; $tvaIntraCommuValue = $firstClient["legal_one"];
} }
$defaultConfig = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN)); $defaultConfig = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
$configurationAddresses = FileExportHelpers::GetAddressAndCityFromAddress($defaultConfig[0]->adresse);
$configurationAddress = $configurationAddresses["address"];
$configurationAddressCity = $configurationAddresses["city"];
$factures = json_decode($this->gestionBdd->getClientFacturesByClientGroupFacturationIdAndDate($clientGroupId,$date)); $factures = json_decode($this->gestionBdd->getClientFacturesByClientGroupFacturationIdAndDate($clientGroupId,$date));
$factures = array_filter($factures, callback: function($facture) {return $facture->id_client != NULL; }); $factures = array_filter($factures, callback: function($facture) {return $facture->id_client != NULL; });
$groupName = ""; $groupName = "";
@ -158,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);
@ -166,27 +170,52 @@ class InvoiceRecapService {
if($doesLogoExist){ if($doesLogoExist){
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25); $pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
} }
//adresse de mon entreprise
$companyInfoXAxis = 10;
$companyInfoYAxis = 40;
$pdf->SetFont('ComicSans', '', 11);
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($defaultConfig[0]->entreprise));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddress));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddressCity));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, 'Mail : ' . $defaultConfig[0]->mail);
// adresse du facture // adresse du facture
$pdf->SetFont('ComicSans','B',11); $_x = 122 ; $_y = 40; $clientInfoXAxis = 125;
$pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode('Groupe '.$groupName), 0, 0, ''); $_y += 8; $clientInfoYAxis = 40;
$pdf->SetFont('ComicSans','',size: 11);
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, utf8_decode('Groupe '.$groupName));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
// date facture // date facture
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 122, 60 ); $pdf->Cell( 0, 7, "Saint Senoux, le ".utf8_decode($date_formated));
$pdf->Cell( 60, 8, "Saint Senoux, le ".utf8_decode($date_formated), 0, 0, '');
// observations // observations
$pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, 85 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L"); $pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, 95 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
$objet = utf8_decode("Récapitulatif Facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])); $objet = utf8_decode("Récapitulatif Facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1]));
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 85 ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 95 ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 95 ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 105 ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L");
$text1 = utf8_decode("Veuillez trouver ci-dessous le récapitulatif de la facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1]))."."; $text1 = utf8_decode("Veuillez trouver ci-dessous le récapitulatif de la facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])).".";
$text2 = utf8_decode("Vous en souhaitant bonne réception."); $text2 = utf8_decode("Vous en souhaitant bonne réception.");
$text3 = utf8_decode("Veuillez agréer, Madame, Monsieur, mes salutations les meilleures."); $text3 = utf8_decode("Veuillez agréer, Madame, Monsieur, mes salutations les meilleures.");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 105 ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 115 ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 110 ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 125 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
// signature // signature
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 ); $pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 );
@ -226,26 +255,36 @@ class InvoiceRecapService {
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25); $pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
} }
//adresse de mon entreprise
$companyInfoXAxis = 10;
$companyInfoYAxis = 40;
$pdf->SetFont('ComicSans', '', 11);
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($defaultConfig[0]->entreprise));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddress));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddressCity));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, 'Mail : ' . $defaultConfig[0]->mail);
// n° page en haute à droite // n° page en haute à droite
if($nb_page>1){ if($nb_page>1){
$pdf->SetXY( 120, 5 ); $pdf->SetFont( "ComicSans", "B", 9 ); $pdf->Cell( 160, 8, $num_page . '/' . $nb_page, 0, 0, 'C'); $pdf->SetXY( 120, 5 ); $pdf->SetFont( "ComicSans", "B", 9 ); $pdf->Cell( 160, 8, $num_page . '/' . $nb_page, 0, 0, 'C');
} }
// date facture
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 122, 15 );
$pdf->SetY(10);
$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->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
$pdf->SetFont('ComicSans','B',11); $clientInfoXAxis = 125;
$pdf->SetY(32); $clientInfoYAxis = 40;
// $pdf->SetXY( $x, $y ); $pdf->Cell( 100, 8, 'doit', 0, 0, ''); $y += 8; $pdf->SetFont('ComicSans','',size: 11);
$pdf->Cell( 0, 6, 'Groupe '.$groupName, 0, 1, 'R'); $pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 6, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . FileExportHelpers::FormatTextForExport($tvaIntraCommuValue), 0, 1, 'R'); $pdf->Cell( 0, 7, utf8_decode('Groupe '.$groupName));
// *********************** // ***********************
// le cadre des articles // le cadre des articles
@ -253,13 +292,24 @@ class InvoiceRecapService {
// 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->SetLineWidth(0.2); $pdf->Rect(5, 80, 200, 153, "D");
// cadre titre des colonnes // cadre titre des colonnes
$pdf->SetFillColor(255);
$pdf->Line(5, 90, 205, 90); $pdf->Line(5, 90, 205, 90);
// les traits verticaux colonnes // les traits verticaux colonnes
$pdf->Line(25, 80, 25, 225);
$pdf->Line(46, 80, 46, 225);
$pdf->Line(84, 80, 84, 225);
$pdf->Line(145, 80, 145, 233); $pdf->Line(163, 80, 163, 233); $pdf->Line(145, 80, 145, 233); $pdf->Line(163, 80, 163, 233);
if($num_page == $nb_page) $pdf->Line(183, 80, 183, 240); if($num_page == $nb_page){
else $pdf->Line(183, 80, 183, 233); $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( 30, 8, FileExportHelpers::FormatTextForExport(""), 0, 0, 'C');
$pdf->SetXY( 26, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 18, 8, "Date", 0, 0, 'C');
$pdf->SetXY( 47, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 35, 8, FileExportHelpers::FormatTextForExport("Défunt"), 0, 0, 'C');
$pdf->SetXY( 85, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 60, 8, FileExportHelpers::FormatTextForExport("Société"), 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');
$pdf->SetXY( 168, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 10, 8, "TVA 20%", 0, 0, 'C'); $pdf->SetXY( 168, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 10, 8, "TVA 20%", 0, 0, 'C');
$pdf->SetXY( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C'); $pdf->SetXY( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C');
@ -279,9 +329,9 @@ class InvoiceRecapService {
$date_soin_temp = new DateTime($mois[$index_facture_position]['date_soin']); $date_soin_temp = new DateTime($mois[$index_facture_position]['date_soin']);
$pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $mois[$index_facture_position]['num'], 0, 0, ''); $pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $mois[$index_facture_position]['num'], 0, 0, '');
$pdf->SetXY( 26, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, ''); $pdf->SetXY( 29, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, '');
$pdf->SetXY( 40, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 8, utf8_decode(html_entity_decode($mois[$index_facture_position]['defunt'])), 0, 0, ''); $pdf->SetXY( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 8, utf8_decode(html_entity_decode($mois[$index_facture_position]['defunt'])), 0, 0, '');
$pdf->SetXY( 86, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, $mois[$index_facture_position]['prenoms_client'].' '.$mois[$index_facture_position]['nom_client'], 0, 0, ''); $pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, $mois[$index_facture_position]['nom_client'], 0, 0, '');
$pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 8, number_format($mois[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C'); $pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 8, number_format($mois[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C');
$pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 8, number_format($mois[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C'); $pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 8, number_format($mois[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C');
$pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 8, number_format($mois[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C'); $pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 8, number_format($mois[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C');
@ -306,9 +356,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;
@ -336,7 +390,6 @@ class InvoiceRecapService {
$num_page++; $num_page++;
} }
// var_dump("tonga aty ve");die;
$ff_pdf = html_entity_decode( $ff_pdf = html_entity_decode(
$defaultConfig[0]->path). $defaultConfig[0]->path).
'/DOCUMENTS RECAPITULATIFS/'.$key_annee.'/'.$key_mois.' '. '/DOCUMENTS RECAPITULATIFS/'.$key_annee.'/'.$key_mois.' '.
@ -365,6 +418,9 @@ class InvoiceRecapService {
$tvaIntraCommuValue = $firstClient["legal_one"]; $tvaIntraCommuValue = $firstClient["legal_one"];
} }
$defaultConfig = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN)); $defaultConfig = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
$configurationAddresses = FileExportHelpers::GetAddressAndCityFromAddress($defaultConfig[0]->adresse);
$configurationAddress = $configurationAddresses["address"];
$configurationAddressCity = $configurationAddresses["city"];
$factures = json_decode($this->gestionBdd->getClientFacturesByClientIdAndDate( $factures = json_decode($this->gestionBdd->getClientFacturesByClientIdAndDate(
clientId: $clientId, clientId: $clientId,
date: $date date: $date
@ -443,6 +499,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);
@ -451,32 +508,58 @@ class InvoiceRecapService {
if($doesLogoExist){ if($doesLogoExist){
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25); $pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
} }
//adresse de mon entreprise
$companyInfoXAxis = 10;
$companyInfoYAxis = 40;
$pdf->SetFont('ComicSans', '', 11);
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($defaultConfig[0]->entreprise));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddress));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddressCity));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, 'Mail : ' . $defaultConfig[0]->mail);
// adresse du facture // adresse du facture
$pdf->SetFont('ComicSans','B',size: 11); $clientInfoXAxis = 125;
$pdf->SetY(40); $clientInfoYAxis = 40;
$pdf->Cell( 0, 8, utf8_decode($current_client), 0, 1, 'R'); $pdf->SetFont('ComicSans','',size: 11);
$pdf->Cell( 0, 8, trim(utf8_decode(html_entity_decode($clientAddress))), 0,1,'R'); $pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
if($clientCity != ''){ $pdf->Cell( 0, 7, utf8_decode($current_client));
$pdf->Cell( 0, 8, trim(utf8_decode(html_entity_decode($clientCity))), 0, 1, 'R'); $clientInfoYAxis += 7;
} $pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientAddress))));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientCity))));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
// date facture // date facture
$pdf->SetFont('ComicSans','',11); $pdf->Cell( 0, 7, "Saint Senoux, le ".utf8_decode($date_formated));
$pdf->Cell( 0, 8, "Saint Senoux, le ".utf8_decode($date_formated), 0, 1, 'R');
// observations // observations
$pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, 85 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L"); $pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, 95 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
$objet = utf8_decode("Récapitulatif Facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])); $objet = utf8_decode("Récapitulatif Facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1]));
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 85 ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 95 ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 95 ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 105 ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L");
$text1 = utf8_decode("Veuillez trouver ci-dessous le récapitulatif de la facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1]))."."; $text1 = utf8_decode("Veuillez trouver ci-dessous le récapitulatif de la facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])).".";
$text2 = utf8_decode("Vous en souhaitant bonne réception."); $text2 = utf8_decode("Vous en souhaitant bonne réception.");
$text3 = utf8_decode("Veuillez agréer, Madame, Monsieur, mes salutations les meilleures."); $text3 = utf8_decode("Veuillez agréer, Madame, Monsieur, mes salutations les meilleures.");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 105 ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 115 ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 110 ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L"); $pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 125 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
// signature // signature
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 ); $pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 );
@ -516,44 +599,75 @@ class InvoiceRecapService {
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25); $pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
} }
//adresse de mon entreprise
$companyInfoXAxis = 10;
$companyInfoYAxis = 40;
$pdf->SetFont('ComicSans', '', 11);
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($defaultConfig[0]->entreprise));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddress));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport($configurationAddressCity));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone));
$companyInfoYAxis += 7;
$pdf->SetXY($companyInfoXAxis,$companyInfoYAxis);
$pdf->Cell(0, 7, 'Mail : ' . $defaultConfig[0]->mail);
// n° page en haute à droite // n° page en haute à droite
if($nb_page>1){ if($nb_page>1){
$pdf->SetXY( 120, 5 ); $pdf->SetFont( "ComicSans", "B", 9 ); $pdf->Cell( 160, 8, $num_page . '/' . $nb_page, 0, 0, 'C'); $pdf->SetXY( 120, 5 ); $pdf->SetFont( "ComicSans", "B", 9 ); $pdf->Cell( 160, 8, $num_page . '/' . $nb_page, 0, 0, 'C');
} }
// date facture
$pdf->SetFont('ComicSans','',11);
$pdf->SetY(10);
$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->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
$pdf->SetFont('ComicSans','B',11); $clientInfoXAxis = 125;
$pdf->SetY(y: 32); $clientInfoYAxis = 40;
$pdf->Cell( 0, 6, utf8_decode($current_client), 0, 1, 'R'); $pdf->SetFont('ComicSans','',size: 11);
$pdf->Cell( 0, 6, trim(utf8_decode(html_entity_decode($clientAddress))), 0, 1, 'R'); $pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
if($clientCity != ''){ $pdf->Cell( 0, 7, utf8_decode($current_client));
$pdf->Cell( 0, 6, trim(utf8_decode(html_entity_decode($clientCity))), 0, 1, 'R'); $clientInfoYAxis += 7;
} $pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 6, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . FileExportHelpers::FormatTextForExport($tvaIntraCommuValue), 0, 1, 'R'); $pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientAddress))));
$pdf->Cell( 0, 6, 'Email: ' . utf8_decode(html_entity_decode($facture['mail_client'])), 0, 1, 'R'); $clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientCity))));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . FileExportHelpers::FormatTextForExport($tvaIntraCommuValue));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, 'Email: ' . utf8_decode(html_entity_decode($facture['mail_client'])),0,1);
// *********************** // ***********************
// 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->SetFillColor(255);
$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(25, 80, 25, 225);
if($num_page == $nb_page) $pdf->Line(183, 80, 183, 240); $pdf->Line(46, 80, 46, 225);
else $pdf->Line(183, 80, 183, 233); $pdf->Line(84, 80, 84, 225);
$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 // 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( 30, 8, FileExportHelpers::FormatTextForExport(""), 0, 0, 'C');
$pdf->SetXY( 26, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 18, 8, "Date", 0, 0, 'C');
$pdf->SetXY( 47, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 35, 8, FileExportHelpers::FormatTextForExport("Défunt"), 0, 0, 'C');
$pdf->SetXY( 85, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 60, 8, "Articles", 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');
$pdf->SetXY( 168, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 10, 8, "TVA 20%", 0, 0, 'C'); $pdf->SetXY( 168, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 10, 8, "TVA 20%", 0, 0, 'C');
$pdf->SetXY( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C'); $pdf->SetXY( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C');
@ -573,9 +687,9 @@ class InvoiceRecapService {
$date_soin_temp = new DateTime($client[$index_facture_position]['date_soin']); $date_soin_temp = new DateTime($client[$index_facture_position]['date_soin']);
$pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $client[$index_facture_position]['num'], 0, 0, ''); $pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $client[$index_facture_position]['num'], 0, 0, '');
$pdf->SetXY( 32, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 8, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, ''); $pdf->SetXY( 29, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 8, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, '');
$pdf->SetXY( 50, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, utf8_decode(html_entity_decode($client[$index_facture_position]['defunt'])), 0, 0, ''); $pdf->SetXY( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, utf8_decode(html_entity_decode($client[$index_facture_position]['defunt'])), 0, 0, '');
$pdf->SetXY( 90, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, utf8_decode(html_entity_decode($client[$index_facture_position]['produit_references'])), 0, 0, ''); $pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, utf8_decode(html_entity_decode($client[$index_facture_position]['produit_references'])), 0, 0, '');
$pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 8, number_format($client[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C'); $pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 8, number_format($client[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C');
$pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 8, number_format($client[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C'); $pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 8, number_format($client[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C');
$pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 8, number_format($client[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C'); $pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 8, number_format($client[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C');
@ -594,15 +708,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>