Compare commits

..

2 Commits

Author SHA1 Message Date
c3ca34a41f fix delete username at signature mail 2025-09-09 10:58:47 +03:00
ff03a0cf0d fix carte modification HFC 2025-09-08 13:27:22 +03:00
28 changed files with 27 additions and 223 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

File diff suppressed because one or more lines are too long

View File

@ -482,7 +482,6 @@ class Bdd
foreach($facturesList as $currentFacture) {
$produits = $this->getProduitsDevisByDevisId($currentFacture->id_devis);
$currentFacture->produits = $produits;
$currentFacture->totalPrices = $this->getFactureTotalPrices($currentFacture->id);
}
return json_encode($facturesList);
}
@ -4997,7 +4996,7 @@ COMMENTAIRES: ".$comment;
$conditions = [$clientGroupFacturationId,$year,$month];
if(!empty($mentionFilters)) {
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
$sql .= " AND "."devis.mentions IN ($mentionsFilterPlaceholders)";
$sql .= " AND ". $this->tableprefix."devis.mentions IN ($mentionsFilterPlaceholders)";
$conditions = array_merge($conditions, $mentionFilters);
}
$sql .= ";";
@ -5225,26 +5224,6 @@ COMMENTAIRES: ".$comment;
return $devisList;
}
public function getDevisIdsGroupByFactureId($factureId,$mentionFilters = []){
$sql = "SELECT devis.id
FROM ".$this->tableprefix."devis as devis
WHERE devis.fk_facture_id = ? ";
$conditions = [$factureId];
if(!empty($mentionFilters)){
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
$conditions = array_merge($conditions, $mentionFilters);
}
$sql.= ";";
$devisList = $this->execSQLNoJsonReturn($sql,$conditions);
$devisIds = [];
foreach($devisList as $devis){
$devisIds[] = $devis['id'];
}
return $devisIds;
}
public function getDevisDataGroupByFactureId($factureId, $mentionFilters = [])
{
$sql = "SELECT
@ -5682,79 +5661,4 @@ COMMENTAIRES: ".$comment;
}
return null;
}
private function getProductsTotalPrices($products)
{
$configs = json_decode($this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
$currentConfig = $configs[0];
$totalHt = 0;
$totalTtc = 0;
foreach ($products as $product) {
$valueHt = $product['produit_price'] * $product['quantite'];
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $currentConfig->tva_default);
$totalHt += $valueHt;
$totalTtc += $valueTtc;
}
return [
"total_ht" => $totalHt,
"total_ttc" => $totalTtc,
"tva" => $currentConfig->tva_default
];
}
private function getDevisIdsListByFactureId($factureId){
$factureData = $this->getFactureByFactureId(factureId: $factureId);
$isFactureGroupOfDevis = $factureData["facture_type"] == FactureTypeConstant::TYPE_GROUP;
$factureDevisIdsList = [];
if($isFactureGroupOfDevis){
$isFactureForSingleClient = $factureData['fk_client_id'] != null && $factureData['fk_client_id'] != 0;
$devisMentionFilters = [
DevisMentionConstant::FACTURED_FORMATTED,
DevisMentionConstant::FACTURED
];
$devis = $this->getDevisByFkFactureId($factureId);
$factureGroupIsRelatedToAnyDevis = $devis != null;
if (!$factureGroupIsRelatedToAnyDevis) {
if($isFactureForSingleClient){
$factureDevisIdsList = $this->getDevisIdsByClientIdAndMonthYear(
$factureData['fk_client_id'],
$factureData['month'],
$factureData['year'],$devisMentionFilters
);
}else{
$factureDevisIdsList = $this->getDevisIdsByClientGroupFacturationIdAndMonthYear(
$factureData['fk_client_group_facturation_id'],
$factureData['month'],
$factureData['year'],$devisMentionFilters
);
}
}else{
$factureDevisIdsList = $this->getDevisIdsGroupByFactureId($factureId, $devisMentionFilters );
}
}
else{
$factureDevisIdsList = $factureData['id_devis'] ? [$factureData['id_devis']] : [];
}
return $factureDevisIdsList;
}
private function getFactureTotalPrices($factureId)
{
$factureDevisIds = $this->getDevisIdsListByFactureId($factureId);
$totalHt = 0;
$totalTtc = 0;
$tva = 0;
foreach($factureDevisIds as $devisId){
$products = $this->getDevisProduits($devisId);
$totalPrices = $this->getProductsTotalPrices($products);
$totalHt += $totalPrices["total_ht"];
$totalTtc += $totalPrices["total_ttc"];
$tva = $totalPrices["tva"];
}
return [
"total_ht" => PriceHelpers::formatDecimalPriceWithCurrency($totalHt),
"total_ttc" => PriceHelpers::formatDecimalPriceWithCurrency($totalTtc),
"tva" => PriceHelpers::formatDecimalPriceWithCurrency($tva)
];
}
}

View File

@ -17,9 +17,4 @@ class PriceHelpers
return number_format($price,2,'.','');
}
public static function formatDecimalPriceWithCurrency($price,$currency = '€')
{
return self::formatDecimalPrice($price) . $currency;
}
}

View File

@ -118,17 +118,17 @@ class DevisPdfLayoutManager
$pdf->MultiCell(0, 7, trim(\OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($clientInfo['address'])));
$pdf->SetMargins(0, 0, 0);
$clientInfoYAxis += 7;
$clientInfoYAxis += 14;
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
$pdf->Cell(0, 7, trim(mb_convert_encoding(html_entity_decode($clientInfo['city']), 'ISO-8859-1', 'UTF-8')));
if (isset($clientInfo['siret']) && trim($clientInfo['siret']) !== '' && $clientInfo['siret'] !== null) {
if (!empty($clientInfo['siret'])) {
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
$pdf->Cell(0, 7, 'Siret: ' . \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($clientInfo['siret']));
}
if (isset($clientInfo['email']) && trim($clientInfo['email']) !== '' && $clientInfo['email'] !== null) {
if (!empty($clientInfo['email'])) {
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
$pdf->Cell(0, 7, 'Email: ' . mb_convert_encoding(html_entity_decode($clientInfo['email']), 'ISO-8859-1', 'UTF-8'));

View File

@ -58,7 +58,6 @@ export class Facture {
this.clientName = ((myresp.facture_group_name == null || myresp.facture_group_name.length == 0) ? '-' : myresp.facture_group_name);
}
}
this.totalTtc = myresp?.totalPrices?.total_ttc ?? 0;
}
getDocumentStateLabel(documentState){
@ -87,7 +86,6 @@ export class Facture {
'<div>' + this.payment_date + '</div>',
'<div><span class="badge '+this.isDocumentAlreadyGeneratedClass+'">' + this.isDocumentAlreadyGeneratedLabel + '</span></div>',
'<div><span class="badge '+this.isDocumentAlreadySentClass+'">' + this.isDocumentAlreadySentLabel + '</span></div>',
'<div><span>'+this.totalTtc + '</span></div>',
'<div style="display:inline-block;margin-right:0px;width:80%;"><a href="' + this.baseUrl +'"><button>' + t('gestion', 'Open') + '</button></a></div><div data-modifier="facture" data-id=' + this.id + ' data-table="facture" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>',
];
return myrow;

View File

@ -39,7 +39,6 @@
<th><?php p($l->t('Date de paiement'));?></th>
<th><?php p($l->t('Générée'));?></th>
<th><?php p($l->t('Envoyée au client'));?></th>
<th><?php p($l->t('Total TTC'));?></th>
<th><?php p($l->t('Actions'));?></th>
</tr>
</thead>