Fix: Debuggage saisie charge sociale
New: Possiblite modifier libelle charge sociale.
This commit is contained in:
parent
16592eea35
commit
f5f8a498bd
@ -102,25 +102,42 @@ class ChargeSociales
|
|||||||
/**
|
/**
|
||||||
* \brief Crée une charge sociale
|
* \brief Crée une charge sociale
|
||||||
* \param user Utilisateur qui crée
|
* \param user Utilisateur qui crée
|
||||||
* \return int <0 si erreur, >0 si ok
|
* \return int <0 si KO, id charge créée si OK
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
|
// Nettoyage parametres
|
||||||
|
$newamount=price2num($this->amount,'MT');
|
||||||
|
|
||||||
|
// Validation parametres
|
||||||
|
if (! $newamount > 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorBadParameter";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount)";
|
||||||
$sql.= " VALUES (".$this->type.",'".addslashes($this->lib)."',";
|
$sql.= " VALUES (".$this->type.",'".addslashes($this->lib)."',";
|
||||||
$sql.= "'".$this->date_ech."','".$this->periode."',";
|
$sql.= "'".$this->date_ech."','".$this->periode."',";
|
||||||
$sql.= "'".$this->amount."'";
|
$sql.= " ".$newamount;
|
||||||
$sql.= ')';
|
$sql.= ")";
|
||||||
|
|
||||||
dolibarr_syslog("ChargesSociales::create sql=".$sql);
|
dolibarr_syslog("ChargesSociales::create sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
return 1;
|
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
|
||||||
|
|
||||||
|
//dolibarr_syslog("ChargesSociales::create this->id=".$this->id);
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,6 +165,38 @@ class ChargeSociales
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Met a jour une charge sociale
|
||||||
|
* \param user Utilisateur qui modifie
|
||||||
|
* \return int <0 si erreur, >0 si ok
|
||||||
|
*/
|
||||||
|
function update($user)
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||||
|
$sql.= " SET libelle='".addslashes($this->lib)."',";
|
||||||
|
$sql.= " date_ech='".$this->date_ech."',";
|
||||||
|
$sql.= " periode='".$this->periode."'";
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
dolibarr_syslog("ChargesSociales::update sql=".$sql);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function solde($year = 0)
|
function solde($year = 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT sum(f.amount) as amount";
|
$sql = "SELECT sum(f.amount) as amount";
|
||||||
@ -293,26 +342,25 @@ class PaiementCharge
|
|||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$total = 0;
|
$total=0;
|
||||||
foreach ($this->amounts as $key => $value)
|
foreach ($this->amounts as $key => $value)
|
||||||
{
|
{
|
||||||
$facid = $key;
|
$facid = $key;
|
||||||
$value = trim($value);
|
$amount = price2num(trim($value), 'MT');
|
||||||
$amount = round(price2num($value), 2); // Un round est ok si nb avec '.'
|
$total += $amount;
|
||||||
if (is_numeric($amount)) $total += $amount;
|
|
||||||
}
|
}
|
||||||
$total = price2num($total);
|
|
||||||
|
|
||||||
if ($total > 0)
|
if ($total > 0)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_user_creat)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_user_creat)";
|
||||||
$sql .= " VALUES ($this->chid, now(), $this->datepaye, '$total', $this->paiementtype, '$this->num_paiement', '$this->note', $user->id)";
|
$sql .= " VALUES ($this->chid, now(), ".$this->db->idate($this->datepaye).", ".price2num($total).", $this->paiementtype, '$this->num_paiement', '$this->note', $user->id)";
|
||||||
|
|
||||||
dolibarr_syslog("PaiementCharges::create sql=".$sql);
|
dolibarr_syslog("PaiementCharge::create sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -342,7 +390,7 @@ class PaiementCharge
|
|||||||
/**
|
/**
|
||||||
* \brief Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank générée
|
* \brief Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank générée
|
||||||
* \param id_bank Id de la banque
|
* \param id_bank Id de la banque
|
||||||
* \return int 1 ou 0
|
* \return int >0 si OK, <=0 si KO
|
||||||
*/
|
*/
|
||||||
function update_fk_bank($id_bank)
|
function update_fk_bank($id_bank)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -174,18 +174,6 @@ class Account
|
|||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
$emetteur=trim($emetteur);
|
$emetteur=trim($emetteur);
|
||||||
$banque=trim($banque);
|
$banque=trim($banque);
|
||||||
|
|
||||||
dolibarr_syslog("Account::Addline: date=".$date.", oper=".$oper.", label=".$label.", amount=".$amount.", num_chq=".$num_chq.", categorie=".$categorie.", user=".$user->id);
|
|
||||||
|
|
||||||
// Verififcation parametres
|
|
||||||
if (! $this->rowid)
|
|
||||||
{
|
|
||||||
$this->error="Account::addline this->rowid not defined";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
switch ($oper)
|
switch ($oper)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@ -210,7 +198,16 @@ class Account
|
|||||||
$oper = 'CHQ';
|
$oper = 'CHQ';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verification parametres
|
||||||
|
if (! $this->rowid)
|
||||||
|
{
|
||||||
|
$this->error="Account::addline this->rowid not defined";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$datev = $date;
|
$datev = $date;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)";
|
||||||
@ -223,6 +220,7 @@ class Account
|
|||||||
$sql.= " ".($banque?"'".addslashes($banque)."'":"null");
|
$sql.= " ".($banque?"'".addslashes($banque)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
|
dolibarr_syslog("Account::addline sql=".$sql);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank");
|
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank");
|
||||||
|
|||||||
@ -56,11 +56,8 @@ if ($_POST["action"] == 'add_paiement')
|
|||||||
|
|
||||||
if ($_POST["paiementtype"] > 0)
|
if ($_POST["paiementtype"] > 0)
|
||||||
{
|
{
|
||||||
|
$datepaye = dolibarr_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
$datepaye = $db->idate(dolibarr_mktime(12, 0 , 0,
|
//print "x".dolibarr_print_date($datepaye,'dayhour');
|
||||||
$_POST["remonth"],
|
|
||||||
$_POST["reday"],
|
|
||||||
$_POST["reyear"]));
|
|
||||||
|
|
||||||
$paiement_id = 0;
|
$paiement_id = 0;
|
||||||
$amounts = array();
|
$amounts = array();
|
||||||
@ -94,14 +91,13 @@ if ($_POST["action"] == 'add_paiement')
|
|||||||
{
|
{
|
||||||
$chid = $key;
|
$chid = $key;
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
$amount = round(price2num($value), 2); // Un round est ok si nb avec '.'
|
$amount = price2num(trim($value), 'MT'); // Un round est ok si nb avec '.'
|
||||||
if (is_numeric($amount)) $total += $amount;
|
$total += $amount;
|
||||||
}
|
}
|
||||||
$total = price2num($total);
|
|
||||||
|
|
||||||
// Insertion dans llx_bank
|
// Insertion dans llx_bank
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
$label = $langs->trans("SocialContributionPayment");
|
$label = $langs->transnoentities("SocialContributionPayment");
|
||||||
$acc = new Account($db, $_POST["accountid"]);
|
$acc = new Account($db, $_POST["accountid"]);
|
||||||
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user);
|
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user);
|
||||||
|
|
||||||
@ -172,6 +168,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<form name="add_paiement" action="paiement_charge.php" method="post">';
|
print '<form name="add_paiement" action="paiement_charge.php" method="post">';
|
||||||
print "<input type=\"hidden\" name=\"id\" value=\"$charge->id\">";
|
print "<input type=\"hidden\" name=\"id\" value=\"$charge->id\">";
|
||||||
print '<input type="hidden" name="action" value="add_paiement">';
|
print '<input type="hidden" name="action" value="add_paiement">';
|
||||||
|
|
||||||
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
|
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"3\">Charge</td>";
|
print "<tr class=\"liste_titre\"><td colspan=\"3\">Charge</td>";
|
||||||
|
|||||||
@ -91,10 +91,155 @@ if ($_POST["action"] == 'confirm_delete')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ajout d'une charge sociale
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'add' && $user->rights->tax->charges->creer)
|
||||||
|
{
|
||||||
|
if (! $_POST["date"])
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'</div>';
|
||||||
|
$_GET["action"] = 'create';
|
||||||
|
}
|
||||||
|
elseif (! $_POST["period"])
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'</div>';
|
||||||
|
$_GET["action"] = 'create';
|
||||||
|
}
|
||||||
|
elseif (! $_POST["amount"])
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")).'</div>';
|
||||||
|
$_GET["action"] = 'create';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$chargesociales=new ChargeSociales($db);
|
||||||
|
|
||||||
|
$chargesociales->type=$_POST["type"];
|
||||||
|
$chargesociales->lib=$_POST["label"];
|
||||||
|
$chargesociales->date_ech=$_POST["date"];
|
||||||
|
$chargesociales->periode=$_POST["period"];
|
||||||
|
$chargesociales->amount=$_POST["amount"];
|
||||||
|
|
||||||
|
$chid=$chargesociales->create($user);
|
||||||
|
if ($chid > 0)
|
||||||
|
{
|
||||||
|
//$mesg='<div class="ok">'.$langs->trans("SocialContributionAdded").'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$chargesociales->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer)
|
||||||
|
{
|
||||||
|
if (! $_POST["date"])
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'</div>';
|
||||||
|
$_GET["action"] = 'edit';
|
||||||
|
}
|
||||||
|
elseif (! $_POST["period"])
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'</div>';
|
||||||
|
$_GET["action"] = 'edit';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$chargesociales=new ChargeSociales($db);
|
||||||
|
$result=$chargesociales->fetch($_GET["id"]);
|
||||||
|
|
||||||
|
$chargesociales->lib=$_POST["label"];
|
||||||
|
$chargesociales->date_ech=$_POST["date"];
|
||||||
|
$chargesociales->periode=$_POST["period"];
|
||||||
|
|
||||||
|
$result=$chargesociales->update($user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
//$mesg='<div class="ok">'.$langs->trans("SocialContributionAdded").'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$chargesociales->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mode creation
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == 'create')
|
||||||
|
{
|
||||||
|
print_fiche_titre($langs->trans("NewSocialContribution"));
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
|
$var=false;
|
||||||
|
|
||||||
|
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/sociales/charges.php">';
|
||||||
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print '<td>';
|
||||||
|
print ' ';
|
||||||
|
print '</td><td align="left">';
|
||||||
|
print $langs->trans("DateDue");
|
||||||
|
print '</td><td align="left">';
|
||||||
|
print $langs->trans("Period");
|
||||||
|
print '</td><td align="left">';
|
||||||
|
print $langs->trans("Type");
|
||||||
|
print '</td><td align="left">';
|
||||||
|
print $langs->trans("Label");
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $langs->trans("Amount");
|
||||||
|
print '</td><td align="center">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].' valign="top">';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td><input type="text" size="8" name="date"><br>YYYYMMDD</td>';
|
||||||
|
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>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td align="left"><input type="text" size="34" name="label" class="flat"></td>';
|
||||||
|
|
||||||
|
print '<td align="right"><input type="text" size="6" name="amount" class="flat"></td>';
|
||||||
|
|
||||||
|
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Mode fiche */
|
/* Mode fiche */
|
||||||
@ -139,7 +284,7 @@ if ($chid > 0)
|
|||||||
print '<br />';
|
print '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<form action=\"charges.php?id=$cha->id&action=update\" method=\"post\">";
|
if ($_GET['action'] == 'edit') print "<form action=\"charges.php?id=$cha->id&action=update\" method=\"post\">";
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -151,7 +296,7 @@ if ($chid > 0)
|
|||||||
print "<td>";
|
print "<td>";
|
||||||
if ($cha->paye==0 && $_GET['action'] == 'edit')
|
if ($cha->paye==0 && $_GET['action'] == 'edit')
|
||||||
{
|
{
|
||||||
print "<input type=\"text\" name=\"period\" value=\"".strftime("%Y%m%d",$cha->period)."\">";
|
print "<input type=\"text\" name=\"period\" value=\"".strftime("%Y%m%d",$cha->periode)."\">";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -219,10 +364,10 @@ if ($chid > 0)
|
|||||||
if ($cha->paye==0 && $_GET['action'] == 'edit')
|
if ($cha->paye==0 && $_GET['action'] == 'edit')
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>';
|
||||||
print '<input type="text" name="desc" size="40" value="'.$cha->lib.'">';
|
print '<input type="text" name="label" size="40" value="'.$cha->lib.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td>";
|
print '<tr><td>'.$langs->trans("DateDue")."</td><td>";
|
||||||
print "<input type=\"text\" name=\"amount\" value=\"".strftime("%Y%m%d",$cha->date_ech)."\">";
|
print "<input type=\"text\" name=\"date\" value=\"".strftime("%Y%m%d",$cha->date_ech)."\">";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -232,19 +377,28 @@ if ($chid > 0)
|
|||||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($cha->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($cha->amount).'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$cha->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$cha->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
if ($_GET['action'] == 'edit')
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="3" align="center">';
|
||||||
|
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
if ($_GET['action'] == 'edit') print "</form>\n";
|
||||||
print "</form>\n";
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if (! $_GET["action"])
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Boutons actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Boutons actions
|
||||||
|
*/
|
||||||
|
if (! $_GET["action"] || $_GET["action"] == 'update')
|
||||||
|
{
|
||||||
print "<div class=\"tabsAction\">\n";
|
print "<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
// Editer
|
// Editer
|
||||||
|
|||||||
@ -56,47 +56,6 @@ $filtre=$_GET["filtre"];
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ajout d'une charge sociale
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
|
||||||
{
|
|
||||||
if (! $_POST["date"])
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'</div>';
|
|
||||||
}
|
|
||||||
elseif (! $_POST["periode"])
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'</div>';
|
|
||||||
}
|
|
||||||
elseif (! $_POST["amount"])
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")).'</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$chargesociales=new ChargeSociales($db);
|
|
||||||
|
|
||||||
$chargesociales->type=$_POST["type"];
|
|
||||||
$chargesociales->lib=$_POST["libelle"];
|
|
||||||
$chargesociales->date_ech=$_POST["date"];
|
|
||||||
$chargesociales->period=$_POST["period"];
|
|
||||||
$chargesociales->amount=$_POST["amount"];
|
|
||||||
|
|
||||||
$result=$chargesociales->create($user);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$mesg='<div class="ok">'.$langs->trans("SocialContributionAdded").'</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$chargesociales->error.'</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage liste et formulaire des charges.
|
* Affichage liste et formulaire des charges.
|
||||||
@ -107,75 +66,13 @@ llxHeader();
|
|||||||
print_fiche_titre($langs->trans("SocialContributions"),($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":""));
|
print_fiche_titre($langs->trans("SocialContributions"),($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":""));
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
if ($mesg) {
|
if ($mesg)
|
||||||
print "$mesg<br>";
|
{
|
||||||
|
print $mesg."<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
/*
|
|
||||||
* Forumalaire d'ajout d'une charge
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($user->rights->tax->charges->creer) {
|
|
||||||
$var=false;
|
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td>';
|
|
||||||
print ' ';
|
|
||||||
print '</td><td align="left">';
|
|
||||||
print $langs->trans("DateDue");
|
|
||||||
print '</td><td align="left">';
|
|
||||||
print $langs->trans("Period");
|
|
||||||
print '</td><td align="left">';
|
|
||||||
print $langs->trans("Type");
|
|
||||||
print '</td><td align="left">';
|
|
||||||
print $langs->trans("Label");
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $langs->trans("Amount");
|
|
||||||
print '</td><td align="center">';
|
|
||||||
print ' ';
|
|
||||||
print '</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<form method="post" action="index.php">';
|
|
||||||
print '<tr '.$bc[$var].' valign="top">';
|
|
||||||
print '<input type="hidden" name="action" value="add">';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td><input type="text" size="8" name="date"><br>YYYYMMDD</td>';
|
|
||||||
print '<td><input type="text" size="8" name="periode"><br>YYYYMMDD</td>';
|
|
||||||
|
|
||||||
print '<td align="left"><select 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>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="left"><input type="text" size="34" name="libelle"></td>';
|
|
||||||
print '<td align="right"><input type="text" size="6" name="amount"></td>';
|
|
||||||
|
|
||||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
print '<tr><td colspan="7"> </td></tr>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"),"index.php","id","","","",$sortfield);
|
print_liste_field_titre($langs->trans("Ref"),"index.php","id","","","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("DateDue"),"index.php","de","","","",$sortfield);
|
print_liste_field_titre($langs->trans("DateDue"),"index.php","de","","","",$sortfield);
|
||||||
|
|||||||
@ -38,8 +38,9 @@ function llxHeader($head = "")
|
|||||||
|
|
||||||
$menu = new Menu();
|
$menu = new Menu();
|
||||||
|
|
||||||
$menu->add("../charges/",$langs->trans("Contributions"));
|
$menu->add(DOL_URL_ROOT."/compta/charges/index.php",$langs->trans("Contributions"));
|
||||||
$menu->add_submenu("index.php",$langs->trans("SocialContributions"));
|
$menu->add_submenu(DOL_URL_ROOT."/compta/sociales/charges.php?action=create",$langs->trans("MenuNewSocialContribution"));
|
||||||
|
$menu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("List"));
|
||||||
|
|
||||||
left_menu($menu->liste);
|
left_menu($menu->liste);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -443,7 +443,8 @@ class MenuLeft {
|
|||||||
if ($conf->tax->enabled)
|
if ($conf->tax->enabled)
|
||||||
{
|
{
|
||||||
$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->tax->charges->lire);
|
$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->tax->charges->lire);
|
||||||
if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->tax->charges->lire);
|
if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/charges.php?action=create",$langs->trans("MenuNewSocialContribution"), 1, $user->rights->tax->charges->creer);
|
||||||
|
if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("List"), 1, $user->rights->tax->charges->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Charges tva
|
// Charges tva
|
||||||
|
|||||||
@ -30,6 +30,8 @@ VATPayed=VAT payed
|
|||||||
VATCollected=VAT collected
|
VATCollected=VAT collected
|
||||||
SocialContribution=Social contribution
|
SocialContribution=Social contribution
|
||||||
SocialContributions=Social contributions
|
SocialContributions=Social contributions
|
||||||
|
MenuNewSocialContribution=New social contribution
|
||||||
|
NewSocialContribution=New social contribution
|
||||||
ContributionsToPay=Contributions to pay
|
ContributionsToPay=Contributions to pay
|
||||||
AccountancyTreasuryArea=Accountancy/Treasury area
|
AccountancyTreasuryArea=Accountancy/Treasury area
|
||||||
AccountancySetup=Accountancy setup
|
AccountancySetup=Accountancy setup
|
||||||
|
|||||||
@ -63,6 +63,7 @@ Home=Home
|
|||||||
Help=Help
|
Help=Help
|
||||||
Always=Always
|
Always=Always
|
||||||
Never=Never
|
Never=Never
|
||||||
|
Period=Period
|
||||||
Activate=Activate
|
Activate=Activate
|
||||||
Activated=Activated
|
Activated=Activated
|
||||||
Closed=Closed
|
Closed=Closed
|
||||||
|
|||||||
@ -30,6 +30,8 @@ VATPayed=TVA pay
|
|||||||
VATCollected=TVA récupérée
|
VATCollected=TVA récupérée
|
||||||
SocialContribution=Charge sociale
|
SocialContribution=Charge sociale
|
||||||
SocialContributions=Charges sociales
|
SocialContributions=Charges sociales
|
||||||
|
MenuNewSocialContribution=Nouvelle charge sociale
|
||||||
|
NewSocialContribution=Nouvelle charge sociale
|
||||||
ContributionsToPay=Charges à payer
|
ContributionsToPay=Charges à payer
|
||||||
AccountancyTreasuryArea=Espace Compta/Tréso
|
AccountancyTreasuryArea=Espace Compta/Tréso
|
||||||
AccountancySetup=Configuration compta
|
AccountancySetup=Configuration compta
|
||||||
|
|||||||
@ -63,6 +63,7 @@ Home=Accueil
|
|||||||
Help=Aide
|
Help=Aide
|
||||||
Always=Toujours
|
Always=Toujours
|
||||||
Never=Jamais
|
Never=Jamais
|
||||||
|
Period=Période
|
||||||
Activate=Activer
|
Activate=Activer
|
||||||
Activated=Activé
|
Activated=Activé
|
||||||
Closed=Clôturé
|
Closed=Clôturé
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user