Merge branch 'features/feature-group-facturation-adress' into staging
This commit is contained in:
commit
6a4030d1e6
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
@ -46,7 +46,8 @@ class Bdd {
|
||||
"fk_product_type_id",
|
||||
"portal_code","alarm_code","funeral_code",
|
||||
"product_brand","product_reference",
|
||||
"fk_user_uuid");
|
||||
"fk_user_uuid",
|
||||
"phone_number","address",'postal_code','city','email','siret_number','tva_intracommu');
|
||||
$this->whiteTable = array(
|
||||
"client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit", "configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis", "bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt",
|
||||
"client_group_discount","client_group",
|
||||
@ -378,6 +379,7 @@ class Bdd {
|
||||
.$this->tableprefix."facture.id, ".$this->tableprefix."facture.user_id, ".$this->tableprefix."facture.num, ".$this->tableprefix."facture.date, "
|
||||
.$this->tableprefix."devis.num as dnum,".$this->tableprefix."devis.version as adresse_devis,".$this->tableprefix."devis.comment as numero_commande, "
|
||||
.$this->tableprefix."client.adresse as adresse_client, ".$this->tableprefix."devis.date as date_soin, "
|
||||
.$this->tableprefix."client.legal_one as client_siret, "
|
||||
.$this->tableprefix."client.mail as mail_client, ".$this->tableprefix."client.entreprise as client_entreprise, ".$this->tableprefix."client.fk_client_group_id as fk_client_group_id, "
|
||||
.$this->tableprefix."devis.id_client as id_client, date_paiement, type_paiement, id_devis, ".$this->tableprefix."client.nom as nom, prenom, entreprise, "
|
||||
.$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu,".$this->tableprefix."lieu.adresse as adresse_soin,"
|
||||
@ -412,16 +414,25 @@ class Bdd {
|
||||
.$this->tableprefix."devis.num as dnum,".$this->tableprefix."devis.version as adresse_devis,".$this->tableprefix."devis.comment as numero_commande, "
|
||||
.$this->tableprefix."client.adresse as adresse_client, ".$this->tableprefix."devis.date as date_soin, "
|
||||
.$this->tableprefix."client.mail as mail_client, ".$this->tableprefix."client.entreprise as client_entreprise, ".$this->tableprefix."client.fk_client_group_id as fk_client_group_id, "
|
||||
.$this->tableprefix."client.legal_one as client_siret, "
|
||||
.$this->tableprefix."devis.id_client as id_client, date_paiement, type_paiement, id_devis, ".$this->tableprefix."client.nom as nom, prenom, entreprise, "
|
||||
.$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu,".$this->tableprefix."lieu.adresse as adresse_soin,"
|
||||
.$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt,"
|
||||
.$this->tableprefix."facture.version, status_paiement
|
||||
.$this->tableprefix."facture.version, status_paiement, "
|
||||
.$this->tableprefix."client_group_facturation.id as group_id, "
|
||||
.$this->tableprefix."client_group_facturation.group_facturation_name as group_name, "
|
||||
.$this->tableprefix."client_group_facturation.address as group_address, "
|
||||
.$this->tableprefix."client_group_facturation.postal_code as group_postal_code, "
|
||||
.$this->tableprefix."client_group_facturation.city as group_city, "
|
||||
.$this->tableprefix."client_group_facturation.email as group_email, "
|
||||
.$this->tableprefix."client_group_facturation.siret_number as group_siret_number
|
||||
FROM (".$this->tableprefix."facture
|
||||
LEFT JOIN ".$this->tableprefix."devis on ".$this->tableprefix."facture.id_devis = ".$this->tableprefix."devis.id)
|
||||
LEFT JOIN ".$this->tableprefix."lieu on ".$this->tableprefix."devis.id_lieu = ".$this->tableprefix."lieu.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
|
||||
WHERE YEAR(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[2]." AND MONTH(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[1]."
|
||||
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('-', string: $date)[2]." AND MONTH(".$this->tableprefix."facture.date_paiement) = ".explode('-', $date)[1]."
|
||||
AND ".$this->tableprefix."client.id = ? ORDER BY date_soin ASC";
|
||||
$result = $this->execSQL($sql, array($clientId));
|
||||
return $result;
|
||||
@ -2717,14 +2728,22 @@ class Bdd {
|
||||
$products = $this->getDevisProduits($factureData["devis_id"]);
|
||||
$factureData = $this->setDevisStartAndEndTime($factureData);
|
||||
|
||||
$firstClient = $this->getFirstClient();
|
||||
$factureData["siret"] = $firstClient != null ? $firstClient['legal_one'] : '';
|
||||
$factureData["products"] = $products;
|
||||
$factureData["configuration"] = $configuration;
|
||||
|
||||
$clientAdresses = FileExportHelpers::GetAddressAndCityFromAddress($factureData["client_adresse"]);
|
||||
$factureData["client_real_adress"] = $clientAdresses["address"];
|
||||
$factureData["client_adress_city"] = $clientAdresses["city"];
|
||||
|
||||
$isClientInsideGroup = $factureData["group_id"] != null;
|
||||
if($isClientInsideGroup){
|
||||
$factureData["client_real_adress"] = $factureData["group_address"];
|
||||
$factureData["client_adress_city"] = $factureData["group_postal_code"]." ".$factureData["group_city"];
|
||||
$factureData["client_mail"] = $factureData["group_email"];
|
||||
$factureData["siret"] = $factureData["group_siret_number"];
|
||||
}
|
||||
else{
|
||||
$factureData["siret"] = $factureData["client_legal_one"];
|
||||
$clientAdresses = FileExportHelpers::GetAddressAndCityFromAddress($factureData["client_adresse"]);
|
||||
$factureData["client_real_adress"] = $clientAdresses["address"];
|
||||
$factureData["client_adress_city"] = $clientAdresses["city"];
|
||||
}
|
||||
|
||||
$configurationAdresses = FileExportHelpers::GetAddressAndCityFromAddress($configuration->adresse);
|
||||
$factureData["configuration_adresse"] = $configurationAdresses["address"];
|
||||
@ -2790,16 +2809,24 @@ class Bdd {
|
||||
year: $year
|
||||
);
|
||||
}
|
||||
$firstClient = $this->getFirstClient();
|
||||
foreach($invoices as &$invoice){
|
||||
$invoice["siret"] = $firstClient != null ? $firstClient['legal_one'] : '';
|
||||
$products = $this->getDevisProduits($invoice["devis_id"]);
|
||||
$invoice["products"] = $products;
|
||||
$invoice["configuration"] = $configuration;
|
||||
|
||||
$clientAdresses = FileExportHelpers::GetAddressAndCityFromAddress($invoice["client_adresse"]);
|
||||
$invoice["client_real_adress"] = $clientAdresses["address"];
|
||||
$invoice["client_adress_city"] = $clientAdresses["city"];
|
||||
$isClientInsideGroup = $invoice["group_id"] != null;
|
||||
if($isClientInsideGroup){
|
||||
$invoice["client_real_adress"] = $invoice["group_address"];
|
||||
$invoice["client_adress_city"] = $invoice["group_postal_code"]." ".$invoice["group_city"];
|
||||
$invoice["client_mail"] = $invoice["group_email"];
|
||||
$invoice["siret"] = $invoice["group_siret_number"];
|
||||
}
|
||||
else{
|
||||
$invoice["siret"] = $invoice["client_legal_one"];
|
||||
$clientAdresses = FileExportHelpers::GetAddressAndCityFromAddress($invoice["client_adresse"]);
|
||||
$invoice["client_real_adress"] = $clientAdresses["address"];
|
||||
$invoice["client_adress_city"] = $clientAdresses["city"];
|
||||
}
|
||||
|
||||
$configurationAdresses = FileExportHelpers::GetAddressAndCityFromAddress($configuration->adresse);
|
||||
$invoice["configuration_adresse"] = $configurationAdresses["address"];
|
||||
@ -2849,7 +2876,15 @@ class Bdd {
|
||||
lieu.adresse as lieu_adresse,
|
||||
thanato.nom as thanato_nom,
|
||||
thanato.prenom as thanato_prenom,
|
||||
client_group_facturation.group_facturation_name as group_facturation_name,
|
||||
client_group_facturation.group_facturation_name as group_name,
|
||||
client_group_facturation.id as group_id,
|
||||
client_group_facturation.phone_number as group_phone_number,
|
||||
client_group_facturation.address as group_address,
|
||||
client_group_facturation.postal_code as group_postal_code,
|
||||
client_group_facturation.city as group_city,
|
||||
client_group_facturation.email as group_email,
|
||||
client_group_facturation.siret_number as group_siret_number,
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu,
|
||||
'group' as facture_type
|
||||
FROM ".$this->tableprefix."facture as facture
|
||||
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
|
||||
@ -2903,6 +2938,15 @@ class Bdd {
|
||||
lieu.adresse as lieu_adresse,
|
||||
thanato.nom as thanato_nom,
|
||||
thanato.prenom as thanato_prenom,
|
||||
client_group_facturation.id as group_id,
|
||||
client_group_facturation.group_facturation_name as group_name,
|
||||
client_group_facturation.phone_number as group_phone_number,
|
||||
client_group_facturation.address as group_address,
|
||||
client_group_facturation.postal_code as group_postal_code,
|
||||
client_group_facturation.city as group_city,
|
||||
client_group_facturation.email as group_email,
|
||||
client_group_facturation.siret_number as group_siret_number,
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu,
|
||||
'client' as facture_type
|
||||
FROM ".$this->tableprefix."facture as facture
|
||||
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
|
||||
@ -2910,6 +2954,7 @@ class Bdd {
|
||||
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||
LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id
|
||||
LEFT JOIN ".$this->tableprefix."thanato as thanato on devis.id_thanato = thanato.id
|
||||
LEFT JOIN ".$this->tableprefix."client_group_facturation as client_group_facturation on client.fk_client_group_facturation_id = client_group_facturation.id
|
||||
WHERE client.id = ? AND
|
||||
YEAR(facture.date_paiement) = ?";
|
||||
|
||||
@ -2972,18 +3017,29 @@ class Bdd {
|
||||
client.entreprise as client_entreprise,
|
||||
client.adresse as client_adresse,
|
||||
client.mail as client_mail,
|
||||
client.legal_one as client_legal_one,
|
||||
defunt.nom as defunt_nom,
|
||||
defunt.sexe as defunt_sexe,
|
||||
lieu.nom as lieu_nom,
|
||||
lieu.adresse as lieu_adresse,
|
||||
thanato.nom as thanato_nom,
|
||||
thanato.prenom as thanato_prenom
|
||||
thanato.prenom as thanato_prenom,
|
||||
client_group_facturation.id as group_id,
|
||||
client_group_facturation.group_facturation_name as group_name,
|
||||
client_group_facturation.phone_number as group_phone_number,
|
||||
client_group_facturation.address as group_address,
|
||||
client_group_facturation.postal_code as group_postal_code,
|
||||
client_group_facturation.city as group_city,
|
||||
client_group_facturation.email as group_email,
|
||||
client_group_facturation.siret_number as group_siret_number,
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu
|
||||
FROM ".$this->tableprefix."facture as facture
|
||||
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
|
||||
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
|
||||
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||
LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id
|
||||
LEFT JOIN ".$this->tableprefix."thanato as thanato on devis.id_thanato = thanato.id
|
||||
LEFT JOIN ".$this->tableprefix."client_group_facturation as client_group_facturation on client.fk_client_group_facturation_id = client_group_facturation.id
|
||||
WHERE facture.id = ?
|
||||
;";
|
||||
$facture = $this->execSQLNoJsonReturn(
|
||||
@ -3641,7 +3697,7 @@ class Bdd {
|
||||
return true;
|
||||
}
|
||||
|
||||
private function getClientGroupFacturationById($clientGroupFacturationId){
|
||||
public function getClientGroupFacturationById($clientGroupFacturationId){
|
||||
$sql = "SELECT *
|
||||
FROM ".$this->tableprefix."client_group_facturation as client_group_facturation
|
||||
WHERE client_group_facturation.id = ? ;";
|
||||
|
||||
@ -80,7 +80,7 @@ class InvoicePdfHandler extends FPDF {
|
||||
$filename = mb_strtoupper($factureData["client_nom"],'UTF-8');
|
||||
}
|
||||
else{
|
||||
$filename = 'GROUPE_'.mb_strtoupper($factureData["group_facturation_name"],'UTF-8');
|
||||
$filename = 'GROUPE_'.mb_strtoupper($factureData["group_name"],'UTF-8');
|
||||
}
|
||||
$filename .= $month != 0 ? '_'.DateHelpers::GetMonthPlainString($month) :'';
|
||||
$filename .= "_".$year;
|
||||
@ -109,8 +109,8 @@ class InvoicePdfHandler extends FPDF {
|
||||
private function DrawInvoiceClientInfo(){
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$clientName = $this->factureData['client_nom'];
|
||||
if($this->factureData['facture_type'] == MultipleFactureTypeConstant::GROUP_FILTER_TYPE){
|
||||
$clientName = $this->factureData['group_facturation_name'];
|
||||
if($this->factureData["group_name"] != null && $this->factureData["group_name"] != ""){
|
||||
$clientName = $this->factureData['group_name'];
|
||||
}
|
||||
$clientInfoXAxis = 125;
|
||||
$clientInfoYAxis = 40;
|
||||
|
||||
@ -27,6 +27,7 @@ declare(strict_types=1);
|
||||
namespace OCA\Gestion\Service;
|
||||
|
||||
use DateTime;
|
||||
use OCA\Gestion\Constants\MultipleFactureTypeConstant;
|
||||
use OCA\Gestion\Db\Bdd;
|
||||
use OCA\Gestion\Helpers\DateHelpers;
|
||||
use OCA\Gestion\Service\InvoiceRecap\InvoiceRecapService;
|
||||
@ -141,8 +142,14 @@ class InvoicePdfService {
|
||||
$pdf->MutlipleInvoicePdfFactory($invoiceData,$logo);
|
||||
$pdf->SetMultipleFactureContent();
|
||||
$racinePath = html_entity_decode(string: $currentConfig->path).'/';
|
||||
$clientRacineFolder = $racinePath.'CLIENTS/'.mb_strtoupper($invoiceData[0]["client_nom"],'UTF-8').'/';
|
||||
$filename = $currentConfig->facture_prefixe.'_'.$pdf->GetMultipleInvoiceFilename($month,$year);
|
||||
$clientNameInFolder = $invoiceData[0]["client_nom"];
|
||||
if($invoiceData[0]['facture_type'] == MultipleFactureTypeConstant::GROUP_FILTER_TYPE){
|
||||
if($invoiceData[0]["group_name"] != null && $invoiceData[0]["group_name"] != ""){
|
||||
$clientNameInFolder = $invoiceData[0]["group_name"];
|
||||
}
|
||||
}
|
||||
$clientRacineFolder = $racinePath.'CLIENTS/'.mb_strtoupper($clientNameInFolder,'UTF-8').'/';
|
||||
$filename = "FACTURE".'_'.$pdf->GetMultipleInvoiceFilename($month,$year);
|
||||
$filenamePath = $clientRacineFolder.$filename.'.pdf';
|
||||
$pdfContent = $pdf->Output('','S');
|
||||
try {
|
||||
|
||||
@ -88,18 +88,16 @@ class InvoiceRecapService {
|
||||
$storage = $this->rootFolder->getUserFolder($idNextcloud);
|
||||
$doesLogoExist = $this->doesLogoExist();
|
||||
$doesSignatureExist = $this->doesSignatureImageExists();
|
||||
$tvaIntraCommuValue = "";
|
||||
$firstClient = $this->gestionBdd->getFirstClient();
|
||||
if($firstClient != null){
|
||||
$tvaIntraCommuValue = $firstClient["legal_one"];
|
||||
}
|
||||
$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 = array_filter($factures, callback: function($facture) {return $facture->id_client != NULL; });
|
||||
$groupName = "";
|
||||
$clientGroupFacturation = $this->gestionBdd->getClientGroupFacturationById($clientGroupId);
|
||||
if($clientGroupFacturation == null){
|
||||
return null;
|
||||
}
|
||||
foreach ($factures as $key => $facture) {
|
||||
$facture_temp = array(
|
||||
'num' => $facture->num,
|
||||
@ -118,8 +116,7 @@ class InvoiceRecapService {
|
||||
'montant_htc' => 0,
|
||||
'tva' => $defaultConfig[0]->tva_default,
|
||||
'montant_tva' => 0,
|
||||
'montant_ttc' => 0,
|
||||
'group_facturation_name' => $facture->group_facturation_name
|
||||
'montant_ttc' => 0
|
||||
);
|
||||
$produits = json_decode($this->gestionBdd->getListProduit($facture->id_devis,$idNextcloud));
|
||||
$produitsReferenceArray = [];
|
||||
@ -156,7 +153,6 @@ class InvoiceRecapService {
|
||||
$pdf = new FPDF();
|
||||
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
|
||||
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
|
||||
$groupName = $mois[0]['group_facturation_name'];
|
||||
$date_facture = $mois[0]['date_facture'];
|
||||
|
||||
$date_temp = date("t-m-Y", strtotime($date_facture));
|
||||
@ -203,10 +199,16 @@ class InvoiceRecapService {
|
||||
$clientInfoYAxis = 40;
|
||||
$pdf->SetFont('ComicSans','',size: 11);
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, utf8_decode('Groupe '.$groupName));
|
||||
$pdf->Cell( 0, 7, utf8_decode($clientGroupFacturation["group_facturation_name"]));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["address"]))));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["postal_code"]. ' ' .$clientGroupFacturation["city"]))));
|
||||
// date facture
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, "Saint Senoux, le ".utf8_decode($date_formated));
|
||||
|
||||
// observations
|
||||
@ -291,7 +293,19 @@ class InvoiceRecapService {
|
||||
$clientInfoYAxis = 40;
|
||||
$pdf->SetFont('ComicSans','',size: 11);
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, utf8_decode('Groupe '.$groupName));
|
||||
$pdf->Cell( 0, 7, utf8_decode('Groupe '.$clientGroupFacturation["group_facturation_name"]));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["address"]))));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["postal_code"]. ' '.$clientGroupFacturation["city"]))));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . FileExportHelpers::FormatTextForExport($clientGroupFacturation["siret_number"]));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, 'Email: ' . utf8_decode(html_entity_decode($clientGroupFacturation["email"])),0,1);
|
||||
|
||||
// ***********************
|
||||
// le cadre des articles
|
||||
@ -319,7 +333,7 @@ class InvoiceRecapService {
|
||||
$pdf->SetXY( 1, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 30, 8, FileExportHelpers::FormatTextForExport("N°"), 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( 85, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 60, 8, FileExportHelpers::FormatTextForExport("Articles"), 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( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C');
|
||||
@ -341,7 +355,7 @@ class InvoiceRecapService {
|
||||
$pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $mois[$index_facture_position]['num'], 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( 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( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, FileExportHelpers::FormatTextForExport($mois[$index_facture_position]['nom_client']), 0, 0, '');
|
||||
$pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, FileExportHelpers::FormatTextForExport($mois[$index_facture_position]['produit_references']), 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( 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');
|
||||
@ -406,7 +420,7 @@ class InvoiceRecapService {
|
||||
strtoupper(
|
||||
FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])
|
||||
).
|
||||
'/GROUPE_'.$groupName.'_RECAP_FACTURE_'.strtoupper(
|
||||
'/GROUPE_'.$clientGroupFacturation["group_facturation_name"].'_RECAP_FACTURE_'.strtoupper(
|
||||
FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])
|
||||
).'_'.$key_annee.'.pdf';
|
||||
$storage->newFile($ff_pdf);
|
||||
@ -422,11 +436,6 @@ class InvoiceRecapService {
|
||||
$data_factures = [];
|
||||
$storage = $this->rootFolder->getUserFolder($idNextcloud);
|
||||
$doesLogoExist = $this->doesLogoExist();
|
||||
$tvaIntraCommuValue = "";
|
||||
$firstClient = $this->gestionBdd->getFirstClient();
|
||||
if($firstClient != null){
|
||||
$tvaIntraCommuValue = $firstClient["legal_one"];
|
||||
}
|
||||
$defaultConfig = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
||||
$configurationAddresses = FileExportHelpers::GetAddressAndCityFromAddress($defaultConfig[0]->adresse);
|
||||
$configurationAddress = $configurationAddresses["address"];
|
||||
@ -455,6 +464,14 @@ class InvoiceRecapService {
|
||||
'tva' => $defaultConfig[0]->tva_default,
|
||||
'montant_tva' => 0,
|
||||
'montant_ttc' => 0,
|
||||
"group_id" => $facture->group_id,
|
||||
"group_name" => $facture->group_name,
|
||||
"group_address" => $facture->group_address,
|
||||
"group_email" => $facture->group_email,
|
||||
"group_city" => $facture->group_city,
|
||||
"group_postal_code" => $facture->group_postal_code,
|
||||
"group_siret_number" => $facture->group_siret_number,
|
||||
"client_siret" => $facture->client_siret
|
||||
);
|
||||
$produits = json_decode($this->gestionBdd->getListProduit($facture->id_devis,$idNextcloud));
|
||||
$produitsReferenceArray = [];
|
||||
@ -493,19 +510,32 @@ class InvoiceRecapService {
|
||||
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
|
||||
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
|
||||
$current_client = '';
|
||||
$clientHeaderLabel = '';
|
||||
$clientAddress = '';
|
||||
$clientCity = '';
|
||||
$tvaIntraCommuValue = '';
|
||||
$clientMail = '';
|
||||
$date_facture;
|
||||
$j=1;
|
||||
foreach ($client as $key => $facture) {
|
||||
if($j==1) {
|
||||
$current_client = $facture['nom_client'];
|
||||
$date_facture = $facture['date_facture'];
|
||||
$current_client = $facture['nom_client'];
|
||||
$clientHeaderLabel = $current_client;
|
||||
$date_facture = $facture['date_facture'];
|
||||
$isClientInsideGroup = $facture["group_id"] != null;
|
||||
if($isClientInsideGroup){
|
||||
$clientHeaderLabel = $facture["group_name"];
|
||||
$clientAddress = $facture["group_address"];
|
||||
$clientCity = $facture["group_postal_code"]. " ".$facture["group_city"];
|
||||
$tvaIntraCommuValue = $facture["group_siret_number"];
|
||||
$clientMail = $facture["group_email"];
|
||||
}
|
||||
else{
|
||||
$clientAddresses = FileExportHelpers::GetAddressAndCityFromAddress($facture['adresse_client']);
|
||||
$clientAddress = $clientAddresses['address'];
|
||||
$clientCity = $clientAddresses['city'];
|
||||
$tvaIntraCommuValue = $facture["client_siret"];
|
||||
$clientMail = $facture['mail_client'];
|
||||
}
|
||||
$j++;
|
||||
break;
|
||||
}
|
||||
$date_temp = date("t-m-Y", strtotime($date_facture));
|
||||
$formatter = new IntlDateFormatter('fr_FR', IntlDateFormatter::LONG, IntlDateFormatter::NONE);
|
||||
@ -551,7 +581,7 @@ class InvoiceRecapService {
|
||||
$clientInfoYAxis = 40;
|
||||
$pdf->SetFont('ComicSans','',size: 11);
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, utf8_decode($current_client));
|
||||
$pdf->Cell( 0, 7, utf8_decode($clientHeaderLabel));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientAddress))));
|
||||
@ -581,7 +611,7 @@ class InvoiceRecapService {
|
||||
// signature
|
||||
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 );
|
||||
$pdf->Cell( $pdf->GetStringWidth($defaultConfig[0]->nom.' '.$defaultConfig[0]->prenom), 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom.' '.$defaultConfig[0]->prenom)), 0, 0, 'L');
|
||||
$signatureExists = $this->doesSignatureImageExists('sign.png');
|
||||
$signatureExists = $this->doesSignatureImageExists();
|
||||
if($signatureExists){
|
||||
$pdf->Image($this->defaultImagePath."sign.png", 135, 150, 60,40);
|
||||
}
|
||||
@ -645,7 +675,7 @@ class InvoiceRecapService {
|
||||
$clientInfoYAxis = 40;
|
||||
$pdf->SetFont('ComicSans','',size: 11);
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, utf8_decode($current_client));
|
||||
$pdf->Cell( 0, 7, utf8_decode($clientHeaderLabel));
|
||||
$clientInfoYAxis += 7;
|
||||
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientAddress))));
|
||||
@ -657,7 +687,7 @@ class InvoiceRecapService {
|
||||
$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);
|
||||
$pdf->Cell( 0, 7, 'Email: ' . utf8_decode(html_entity_decode($clientMail)),0,1);
|
||||
|
||||
// ***********************
|
||||
// le cadre des articles
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
alter table oc_gestion_client_group_facturation
|
||||
add column phone_number VARCHAR(100) DEFAULT '',
|
||||
add column address VARCHAR(255) DEFAULT '',
|
||||
add column postal_code VARCHAR(255) DEFAULT '',
|
||||
add column city VARCHAR(255) DEFAULT '',
|
||||
add column email VARCHAR(255) DEFAULT '',
|
||||
add column siret_number VARCHAR(255) DEFAULT '',
|
||||
add column tva_intracommu VARCHAR(255) DEFAULT '';
|
||||
@ -11,6 +11,13 @@ export class ClientGroupFacturation {
|
||||
constructor(myresp) {
|
||||
this.id = myresp.id;
|
||||
this.clientGroupFacturationName = ((myresp.group_facturation_name.length === 0) ? '-' : myresp.group_facturation_name);
|
||||
this.phoneNumber = (myresp.phone_number != null && myresp.phone_number.length > 0) ? myresp.phone_number : '-';
|
||||
this.address = (myresp.address != null && myresp.address.length > 0) ? myresp.address : '-';
|
||||
this.postalCode = (myresp.postal_code != null && myresp.postal_code.length > 0) ? myresp.postal_code : '-';
|
||||
this.city = (myresp.city != null && myresp.city.length > 0) ? myresp.city : '-';
|
||||
this.email = (myresp.email != null && myresp.email.length > 0) ? myresp.email : '-';
|
||||
this.siretNumber = (myresp.siret_number != null && myresp.siret_number.length > 0) ? myresp.siret_number : '-';
|
||||
this.tvaIntraCommu = (myresp.tva_intracommu != null && myresp.tva_intracommu.length > 0) ? myresp.tva_intracommu : '-';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -20,6 +27,13 @@ export class ClientGroupFacturation {
|
||||
let clientGroupFacturationRow = [
|
||||
'<div>' + this.id + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="group_facturation_name" data-id="' + this.id + '">' + this.clientGroupFacturationName + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="address" data-id="' + this.id + '">' + this.address + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="city" data-id="' + this.id + '">' + this.city + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="postal_code" data-id="' + this.id + '">' + this.postalCode + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="email" data-id="' + this.id + '">' + this.email + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="phone_number" data-id="' + this.id + '">' + this.phoneNumber + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="siret_number" data-id="' + this.id + '">' + this.siretNumber + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="tva_intracommu" data-id="' + this.id + '">' + this.tvaIntraCommu + '</div>',
|
||||
'<div data-modifier="clientGroupFacturation" data-id=' + this.id + ' data-table="client_group_facturation" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
];
|
||||
|
||||
|
||||
@ -16,6 +16,13 @@
|
||||
<tr>
|
||||
<th><?php p($l->t('ID'));?></th>
|
||||
<th><?php p($l->t('Groupe'));?></th>
|
||||
<th><?php p($l->t('Adresse'));?></th>
|
||||
<th><?php p($l->t('Ville'));?></th>
|
||||
<th><?php p($l->t('Code postal'));?></th>
|
||||
<th><?php p($l->t('Email'));?></th>
|
||||
<th><?php p($l->t('Téléphone'));?></th>
|
||||
<th><?php p($l->t('Siret'));?></th>
|
||||
<th><?php p($l->t('Tva Intra-communautaire'));?></th>
|
||||
<th><?php p($l->t('Actions'));?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user