From 5b1e9a2fcdb6f6e3c635a9fc87e76429e7218242 Mon Sep 17 00:00:00 2001 From: jlb Date: Wed, 3 Sep 2003 14:15:20 +0000 Subject: [PATCH] rajout de formulaire pour l'insertion dans cotisations dans le compte bancaire --- htdocs/adherents/cotisations.php | 92 +++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index bca9e6e3610..378cb79ec29 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -21,11 +21,10 @@ * */ require("./pre.inc.php"); +require(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); llxHeader(); -//$db = new Db(); - if ($action == 'add') { $datepaye = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear)); @@ -44,7 +43,53 @@ if ($action == 'add') { $action = ''; } - +// Insertion de la cotisation dans le compte banquaire +if ($HTTP_POST_VARS["action"] == '2bank' && $HTTP_POST_VARS["rowid"] !=''){ + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){ + $dateop=strftime("%Y%m%d",time()); + $sql="SELECT cotisation FROM llx_cotisation WHERE rowid=".$HTTP_POST_VARS["rowid"]." "; + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + if ($num>0) + { + $objp = $db->fetch_object(0); + $amount=$objp->cotisation; + $acct=new Account($db,ADHERENT_BANK_ACCOUNT); + $insertid=$acct->addline($dateop, $HTTP_POST_VARS["operation"], $HTTP_POST_VARS["label"], $amount, $HTTP_POST_VARS["num_chq"],ADHERENT_BANK_CATEGORIE); + if ($insertid == '') + { + print "

Probleme d'insertion : ".$db->error(); + } + else + { + // met a jour la table cotisation + $sql="UPDATE llx_cotisation SET fk_bank=$insertid WHERE rowid=".$HTTP_POST_VARS["rowid"]." "; + $result = $db->query($sql); + if ($result) + { + //Header("Location: $PHP_SELF"); + } + else + { + print "

Probleme d'insertion $sql : ".$db->error(); + } + } + } + else + { + print "

Probleme SQL : $sql : ".$db->error(); + } + } + else + { + print "

Probleme SQL : $sql : ".$db->error(); + } + + + } +} if ($sortorder == "") { $sortorder="DESC"; } if ($sortfield == "") { $sortfield="c.dateadh"; } @@ -76,7 +121,7 @@ if ($result) $i++; } } -$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh"; +$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank as bank, c.rowid as crowid"; $sql .= " FROM llx_adherent as d, llx_cotisation as c"; $sql .= " WHERE d.rowid = c.fk_adherent"; if(isset($date_select) && $date_select != ''){ @@ -111,21 +156,27 @@ if ($result) print ''; //print "Date"; print ''; - print_liste_field_titre("Date",$PHP_SELF,"c.dateadh","&page=$page&statut=$statut"); + print_liste_field_titre("Date
",$PHP_SELF,"c.dateadh","&page=$page&statut=$statut"); print "\n"; //print "Montant"; print ''; - print_liste_field_titre("Montant",$PHP_SELF,"c.cotisation","&page=$page&statut=$statut"); + print_liste_field_titre("Montant
",$PHP_SELF,"c.cotisation","&page=$page&statut=$statut"); print "\n"; //print "Prenom Nom / Société"; print ''; // print_liste_field_titre("Prenom",$PHP_SELF,"d.prenom","&page=$page&statut=$statut"); - print_liste_field_titre("Prenom Nom",$PHP_SELF,"d.nom","&page=$page&statut=$statut"); + print_liste_field_titre("Prenom Nom
",$PHP_SELF,"d.nom","&page=$page&statut=$statut"); print " / Société"; print "\n"; + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){ + print ''; + // print_liste_field_titre("Bank",$PHP_SELF,"c.fk_bank","&page=$page&statut=$statut"); + print 'Bank
(Type,Numéro,Libelle)'; + print "\n"; + } print "\n"; $var=True; @@ -144,6 +195,31 @@ if ($result) }else{ print "rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)."\n"; } + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){ + if ($objp->bank !='' ){ + print "Deposé"; + }else{ + print ""; + print "

"; + print ''; + print ''; + print ''; + print ' - '; + print "prenom)." ".stripslashes($objp->nom)." ".strftime("%Y",$objp->dateadh)."\" >\n"; + // print ""; + // print ""; + print ''; + print "
\n"; + print "\n"; + } + } print ""; $i++; } @@ -152,7 +228,7 @@ if ($result) print "Total\n"; print "".price($total)."\n"; // print " \n"; - print ""; + print ""; print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1); print "\n";