Maxi debug of withdraw module
This commit is contained in:
parent
afd8068d0a
commit
b86223bc90
@ -507,7 +507,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_add_spip' &&
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
@ -1820,7 +1820,8 @@ if ($_GET['action'] == 'create')
|
||||
else
|
||||
{
|
||||
$id = $_GET['facid'];
|
||||
if ($id > 0)
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
@ -1832,7 +1833,7 @@ else
|
||||
$facstatic = new Facture($db);
|
||||
|
||||
$fac = new Facture($db);
|
||||
$result=$fac->fetch($_GET['facid']);
|
||||
$result=$fac->fetch($_GET['facid'],$_GET['ref']);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0);
|
||||
@ -2026,17 +2027,19 @@ else
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="5">'.$fac->ref;
|
||||
print '<td colspan="5">';
|
||||
$morehtmlref='';
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$result=$discount->fetch(0,$fac->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
print ' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
|
||||
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dolibarr_print_error('',$discount->error);
|
||||
}
|
||||
print $html->showrefnav($fac,'ref','',1,'facnumber','ref',$morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,73 +16,74 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/facture/prelevement.php
|
||||
\ingroup facture
|
||||
\brief Gestion des prelevement d'une facture
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/compta/facture/prelevement.php
|
||||
* \ingroup facture
|
||||
* \brief Gestion des prelevement d'une facture
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
if (!$user->rights->facture->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("banks");
|
||||
$langs->load("withdrawals");
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($_GET["action"] == "new")
|
||||
{
|
||||
$fact = new Facture($db);
|
||||
if ($fact->fetch($_GET["facid"]))
|
||||
{
|
||||
$result = $fact->demande_prelevement($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: prelevement.php?facid=".$fact->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$fact->error.'</div>';
|
||||
}
|
||||
}
|
||||
$fact = new Facture($db);
|
||||
if ($fact->fetch($_GET["facid"]))
|
||||
{
|
||||
$result = $fact->demande_prelevement($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: prelevement.php?facid=".$fact->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$fact->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == "delete")
|
||||
{
|
||||
$fact = new Facture($db);
|
||||
if ($fact->fetch($_GET["facid"]))
|
||||
{
|
||||
$result = $fact->demande_prelevement_delete($user,$_GET["did"]);
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: prelevement.php?facid=".$fact->id);
|
||||
}
|
||||
}
|
||||
$fact = new Facture($db);
|
||||
if ($fact->fetch($_GET["facid"]))
|
||||
{
|
||||
$result = $fact->demande_prelevement_delete($user,$_GET["did"]);
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: prelevement.php?facid=".$fact->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("Bill"));
|
||||
|
||||
@ -96,210 +97,210 @@ $html = new Form($db);
|
||||
|
||||
if ($_GET["facid"] > 0)
|
||||
{
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$soc = new Societe($db, $fac->socid);
|
||||
$soc->fetch($fac->socid);
|
||||
$soc = new Societe($db, $fac->socid);
|
||||
$soc->fetch($fac->socid);
|
||||
|
||||
$author = new User($db);
|
||||
if ($fac->user_author)
|
||||
{
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
}
|
||||
$author = new User($db);
|
||||
if ($fac->user_author)
|
||||
{
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
}
|
||||
|
||||
$head = facture_prepare_head($fac);
|
||||
dolibarr_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'));
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference du facture
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $fac->ref;
|
||||
print "</td></tr>";
|
||||
|
||||
// Societe
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
print '</tr>';
|
||||
// Societe
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dolibarr_print_date($fac->date,"daytext").'</td>';
|
||||
print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"daytext");
|
||||
if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dolibarr_print_date($fac->date,"daytext").'</td>';
|
||||
print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"daytext");
|
||||
if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">';
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none");
|
||||
print '</td></tr>';
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">';
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->mode_reglement_id,"none");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="2"> </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="2"> </td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</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"> </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</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"> </td></tr>';
|
||||
|
||||
print '<tr><td>RIB</td><td colspan="5">';
|
||||
print $soc->display_rib();
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="5">';
|
||||
print $soc->display_rib();
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Demande de prélèvement
|
||||
*
|
||||
*/
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.amount";
|
||||
$sql .= " , u.rowid as user_id, u.name, u.firstname, u.login";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
/*
|
||||
* Demande de prélèvement
|
||||
*
|
||||
*/
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
if ($result_sql)
|
||||
{
|
||||
$num = $db->num_rows($result_sql);
|
||||
}
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.amount";
|
||||
$sql .= " , u.rowid as user_id, u.name, u.firstname, u.login";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
if ($result_sql)
|
||||
{
|
||||
$num = $db->num_rows($result_sql);
|
||||
}
|
||||
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
// Valider
|
||||
if ($fac->statut > 0 && $fac->paye == 0 && $fac->mode_reglement_code == 'PRE' && $num == 0)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="prelevement.php?facid='.$fac->id.'&action=new">Faire une demande de prélèvement</a>';
|
||||
}
|
||||
}
|
||||
print "</div><br/>";
|
||||
// Add a withdraw request
|
||||
if ($fac->statut > 0 && $fac->paye == 0 && $fac->mode_reglement_code == 'PRE' && $num == 0)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="prelevement.php?facid='.$fac->id.'&action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
print "</div><br/>";
|
||||
|
||||
|
||||
/*
|
||||
* Prélèvement
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="center">'.$langs->trans("DateRequest").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td><td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
$var=True;
|
||||
/*
|
||||
* Prélèvement
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
if ($result_sql)
|
||||
{
|
||||
$i = 0;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$langs->trans("DateRequest").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td><td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
$var=!$var;
|
||||
if ($result_sql)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="center">'.dolibarr_print_date($obj->date_demande)."</td>\n";
|
||||
print '<td align="center">En attente de traitement</td>';
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">-</td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print '<a href="prelevement.php?facid='.$fac->id.'&action=delete&did='.$obj->rowid.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
$var=!$var;
|
||||
|
||||
$db->free($result_sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "<tr $bc[$var]>";
|
||||
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">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">-</td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print '<a href="prelevement.php?facid='.$fac->id.'&action=delete&did='.$obj->rowid.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.fk_prelevement_bons, pfd.amount";
|
||||
$sql .= " , u.rowid as user_id, u.name, u.firstname, u.login";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 1";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
$db->free($result_sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande";
|
||||
$sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite";
|
||||
$sql .= " , pfd.fk_prelevement_bons, pfd.amount";
|
||||
$sql .= " , u.rowid as user_id, u.name, u.firstname, u.login";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$fac->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 1";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print '<td align="center">'.dolibarr_print_date($obj->date_demande)."</td>\n";
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td align="center">'.dolibarr_print_date($obj->date_traite)."</td>\n";
|
||||
print '<td align="center">'.dolibarr_print_date($obj->date_demande)."</td>\n";
|
||||
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($obj->date_traite)."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$obj->fk_prelevement_bons;
|
||||
print '">'.$obj->fk_prelevement_bons."</a></td>\n";
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$obj->fk_prelevement_bons;
|
||||
print '">'.$obj->fk_prelevement_bons."</a></td>\n";
|
||||
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Facture non trouvée */
|
||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Facture non trouvée */
|
||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -26,11 +26,16 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
|
||||
|
||||
require_once (DOL_DOCUMENT_ROOT."/facture.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;
|
||||
|
||||
@ -43,6 +48,7 @@ class BonPrelevement
|
||||
var $total;
|
||||
var $_fetched;
|
||||
|
||||
|
||||
function BonPrelevement($DB, $filename='')
|
||||
{
|
||||
$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 .= ",".$this->db->pdate("p.datec")." as dc";
|
||||
@ -205,9 +211,9 @@ class BonPrelevement
|
||||
$sql .= " , fk_user_credit";
|
||||
$sql .= " , statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
|
||||
$sql .= " WHERE p.rowid=".$rowid;
|
||||
|
||||
dolibarr_syslog("Bon-prelevement::fetch sql=".$sql, LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
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 agence agence
|
||||
* \return int <O si erreur, sinon nbre de factures
|
||||
*/
|
||||
function NbFactureAPrelever($banque=0,$agence=0)
|
||||
{
|
||||
$sql = "SELECT count(f.total_ttc)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe_rib as sr";
|
||||
|
||||
$sql = "SELECT count(f.rowid)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
if ($banque == 1 || $agence == 1) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
$sql .= " AND f.rowid = pfd.fk_facture";
|
||||
$sql .= " AND f.fk_soc = sr.fk_soc";
|
||||
$sql .= " AND f.paye = 0";
|
||||
$sql .= " AND pfd.traite = 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)
|
||||
{
|
||||
$sql .= " AND sr.code_banque = '".PRELEVEMENT_CODE_BANQUE."'";
|
||||
@ -643,17 +646,18 @@ class BonPrelevement
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Cree prelevement
|
||||
* \return int <0 si ko, nbre de facture pr<EFBFBD>lev<EFBFBD> sinon
|
||||
* \brief Create a withdraw
|
||||
* \return int <0 if KO, nbre of invoice withdrawed if OK
|
||||
*/
|
||||
function Create($banque=0, $guichet=0)
|
||||
{
|
||||
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."/societe.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
@ -665,7 +669,7 @@ class BonPrelevement
|
||||
$month = strftime("%m", $datetimeprev);
|
||||
$year = strftime("%Y", $datetimeprev);
|
||||
|
||||
$user = new user($this->db, PRELEVEMENT_USER);
|
||||
$user = new User($this->db, $conf->global->PRELEVEMENT_USER);
|
||||
|
||||
/**
|
||||
* Lectures des factures
|
||||
@ -676,7 +680,6 @@ class BonPrelevement
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
$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.amount";
|
||||
@ -684,17 +687,14 @@ class BonPrelevement
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||
$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 .= " 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.paye = 0";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
$sql .= " AND f.fk_mode_reglement = 3"; // Mode pr<70>l<EFBFBD>vement
|
||||
|
||||
if ($banque == 1)
|
||||
{
|
||||
$sql .= " AND sr.code_banque = '".PRELEVEMENT_CODE_BANQUE."'";
|
||||
@ -704,8 +704,8 @@ class BonPrelevement
|
||||
$sql .= " AND sr.code_guichet = '".PRELEVEMENT_CODE_GUICHET."'";
|
||||
}
|
||||
|
||||
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -718,7 +718,7 @@ class BonPrelevement
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
dolibarr_syslog("$i factures <20> pr<70>lever");
|
||||
dolibarr_syslog($i." invoices to withdraw");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -728,20 +728,11 @@ class BonPrelevement
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Verif des clients
|
||||
*
|
||||
*/
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
/*
|
||||
* V<EFBFBD>rification des RIB
|
||||
*
|
||||
*/
|
||||
$i = 0;
|
||||
dolibarr_syslog("D<EFBFBD>but v<>rification des RIB");
|
||||
// Check RIB
|
||||
$i = 0;
|
||||
dolibarr_syslog("Start RIB check");
|
||||
|
||||
if (sizeof($factures) > 0)
|
||||
{
|
||||
@ -763,18 +754,18 @@ class BonPrelevement
|
||||
}
|
||||
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";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Impossible de lire la soci<63>t<EFBFBD>");
|
||||
dolibarr_syslog("Failed to read company", LOG_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Impossible de lire la facture");
|
||||
dolibarr_syslog("Impossible de lire la facture", LOG_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -785,12 +776,8 @@ class BonPrelevement
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
dolibarr_syslog(sizeof($factures_prev)." factures seront pr<70>lev<65>es");
|
||||
// Withdraw invoices in factures_prev array
|
||||
dolibarr_syslog(sizeof($factures_prev)." invoices will be withdrawed");
|
||||
|
||||
if (sizeof($factures_prev) > 0)
|
||||
{
|
||||
@ -815,6 +802,7 @@ class BonPrelevement
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql .= " WHERE ref LIKE '$ref%'";
|
||||
|
||||
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
@ -831,14 +819,11 @@ class BonPrelevement
|
||||
|
||||
$filebonprev = $ref;
|
||||
|
||||
/*
|
||||
* Creation du bon de prelevement
|
||||
*
|
||||
*/
|
||||
|
||||
// Create withdraw receipt in database
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (ref,datec)";
|
||||
$sql .= " VALUES ('".$ref."',".$this->db->idate(mktime()).")";
|
||||
|
||||
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
@ -855,7 +840,7 @@ class BonPrelevement
|
||||
else
|
||||
{
|
||||
$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)
|
||||
{
|
||||
dolibarr_syslog("D<EFBFBD>but g<>n<EFBFBD>ration des paiements");
|
||||
dolibarr_syslog("Nombre de factures ".sizeof($factures_prev));
|
||||
dolibarr_syslog("Start generation payments for the ".sizeof($factures_prev)." invoices");
|
||||
|
||||
if (sizeof($factures_prev) > 0)
|
||||
{
|
||||
foreach ($factures_prev as $fac)
|
||||
{
|
||||
// Fetch invoice
|
||||
$fact = new Facture($this->db);
|
||||
$fact->fetch($fac[0]);
|
||||
|
||||
// Create payment
|
||||
$pai = new Paiement($this->db);
|
||||
|
||||
$pai->amounts = array();
|
||||
$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->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++;
|
||||
dolibarr_syslog("Erreur creation paiement facture ".$fac[0]);
|
||||
@ -925,6 +911,7 @@ class BonPrelevement
|
||||
$sql .= ", fk_prelevement_bons = ".$prev_id;
|
||||
$sql .= " WHERE rowid=".$fac[1];
|
||||
|
||||
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
@ -984,11 +971,12 @@ class BonPrelevement
|
||||
$sql .= " SET amount = ".price2num($bonprev->total);
|
||||
$sql .= " WHERE rowid = ".$prev_id;
|
||||
|
||||
dolibarr_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$this->db->commit();
|
||||
dolibarr_syslog("COMMIT");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("ROLLBACK");
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_notifications ";
|
||||
$sql .= " WHERE rowid = '".$rowid."';";
|
||||
$sql .= " WHERE rowid = '".$rowid."'";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -1044,7 +1058,7 @@ class BonPrelevement
|
||||
$result = 0;
|
||||
|
||||
$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))
|
||||
{
|
||||
@ -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()
|
||||
|
||||
@ -15,17 +15,13 @@
|
||||
* 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$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/bon.php
|
||||
\ingroup prelevement
|
||||
\brief Fiche aperçu du bon de prelevement
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -146,5 +142,5 @@ if ($_GET["id"])
|
||||
|
||||
print "</div>";
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -15,16 +15,13 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/bons.php
|
||||
\ingroup prelevement
|
||||
\brief Page liste des bons de prelevements
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
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="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -184,94 +184,98 @@ print '<br>';
|
||||
* TODO Use notification module instead
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("Notifications"));
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=addnotif">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30%">Nom</td>';
|
||||
print '<td width="40%">Valeur</td>';
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
print '<td width="30%">Action</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
if ($conf->global->MAIN_MODULE_NOTIFICATION)
|
||||
{
|
||||
print '<tr class="impair"><td align="left">';
|
||||
print '<input type="hidden" name="nom6" value="PRELEVEMENT_USER">';
|
||||
print '<select name="user">';
|
||||
$sql = "SELECT rowid, name, firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " ORDER BY name ASC";
|
||||
|
||||
if ($db->query($sql))
|
||||
|
||||
print_titre($langs->trans("Notifications"));
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=addnotif">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30%">Nom</td>';
|
||||
print '<td width="40%">Valeur</td>';
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
print '<td width="30%">Action</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
print '<tr class="impair"><td align="left">';
|
||||
print '<input type="hidden" name="nom6" value="PRELEVEMENT_USER">';
|
||||
print '<select name="user">';
|
||||
$sql = "SELECT rowid, name, firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " ORDER BY name ASC";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
print '<option value="'.$obj->rowid.'">'.$obj->firstname." ".$obj->name;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
print '</select></td>';
|
||||
|
||||
print '<td align="left">';
|
||||
print '<select name="action">';
|
||||
|
||||
print '<option value="tr">Transmission du bon</option>';
|
||||
print '<option value="em">Emission du bon</option>';
|
||||
print '<option value="cr">Credit du bon</option>';
|
||||
print '</select></td>';
|
||||
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT u.name, u.firstname, pn.action, pn.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_notifications as pn";
|
||||
$sql .= " WHERE u.rowid = pn.fk_user";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
print '<option value="'.$obj->rowid.'">'.$obj->firstname." ".$obj->name;
|
||||
$i++;
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>'.$obj->firstname." ".$obj->name.'</td>';
|
||||
print '<td>'.$obj->action.'</td>';
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
{
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&notif='.$obj->rowid.'">'.img_delete().'</a></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
print '</select></td>';
|
||||
|
||||
print '<td align="left">';
|
||||
print '<select name="action">';
|
||||
|
||||
print '<option value="tr">Transmission du bon</option>';
|
||||
print '<option value="em">Emission du bon</option>';
|
||||
print '<option value="cr">Credit du bon</option>';
|
||||
print '</select></td>';
|
||||
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT u.name, u.firstname, pn.action, pn.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_notifications as pn";
|
||||
$sql .= " WHERE u.rowid = pn.fk_user";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>'.$obj->firstname." ".$obj->name.'</td>';
|
||||
print '<td>'.$obj->action.'</td>';
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
{
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&notif='.$obj->rowid.'">'.img_delete().'</a></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
if ($user->rights->prelevement->bons->configurer)
|
||||
print '</form>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/create.php
|
||||
\brief Prelevement
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/compta/prelevement/create.php
|
||||
\brief Prelevement
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.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("companies");
|
||||
@ -32,7 +34,7 @@ $langs->load("bills");
|
||||
|
||||
|
||||
if (!$user->rights->prelevement->bons->creer)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
@ -41,16 +43,16 @@ if (!$user->rights->prelevement->bons->creer)
|
||||
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
$bprev = new BonPrelevement($db);
|
||||
$result=$bprev->create($_GET["banque"],$_GET["guichet"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$bprev->error.'</div>';
|
||||
}
|
||||
if ($result == 0)
|
||||
{
|
||||
$mesg='<div class="error">Aucune facture prélevable, prélevé avec succès</div>';
|
||||
}
|
||||
$bprev = new BonPrelevement($db);
|
||||
$result=$bprev->create($_GET["banque"],$_GET["guichet"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$bprev->error.'</div>';
|
||||
}
|
||||
if ($result == 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("NoInvoiceCouldBeWithdrawed").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +60,10 @@ if ($_GET["action"] == 'create')
|
||||
* View
|
||||
*/
|
||||
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$invoicestatic=new Facture($db);
|
||||
$bprev = new BonPrelevement($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$h=0;
|
||||
@ -67,22 +73,24 @@ $h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("StandingOrders"));
|
||||
|
||||
$bprev = new BonPrelevement($db);
|
||||
|
||||
$nb=$bprev->NbFactureAPrelever();
|
||||
$nb1=$bprev->NbFactureAPrelever(1);
|
||||
$nb11=$bprev->NbFactureAPrelever(1,1);
|
||||
if ($nb < 0 || $nb1 < 0 || $nb11 < 0)
|
||||
{
|
||||
dolibarr_print_error($bprev->error);
|
||||
dolibarr_print_error($bprev->error);
|
||||
}
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
|
||||
print '<td align="right">';
|
||||
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 '</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 '</td></tr>';
|
||||
|
||||
@ -90,9 +98,9 @@ print '<tr><td>'.$langs->trans("AmountToWithdraw").'</td>';
|
||||
print '<td align="right">';
|
||||
print price($bprev->SommeAPrelever());
|
||||
print '</td>';
|
||||
print '<td colspan="4"> </td>';
|
||||
|
||||
print '</tr></table>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -100,17 +108,17 @@ if ($mesg) print $mesg;
|
||||
|
||||
if ($nb)
|
||||
{
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($nb) print '<a class="butAction" href="create.php?action=create">'.$langs->trans("Create")."</a>\n";
|
||||
if ($nb1) print '<a class="butAction" href="create.php?action=create&banque=1&guichet=1">'.$langs->trans("CreateGuichet")."</a>\n";
|
||||
if ($nb11) print '<a class="butAction" href="create.php?action=create&banque=1">'.$langs->trans("CreateBanque")."</a>\n";
|
||||
|
||||
print "</div>\n";
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($nb) print '<a class="butAction" href="create.php?action=create">'.$langs->trans("Create")."</a>\n";
|
||||
if ($nb1) print '<a class="butAction" href="create.php?action=create&banque=1&guichet=1">'.$langs->trans("CreateGuichet")."</a>\n";
|
||||
if ($nb11) print '<a class="butAction" href="create.php?action=create&banque=1">'.$langs->trans("CreateBanque")."</a>\n";
|
||||
|
||||
print "</div>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoInvoiceToWithdraw").'<br>';
|
||||
print $langs->trans("NoInvoiceToWithdraw").'<br>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
@ -126,42 +134,44 @@ $sql.= ", p.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " ORDER BY datec DESC";
|
||||
$sql.=$db->plimit($limit);
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipts",$limit).'</td>';
|
||||
print '<td><Date</td><td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipts",$limit).'</td>';
|
||||
print '<td><Date</td><td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<img border="0" src="./statut'.$obj->statut.'.png"></a> ';
|
||||
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
print '<td align="center">'.dolibarr_print_date($obj->datec,'day')."</td>\n";
|
||||
print "<tr $bc[$var]><td>";
|
||||
$bprev->id=$obj->rowid;
|
||||
$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="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";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($result);
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
@ -178,39 +188,46 @@ $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $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>";
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
}
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("InvoiceWaitingWithdraw").' ('.$num.')</td></tr>';
|
||||
$var = True;
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$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++;
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -19,13 +19,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/demandes.php
|
||||
\brief Page de la liste des demandes de prélèvements
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/compta/prelevement/demandes.php
|
||||
\brief Page de la liste des demandes de prélèvements
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.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("companies");
|
||||
@ -36,11 +38,14 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'prelevement','','');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$invoicestatic=new Facture($db);
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortorder = $_GET["sortorder"];
|
||||
@ -73,79 +78,89 @@ if ($statut) $sql.= " AND pfd.traite = ".$statut;
|
||||
$sql.= " AND pfd.fk_facture = f.rowid";
|
||||
if (strlen(trim($_GET["search_societe"])))
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
|
||||
$sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
|
||||
}
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
}
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if (! $statut)
|
||||
{
|
||||
print_barre_liste($langs->trans("RequestStandingOrderToTreat"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
}
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
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" align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<form action="demandes.php" method="GET">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.$GET["search_facture"].'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.$GET["search_societe"].'"></td>';
|
||||
print '<td colspan="2" class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'"></td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
$var = True;
|
||||
|
||||
$users = array();
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref facture
|
||||
print '<td><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 '<td align="center">'.dolibarr_print_date($obj->date_demande).'</td>';
|
||||
|
||||
if (!array_key_exists($obj->fk_user_demande,$users))
|
||||
if (! $statut)
|
||||
{
|
||||
$users[$obj->fk_user_demande] = new User($db, $obj->fk_user_demande);
|
||||
$users[$obj->fk_user_demande]->fetch();
|
||||
print_barre_liste($langs->trans("RequestStandingOrderToTreat"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
}
|
||||
|
||||
// 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 '<table class="liste" width="100%">';
|
||||
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" align="center">'.$langs->trans("DateRequest").'</td>';
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table><br />";
|
||||
print '<form action="demandes.php" method="GET">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.$GET["search_facture"].'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.$GET["search_societe"].'"></td>';
|
||||
print '<td colspan="2" class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'"></td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
$var = True;
|
||||
|
||||
$users = array();
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref facture
|
||||
print '<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 '<td align="center">'.dolibarr_print_date($obj->date_demande,'day').'</td>';
|
||||
|
||||
if (!array_key_exists($obj->fk_user_demande,$users))
|
||||
{
|
||||
$users[$obj->fk_user_demande] = new User($db, $obj->fk_user_demande);
|
||||
$users[$obj->fk_user_demande]->fetch();
|
||||
}
|
||||
|
||||
// User
|
||||
print '<td align="center">';
|
||||
print $users[$obj->fk_user_demande]->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table><br />";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
@ -15,26 +15,25 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/factures.php
|
||||
\ingroup prelevement
|
||||
\brief Page liste des factures prélevées
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
llxHeader('','Bon de prélèvement');
|
||||
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
||||
|
||||
$h = 0;
|
||||
$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)
|
||||
{
|
||||
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 '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>';
|
||||
print '</table><br />';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -128,7 +129,7 @@ if ($result)
|
||||
|
||||
$urladd = "&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 '<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 '<td class="liste_titre" colspan="2"> </td></tr>';
|
||||
|
||||
$var=True;
|
||||
$var=false;
|
||||
|
||||
$total = 0;
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
|
||||
*/
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
llxHeader('','Bon de prélèvement - Rejet');
|
||||
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
||||
|
||||
$h = 0;
|
||||
$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 '<tr class="liste_titre">';
|
||||
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("Société","rejets.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre("Montant","rejets.php","f.total_ttc","",$urladd,'align="center"');
|
||||
print_liste_field_titre($langs->trans("Invoice"),"rejets.php","p.facnumber",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Amount"),"rejets.php","f.total_ttc","",$urladd,'align="center"');
|
||||
print '<td colspan="2"> </td></tr>';
|
||||
|
||||
$var=True;
|
||||
@ -156,5 +156,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -15,9 +15,10 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -27,7 +28,7 @@ require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
llxHeader('','Bon de prélèvement - Rejet');
|
||||
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
||||
|
||||
$h = 0;
|
||||
$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)
|
||||
{
|
||||
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 '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>';
|
||||
print '</table><br />';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -111,11 +114,11 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$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 '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
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;
|
||||
$total = 0;
|
||||
@ -144,8 +147,8 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print "<td>Total</td>\n";
|
||||
print '<tr class="liste_total"><td> </td>';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>\n";
|
||||
print '<td> </td>';
|
||||
print "</tr>\n</table>\n";
|
||||
|
||||
@ -15,9 +15,10 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -25,7 +26,12 @@ require("./pre.inc.php");
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
llxHeader('','Statistique Bon de prélèvement');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
||||
|
||||
$h = 0;
|
||||
$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)
|
||||
{
|
||||
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 '<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
|
||||
{
|
||||
@ -97,7 +105,7 @@ if ($prev_id)
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>Statut</td><td align="right">Montant</td><td align="right">%</td></tr>';
|
||||
|
||||
$var=True;
|
||||
$var=false;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -116,7 +124,8 @@ if ($prev_id)
|
||||
elseif ($row[1] == 1)
|
||||
{
|
||||
print 'En attente';
|
||||
}
|
||||
}
|
||||
else print 'Unknown';
|
||||
|
||||
print '</td><td align="right">';
|
||||
print price($row[0]);
|
||||
@ -142,5 +151,5 @@ if ($prev_id)
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -15,16 +15,13 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/fiche.php
|
||||
\ingroup prelevement
|
||||
\brief Fiche prelevement
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -33,12 +30,19 @@ if (!$user->rights->prelevement->bons->lire)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("withdrawals");
|
||||
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'confirm_credite' && $_POST["confirm"] == yes)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
@ -57,7 +61,7 @@ if ($_POST["action"] == 'infotrans')
|
||||
{
|
||||
$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"]);
|
||||
|
||||
@ -91,7 +95,7 @@ if ($_POST["action"] == 'infocredit')
|
||||
}
|
||||
}
|
||||
|
||||
llxHeader('','Bon de prélèvement');
|
||||
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
||||
|
||||
$h = 0;
|
||||
$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)
|
||||
{
|
||||
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"));
|
||||
|
||||
if (isset($_GET["error"]))
|
||||
{
|
||||
@ -149,7 +153,7 @@ if ($_GET["id"])
|
||||
|
||||
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("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
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 dolibarr_print_date($bon->date_trans,'dayhour');
|
||||
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 '</td></tr>';
|
||||
}
|
||||
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 '</td></tr>';
|
||||
}
|
||||
@ -193,10 +197,10 @@ if ($_GET["id"])
|
||||
print '<tr><td width="20%">Date Transmission</td><td>';
|
||||
print $html->select_date('','','','','',"userfile");
|
||||
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 '</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 class="flat" type="file" name="userfile" size="80"><br />';
|
||||
print '</td></tr>';
|
||||
@ -240,7 +244,7 @@ if ($_GET["action"] == '')
|
||||
|
||||
if ($bon->credite == 0)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?action=credite&id=$bon->id\">".$langs->trans("Classer crédité")."</a>";
|
||||
print "<a class=\"butAction\" href=\"fiche.php?action=credite&id=$bon->id\">".$langs->trans("ClassCredited")."</a>";
|
||||
}
|
||||
|
||||
|
||||
@ -250,5 +254,5 @@ if ($_GET["action"] == '')
|
||||
print "</div>";
|
||||
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -19,13 +19,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/index.php
|
||||
\brief Prelevement
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/compta/prelevement/index.php
|
||||
* \brief Prelevement
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.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");
|
||||
|
||||
@ -38,8 +40,7 @@ $result = restrictedArea($user, 'prelevement','','');
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
@ -51,7 +52,8 @@ print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$invoicestatic=new Facture($db);
|
||||
$bprev = new BonPrelevement($db);
|
||||
$var=true;
|
||||
|
||||
@ -68,60 +70,10 @@ print '<td align="right">';
|
||||
print price($bprev->SommeAPrelever());
|
||||
print '</td></tr></table><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Bon de prélèvement
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
|
||||
$sql .= " ,p.statut ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " ORDER BY datec DESC LIMIT 5";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("WithdrawalReceiptShort").'</td><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<img border="0" src="./statut'.$obj->statut.'.png"></a> ';
|
||||
|
||||
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td>'.dolibarr_print_date($obj->datec,"dayhour")."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
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";
|
||||
@ -130,47 +82,102 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFI
|
||||
$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)
|
||||
if ($socid) $sql .= " AND f.fk_soc = $socid";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
}
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
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)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("InvoiceWaitingWithdraw").' ('.$num.')</td></tr>';
|
||||
if ($num)
|
||||
{
|
||||
$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++;
|
||||
$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++;
|
||||
}
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="2">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Bon de prélèvement
|
||||
*
|
||||
*/
|
||||
$limit=5;
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
|
||||
$sql .= " ,p.statut ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " ORDER BY datec DESC LIMIT ".$limit;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
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 '</tr>';
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<img border="0" src="./statut'.$obj->statut.'.png"></a> ';
|
||||
|
||||
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td>'.dolibarr_print_date($obj->datec,"dayhour")."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
||||
@ -15,11 +15,11 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* \version $Id$
|
||||
*/
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
@ -27,59 +27,66 @@ require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
llxHeader('','Bon de prélèvement');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$h++;
|
||||
$h++;
|
||||
|
||||
if ($conf->use_preview_tabs)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$h++;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
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 />';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
}
|
||||
}
|
||||
|
||||
$page = $_GET["page"];
|
||||
@ -93,10 +100,10 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if ($sortorder == "") {
|
||||
$sortorder="DESC";
|
||||
$sortorder="DESC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield="pl.fk_soc";
|
||||
$sortfield="pl.fk_soc";
|
||||
}
|
||||
|
||||
/*
|
||||
@ -113,7 +120,7 @@ $sql .= " AND pl.fk_soc = s.rowid";
|
||||
|
||||
if ($_GET["socid"])
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$_GET["socid"];
|
||||
$sql .= " AND s.rowid = ".$_GET["socid"];
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
@ -122,76 +129,76 @@ $result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$urladd = "&id=".$_GET["id"];
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Lignes de prélèvement", $page, "lignes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Lignes","lignes.php","pl.rowid",'',$urladd);
|
||||
print_liste_field_titre("Société","lignes.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre("Montant","lignes.php","f.total_ttc","",$urladd,'align="center"');
|
||||
print '<td colspan="2"> </td></tr>';
|
||||
$urladd = "&id=".$_GET["id"];
|
||||
|
||||
$var=True;
|
||||
print_barre_liste("", $page, "lignes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Lines"),"lignes.php","pl.rowid",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),"lignes.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Amount"),"lignes.php","f.total_ttc","",$urladd,'align="center"');
|
||||
print '<td colspan="2"> </td></tr>';
|
||||
|
||||
$total = 0;
|
||||
$var=false;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$total = 0;
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<img border="0" src="./statut'.$obj->statut.'.png"></a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print substr('000000'.$obj->rowid, -6);
|
||||
print '</a></td>';
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
|
||||
|
||||
print '<td align="center">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print '<td>';
|
||||
|
||||
if ($obj->statut == 3)
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
print '<b>Rejeté</b>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<img border="0" src="./statut'.$obj->statut.'.png"></a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print substr('000000'.$obj->rowid, -6);
|
||||
print '</a></td>';
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
|
||||
|
||||
print '<td align="center">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print '<td>';
|
||||
|
||||
if ($obj->statut == 3)
|
||||
{
|
||||
print '<b>Rejeté</b>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
$total += $obj->total_ttc;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
if($_GET["socid"])
|
||||
{
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
$total += $obj->total_ttc;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
print '<td>Total</td>';
|
||||
|
||||
if($_GET["socid"])
|
||||
{
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<td align="center">'.price($total)."</td>\n";
|
||||
|
||||
print '<td>Total</td>';
|
||||
print '<td> </td>';
|
||||
|
||||
print '<td align="center">'.price($total)."</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<td> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -105,7 +105,7 @@ if ($result)
|
||||
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("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 '<td class="liste_titre"> </td>';
|
||||
print '</tr>';
|
||||
@ -140,9 +140,9 @@ if ($result)
|
||||
print '<td><img border="0" src="./statut'.$obj->statut.'.png"></a> ';
|
||||
|
||||
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 align="center">'.dolibarr_print_date($obj->datec)."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</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,'day')."</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> </td>';
|
||||
|
||||
|
||||
@ -337,10 +337,10 @@ class Facture extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Create a new invoice in database from current invoice
|
||||
\param user Object user that ask creation
|
||||
\param invertdetail Reverse sign of amounts for lines
|
||||
\return int <0 si ko, >0 si ok
|
||||
\brief Create a new invoice in database from current invoice
|
||||
\param user Object user that ask creation
|
||||
\param invertdetail Reverse sign of amounts for lines
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create_clone($user,$invertdetail=0)
|
||||
{
|
||||
@ -388,7 +388,7 @@ class Facture extends CommonObject
|
||||
/**
|
||||
* \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 option Sur quoi pointe le lien
|
||||
* \param option Sur quoi pointe le lien ('', 'withdraw')
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
@ -397,8 +397,16 @@ class Facture extends CommonObject
|
||||
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
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.'">';
|
||||
$lienfin='</a>';
|
||||
}
|
||||
|
||||
$picto='bill';
|
||||
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
|
||||
\param rowid id de la facture a récupérer
|
||||
\param societe_id id de societe
|
||||
\return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function fetch($rowid, $societe_id=0)
|
||||
* \brief Recupére l'objet facture et ses lignes de factures
|
||||
* \param rowid id de la facture a récupérer
|
||||
* \param ref Ref of invoice
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
dolibarr_syslog("Facture::Fetch rowid=".$rowid.", societe_id=".$societe_id, LOG_DEBUG);
|
||||
|
||||
$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 = '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.= ','.$this->db->pdate('f.datef').' as df';
|
||||
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
|
||||
$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.'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.= ' WHERE f.rowid='.$rowid;
|
||||
if ($societe_id > 0)
|
||||
{
|
||||
$sql.= ' AND f.fk_soc = '.$societe_id;
|
||||
}
|
||||
$result = $this->db->query($sql);
|
||||
if ($ref) $sql.= " WHERE f.facnumber='".$ref."'";
|
||||
else $sql.= " WHERE f.rowid=".$rowid;
|
||||
|
||||
dolibarr_syslog("Facture::Fetch sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->facnumber;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->type = $obj->type;
|
||||
@ -927,7 +931,7 @@ class Facture extends CommonObject
|
||||
$sql.= ' SET paye=0, fk_statut=1, close_code=null, close_note=null';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
|
||||
dolibarr_syslog("Facture::set_unpayed sql=".$sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1094,7 +1098,7 @@ class Facture extends CommonObject
|
||||
$sql.= ', date_lim_reglement='.$this->db->idate($datelim);
|
||||
}
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
|
||||
dolibarr_syslog("Facture::set_valid() sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1171,7 +1175,7 @@ class Facture extends CommonObject
|
||||
$result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -1180,7 +1184,7 @@ class Facture extends CommonObject
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1303,7 +1307,7 @@ class Facture extends CommonObject
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
@ -2229,42 +2233,42 @@ class Facture extends CommonObject
|
||||
$sql .= ' WHERE fk_facture='.$this->id;
|
||||
$sql .= ' AND traite = 0';
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
$row = $this->db->fetch_row();
|
||||
if ($row[0] == 0)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
||||
$sql .= ' VALUES ('.$this->id;
|
||||
$sql .= ",'".price2num($this->total_ttc)."'";
|
||||
$sql .= ",".$this->db->idate(mktime()).",".$user->id;
|
||||
$sql .= ",'".$soc->bank_account->code_banque."'";
|
||||
$sql .= ",'".$soc->bank_account->code_guichet."'";
|
||||
$sql .= ",'".$soc->bank_account->number."'";
|
||||
$sql .= ",'".$soc->bank_account->cle_rib."')";
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog('Facture::DemandePrelevement Erreur');
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Une demande existe déjà";
|
||||
dolibarr_syslog('Facture::DemandePrelevement Impossible de créer une demande, demande déja en cours');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog('Facture::DemandePrelevement Erreur -2');
|
||||
return -2;
|
||||
}
|
||||
{
|
||||
$row = $this->db->fetch_row();
|
||||
if ($row[0] == 0)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
||||
$sql .= ' VALUES ('.$this->id;
|
||||
$sql .= ",'".price2num($this->total_ttc)."'";
|
||||
$sql .= ",".$this->db->idate(mktime()).",".$user->id;
|
||||
$sql .= ",'".$soc->bank_account->code_banque."'";
|
||||
$sql .= ",'".$soc->bank_account->code_guichet."'";
|
||||
$sql .= ",'".$soc->bank_account->number."'";
|
||||
$sql .= ",'".$soc->bank_account->cle_rib."')";
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog('Facture::DemandePrelevement Erreur');
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Une demande existe déjà";
|
||||
dolibarr_syslog('Facture::DemandePrelevement Impossible de créer une demande, demande déja en cours');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog('Facture::DemandePrelevement Erreur -2');
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2990,12 +2990,13 @@ class Form
|
||||
* \param object Object to show
|
||||
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
|
||||
* \param morehtml Code html supplementaire a afficher avant barre nav
|
||||
* \param shownav Show Condition
|
||||
* \param fieldid Nom du champ id a utiliser pour select next et previous
|
||||
* \param fieldref Nom du champ ref a utiliser pour select next et previous
|
||||
* \param shownav Show Condition
|
||||
* \param fieldid Nom du champ en base 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
|
||||
*/
|
||||
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref')
|
||||
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='')
|
||||
{
|
||||
$ret='';
|
||||
|
||||
@ -3009,7 +3010,10 @@ class Form
|
||||
}
|
||||
|
||||
$ret.=$object->$fieldref;
|
||||
|
||||
if ($morehtmlref) {
|
||||
$ret.=' '.$morehtmlref;
|
||||
}
|
||||
|
||||
if ($morehtml) {
|
||||
$ret.='</td><td class="nobordernopadding" align="right">'.$morehtml;
|
||||
}
|
||||
|
||||
@ -15,13 +15,12 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\defgroup notification Module notification
|
||||
\brief Module pour g<EFBFBD>rer les notifications (par mail ou autre)
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -43,6 +43,7 @@ IOMonthlyReporting=Monthly reporting
|
||||
BankAccountDomiciliation=Account address
|
||||
BankAccountOwner=Account owner name
|
||||
BankAccountOwnerAddress=Account owner address
|
||||
RIBControlError=Control of key says informations for this account number are not complete or wrong.
|
||||
CreateAccount=Create account
|
||||
StandingOrderToProcess=To process
|
||||
StandingOrderProcessed=Processed
|
||||
|
||||
@ -16,11 +16,18 @@ RequestStandingOrderToTreat=Request for standing orders to treat
|
||||
RequestStandingOrderTreated=Request for standing orders treated
|
||||
CustomersStandingOrders=Customer standing orders
|
||||
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
|
||||
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
|
||||
WithdrawalsSetup=Withdrawal setup
|
||||
WithdrawStatistics=Withdraws' 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é
|
||||
@ -43,6 +43,7 @@ IOMonthlyReporting=Rapport mensuel E/S
|
||||
BankAccountDomiciliation=Domiciliation du compte
|
||||
BankAccountOwner=Nom 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
|
||||
StandingOrderToProcess=À traiter
|
||||
StandingOrderProcessed=Traités
|
||||
|
||||
@ -16,11 +16,18 @@ RequestStandingOrderToTreat=Demandes de pr
|
||||
RequestStandingOrderTreated=Demandes de prélèvements traitées
|
||||
CustomersStandingOrders=Prélèvements clients
|
||||
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
|
||||
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
|
||||
WithdrawalsSetup=Configuration des prélèvements
|
||||
WithdrawStatistics=Statistiques des 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é
|
||||
@ -101,7 +101,7 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
{
|
||||
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%">';
|
||||
@ -109,7 +109,13 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
|
||||
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> </td><td align="center">'.$account->code_banque.'</td>';
|
||||
print '<td align="center">'.$account->code_guichet.'</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 '<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 "</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 "</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 "</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 '<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> </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="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 '<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 $account->domiciliation;
|
||||
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></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 $account->adresse_proprio;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user