Clean code
This commit is contained in:
parent
7c9bb10d6b
commit
33b9d492e2
@ -3842,10 +3842,10 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* Output an HTML select vat rate
|
* Output an HTML select vat rate
|
||||||
*
|
*
|
||||||
* @param string $htmlname Nom champ html
|
* @param string $htmlname Name of html select field
|
||||||
* @param float $selectedrate Forcage du taux tva pre-selectionne. Mettre '' pour aucun forcage.
|
* @param float $selectedrate Force preselected vat rate. Use '' for no forcing.
|
||||||
* @param Societe $societe_vendeuse Objet societe vendeuse
|
* @param Societe $societe_vendeuse Thirdparty seller
|
||||||
* @param Societe $societe_acheteuse Objet societe acheteuse
|
* @param Societe $societe_acheteuse Thirdparty buyer
|
||||||
* @param int $idprod Id product
|
* @param int $idprod Id product
|
||||||
* @param int $info_bits Miscellaneous information on line (1 for NPR)
|
* @param int $info_bits Miscellaneous information on line (1 for NPR)
|
||||||
* @param int $type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined)
|
* @param int $type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined)
|
||||||
@ -3863,9 +3863,6 @@ class Form
|
|||||||
global $langs,$conf,$mysoc;
|
global $langs,$conf,$mysoc;
|
||||||
|
|
||||||
$return='';
|
$return='';
|
||||||
$txtva=array();
|
|
||||||
$libtva=array();
|
|
||||||
$nprtva=array();
|
|
||||||
|
|
||||||
// Define defaultnpr and defaultttx
|
// Define defaultnpr and defaultttx
|
||||||
$defaultnpr=($info_bits & 0x01);
|
$defaultnpr=($info_bits & 0x01);
|
||||||
|
|||||||
@ -1292,7 +1292,7 @@ function migrate_price_facture($db,$langs,$conf)
|
|||||||
print '<b>'.$langs->trans('MigrationInvoice')."</b><br>\n";
|
print '<b>'.$langs->trans('MigrationInvoice')."</b><br>\n";
|
||||||
|
|
||||||
// Liste des lignes facture non a jour
|
// Liste des lignes facture non a jour
|
||||||
$sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_tx as tva_taux, fd.total_ttc, fd.info_bits,";
|
$sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_tx as vatrate, fd.total_ttc, fd.info_bits,";
|
||||||
$sql.= " f.rowid as facid, f.remise_percent as remise_percent_global, f.total_ttc as total_ttc_f";
|
$sql.= " f.rowid as facid, f.remise_percent as remise_percent_global, f.total_ttc as total_ttc_f";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " WHERE fd.fk_facture = f.rowid";
|
$sql.= " WHERE fd.fk_facture = f.rowid";
|
||||||
@ -1314,7 +1314,7 @@ function migrate_price_facture($db,$langs,$conf)
|
|||||||
$rowid = $obj->rowid;
|
$rowid = $obj->rowid;
|
||||||
$qty = $obj->qty;
|
$qty = $obj->qty;
|
||||||
$pu = $obj->subprice;
|
$pu = $obj->subprice;
|
||||||
$txtva = $obj->tva_taux;
|
$vatrate = $obj->vatrate;
|
||||||
$remise_percent = $obj->remise_percent;
|
$remise_percent = $obj->remise_percent;
|
||||||
$remise_percent_global = $obj->remise_percent_global;
|
$remise_percent_global = $obj->remise_percent_global;
|
||||||
$total_ttc_f = $obj->total_ttc_f;
|
$total_ttc_f = $obj->total_ttc_f;
|
||||||
@ -1324,7 +1324,7 @@ function migrate_price_facture($db,$langs,$conf)
|
|||||||
$facligne= new FactureLigne($db);
|
$facligne= new FactureLigne($db);
|
||||||
$facligne->fetch($rowid);
|
$facligne->fetch($rowid);
|
||||||
|
|
||||||
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva, 0, 0,$remise_percent_global,'HT',$info_bits,0);
|
$result=calcul_price_total($qty,$pu,$remise_percent,$vatrate, 0, 0,$remise_percent_global,'HT',$info_bits,0);
|
||||||
$total_ht = $result[0];
|
$total_ht = $result[0];
|
||||||
$total_tva = $result[1];
|
$total_tva = $result[1];
|
||||||
$total_ttc = $result[2];
|
$total_ttc = $result[2];
|
||||||
@ -1333,7 +1333,7 @@ function migrate_price_facture($db,$langs,$conf)
|
|||||||
$facligne->total_tva = $total_tva;
|
$facligne->total_tva = $total_tva;
|
||||||
$facligne->total_ttc = $total_ttc;
|
$facligne->total_ttc = $total_ttc;
|
||||||
|
|
||||||
dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
||||||
print ". ";
|
print ". ";
|
||||||
$facligne->update_total();
|
$facligne->update_total();
|
||||||
|
|
||||||
@ -1406,7 +1406,7 @@ function migrate_price_propal($db,$langs,$conf)
|
|||||||
print '<b>'.$langs->trans('MigrationProposal')."</b><br>\n";
|
print '<b>'.$langs->trans('MigrationProposal')."</b><br>\n";
|
||||||
|
|
||||||
// Liste des lignes propal non a jour
|
// Liste des lignes propal non a jour
|
||||||
$sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as tva_taux, pd.info_bits,";
|
$sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as vatrate, pd.info_bits,";
|
||||||
$sql.= " p.rowid as propalid, p.remise_percent as remise_percent_global";
|
$sql.= " p.rowid as propalid, p.remise_percent as remise_percent_global";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as p";
|
||||||
$sql.= " WHERE pd.fk_propal = p.rowid";
|
$sql.= " WHERE pd.fk_propal = p.rowid";
|
||||||
@ -1427,7 +1427,7 @@ function migrate_price_propal($db,$langs,$conf)
|
|||||||
$rowid = $obj->rowid;
|
$rowid = $obj->rowid;
|
||||||
$qty = $obj->qty;
|
$qty = $obj->qty;
|
||||||
$pu = $obj->subprice;
|
$pu = $obj->subprice;
|
||||||
$txtva = $obj->tva_taux;
|
$vatrate = $obj->vatrate;
|
||||||
$remise_percent = $obj->remise_percent;
|
$remise_percent = $obj->remise_percent;
|
||||||
$remise_percent_global = $obj->remise_percent_global;
|
$remise_percent_global = $obj->remise_percent_global;
|
||||||
$info_bits = $obj->info_bits;
|
$info_bits = $obj->info_bits;
|
||||||
@ -1436,7 +1436,7 @@ function migrate_price_propal($db,$langs,$conf)
|
|||||||
$propalligne= new PropaleLigne($db);
|
$propalligne= new PropaleLigne($db);
|
||||||
$propalligne->fetch($rowid);
|
$propalligne->fetch($rowid);
|
||||||
|
|
||||||
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits,0);
|
$result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0);
|
||||||
$total_ht = $result[0];
|
$total_ht = $result[0];
|
||||||
$total_tva = $result[1];
|
$total_tva = $result[1];
|
||||||
$total_ttc = $result[2];
|
$total_ttc = $result[2];
|
||||||
@ -1445,7 +1445,7 @@ function migrate_price_propal($db,$langs,$conf)
|
|||||||
$propalligne->total_tva = $total_tva;
|
$propalligne->total_tva = $total_tva;
|
||||||
$propalligne->total_ttc = $total_ttc;
|
$propalligne->total_ttc = $total_ttc;
|
||||||
|
|
||||||
dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
||||||
print ". ";
|
print ". ";
|
||||||
$propalligne->update_total();
|
$propalligne->update_total();
|
||||||
|
|
||||||
@ -1515,7 +1515,7 @@ function migrate_price_contrat($db,$langs,$conf)
|
|||||||
print '<b>'.$langs->trans('MigrationContract')."</b><br>\n";
|
print '<b>'.$langs->trans('MigrationContract')."</b><br>\n";
|
||||||
|
|
||||||
// Liste des lignes contrat non a jour
|
// Liste des lignes contrat non a jour
|
||||||
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,";
|
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,";
|
||||||
$sql.= " c.rowid as contratid";
|
$sql.= " c.rowid as contratid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||||
$sql.= " WHERE cd.fk_contrat = c.rowid";
|
$sql.= " WHERE cd.fk_contrat = c.rowid";
|
||||||
@ -1536,7 +1536,7 @@ function migrate_price_contrat($db,$langs,$conf)
|
|||||||
$rowid = $obj->rowid;
|
$rowid = $obj->rowid;
|
||||||
$qty = $obj->qty;
|
$qty = $obj->qty;
|
||||||
$pu = $obj->subprice;
|
$pu = $obj->subprice;
|
||||||
$txtva = $obj->tva_taux;
|
$vatrate = $obj->vatrate;
|
||||||
$remise_percent = $obj->remise_percent;
|
$remise_percent = $obj->remise_percent;
|
||||||
$info_bits = $obj->info_bits;
|
$info_bits = $obj->info_bits;
|
||||||
|
|
||||||
@ -1545,7 +1545,7 @@ function migrate_price_contrat($db,$langs,$conf)
|
|||||||
//$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
|
//$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
|
||||||
$contratligne->id=$rowid;
|
$contratligne->id=$rowid;
|
||||||
|
|
||||||
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0,$tmpmysoc);
|
$result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,0,'HT',$info_bits,0,$tmpmysoc);
|
||||||
$total_ht = $result[0];
|
$total_ht = $result[0];
|
||||||
$total_tva = $result[1];
|
$total_tva = $result[1];
|
||||||
$total_ttc = $result[2];
|
$total_ttc = $result[2];
|
||||||
@ -1554,7 +1554,7 @@ function migrate_price_contrat($db,$langs,$conf)
|
|||||||
$contratligne->total_tva = $total_tva;
|
$contratligne->total_tva = $total_tva;
|
||||||
$contratligne->total_ttc = $total_ttc;
|
$contratligne->total_ttc = $total_ttc;
|
||||||
|
|
||||||
dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc");
|
dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc");
|
||||||
print ". ";
|
print ". ";
|
||||||
$contratligne->update_total();
|
$contratligne->update_total();
|
||||||
|
|
||||||
@ -1600,7 +1600,7 @@ function migrate_price_commande($db,$langs,$conf)
|
|||||||
print '<b>'.$langs->trans('MigrationOrder')."</b><br>\n";
|
print '<b>'.$langs->trans('MigrationOrder')."</b><br>\n";
|
||||||
|
|
||||||
// Liste des lignes commande non a jour
|
// Liste des lignes commande non a jour
|
||||||
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,";
|
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,";
|
||||||
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
|
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."commande as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."commande as c";
|
||||||
$sql.= " WHERE cd.fk_commande = c.rowid";
|
$sql.= " WHERE cd.fk_commande = c.rowid";
|
||||||
@ -1621,7 +1621,7 @@ function migrate_price_commande($db,$langs,$conf)
|
|||||||
$rowid = $obj->rowid;
|
$rowid = $obj->rowid;
|
||||||
$qty = $obj->qty;
|
$qty = $obj->qty;
|
||||||
$pu = $obj->subprice;
|
$pu = $obj->subprice;
|
||||||
$txtva = $obj->tva_taux;
|
$vatrate = $obj->vatrate;
|
||||||
$remise_percent = $obj->remise_percent;
|
$remise_percent = $obj->remise_percent;
|
||||||
$remise_percent_global = $obj->remise_percent_global;
|
$remise_percent_global = $obj->remise_percent_global;
|
||||||
$info_bits = $obj->info_bits;
|
$info_bits = $obj->info_bits;
|
||||||
@ -1630,7 +1630,7 @@ function migrate_price_commande($db,$langs,$conf)
|
|||||||
$commandeligne= new OrderLine($db);
|
$commandeligne= new OrderLine($db);
|
||||||
$commandeligne->fetch($rowid);
|
$commandeligne->fetch($rowid);
|
||||||
|
|
||||||
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits,0);
|
$result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0);
|
||||||
$total_ht = $result[0];
|
$total_ht = $result[0];
|
||||||
$total_tva = $result[1];
|
$total_tva = $result[1];
|
||||||
$total_ttc = $result[2];
|
$total_ttc = $result[2];
|
||||||
@ -1639,7 +1639,7 @@ function migrate_price_commande($db,$langs,$conf)
|
|||||||
$commandeligne->total_tva = $total_tva;
|
$commandeligne->total_tva = $total_tva;
|
||||||
$commandeligne->total_ttc = $total_ttc;
|
$commandeligne->total_ttc = $total_ttc;
|
||||||
|
|
||||||
dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
||||||
print ". ";
|
print ". ";
|
||||||
$commandeligne->update_total();
|
$commandeligne->update_total();
|
||||||
|
|
||||||
@ -1714,7 +1714,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
|
|||||||
print '<b>'.$langs->trans('MigrationSupplierOrder')."</b><br>\n";
|
print '<b>'.$langs->trans('MigrationSupplierOrder')."</b><br>\n";
|
||||||
|
|
||||||
// Liste des lignes commande non a jour
|
// Liste des lignes commande non a jour
|
||||||
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,";
|
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,";
|
||||||
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
|
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd, ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd, ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||||
$sql.= " WHERE cd.fk_commande = c.rowid";
|
$sql.= " WHERE cd.fk_commande = c.rowid";
|
||||||
@ -1735,7 +1735,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
|
|||||||
$rowid = $obj->rowid;
|
$rowid = $obj->rowid;
|
||||||
$qty = $obj->qty;
|
$qty = $obj->qty;
|
||||||
$pu = $obj->subprice;
|
$pu = $obj->subprice;
|
||||||
$txtva = $obj->tva_taux;
|
$vatrate = $obj->vatrate;
|
||||||
$remise_percent = $obj->remise_percent;
|
$remise_percent = $obj->remise_percent;
|
||||||
$remise_percent_global = $obj->remise_percent_global;
|
$remise_percent_global = $obj->remise_percent_global;
|
||||||
$info_bits = $obj->info_bits;
|
$info_bits = $obj->info_bits;
|
||||||
@ -1744,7 +1744,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
|
|||||||
$commandeligne= new CommandeFournisseurLigne($db);
|
$commandeligne= new CommandeFournisseurLigne($db);
|
||||||
$commandeligne->fetch($rowid);
|
$commandeligne->fetch($rowid);
|
||||||
|
|
||||||
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits,0);
|
$result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0);
|
||||||
$total_ht = $result[0];
|
$total_ht = $result[0];
|
||||||
$total_tva = $result[1];
|
$total_tva = $result[1];
|
||||||
$total_ttc = $result[2];
|
$total_ttc = $result[2];
|
||||||
@ -1753,7 +1753,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
|
|||||||
$commandeligne->total_tva = $total_tva;
|
$commandeligne->total_tva = $total_tva;
|
||||||
$commandeligne->total_ttc = $total_ttc;
|
$commandeligne->total_ttc = $total_ttc;
|
||||||
|
|
||||||
dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
||||||
print ". ";
|
print ". ";
|
||||||
$commandeligne->update_total();
|
$commandeligne->update_total();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user