Maxi debug of withdraw module

This commit is contained in:
Laurent Destailleur 2008-11-05 22:34:14 +00:00
parent afd8068d0a
commit b86223bc90
25 changed files with 921 additions and 811 deletions

View File

@ -507,7 +507,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_add_spip' &&
/* /*
* * View
*/ */
llxHeader(); llxHeader();

View File

@ -1820,7 +1820,8 @@ if ($_GET['action'] == 'create')
else else
{ {
$id = $_GET['facid']; $id = $_GET['facid'];
if ($id > 0) $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
/* *************************************************************************** */ /* *************************************************************************** */
/* */ /* */
@ -1832,7 +1833,7 @@ else
$facstatic = new Facture($db); $facstatic = new Facture($db);
$fac = new Facture($db); $fac = new Facture($db);
$result=$fac->fetch($_GET['facid']); $result=$fac->fetch($_GET['facid'],$_GET['ref']);
if ($result > 0) if ($result > 0)
{ {
if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0); if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0);
@ -2026,17 +2027,19 @@ else
// Reference // Reference
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>'; print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$fac->ref; print '<td colspan="5">';
$morehtmlref='';
$discount=new DiscountAbsolute($db); $discount=new DiscountAbsolute($db);
$result=$discount->fetch(0,$fac->id); $result=$discount->fetch(0,$fac->id);
if ($result > 0) if ($result > 0)
{ {
print ' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
} }
if ($result < 0) if ($result < 0)
{ {
dolibarr_print_error('',$discount->error); dolibarr_print_error('',$discount->error);
} }
print $html->showrefnav($fac,'ref','',1,'facnumber','ref',$morehtmlref);
print '</td></tr>'; print '</td></tr>';
// Ref client // Ref client

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2005 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 * 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 * it under the terms of the GNU General Public License as published by
@ -16,16 +16,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/compta/facture/prelevement.php * \file htdocs/compta/facture/prelevement.php
\ingroup facture * \ingroup facture
\brief Gestion des prelevement d'une facture * \brief Gestion des prelevement d'une facture
\version $Revision$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -78,11 +75,15 @@ if ($_GET["action"] == "delete")
if ($result == 0) if ($result == 0)
{ {
Header("Location: prelevement.php?facid=".$fact->id); Header("Location: prelevement.php?facid=".$fact->id);
exit;
} }
} }
} }
/*
* View
*/
llxHeader('',$langs->trans("Bill")); llxHeader('',$langs->trans("Bill"));
@ -153,7 +154,7 @@ if ($_GET["facid"] > 0)
print '<td align="right" colspan="2"><b>'.price($fac->total_ttc).'</b></td>'; print '<td align="right" colspan="2"><b>'.price($fac->total_ttc).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="2">&nbsp;</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="2">&nbsp;</td></tr>';
print '<tr><td>RIB</td><td colspan="5">'; print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="5">';
print $soc->display_rib(); print $soc->display_rib();
print '</td></tr>'; print '</td></tr>';
@ -185,12 +186,12 @@ if ($_GET["facid"] > 0)
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
// Valider // Add a withdraw request
if ($fac->statut > 0 && $fac->paye == 0 && $fac->mode_reglement_code == 'PRE' && $num == 0) if ($fac->statut > 0 && $fac->paye == 0 && $fac->mode_reglement_code == 'PRE' && $num == 0)
{ {
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
{ {
print '<a class="butAction" href="prelevement.php?facid='.$fac->id.'&amp;action=new">Faire une demande de prélèvement</a>'; print '<a class="butAction" href="prelevement.php?facid='.$fac->id.'&amp;action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
} }
} }
print "</div><br/>"; print "</div><br/>";
@ -202,7 +203,7 @@ if ($_GET["facid"] > 0)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("DateRequest").'</td>'; print '<td align="left">'.$langs->trans("DateRequest").'</td>';
print '<td align="center">'.$langs->trans("DateProcess").'</td>'; print '<td align="center">'.$langs->trans("DateProcess").'</td>';
print '<td align="center">'.$langs->trans("Amount").'</td>'; print '<td align="center">'.$langs->trans("Amount").'</td>';
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>'; print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
@ -220,7 +221,7 @@ if ($_GET["facid"] > 0)
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td align="center">'.dolibarr_print_date($obj->date_demande)."</td>\n"; print '<td align="left">'.dolibarr_print_date($obj->date_demande,'day')."</td>\n";
print '<td align="center">En attente de traitement</td>'; print '<td align="center">En attente de traitement</td>';
print '<td align="center">'.price($obj->amount).'</td>'; print '<td align="center">'.price($obj->amount).'</td>';
print '<td align="center">-</td>'; print '<td align="center">-</td>';

View File

