


-- test facturation 
SELECT id, code , montant_total_ht, montant_total_ttc,
        montant_total_tva, net_a_payer, net_a_payer_ht 
FROM `entetecommercials` 
where code = 'FAC24700075';

 
SELECT id, entetecommercial_code, bl_code,type, produit_code,pu_ht, pu_ttc, 
        quantite, taux_tva, p_tva, total_ht, total_net_ht, total, total_net ,(total - total_ht) as montant_tva,remise, remise_client
FROM `lignecommercials` 
where entetecommercial_code='FAC24700075';

-- test bl
SELECT id, code , montant_total_ht, montant_total_ttc, facture, status_facture,
        montant_total_tva, net_a_payer, net_a_payer_ht 
FROM `entetecommercials` 
where code in('2-BLN-DAnomadis39Mg13', '2-BLN-DAnomadis40Mg13');

SELECT id, entetecommercial_code, bl_code,type, produit_code,pu_ht, pu_ttc, 
        quantite,quantite_facture, status_facture, facture, taux_tva, p_tva, 
        total_ht, total_net_ht, total, total_net ,remise, remise_client
FROM `lignecommercials` 
where entetecommercial_code in('2-BLN-DAnomadis39Mg13', '2-BLN-DAnomadis40Mg13') and type="vente";



update entetecommercials set status_facture='Non Facturé', facture=0 
where code in('2-BLN-DAnomadis39Mg13', '2-BLN-DAnomadis40Mg13') ;

update lignecommercials set status_facture='Non Facturé', facture=0, quantite_facture=0 
where entetecommercial_code in('2-BLN-DAnomadis39Mg13', '2-BLN-DAnomadis40Mg13') and type="vente";


array:5 [
  0 => 28.5
  1 => 11.4
  2 => 22.8
  3 => 36.07
  4 => 4.778
]