Utilisation de la focntion select_tva avec carac societe vendeuse et acheteuse pour déterminer taux de tva par défaut

This commit is contained in:
Laurent Destailleur 2005-11-23 00:43:19 +00:00
parent b97ea500e5
commit 7c1d13a4f2
11 changed files with 54 additions and 48 deletions

View File

@ -37,27 +37,27 @@ if (!$user->admin)
if ( (isset($_POST["action"]) && $_POST["action"] == 'update') if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) || (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
{ {
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",stripslashes($_POST["nom"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",stripslashes($_POST["address"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_VILLE",stripslashes($_POST["ville"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_VILLE",$_POST["ville"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_CP",stripslashes($_POST["cp"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_CP",$_POST["cp"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",stripslashes($_POST["pays_id"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]);
dolibarr_set_const($db, "MAIN_MONNAIE",stripslashes($_POST["currency"])); dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",stripslashes($_POST["tel"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",stripslashes($_POST["fax"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",stripslashes($_POST["mail"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",stripslashes($_POST["web"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",stripslashes($_POST["logo"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$_POST["logo"]);
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",stripslashes($_POST["capital"])); dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",stripslashes($_POST["forme_juridique_code"])); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"]);
dolibarr_set_const($db, "MAIN_INFO_SIREN",stripslashes($_POST["siren"])); dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]);
dolibarr_set_const($db, "MAIN_INFO_SIRET",stripslashes($_POST["siret"])); dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]);
dolibarr_set_const($db, "MAIN_INFO_APE",stripslashes($_POST["ape"])); dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"]);
dolibarr_set_const($db, "MAIN_INFO_RCS",stripslashes($_POST["rcs"])); dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"]);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",stripslashes($_POST["tva"])); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]);
dolibarr_set_const($db, "FACTURE_TVAOPTION",stripslashes($_POST["optiontva"])); dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"]);
if ($_POST['action'] != 'updateedit') if ($_POST['action'] != 'updateedit')
{ {

View File

@ -803,7 +803,7 @@ if ($_GET['propalid'] > 0)
} }
print '<textarea name="desc" cols="50" rows="'.ROWS_2.'">'.stripslashes($objp->description).'</textarea></td>'; print '<textarea name="desc" cols="50" rows="'.ROWS_2.'">'.stripslashes($objp->description).'</textarea></td>';
print '<td align="right">'; print '<td align="right">';
print $html->select_tva("tva_tx",$objp->tva_tx); print $html->select_tva("tva_tx",$objp->tva_tx,$mysoc,$societe);
print '</td>'; print '</td>';
print '<td align="right"><input size="6" type="text" name="subprice" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="6" type="text" name="subprice" value="'.price($objp->subprice).'"></td>';
print '<td align="right"><input size="2" type="text" name="qty" value="'.$objp->qty.'"></td>'; print '<td align="right"><input size="2" type="text" name="qty" value="'.$objp->qty.'"></td>';
@ -862,7 +862,7 @@ if ($_GET['propalid'] > 0)
print '<tr '.$bc[$var].">\n"; print '<tr '.$bc[$var].">\n";
print ' <td><textarea cols="50" name="np_desc" rows="'.ROWS_2.'"></textarea></td>'; print ' <td><textarea cols="50" name="np_desc" rows="'.ROWS_2.'"></textarea></td>';
print ' <td align="center">'; print ' <td align="center">';
$html->select_tva('np_tva_tx', $conf->defaulttx) . "</td>\n"; $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe) . "</td>\n";
print ' <td align="right"><input type="text" size="5" name="np_price"></td>'; print ' <td align="right"><input type="text" size="5" name="np_price"></td>';
print ' <td align="right"><input type="text" size="2" value="1" name="np_qty"></td>'; print ' <td align="right"><input type="text" size="2" value="1" name="np_qty"></td>';
print ' <td align="right" nowrap><input type="text" size="2" value="'.$societe->remise_client.'" name="np_remise">%</td>'; print ' <td align="right" nowrap><input type="text" size="2" value="'.$societe->remise_client.'" name="np_remise">%</td>';

View File

@ -431,6 +431,7 @@ else
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->soc_id); $soc->fetch($commande->soc_id);
$author = new User($db); $author = new User($db);
$author->id = $commande->user_author_id; $author->id = $commande->user_author_id;
$author->fetch(); $author->fetch();
@ -642,9 +643,8 @@ else
print '</table><br>'; print '</table><br>';
/* /*
* Lignes de commandes * Lignes de commandes
* */
*/
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,'; $sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid'; $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
@ -745,7 +745,7 @@ else
} }
print '<textarea name="eldesc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>'; print '<textarea name="eldesc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>';
print '<td align="right">'; print '<td align="right">';
print $html->select_tva('eltva_tx',$objp->tva_tx); print $html->select_tva('eltva_tx',$objp->tva_tx,$mysoc,$soc);
print '</td>'; print '</td>';
print '<td align="right"><input size="5" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="5" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>';
print '<td align="right"><input size="2" type="text" class="flat" name="elqty" value="'.$objp->qty.'"></td>'; print '<td align="right"><input size="2" type="text" class="flat" name="elqty" value="'.$objp->qty.'"></td>';
@ -791,7 +791,7 @@ else
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print ' <td><textarea cols="50" name="desc" rows="1"></textarea></td>'; print ' <td><textarea cols="50" name="desc" rows="1"></textarea></td>';
print '<td align="center">'; print '<td align="center">';
print $html->select_tva('tva_tx',$conf->defaulttx); print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
print '</td>'; print '</td>';
print '<td align="right"><input type="text" name="pu" size="5"></td>'; print '<td align="right"><input type="text" name="pu" size="5"></td>';
print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>'; print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>';

