Fix look and field for direct debit notes
This commit is contained in:
parent
cce1549f66
commit
17eec5f9e9
@ -493,7 +493,7 @@ class Paiement extends CommonObject
|
||||
*
|
||||
* @param User $user Object of user making payment
|
||||
* @param string $mode 'payment', 'payment_supplier'
|
||||
* @param string $label Label to use in bank record
|
||||
* @param string $label Label to use in bank record. Note: If label is '(WithdrawalPayment)', a third entry 'widthdraw' is added into bank_url.
|
||||
* @param int $accountid Id of bank account to do link with
|
||||
* @param string $emetteur_nom Name of transmitter
|
||||
* @param string $emetteur_banque Name of bank
|
||||
|
||||
@ -51,6 +51,9 @@ if (! $sortfield) $sortfield="p.datec";
|
||||
// Get supervariables
|
||||
$statut = GETPOST('statut','int');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
|
||||
$bon=new BonPrelevement($db,"");
|
||||
|
||||
|
||||
/*
|
||||
@ -60,6 +63,7 @@ $search_ref = GETPOST('search_ref','alpha');
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_amount="";
|
||||
}
|
||||
|
||||
|
||||
@ -69,13 +73,12 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
$bon=new BonPrelevement($db,"");
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
|
||||
$sql.= ", p.datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
|
||||
if ($search_amount) $sql.=natural_search("p.amount", $search_amount, 1);
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
@ -97,6 +100,8 @@ if ($result)
|
||||
|
||||
$urladd= "&statut=".$statut;
|
||||
|
||||
$selectedfields='';
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -116,7 +121,9 @@ if ($result)
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -125,9 +132,11 @@ if ($result)
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"","","",'align="center"');
|
||||
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"p.amount","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
@ -136,15 +145,18 @@ if ($result)
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
print $bon->LibStatut($obj->statut,2);
|
||||
print " ";
|
||||
|
||||
print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print '<td align="right">';
|
||||
print $bon->LibStatut($obj->statut, 3);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right"></td>'."\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/card.php
|
||||
* \ingroup prelevement
|
||||
* \brief Fiche prelevement
|
||||
* \brief Card of a direct debit
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
@ -47,18 +47,21 @@ $action = GETPOST('action','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (! $sortfield) $sortfield='pl.fk_soc';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -66,10 +69,9 @@ if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
if ( $action == 'confirm_delete' )
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$res=$bon->delete();
|
||||
$res=$object->delete();
|
||||
if ($res > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
@ -77,16 +79,16 @@ if ( $action == 'confirm_delete' )
|
||||
}
|
||||
}
|
||||
|
||||
// Seems to no be used and replaced with $action == 'infocredit
|
||||
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$res=$bon->set_credite();
|
||||
$res=$object->set_credite();
|
||||
if ($res >= 0)
|
||||
{
|
||||
header("Location: card.php?id=".$id);
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,19 +96,18 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||
|
||||
/*
|
||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
|
||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
||||
{
|
||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
||||
{
|
||||
$bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
}
|
||||
|
||||
header("Location: card.php?id=".$id);
|
||||
@ -118,7 +119,7 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
$mesg='BadFile';
|
||||
}*/
|
||||
|
||||
$error = $bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@ -127,13 +128,13 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
}
|
||||
}
|
||||
|
||||
// Set direct debit order to credited, create payment and close invoices
|
||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||
|
||||
$error = $bon->set_infocredit($user, $dt);
|
||||
$error = $object->set_infocredit($user, $dt);
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@ -143,61 +144,66 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
|
||||
if ($id > 0)
|
||||
if ($id > 0 || $ref)
|
||||
{
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
if (GETPOST('error','alpha')!='')
|
||||
{
|
||||
print '<div class="error">'.$bon->getErrorString(GETPOST('error','alpha')).'</div>';
|
||||
print '<div class="error">'.$object->getErrorString(GETPOST('error','alpha')).'</div>';
|
||||
}
|
||||
|
||||
/*if ($action == 'credite')
|
||||
{
|
||||
print $form->formconfirm("card.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
|
||||
print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
|
||||
|
||||
}*/
|
||||
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -205,19 +211,36 @@ if ($id > 0)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
|
||||
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
|
||||
{
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$bon->id.'" enctype="multipart/form-data">';
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="infotrans">';
|
||||
print '<table class="border" width="100%">';
|
||||
@ -227,7 +250,7 @@ if ($id > 0)
|
||||
print $form->select_date('','','','','',"userfile",1,1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $form->selectarray("methode",$bon->methodes_trans);
|
||||
print $form->selectarray("methode",$object->methodes_trans);
|
||||
print '</td></tr>';
|
||||
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
|
||||
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
|
||||
@ -238,9 +261,9 @@ if ($id > 0)
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if (! empty($bon->date_trans) && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
|
||||
if (! empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
|
||||
{
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$bon->id.'">';
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="infocredit">';
|
||||
print '<table class="border" width="100%">';
|
||||
@ -261,17 +284,17 @@ if ($id > 0)
|
||||
{
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send)
|
||||
if (empty($object->date_trans) && $user->rights->prelevement->bons->send)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$bon->id."\">".$langs->trans("SetToStatusSent")."</a>";
|
||||
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$object->id."\">".$langs->trans("SetToStatusSent")."</a>";
|
||||
}
|
||||
|
||||
if (! empty($bon->date_trans) && $bon->date_credit == 0)
|
||||
if (! empty($object->date_trans) && $object->date_credit == 0)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$bon->id."\">".$langs->trans("ClassCredited")."</a>";
|
||||
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$object->id."\">".$langs->trans("ClassCredited")."</a>";
|
||||
}
|
||||
|
||||
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$bon->id."\">".$langs->trans("Delete")."</a>";
|
||||
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
@ -293,7 +316,16 @@ if ($id > 0)
|
||||
$sql.= " AND pl.fk_soc = s.rowid";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -304,8 +336,9 @@ if ($id > 0)
|
||||
|
||||
$urladd = "&id=".$id;
|
||||
|
||||
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
|
||||
@ -369,6 +402,8 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@ -38,6 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
*/
|
||||
class BonPrelevement extends CommonObject
|
||||
{
|
||||
public $element='widthdraw';
|
||||
public $table_element='prelevement_bons';
|
||||
public $picto = 'payment';
|
||||
|
||||
var $date_echeance;
|
||||
var $raison_sociale;
|
||||
var $reference_remise;
|
||||
@ -263,10 +267,11 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Get object and lines from database
|
||||
*
|
||||
* @param int $rowid id of object to load
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Ref of direct debit
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($rowid)
|
||||
function fetch($rowid, $ref='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -278,8 +283,9 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= ", p.fk_user_credit";
|
||||
$sql.= ", p.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.rowid = ".$rowid;
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($rowid > 0) $sql.= " AND p.rowid = ".$rowid;
|
||||
else $sql.= " AND p.ref = '".$this->db->escape($ref)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
@ -345,7 +351,7 @@ class BonPrelevement extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
if (! $error)
|
||||
{
|
||||
$facs = array();
|
||||
$facs = $this->getListInvoices();
|
||||
@ -361,9 +367,8 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql.= " SET statut = 2";
|
||||
$sql.= " WHERE fk_prelevement_bons = ".$this->id;
|
||||
@ -378,7 +383,7 @@ class BonPrelevement extends CommonObject
|
||||
/*
|
||||
* End of procedure
|
||||
*/
|
||||
if ($error == 0)
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
@ -399,10 +404,10 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set withdrawal to credited status
|
||||
* Set direct debit order to "credited" status.
|
||||
*
|
||||
* @param User $user id of user
|
||||
* @param int $date date of action
|
||||
* @param User $user Id of user
|
||||
* @param int $date date of action
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function set_infocredit($user, $date)
|
||||
@ -466,7 +471,7 @@ class BonPrelevement extends CommonObject
|
||||
$paiement_id = $paiement->create($user);
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_credite AddPayment Error");
|
||||
dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
@ -474,7 +479,7 @@ class BonPrelevement extends CommonObject
|
||||
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'','');
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_credite AddPaymentToBank Error");
|
||||
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -486,7 +491,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_credite Update lines Error");
|
||||
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -1819,11 +1824,11 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status label for a status
|
||||
* Return status label for a status
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
|
||||
* @return string Label
|
||||
* @param int $statut id statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function LibStatut($statut,$mode=0)
|
||||
{
|
||||
@ -1846,8 +1851,25 @@ class BonPrelevement extends CommonObject
|
||||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
|
||||
}
|
||||
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
|
||||
@ -67,7 +67,7 @@ if ($action == 'create')
|
||||
{
|
||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||
}
|
||||
if ($result == 0)
|
||||
elseif ($result == 0)
|
||||
{
|
||||
$mesg='';
|
||||
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
|
||||
@ -78,6 +78,10 @@ if ($action == 'create')
|
||||
$mesg.=$val."<br>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("DirectDebitOrderCreated"), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -55,6 +55,9 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -65,39 +68,41 @@ $thirdpartytmp = new Societe($db);
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id)
|
||||
if ($prev_id > 0 || $ref)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($prev_id) == 0)
|
||||
if ($object->fetch($prev_id, $ref) == 0)
|
||||
{
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans('Status').'</td><td>'.$bon->getLibStatut(1).'</td></tr>';
|
||||
//print '<tr><td>'.$langs->trans('Status').'</td><td>'.$object->getLibStatut(1).'</td></tr>';
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -105,12 +110,29 @@ if ($prev_id)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
@ -137,7 +159,6 @@ $sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($prev_id) $sql.= " AND p.rowid=".$prev_id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
@ -172,9 +193,10 @@ if ($result)
|
||||
|
||||
$massactionbutton='';
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("Invoices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
|
||||
@ -250,6 +272,8 @@ if ($result)
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@ -41,49 +41,68 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id)
|
||||
if ($prev_id > 0 || $ref)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($prev_id) == 0)
|
||||
if ($object->fetch($prev_id, $ref) == 0)
|
||||
{
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -91,12 +110,29 @@ if ($prev_id)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
@ -109,7 +145,7 @@ if ($prev_id)
|
||||
$rej = new RejetPrelevement($db, $user);
|
||||
|
||||
/*
|
||||
* Liste des factures
|
||||
* List errors
|
||||
*/
|
||||
$sql = "SELECT pl.rowid, pl.amount, pl.statut";
|
||||
$sql.= " , s.rowid as socid, s.nom as name";
|
||||
@ -127,12 +163,25 @@ $sql.= " AND pr.fk_prelevement_lignes = pl.rowid";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY pl.amount DESC";
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print_barre_liste($langs->trans("Rejects"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
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>';
|
||||
@ -146,32 +195,32 @@ if ($resql)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print img_picto('', 'statut'.$obj->statut).' ';
|
||||
print substr('000000'.$obj->rowid, -6);
|
||||
print '</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
|
||||
|
||||
|
||||
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";
|
||||
|
||||
|
||||
$total += $obj->amount;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr class="liste_total"><td> </td>';
|
||||
@ -181,6 +230,8 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@ -38,7 +38,20 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -48,40 +61,44 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($prev_id) == 0)
|
||||
if ($object->fetch($prev_id) == 0)
|
||||
{
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -89,12 +106,29 @@ if ($prev_id)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
@ -121,7 +155,7 @@ if ($prev_id)
|
||||
$i = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("StatisticsByLineStatus"),'','');
|
||||
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -139,12 +173,12 @@ if ($prev_id)
|
||||
print price($row[0]);
|
||||
|
||||
print '</td><td align="right">';
|
||||
if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %";
|
||||
if ($object->amount) print round($row[0]/$object->amount*100,2)." %";
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user