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

This commit is contained in:
Tiavina 2025-02-04 12:32:42 +03:00
commit 37336a2816
2 changed files with 19 additions and 5 deletions

View File

@ -378,7 +378,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.mail as mail_client, ".$this->tableprefix."client.entreprise as client_entreprise, "
.$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,"
.$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt,"
@ -411,7 +411,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.mail as mail_client, ".$this->tableprefix."client.entreprise as client_entreprise, "
.$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,"
.$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt,"
@ -2551,7 +2551,7 @@ class Bdd {
return $produitList;
}
private function getProductPriceByClientGroupId($clientGroupId,$productId){
public function getProductPriceByClientGroupId($clientGroupId,$productId){
$sql = "SELECT *
FROM ".$this->tableprefix ."client_group_discount as client_group_discount
WHERE client_group_discount.fk_client_group_id = ? AND

View File

@ -124,7 +124,14 @@ class InvoiceRecapService {
$produits = json_decode($this->gestionBdd->getListProduit($facture->id_devis,$idNextcloud));
$produitsReferenceArray = [];
foreach ($produits as $key => $produit) {
$facture_temp['montant_htc'] += $produit->prix_unitaire * $produit->quantite;
$htPrice = $produit->prix_unitaire;
if($facture->fk_client_group_id != null){
$price = $this->gestionBdd->getProductPriceByClientGroupId($facture->fk_client_group_id,$produit->id);
if($price != null){
$htPrice = $price;
}
}
$facture_temp['montant_htc'] += $htPrice * $produit->quantite;
$produitsReferenceArray[] = $produit->reference;
};
$produitsReferenceArray = array_unique($produitsReferenceArray);
@ -449,7 +456,14 @@ class InvoiceRecapService {
$produits = json_decode($this->gestionBdd->getListProduit($facture->id_devis,$idNextcloud));
$produitsReferenceArray = [];
foreach ($produits as $key => $produit) {
$facture_temp['montant_htc'] += $produit->prix_unitaire * $produit->quantite;
$htPrice = $produit->prix_unitaire;
if($facture->fk_client_group_id != null){
$price = $this->gestionBdd->getProductPriceByClientGroupId($facture->fk_client_group_id,$produit->id);
if($price != null){
$htPrice = $price;
}
}
$facture_temp['montant_htc'] += $htPrice * $produit->quantite;
$produitsReferenceArray[] = $produit->reference;
};
$produitsReferenceArray = array_unique($produitsReferenceArray);