Fix: Super maxi debuggage sur la gestion des prix HT et TTC
This commit is contained in:
parent
82d84a4df3
commit
bc38375fa0
@ -394,8 +394,9 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
|
||||
// TVA Intra
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("TVAIntra").'</td><td>';
|
||||
print '<input name="tva" size="20" value="' . $conf->global->MAIN_INFO_TVAINTRA . '"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("VATIntra").'</td><td>';
|
||||
print '<input name="tva" size="20" value="' . $conf->global->MAIN_INFO_TVAINTRA . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -524,9 +525,12 @@ else
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Identifiants de la société (propre au pays)
|
||||
print '<form name="formsoc" method="post">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
$var=true;
|
||||
@ -607,12 +611,48 @@ else
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// TVA Intracommunautaire
|
||||
// TVA
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a,b) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?countryCode='+a+'&vatNumber='+b,'".$langs->trans("VATIntraCheckableOnEUSite")."',500,260);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
}
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("TVAIntra").'</td><td>' . $conf->global->MAIN_INFO_TVAINTRA . '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("VATIntra").'</td>';
|
||||
print '<td>';
|
||||
if ($conf->global->MAIN_INFO_TVAINTRA)
|
||||
{
|
||||
$s='';
|
||||
$code=substr($conf->global->MAIN_INFO_TVAINTRA,0,2);
|
||||
$num=substr($conf->global->MAIN_INFO_TVAINTRA,2);
|
||||
$s.=$conf->global->MAIN_INFO_TVAINTRA;
|
||||
$s.='<input type="hidden" name="tva_intra_code" size="1" maxlength="2" value="'.$code.'">';
|
||||
$s.='<input type="hidden" name="tva_intra_num" size="12" maxlength="18" value="'.$num.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra_code.value,document.formsoc.tva_intra_num.value);" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithhelp($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
/*
|
||||
* Options fiscale
|
||||
|
||||
@ -485,12 +485,18 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
|
||||
*/
|
||||
if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
||||
{
|
||||
if ($_POST['qty'] && (($_POST['np_price']!=0 && $_POST['np_desc']) || $_POST['idprod']))
|
||||
if ($_POST['qty'] && (($_POST['np_price']!='' && $_POST['np_desc']) || $_POST['idprod']))
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$ret=$propal->fetch($_POST['propalid']);
|
||||
$soc = new Societe($db, $propal->socid);
|
||||
$soc->fetch($propal->socid);
|
||||
if ($ret < 0)
|
||||
{
|
||||
dolibarr_print_error($db,$propal->error);
|
||||
exit;
|
||||
}
|
||||
$ret=$propal->fetch_client();
|
||||
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
@ -500,16 +506,36 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
||||
$prod = new Product($db, $_POST['idprod']);
|
||||
$prod->fetch($_POST['idprod']);
|
||||
|
||||
// multiprix
|
||||
$tva_tx = get_default_tva($mysoc,$propal->client,$prod->tva_tx);
|
||||
|
||||
// On defini prix unitaire
|
||||
if ($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
{
|
||||
$pu = $prod->multiprices[$soc->price_level];
|
||||
$pu_ht = $prod->multiprices[$fac->client->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$fac->client->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$fac->client->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$prod->price;
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
}
|
||||
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tva_tx != $prod->tva_tx)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
// La description de la ligne est celle saisie ou
|
||||
// celle du produit si PRODUIT_CHANGE_PROD_DESC est défini
|
||||
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
|
||||
@ -520,12 +546,10 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
||||
{
|
||||
$desc = $_POST['np_desc'];
|
||||
}
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$_POST['np_price'];
|
||||
$pu_ht=$_POST['np_price'];
|
||||
$tva_tx=$_POST['np_tva_tx'];
|
||||
$desc=$_POST['np_desc'];
|
||||
}
|
||||
@ -533,12 +557,13 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
||||
$propal->addline(
|
||||
$_POST['propalid'],
|
||||
$desc,
|
||||
$pu,
|
||||
$pu_ht,
|
||||
$_POST['qty'],
|
||||
$tva_tx,
|
||||
$_POST['idprod'],
|
||||
$_POST['remise_percent'],
|
||||
'HT'
|
||||
$price_base_type,
|
||||
$pu_ttc
|
||||
);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
|
||||
@ -626,7 +626,7 @@ class Commande extends CommonObject
|
||||
*/
|
||||
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0)
|
||||
{
|
||||
dolibarr_syslog("Commande::addline $commandeid, $desc, $pu, $qty, $txtva, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc");
|
||||
dolibarr_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
|
||||
if ($this->statut == 0)
|
||||
@ -641,9 +641,15 @@ class Commande extends CommonObject
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
|
||||
if ($price_base_type=='HT') $pu=$pu_ht;
|
||||
else $pu=$pu_ttc;
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
@ -654,6 +660,7 @@ class Commande extends CommonObject
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
||||
// \TODO A virer
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
$remise = 0;
|
||||
@ -680,7 +687,7 @@ class Commande extends CommonObject
|
||||
$ligne->total_tva=$total_tva;
|
||||
$ligne->total_ttc=$total_ttc;
|
||||
|
||||
// Ne plus utiliser
|
||||
// \TODO Ne plus utiliser
|
||||
$ligne->price=$price;
|
||||
$ligne->remise=$remise;
|
||||
|
||||
@ -688,7 +695,7 @@ class Commande extends CommonObject
|
||||
if ($result > 0)
|
||||
{
|
||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||
$result=$this->update_price($this->id);
|
||||
$result=$this->update_price($commandeid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -1476,9 +1483,6 @@ class Commande extends CommonObject
|
||||
$this->total_tva += ($obj->total_ttc - $obj->total_ht);
|
||||
$this->total_ttc += $obj->total_ttc;
|
||||
|
||||
// Anciens indicateurs
|
||||
$this->amount_ht += ($obj->price * $obj->qty);
|
||||
$this->total_remise += 0; // Plus de remise globale (toute remise est sur une ligne)
|
||||
$tvas[$obj->tva_taux] += ($obj->total_ttc - $obj->total_ht);
|
||||
$i++;
|
||||
}
|
||||
@ -1487,14 +1491,13 @@ class Commande extends CommonObject
|
||||
|
||||
// Met a jour indicateurs
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET";
|
||||
$sql .= " amount_ht='".price2num($this->amount_ht)."'";
|
||||
$sql .= ", total_ht='". price2num($this->total_ht)."'";
|
||||
$sql .= ", tva='". price2num($this->total_tva)."'";
|
||||
$sql .= ", total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql .= ", remise='".price2num($this->total_remise)."'";
|
||||
$sql .= " total_ht='". price2num($this->total_ht)."',";
|
||||
$sql .= " tva='". price2num($this->total_tva)."',";
|
||||
$sql .= " total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql .=" WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Facture::update_price sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
@ -1566,32 +1569,33 @@ class Commande extends CommonObject
|
||||
* \param date_livraison Date de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_date_livraison($user, $date_livraison)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
function set_date_livraison($user, $date_livraison)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET date_livraison = ".($date_livraison ? $this->db->idate($date_livraison) : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->date_livraison = $date_livraison;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Commande::set_date_livraison Erreur SQL sql=$sql");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET date_livraison = ".($date_livraison ? $this->db->idate($date_livraison) : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
dolibarr_syslog("Commande::set_date_livraison sql=$sql",LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->date_livraison = $date_livraison;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Commande::set_date_livraison ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Définit une adresse de livraison
|
||||
|
||||
@ -244,11 +244,13 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->commande->creer)
|
||||
|
||||
if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer)
|
||||
{
|
||||
$datelivraison=dolibarr_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$result=$commande->set_date_livraison($user,$datelivraison);
|
||||
if ($result < 0)
|
||||
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$datelivraison=dolibarr_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$result=$commande->set_date_livraison($user,$datelivraison);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||
}
|
||||
@ -302,12 +304,12 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$ret=$commande->fetch($_POST['id']);
|
||||
$ret=$commande->fetch_client();
|
||||
if ($ret < 0)
|
||||
{
|
||||
dolibarr_print_error($db,$commande->error);
|
||||
exit;
|
||||
}
|
||||
$ret=$commande->fetch_client();
|
||||
|
||||
$price_base_type = 'HT';
|
||||
|
||||
@ -320,39 +322,52 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
$prod = new Product($db, $_POST['idprod']);
|
||||
$prod->fetch($_POST['idprod']);
|
||||
|
||||
$price_base_type = $prod->price_base_type;
|
||||
|
||||
$libelle = $prod->libelle;
|
||||
$tva_tx = get_default_tva($mysoc,$commande->client,$prod->tva_tx);
|
||||
|
||||
// multiprix
|
||||
if ($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
{
|
||||
$pu = $prod->multiprices[$commande->client->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$commande->client->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$commande->client->price_level];
|
||||
$pu_ht = $prod->multiprices[$commande->client->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$commande->client->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$commande->client->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
}
|
||||
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tva_tx != $prod->tva_tx)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
// La description de la ligne est celle saisie ou
|
||||
// celle du produit si PRODUIT_CHANGE_PROD_DESC est défini
|
||||
$libelle = $prod->libelle;
|
||||
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
|
||||
{
|
||||
$desc = $prod->description;
|
||||
}
|
||||
else
|
||||
{
|
||||
$desc=$_POST['np_desc'];
|
||||
$desc = $_POST['np_desc'];
|
||||
}
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$commande->client,$prod->tva_tx);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$_POST['pu'];
|
||||
$pu_ht=$_POST['pu'];
|
||||
$tva_tx=$_POST['tva_tx'];
|
||||
$desc=$_POST['np_desc'];
|
||||
}
|
||||
@ -360,7 +375,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
$result = $commande->addline(
|
||||
$_POST['id'],
|
||||
$desc,
|
||||
$pu,
|
||||
$pu_ht,
|
||||
$_POST['qty'],
|
||||
$tva_tx,
|
||||
$_POST['idprod'],
|
||||
@ -715,178 +730,176 @@ $html = new Form($db);
|
||||
*********************************************************************/
|
||||
if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
print_titre($langs->trans('CreateOrder'));
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$new_commande = new Commande($db);
|
||||
|
||||
if ($propalid)
|
||||
{
|
||||
$sql = 'SELECT s.nom, s.prefix_comm, s.rowid';
|
||||
$sql.= ', p.price, p.remise, p.remise_percent, p.tva, p.total, p.ref, p.fk_cond_reglement, p.fk_mode_reglement';
|
||||
$sql.= ', '.$db->pdate('p.datep').' as dp';
|
||||
$sql.= ', c.id as statut, c.label as lst';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p, '.MAIN_DB_PREFIX.'c_propalst as c';
|
||||
$sql .= ' WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id';
|
||||
$sql .= ' AND p.rowid = '.$propalid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT s.nom, s.prefix_comm, s.rowid, s.mode_reglement, s.cond_reglement ';
|
||||
$sql .= 'FROM '.MAIN_DB_PREFIX.'societe as s ';
|
||||
$sql .= 'WHERE s.rowid = '.$_GET['socid'];
|
||||
}
|
||||
$resql = $db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($obj->rowid);
|
||||
|
||||
$nbrow=7;
|
||||
|
||||
print '<form name="crea_commande" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_client.'">';
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td>';
|
||||
print '<td>'.$langs->trans('NotePublic').'</td></tr>';
|
||||
|
||||
// Reference client
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
|
||||
print '<input type="text" name="ref_client" value=""></td>';
|
||||
print '<td rowspan="'.$nbrow.'" valign="top"><textarea name="note" cols="70" rows="8"></textarea></td></tr>';
|
||||
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
/*
|
||||
* Contact de la commande
|
||||
*/
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
||||
$html->select_date('','re','','','',"crea_commande");
|
||||
print '</td></tr>';
|
||||
|
||||
// Date de livraison
|
||||
if ($conf->expedition->enabled)
|
||||
{
|
||||
print "<tr><td>".$langs->trans("DateDelivery")."</td><td>";
|
||||
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY)
|
||||
{
|
||||
$tmpdte = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
$html->select_date($tmpdte,'liv_','','',1,"crea_commande");
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_date(-1,'liv_','','',1,"crea_commande");
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Adresse de livraison
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td>';
|
||||
$numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1);
|
||||
|
||||
if ($numaddress==0)
|
||||
{
|
||||
print ' <a href="../comm/adresse_livraison.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Conditions de réglement
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
$html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode de réglement
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
$html->select_types_paiements($soc->mode_reglement,'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
$numprojet=$html->select_projects($soc->id,$projetid,'projetid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <a href=../projet/fiche.php?socid='.$soc->id.'&action=create>'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print_titre($langs->trans('CreateOrder'));
|
||||
|
||||
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
||||
$html->selectSourcesCommande('','source_id',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
// pdf
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
|
||||
$model=new ModelePDFCommandes();
|
||||
$liste=$model->liste_modeles($db);
|
||||
$html->select_array('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
if ($propalid > 0)
|
||||
{
|
||||
$amount = ($obj->price);
|
||||
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
|
||||
print '<input type="hidden" name="total" value="'.$obj->total.'">'."\n";
|
||||
print '<input type="hidden" name="remise" value="'.$obj->remise.'">'."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="'.$obj->remise_percent.'">'."\n";
|
||||
print '<input type="hidden" name="tva" value="'.$obj->tva.'">'."\n";
|
||||
print '<input type="hidden" name="propalid" value="'.$propalid.'">';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="2">'.$obj->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($amount).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('VAT').'</td><td colspan="2">'.price($obj->tva).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($obj->total).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE)
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$new_commande = new Commande($db);
|
||||
|
||||
if ($propalid)
|
||||
{
|
||||
$sql = 'SELECT s.nom, s.prefix_comm, s.rowid';
|
||||
$sql.= ', p.price, p.remise, p.remise_percent, p.tva, p.total, p.ref, p.fk_cond_reglement, p.fk_mode_reglement';
|
||||
$sql.= ', '.$db->pdate('p.datep').' as dp';
|
||||
$sql.= ', c.id as statut, c.label as lst';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p, '.MAIN_DB_PREFIX.'c_propalst as c';
|
||||
$sql .= ' WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id';
|
||||
$sql .= ' AND p.rowid = '.$propalid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT s.nom, s.prefix_comm, s.rowid, s.mode_reglement, s.cond_reglement ';
|
||||
$sql .= 'FROM '.MAIN_DB_PREFIX.'societe as s ';
|
||||
$sql .= 'WHERE s.rowid = '.$_GET['socid'];
|
||||
}
|
||||
$resql = $db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
/*
|
||||
* Services/produits prédéfinis
|
||||
*/
|
||||
$NBLINES=8;
|
||||
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<tr><td>'.$langs->trans('ProductsAndServices').'</td>';
|
||||
print '<td>'.$langs->trans('Qty').'</td>';
|
||||
print '<td>'.$langs->trans('ReductionShort').'</td>';
|
||||
print '</tr>';
|
||||
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($obj->rowid);
|
||||
|
||||
$nbrow=9;
|
||||
|
||||
print '<form name="crea_commande" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_client.'">';
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td>';
|
||||
print '<td>'.$langs->trans('NotePublic').'</td></tr>';
|
||||
|
||||
// Reference client
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
|
||||
print '<input type="text" name="ref_client" value=""></td>';
|
||||
print '<td rowspan="'.$nbrow.'" valign="top"><textarea name="note" cols="70" rows="8"></textarea></td></tr>';
|
||||
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
/*
|
||||
* Contact de la commande
|
||||
*/
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
||||
$html->select_date('','re','','','',"crea_commande");
|
||||
print '</td></tr>';
|
||||
|
||||
// Date de livraison
|
||||
print "<tr><td>".$langs->trans("DateDelivery")."</td><td>";
|
||||
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY)
|
||||
{
|
||||
$tmpdte = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
$html->select_date($tmpdte,'liv_','','',1,"crea_commande");
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_date(-1,'liv_','','',1,"crea_commande");
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Adresse de livraison
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td>';
|
||||
$numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1);
|
||||
|
||||
if ($numaddress==0)
|
||||
{
|
||||
print ' <a href="../comm/adresse_livraison.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Conditions de réglement
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
$html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode de réglement
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
$html->select_types_paiements($soc->mode_reglement,'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
$numprojet=$html->select_projects($soc->id,$projetid,'projetid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <a href=../projet/fiche.php?socid='.$soc->id.'&action=create>'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('Source').'</td><td colspan="2">';
|
||||
$html->selectSourcesCommande('','source_id',1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td colspan="2">';
|
||||
// pdf
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
|
||||
$model=new ModelePDFCommandes();
|
||||
$liste=$model->liste_modeles($db);
|
||||
$html->select_array('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
if ($propalid > 0)
|
||||
{
|
||||
$amount = ($obj->price);
|
||||
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
|
||||
print '<input type="hidden" name="total" value="'.$obj->total.'">'."\n";
|
||||
print '<input type="hidden" name="remise" value="'.$obj->remise.'">'."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="'.$obj->remise_percent.'">'."\n";
|
||||
print '<input type="hidden" name="tva" value="'.$obj->tva.'">'."\n";
|
||||
print '<input type="hidden" name="propalid" value="'.$propalid.'">';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="2">'.$obj->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($amount).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('VAT').'</td><td colspan="2">'.price($obj->tva).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($obj->total).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE)
|
||||
{
|
||||
/*
|
||||
* Services/produits prédéfinis
|
||||
*/
|
||||
$NBLINES=8;
|
||||
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<tr><td>'.$langs->trans('ProductsAndServices').'</td>';
|
||||
print '<td>'.$langs->trans('Qty').'</td>';
|
||||
print '<td>'.$langs->trans('ReductionShort').'</td>';
|
||||
print '</tr>';
|
||||
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
||||
{
|
||||
print '<tr><td>';
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
|
||||
@ -141,7 +141,7 @@ if ($_GET["id"] > 0)
|
||||
{
|
||||
if ($commande->statut > 0)
|
||||
{
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -728,6 +728,11 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
$ret=$fac->fetch($_POST['facid']);
|
||||
if ($ret < 0)
|
||||
{
|
||||
dolibarr_print_error($db,$fac->error);
|
||||
exit;
|
||||
}
|
||||
$ret=$fac->fetch_client();
|
||||
|
||||
$date_start='';
|
||||
@ -768,21 +773,36 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
$prod = new Product($db, $_POST['idprod']);
|
||||
$prod->fetch($_POST['idprod']);
|
||||
|
||||
$price_base_type = $prod->price_base_type;
|
||||
$tva_tx = get_default_tva($mysoc,$fac->client,$prod->tva_tx);
|
||||
|
||||
// multiprix
|
||||
// On defini prix unitaire
|
||||
if ($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
{
|
||||
$pu = $prod->multiprices[$fac->client->price_level];
|
||||
$pu_ht = $prod->multiprices[$fac->client->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$fac->client->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$fac->client->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu = $prod->price;
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
}
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tva_tx != $prod->tva_tx)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
// La description de la ligne est celle saisie ou
|
||||
// celle du produit si PRODUIT_CHANGE_PROD_DESC défini
|
||||
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
|
||||
@ -793,12 +813,10 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
{
|
||||
$desc=$_POST['np_desc'];
|
||||
}
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$fac->client,$prod->tva_tx);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$_POST['pu'];
|
||||
$pu_ht=$_POST['pu'];
|
||||
$tva_tx=$_POST['tva_tx'];
|
||||
$desc=$_POST['np_desc'];
|
||||
}
|
||||
@ -807,7 +825,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
$result = $fac->addline(
|
||||
$_POST['facid'],
|
||||
$desc,
|
||||
$pu,
|
||||
$pu_ht,
|
||||
$_POST['qty'],
|
||||
$tva_tx,
|
||||
$_POST['idprod'],
|
||||
@ -1637,14 +1655,14 @@ if ($_GET['action'] == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Fiche en mode visu */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
$id = $_GET['facid'];
|
||||
if ($id > 0)
|
||||
{
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Fiche en mode visu / edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$fac = New Facture($db);
|
||||
@ -1652,6 +1670,8 @@ else
|
||||
{
|
||||
if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0);
|
||||
|
||||
$result=$fac->fetch_client();
|
||||
|
||||
$soc = new Societe($db, $fac->socid);
|
||||
$soc->fetch($fac->socid);
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
@ -2391,9 +2411,9 @@ else
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
if(! $soc->tva_assuj)
|
||||
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
else
|
||||
print $html->select_tva('tva_tx',$objp->tva_taux,$mysoc,$soc);
|
||||
print $html->select_tva('tva_tx',$objp->tva_taux,$mysoc,$soc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input size="6" type="text" class="flat" name="price" value="'.price($objp->subprice,0,'',0).'"></td>';
|
||||
print '<td align="right">';
|
||||
@ -2475,9 +2495,9 @@ else
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
if($soc->tva_assuj == "0")
|
||||
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
else
|
||||
$html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||
$html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" name="pu" size="6"></td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="'.($fac->type==2?'-1':'1').'" size="2"></td>';
|
||||
|
||||
@ -285,7 +285,7 @@ if ($_GET["propalid"] > 0)
|
||||
|
||||
// Amount
|
||||
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($propal->price).'</b></td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($propal->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '<tr><td height="10">'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2">'.price($propal->total_tva).'</td>';
|
||||
@ -304,7 +304,8 @@ if ($_GET["propalid"] > 0)
|
||||
*/
|
||||
$sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.fk_remise_except,';
|
||||
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc,';
|
||||
$sql.= ' p.rowid as prodid, p.label as product, p.ref, p.fk_product_type, ';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
|
||||
@ -424,16 +425,13 @@ if ($_GET["propalid"] > 0)
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td align="right">'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."</td>\n";
|
||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||
|
||||
print '<td colspan="3"> </td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$total = $total + ($objp->qty * $objp->price);
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
@ -647,9 +645,12 @@ else
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$year = $_REQUEST["year"];
|
||||
$month = $_REQUEST["month"];
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, s.client,";
|
||||
$sql.= " p.rowid as propalid, p.price, p.ref, p.fk_statut,";
|
||||
$sql.= " p.rowid as propalid, p.ref, p.fk_statut,";
|
||||
$sql.= " p.total_ht, p.tva, p.total,";
|
||||
$sql.= $db->pdate("p.datep")." as dp, ";
|
||||
$sql.= $db->pdate("p.fin_validite")." as dfin";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
@ -697,7 +698,7 @@ else
|
||||
print_liste_field_titre($langs->trans("Ref"),"propal.php","p.ref","","&year=$year&viewstatut=$viewstatut",'width=20%',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Company"),"propal.php","s.nom","&viewstatut=$viewstatut","",'',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Date"),"propal.php","p.datep","&viewstatut=$viewstatut","",'align="right"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Price"),"propal.php","p.price","&viewstatut=$viewstatut","",'align="right"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),"propal.php","p.price","&viewstatut=$viewstatut","",'align="right"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),"propal.php","p.fk_statut","&viewstatut=$viewstatut","",'align="right"',$sortfield);
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print "</tr>\n";
|
||||
@ -706,24 +707,23 @@ else
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" valign="right">';
|
||||
print '<td valign="right">';
|
||||
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET['search_ref'].'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="40" name="search_societe" value="'.$_GET['search_societe'].'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1" align="right">';
|
||||
print $langs->trans('Month').' : ' . '<input class="flat" type="text" size="3" name="month" value="'.$month.'">';
|
||||
print ' '.$langs->trans('Year').' : ' . '<input class="flat" type="text" size="5" name="year" value="'.$year.'">';
|
||||
print '<td colspan="1" align="right">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="1" name="month" value="'.$month.'">';
|
||||
print ' '.$langs->trans('Year').': <input class="flat" type="text" size="1" name="year" value="'.$year.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET['search_montant_ht'].'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
//print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET['search_montant_ht'].'">';
|
||||
print '<td align="right">';
|
||||
$html->select_propal_statut($viewstatut);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '<td align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
@ -779,7 +779,7 @@ else
|
||||
print strftime("%Y",$objp->dp)."</a></td>\n";
|
||||
|
||||
// Prix
|
||||
print "<td align=\"right\">".price($objp->price)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->total_ht)."</td>\n";
|
||||
print "<td align=\"right\">".$propalstatic->LibStatut($objp->fk_statut,5)."</td>\n";
|
||||
print "<td> </td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1309,7 +1309,7 @@ class Facture extends CommonObject
|
||||
* \param date_end Date de fin de validité du service
|
||||
* \param ventil Code de ventilation comptable
|
||||
* \param info_bits Bits de type de lignes
|
||||
* \param fk_remise_exscept Id remise
|
||||
* \param fk_remise_except Id remise
|
||||
* \param price_base_type HT or TTC
|
||||
* \param pu_ttc Prix unitaire TTC
|
||||
* \return int >0 si ok, <0 si ko
|
||||
@ -1320,7 +1320,7 @@ class Facture extends CommonObject
|
||||
*/
|
||||
function addline($facid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $fk_remise_except='', $price_base_type='HT', $pu_ttc=0)
|
||||
{
|
||||
dolibarr_syslog("Facture::Addline $facid,$desc,$pu_ht,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$fk_remise_except,$price_base_type,$pu_ttc", LOG_DEBUG);
|
||||
dolibarr_syslog("Facture::Addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc", LOG_DEBUG);
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
|
||||
if ($this->brouillon)
|
||||
@ -1337,8 +1337,14 @@ class Facture extends CommonObject
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
|
||||
if ($price_base_type=='HT') $pu=$pu_ht;
|
||||
else $pu=$pu_ttc;
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
@ -1349,6 +1355,7 @@ class Facture extends CommonObject
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
||||
// \TODO A virer
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
$remise = 0;
|
||||
@ -1378,7 +1385,7 @@ class Facture extends CommonObject
|
||||
$ligne->total_tva=$total_tva;
|
||||
$ligne->total_ttc=$total_ttc;
|
||||
|
||||
// A ne plus utiliser
|
||||
// \TODO Ne plus utiliser
|
||||
$ligne->price=$price;
|
||||
$ligne->remise=$remise;
|
||||
|
||||
@ -1552,18 +1559,20 @@ class Facture extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Mise à jour des sommes de la facture et calculs denormalises
|
||||
\param facid id de la facture a modifier
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update_price($facid)
|
||||
*/
|
||||
function update_price($facid)
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
|
||||
$tvas=array();
|
||||
$err=0;
|
||||
|
||||
// Liste des lignes factures a sommer (Ne plus utiliser price)
|
||||
$sql = 'SELECT qty, tva_taux, subprice, remise_percent, price,';
|
||||
// Liste des lignes a sommer
|
||||
$sql = 'SELECT qty, tva_taux, subprice, remise_percent,';
|
||||
$sql.= ' total_ht, total_tva, total_ttc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet';
|
||||
$sql.= ' WHERE fk_facture = '.$facid;
|
||||
@ -1575,6 +1584,7 @@ class Facture extends CommonObject
|
||||
$this->total_ht = 0;
|
||||
$this->total_tva = 0;
|
||||
$this->total_ttc = 0;
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
@ -1585,9 +1595,6 @@ class Facture extends CommonObject
|
||||
$this->total_tva += ($obj->total_ttc - $obj->total_ht);
|
||||
$this->total_ttc += $obj->total_ttc;
|
||||
|
||||
// Ne plus utiliser amount, ni remise
|
||||
$this->amount_ht += ($obj->price * $obj->qty);
|
||||
$this->total_remise += 0; // Plus de remise globale (toute remise est sur une ligne)
|
||||
$tvas[$obj->tva_taux] += ($obj->total_ttc - $obj->total_ht);
|
||||
$i++;
|
||||
}
|
||||
@ -1595,15 +1602,14 @@ class Facture extends CommonObject
|
||||
$this->db->free($resql);
|
||||
|
||||
// Met a jour indicateurs
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture ';
|
||||
$sql .= "SET amount ='".price2num($this->amount_ht)."'";
|
||||
$sql .= ", remise='". price2num($this->total_remise)."'";
|
||||
$sql .= ", total='". price2num($this->total_ht)."'";
|
||||
$sql .= ", tva='". price2num($this->total_tva)."'";
|
||||
$sql .= ", total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
|
||||
$sql .= " total='". price2num($this->total_ht)."',";
|
||||
$sql .= " tva='". price2num($this->total_tva)."',";
|
||||
$sql .= " total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql .= ' WHERE rowid = '.$facid;
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
dolibarr_syslog("Facture::update_price sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// \TODO A supprimer car l'utilisation de facture_tva_sum non utilisable
|
||||
|
||||
@ -2449,7 +2449,7 @@ class Form
|
||||
/**
|
||||
* \brief Selection du taux de tva appliqué par vendeur
|
||||
* \param name Nom champ html
|
||||
* \param defaulttx Forçage du taux tva présélectionné. Mettre '' pour appliquer règle par défaut.
|
||||
* \param defaulttx Forçage du taux tva présélectionné. Mettre '' pour aucun forcage.
|
||||
* \param societe_vendeuse Objet société vendeuse
|
||||
* \param societe_acheteuse Objet société acheteuse
|
||||
* \param taux_produit Taux par defaut du produit vendu
|
||||
@ -2519,11 +2519,11 @@ class Form
|
||||
print '<font class="error">'.$this->db->error().'</font>';
|
||||
}
|
||||
|
||||
// Définition du taux à présélectionner
|
||||
if (("".$defaulttx) == "") $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$taux_produit);
|
||||
// Si taux par defaut n'a pu etre trouvé, on prend dernier.
|
||||
// Définition du taux à présélectionner (si defaulttx non forcé et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || strlen($defaulttx) == 0) $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$taux_produit);
|
||||
// Si taux par defaut n'a pu etre déterminé, on prend dernier de la liste.
|
||||
// Comme ils sont triés par ordre croissant, dernier = plus élevé = taux courant
|
||||
if (("".$defaulttx) == "") $defaulttx = $txtva[sizeof($txtva)-1];
|
||||
if ($defaulttx < 0 || strlen($defaulttx) == 0) $defaulttx = $txtva[sizeof($txtva)-1];
|
||||
|
||||
$nbdetaux = sizeof($txtva);
|
||||
|
||||
|
||||
@ -94,9 +94,9 @@ ProfId1PT=NIPC
|
||||
ProfId2PT=Social security number
|
||||
ProfId3PT=Commercial Record number
|
||||
ProfId4PT=Conservatory
|
||||
TVAIntra=Intracommunautary VAT
|
||||
VATIntraShort=Intra-communautary VAT code
|
||||
VATIntraVeryShort=VAT Intra-comm.
|
||||
VATIntra=VAT number
|
||||
VATIntraShort=VAT number
|
||||
VATIntraVeryShort=VAT
|
||||
VATIntraSyntaxIsValid=Syntax is valid
|
||||
VATIntraValueIsValid=Value is valid
|
||||
ProspectCustomer=Prospect / Customer
|
||||
@ -167,7 +167,7 @@ EditCompany=Edit company
|
||||
ThisUserIsNot=This user is not a prospect, customer nor supplier
|
||||
VATIntraCheck=Check
|
||||
VATIntraCheckDesc=The link <b>%s</b> allows to ask the european VAT checker service. An external internet access from server is required for this service to work.
|
||||
VATIntraCheckURL=http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm
|
||||
VATIntraCheckURL=http://ec.europa.eu/taxation_customs/vies/vieshome.do
|
||||
VATIntraCheckableOnEUSite=Check Intracomunnautary VAT on European commision site
|
||||
VATIntraManualCheck=You can also check manually from european web site <a href="%s" target="_new">%s</a>
|
||||
ErrorVATCheckMS_UNAVAILABLE=Check not possible. Check service is not provided by the member state (%s).
|
||||
|
||||
@ -27,7 +27,7 @@ ErrorRecordIsUsedByChild=Failed to delete this record. This record is used by at
|
||||
ErrorWrongValue=Wrong value
|
||||
ErrorWrongValueForParameterX=Wrong value for parameter %s
|
||||
ErrorNoRequestInError=No request in error
|
||||
ErrorServiceUnavailableTryLater=Service not available or busy for the moment. Try again later.
|
||||
ErrorServiceUnavailableTryLater=Service not available for the moment. Try again later.
|
||||
ErrorDuplicateField=Duplicate value in a unique field
|
||||
ErrorSomeErrorWereFoundRollbackIsDone=Some errors were found. We rollback changes.
|
||||
ErrorConfigParameterNotDefined=Parameter <b>%s</b> is not defined inside Dolibarr config file <b>conf.php</b>.
|
||||
|
||||
@ -73,9 +73,9 @@ ProfId1PT=
|
||||
ProfId2PT=Numéro de sécurité sociale
|
||||
ProfId3PT=Numéro d'enregistrement commercial
|
||||
ProfId4PT=
|
||||
TVAIntra=Numéro de TVA Intracommunautaire
|
||||
VATIntraShort=Numéro de TVA intra-communautaire
|
||||
VATIntraVeryShort=TVA intra-comm.
|
||||
VATIntra=Numéro de TVA
|
||||
VATIntraShort=Num TVA
|
||||
VATIntraVeryShort=N° TVA
|
||||
ProspectCustomer=Prospect / Client
|
||||
Prospect=Prospect
|
||||
CustomerCard=Fiche Client
|
||||
@ -137,7 +137,7 @@ Capital=Capital
|
||||
CapitalOf=Capital de %s
|
||||
EditCompany=Modification société
|
||||
ThisUserIsNot=Cet utilisateur n'est ni un prospect, ni un client, ni un fournisseur
|
||||
VATIntraCheckURL=http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm
|
||||
VATIntraCheckURL=http://ec.europa.eu/taxation_customs/vies/vieshome.do
|
||||
VATIntraCheckableOnEUSite=Verifier un numéro de TVA intra-communautaire sur le site de la Commission Européenne
|
||||
NorProspectNorCustomer=Pas un prospect, ni un client
|
||||
JuridicalStatus=Statut juridique
|
||||
|
||||
@ -94,9 +94,9 @@ ProfId1PT=NIPC
|
||||
ProfId2PT=Num sécurité social
|
||||
ProfId3PT=Num enreg. commercial
|
||||
ProfId4PT=Conservatory
|
||||
TVAIntra=Numéro de TVA Intracommunautaire
|
||||
VATIntraShort=N° TVA Intra-communautaire
|
||||
VATIntraVeryShort=TVA Intra-comm.
|
||||
VATIntra=Numéro de TVA
|
||||
VATIntraShort=Num TVA
|
||||
VATIntraVeryShort=N° TVA
|
||||
VATIntraSyntaxIsValid=Syntaxe valide
|
||||
VATIntraValueIsValid=Valeure valide
|
||||
ProspectCustomer=Prospect / Client
|
||||
@ -167,7 +167,7 @@ EditCompany=Modification soci
|
||||
ThisUserIsNot=Cet utilisateur n'est ni un prospect, ni un client, ni un fournisseur
|
||||
VATIntraCheck=Vérifier
|
||||
VATIntraCheckDesc=Le lien <b>%s</b> permet d'interroger le service européen de contrôle des numéro de TVA intracommunautaire. Un accès au monde internet exterieur depuis le serveur est requis pour que ce service fonctionne.
|
||||
VATIntraCheckURL=http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm
|
||||
VATIntraCheckURL=http://ec.europa.eu/taxation_customs/vies/vieshome.do
|
||||
VATIntraCheckableOnEUSite=Vérifier sur le site de la Commission Européenne
|
||||
VATIntraManualCheck=Vous pouvez aussi vérifier manuellement via le site européen <a href="%s" target="_new">%s</a>
|
||||
ErrorVATCheckMS_UNAVAILABLE=Vérification impossible. Le service de vérification n'est pas fourni par ce pays membre (%s).
|
||||
|
||||
@ -27,7 +27,7 @@ ErrorRecordIsUsedByChild=Impossible de supprimer cet enregistrement. Ce dernier
|
||||
ErrorWrongValue=Valeur incorrecte
|
||||
ErrorWrongValueForParameterX=Valeur incorrecte pour le paramètre %s
|
||||
ErrorNoRequestInError=Aucune requete en erreur
|
||||
ErrorServiceUnavailableTryLater=Service non disponible ou saturé actuellement. Réessayer plus tard.
|
||||
ErrorServiceUnavailableTryLater=Service non disponible actuellement. Réessayer plus tard.
|
||||
ErrorDuplicateField=Doublon dans un champ unique
|
||||
ErrorSomeErrorWereFoundRollbackIsDone=Des erreurs ont été trouvés. On rollback les modifications.
|
||||
ErrorConfigParameterNotDefined=Le parametre <b>%s</b> n'est pas défini dans le fichier de configuration Dolibarr <b>conf.php</b>.
|
||||
|
||||
@ -77,9 +77,9 @@ ProfId1PT=NIPC
|
||||
ProfId2PT=Nummer sociale zekerheid
|
||||
ProfId3PT=Nummer Commercial Record
|
||||
ProfId4PT=Conservatory
|
||||
TVAIntra=Intracommunautary VAT
|
||||
VATIntraShort=Intra-communautary VAT code
|
||||
VATIntraVeryShort=VAT Intra-comm.
|
||||
VATIntra=VAT number
|
||||
VATIntraShort=VAT number
|
||||
VATIntraVeryShort=VAT
|
||||
VATIntraSyntaxIsValid=Syntax is geldig
|
||||
VATIntraValueIsValid=Waarde is geldig
|
||||
ProspectCustomer=Prospect / Klant
|
||||
@ -145,7 +145,7 @@ EditCompany=Aanpassen bedrijf
|
||||
ThisUserIsNot=Deze gebruiker is geen prospect, klant of leverancier
|
||||
VATIntraCheck=Controleer
|
||||
VATIntraCheckDesc=De verbinding <b>%s</b> laat toe de europeese BTW testservice te bevragen. Een toegang tot het internet vanaf de server is vereist om deze dienst te laten werken.
|
||||
VATIntraCheckURL=http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm
|
||||
VATIntraCheckURL=http://ec.europa.eu/taxation_customs/vies/vieshome.do
|
||||
VATIntraCheckableOnEUSite=Check Intracomunnautary VAT on European commision site
|
||||
VATIntraManualCheck=U kan ook zelf de test doen via de europese website <a href="%s" target="_new">%s</a>
|
||||
ErrorVATCheckMS_UNAVAILABLE=Test niet mogelijk. Testservice wordt niet voorzien door de lidstaat (%s).
|
||||
|
||||
@ -641,16 +641,17 @@ function dolibarr_getdate($timestamp,$fast=false)
|
||||
\param month Mois
|
||||
\param day Jour
|
||||
\param year Année
|
||||
\return date Date
|
||||
\return timestamp Date en timestamp, '' if error
|
||||
\remarks PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||
*/
|
||||
function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0)
|
||||
{
|
||||
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
||||
|
||||
if (! $month || ! $day) return '';
|
||||
|
||||
$usealternatemethod=false;
|
||||
if ($timestamp <= 0) $usealternatemethod=true; // <= 1970
|
||||
if ($timestamp >= 2145913200) $usealternatemethod=true; // >= 2038
|
||||
if ($year <= 1970) $usealternatemethod=true; // <= 1970
|
||||
if ($year >= 2038) $usealternatemethod=true; // >= 2038
|
||||
|
||||
if ($usealternatemethod || $gm) // Si time gm, seule adodb peut convertir
|
||||
{
|
||||
@ -2248,23 +2249,23 @@ function price2num($amount,$rounding='')
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui renvoie la tva d'une ligne (en fonction du vendeur, acheteur et taux du produit)
|
||||
\remarks Si vendeur non assujeti à TVA, TVA par défaut=0. Fin de règle.
|
||||
Si le (pays vendeur = pays acheteur) alors TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||
Si vendeur et acheteur dans Communauté européenne et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par défaut=0 (La TVA doit être payé par acheteur au centre d'impots de son pays et non au vendeur). Fin de règle.
|
||||
Si vendeur et acheteur dans Communauté européenne et acheteur = particulier ou entreprise sans num TVA intra alors TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||
Si vendeur et acheteur dans Communauté européenne et acheteur = entreprise avec num TVA intra alors TVA par défaut=0. Fin de règle.
|
||||
Sinon TVA proposée par défaut=0. Fin de règle.
|
||||
\param societe_vendeuse Objet société vendeuse
|
||||
\param societe_acheteuse Objet société acheteuse
|
||||
\param taux_produit Taux par defaut du produit vendu
|
||||
\return float Taux de tva de la ligne
|
||||
\brief Fonction qui renvoie la tva d'une ligne (en fonction du vendeur, acheteur et taux du produit)
|
||||
\remarks Si vendeur non assujeti à TVA, TVA par défaut=0. Fin de règle.
|
||||
Si le (pays vendeur = pays acheteur) alors TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||
Si (vendeur et acheteur dans Communauté européenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par défaut=0 (La TVA doit être payé par acheteur au centre d'impots de son pays et non au vendeur). Fin de règle.
|
||||
Si (vendeur et acheteur dans Communauté européenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||
Si (vendeur et acheteur dans Communauté européenne) et (acheteur = entreprise avec num TVA) intra alors TVA par défaut=0. Fin de règle.
|
||||
Sinon TVA proposée par défaut=0. Fin de règle.
|
||||
\param societe_vendeuse Objet société vendeuse
|
||||
\param societe_acheteuse Objet société acheteuse
|
||||
\param taux_produit Taux par defaut du produit vendu
|
||||
\return float Taux de tva à appliquer, -1 si ne peut etre déterminé
|
||||
*/
|
||||
function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
||||
{
|
||||
dolibarr_syslog("get_default_tva vendeur_assujeti=$societe_vendeuse->tva_assuj pays_vendeur=$societe_vendeuse->pays_id, pays_acheteur=$societe_acheteuse->pays_id, taux_produit=$taux_produit");
|
||||
|
||||
if (!is_object($societe_vendeuse)) return 0;
|
||||
if (!is_object($societe_vendeuse)) return -1;
|
||||
|
||||
// Si vendeur non assujeti à TVA (tva_assuj vaut 0/1 ou franchise/reel)
|
||||
if (is_numeric($societe_vendeuse->tva_assuj) && ! $societe_vendeuse->tva_assuj) return 0;
|
||||
@ -2275,25 +2276,28 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
||||
// Le test ci-dessus ne devrait pas etre necessaire. Me signaler l'exemple du cas juridique concercné si le test suivant n'est pas suffisant.
|
||||
if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id))
|
||||
{
|
||||
if (strlen($taux_produit) == 0) return -1; // Si taux produit = '', on ne peut déterminer taux tva
|
||||
return $taux_produit;
|
||||
}
|
||||
|
||||
// Si vendeur et acheteur dans Communauté européenne et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par défaut=0 (La TVA doit être payé par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de règle.
|
||||
// Si (vendeur et acheteur dans Communauté européenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par défaut=0 (La TVA doit être payé par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de règle.
|
||||
// Non géré
|
||||
|
||||
// Si vendeur et acheteur dans Communauté européenne et acheteur = particulier ou entreprise sans num TVA intra alors TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||
// Si (vendeur et acheteur dans Communauté européenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||
if (is_object($societe_acheteuse) && ($societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC()) && ! $societe_acheteuse->tva_intra)
|
||||
{
|
||||
if (strlen($taux_produit) == 0) return -1; // Si taux produit = '', on ne peut déterminer taux tva
|
||||
return $taux_produit;
|
||||
}
|
||||
|
||||
// Si vendeur et acheteur dans Communauté européenne et acheteur = entreprise avec num TVA intra alors TVA par défaut=0. Fin de règle.
|
||||
// Si (vendeur et acheteur dans Communauté européenne) et (acheteur = entreprise avec num TVA intra) alors TVA par défaut=0. Fin de règle.
|
||||
if (is_object($societe_acheteuse) && ($societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC()) && $societe_acheteuse->tva_intra)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Sinon la TVA proposée par défaut=0. Fin de règle.
|
||||
// Rem: Cela signifie qu'au moins un des 2 est hors Communauté européenne et que le pays diffère
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -255,12 +255,13 @@ class Propal extends CommonObject
|
||||
* \brief Ajout d'un produit dans la proposition, en base
|
||||
* \param propalid Id de la propale
|
||||
* \param desc Description de la ligne
|
||||
* \param pu Prix unitaire
|
||||
* \param pu_ht Prix unitaire
|
||||
* \param qty Quantité
|
||||
* \param txtva Taux de tva forcé, sinon -1
|
||||
* \param fk_product Id du produit/service predéfini
|
||||
* \param remise_percent Pourcentage de remise de la ligne
|
||||
* \param price_base_type HT or TTC
|
||||
* \param pu_ttc Prix unitaire TTC
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* \see add_product
|
||||
* \remarks Les parametres sont deja censé etre juste et avec valeurs finales a l'appel
|
||||
@ -268,9 +269,9 @@ class Propal extends CommonObject
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
function addline($propalid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT')
|
||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc)
|
||||
{
|
||||
dolibarr_syslog("Propal::Addline $propalid, $desc, $pu, $qty, $txtva, $fk_product, $remise_percent, $price_base_type");
|
||||
dolibarr_syslog("Propal::Addline propalid=$propalid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
|
||||
if ($this->statut == 0)
|
||||
@ -281,8 +282,18 @@ class Propal extends CommonObject
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
$pu = price2num($pu,'MU');
|
||||
$txtva = price2num($txtva,'MU');
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
@ -296,7 +307,8 @@ class Propal extends CommonObject
|
||||
// \TODO A virer
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
if ($remise_percent > 0)
|
||||
$remise = 0;
|
||||
if ($remise_percent > 0)
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
@ -311,9 +323,10 @@ class Propal extends CommonObject
|
||||
$ligne->tva_tx=$txtva;
|
||||
$ligne->fk_product=$fk_product;
|
||||
$ligne->remise_percent=$remise_percent;
|
||||
$ligne->subprice=$pu;
|
||||
$ligne->subprice=$pu_ht;
|
||||
$ligne->rang=-1;
|
||||
$ligne->info_bits=$info_bits;
|
||||
$ligne->fk_remise_except=$fk_remise_except;
|
||||
$ligne->total_ht=$total_ht;
|
||||
$ligne->total_tva=$total_tva;
|
||||
$ligne->total_ttc=$total_ttc;
|
||||
@ -326,8 +339,7 @@ class Propal extends CommonObject
|
||||
if ($result > 0)
|
||||
{
|
||||
// Mise a jour informations denormalisees au niveau de la facture meme
|
||||
$result=$this->update_price($facid);
|
||||
|
||||
$result=$this->update_price($propalid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -582,61 +594,67 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function update_price()
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
|
||||
$tvas=array();
|
||||
$err=0;
|
||||
|
||||
// Liste des lignes factures a sommer
|
||||
$sql = "SELECT price, qty, tva_tx, total_ht, total_tva, total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet";
|
||||
$sql.= " WHERE fk_propal = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Propal::update_price sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->total_ht = 0;
|
||||
$this->total_tva = 0;
|
||||
$this->total_ttc = 0;
|
||||
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->total_ht += $obj->total_ht;
|
||||
$this->total_tva += $obj->total_tva;
|
||||
$this->total_ttc += $obj->total_ttc;
|
||||
|
||||
// Anciens indicateurs
|
||||
$this->amount_ht += $obj->price * $obj->qty; // \TODO A virer
|
||||
$this->total_remise += 0; // Plus de remise globale (toute remise est sur une ligne)
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
// Liste des lignes a sommer
|
||||
$sql = "SELECT qty, tva_tx, subprice, remise_percent,";
|
||||
$sql.= " total_ht, total_tva, total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet";
|
||||
$sql.= " WHERE fk_propal = ".$this->id;
|
||||
|
||||
// Met a jour en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
|
||||
$sql .= " total_ht=".price2num($this->total_ht).",";
|
||||
$sql .= " tva=". price2num($this->total_tva).",";
|
||||
$sql .= " total=". price2num($this->total_ttc).",";
|
||||
//$sql .= " remise=". price2num($this->total_remise).","; // \TODO A virer
|
||||
$sql .= " price=". price2num($this->total_ht); // \TODO A virer
|
||||
$sql .=" WHERE rowid = ".$this->id;
|
||||
dolibarr_syslog("Propal::update_price sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->total_ht = 0;
|
||||
$this->total_tva = 0;
|
||||
$this->total_ttc = 0;
|
||||
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->total_ht += $obj->total_ht;
|
||||
$this->total_tva += ($obj->total_ttc - $obj->total_ht);
|
||||
$this->total_ttc += $obj->total_ttc;
|
||||
|
||||
$tvas[$obj->tva_taux] += ($obj->total_ttc - $obj->total_ht);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
dolibarr_syslog("Propal::update_price sql=".$sql);
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Propal::update_price error=".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Met a jour indicateurs
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
|
||||
$sql.= " total_ht=".price2num($this->total_ht).",";
|
||||
$sql.= " tva=". price2num($this->total_tva).",";
|
||||
$sql.= " total=". price2num($this->total_ttc);
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Propal::update_price sql=".$sql);
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Propal::update_price error=".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Propal::update_price error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -770,7 +788,8 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT p.rowid,ref,total,price,remise,remise_percent,remise_absolue,tva,fk_soc";
|
||||
$sql = "SELECT p.rowid,ref,remise,remise_percent,remise_absolue,fk_soc";
|
||||
$sql.= ", total, tva, total_ht";
|
||||
$sql.= ", ".$this->db->pdate("datep")." as dp";
|
||||
$sql.= ", ".$this->db->pdate("fin_validite")." as dfv";
|
||||
$sql.= ", ".$this->db->pdate("date_livraison")." as date_livraison";
|
||||
@ -782,12 +801,12 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fk_mode_reglement, cp.code as mode_reglement_code";
|
||||
$sql.= ", c.label as statut_label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= " WHERE p.fk_statut = c.id";
|
||||
$sql.= " AND p.rowid='".$rowid."'";
|
||||
|
||||
dolibarr_syslog("Propal.class::fecth rowid=".$rowid);
|
||||
dolibarr_syslog("Propal::fecth rowid=".$rowid);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -803,12 +822,11 @@ class Propal extends CommonObject
|
||||
$this->date = $obj->dp;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->price = $obj->price;
|
||||
$this->remise = $obj->remise;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->remise_absolue = $obj->remise_absolue;
|
||||
$this->total = $obj->total;
|
||||
$this->total_ht = $obj->price;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->tva;
|
||||
$this->total_ttc = $obj->total;
|
||||
$this->socid = $obj->fk_soc;
|
||||
@ -906,7 +924,7 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Propal.class::Fetch Error $this->error, sql=$sql");
|
||||
dolibarr_syslog("Propal::Fetch Error $this->error, sql=$sql");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -919,7 +937,7 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Propal.class::Fetch Error sql=$sql ".$this->error);
|
||||
dolibarr_syslog("Propal::Fetch Error sql=$sql ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2272,7 +2290,7 @@ class PropaleLigne
|
||||
*/
|
||||
function insert()
|
||||
{
|
||||
dolibarr_syslog("PropaleLigne.class::insert rang=".$this->rang);
|
||||
dolibarr_syslog("PropaleLigne::insert rang=".$this->rang);
|
||||
$this->db->begin();
|
||||
|
||||
// Nettoyage parameteres
|
||||
@ -2301,7 +2319,7 @@ class PropaleLigne
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
|
||||
$sql.= ' (fk_propal, description, fk_product, fk_remise_except, qty, tva_tx,';
|
||||
$sql.= ' subprice, remise_percent, price, remise, ';
|
||||
$sql.= ' subprice, remise_percent, ';
|
||||
$sql.= ' info_bits, ';
|
||||
$sql.= ' total_ht, total_tva, total_ttc, marge_tx, marque_tx, rang)';
|
||||
$sql.= " VALUES (".$this->fk_propal.",";
|
||||
@ -2314,8 +2332,6 @@ class PropaleLigne
|
||||
$sql.= " ".price2num($this->tva_tx).",";
|
||||
$sql.= " ".price2num($this->subprice).",";
|
||||
$sql.= " ".price2num($this->remise_percent).",";
|
||||
$sql.= " ".price2num($this->price).","; // \TODO A virer
|
||||
$sql.= " ".price2num($this->remise).","; // \TODO A virer
|
||||
$sql.= " '".$this->info_bits."',";
|
||||
$sql.= " ".price2num($this->total_ht).",";
|
||||
$sql.= " ".price2num($this->total_tva).",";
|
||||
@ -2327,7 +2343,7 @@ class PropaleLigne
|
||||
$sql.= ' '.$rangtouse;
|
||||
$sql.= ')';
|
||||
|
||||
dolibarr_syslog("PropaleLigne.class::insert sql=$sql");
|
||||
dolibarr_syslog("PropaleLigne::insert sql=$sql");
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -515,7 +515,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
||||
print $html->selectyesno('assujtva_value',1,1); // Assujeti par défaut en creation
|
||||
print '</td>';
|
||||
|
||||
// Code TVA intra
|
||||
// Code TVA
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
print "\n";
|
||||
@ -526,7 +526,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
||||
print '</script>';
|
||||
print "\n";
|
||||
}
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntraShort').'</td>';
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntra').'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
$s ='<input type="text" class="flat" name="tva_intra_code" size="1" maxlength="2" value="'.$soc->tva_intra_code.'">';
|
||||
$s.='<input type="text" class="flat" name="tva_intra_num" size="12" maxlength="18" value="'.$soc->tva_intra_num.'">';
|
||||
@ -806,18 +806,18 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
print $form->selectyesno('assujtva_value',$soc->tva_assuj,1);
|
||||
print '</td>';
|
||||
|
||||
// Code TVA intra
|
||||
// Code TVA
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a,b) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?countryCode='+a+'&vatNumber='+b,'".$langs->trans("VATIntraCheckableOnEUSite")."',500,230);\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?countryCode='+a+'&vatNumber='+b,'".$langs->trans("VATIntraCheckableOnEUSite")."',500,260);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
}
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntraShort').'</td>';
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntra').'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
$s ='<input type="text" class="flat" name="tva_intra_code" size="1" maxlength="2" value="'.$soc->tva_intra_code.'">';
|
||||
$s.='<input type="text" class="flat" name="tva_intra_num" size="12" maxlength="18" value="'.$soc->tva_intra_num.'">';
|
||||
@ -892,7 +892,8 @@ else
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<form name="formsoc" method="post">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$soc->nom.'</td></tr>';
|
||||
|
||||
@ -997,32 +998,49 @@ else
|
||||
// Assujeti TVA
|
||||
$html = new Form($db);
|
||||
print '<tr><td>';
|
||||
/* Pas besoin de gérer l'icone "Modifier" car le champ est déja editable quand société en mode "Edit"
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('VATIsUsed');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer && $_GET['action'] != 'editassujtva')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editassujtva&socid='.$soc->id.'">'.img_edit($langs->trans('SetMode')).'</a>';
|
||||
else
|
||||
print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if($_GET['action'] == 'editassujtva')
|
||||
print $html->form_assujetti_tva($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->tva_assuj,'assujtva_value');
|
||||
else if($soc->tva_assuj == 1)
|
||||
print 'oui';
|
||||
else
|
||||
print 'non';
|
||||
print '';
|
||||
*/
|
||||
print $langs->trans('VATIsUsed');
|
||||
print '</td><td>';
|
||||
print yn($soc->tva_assuj);
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrpa">'.$langs->trans('VATIntraShort').'</td><td>';
|
||||
print $soc->tva_intra;
|
||||
print '</td></tr>';
|
||||
|
||||
// VAT Code
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a,b) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?countryCode='+a+'&vatNumber='+b,'".$langs->trans("VATIntraCheckableOnEUSite")."',500,260);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
}
|
||||
print '<td nowrap="nowrpa">'.$langs->trans('VATIntra').'</td><td>';
|
||||
if ($soc->tva_intra)
|
||||
{
|
||||
$s='';
|
||||
$code=substr($soc->tva_intra,0,2);
|
||||
$num=substr($soc->tva_intra,2);
|
||||
$s.=$soc->tva_intra;
|
||||
$s.='<input type="hidden" name="tva_intra_code" size="1" maxlength="2" value="'.$code.'">';
|
||||
$s.='<input type="hidden" name="tva_intra_num" size="12" maxlength="18" value="'.$num.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra_code.value,document.formsoc.tva_intra_num.value);" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithhelp($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Capital
|
||||
print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3">';
|
||||
@ -1106,6 +1124,7 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print "</div>\n";
|
||||
/*
|
||||
*
|
||||
|
||||
@ -941,4 +941,6 @@ INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active)
|
||||
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (9, 'A6', 'Format A6', '105', '148', 'mm', 1);
|
||||
|
||||
ALTER TABLE llx_user ADD COLUMN phenix_login varchar(25) after webcal_login;
|
||||
ALTER TABLE llx_user ADD COLUMN phenix_pass varchar(128) after phenix_login;
|
||||
ALTER TABLE llx_user ADD COLUMN phenix_pass varchar(128) after phenix_login;
|
||||
|
||||
update llx_propal set total_ht = price where total_ht = 0 and total > 0;
|
||||
|
||||
@ -50,7 +50,7 @@ create table llx_societe
|
||||
siret varchar(16), -- IDProf2: siret pour france
|
||||
ape varchar(16), -- IDProf3: code ape pour france
|
||||
idprof4 varchar(16), -- IDProf4: nu pour france
|
||||
tva_intra varchar(20), -- tva intracommunautaire
|
||||
tva_intra varchar(20), -- tva
|
||||
capital real, -- capital de la société
|
||||
description text, --
|
||||
fk_stcomm tinyint DEFAULT 0, -- commercial statut
|
||||
|
||||
Loading…
Reference in New Issue
Block a user