Add help on adding a new social contribution

This commit is contained in:
Laurent Destailleur 2008-03-16 14:52:31 +00:00
parent cfbe90498f
commit a2390f0ebf
6 changed files with 81 additions and 49 deletions

View File

@ -209,53 +209,53 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyName").'</td><td>';
print '<input name="nom" size="30" value="'. $conf->global->MAIN_INFO_SOCIETE_NOM . '"></td></tr>';
print '<input name="nom" size="30" value="'. $conf->global->MAIN_INFO_SOCIETE_NOM . '"></td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyAddress").'</td><td>';
print '<textarea name="address" cols="60" rows="'.ROWS_3.'">'. $conf->global->MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>';
print '<textarea name="address" cols="60" rows="'.ROWS_3.'">'. $conf->global->MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyZip").'</td><td>';
print '<input name="cp" value="'. $conf->global->MAIN_INFO_SOCIETE_CP . '" size="10"></td></tr>';
print '<input name="cp" value="'. $conf->global->MAIN_INFO_SOCIETE_CP . '" size="10"></td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyTown").'</td><td>';
print '<input name="ville" size="30" value="'. $conf->global->MAIN_INFO_SOCIETE_VILLE . '"></td></tr>';
print '<input name="ville" size="30" value="'. $conf->global->MAIN_INFO_SOCIETE_VILLE . '"></td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Country").'</td><td>';
$form->select_pays($conf->global->MAIN_INFO_SOCIETE_PAYS,'pays_id',($conf->use_javascript_ajax?' onChange="company_save_refresh()"':''));
print '</td></tr>';
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCurrency").'</td><td>';
$form->select_currency($conf->global->MAIN_MONNAIE,"currency");
print '</td></tr>';
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Tel").'</td><td>';
print '<input name="tel" value="'. $conf->global->MAIN_INFO_SOCIETE_TEL . '"></td></tr>';
print '</td></tr>';
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Fax").'</td><td>';
print '<input name="fax" value="'. $conf->global->MAIN_INFO_SOCIETE_FAX . '"></td></tr>';
print '</td></tr>';
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Mail").'</td><td>';
print '<input name="mail" size="60" value="'. $conf->global->MAIN_INFO_SOCIETE_MAIL . '"></td></tr>';
print '</td></tr>';
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Web").'</td><td>';
print '<input name="web" size="60" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>';
print '</td></tr>';
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Gencod").'</td><td>';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -14,15 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
\file htdocs/compta/sociales/charges.php
\ingroup tax
\brief Fiche d'une charge sociale
\version $Revision$
\version $Id$
*/
require("./pre.inc.php");
@ -214,21 +212,7 @@ if ($_GET["action"] == 'create')
print '<td><input type="text" size="8" name="period"><br>YYYYMMDD</td>';
print '<td align="left"><select class="flat" name="type">';
$sql = "SELECT c.id, c.libelle as type FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql .= " ORDER BY lower(c.libelle) ASC";
if ( $db->query($sql) )
{
$num = $db->num_rows();
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object();
print '<option value="'.$obj->id.'">'.$obj->type;
$i++;
}
}
print '</select>';
$html->select_type_socialcontrib();
print '</td>';
print '<td align="left"><input type="text" size="34" name="label" class="flat"></td>';

View File

