Merge pull request #6900 from aspangaro/6.0-d1
Review expense report - Look and feel v6
This commit is contained in:
commit
0c5bf21f3a
@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
@ -195,7 +195,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_num_releve='';
|
||||
$search_conciliated='';
|
||||
$thirdparty='';
|
||||
|
||||
|
||||
$account="";
|
||||
if ($id > 0 || ! empty($ref)) $account=$object->id;
|
||||
}
|
||||
@ -345,7 +345,7 @@ $paymentsupplierstatic=new PaiementFourn($db);
|
||||
$paymentvatstatic=new TVA($db);
|
||||
$paymentsalstatic=new PaymentSalary($db);
|
||||
$donstatic=new Don($db);
|
||||
$expensereportstatic=new ExpenseReport($db);
|
||||
$paymentexpensereportstatic=new PaymentExpenseReport($db);
|
||||
$bankstatic=new Account($db);
|
||||
$banklinestatic=new AccountLine($db);
|
||||
|
||||
@ -436,7 +436,6 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@ -548,9 +547,9 @@ if ($resql)
|
||||
{
|
||||
$var=True;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
@ -559,16 +558,14 @@ if ($resql)
|
||||
//if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
|
||||
// Confirmation delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$text=$langs->trans('ConfirmDeleteTransaction');
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -582,7 +579,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="ref" value="'.$ref.'">';
|
||||
if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
|
||||
|
||||
|
||||
// Form to reconcile
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile')
|
||||
{
|
||||
@ -657,11 +654,10 @@ if ($resql)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
';
|
||||
|
||||
';
|
||||
|
||||
$i = 0;
|
||||
|
||||
|
||||
// Title
|
||||
$bankcateg=new BankCateg($db);
|
||||
$morehtml='<div data-role="fieldcontain">';
|
||||
@ -669,7 +665,7 @@ if ($resql)
|
||||
$morehtml.='<input type="text" name="pageplusone" id="pageplusone" size="1" class="flat" value="'.($page+1).'">';
|
||||
$morehtml.='/'.$nbtotalofpages.' ';
|
||||
$morehtml.='</div>';
|
||||
|
||||
|
||||
$picto='title_bank';
|
||||
if ($id > 0 || ! empty($ref)) $picto='';
|
||||
if (GETPOST("bid"))
|
||||
@ -681,13 +677,12 @@ if ($resql)
|
||||
{
|
||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
|
||||
}
|
||||
|
||||
|
||||
// We can add page now to param
|
||||
if ($page != '') $param.='&page='.urlencode($page);
|
||||
|
||||
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('DateOperationShort').' : ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
|
||||
@ -695,7 +690,7 @@ if ($resql)
|
||||
//$moreforfilter .= ' - ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('DateValueShort').' : ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
|
||||
@ -703,7 +698,7 @@ if ($resql)
|
||||
//$moreforfilter .= ' - ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
@ -715,10 +710,10 @@ if ($resql)
|
||||
print $moreforfilter;
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
@ -803,7 +798,6 @@ if ($resql)
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
||||
@ -838,14 +832,13 @@ if ($resql)
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
$balance = 0; // For balance
|
||||
$balancecalculated = false;
|
||||
|
||||
|
||||
// Loop on each record
|
||||
$sign = 1;
|
||||
|
||||
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
@ -885,9 +878,9 @@ if ($resql)
|
||||
|
||||
$balancecalculated=true;
|
||||
}
|
||||
|
||||
|
||||
$balance = price2num($balance + ($sign * $objp->amount),'MT');
|
||||
|
||||
|
||||
if (empty($cachebankaccount[$objp->bankid]))
|
||||
{
|
||||
$bankaccounttmp = new Account($db);
|
||||
@ -899,8 +892,6 @@ if ($resql)
|
||||
{
|
||||
$bankaccount = $cachebankaccount[$objp->bankid];
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -975,9 +966,9 @@ if ($resql)
|
||||
}
|
||||
elseif ($links[$key]['type']=='payment_expensereport')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
||||
print '</a>';
|
||||
$paymentexpensereportstatic->id=$links[$key]['url_id'];
|
||||
$paymentexpensereportstatic->ref=$links[$key]['url_id'];
|
||||
print ' '.$paymentexpensereportstatic->getNomUrl(2);
|
||||
}
|
||||
elseif ($links[$key]['type']=='banktransfert')
|
||||
{
|
||||
@ -1012,19 +1003,19 @@ if ($resql)
|
||||
}
|
||||
elseif ($links[$key]['type']=='company')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
elseif ($links[$key]['type']=='user')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
elseif ($links[$key]['type']=='member')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
elseif ($links[$key]['type']=='sc')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1044,11 +1035,10 @@ if ($resql)
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Date ope
|
||||
if (! empty($arrayfields['b.dateo']['checked']))
|
||||
{
|
||||
@ -1089,7 +1079,7 @@ if ($resql)
|
||||
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['bu.label']['checked']))
|
||||
{
|
||||
@ -1114,7 +1104,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Bank account
|
||||
if (! empty($arrayfields['ba.ref']['checked']))
|
||||
{
|
||||
@ -1123,7 +1113,7 @@ if ($resql)
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Debit
|
||||
if (! empty($arrayfields['b.debit']['checked']))
|
||||
{
|
||||
@ -1137,6 +1127,7 @@ if ($resql)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
|
||||
}
|
||||
|
||||
// Credit
|
||||
if (! empty($arrayfields['b.credit']['checked']))
|
||||
{
|
||||
@ -1150,7 +1141,7 @@ if ($resql)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
|
||||
}
|
||||
|
||||
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
@ -1169,8 +1160,9 @@ if ($resql)
|
||||
{
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
{
|
||||
print '<td class="nowrap" align="center">';
|
||||
@ -1197,7 +1189,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Action edit/delete
|
||||
print '<td class="nowrap" align="center">';
|
||||
// Transaction reconciliated or edit link
|
||||
@ -1254,7 +1246,7 @@ if ($resql)
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield']))
|
||||
{
|
||||
@ -1277,7 +1269,7 @@ if ($resql)
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
|
||||
print '</form>';
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
@ -78,7 +78,40 @@ function expensereport_prepare_head($object)
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with the tabs for the "Expense report payment" section
|
||||
* It loads tabs from modules looking for the entity payment
|
||||
*
|
||||
* @param Paiement $object Current payment object
|
||||
* @return array Tabs for the payment section
|
||||
*/
|
||||
function payment_expensereport_prepare_head(PaymentExpenseReport $object) {
|
||||
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_expensereport');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/payment/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_expensereport', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -37,9 +37,12 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/expensereport.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expensereport.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
}
|
||||
|
||||
$langs->load("trips");
|
||||
$langs->load("bills");
|
||||
@ -647,14 +650,14 @@ if (empty($reshook))
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
$result = $object->setDeny($user,GETPOST('detail_refuse'));
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
@ -674,11 +677,11 @@ if (empty($reshook))
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Send mail
|
||||
|
||||
|
||||
// TO
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($object->fk_user_author);
|
||||
@ -714,10 +717,10 @@ if (empty($reshook))
|
||||
array_push($mimetype,"application/pdf");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// PREPARE SEND
|
||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||
|
||||
|
||||
if ($mailfile)
|
||||
{
|
||||
// SEND
|
||||
@ -767,17 +770,17 @@ if (empty($reshook))
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
//var_dump($user->id == $object->fk_user_validator);exit;
|
||||
if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
if ($user->id == $object->fk_user_valid || $user->id == $object->fk_user_author)
|
||||
{
|
||||
$result = $object->set_cancel($user,GETPOST('detail_cancel'));
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
@ -797,16 +800,16 @@ if (empty($reshook))
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Send mail
|
||||
|
||||
|
||||
// TO
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($object->fk_user_author);
|
||||
$emailTo = $destinataire->email;
|
||||
|
||||
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_cancel);
|
||||
@ -891,7 +894,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->creer)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
@ -899,7 +902,7 @@ if (empty($reshook))
|
||||
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid)
|
||||
{
|
||||
$result = $object->setStatut(0);
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
@ -919,7 +922,7 @@ if (empty($reshook))
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
@ -935,14 +938,14 @@ if (empty($reshook))
|
||||
setEventMessages("NOT_AUTHOR", '', 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
$result = $object->set_paid($id, $user);
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
@ -962,46 +965,46 @@ if (empty($reshook))
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Send mail
|
||||
|
||||
|
||||
// TO
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($object->fk_user_author);
|
||||
$emailTo = $destinataire->email;
|
||||
|
||||
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($user->id);
|
||||
$emailFrom = $expediteur->email;
|
||||
|
||||
|
||||
if ($emailFrom && $emailTo)
|
||||
{
|
||||
$filename=array(); $filedir=array(); $mimetype=array();
|
||||
|
||||
// SUBJECT
|
||||
$subject = $langs->transnoentities("ExpenseReportPaid");
|
||||
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$message = $langs->transnoentities("ExpenseReportPaidMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||
|
||||
|
||||
// CONTENT
|
||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n";
|
||||
$message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
||||
$message.= "Bien cordialement,\n' SI";
|
||||
|
||||
|
||||
// Generate pdf before attachment
|
||||
$object->setDocModel($user,"");
|
||||
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||
|
||||
|
||||
// PREPARE SEND
|
||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||
|
||||
|
||||
if ($mailfile)
|
||||
{
|
||||
// SEND
|
||||
@ -1055,45 +1058,44 @@ if (empty($reshook))
|
||||
if ($action == "addline" && $user->rights->expensereport->creer)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$object_ligne = new ExpenseReportLine($db);
|
||||
|
||||
|
||||
$vatrate = GETPOST('vatrate');
|
||||
$object_ligne->comments = GETPOST('comments');
|
||||
$qty = GETPOST('qty','int');
|
||||
if (empty($qty)) $qty=1;
|
||||
$object_ligne->qty = $qty;
|
||||
|
||||
|
||||
$up=price2num(GETPOST('value_unit'),'MU');
|
||||
$object_ligne->value_unit = $up;
|
||||
|
||||
|
||||
$object_ligne->date = $date;
|
||||
|
||||
|
||||
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
|
||||
|
||||
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
|
||||
if (empty($vatrate)) $vatrate = "0.000";
|
||||
$object_ligne->vatrate = price2num($vatrate);
|
||||
|
||||
|
||||
$object_ligne->fk_projet = $fk_projet;
|
||||
|
||||
|
||||
|
||||
if (! GETPOST('fk_c_type_fees') > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
if ($vatrate < 0 || $vatrate == '')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
/* Projects are never required. To force them, check module forceproject
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
@ -1103,7 +1105,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors');
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// Si aucune date n'est rentrée
|
||||
if (empty($object_ligne->date) || $object_ligne->date=="--")
|
||||
{
|
||||
@ -1116,21 +1118,21 @@ if (empty($reshook))
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// S'il y'a eu au moins une erreur
|
||||
if (! $error)
|
||||
{
|
||||
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
||||
|
||||
|
||||
$type = 0; // TODO What if service ?
|
||||
$seller = ''; // seller is unknown
|
||||
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
|
||||
|
||||
|
||||
$object_ligne->vatrate = price2num($vatrate);
|
||||
$object_ligne->total_ttc = $tmp[2];
|
||||
$object_ligne->total_ht = $tmp[0];
|
||||
$object_ligne->total_tva = $tmp[1];
|
||||
|
||||
|
||||
$result = $object_ligne->insert();
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -1144,10 +1146,10 @@ if (empty($reshook))
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes" && $user->rights->expensereport->creer)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
@ -1157,7 +1159,7 @@ if (empty($reshook))
|
||||
$object_ligne->fetch(GETPOST("rowid"));
|
||||
$total_ht = $object_ligne->total_ht;
|
||||
$total_tva = $object_ligne->total_tva;
|
||||
|
||||
|
||||
$result=$object->deleteline(GETPOST("rowid"), $user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
@ -1190,12 +1192,12 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == "updateligne" && $user->rights->expensereport->creer)
|
||||
{
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
$rowid = $_POST['rowid'];
|
||||
$type_fees_id = GETPOST('fk_c_type_fees');
|
||||
$projet_id = $fk_projet;
|
||||
@ -1207,7 +1209,7 @@ if (empty($reshook))
|
||||
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
|
||||
if (empty($vatrate)) $vatrate = "0.000";
|
||||
$vatrate = price2num($vatrate);
|
||||
|
||||
|
||||
if (! GETPOST('fk_c_type_fees') > 0)
|
||||
{
|
||||
$error++;
|
||||
@ -1220,7 +1222,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// TODO Use update method of ExpenseReportLine
|
||||
@ -1258,7 +1260,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->expensereport->dir_output;
|
||||
$permissioncreate = $user->rights->expensereport->creer;
|
||||
@ -1278,6 +1280,8 @@ $form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formproject = new FormProjets($db);
|
||||
$projecttmp = new Project($db);
|
||||
$paymentexpensereportstatic=new PaymentExpenseReport($db);
|
||||
$bankaccountstatic = new Account($db);
|
||||
|
||||
// Create
|
||||
if ($action == 'create')
|
||||
@ -1320,7 +1324,7 @@ if ($action == 'create')
|
||||
print $s;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("VALIDATOR").'</td>';
|
||||
print '<td>';
|
||||
@ -1376,7 +1380,7 @@ if ($action == 'create')
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
}
|
||||
|
||||
|
||||
print '<tbody>';
|
||||
print '</table>';
|
||||
|
||||
@ -1447,7 +1451,7 @@ else
|
||||
$userfee->fetch($object->fk_user_author);
|
||||
print $userfee->getNomUrl(-1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
@ -1542,7 +1546,7 @@ else
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneExpenseReport'), $langs->trans('ConfirmCloneExpenseReport', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'save')
|
||||
{
|
||||
$formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1);
|
||||
@ -1592,13 +1596,10 @@ else
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
|
||||
// Expense report card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
/*
|
||||
// Ref customer
|
||||
@ -1639,15 +1640,13 @@ else
|
||||
}
|
||||
}*/
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Author
|
||||
@ -1662,7 +1661,7 @@ else
|
||||
print $userauthor->getNomUrl(-1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Period").'</td>';
|
||||
print '<td>';
|
||||
@ -1677,29 +1676,6 @@ else
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Amount
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td>'.price($object->total_ht).'</td>';
|
||||
$rowspan = 5;
|
||||
if ($object->fk_statut < 3) $rowspan++;
|
||||
elseif($object->fk_statut == 4) $rowspan+=2;
|
||||
else $rowspan+=2;
|
||||
if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2;
|
||||
if($object->fk_statut==6) $rowspan+=2;
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountVAT").'</td>';
|
||||
print '<td>'.price($object->total_tva).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td>'.price($object->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Validation date
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DATE_SAVE").'</td>';
|
||||
@ -1740,7 +1716,7 @@ else
|
||||
print $userfee->getNomUrl(-1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("MOTIF_CANCEL").'</td>';
|
||||
print '<td>'.$object->detail_cancel.'</td></tr>';
|
||||
@ -1762,7 +1738,7 @@ else
|
||||
print $userapp->getNomUrl(-1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateApprove").'</td>';
|
||||
print '<td>'.dol_print_date($object->date_approve,'dayhour').'</td></tr>';
|
||||
@ -1778,7 +1754,7 @@ else
|
||||
$userfee->fetch($object->fk_user_refuse);
|
||||
print $userfee->getNomUrl(-1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DATE_REFUS").'</td>';
|
||||
print '<td>'.dol_print_date($object->date_refuse,'dayhour');
|
||||
@ -1805,67 +1781,130 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
//print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// List of payments
|
||||
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
|
||||
$sql.= "c.code as type_code,c.libelle as payment_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p";
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Amount
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
|
||||
$rowspan = 5;
|
||||
if ($object->fk_statut < 3) $rowspan++;
|
||||
elseif($object->fk_statut == 4) $rowspan+=2;
|
||||
else $rowspan+=2;
|
||||
if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2;
|
||||
if($object->fk_statut==6) $rowspan+=2;
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountVAT").'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// List of payments already done
|
||||
$nbcols = 3;
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
$nbrows ++;
|
||||
$nbcols ++;
|
||||
}
|
||||
|
||||
print '<table class="noborder paymenttable" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">' . $langs->trans('Payments') . '</td>';
|
||||
print '<td class="liste_titre">' . $langs->trans('Date') . '</td>';
|
||||
print '<td class="liste_titre">' . $langs->trans('Type') . '</td>';
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
print '<td class="liste_titre" align="right">' . $langs->trans('BankAccount') . '</td>';
|
||||
}
|
||||
print '<td class="liste_titre" align="right">' . $langs->trans('Amount') . '</td>';
|
||||
print '<td class="liste_titre" width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Payments already done (from payment on this expensereport)
|
||||
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount, p.fk_bank,";
|
||||
$sql.= "c.code as p_code, c.libelle as payment_type,";
|
||||
$sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."payment_expensereport as p";
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
$sql.= " WHERE e.rowid = '".$id."'";
|
||||
$sql.= " AND p.fk_expensereport = e.rowid";
|
||||
$sql.= " AND e.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_typepayment = c.id";
|
||||
$sql.= " ORDER BY dp";
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="noborder paymenttable" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print "<tr ".$bc[$var]."><td>";
|
||||
print '<a href="'.DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
||||
|
||||
print '<tr class="oddseven"><td>';
|
||||
$paymentexpensereportstatic->id = $objp->rowid;
|
||||
$paymentexpensereportstatic->datepaye = $db->jdate($objp->dp);
|
||||
$paymentexpensereportstatic->ref = $objp->rowid;
|
||||
$paymentexpensereportstatic->num_paiement = $objp->num_paiement;
|
||||
$paymentexpensereportstatic->payment_code = $objp->payment_code;
|
||||
print $paymentexpensereportstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->fk_typepayment;
|
||||
$labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->fk_typepayment;
|
||||
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
$bankaccountstatic->label = $objp->baref;
|
||||
$bankaccountstatic->number = $objp->banumber;
|
||||
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
$bankaccountstatic->account_number = $objp->account_number;
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objp->fk_accountancy_journal);
|
||||
$bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
|
||||
print '<td align="right">';
|
||||
if ($bankaccountstatic->id)
|
||||
print $bankaccountstatic->getNomUrl(1, 'transactions');
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">'.price($objp->amount)."</td>";
|
||||
print "</tr>";
|
||||
$totalpaid += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if ($object->paid == 0)
|
||||
{
|
||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaid)."</td></tr>\n";
|
||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->total_ttc)."</td></tr>\n";
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("AlreadyPaid").':</td><td align="right">'.price($totalpaid).'</td></tr>';
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("AmountExpected").':</td><td align="right">'.price($object->total_ttc).'</td></tr>';
|
||||
|
||||
$remaintopay = $object->total_ttc - $totalpaid;
|
||||
|
||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
||||
print '<td align="right"'.($remaintopay?' class="amountremaintopay"':'').'>'.price($remaintopay)."</td></tr>\n";
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">'.$langs->trans("RemainderToPay").':</td>';
|
||||
print '<td align="right"'.($remaintopay?' class="amountremaintopay"':'').'>'.price($remaintopay).'</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
@ -1873,15 +1912,13 @@ else
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Fetch Lines of current expense report
|
||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
||||
@ -1898,18 +1935,17 @@ else
|
||||
|
||||
$actiontouse='updateligne';
|
||||
if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') $actiontouse='addline';
|
||||
|
||||
|
||||
print '<form name="expensereport" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="'.$actiontouse.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="fk_expensereport" value="'.$object->id.'" />';
|
||||
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num_lignes = $db->num_rows($resql);
|
||||
@ -1989,7 +2025,7 @@ else
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -2042,7 +2078,7 @@ else
|
||||
print '<td style="text-align:right;">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td style="text-align:right;">'.$langs->trans('AmountTTC').'</td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td style="text-align:center;">';
|
||||
print '<input type="hidden" name="rowid" value="'.$objp->rowid.'">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||
@ -2078,11 +2114,11 @@ else
|
||||
print '<td colspan="3"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr '.$bc[true].'>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
|
||||
// Select date
|
||||
print '<td align="center">';
|
||||
$form->select_date($date?$date:-1,'date');
|
||||
@ -2091,11 +2127,11 @@ else
|
||||
// Select project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Select type
|
||||
print '<td align="center">';
|
||||
select_type_fees_id($fk_c_type_fees,'fk_c_type_fees',1);
|
||||
@ -2249,7 +2285,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If status is Appoved
|
||||
// --------------------
|
||||
|
||||
@ -2257,7 +2293,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=refuse&id='.$object->id.'">'.$langs->trans('Deny').'</a></div>';
|
||||
}
|
||||
|
||||
|
||||
// If bank module is used
|
||||
if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == 5)
|
||||
{
|
||||
@ -2272,7 +2308,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
}
|
||||
}
|
||||
|
||||
// If bank module is not used
|
||||
// If bank module is not used
|
||||
if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5)
|
||||
{
|
||||
//if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -31,6 +31,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
{
|
||||
public $element='payment_expensereport'; //!< Id that identify managed objects
|
||||
public $table_element='payment_expensereport'; //!< Name of table without prefix where object is stored
|
||||
public $picto = 'payment';
|
||||
|
||||
var $rowid;
|
||||
|
||||
@ -425,6 +426,32 @@ class PaymentExpenseReport extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
function LibStatut($statut,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
@ -613,4 +640,48 @@ class PaymentExpenseReport extends CommonObject
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab information on object
|
||||
*
|
||||
* @param int $id Payment id
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT e.rowid, e.datec, e.fk_user_creat, e.fk_user_modif, e.tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as e';
|
||||
$sql.= ' WHERE e.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_creat)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_creat);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
if ($obj->fk_user_modif)
|
||||
{
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -24,29 +24,25 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/expensereport/modules_expensereport.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||
if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('banks');
|
||||
$langs->load('companies');
|
||||
$langs->load('trips');
|
||||
|
||||
// Security check
|
||||
$id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
// TODO Add rule to restrict access payment
|
||||
//$result = restrictedArea($user, 'facture', $id,'');
|
||||
|
||||
$payment = new PaymentExpenseReport($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result=$payment->fetch($id);
|
||||
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
||||
}
|
||||
|
||||
$object = new PaymentExpenseReport($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -57,7 +53,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expensere
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result = $payment->delete($user);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
@ -66,7 +62,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expensere
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -76,7 +72,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->expensere
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=$payment->valide();
|
||||
$result=$object->valide();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -99,12 +95,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->expensere
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: card.php?id='.$payment->id);
|
||||
header('Location: card.php?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -114,27 +110,27 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->expensere
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
llxHeader('', $langs->trans("ExpenseReportPayment"));
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
||||
}
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$h=0;
|
||||
$head = payment_expensereport_prepare_head($object);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ExpenseReportPayment"), 0, 'payment');
|
||||
dol_fiche_head($head, 'payment', $langs->trans("ExpenseReportPayment"), -1, 'payment');
|
||||
|
||||
/*
|
||||
* Confirm deleting of the payment
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm('card.php?id='.$payment->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||
|
||||
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -143,46 +139,61 @@ if ($action == 'delete')
|
||||
if ($action == 'valide')
|
||||
{
|
||||
$facid = $_GET['facid'];
|
||||
print $form->formconfirm('card.php?id='.$payment->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||
|
||||
}
|
||||
|
||||
// $linkback = '<a href="' . DOL_URL_ROOT . '/expensereport/payment/list.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="20%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($payment,'id','',1,'rowid','id');
|
||||
print '</td></tr>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($payment->datep,'day').'</td></tr>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Date payment
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($object->datep,'day').'</td></tr>';
|
||||
|
||||
// Mode
|
||||
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$payment->type_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$langs->trans("PaymentType".$object->type_code).'</td></tr>';
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$payment->num_payment.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_payment.'</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($payment->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($payment->note).'</td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
|
||||
|
||||
$disable_delete = 0;
|
||||
// Bank account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($payment->bank_account)
|
||||
if ($object->bank_account)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($payment->bank_line);
|
||||
$bankline->fetch($object->bank_line);
|
||||
if ($bankline->rappro)
|
||||
{
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
print $bankline->getNomUrl(1,0,'showconciliated');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td colspan="3">';
|
||||
$accountstatic=new Account($db);
|
||||
$accountstatic->fetch($bankline->fk_account);
|
||||
print $accountstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -190,13 +201,16 @@ if (! empty($conf->banque->enabled))
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* List of donations paid
|
||||
* List of expense report paid
|
||||
*/
|
||||
|
||||
$disable_delete = 0;
|
||||
$sql = 'SELECT er.rowid as did, er.paid, er.total_ttc, per.amount';
|
||||
$sql = 'SELECT er.rowid as eid, er.paid, er.total_ttc, per.amount';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as per,'.MAIN_DB_PREFIX.'expensereport as er';
|
||||
$sql.= ' WHERE per.fk_expensereport = er.rowid';
|
||||
$sql.= ' AND er.entity IN ('.getEntity('expensereport', 1).')';
|
||||
@ -210,12 +224,17 @@ if ($resql)
|
||||
|
||||
$i = 0;
|
||||
$total = 0;
|
||||
print '<br><table class="noborder" width="100%">';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('ExpenseReport').'</td>';
|
||||
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Status').'</td>';
|
||||
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
|
||||
print '<td align="right">'.$langs->trans('RemainderToPay').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Status').'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($num > 0)
|
||||
@ -226,19 +245,28 @@ if ($resql)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Ref
|
||||
|
||||
$expensereport=new ExpenseReport($db);
|
||||
$expensereport->fetch($objp->eid);
|
||||
|
||||
// Expense report
|
||||
print '<td>';
|
||||
$expensereport->fetch($objp->did);
|
||||
print $expensereport->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
// Expected to pay
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
// Status
|
||||
print '<td align="center">'.$expensereport->getLibStatut(4,$objp->amount).'</td>';
|
||||
|
||||
// Amount paid
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
|
||||
// Remain to pay
|
||||
print '<td align="right">'.price($remaintopay).'</td>';
|
||||
|
||||
// Status
|
||||
print '<td align="center">'.$expensereport->getLibStatut(4,$objp->amount).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
if ($objp->paid == 1) // If at least one invoice is paid, disable delete
|
||||
{
|
||||
@ -251,6 +279,8 @@ if ($resql)
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
@ -266,26 +296,13 @@ print '</div>';
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
/*
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
{
|
||||
if ($user->societe_id == 0 && $payment->statut == 0 && $_GET['action'] == '')
|
||||
{
|
||||
if ($user->rights->facture->paiement)
|
||||
{
|
||||
print '<a class="butAction" href="card.php?id='.$_GET['id'].'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($_GET['action'] == '')
|
||||
if ($action == '')
|
||||
{
|
||||
if ($user->rights->expensereport->supprimer)
|
||||
{
|
||||
if (! $disable_delete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -296,8 +313,6 @@ if ($_GET['action'] == '')
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
81
htdocs/expensereport/payment/info.php
Normal file
81
htdocs/expensereport/payment/info.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expensereport/payment/info.php
|
||||
* \ingroup Expense report
|
||||
* \brief Tab payment info
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("trips");
|
||||
|
||||
$id=GETPOST('id');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Payment"));
|
||||
|
||||
$object = new PaymentExpenseReport($db);
|
||||
$object->fetch($id, $ref);
|
||||
$object->info($object->id);
|
||||
|
||||
$head = payment_expensereport_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("ExpenseReportPayment"), -1, 'payment');
|
||||
|
||||
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/expensereport/payment/list.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
Loading…
Reference in New Issue
Block a user