@ -26,11 +26,16 @@
\version $Revision$ \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
class BonPrelevement
/**
* \class BonPrelevement
* \brief Classe permettant la gestion des bons de prelevements
*/
class BonPrelevement extends CommonObject
{ {
var $db; var $db;
@ -43,6 +48,7 @@ class BonPrelevement
var $total; var $total;
var $_fetched; var $_fetched;
function BonPrelevement($DB, $filename='') function BonPrelevement($DB, $filename='')
{ {
$error = 0; $error = 0;
@ -195,7 +201,7 @@ class BonPrelevement
* *
* *
*/ */
function Fetch($rowid) function fetch($rowid)
{ {
$sql = "SELECT p.rowid, p.ref, p.amount, p.note, p.credite"; $sql = "SELECT p.rowid, p.ref, p.amount, p.note, p.credite";
$sql .= ",".$this->db->pdate("p.datec")." as dc"; $sql .= ",".$this->db->pdate("p.datec")." as dc";
@ -205,9 +211,9 @@ class BonPrelevement
$sql .= " , fk_user_credit"; $sql .= " , fk_user_credit";
$sql .= " , statut"; $sql .= " , statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " WHERE p.rowid=".$rowid; $sql .= " WHERE p.rowid=".$rowid;
dolibarr_syslog("Bon-prelevement::fetch sql=".$sql, LOG_DEBUG);
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
@ -595,26 +601,23 @@ class BonPrelevement
} }
/** /**
* \brief Renvoi nombre de factures a pr<EFBFBD>lever * \brief Renvoi nombre de factures a prelever
* \param banque bank * \param banque bank
* \param agence agence * \param agence agence
* \return int <O si erreur, sinon nbre de factures * \return int <O si erreur, sinon nbre de factures
*/ */
function NbFactureAPrelever($banque=0,$agence=0) function NbFactureAPrelever($banque=0,$agence=0)
{ {
$sql = "SELECT count(f.total_ttc)"; $sql = "SELECT count(f.rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " , ".MAIN_DB_PREFIX."societe_rib as sr"; if ($banque == 1 || $agence == 1) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr";
$sql .= " WHERE f.fk_statut = 1"; $sql .= " WHERE f.fk_statut = 1";
$sql .= " AND f.rowid = pfd.fk_facture"; $sql .= " AND f.rowid = pfd.fk_facture";
$sql .= " AND f.fk_soc = sr.fk_soc";
$sql .= " AND f.paye = 0"; $sql .= " AND f.paye = 0";
$sql .= " AND pfd.traite = 0"; $sql .= " AND pfd.traite = 0";
$sql .= " AND f.total_ttc > 0"; $sql .= " AND f.total_ttc > 0";
$sql .= " AND f.fk_mode_reglement = 3"; if ($banque == 1 || $agence == 1) $sql .= " AND f.fk_soc = sr.rowid";
if ($banque == 1) if ($banque == 1)
{ {
$sql .= " AND sr.code_banque = '".PRELEVEMENT_CODE_BANQUE."'"; $sql .= " AND sr.code_banque = '".PRELEVEMENT_CODE_BANQUE."'";
@ -643,17 +646,18 @@ class BonPrelevement
} }
} }
/** /**
* \brief Cree prelevement * \brief Create a withdraw
* \return int <0 si ko, nbre de facture pr<EFBFBD>lev<EFBFBD> sinon * \return int <0 if KO, nbre of invoice withdrawed if OK
*/ */
function Create($banque=0, $guichet=0) function Create($banque=0, $guichet=0)
{ {
global $conf; global $conf;
dolibarr_syslog("BonPrelevement::Create"); dolibarr_syslog("BonPrelevement::Create banque=$banque guichet=$guichet");
require_once (DOL_DOCUMENT_ROOT."/bon-prelevement.class.php"); require_once (DOL_DOCUMENT_ROOT."/compta/prelevement/bon-prelevement.class.php");
require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); require_once (DOL_DOCUMENT_ROOT."/facture.class.php");
require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); require_once (DOL_DOCUMENT_ROOT."/societe.class.php");
require_once (DOL_DOCUMENT_ROOT."/paiement.class.php"); require_once (DOL_DOCUMENT_ROOT."/paiement.class.php");
@ -665,7 +669,7 @@ class BonPrelevement
$month = strftime("%m", $datetimeprev); $month = strftime("%m", $datetimeprev);
$year = strftime("%Y", $datetimeprev); $year = strftime("%Y", $datetimeprev);
$user = new user($this->db, PRELEVEMENT_USER); $user = new User($this->db, $conf->global->PRELEVEMENT_USER);
/** /**
* Lectures des factures * Lectures des factures
@ -676,7 +680,6 @@ class BonPrelevement
if (! $error) if (! $error)
{ {
$sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc"; $sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc";
$sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib"; $sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib";
$sql .= ", pfd.amount"; $sql .= ", pfd.amount";
@ -684,17 +687,14 @@ class BonPrelevement
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " , ".MAIN_DB_PREFIX."societe_rib as sr"; if ($banque == 1 || $agence ==1) $sql .= " , ".MAIN_DB_PREFIX."societe_rib as sr";
$sql .= " WHERE f.rowid = pfd.fk_facture"; $sql .= " WHERE f.rowid = pfd.fk_facture";
$sql .= " AND s.rowid = f.fk_soc"; $sql .= " AND s.rowid = f.fk_soc";
$sql .= " AND s.rowid = sr.fk_soc"; if ($banque == 1 || $agence ==1) $sql .= " AND s.rowid = sr.fk_soc";
$sql .= " AND f.fk_statut = 1"; $sql .= " AND f.fk_statut = 1";
$sql .= " AND f.paye = 0"; $sql .= " AND f.paye = 0";
$sql .= " AND pfd.traite = 0"; $sql .= " AND pfd.traite = 0";
$sql .= " AND f.total_ttc > 0"; $sql .= " AND f.total_ttc > 0";
$sql .= " AND f.fk_mode_reglement = 3"; // Mode pr<70>l<EFBFBD>vement
if ($banque == 1) if ($banque == 1)
{ {
$sql .= " AND sr.code_banque = '".PRELEVEMENT_CODE_BANQUE."'"; $sql .= " AND sr.code_banque = '".PRELEVEMENT_CODE_BANQUE."'";
@ -704,8 +704,8 @@ class BonPrelevement
$sql .= " AND sr.code_guichet = '".PRELEVEMENT_CODE_GUICHET."'"; $sql .= " AND sr.code_guichet = '".PRELEVEMENT_CODE_GUICHET."'";
} }
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -718,7 +718,7 @@ class BonPrelevement
$i++; $i++;
} }
$this->db->free($resql); $this->db->free($resql);
dolibarr_syslog("$i factures <20> pr<70>lever"); dolibarr_syslog($i." invoices to withdraw");
} }
else else
{ {
@ -728,20 +728,11 @@ class BonPrelevement
} }
} }
/*
*
* Verif des clients
*
*/
if (! $error) if (! $error)
{ {
/* // Check RIB
* V<EFBFBD>rification des RIB
*
*/
$i = 0; $i = 0;
dolibarr_syslog("D<EFBFBD>but v<>rification des RIB"); dolibarr_syslog("Start RIB check");
if (sizeof($factures) > 0) if (sizeof($factures) > 0)
{ {
@ -763,18 +754,18 @@ class BonPrelevement
} }
else else
{ {
dolibarr_syslog("Erreur de RIB societe $fact->socid $soc->nom"); dolibarr_syslog("Erreur de RIB societe $fact->socid $soc->nom", LOG_ERROR);
$facture_errors[$fac[0]]="Erreur de RIB societe $fact->socid $soc->nom"; $facture_errors[$fac[0]]="Erreur de RIB societe $fact->socid $soc->nom";
} }
} }
else else
{ {
dolibarr_syslog("Impossible de lire la soci<63>t<EFBFBD>"); dolibarr_syslog("Failed to read company", LOG_ERROR);
} }
} }
else else
{ {
dolibarr_syslog("Impossible de lire la facture"); dolibarr_syslog("Impossible de lire la facture", LOG_ERROR);
} }
} }
} }
@ -785,12 +776,8 @@ class BonPrelevement
} }
/* // Withdraw invoices in factures_prev array
* dolibarr_syslog(sizeof($factures_prev)." invoices will be withdrawed");
*
*/
dolibarr_syslog(sizeof($factures_prev)." factures seront pr<70>lev<65>es");
if (sizeof($factures_prev) > 0) if (sizeof($factures_prev) > 0)
{ {
@ -815,6 +802,7 @@ class BonPrelevement
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."prelevement_bons"; $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql .= " WHERE ref LIKE '$ref%'"; $sql .= " WHERE ref LIKE '$ref%'";
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -831,14 +819,11 @@ class BonPrelevement
$filebonprev = $ref; $filebonprev = $ref;
/* // Create withdraw receipt in database
* Creation du bon de prelevement
*
*/
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (ref,datec)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (ref,datec)";
$sql .= " VALUES ('".$ref."',".$this->db->idate(mktime()).")"; $sql .= " VALUES ('".$ref."',".$this->db->idate(mktime()).")";
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -855,7 +840,7 @@ class BonPrelevement
else else
{ {
$error++; $error++;
dolibarr_syslog("Erreur cr<EFBFBD>ation du bon de prelevement"); dolibarr_syslog("Erreur creation du bon de prelevement");
} }
} }
@ -865,25 +850,26 @@ class BonPrelevement
*/ */
if (!$error) if (!$error)
{ {
dolibarr_syslog("D<EFBFBD>but g<>n<EFBFBD>ration des paiements"); dolibarr_syslog("Start generation payments for the ".sizeof($factures_prev)." invoices");
dolibarr_syslog("Nombre de factures ".sizeof($factures_prev));
if (sizeof($factures_prev) > 0) if (sizeof($factures_prev) > 0)
{ {
foreach ($factures_prev as $fac) foreach ($factures_prev as $fac)
{ {
// Fetch invoice
$fact = new Facture($this->db); $fact = new Facture($this->db);
$fact->fetch($fac[0]); $fact->fetch($fac[0]);
// Create payment
$pai = new Paiement($this->db); $pai = new Paiement($this->db);
$pai->amounts = array(); $pai->amounts = array();
$pai->amounts[$fac[0]] = $fact->total_ttc; $pai->amounts[$fac[0]] = $fact->total_ttc;
$pai->datepaye = $this->db->idate($datetimeprev); $pai->datepaye = $datetimeprev;
$pai->paiementid = 3; // pr<70>l<EFBFBD>vement $pai->paiementid = 3; // pr<70>l<EFBFBD>vement
$pai->num_paiement = $ref; $pai->num_paiement = $ref;
if ($pai->create($user, 1) == -1) // on appelle en no_commit if ($pai->create($user, 1) < 0) // on appelle en no_commit
{ {
$error++; $error++;
dolibarr_syslog("Erreur creation paiement facture ".$fac[0]); dolibarr_syslog("Erreur creation paiement facture ".$fac[0]);
@ -925,6 +911,7 @@ class BonPrelevement
$sql .= ", fk_prelevement_bons = ".$prev_id; $sql .= ", fk_prelevement_bons = ".$prev_id;
$sql .= " WHERE rowid=".$fac[1]; $sql .= " WHERE rowid=".$fac[1];
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -984,11 +971,12 @@ class BonPrelevement
$sql .= " SET amount = ".price2num($bonprev->total); $sql .= " SET amount = ".price2num($bonprev->total);
$sql .= " WHERE rowid = ".$prev_id; $sql .= " WHERE rowid = ".$prev_id;
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) if (! $resql)
{ {
$error++; $error++;
dolibarr_syslog("Erreur mise <EFBFBD> jour du total - $sql"); dolibarr_syslog("Erreur mise a jour du total - $sql");
} }
/* /*
@ -998,12 +986,10 @@ class BonPrelevement
if (!$error) if (!$error)
{ {
$this->db->commit(); $this->db->commit();
dolibarr_syslog("COMMIT");
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
dolibarr_syslog("ROLLBACK");
} }
return sizeof($factures_prev); return sizeof($factures_prev);
@ -1014,6 +1000,34 @@ class BonPrelevement
} }
} }
/**
* \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto Inclut le picto dans le lien
* \param 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/prelevement/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
if ($option == 'xxx')
{
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
}
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowWithdraw"),'payment').$lienfin.' ');
$result.=$lien.$this->ref.$lienfin;
return $result;
}
/** /**
* *
* *
@ -1023,7 +1037,7 @@ class BonPrelevement
$result = 0; $result = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_notifications "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_notifications ";
$sql .= " WHERE rowid = '".$rowid."';"; $sql .= " WHERE rowid = '".$rowid."'";
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -1044,7 +1058,7 @@ class BonPrelevement
$result = 0; $result = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_notifications "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_notifications ";
$sql .= " WHERE fk_user = '".$user."' AND action = '".$action."';"; $sql .= " WHERE fk_user = '".$user."' AND action = '".$action."'";
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -1086,7 +1100,7 @@ class BonPrelevement
} }
/** /**
* G<EFBFBD>n<EFBFBD>ration d'un bon de pr<EFBFBD>l<EFBFBD>vement * Generation d'un bon de pr<EFBFBD>l<EFBFBD>vement
* *
*/ */
function Generate() function Generate()

View File

@ -15,17 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/ */
/** /**
\file htdocs/compta/prelevement/bon.php \file htdocs/compta/prelevement/bon.php
\ingroup prelevement \ingroup prelevement
\brief Fiche aperçu du bon de prelevement \brief Fiche aperçu du bon de prelevement
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -146,5 +142,5 @@ if ($_GET["id"])
print "</div>"; print "</div>";
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1,6 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -15,16 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/compta/prelevement/bons.php \file htdocs/compta/prelevement/bons.php
\ingroup prelevement \ingroup prelevement
\brief Page liste des bons de prelevements \brief Page liste des bons de prelevements
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -108,7 +105,7 @@ if ($result)
print '<td align="center">'.dolibarr_print_date($obj->datec,'day')."</td>\n"; print '<td align="center">'.dolibarr_print_date($obj->datec,'day')."</td>\n";
print '<td align="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</td>\n"; print '<td align="right">'.price($obj->amount)."</td>\n";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

View File

@ -184,6 +184,9 @@ print '<br>';
* TODO Use notification module instead * TODO Use notification module instead
*/ */
if ($conf->global->MAIN_MODULE_NOTIFICATION)
{
print_titre($langs->trans("Notifications")); print_titre($langs->trans("Notifications"));
if ($user->rights->prelevement->bons->configurer) if ($user->rights->prelevement->bons->configurer)
@ -270,6 +273,7 @@ print '</table>';
if ($user->rights->prelevement->bons->configurer) if ($user->rights->prelevement->bons->configurer)
print '</form>'; print '</form>';
}
$db->close(); $db->close();

View File

@ -24,6 +24,8 @@
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php");
require_once DOL_DOCUMENT_ROOT."/facture.class.php";
require_once DOL_DOCUMENT_ROOT."/societe.class.php";
$langs->load("widthdrawals"); $langs->load("widthdrawals");
$langs->load("companies"); $langs->load("companies");
@ -49,7 +51,7 @@ if ($_GET["action"] == 'create')
} }
if ($result == 0) if ($result == 0)
{ {
$mesg='<div class="error">Aucune facture prélevable, prélevé avec succès</div>'; $mesg='<div class="error">'.$langs->trans("NoInvoiceCouldBeWithdrawed").'</div>';
} }
} }
@ -58,6 +60,10 @@ if ($_GET["action"] == 'create')
* View * View
*/ */
$thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db);
$bprev = new BonPrelevement($db);
llxHeader(); llxHeader();
$h=0; $h=0;
@ -67,7 +73,6 @@ $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("StandingOrders")); dolibarr_fiche_head($head, $hselected, $langs->trans("StandingOrders"));
$bprev = new BonPrelevement($db);
$nb=$bprev->NbFactureAPrelever(); $nb=$bprev->NbFactureAPrelever();
$nb1=$bprev->NbFactureAPrelever(1); $nb1=$bprev->NbFactureAPrelever(1);
@ -77,12 +82,15 @@ if ($nb < 0 || $nb1 < 0 || $nb11 < 0)
dolibarr_print_error($bprev->error); dolibarr_print_error($bprev->error);
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdraw").'</td>'; print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
print '<td align="right">'; print '<td align="right">';
print $nb; print $nb;
print '</td><td>'.$langs->trans("BankCode").'</td><td align="right">'; print '</td></tr>';
print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdraw").' '.$langs->trans("ThirdPartyBankCode").'='.PRELEVEMENT_CODE_BANQUE.'</td><td align="right">';
print $nb1; print $nb1;
print '</td><td>'.$langs->trans("DeskCode").'</td><td align="right">'; print '</td></tr>';
print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdraw").' '.$langs->trans("ThirdPartyDeskCode").'='.PRELEVEMENT_CODE_GUICHET.'</td><td align="right">';
print $nb11; print $nb11;
print '</td></tr>'; print '</td></tr>';
@ -90,9 +98,9 @@ print '<tr><td>'.$langs->trans("AmountToWithdraw").'</td>';
print '<td align="right">'; print '<td align="right">';
print price($bprev->SommeAPrelever()); print price($bprev->SommeAPrelever());
print '</td>'; print '</td>';
print '<td colspan="4">&nbsp;</td>'; print '</tr>';
print '</tr></table>'; print '</table>';
print '</div>'; print '</div>';
@ -147,8 +155,10 @@ if ($result)
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td>"; print "<tr $bc[$var]><td>";
print '<img border="0" src="./statut'.$obj->statut.'.png"></a>&nbsp;'; $bprev->id=$obj->rowid;
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; $bprev->ref=$obj->ref;
print $bprev->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.dolibarr_print_date($obj->datec,'day')."</td>\n"; print '<td align="center">'.dolibarr_print_date($obj->datec,'day')."</td>\n";
print '<td align="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</td>\n"; print '<td align="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</td>\n";
@ -190,15 +200,22 @@ if ( $db->query($sql) )
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">Factures en attente de prélèvement ('.$num.')</td></tr>'; print '<td colspan="2">'.$langs->trans("InvoiceWaitingWithdraw").' ('.$num.')</td></tr>';
$var = True; $var = True;
while ($i < $num && $i < 20) while ($i < $num && $i < 20)
{ {
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>'; $invoicestatic->id=$obj->rowid;
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>'; $invoicestatic->ref=$obj->facnumber;
print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>';
print '<td>';
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom;
print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -26,6 +26,8 @@
require("./pre.inc.php"); require("./pre.inc.php");
require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php"; require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/facture.class.php";
require_once DOL_DOCUMENT_ROOT."/societe.class.php";
$langs->load("widthdrawals"); $langs->load("widthdrawals");
$langs->load("companies"); $langs->load("companies");
@ -36,11 +38,14 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement','',''); $result = restrictedArea($user, 'prelevement','','');
/*
* View
*/
llxHeader(); llxHeader();
/* $thirdpartystatic=new Societe($db);
* $invoicestatic=new Facture($db);
*/
$page = $_GET["page"]; $page = $_GET["page"];
$sortorder = $_GET["sortorder"]; $sortorder = $_GET["sortorder"];
@ -98,7 +103,7 @@ else
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Bill").'</td><td class="liste_titre">'.$langs->trans("Company").'</td>'; print '<td class="liste_titre">'.$langs->trans("Bill").'</td><td class="liste_titre">'.$langs->trans("Company").'</td>';
print '<td class="liste_titre" align="center">'.$langs->trans("Date").'</td>'; print '<td class="liste_titre" align="center">'.$langs->trans("DateRequest").'</td>';
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>'; print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
print '</tr>'; print '</tr>';
@ -120,11 +125,19 @@ else
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
// Ref facture // Ref facture
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>'; print '<td>';
$invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber;
print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>'; print '<td>';
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom;
print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>';
print '<td align="center">'.dolibarr_print_date($obj->date_demande).'</td>'; print '<td align="center">'.dolibarr_print_date($obj->date_demande,'day').'</td>';
if (!array_key_exists($obj->fk_user_demande,$users)) if (!array_key_exists($obj->fk_user_demande,$users))
{ {
@ -133,7 +146,9 @@ else
} }
// User // User
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$users[$obj->fk_user_demande]->id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$users[$obj->fk_user_demande]->code.'</a></td>'; print '<td align="center">';
print $users[$obj->fk_user_demande]->getNomUrl(1);
print '</td>';
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@ -15,26 +15,25 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/compta/prelevement/factures.php \file htdocs/compta/prelevement/factures.php
\ingroup prelevement \ingroup prelevement
\brief Page liste des factures prélevées \brief Page liste des factures prélevées
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
$langs->load("companies");
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement'); llxHeader('',$langs->trans("WithdrawalReceipt"));
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
@ -74,11 +73,13 @@ if ($_GET["id"])
if ($bon->fetch($_GET["id"]) == 0) if ($bon->fetch($_GET["id"]) == 0)
{ {
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '</table><br />'; print '</table>';
print '</div>';
} }
else else
{ {
@ -128,7 +129,7 @@ if ($result)
$urladd = "&amp;id=".$_GET["id"]; $urladd = "&amp;id=".$_GET["id"];
print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num); print_barre_liste("", $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
@ -138,7 +139,7 @@ if ($result)
print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder);
print '<td class="liste_titre" colspan="2">&nbsp;</td></tr>'; print '<td class="liste_titre" colspan="2">&nbsp;</td></tr>';
$var=True; $var=false;
$total = 0; $total = 0;

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
*/ */
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement - Rejet'); llxHeader('',$langs->trans("WithdrawalReceipt"));
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
@ -105,9 +105,9 @@ if ($result)
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Bon N°","rejets.php","p.ref",'',$urladd); print_liste_field_titre("Bon N°","rejets.php","p.ref",'',$urladd);
print_liste_field_titre("Facture","rejets.php","p.facnumber",'',$urladd); print_liste_field_titre($langs->trans("Invoice"),"rejets.php","p.facnumber",'',$urladd);
print_liste_field_titre("Société","rejets.php","s.nom",'',$urladd); print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd);
print_liste_field_titre("Montant","rejets.php","f.total_ttc","",$urladd,'align="center"'); print_liste_field_titre($langs->trans("Amount"),"rejets.php","f.total_ttc","",$urladd,'align="center"');
print '<td colspan="2">&nbsp;</td></tr>'; print '<td colspan="2">&nbsp;</td></tr>';
$var=True; $var=True;
@ -156,5 +156,5 @@ else
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -15,9 +15,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* */
* $Id$
* $Source$ /*
* \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -27,7 +28,7 @@ require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement - Rejet'); llxHeader('',$langs->trans("WithdrawalReceipt"));
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
@ -66,11 +67,13 @@ if ($_GET["id"])
if ($bon->fetch($_GET["id"]) == 0) if ($bon->fetch($_GET["id"]) == 0)
{ {
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '</table><br />'; print '</table>';
print '</div>';
} }
else else
{ {
@ -111,11 +114,11 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
print_barre_liste("Lignes de prélèvement rejetées", $page, "fiche-rejet.php", $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>Ligne</td><td>Société</td><td align="right">Montant</td><td>Motif</td><td align="center">A Facturer</td><td align="center">Facture</td></tr>'; print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>';
print '<td>'.$langs->trans("Reason").'</td><td align="center">'.$langs->trans("ToBill").'</td><td align="center">'.$langs->trans("Invoice").'</td></tr>';
$var=True; $var=True;
$total = 0; $total = 0;
@ -144,8 +147,8 @@ if ($resql)
$i++; $i++;
} }
print "<tr $bc[$var]><td>&nbsp;</td>"; print '<tr class="liste_total"><td>&nbsp;</td>';
print "<td>Total</td>\n"; print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>\n"; print '<td align="right">'.price($total)."</td>\n";
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n</table>\n"; print "</tr>\n</table>\n";

View File

@ -15,9 +15,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* */
* $Id$
* $Source$ /*
* \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -25,7 +26,12 @@ require("./pre.inc.php");
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Statistique Bon de prélèvement');
/*
* View
*/
llxHeader('',$langs->trans("WithdrawalReceipt"));
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
@ -64,13 +70,15 @@ if ($prev_id)
if ($bon->fetch($_GET["id"]) == 0) if ($bon->fetch($_GET["id"]) == 0)
{ {
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '</table><br />'; print '</table>';
print '</div>';
} }
else else
{ {
@ -97,7 +105,7 @@ if ($prev_id)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>Statut</td><td align="right">Montant</td><td align="right">%</td></tr>'; print '<td>Statut</td><td align="right">Montant</td><td align="right">%</td></tr>';
$var=True; $var=false;
while ($i < $num) while ($i < $num)
{ {
@ -117,6 +125,7 @@ if ($prev_id)
{ {
print 'En attente'; print 'En attente';
} }
else print 'Unknown';
print '</td><td align="right">'; print '</td><td align="right">';
print price($row[0]); print price($row[0]);
@ -142,5 +151,5 @@ if ($prev_id)
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -15,16 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/compta/prelevement/fiche.php \file htdocs/compta/prelevement/fiche.php
\ingroup prelevement \ingroup prelevement
\brief Fiche prelevement \brief Fiche prelevement
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -33,12 +30,19 @@ if (!$user->rights->prelevement->bons->lire)
accessforbidden(); accessforbidden();
$langs->load("bills"); $langs->load("bills");
$langs->load("withdrawals");
/* /*
* Sécurité accés client * Sécurité accés client
*/ */
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
/*
* Actions
*/
if ($_POST["action"] == 'confirm_credite' && $_POST["confirm"] == yes) if ($_POST["action"] == 'confirm_credite' && $_POST["confirm"] == yes)
{ {
$bon = new BonPrelevement($db,""); $bon = new BonPrelevement($db,"");
@ -57,7 +61,7 @@ if ($_POST["action"] == 'infotrans')
{ {
$dir = $conf->prelevement->dir_output.'/bon/'; $dir = $conf->prelevement->dir_output.'/bon/';
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name'],1)) if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name'],1) > 0)
{ {
$dt = dolibarr_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $dt = dolibarr_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
@ -91,7 +95,7 @@ if ($_POST["action"] == 'infocredit')
} }
} }
llxHeader('','Bon de prélèvement'); llxHeader('',$langs->trans("WithdrawalReceipt"));
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
@ -132,7 +136,7 @@ if ($_GET["id"])
if ($bon->fetch($_GET["id"]) == 0) if ($bon->fetch($_GET["id"]) == 0)
{ {
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"));
if (isset($_GET["error"])) if (isset($_GET["error"]))
{ {
@ -149,7 +153,7 @@ if ($_GET["id"])
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dolibarr_print_date($bon->datec,'dayhour').'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dolibarr_print_date($bon->datec,'dayhour').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>'; print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
@ -172,13 +176,13 @@ if ($_GET["id"])
print '<tr><td width="20%">Date Transmission / Par</td><td>'; print '<tr><td width="20%">Date Transmission / Par</td><td>';
print dolibarr_print_date($bon->date_trans,'dayhour'); print dolibarr_print_date($bon->date_trans,'dayhour');
print ' par '.$muser->fullname.'</td></tr>'; print ' par '.$muser->fullname.'</td></tr>';
print '<tr><td width="20%">Méthode Transmission</td><td>'; print '<tr><td width="20%">Methode Transmission</td><td>';
print $bon->methodes_trans[$bon->method_trans]; print $bon->methodes_trans[$bon->method_trans];
print '</td></tr>'; print '</td></tr>';
} }
if($bon->date_credit <> 0) if($bon->date_credit <> 0)
{ {
print '<tr><td width="20%">Crédité le</td><td>'; print '<tr><td width="20%">Credit on</td><td>';
print dolibarr_print_date($bon->date_credit,'dayhour'); print dolibarr_print_date($bon->date_credit,'dayhour');
print '</td></tr>'; print '</td></tr>';
} }
@ -193,10 +197,10 @@ if ($_GET["id"])
print '<tr><td width="20%">Date Transmission</td><td>'; print '<tr><td width="20%">Date Transmission</td><td>';
print $html->select_date('','','','','',"userfile"); print $html->select_date('','','','','',"userfile");
print '</td></tr>'; print '</td></tr>';
print '<tr><td width="20%">Méthode Transmission</td><td>'; print '<tr><td width="20%">Methode Transmission</td><td>';
print $html->select_array("methode",$bon->methodes_trans); print $html->select_array("methode",$bon->methodes_trans);
print '</td></tr>'; print '</td></tr>';
print '<tr><td width="20%">Fichier</td><td>'; print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">'; print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<input class="flat" type="file" name="userfile" size="80"><br />'; print '<input class="flat" type="file" name="userfile" size="80"><br />';
print '</td></tr>'; print '</td></tr>';
@ -240,7 +244,7 @@ if ($_GET["action"] == '')
if ($bon->credite == 0) if ($bon->credite == 0)
{ {
print "<a class=\"butAction\" href=\"fiche.php?action=credite&amp;id=$bon->id\">".$langs->trans("Classer crédité")."</a>"; print "<a class=\"butAction\" href=\"fiche.php?action=credite&amp;id=$bon->id\">".$langs->trans("ClassCredited")."</a>";
} }
@ -250,5 +254,5 @@ if ($_GET["action"] == '')
print "</div>"; print "</div>";
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,13 +19,15 @@
*/ */
/** /**
\file htdocs/compta/prelevement/index.php * \file htdocs/compta/prelevement/index.php
\brief Prelevement * \brief Prelevement
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php"; require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/facture.class.php";
require_once DOL_DOCUMENT_ROOT."/societe.class.php";
$langs->load("withdrawals"); $langs->load("withdrawals");
@ -38,8 +40,7 @@ $result = restrictedArea($user, 'prelevement','','');
/* /*
* Affichage page * View
*
*/ */
llxHeader(); llxHeader();
@ -51,7 +52,8 @@ print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">'; print '<tr><td valign="top" width="30%" class="notopnoleft">';
$thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db);
$bprev = new BonPrelevement($db); $bprev = new BonPrelevement($db);
$var=true; $var=true;
@ -68,15 +70,72 @@ print '<td align="right">';
print price($bprev->SommeAPrelever()); print price($bprev->SommeAPrelever());
print '</td></tr></table><br>'; print '</td></tr></table><br>';
print '</td><td valign="top" width="70%">';
/*
* Factures
*/
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.rowid as socid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE s.rowid = f.fk_soc";
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql .= " AND f.fk_soc = $socid";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("InvoiceWaitingWithdraw").' ('.$num.')</td></tr>';
if ($num)
{
$var = True;
while ($i < $num && $i < 20)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'><td>';
$invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber;
print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>';
print '<td>';
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom;
print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>';
print '</tr>';
$i++;
}
}
else
{
print '<tr><td colspan="2">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>';
}
print "</table><br>";
}
else
{
dolibarr_print_error($db);
}
/* /*
* Bon de prélèvement * Bon de prélèvement
* *
*/ */
$limit=5;
$sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec"; $sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
$sql .= " ,p.statut "; $sql .= " ,p.statut ";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " ORDER BY datec DESC LIMIT 5"; $sql .= " ORDER BY datec DESC LIMIT ".$limit;
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -87,11 +146,12 @@ if ($result)
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("WithdrawalReceiptShort").'</td><td>'.$langs->trans("Date").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipt",$limit).'</td>';
print '<td>'.$langs->trans("Date").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>'; print '<td align="right">'.$langs->trans("Amount").'</td>';
print '</tr>'; print '</tr>';
while ($i < $num) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var=!$var; $var=!$var;
@ -117,60 +177,7 @@ else
dolibarr_print_error($db); dolibarr_print_error($db);
} }
print '</td><td valign="top" width="70%">';
/*
* Factures
*
*/
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.rowid as socid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE s.rowid = f.fk_soc";
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
{
$sql .= " AND f.fk_soc = $socid";
}
if ( $db->query($sql) )
{
$num = $db->num_rows();
$i = 0;
if ($num)
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">Factures en attente de prélèvement ('.$num.')</td></tr>';
$var = True;
while ($i < $num && $i < 20)
{
$obj = $db->fetch_object();
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>';
print '</tr>';
$i++;
}
print "</table><br>";
}
}
else
{
dolibarr_print_error($db);
}
print '</td></tr></table>'; print '</td></tr></table>';
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/*
* \version $Id$
*/
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
@ -27,7 +27,12 @@ require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement');
/*
* View
*/
llxHeader('',$langs->trans("WithdrawalReceipt"));
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
@ -67,14 +72,16 @@ if ($_GET["id"])
if ($bon->fetch($_GET["id"]) == 0) if ($bon->fetch($_GET["id"]) == 0)
{ {
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '</table><br />'; print '</table>';
print '</div>';
} }
else else
{ {
@ -127,16 +134,16 @@ if ($result)
$urladd = "&amp;id=".$_GET["id"]; $urladd = "&amp;id=".$_GET["id"];
print_barre_liste("Lignes de prélèvement", $page, "lignes.php", $urladd, $sortfield, $sortorder, '', $num); print_barre_liste("", $page, "lignes.php", $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Lignes","lignes.php","pl.rowid",'',$urladd); print_liste_field_titre($langs->trans("Lines"),"lignes.php","pl.rowid",'',$urladd);
print_liste_field_titre("Société","lignes.php","s.nom",'',$urladd); print_liste_field_titre($langs->trans("ThirdParty"),"lignes.php","s.nom",'',$urladd);
print_liste_field_titre("Montant","lignes.php","f.total_ttc","",$urladd,'align="center"'); print_liste_field_titre($langs->trans("Amount"),"lignes.php","f.total_ttc","",$urladd,'align="center"');
print '<td colspan="2">&nbsp;</td></tr>'; print '<td colspan="2">&nbsp;</td></tr>';
$var=True; $var=false;
$total = 0; $total = 0;

View File

@ -105,7 +105,7 @@ if ($result)
print_liste_field_titre($langs->trans("WithdrawalReceipt"),"liste.php","p.ref"); print_liste_field_titre($langs->trans("WithdrawalReceipt"),"liste.php","p.ref");
print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom"); print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom");
print_liste_field_titre($langs->trans("Date"),"liste.php","p.datec","","",'align="center"'); print_liste_field_titre($langs->trans("Date"),"liste.php","p.datec","","",'align="center"');
print_liste_field_titre($langs->trans("Amount"),"liste.php","pl.amount"); print_liste_field_titre($langs->trans("Amount"),"liste.php","pl.amount","","",'align="right"');
print_liste_field_titre($langs->trans("CustomerCode"),"liste.php","s.code_client",'','','align="center"'); print_liste_field_titre($langs->trans("CustomerCode"),"liste.php","s.code_client",'','','align="center"');
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -140,9 +140,9 @@ if ($result)
print '<td><img border="0" src="./statut'.$obj->statut.'.png"></a>&nbsp;'; print '<td><img border="0" src="./statut'.$obj->statut.'.png"></a>&nbsp;';
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td><a href="fiche.php?id='.$obj->rowid.'">'.stripslashes($obj->nom)."</a></td>\n"; print '<td><a href="fiche.php?id='.$obj->rowid.'">'.$obj->nom."</a></td>\n";
print '<td align="center">'.dolibarr_print_date($obj->datec)."</td>\n"; print '<td align="center">'.dolibarr_print_date($obj->datec,'day')."</td>\n";
print '<td align="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</td>\n"; print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td align="center"><a href="fiche.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n"; print '<td align="center"><a href="fiche.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';

View File

@ -388,7 +388,7 @@ class Facture extends CommonObject
/** /**
* \brief Renvoie nom clicable (avec eventuellement le picto) * \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* \param option Sur quoi pointe le lien * \param option Sur quoi pointe le lien ('', 'withdraw')
* \return string Chaine avec URL * \return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0,$option='')
@ -397,8 +397,16 @@ class Facture extends CommonObject
$result=''; $result='';
if ($option == 'withdraw')
{
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id.'">';
$lienfin='</a>';
}
else
{
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
}
$picto='bill'; $picto='bill';
if ($this->type == 1) $picto.='r'; if ($this->type == 1) $picto.='r';
@ -416,16 +424,14 @@ class Facture extends CommonObject
/** /**
\brief Recupére l'objet facture et ses lignes de factures * \brief Recupére l'objet facture et ses lignes de factures
\param rowid id de la facture a récupérer * \param rowid id de la facture a récupérer
\param societe_id id de societe * \param ref Ref of invoice
\return int >0 si ok, <0 si ko * \return int >0 si ok, <0 si ko
*/ */
function fetch($rowid, $societe_id=0) function fetch($rowid,$ref='')
{ {
dolibarr_syslog("Facture::Fetch rowid=".$rowid.", societe_id=".$societe_id, LOG_DEBUG); $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
$sql = 'SELECT f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
$sql.= ','.$this->db->pdate('f.datef').' as df'; $sql.= ','.$this->db->pdate('f.datef').' as df';
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr'; $sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
$sql.= ','.$this->db->pdate('f.datec').' as datec'; $sql.= ','.$this->db->pdate('f.datec').' as datec';
@ -440,20 +446,18 @@ class Facture extends CommonObject
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as c ON f.fk_cond_reglement = c.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as c ON f.fk_cond_reglement = c.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'co_fa as cf ON cf.fk_facture = f.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'co_fa as cf ON cf.fk_facture = f.rowid';
$sql.= ' WHERE f.rowid='.$rowid; if ($ref) $sql.= " WHERE f.facnumber='".$ref."'";
if ($societe_id > 0) else $sql.= " WHERE f.rowid=".$rowid;
{
$sql.= ' AND f.fk_soc = '.$societe_id;
}
$result = $this->db->query($sql);
dolibarr_syslog("Facture::Fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $rowid; $this->id = $obj->rowid;
$this->ref = $obj->facnumber; $this->ref = $obj->facnumber;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->type = $obj->type; $this->type = $obj->type;

View File

@ -2991,11 +2991,12 @@ class Form
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL * \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
* \param morehtml Code html supplementaire a afficher avant barre nav * \param morehtml Code html supplementaire a afficher avant barre nav
* \param shownav Show Condition * \param shownav Show Condition
* \param fieldid Nom du champ id a utiliser pour select next et previous * \param fieldid Nom du champ en base a utiliser pour select next et previous
* \param fieldref Nom du champ ref a utiliser pour select next et previous * \param fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* \param morehtmlref Code html supplementaire a afficher apres ref
* \return string Portion HTML avec ref + boutons nav * \return string Portion HTML avec ref + boutons nav
*/ */
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref') function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='')
{ {
$ret=''; $ret='';
@ -3009,6 +3010,9 @@ class Form
} }
$ret.=$object->$fieldref; $ret.=$object->$fieldref;
if ($morehtmlref) {
$ret.=' '.$morehtmlref;
}
if ($morehtml) { if ($morehtml) {
$ret.='</td><td class="nobordernopadding" align="right">'.$morehtml; $ret.='</td><td class="nobordernopadding" align="right">'.$morehtml;

View File

@ -15,13 +15,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\defgroup notification Module notification \defgroup notification Module notification
\brief Module pour g<EFBFBD>rer les notifications (par mail ou autre) \brief Module pour g<EFBFBD>rer les notifications (par mail ou autre)
\version $Id$
*/ */
/** /**

View File

@ -43,6 +43,7 @@ IOMonthlyReporting=Monthly reporting
BankAccountDomiciliation=Account address BankAccountDomiciliation=Account address
BankAccountOwner=Account owner name BankAccountOwner=Account owner name
BankAccountOwnerAddress=Account owner address BankAccountOwnerAddress=Account owner address
RIBControlError=Control of key says informations for this account number are not complete or wrong.
CreateAccount=Create account CreateAccount=Create account
StandingOrderToProcess=To process StandingOrderToProcess=To process
StandingOrderProcessed=Processed StandingOrderProcessed=Processed

View File

@ -16,11 +16,18 @@ RequestStandingOrderToTreat=Request for standing orders to treat
RequestStandingOrderTreated=Request for standing orders treated RequestStandingOrderTreated=Request for standing orders treated
CustomersStandingOrders=Customer standing orders CustomersStandingOrders=Customer standing orders
CustomerStandingOrder=Customer standing order CustomerStandingOrder=Customer standing order
NbOfInvoiceToWithdraw=Nb of invoice to withdraw NbOfInvoiceToWithdraw=Nb of invoice with withdraw request
InvoiceWaitingWithdraw=Invoice waiting for withdraw
AmountToWithdraw=Amount to withdraw AmountToWithdraw=Amount to withdraw
WithdrawsRefused=Withdraws refused WithdrawsRefused=Withdraws refused
NoInvoiceToWithdraw=No invoice in payment mode "withdraw" is waiting NoInvoiceToWithdraw=No customer invoice in payment mode "withdraw" is waiting. Go on 'Withdraw' tab on invoice card to make a request.
ResponsibleUser=Responsible user ResponsibleUser=Responsible user
WithdrawalsSetup=Withdrawal setup WithdrawalsSetup=Withdrawal setup
WithdrawStatistics=Withdraws' statistics WithdrawStatistics=Withdraws' statistics
WithdrawRejectStatistics=Withdraw rejects' statistics WithdrawRejectStatistics=Withdraw rejects' statistics
LastWithdrawalReceipt=Last %s withdrawing receipts
MakeWithdrawRequest=Make a withdraw request
ThirdPartyBankCode=Third party bank code
ThirdPartyDeskCode=Third party desk code
NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoice are on companies with a valid RIB.
ClassCredited=Classer crédité

View File

@ -43,6 +43,7 @@ IOMonthlyReporting=Rapport mensuel E/S
BankAccountDomiciliation=Domiciliation du compte BankAccountDomiciliation=Domiciliation du compte
BankAccountOwner=Nom du propriétaire du compte BankAccountOwner=Nom du propriétaire du compte
BankAccountOwnerAddress=Adresse du propriétaire du compte BankAccountOwnerAddress=Adresse du propriétaire du compte
RIBControlError=Le contrôle de la clé indique que les informations de ce compte bancaire sont incomplètes ou incorrectes.
CreateAccount=Créer compte CreateAccount=Créer compte
StandingOrderToProcess=À traiter StandingOrderToProcess=À traiter
StandingOrderProcessed=Traités StandingOrderProcessed=Traités

View File

@ -16,11 +16,18 @@ RequestStandingOrderToTreat=Demandes de pr
RequestStandingOrderTreated=Demandes de prélèvements traitées RequestStandingOrderTreated=Demandes de prélèvements traitées
CustomersStandingOrders=Prélèvements clients CustomersStandingOrders=Prélèvements clients
CustomerStandingOrder=Prélèvement client CustomerStandingOrder=Prélèvement client
NbOfInvoiceToWithdraw=Nb de facture à prélever NbOfInvoiceToWithdraw=Nb de facture en attente de prélevement
InvoiceWaitingWithdraw=Factures en attente de prélèvement
AmountToWithdraw=Somme à prélever AmountToWithdraw=Somme à prélever
WithdrawsRefused=Prélèvements rejetés WithdrawsRefused=Prélèvements rejetés
NoInvoiceToWithdraw=Aucune facture en mode de paiement 'Prélevement' n'a de demande de prélèvements en attente NoInvoiceToWithdraw=Aucune facture client en mode de paiement 'Prélevement' n'a de demande de prélèvements en attente. Aller sur l'onglet 'Prélèvement' de la fiche facture pour faire une demande.
ResponsibleUser=Utilisateur responsable des prélèvements ResponsibleUser=Utilisateur responsable des prélèvements
WithdrawalsSetup=Configuration des prélèvements WithdrawalsSetup=Configuration des prélèvements
WithdrawStatistics=Statistiques des prélèvements WithdrawStatistics=Statistiques des prélèvements
WithdrawRejectStatistics=Statistiques des rejets de prélèvements WithdrawRejectStatistics=Statistiques des rejets de prélèvements
LastWithdrawalReceipt=Les %s derniers bons de prélèvements
MakeWithdrawRequest=Faire une demande de prélèvement
ThirdPartyBankCode=Code banque du tiers
ThirdPartyDeskCode=Code guichet du tiers
NoInvoiceCouldBeWithdrawed=Aucune facture prélevable, prélevé avec succès. Vérifiez que les factures sont sur des sociétés dont le RIB est correctement renseigné.
ClassCredited=Classer crédité

View File

@ -101,7 +101,7 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
{ {
if (!$account->verif()) if (!$account->verif())
{ {
print '<div class="error"><b>Le contrôle de la clé indique que les informations de ce compte bancaire sont incomplètes ou incorrectes.</b></div><br>'; print '<div class="error">'.$langs->trans("RIBControlError").'</div><br>';
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -109,7 +109,13 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>'; print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
print '<td colspan="4">'.$account->bank.'</td></tr>'; print '<td colspan="4">'.$account->bank.'</td></tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td align="center">Code Banque</td><td align="center">Code Guichet</td><td align="center">Numéro</td><td align="center">Clé RIB</td></tr>'; print '<tr><td>'.$langs->trans("RIB").'</td>';
print '<td align="center">'.$langs->trans("BankCode").'</td>';
print '<td align="center">'.$langs->trans("DeskCode").'</td>';
print '<td align="center">'.$langs->trans("BankAccountNumber").'</td>';
print '<td align="center">'.$langs->trans("BankAccountNumberKey").'</td>';
print '</tr>';
print '<tr><td>&nbsp;</td><td align="center">'.$account->code_banque.'</td>'; print '<tr><td>&nbsp;</td><td align="center">'.$account->code_banque.'</td>';
print '<td align="center">'.$account->code_guichet.'</td>'; print '<td align="center">'.$account->code_guichet.'</td>';
print '<td align="center">'.$account->number.'</td>'; print '<td align="center">'.$account->number.'</td>';
@ -121,15 +127,15 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>'; print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
print '<td colspan="4">'.$account->bic.'</td></tr>'; print '<td colspan="4">'.$account->bic.'</td></tr>';
print '<tr><td valign="top">Domiciliation</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print $account->domiciliation; print $account->domiciliation;
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td valign="top">Nom propriétaire du compte</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="4">';
print $account->proprio; print $account->proprio;
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td valign="top">Adresse propriétaire du compte</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
print $account->adresse_proprio; print $account->adresse_proprio;
print "</td></tr>\n"; print "</td></tr>\n";
@ -176,7 +182,10 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>'; print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
print '<td colspan="4"><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>'; print '<td colspan="4"><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td>Code Banque</td><td>Code Guichet</td><td>Numéro</td><td>Clé RIB</td></tr>'; print '<tr><td>'.$langs->trans("RIB").'</td><td>'.$langs->trans("BankCode").'</td>';
print '<td>'.$langs->trans("DeskCode").'</td>';
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
print '<td>'.$langs->trans("BankAccountNumberKey").'</td></tr>';
print '<tr><td>&nbsp;</td><td><input size="8" type="text" name="code_banque" value="'.$account->code_banque.'"></td>'; print '<tr><td>&nbsp;</td><td><input size="8" type="text" name="code_banque" value="'.$account->code_banque.'"></td>';
print '<td><input size="8" type="text" name="code_guichet" value="'.$account->code_guichet.'"></td>'; print '<td><input size="8" type="text" name="code_guichet" value="'.$account->code_guichet.'"></td>';
print '<td><input size="15" type="text" name="number" value="'.$account->number.'"></td>'; print '<td><input size="15" type="text" name="number" value="'.$account->number.'"></td>';
@ -188,16 +197,16 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>'; print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>'; print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td valign="top">Domiciliation</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">"; print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
print $account->domiciliation; print $account->domiciliation;
print "</textarea></td></tr>"; print "</textarea></td></tr>";
print '<tr><td valign="top">Nom propriétaire du compte</td>'; print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>'; print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td valign="top">Adresse propriétaire du compte</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
print "<textarea name=\"adresse_proprio\" rows=\"4\" cols=\"40\">"; print "<textarea name=\"adresse_proprio\" rows=\"4\" cols=\"40\">";
print $account->adresse_proprio; print $account->adresse_proprio;
print "</textarea></td></tr>"; print "</textarea></td></tr>";