TVA NPR : deduplicate line. Remove tva npr from journal lines
This commit is contained in:
parent
bbbc4ad8c4
commit
148ad65150
@ -97,9 +97,9 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,";
|
||||
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
|
||||
@ -142,7 +142,8 @@ if ($result)
|
||||
$tabfac[$obj->rowid]["lib"] = $obj->libelle;
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
if($obj->recuperableonly != 1)
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name);
|
||||
|
||||
$i++;
|
||||
@ -238,4 +239,4 @@ print "</table>";
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -99,12 +99,12 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||
@ -149,7 +149,8 @@ if ($result)
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0;
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
if($obj->recuperableonly != 1)
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client);
|
||||
$i++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user