View File

@ -106,7 +106,7 @@ if ($_POST["action"] == 'add')
} }
else else
{ {
$mesg="Montant non défini"; $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
$_GET["action"] = "create"; $_GET["action"] = "create";
} }
} }
@ -129,7 +129,7 @@ if ($_GET["action"] == 'valid_promesse')
$don = new Don($db); $don = new Don($db);
if ($don->valid_promesse($_GET["rowid"], $user->id)) if ($don->valid_promesse($_GET["rowid"], $user->id))
{ {
Header("Location: liste.php"); Header("Location: fiche.php?rowid=".$_GET["rowid"]);
exit; exit;
} }
} }
@ -138,7 +138,7 @@ if ($_GET["action"] == 'set_payed')
$don = new Don($db); $don = new Don($db);
if ($don->set_paye($_GET["rowid"], $modepaiement)) if ($don->set_paye($_GET["rowid"], $modepaiement))
{ {
Header("Location: liste.php"); Header("Location: fiche.php?rowid=".$_GET["rowid"]);
exit; exit;
} }
} }
@ -410,7 +410,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
if ($don->statut == 2 || $don->statut == 3) if ($don->statut == 2 || $don->statut == 3)
{ {
print ' <a class="butAction" href="fiche.php?rowid='.$don->id.'&amp;action=build">'.$langs->trans('BuildDoc').'</a>'; print ' <a class="butAction" href="fiche.php?rowid='.$don->id.'&amp;action=build">'.$langs->trans('BuildDonationReceipt').'</a>';
} }
if ($don->statut == 0) if ($don->statut == 0)

View File

@ -1501,7 +1501,7 @@ else
} }
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'">'.stripslashes($objp->description).'</textarea></td>'; print '<textarea name="desc" cols="70" rows="'.ROWS_2.'">'.stripslashes($objp->description).'</textarea></td>';
print '<td align="right">'; print '<td align="right">';
print $html->select_tva('tva_tx',$objp->tva_taux); print $html->select_tva('tva_tx',$objp->tva_taux,$mysoc,$soc);
print '</td>'; print '</td>';
print '<td align="right"><input size="6" type="text" name="price" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="6" type="text" name="price" value="'.price($objp->subprice).'"></td>';
print '<td align="right"><input size="2" type="text" name="qty" value="'.$objp->qty.'"></td>'; print '<td align="right"><input size="2" type="text" name="qty" value="'.$objp->qty.'"></td>';
@ -1559,7 +1559,7 @@ else
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>'; print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
print '<td align="right">'; print '<td align="right">';
$html->select_tva('tva_tx',$conf->defaulttx); $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
print '</td>'; print '</td>';
print '<td align="right"><input type="text" name="pu" size="6"></td>'; print '<td align="right"><input type="text" name="pu" size="6"></td>';
print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>'; print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>';

View File

@ -742,7 +742,7 @@ else
} }
print '<textarea name="eldesc" cols="70" rows="1">'.$objp->description.'</textarea></td>'; print '<textarea name="eldesc" cols="70" rows="1">'.$objp->description.'</textarea></td>';
print '<td align="right">'; print '<td align="right">';
print $html->select_tva("eltva_tx",$objp->tva_tx); print $html->select_tva("eltva_tx",$objp->tva_tx,$mysoc,$contrat->societe);
print '</td>'; print '</td>';
print '<td align="right"><input size="6" type="text" name="elprice" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="6" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
print '<td align="center"><input size="3" type="text" name="elqty" value="'.$objp->qty.'"></td>'; print '<td align="center"><input size="3" type="text" name="elqty" value="'.$objp->qty.'"></td>';
@ -842,7 +842,7 @@ else
print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>'; print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
print '<td>'; print '<td>';
$html->select_tva("tva_tx",$conf->defaulttx); $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,$contrat->societe);
print '</td>'; print '</td>';
print '<td align="right"><input type="text" class="flat" size="4" name="pu" value=""></td>'; print '<td align="right"><input type="text" class="flat" size="4" name="pu" value=""></td>';
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>'; print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';

