dolibarr/htdocs/compta/prelevement/fiche.php

203 lines
5.9 KiB
PHP
Raw Normal View History

2005-01-07 16:26:30 +01:00
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2005-01-21 23:59:48 +01:00
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
2005-01-07 16:26:30 +01:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
2005-01-21 23:59:48 +01:00
/**
\file htdocs/compta/prelevement/fiche.php
\ingroup prelevement
\brief Fiche prelevement
\version $Revision$
*/
2005-01-07 16:26:30 +01:00
require("./pre.inc.php");
2005-01-21 23:59:48 +01:00
$langs->load("bills");
2005-01-07 16:26:30 +01:00
/*
* S<EFBFBD>curit<EFBFBD> acc<EFBFBD>s client
*/
if ($user->societe_id > 0) accessforbidden();
if ($_POST["action"] == 'confirm_credite' && $_POST["confirm"] == yes)
2005-01-07 16:26:30 +01:00
{
$bon = new BonPrelevement($db,"");
$bon->id = $_GET["id"];
$bon->set_credite();
Header("Location: fiche.php?id=".$_GET["id"]);
2005-01-07 16:26:30 +01:00
}
if ($_POST["action"] == 'infotrans')
{
$bon = new BonPrelevement($db,"");
$bon->id = $_GET["id"];
$dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$bon->set_infotrans($user, $dt, $_POST["methode"]);
Header("Location: fiche.php?id=".$_GET["id"]);
}
if ($_POST["action"] == 'infocredit')
{
$bon = new BonPrelevement($db,"");
$bon->id = $_GET["id"];
$dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$bon->set_infocredit($user, $dt);
Header("Location: fiche.php?id=".$_GET["id"]);
}
llxHeader('','Bon de pr<70>l<EFBFBD>vement');
2005-01-07 16:26:30 +01:00
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
2005-01-21 23:59:48 +01:00
$head[$h][1] = $langs->trans("Card");
2005-01-07 16:26:30 +01:00
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
2005-01-21 23:59:48 +01:00
$head[$h][1] = $langs->trans("Bills");
$h++;
2005-01-07 16:26:30 +01:00
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
2005-01-21 23:59:48 +01:00
$head[$h][1] = $langs->trans("Statistics");
$h++;
2005-01-11 15:40:08 +01:00
$prev_id = $_GET["id"];
$html = new Form($db);
2005-01-11 15:40:08 +01:00
if ($_GET["id"])
{
$bon = new BonPrelevement($db,"");
if ($bon->fetch($_GET["id"]) == 0)
{
dolibarr_fiche_head($head, $hselected, 'Pr<50>l<EFBFBD>vement : '. $bon->ref);
if ($_GET["action"] == 'credite')
{
$html->form_confirm("fiche.php?id=".$bon->id,"Classer comme cr<63>dit<69>","Etes-vous s<>r de vouloir classer ce bon de pr<70>l<EFBFBD>vement comme cr<63>dit<69> sur votre compte bancaire ?","confirm_credite");
print '<br />';
}
2005-01-11 15:40:08 +01:00
print '<table class="border" width="100%">';
2005-01-21 23:59:48 +01:00
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.strftime("%d %b %Y",$bon->datec).'</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>';
2005-01-11 15:40:08 +01:00
$encfile = urlencode(DOL_DATA_ROOT.'/prelevement/bon/'.$bon->ref);
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;file='.$encfile.'">'.$bon->ref.'</a>';
print '</td></tr>';
if($bon->date_trans <> 0)
{
$muser = new User($db, $bon->user_trans);
$muser->fetch();
print '<tr><td width="20%">Date Transmission / Par</td><td>';
print strftime("%d %b %Y",$bon->date_trans);
print ' par '.$muser->fullname.'</td></tr>';
print '<tr><td width="20%">M<>thode Transmission</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
{
print '<tr><td width="20%">Cr<43>dit<69> le</td><td>';
print strftime("%d %b %Y",$bon->date_credit);
print '</td></tr>';
}
print '</table><br />';
if($bon->date_trans == 0)
{
print '<form method="post" action="fiche.php?id='.$bon->id.'">';
print '<input type="hidden" name="action" value="infotrans">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">Date Transmission</td><td>';
print $html->select_date();
print '</td></tr>';
print '<tr><td width="20%">M<>thode Transmission</td><td>';
print $html->select_array("methode",$bon->methodes_trans);
print '</td></tr>';
print '<tr><td colspan="2" align="center">';
print '<input type="submit">';
print '</td></tr>';
print '</table></form>';
}
if($bon->date_trans <> 0 && $bon->date_credit == 0)
{
print '<form method="post" action="fiche.php?id='.$bon->id.'">';
print '<input type="hidden" name="action" value="infocredit">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">Cr<43>dit<69> le</td><td>';
print $html->select_date();
print '</td></tr>';
print '<tr><td colspan="2" align="center">';
print '<input type="submit">';
print '</td></tr>';
print '</table></form>';
}
2005-01-11 15:40:08 +01:00
}
else
{
2005-01-21 23:59:48 +01:00
dolibarr_print_error($db);
2005-01-11 15:40:08 +01:00
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
2005-01-11 15:40:08 +01:00
print "\n</div>\n<div class=\"tabsAction\">\n";
2005-01-07 16:26:30 +01:00
if ($_GET["action"] == '')
{
2005-01-07 16:26:30 +01:00
if ($bon->credite == 0)
{
print "<a class=\"tabAction\" href=\"fiche.php?action=credite&amp;id=$bon->id\">".$langs->trans("Classer cr<EFBFBD>dit<EFBFBD>")."</a>";
}
2005-01-07 16:26:30 +01:00
2005-01-07 16:26:30 +01:00
}
print "</div>";
2005-01-07 16:26:30 +01:00
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>