From 245d8721e62c964487909678bb0b1c4f86c54dec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2004 16:01:35 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Ajout=20d'une=20fiche=20de=20Charges=20S?= =?UTF-8?q?ociales=20permettant=20de=20modifier=20une=20saisie=20de=20char?= =?UTF-8?q?ge=20(montant,=20libell=E9)=20tant=20qu'elle=20n'est=20pas=20pa?= =?UTF-8?q?y=E9.=20Il=20reste=20=E0=20g=E9rer=20le=20paiement=20pour=20avo?= =?UTF-8?q?ir=20une=20entr=E9e=20sur=20le=20compte=20automatiquement=20(co?= =?UTF-8?q?mme=20pour=20les=20factures).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/sociales/charges.php | 139 +++++++++++++++++++++++++++++ htdocs/compta/sociales/index.php | 37 +++++++- 2 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 htdocs/compta/sociales/charges.php diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php new file mode 100644 index 00000000000..8495eddd510 --- /dev/null +++ b/htdocs/compta/sociales/charges.php @@ -0,0 +1,139 @@ + + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); + +$user->getrights('facture'); +$user->getrights('compta'); + +if (!$user->admin && !$user->rights->compta->charges) + accessforbidden(); + +require("../../chargesociales.class.php"); +require("../../paiement.class.php"); +require("../bank/account.class.php"); + + +llxHeader(); + + +/* *************************************************************************** */ +/* */ +/* Mode fiche */ +/* */ +/* *************************************************************************** */ +if ($_GET["id"] > 0) + { + $html = new Form($db); + + $cha = New ChargeSociales($db); + if ( $cha->fetch($_GET["id"]) > 0) + { + /* + * Charge + */ + print_titre("Charge sociale : ".$cha->id); + print "
"; + + /* + * Confirmation de la suppression de la facture + * + */ + if ($_GET["action"] == 'delete') + { + $html->form_confirm("index.php?id=$cha->id&action=del","Supprimer la charge sociale","Etes-vous sûr de vouloir supprimer cette charge sociale ?","confirm_delete"); + } + + print "
id&action=update\" method=\"post\">"; + + print ''; + print ""; + print ""; + if ($cha->paye==0) { + print ''; + print ""; + print ""; + } + else { + print ''; + print ""; + print ""; + } + print ""; + print "
Type$cha->type_libelle
PériodeNA
Libellé
Date d'échéancedate_ech)."\">Date de paiementNA
Montantamount\"> 
Libellé'.stripslashes($cha->lib).'
Date d'échéance".strftime("%Y%m%d",$cha->date_ech)."Date de paiement".strftime("%Y%m%d",$cha->date_pai)."
Montant$cha->amount 
Statut".($cha->paye==0?"Non paye":"Payé")." 
"; + + + print "
\n"; + + + + if (! $_GET["action"]) { + + /* + * Boutons actions + */ + + print "
\n"; + + // Supprimer + if ($cha->paye == 0 && $user->rights->facture->supprimer) + { + print "id&action=delete\">Supprimer"; + } + + // Emettre paiement + if ($cha->paye == 0 && $user->rights->facture->paiement) + { + print "id&action=create\">Emettre paiement"; + } + + // Classer 'payé' + if ($cha->paye == 0 && $user->rights->facture->paiement) + { + print "id&action=payed\">Classer 'Payée'"; + } + + print "
"; + } + + if ($_GET["action"] == 'create') + { + print "Cette fonction n'a pas encore été implémentée"; + + } + if ($_GET["action"] == 'payed') + { + print "Cette fonction n'a pas encore été implémentée"; + + } + + } + else + { + /* Charge non trouvée */ + print "Charge inexistante ou accés refusé"; + } +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 89230e8053a..815f32bcf1a 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -22,6 +22,13 @@ */ require("./pre.inc.php"); +$user->getrights('facture'); +$user->getrights('compta'); + +if (!$user->admin && !$user->rights->compta->charges) + accessforbidden(); + + llxHeader(); function valeur($sql) @@ -75,9 +82,16 @@ print_titre("Charges sociales $year"); print "
\n"; +//if ($filtre) { +// print_titre("Filtre : ".$_GET["filtrelib"]); +// print "
\n"; +//} + print ""; print ""; print ''; print "\n"; -$sql = "SELECT s.rowid as id, c.libelle as type, s.amount,".$db->pdate("s.date_ech")." as de, s.date_pai, s.libelle, s.paye,".$db->pdate("s.periode")." as periode,".$db->pdate("s.date_pai")." as dp"; +$sql = "SELECT s.rowid as id, s.fk_type as type, c.libelle as type_lib, s.amount,".$db->pdate("s.date_ech")." as de, s.date_pai, s.libelle, s.paye,".$db->pdate("s.periode")." as periode,".$db->pdate("s.date_pai")." as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s"; $sql .= " WHERE s.fk_type = c.id"; if ($year > 0) @@ -104,7 +118,20 @@ if ($filtre) { $filtre=ereg_replace(":","=",$filtre); $sql .= " AND $filtre"; } -$sql .= " ORDER BY lower(s.date_ech) DESC"; +if ($_GET["sortfield"]) { + $sql .= " ORDER BY ".$_GET["sortfield"]; +} +else { + $sql .= " ORDER BY lower(s.date_ech)"; +} +if ($_GET["sortorder"]) { + $sql .= " ".$_GET["sortorder"]; +} +else { + $sql .= " DESC"; +} + + if ( $db->query($sql) ) { @@ -117,6 +144,7 @@ if ( $db->query($sql) ) $var = !$var; print ""; + print ''; print ''; print ''; - print ''; + print ''; print ''; if ($obj->paye) @@ -143,7 +171,7 @@ if ( $db->query($sql) ) } else { - print $db->error(); + print "Error :".$db->error()." - $sql"; } /* @@ -152,6 +180,7 @@ else */ print ''; print ''; +print ''; print ''; print '';
'; +print_liste_field_titre("Num",$PHP_SELF,"id"); +print ''; print_liste_field_titre("Echéance/Date",$PHP_SELF,"de"); print ''; print_liste_field_titre("Période",$PHP_SELF,"periode"); @@ -93,7 +107,7 @@ print ' 
'.$obj->id.''.strftime("%d %b %y",$obj->de).''; if ($obj->periode) { @@ -125,7 +153,7 @@ if ( $db->query($sql) ) print ' '; } print ''.$obj->type.''.$obj->libelle.''.$obj->type_lib.''.$obj->libelle.''.price($obj->amount).'
  YYYYMMDD