Add salary payment in tax module - Link to user.

Necessary for future hrm module.
This commit is contained in:
aspangaro 2014-03-06 21:21:16 +01:00
parent 15aebfb7a3
commit 048b3c01ce
10 changed files with 1184 additions and 9 deletions

View File

@ -5,7 +5,8 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -30,10 +31,12 @@
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -133,11 +136,13 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m
llxHeader();
$societestatic=new Societe($db);
$userstatic=new User($db);
$chargestatic=new ChargeSociales($db);
$memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$paymentsalstatic=new Sal($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
@ -458,8 +463,12 @@ if ($id > 0 || ! empty($ref))
}
if ($mode_search && ! empty($conf->tax->enabled))
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'";
// VAT
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid";
// Salaries
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_sal'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."salaries as sal ON bu3.url_id = sal.rowid";
}
if ($mode_search && ! empty($conf->adherent->enabled))
{
@ -577,6 +586,12 @@ if ($id > 0 || ! empty($ref))
$paymentvatstatic->ref=$links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_sal')
{
$paymentsalstatic->id=$links[$key]['url_id'];
$paymentsalstatic->ref=$links[$key]['url_id'];
print ' '.$paymentsalstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='banktransfert')
{
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
@ -611,6 +626,10 @@ if ($id > 0 || ! empty($ref))
elseif ($links[$key]['type']=='company')
{
}
elseif ($links[$key]['type']=='user')
{
}
elseif ($links[$key]['type']=='member')
{
@ -650,6 +669,12 @@ if ($id > 0 || ! empty($ref))
$societestatic->nom=$links[$key]['label'];
print $societestatic->getNomUrl(1,'',16);
}
else if ($links[$key]['type']=='user')
{
$userstatic->id=$links[$key]['url_id'];
$userstatic->lastname=$links[$key]['label'];
print $userstatic->getNomUrl(1,'');
}
else if ($links[$key]['type']=='sc')
{
// sc=old value

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -20,13 +21,14 @@
/**
* \file htdocs/compta/charges/index.php
* \ingroup compta
* \brief Page to list payments of social contributions and vat
* \brief Page to list payments of social contributions, vat and salaries
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("compta");
@ -59,6 +61,7 @@ if (! $sortorder) $sortorder="DESC";
$tva_static = new Tva($db);
$socialcontrib=new ChargeSociales($db);
$payment_sc_static=new PaymentSocialContribution($db);
$sal_static = new Sal($db);
llxHeader('',$langs->trans("TaxAndDividendsArea"));
@ -74,12 +77,92 @@ print_fiche_titre($title, ($year?"<a href='index.php?year=".($year-1).$param."'>
if ($year) $param.='&year='.$year;
// Social contributions only
if (GETPOST("mode") != 'sconly')
{
print $langs->trans("DescTaxAndDividendsArea").'<br>';
print "<br>";
}
// Salaries
if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
{
$sal = new Sal($db);
print_fiche_titre($langs->trans("SalPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."salaries as s";
$sql.= " WHERE s.entity = ".$conf->entity;
if ($year > 0)
{
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
print "<td>".$obj->label."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>";
// Ref payment
$sal_static->id=$obj->rowid;
$sal_static->ref=$obj->rowid;
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($total)."</td>";
print "</tr>";
print "</table>";
$db->free($result);
print "<br>";
}
else
{
dol_print_error($db);
}
}
// Social contributions only
if (GETPOST("mode") != 'sconly')
{
print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
}
@ -219,7 +302,7 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').' ? </td>'."\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
print "<td>".$obj->label."</td>\n";

View File

@ -0,0 +1,578 @@
<?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/salaries/class/salaries.class.php
* \ingroup tax
* \brief Class for tax module salaries
*/
// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* Put here description of your class
*/
class Sal extends CommonObject
{
//public $element='salaries'; //!< Id that identify managed objects
//public $table_element='salaries'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
var $tms;
var $fk_user;
var $datep;
var $datev;
var $amount;
var $label;
var $datesp;
var $dateep;
var $note;
var $fk_bank;
var $fk_user_creat;
var $fk_user_modif;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->element = 'salaries';
$this->table_element = 'salaries';
return 1;
}
/**
* Create in database
*
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."salaries(";
$sql.= "tms,";
$sql.= "fk_user,";
$sql.= "datep,";
$sql.= "datev,";
$sql.= "amount,";
$sql.= "label,";
$sql.= "datesp,";
$sql.= "dateep,";
$sql.= "note,";
$sql.= "fk_bank,";
$sql.= "fk_user_creat,";
$sql.= "fk_user_modif";
$sql.= ") VALUES (";
$sql.= " ".$this->db->idate($this->tms).",";
$sql.= " '".$this->fk_user."',";
$sql.= " ".$this->db->idate($this->datep).",";
$sql.= " ".$this->db->idate($this->datev).",";
$sql.= " '".$this->amount."',";
$sql.= " '".$this->label."',";
$sql.= " ".$this->db->idate($this->datesp).",";
$sql.= " ".$this->db->idate($this->dateep).",";
$sql.= " '".$this->note."',";
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").",";
$sql.= " '".$this->fk_user_creat."',";
$sql.= " '".$this->fk_user_modif."'";
$sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salaries");
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SAL_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return $this->id;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
$this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
if (empty($this->fk_user) || $this->fk_user < 0)
{
$this->error='ErrorBadParameter';
return -1;
}
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."salaries SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " fk_user='".$this->fk_user."',";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " amount='".$this->amount."',";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " datesp=".$this->db->idate($this->datesp).",";
$sql.= " dateep=".$this->db->idate($this->dateep).",";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " fk_bank='".$this->fk_bank."',";
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
return -1;
}
if (! $notrigger)
{
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SAL_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
return 1;
}
/**
* Load object in memory from database
*
* @param int $id id object
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
{
global $langs;
$sql = "SELECT";
$sql.= " s.rowid,";
$sql.= " s.tms,";
$sql.= " s.fk_user,";
$sql.= " s.datep,";
$sql.= " s.datev,";
$sql.= " s.amount,";
$sql.= " s.label,";
$sql.= " s.datesp,";
$sql.= " s.dateep,";
$sql.= " s.note,";
$sql.= " s.fk_bank,";
$sql.= " s.fk_user_creat,";
$sql.= " s.fk_user_modif,";
$sql.= " b.fk_account,";
$sql.= " b.fk_type,";
$sql.= " b.rappro";
$sql.= " FROM ".MAIN_DB_PREFIX."salaries as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " WHERE s.rowid = ".$id;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->tms = $this->db->jdate($obj->tms);
$this->fk_user = $obj->fk_user;
$this->datep = $this->db->jdate($obj->datep);
$this->datev = $this->db->jdate($obj->datev);
$this->amount = $obj->amount;
$this->label = $obj->label;
$this->datesp = $this->db->jdate($obj->datesp);
$this->dateep = $this->db->jdate($obj->dateep);
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->fk_account = $obj->fk_account;
$this->fk_type = $obj->fk_type;
$this->rappro = $obj->rappro;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Delete object in database
*
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
function delete($user)
{
global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."salaries";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
return -1;
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SAL_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1;
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
$this->id=0;
$this->tms='';
$this->fk_user='';
$this->datep='';
$this->datev='';
$this->amount='';
$this->label='';
$this->datesp='';
$this->dateep='';
$this->note='';
$this->fk_bank='';
$this->fk_user_creat='';
$this->fk_user_modif='';
}
/**
* Ajoute un paiement de salaire
*
* @param User $user Object user that insert
* @return int <0 if KO, rowid in tva table if OK
*/
function addPayment($user)
{
global $conf,$langs;
$this->db->begin();
// Clean parameters
$this->amount=price2num(trim($this->amount));
// Check parameters
if (! $this->label)
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
return -3;
}
if ($this->fk_user < 0 || $this->fk_user == '')
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Person"));
return -4;
}
if ($this->amount < 0 || $this->amount == '')
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
return -5;
}
if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
return -6;
}
if (! empty($conf->banque->enabled) && (empty($this->paymenttype) || $this->paymenttype <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
return -6;
}
// Insertion dans table des paiement salaires
$sql = "INSERT INTO ".MAIN_DB_PREFIX."salaries (fk_user";
$sql.= ", datep";
$sql.= ", datev";
$sql.= ", amount";
if ($this->note) $sql.=", note";
if ($this->label) $sql.=", label";
$sql.= ", datesp";
$sql.= ", dateep";
$sql.= ", fk_user_creat";
$sql.= ", fk_bank";
$sql.= ", entity";
$sql.= ") ";
$sql.= " VALUES (";
$sql.= "'".$this->fk_user."'";
$sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
if ($this->label) $sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->idate($this->datesp)."'";
$sql.= ", '".$this->db->idate($this->dateep)."'";
$sql.= ", '".$user->id."'";
$sql.= ", NULL";
$sql.= ", ".$conf->entity;
$sql.= ")";
dol_syslog(get_class($this)."::addPayment sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salaries"); // TODO devrait s'appeler payment_sal
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SAL_ADDPAYMENT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($this->id > 0)
{
$ok=1;
if (! empty($conf->banque->enabled) && ! empty($this->amount))
{
// Insertion dans llx_bank
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acc = new Account($this->db);
$result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($this->db);
// Insert payment into llx_bank
// Add link 'payment_sal' in bank_url between payment and bank transaction
$bank_line_id = $acc->addline(
$this->datep,
$this->paymenttype,
$this->label,
-abs($this->amount),
'',
'',
$user
);
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$this->update_fk_bank($bank_line_id);
}
else
{
$this->error=$acc->error;
$ok=0;
}
// Add link 'payment_sal' in bank_url between payment and bank transaction
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalPayment)", "payment_sal");
if ($result <= 0)
{
$this->error=$acc->error;
$ok=0;
}
// Add link 'user' in bank_url between operation and bank transaction
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value)
{
$sal = new Sal ($this->db);
$sal->fetch($key);
$sal->fetch_user($this->fk_user);
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line(
$bank_line_id,
$sal->user->id,
DOL_URL_ROOT.'/user/fiche.php?id=',
$sal->user->lastname,
'user'
);
if ($result <= 0) dol_print_error($this->db);
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
}
}
}
if ($ok)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -3;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -2;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
}
/**
* Mise a jour du lien entre le paiement salaire et la ligne générée dans llx_bank
*
* @param int $id_bank Id compte bancaire
* @return int <0 if KO, >0 if OK
*/
function update_fk_bank($id_bank)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'salaries SET fk_bank = '.$id_bank;
$sql.= ' WHERE rowid = '.$this->id;
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* Renvoie nom clicable (avec eventuellement le picto)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0,$option='')
{
global $langs;
$result='';
$lien = '<a href="'.DOL_URL_ROOT.'/compta/salaries/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
$picto='payment';
$label=$langs->trans("ShowSalPayment").': '.$this->ref;
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
return $result;
}
}
?>

