fix facture en double
This commit is contained in:
parent
6a30d5a004
commit
ec0aba426c
@ -449,7 +449,6 @@ class Bdd
|
|||||||
|
|
||||||
public function getFacturesListWithDependencies()
|
public function getFacturesListWithDependencies()
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
facture.id,
|
facture.id,
|
||||||
facture.user_id,
|
facture.user_id,
|
||||||
@ -484,14 +483,22 @@ class Bdd
|
|||||||
client.prenom,
|
client.prenom,
|
||||||
client.id as id_cli,
|
client.id as id_cli,
|
||||||
client.entreprise as client_entreprise,
|
client.entreprise as client_entreprise,
|
||||||
client.fk_client_group_facturation_id as fk_client_group_facturation_id,
|
client.fk_client_group_facturation_id,
|
||||||
client.adresse as adresse_cli,client.mail as mail_cli,
|
client.adresse as adresse_cli,
|
||||||
client.telephone as telephone_cli,client.legal_one as legalone_cli,
|
client.mail as mail_cli,
|
||||||
client.fk_client_group_id as fk_client_group_id,
|
client.telephone as telephone_cli,
|
||||||
|
client.legal_one as legalone_cli,
|
||||||
|
client.fk_client_group_id,
|
||||||
COALESCE(
|
COALESCE(
|
||||||
client.is_tva,
|
client.is_tva,
|
||||||
CASE
|
CASE
|
||||||
WHEN facture.fk_client_group_facturation_id IS NOT NULL THEN client_group_tva.is_tva
|
WHEN facture.fk_client_group_facturation_id IS NOT NULL
|
||||||
|
THEN (
|
||||||
|
SELECT is_tva
|
||||||
|
FROM ".$this->tableprefix."client
|
||||||
|
WHERE fk_client_group_facturation_id = facture.fk_client_group_facturation_id
|
||||||
|
LIMIT 1
|
||||||
|
)
|
||||||
ELSE facture_client.is_tva
|
ELSE facture_client.is_tva
|
||||||
END
|
END
|
||||||
) as tva,
|
) as tva,
|
||||||
@ -499,18 +506,19 @@ class Bdd
|
|||||||
defunt.nom as nom_defunt,
|
defunt.nom as nom_defunt,
|
||||||
lieu.id as lid,
|
lieu.id as lid,
|
||||||
lieu.nom as lieu,
|
lieu.nom as lieu,
|
||||||
lieu.adresse as adresse_soin,devis.id_lieu
|
lieu.adresse as adresse_soin,
|
||||||
|
devis.id_lieu
|
||||||
FROM ".$this->tableprefix."facture as facture
|
FROM ".$this->tableprefix."facture as facture
|
||||||
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
|
LEFT JOIN ".$this->tableprefix."devis as devis ON facture.id_devis = devis.id
|
||||||
LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id
|
LEFT JOIN ".$this->tableprefix."lieu as lieu ON devis.id_lieu = lieu.id
|
||||||
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.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."defunt as defunt ON devis.id_defunt = defunt.id
|
||||||
LEFT JOIN ".$this->tableprefix."facture_payment_type as facture_payment_type on facture.fk_facture_payment_type_id = facture_payment_type.id
|
LEFT JOIN ".$this->tableprefix."facture_payment_type as facture_payment_type ON facture.fk_facture_payment_type_id = facture_payment_type.id
|
||||||
LEFT JOIN ".$this->tableprefix."facture_status as facture_status on facture.fk_facture_status_key = facture_status.facture_status_key
|
LEFT JOIN ".$this->tableprefix."facture_status as facture_status ON facture.fk_facture_status_key = facture_status.facture_status_key
|
||||||
LEFT JOIN ".$this->tableprefix."client as facture_client on facture.fk_client_id = facture_client.id
|
LEFT JOIN ".$this->tableprefix."client as facture_client ON facture.fk_client_id = facture_client.id
|
||||||
LEFT JOIN ".$this->tableprefix."client_group_facturation as facture_client_group_facturation on facture.fk_client_group_facturation_id = facture_client_group_facturation.id
|
LEFT JOIN ".$this->tableprefix."client_group_facturation as facture_client_group_facturation ON facture.fk_client_group_facturation_id = facture_client_group_facturation.id
|
||||||
LEFT JOIN ".$this->tableprefix."client as client_group_tva ON facture.fk_client_group_facturation_id = client_group_tva.fk_client_group_facturation_id
|
|
||||||
ORDER BY facture.id DESC, facture.date_paiement DESC";
|
ORDER BY facture.id DESC, facture.date_paiement DESC";
|
||||||
|
|
||||||
$result = $this->execSQL($sql, array());
|
$result = $this->execSQL($sql, array());
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user