Qual: Uniformize withdrawals code
This commit is contained in:
parent
a59deddb0f
commit
eb55db74c0
@ -1,6 +1,7 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -25,12 +26,12 @@
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php");
|
||||
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php";
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("categories");
|
||||
|
||||
|
||||
/*
|
||||
* Securite acces client
|
||||
*/
|
||||
@ -39,107 +40,75 @@ if (!$user->rights->prelevement->bons->lire) accessforbidden();
|
||||
|
||||
llxHeader('','Bon de prelevement');
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$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");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejets");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
dol_fiche_head($head, $hselected, 'Prelevement : '. $bon->ref);
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'preview', 'Prelevement : '. $bon->ref);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</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>';
|
||||
|
||||
$relativepath = 'bon/'.$bon->ref;
|
||||
$relativepath = 'bon/'.$bon->ref;
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$bon->ref.'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$bon->ref.'</a>';
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table><br>';
|
||||
print '</td></tr>';
|
||||
print '</table><br>';
|
||||
|
||||
$fileimage = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps.png.0';
|
||||
$fileps = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps';
|
||||
$fileimage = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps.png.0';
|
||||
$fileps = $conf->prelevement->dir_output.'/receipts/'.$bon->ref.'.ps';
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if (!file_exists($fileimage))
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if (!file_exists($fileimage))
|
||||
{
|
||||
print $fileimage;
|
||||
if (function_exists(imagick_readimage))
|
||||
{
|
||||
print $fileimage;
|
||||
if (function_exists(imagick_readimage))
|
||||
{
|
||||
|
||||
$handle = imagick_readimage( $fileps ) ;
|
||||
$handle = imagick_readimage( $fileps ) ;
|
||||
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
imagick_convert( $handle, "PNG" ) ;
|
||||
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
imagick_writeimage( $handle, $fileps .".png");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Les fonctions <i>imagick</i> ne sont pas disponibles sur ce PHP";
|
||||
}
|
||||
}
|
||||
|
||||
imagick_convert( $handle, "PNG" ) ;
|
||||
|
||||
if ( imagick_iserror( $handle ) )
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=prelevement&file='.urlencode(basename($fileimage)).'">';
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
|
||||
imagick_writeimage( $handle, $fileps .".png");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Les fonctions <i>imagick</i> ne sont pas disponibles sur ce PHP";
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=prelevement&file='.urlencode(basename($fileimage)).'">';
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -26,6 +27,7 @@
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/rejet-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
|
||||
@ -38,55 +40,24 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
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++;
|
||||
|
||||
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/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$prev_id = $_GET["id"];
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,83 +92,83 @@ $result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$urladd = "&id=".$_GET["id"];
|
||||
$urladd = "&id=".$_GET["id"];
|
||||
|
||||
print_barre_liste("", $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%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),"factures.php","s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" colspan="2"> </td></tr>';
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),"factures.php","s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" colspan="2"> </td></tr>';
|
||||
|
||||
$var=false;
|
||||
$var=false;
|
||||
|
||||
$total = 0;
|
||||
$total = 0;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">';
|
||||
print img_object($langs->trans("ShowBill"),"bill");
|
||||
print '</a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">';
|
||||
print img_object($langs->trans("ShowBill"),"bill");
|
||||
print '</a> ';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->socid.'">';
|
||||
print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."</a></td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->socid.'">';
|
||||
print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."</a></td>\n";
|
||||
|
||||
print '<td align="center">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td align="center">'.price($obj->total_ttc)."</td>\n";
|
||||
|
||||
print '<td>';
|
||||
print '<td>';
|
||||
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
print '-';
|
||||
}
|
||||
elseif ($obj->statut == 1)
|
||||
{
|
||||
print 'Credite';
|
||||
}
|
||||
elseif ($obj->statut == 2)
|
||||
{
|
||||
print '<b>Rejete</b>';
|
||||
}
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
print '-';
|
||||
}
|
||||
elseif ($obj->statut == 1)
|
||||
{
|
||||
print 'Credite';
|
||||
}
|
||||
elseif ($obj->statut == 2)
|
||||
{
|
||||
print '<b>Rejete</b>';
|
||||
}
|
||||
|
||||
print "</td></tr>\n";
|
||||
print "</td></tr>\n";
|
||||
|
||||
$total += $obj->total_ttc;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if($_GET["socid"])
|
||||
if($_GET["socid"])
|
||||
{
|
||||
print "<tr $bc[$var]><td>";
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<td>Total</td>';
|
||||
print '<td>Total</td>';
|
||||
|
||||
print '<td align="center">'.price($total)."</td>\n";
|
||||
print '<td align="center">'.price($total)."</td>\n";
|
||||
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -25,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/rejet-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
|
||||
@ -39,59 +41,32 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
*/
|
||||
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++;
|
||||
|
||||
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/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$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)
|
||||
{
|
||||
dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
print "Erreur";
|
||||
}
|
||||
}
|
||||
|
||||
$page = $_GET["page"];
|
||||
$rej = new RejetPrelevement($db, $user);
|
||||
|
||||
/*
|
||||
* Liste des factures
|
||||
*
|
||||
@ -116,52 +91,52 @@ $sql.= " ORDER BY pl.amount DESC";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
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>';
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
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;
|
||||
|
||||
while ($i < $num)
|
||||
$var=True;
|
||||
$total = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<img border="0" src="./img/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 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="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
|
||||
print '<td align="center">'.yn($obj->afacturer).'</td>';
|
||||
print '<td align="center">'.$obj->fk_facture.'</td>';
|
||||
print "</tr>\n";
|
||||
print '<td align="center">'.yn($obj->afacturer).'</td>';
|
||||
print '<td align="center">'.$obj->fk_facture.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$total += $obj->amount;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
$total += $obj->amount;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
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";
|
||||
$db->free($resql);
|
||||
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";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php");
|
||||
|
||||
// Security check
|
||||
@ -40,35 +41,6 @@ $langs->load("categories");
|
||||
|
||||
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++;
|
||||
|
||||
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/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
if ($prev_id)
|
||||
@ -77,7 +49,8 @@ if ($prev_id)
|
||||
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php");
|
||||
|
||||
if (!$user->rights->prelevement->bons->lire)
|
||||
@ -108,37 +109,6 @@ if (GETPOST("action") == 'infocredit')
|
||||
|
||||
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");
|
||||
$hselected = $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/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
if ($_GET["id"])
|
||||
@ -147,7 +117,8 @@ if ($_GET["id"])
|
||||
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
|
||||
if (isset($_GET["error"]))
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -25,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/prelevement.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/rejet-prelevement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
|
||||
@ -41,35 +43,6 @@ $langs->load("categories");
|
||||
|
||||
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++;
|
||||
|
||||
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/lignes.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
if ($_GET["id"])
|
||||
@ -78,9 +51,8 @@ if ($_GET["id"])
|
||||
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipt"), '', 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -41,26 +42,6 @@ $result = restrictedArea($user, 'prelevement','','','bons');
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawsRefused"));
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/rejets.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortorder = $_GET["sortorder"];
|
||||
$sortfield = $_GET["sortfield"];
|
||||
@ -94,46 +75,46 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("WithdrawsRefused"), $page, "rejets.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("Nb"),"rejets.php","p.ref",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Reason"),"rejets.php","pr.motif","",$urladd);
|
||||
print '</tr>';
|
||||
print_barre_liste($langs->trans("WithdrawsRefused"), $page, "rejets.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("Nb"),"rejets.php","p.ref",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Reason"),"rejets.php","pr.motif","",$urladd);
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
$var=True;
|
||||
|
||||
$total = 0;
|
||||
$total = 0;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
|
||||
print substr('000000'.$obj->rowid, -6)."</a></td>";
|
||||
print substr('000000'.$obj->rowid, -6)."</a></td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
|
||||
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
print "</tr>\n";
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
print "</tr>\n";
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
95
htdocs/lib/prelevement.lib.php
Normal file
95
htdocs/lib/prelevement.lib.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/lib/prelevement.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module prelevement
|
||||
* \ingroup propal
|
||||
* \version $Id$
|
||||
*
|
||||
* Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Prepare head for prelevement screen and return it
|
||||
* @param prelevement class BonPrelevement
|
||||
* @return array head
|
||||
*/
|
||||
function prelevement_prepare_head($prelevement)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$langs->load("withdrawals");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$prelevement->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'prelevement';
|
||||
$h++;
|
||||
|
||||
if ($conf->use_preview_tabs)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$prelevement->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$head[$h][2] = 'preview';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$prelevement->id;
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$head[$h][2] = 'lines';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$prelevement->id;
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$head[$h][2] = 'invoices';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$prelevement->id;
|
||||
$head[$h][1] = $langs->trans("Rejects");
|
||||
$head[$h][2] = 'rejects';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$prelevement->id;
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$head[$h][2] = 'statistics';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__');
|
||||
if (is_array($conf->tabs_modules['prelevement']))
|
||||
{
|
||||
$i=0;
|
||||
foreach ($conf->tabs_modules['prelevement'] as $value)
|
||||
{
|
||||
$values=explode(':',$value);
|
||||
if ($values[2]) $langs->load($values[2]);
|
||||
$head[$h][0] = DOL_URL_ROOT . preg_replace('/__ID__/i',$propal->id,$values[3]);
|
||||
$head[$h][1] = $langs->trans($values[1]);
|
||||
$head[$h][2] = 'tab'.$values[1];
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
return $head;
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user