@ -77,7 +77,7 @@ $fsearch.=' <input type="submit" class="button" name="submit" value="'.$langs->
$fsearch.='</form>';
// Affiche en-tête du rapport
if ($modetax==1) // Caluclate on invoice for goods and services
if ($modetax==1) // Calculate on invoice for goods and services
{
$nom=$langs->trans("VATReportByCustomersInDueDebtMode");
$nom.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';

View File

@ -574,7 +574,35 @@ class Form
}
/**
/**
* \brief Retourne la liste des types de comptes financiers
* \param selected Type pré-sélectionné
* \param htmlname Nom champ formulaire
*/
function select_type_socialcontrib($selected='',$htmlname='actioncode')
{
global $db,$langs,$user;
$sql = "SELECT c.id, c.libelle as type FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql .= " ORDER BY lower(c.libelle) ASC";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<option value="'.$obj->id.'">'.$obj->type;
$i++;
}
}
print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
/**
* \brief Output html form to select a third party
* \param selected Societe pré-sélectionnée
* \param htmlname Nom champ formulaire
@ -1073,9 +1101,12 @@ class Form
$langs->load('stocks');
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
$sql.= " pf.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice";
$sql.= " pf.ref_fourn,";
$sql.= " pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
$sql.= " s.nom";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pf.fk_soc = s.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pf.rowid = pfp.fk_product_fournisseur";
$sql.= " WHERE p.envente = 1";
if ($socid) $sql.= " AND pf.fk_soc = ".$socid;
@ -1121,10 +1152,10 @@ class Form
if ($objp->fprice == '') $opt.=' disabled="disabled"';
$opt.= '>'.$objp->ref_fourn.' - ';
$opt.= dolibarr_trunc($objp->label,18).' - ';
if ($objp->fprice != '')
if ($objp->fprice != '') // Keep != ''
{
$opt.= price($objp->fprice);
$opt.= $langs->trans("CurrencyShort".$conf->monnaie)."/".$objp->quantity;
$opt.= $langs->trans("Currency".$conf->monnaie)."/".$objp->quantity;
if ($objp->quantity == 1)
{
$opt.= strtolower($langs->trans("Unit"));
@ -1135,10 +1166,12 @@ class Form
}
if ($objp->quantity > 1)
{
$opt.=" - ";
$opt.= price($objp->unitprice).$langs->trans("CurrencyShort".$conf->monnaie)."/".strtolower($langs->trans("Unit"));
$opt.=" (";
$opt.= price($objp->unitprice).$langs->trans("Currency".$conf->monnaie)."/".strtolower($langs->trans("Unit"));
$opt.=")";
}
if ($objp->duration) $opt .= " - ".$objp->duration;
if (! $socid) $opt .= " - ".dolibarr_trunc($objp->nom,8);
}
else
{
@ -2185,21 +2218,23 @@ class Form
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilité
$sql = "SELECT code_iso, label, active FROM ".MAIN_DB_PREFIX."c_currencies";
$sql .= " WHERE active = 1";
$sql .= " ORDER BY code_iso ASC";
$sql = "SELECT code, code_iso, label, active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_currencies";
$sql.= " WHERE active = 1";
$sql.= " ORDER BY code_iso ASC";
if ($this->db->query($sql))
$resql=$this->db->query($sql);
if ($resql)
{
print '<select class="flat" name="'.$htmlname.'">';
$num = $this->db->num_rows();
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
$foundselected=false;
while ($i < $num)
{
$obj = $this->db->fetch_object();
$obj = $this->db->fetch_object($resql);
if ($selected && $selected == $obj->code_iso)
{
$foundselected=true;
@ -2209,8 +2244,8 @@ class Form
{
print '<option value="'.$obj->code_iso.'">';
}
// Si traduction existe, on l'utilise, sinon on prend le libellé par défaut
if ($obj->code_iso) { print $obj->code_iso . ' - '; }
// Si traduction existe, on l'utilise, sinon on prend le libellé par défaut
print ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
print '</option>';
$i++;

View File

@ -38,6 +38,8 @@ function vat_by_thirdparty($db, $y, $modetax, $direction)
global $conf;
$list=array();
//print "xx".$conf->global->MAIN_MODULE_COMPTABILITEEXPERT;
//print "xx".$conf->global->MAIN_MODULE_COMPTABILITE;
if ($direction == 'sell')
{

View File

@ -310,10 +310,20 @@ class Translate {
else
{
// Translation is not available
global $db;
if (ereg('CurrencyShort([A-Z]+)$',$key,$reg)) $key=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','code');
if (ereg('Currency([A-Z]+)$',$key,$reg)) $key=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label');
return $this->convToOuptutCharset($key);
$newstr=$key;
if (ereg('CurrencyShort([A-Z]+)$',$key,$reg))
{
global $db;
//$newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','labelshort');
$newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','code');
}
else if (ereg('Currency([A-Z]+)$',$key,$reg))
{
global $db;
$newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label');
//print "xxx".$key."-".$value."\n";
}
return $this->convToOuptutCharset($newstr);
}
}
@ -481,7 +491,8 @@ class Translate {
}
else
{
dolibarr_print_error($db);
$this->error=$db->lasterror();
dolibarr_syslog("Translate::getLabelFromKey error=".$this->error,LOG_ERR);
return -1;
}
}