Use combo list for revenue stamp
This commit is contained in:
parent
c3589e9785
commit
24427d2c65
@ -30,31 +30,25 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
|
||||
if (! empty($conf->commande->enabled)) {
|
||||
require DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||
}
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('companies');
|
||||
$langs->load('products');
|
||||
$langs->load('main');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
if (! empty($conf->margin->enabled)) $langs->load('margins');
|
||||
|
||||
$sall=trim(GETPOST('sall'));
|
||||
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
||||
@ -1777,14 +1771,15 @@ if ($action == 'update_extras')
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formother=new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
$now=dol_now();
|
||||
|
||||
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
@ -3065,7 +3060,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setrevenuestamp">';
|
||||
print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
|
||||
print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code);
|
||||
//print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -153,10 +153,10 @@ class FormOther
|
||||
|
||||
|
||||
/**
|
||||
* Retourne la liste des ecotaxes avec tooltip sur le libelle
|
||||
* Return list of ecotaxes with label
|
||||
*
|
||||
* @param string $selected code ecotaxes pre-selectionne
|
||||
* @param string $htmlname nom de la liste deroulante
|
||||
* @param string $selected Preselected ecotaxes
|
||||
* @param string $htmlname Name of combo list
|
||||
* @return void
|
||||
*/
|
||||
function select_ecotaxes($selected='',$htmlname='ecotaxe_id')
|
||||
@ -169,6 +169,7 @@ class FormOther
|
||||
$sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid";
|
||||
$sql.= " ORDER BY pays, e.organization ASC, e.code ASC";
|
||||
|
||||
dol_syslog(get_class($this).'::select_ecotaxes sql='.$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -206,6 +207,63 @@ class FormOther
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of revenue stamp for country
|
||||
*
|
||||
* @param string $selected Value of preselected revenue stamp
|
||||
* @param string $htmlname Name of combo list
|
||||
* @return string HTML select list
|
||||
*/
|
||||
function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$out='';
|
||||
|
||||
$sql = "SELECT r.taux";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE r.active = 1 AND r.fk_pays = p.rowid";
|
||||
$sql.= " AND p.code = '".$country_code."'";
|
||||
|
||||
dol_syslog(get_class($this).'::select_revenue_stamp sql='.$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$out.='<select class="flat" name="'.$htmlname.'">';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
$out.='<option value="0"> </option>'."\n";
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if (($selected && $selected == $obj->taux) || $num == 1)
|
||||
{
|
||||
$out.='<option value="'.$obj->taux.'" selected="selected">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<option value="'.$obj->taux.'">';
|
||||
//print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
|
||||
}
|
||||
$out.=$obj->taux;
|
||||
$out.='</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$out.='</select>';
|
||||
return $out;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML select list to select a percent
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user