forked from Wavyzz/dolibarr
New: Ajout constante MAIN_MAX_DECIMALS_SHOWN pour grer le nombre max de dcimal affichs (5 par dfaut).
Si le nb de dcimal dpasse, on limite 5 et on affiche ... la suite.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
||||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
/**
|
/**
|
||||||
\file htdocs/conf/conf.class.php
|
\file htdocs/conf/conf.class.php
|
||||||
\brief Fichier de la classe de stockage de la config courante
|
\brief Fichier de la classe de stockage de la config courante
|
||||||
|
\remarks La config est stock<63>e dans le fichier conf/conf.php
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -447,6 +448,12 @@ class Conf
|
|||||||
|
|
||||||
$this->format_date_short_java="dd/MM/yyyy";
|
$this->format_date_short_java="dd/MM/yyyy";
|
||||||
|
|
||||||
|
// Format montant affich<63>s
|
||||||
|
if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN))
|
||||||
|
{
|
||||||
|
$this->global->MAIN_MAX_DECIMALS_SHOWN=5;
|
||||||
|
}
|
||||||
|
|
||||||
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de d<>sactiver la fonction TVA
|
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de d<>sactiver la fonction TVA
|
||||||
* (pour particuliers ou lib<69>raux en franchise)
|
* (pour particuliers ou lib<69>raux en franchise)
|
||||||
* En attendant, valeur forc<72>e <20> 1
|
* En attendant, valeur forc<72>e <20> 1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.fr>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.fr>
|
||||||
*
|
*
|
||||||
@@ -218,14 +218,26 @@ if ($_GET['action'] == 'del_ligne')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Modification d'une ligne
|
// Modification d'une ligne
|
||||||
if ($_REQUEST['action'] == 'mod_ligne')
|
if ($_REQUEST['action'] == 'change_line')
|
||||||
{
|
{
|
||||||
if ($_REQUEST['etat'] == '1' && ! $_REQUEST['cancel']) // si on valide la modification
|
if ($_REQUEST['etat'] == '1' && ! $_REQUEST['cancel']) // si on valide la modification
|
||||||
{
|
{
|
||||||
$facfou = new FactureFournisseur($db,'',$_GET['facid']);
|
$facfou = new FactureFournisseur($db,'',$_GET['facid']);
|
||||||
|
|
||||||
|
if ($_POST['idprod'])
|
||||||
|
{
|
||||||
|
$prod = new Product($db);
|
||||||
|
$prod->fetch($_POST['idprod']);
|
||||||
|
|
||||||
|
$label = $prod->libelle;
|
||||||
|
|
||||||
|
$facfou->updateline($_GET['ligne_id'], $label, $_POST['puht'], $_POST['tauxtva'], $_POST['qty'], $_POST['idprod']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$facfou->updateline($_GET['ligne_id'], $_POST['label'], $_POST['puht'], $_POST['tauxtva'], $_POST['qty']);
|
$facfou->updateline($_GET['ligne_id'], $_POST['label'], $_POST['puht'], $_POST['tauxtva'], $_POST['qty']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['action'] == 'add_ligne')
|
if ($_GET['action'] == 'add_ligne')
|
||||||
@@ -435,9 +447,9 @@ else
|
|||||||
print '<tr><td valign="top">'.$langs->trans('Ref').'</td><td valign="top">';
|
print '<tr><td valign="top">'.$langs->trans('Ref').'</td><td valign="top">';
|
||||||
print '<input name="facnumber" type="text" value="'.$fac->ref.'"></td>';
|
print '<input name="facnumber" type="text" value="'.$fac->ref.'"></td>';
|
||||||
|
|
||||||
$rownb=8;
|
$rownb=9;
|
||||||
print '<td rowspan="'.$rownb.'" valign="top">';
|
print '<td rowspan="'.$rownb.'" valign="top">';
|
||||||
print '<textarea name="note" wrap="soft" cols="60" rows="'.ROWS_8.'">';
|
print '<textarea name="note" wrap="soft" cols="60" rows="'.ROWS_9.'">';
|
||||||
print $fac->note;
|
print $fac->note;
|
||||||
print '</textarea></td></tr>';
|
print '</textarea></td></tr>';
|
||||||
|
|
||||||
@@ -453,11 +465,9 @@ else
|
|||||||
if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < (time() - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < (time() - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
print '<tr><td>'.$langs->trans('AmountHT').'</td><td nowrap="nowrap"><b>'.price($fac->total_ht).'</b></td></tr>';
|
||||||
print '<td nowrap="nowrap">'.price($fac->total_ht).'</td></tr>';
|
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td nowrap="nowrap">'.price($fac->total_tva).'</td></tr>';
|
||||||
|
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td nowrap="nowrap">'.price($fac->total_ttc).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
|
||||||
print '<td nowrap="nowrap">'.price($fac->total_ttc).'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Status').'</td><td>'.$fac->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Status').'</td><td>'.$fac->getLibStatut(4).'</td></tr>';
|
||||||
print '<tr><td colspan="2" align="center">';
|
print '<tr><td colspan="2" align="center">';
|
||||||
@@ -556,7 +566,7 @@ else
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Societe
|
// Societe
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$societe->getNomUrl(1).'</a></td>';
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$societe->getNomUrl(1).'</td>';
|
||||||
print '<td align="right"><a href="index.php?socid='.$fac->socid.'">'.$langs->trans('OtherBills').'</a></td>';
|
print '<td align="right"><a href="index.php?socid='.$fac->socid.'">'.$langs->trans('OtherBills').'</a></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@@ -688,14 +698,23 @@ else
|
|||||||
// Ligne en modification
|
// Ligne en modification
|
||||||
if ($fac->statut == 0 && $_GET['action'] == 'mod_ligne' && $_GET['etat'] == '0' && $_GET['ligne_id'] == $fac->lignes[$i]->rowid)
|
if ($fac->statut == 0 && $_GET['action'] == 'mod_ligne' && $_GET['etat'] == '0' && $_GET['ligne_id'] == $fac->lignes[$i]->rowid)
|
||||||
{
|
{
|
||||||
print '<form action="fiche.php?facid='.$fac->id.'&action=mod_ligne&etat=1&ligne_id='.$fac->lignes[$i]->rowid.'" method="post">';
|
print '<form action="fiche.php?facid='.$fac->id.'&etat=1&ligne_id='.$fac->lignes[$i]->rowid.'" method="post">';
|
||||||
print '<input type="hidden" name="tauxtva" value="'.$fac->lignes[$i]->tva_taux.'">';
|
print '<input type="hidden" name="action" value="change_line">';
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td><input size="30" name="label" type="text" value="'.$fac->lignes[$i]->description.'"></td>';
|
print '<td>';
|
||||||
|
if ($conf->produit->enabled && $fac->lignes[$i]->fk_product)
|
||||||
|
{
|
||||||
|
$html->select_produits_fournisseurs($fac->socid,$fac->lignes[$i]->fk_product,'idprod',$filtre);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input size="30" name="label" type="text" value="'.$fac->lignes[$i]->description.'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
print '<td align="right" nowrap="nowrap"><input size="6" name="puht" type="text" value="'.price($fac->lignes[$i]->pu_ht).'"></td>';
|
print '<td align="right" nowrap="nowrap"><input size="6" name="puht" type="text" value="'.price($fac->lignes[$i]->pu_ht).'"></td>';
|
||||||
print '<td align="right" nowrap="nowrap"> </td>';
|
print '<td align="right" nowrap="nowrap"><input size="6" name="amountttc" type="text" value=""></td>';
|
||||||
print '<td align="right"><input size="1" name="qty" type="text" value="'.$fac->lignes[$i]->qty.'"></td>';
|
print '<td align="right"><input size="1" name="qty" type="text" value="'.$fac->lignes[$i]->qty.'"></td>';
|
||||||
print '<td align="right" nowrap="nowrap"><input size="6" name="totalht" type="text" value="'.price($fac->lignes[$i]->total_ht).'"></td>';
|
print '<td align="right" nowrap="nowrap"> </td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$html->select_tva('tauxtva',$fac->lignes[$i]->tva_taux,$societe,$mysoc);
|
$html->select_tva('tauxtva',$fac->lignes[$i]->tva_taux,$societe,$mysoc);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@@ -756,7 +775,7 @@ else
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print '<input size="1" name="qty" type="text" value="1">';
|
print '<input size="1" name="qty" type="text" value="1">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">-</td>';
|
print '<td align="right"> </td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$html->select_tva('tauxtva','',$societe,$mysoc);
|
$html->select_tva('tauxtva','',$societe,$mysoc);
|
||||||
print '</td><td align="center" colspan="2">';
|
print '</td><td align="center" colspan="2">';
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print "<td>".$langs->trans("Company")."</td>\n";
|
print "<td>".$langs->trans("Company")."</td>\n";
|
||||||
print "<td>".$langs->trans("SupplierCode")."</td>\n";
|
print "<td>".$langs->trans("SupplierCode")."</td>\n";
|
||||||
print '<td align="center">'.$langs->trans("DateCreation")."</td>\n";
|
print '<td align="right">'.$langs->trans("DateCreation")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
@@ -318,7 +318,7 @@ if ($resql)
|
|||||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>';
|
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>';
|
||||||
print " <a href=\"fiche.php?socid=$obj->idp\">$obj->nom</a></td>\n";
|
print " <a href=\"fiche.php?socid=$obj->idp\">$obj->nom</a></td>\n";
|
||||||
print '<td align="left">'.$obj->code_fournisseur.' </td>';
|
print '<td align="left">'.$obj->code_fournisseur.' </td>';
|
||||||
print '<td align="center">'.dolibarr_print_date($obj->datec).'</td>';
|
print '<td align="right">'.dolibarr_print_date($obj->datec,'day').'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|||||||
@@ -932,14 +932,18 @@ class Form
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
print "<option value=\"0\" selected=\"true\"> </option>";
|
if (! $selected) print '<option value="0" selected="true"> </option>';
|
||||||
|
else print '<option value="0"> </option>';
|
||||||
|
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$opt = '<option value="'.$objp->rowid.'">'.$objp->ref.' - ';
|
|
||||||
|
$opt = '<option value="'.$objp->rowid.'"';
|
||||||
|
if ($selected == $objp->rowid) $opt.= ' selected="true"';
|
||||||
|
$opt.= '>'.$objp->ref.' - ';
|
||||||
$opt.= dolibarr_trunc($objp->label,24).' - ';
|
$opt.= dolibarr_trunc($objp->label,24).' - ';
|
||||||
$opt.= $objp->fprice.$langs->trans("Currency".$conf->monnaie)."/".$objp->quantity.$langs->trans("Units");
|
$opt.= $objp->fprice.$langs->trans("Currency".$conf->monnaie)."/".$objp->quantity.$langs->trans("Units");
|
||||||
if ($objp->quantity > 1)
|
if ($objp->quantity > 1)
|
||||||
@@ -949,6 +953,7 @@ class Form
|
|||||||
}
|
}
|
||||||
if ($objp->duration) $opt .= " - ".$objp->duration;
|
if ($objp->duration) $opt .= " - ".$objp->duration;
|
||||||
$opt .= "</option>\n";
|
$opt .= "</option>\n";
|
||||||
|
|
||||||
print $opt;
|
print $opt;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1819,16 +1819,17 @@ function print_fleche_navigation($page,$file,$options='',$nextpage)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction qui retourne un montant mon<6F>taire format<61>
|
* \brief Fonction qui retourne un montant mon<6F>taire format<61>
|
||||||
\remarks Fonction utilis<69>e dans les pdf et les pages html
|
* \remarks Fonction utilis<69>e dans les pdf et les pages html
|
||||||
\param amount Montant a formater
|
* \param amount Montant a formater
|
||||||
\param html Formatage html ou pas (0 par defaut)
|
* \param html Formatage html ou pas (0 par defaut)
|
||||||
\param outlangs Objet langs pour formatage
|
* \param outlangs Objet langs pour formatage
|
||||||
\seealso price2num Fonction inverse de price
|
* \return string Chaine avec montant format<61>
|
||||||
|
* \seealso price2num Fonction inverse de price
|
||||||
*/
|
*/
|
||||||
function price($amount, $html=0, $outlangs='')
|
function price($amount, $html=0, $outlangs='')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs,$conf;
|
||||||
|
|
||||||
// Separateurs par defaut
|
// Separateurs par defaut
|
||||||
$dec='.'; $thousand=' ';
|
$dec='.'; $thousand=' ';
|
||||||
@@ -1840,8 +1841,6 @@ function price($amount, $html=0, $outlangs='')
|
|||||||
if ($outlangs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->trans("SeparatorThousand");
|
if ($outlangs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->trans("SeparatorThousand");
|
||||||
//print "dec=".$dec." thousand=".$thousand;
|
//print "dec=".$dec." thousand=".$thousand;
|
||||||
|
|
||||||
// On pose par defaut 2 decimales
|
|
||||||
$decimal = 2;
|
|
||||||
//print "xx".$amount."-";
|
//print "xx".$amount."-";
|
||||||
$amount = ereg_replace(',','.',$amount);
|
$amount = ereg_replace(',','.',$amount);
|
||||||
//print $amount."-";
|
//print $amount."-";
|
||||||
@@ -1849,19 +1848,32 @@ function price($amount, $html=0, $outlangs='')
|
|||||||
$decpart = $datas[1];
|
$decpart = $datas[1];
|
||||||
//print $datas[1]."<br>";
|
//print $datas[1]."<br>";
|
||||||
|
|
||||||
|
// On pose par defaut 2 decimales
|
||||||
|
$decimal = 2;
|
||||||
|
$end='';
|
||||||
// On augmente au besoin si il y a plus de 2 d<>cimales
|
// On augmente au besoin si il y a plus de 2 d<>cimales
|
||||||
if (strlen($decpart) > 2) $decimal=strlen($decpart);
|
if (strlen($decpart) > $decimal) $decimal=strlen($decpart);
|
||||||
|
// Si on depasse max
|
||||||
|
if ($decimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN)
|
||||||
|
{
|
||||||
|
$decimal=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
|
||||||
|
$end='...';
|
||||||
|
}
|
||||||
|
|
||||||
// Formate nombre
|
// Formate nombre
|
||||||
if ($html)
|
if ($html)
|
||||||
{
|
{
|
||||||
return ereg_replace(' ',' ',number_format($amount, $decimal, $dec, $thousand));
|
$output=ereg_replace(' ',' ',number_format($amount, $decimal, $dec, $thousand));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return number_format($amount, $decimal, $dec, $thousand);
|
$output=number_format($amount, $decimal, $dec, $thousand);
|
||||||
}
|
}
|
||||||
|
$output.=$end;
|
||||||
|
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction qui retourne un num<75>rique depuis un montant format<61>
|
\brief Fonction qui retourne un num<75>rique depuis un montant format<61>
|
||||||
\remarks Fonction <20> appeler sur montants saisi avant un insert
|
\remarks Fonction <20> appeler sur montants saisi avant un insert
|
||||||
|
|||||||
Reference in New Issue
Block a user