View File

@ -0,0 +1,327 @@
<?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/salaries/fiche.php
* \ingroup tax
* \brief Page of salaries payments
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("compta");
$langs->load("banks");
$langs->load("bills");
$id=GETPOST("id",'int');
$action=GETPOST('action');
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$sal = new Sal($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('taxsalcard'));
/**
* Actions
*/
if ($_POST["cancel"] == $langs->trans("Cancel"))
{
header("Location: index.php");
exit;
}
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$db->begin();
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
$sal->accountid=$_POST["accountid"];
$sal->paymenttype=$_POST["paiementtype"];
$sal->fk_user=$_POST["fk_user"];
$sal->datev=$datev;
$sal->datep=$datep;
$sal->amount=$_POST["amount"];
$sal->label=$_POST["label"];
$sal->datesp=$datesp;
$sal->dateep=$dateep;
$ret=$sal->addPayment($user);
if ($ret > 0)
{
$db->commit();
header("Location: index.php");
exit;
}
else
{
$db->rollback();
setEventMessage($sal->error, 'errors');
$action="create";
}
}
if ($action == 'delete')
{
$result=$sal->fetch($id);
if ($sal->rappro == 0)
{
$db->begin();
$ret=$sal->delete($user);
if ($ret > 0)
{
if ($sal->fk_bank)
{
$accountline=new AccountLine($db);
$result=$accountline->fetch($sal->fk_bank);
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
if ($result >= 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
exit;
}
else
{
$sal->error=$accountline->error;
$db->rollback();
setEventMessage($sal->error,'errors');
}
}
else
{
$db->rollback();
setEventMessage($sal->error,'errors');
}
}
else
{
setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors');
}
}
/*
* View
*/
llxHeader();
$form = new Form($db);
if ($id)
{
$salpayment = new Sal($db);
$result = $salpayment->fetch($id);
if ($result <= 0)
{
dol_print_error($db);
exit;
}
}
// Formulaire saisie salaire
if ($action == 'create')
{
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print_fiche_titre($langs->trans("NewSalPayment"));
print '<table class="border" width="100%">';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->select_date($datep,"datep",'','','','add');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
print $form->select_date($datev,"datev",'','','','add');
print '</td></tr>';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalPayment")).'"></td></tr>';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
print $form->select_date($datesp,"datesp",'','','','add');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
print $form->select_date($dateep,"dateep",'','','','add');
print '</td></tr>';
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
// Bank
if (! empty($conf->banque->enabled))
{
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements($_POST["paiementtype"], "paiementtype");
print "</td>\n";
print "</tr>";
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print "<br>";
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>';
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
if ($id)
{
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/fiche.php?id='.$salpayment->id;
$head[$h][1] = $langs->trans('Card');
$head[$h][2] = 'card';
$h++;
dol_fiche_head($head, 'card', $langs->trans("SalPayment"), 0, 'payment');
print '<table class="border" width="100%">';
print "<tr>";
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $salpayment->ref;
print '</td></tr>';
// Person
print '<tr><td>'.$langs->trans("Person").'</td><td>';
$usersal=new User($db);
$usersal->fetch($salpayment->fk_user);
print $usersal->getNomUrl(1);
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$salpayment->label.'</td></tr>';
print "<tr>";
print '<td>'.$langs->trans("DateStartPeriod").'</td><td colspan="3">';
print dol_print_date($salpayment->datesp,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("DateEndPeriod").'</td><td colspan="3">';
print dol_print_date($salpayment->dateep,'day');
print '</td></tr>';
print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">';
print dol_print_date($salpayment->datep,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("DateValue").'</td><td colspan="3">';
print dol_print_date($salpayment->datev,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($salpayment->amount).'</td></tr>';
if (! empty($conf->banque->enabled))
{
if ($salpayment->fk_account > 0)
{
$bankline=new AccountLine($db);
$bankline->fetch($salpayment->fk_bank);
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1,0,'showall');
print '</td>';
print '</tr>';
}
}
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';
/*
* Boutons d'actions
*/
print "<div class=\"tabsAction\">\n";
if ($salpayment->rappro == 0)
{
if (! empty($user->rights->tax->charges->supprimer))
{
print '<a class="butActionDelete" href="fiche.php?id='.$salpayment->id.'&action=delete">'.$langs->trans("Delete").'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a>';
}
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
}
print "</div>";
}
$db->close();
llxFooter();
?>

View File

@ -0,0 +1,107 @@
<?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/salaries/index.php
* \ingroup tax
* \brief List of salaries payments
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
$langs->load("compta");
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
/*
* View
*/
llxHeader();
$salstatic = new Sal($db);
$userstatic = new User($db);
print_fiche_titre($langs->trans("SalPayments"));
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."salaries as s, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " ORDER BY dm DESC";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
print "<td>".$langs->trans("Person")."</td>";
print "<td>".$langs->trans("Label")."</td>";
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var].">";
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
$salstatic->id=$obj->rowid;
$salstatic->ref=$obj->rowid;
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
$db->close();
llxFooter();
?>

View File

@ -180,9 +180,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy', 'MenuTaxAndDividends', 0, 'compta', '$user->rights->tax->charges->lire', '', 0, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&amp;action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2203__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_sal&amp;mainmenu=accountancy', 'Salaries', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_sal"', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_sal&amp;action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_sal"', __HANDLER__, 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_sal', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&amp;action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'accountancy', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/index.php?leftmenu=tax_vat&amp;mainmenu=accountancy', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/fiche.php?leftmenu=tax_vat&amp;action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);

View File

@ -804,7 +804,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->tax->enabled))
{
$newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax');
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
// Salaries
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_sal&amp;mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_sal&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_sal",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
global $mysoc;
// Social contributions
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
// VAT

View File

@ -0,0 +1,35 @@
-- ===================================================================
-- Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
--
-- 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
create table llx_salaries
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_user integer NOT NULL,
datep date, -- date de paiement
datev date, -- date de valeur
amount real NOT NULL DEFAULT 0,
label varchar(255),
datesp date, -- date de début de la période
dateep date, -- date de fin de la période
entity integer DEFAULT 1 NOT NULL, -- multi company id
note text,
fk_bank integer,
fk_user_creat integer, -- utilisateur qui a cree l'info
fk_user_modif integer -- utilisateur qui a modifié l'info
)ENGINE=innodb;

View File

@ -41,6 +41,7 @@ VATToCollect=VAT purchases
VATSummary=VAT Balance
LT2SummaryES=IRPF Balance
VATPaid=VAT paid
SalPaid=Salary paid
LT2PaidES=IRPF Paid
LT2CustomerES=IRPF sales
LT2SupplierES=IRPF purchases
@ -63,19 +64,24 @@ PaymentCustomerInvoice=Customer invoice payment
PaymentSupplierInvoice=Supplier invoice payment
PaymentSocialContribution=Social contribution payment
PaymentVat=VAT payment
PaymentSal=Salary payment
ListPayment=List of payments
ListOfPayments=List of payments
ListOfCustomerPayments=List of customer payments
ListOfSupplierPayments=List of supplier payments
DatePayment=Payment date
NewVATPayment=New VAT payment
NewSalPayment=New Salary payment
newLT2PaymentES=New IRPF payment
LT2PaymentES=IRPF Payment
LT2PaymentsES=IRPF Payments
VATPayment=VAT Payment
VATPayments=VAT Payments
SalPayment=Salary payment
SalPayments=Saalries payments
SocialContributionsPayments=Social contributions payments
ShowVatPayment=Show VAT payment
ShowSalPayment=Show salary payment
TotalToPay=Total to pay
TotalVATReceived=Total VAT received
CustomerAccountancyCode=Customer accountancy code

View File

@ -63,19 +63,24 @@ PaymentCustomerInvoice=Règlement facture client
PaymentSupplierInvoice=Règlement facture fournisseur
PaymentSocialContribution=Règlement charge sociale
PaymentVat=Règlement TVA
PaymentSal=Règlement salaire
ListPayment=Liste des règlements
ListOfPayments=Liste des règlements
ListOfCustomerPayments=Liste des règlements clients
ListOfSupplierPayments=Liste des règlements fournisseurs
DatePayment=Date de règlement
NewVATPayment=Nouveau règlement de TVA
NewSalPayment=Nouveau règlement de salaire
newLT2PaymentES=Nouveau règlement de IRPF
LT2PaymentES=Règlement IRPF
LT2PaymentsES=Règlements IRPF
VATPayment=Règlement TVA
VATPayments=Règlements TVA
SalPayment=Règlement salaire
SalPayments=Règlements des salaires
SocialContributionsPayments=Règlements charges sociales
ShowVatPayment=Affiche paiement TVA
ShowSalPayment=Affiche paiement salaire
TotalToPay=Total à payer
TotalVATReceived=Total TVA perçue
CustomerAccountancyCode=Compte comptable client