View File

@ -289,7 +289,7 @@ if ($_GET['action'] == 'create' or $_GET['action'] == 'copy')
print '<td align="center"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>'; print '<td align="center"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>';
print '<td align="center"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>'; print '<td align="center"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>';
print '<td align="center">'; print '<td align="center">';
$html->select_tva('tauxtva'.$i); $html->select_tva('tauxtva'.$i,'', '',$mysoc);
print '</td>'; print '</td>';
print '<td align="center"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>'; print '<td align="center"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>';
} }
@ -421,7 +421,7 @@ else
print '</td>'; print '</td>';
print '<td align="center">-</td>'; print '<td align="center">-</td>';
print '<td align="center">'; print '<td align="center">';
$html->select_tva('tauxtva'); $html->select_tva('tauxtva','',$societe,$mysoc);
print '</td><td align="center" colspan="2">'; print '</td><td align="center" colspan="2">';
print '&nbsp;'; print '&nbsp;';
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>'; print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>';

View File

@ -190,11 +190,11 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->lire); $newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->lire);
// Actions // Actions
$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Actions"), 0); $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Actions"), 0, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, 1); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;status=todo", $langs->trans("MenuToDoActions"), 1); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;time=today", $langs->trans("Today"), 1); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;time=today", $langs->trans("Today"), 1, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->societe->lire);
// Propal // Propal
if ($conf->propal->enabled) if ($conf->propal->enabled)

View File

@ -1,6 +1,8 @@
# Dolibarr language file - en_US - donations # Dolibarr language file - en_US - donations
Donation=Donation Donation=Donation
Donationss=Donations Donationss=Donations
Donor=Donor
Donors=Donors
AddDonation=Add a donation AddDonation=Add a donation
NewDonation=New donation NewDonation=New donation
DonationPromise=Gift promise DonationPromise=Gift promise
@ -14,4 +16,5 @@ DonationsArea=Donations area
DonationStatusPromessNotValidated=Draft promess DonationStatusPromessNotValidated=Draft promess
DonationStatusPromessNotValidated=Validated promess DonationStatusPromessNotValidated=Validated promess
DonationStatusPayed=Donation received DonationStatusPayed=Donation received
ValidPromess=Validate promess ValidPromess=Validate promess
BuildDonationReceipt=Build receipt

View File

@ -1,6 +1,8 @@
# Dolibarr language file - fr_FR - donations # Dolibarr language file - fr_FR - donations
Donation=Don Donation=Don
Donations=Dons Donations=Dons
Donor=Donateur
Donors=Donateurs
AddDonation=Ajouter don AddDonation=Ajouter don
NewDonation=Nouveau don NewDonation=Nouveau don
DonationPromise=Promesse de don DonationPromise=Promesse de don
@ -14,4 +16,5 @@ DonationsArea=Espace Dons
DonationStatusPromessNotValidated=Promesse non validée DonationStatusPromessNotValidated=Promesse non validée
DonationStatusPromessNotValidated=Promesse validée DonationStatusPromessNotValidated=Promesse validée
DonationStatusPayed=Don payé DonationStatusPayed=Don payé
ValidPromess=Valider promesse ValidPromess=Valider promesse
BuildDonationReceipt=Créer reçu

View File

@ -285,7 +285,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
$langs->load("bills"); $langs->load("bills");
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'; print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $html->select_tva("tva_tx",$conf->defaulttx); print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'; print '<tr><td>'.$langs->trans("Status").'</td><td>';
@ -511,12 +511,12 @@ if ($_GET["id"])
} }
/* /*
* Fiche en mode edition * Fiche en mode edition
*/ */
if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer) if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer)
{ {
print_fiche_titre('Edition de la fiche '.$types[$product->type].' : '.$product->ref, ""); print_fiche_titre($langs->trans('Edit').' '.$types[$product->type].' : '.$product->ref, "");
if ($mesg) { if ($mesg) {
print '<br><div class="error">'.$mesg.'</div><br>'; print '<br><div class="error">'.$mesg.'</div><br>';
@ -532,7 +532,7 @@ if ($_GET["id"])
$langs->load("bills"); $langs->load("bills");
print '<tr><td>'.$langs->trans("VATRate").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("VATRate").'</td><td colspan="2">';
$html = new Form($db); $html = new Form($db);
print $html->select_tva("tva_tx", $product->tva_tx); print $html->select_tva("tva_tx", $product->tva_tx, $mysoc, '');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
print '<select name="statut">'; print '<select name="statut">';