Merge pull request #5979 from aspangaro/5.0-p35
Vat expense report integration in reports
This commit is contained in:
commit
7953ea8b4d
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||||
|
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,11 +37,14 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
$langs->load("trips");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
// Date range
|
// Date range
|
||||||
@ -111,9 +115,11 @@ $form=new Form($db);
|
|||||||
$company_static=new Societe($db);
|
$company_static=new Societe($db);
|
||||||
$invoice_customer=new Facture($db);
|
$invoice_customer=new Facture($db);
|
||||||
$invoice_supplier=new FactureFournisseur($db);
|
$invoice_supplier=new FactureFournisseur($db);
|
||||||
|
$expensereport=new ExpenseReport($db);
|
||||||
$product_static=new Product($db);
|
$product_static=new Product($db);
|
||||||
$payment_static=new Paiement($db);
|
$payment_static=new Paiement($db);
|
||||||
$paymentfourn_static=new PaiementFourn($db);
|
$paymentfourn_static=new PaiementFourn($db);
|
||||||
|
$paymentexpensereport_static=new PaymentExpenseReport($db);
|
||||||
|
|
||||||
//print load_fiche_titre($langs->trans("VAT"),"");
|
//print load_fiche_titre($langs->trans("VAT"),"");
|
||||||
|
|
||||||
@ -149,16 +155,20 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
|
||||||
|
// Customers invoices
|
||||||
$elementcust=$langs->trans("CustomersInvoices");
|
$elementcust=$langs->trans("CustomersInvoices");
|
||||||
$productcust=$langs->trans("ProductOrService");
|
$productcust=$langs->trans("ProductOrService");
|
||||||
$amountcust=$langs->trans("AmountHT");
|
$amountcust=$langs->trans("AmountHT");
|
||||||
$vatcust=$langs->trans("VATReceived");
|
$vatcust=$langs->trans("VATReceived");
|
||||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
||||||
|
|
||||||
|
// Suppliers invoices
|
||||||
$elementsup=$langs->trans("SuppliersInvoices");
|
$elementsup=$langs->trans("SuppliersInvoices");
|
||||||
$productsup=$langs->trans("ProductOrService");
|
$productsup=$langs->trans("ProductOrService");
|
||||||
$amountsup=$langs->trans("AmountHT");
|
$amountsup=$langs->trans("AmountHT");
|
||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($modetax==0) // Invoice for goods, payment for services
|
if ($modetax==0) // Invoice for goods, payment for services
|
||||||
{
|
{
|
||||||
@ -185,26 +195,29 @@ if ($modetax==0) // Invoice for goods, payment for services
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
|
||||||
|
// Customers invoices
|
||||||
$elementcust=$langs->trans("CustomersInvoices");
|
$elementcust=$langs->trans("CustomersInvoices");
|
||||||
$productcust=$langs->trans("ProductOrService");
|
$productcust=$langs->trans("ProductOrService");
|
||||||
$amountcust=$langs->trans("AmountHT");
|
$amountcust=$langs->trans("AmountHT");
|
||||||
$vatcust=$langs->trans("VATReceived");
|
$vatcust=$langs->trans("VATReceived");
|
||||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
||||||
|
|
||||||
|
// Suppliers invoices
|
||||||
$elementsup=$langs->trans("SuppliersInvoices");
|
$elementsup=$langs->trans("SuppliersInvoices");
|
||||||
$productsup=$langs->trans("ProductOrService");
|
$productsup=$langs->trans("ProductOrService");
|
||||||
$amountsup=$langs->trans("AmountHT");
|
$amountsup=$langs->trans("AmountHT");
|
||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
|
|
||||||
}
|
}
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
$vatcust=$langs->trans("VATReceived");
|
$vatcust=$langs->trans("VATReceived");
|
||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
|
$vatexpensereport=$langs->trans("VATPaid");
|
||||||
|
|
||||||
// VAT Received and paid
|
// VAT Received and paid
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
echo '<table class="noborder" width="100%">';
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
$total = 0;
|
$total = 0;
|
||||||
@ -247,12 +260,12 @@ else
|
|||||||
'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
||||||
'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
||||||
'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
||||||
'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id],
|
'payment_id' =>$x_coll[$my_coll_rate]['payment_id'][$id],
|
||||||
'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
'payment_amount' =>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
||||||
'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
'ftotal_ttc' =>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
||||||
'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
'dtotal_ttc' =>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
||||||
'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
||||||
'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
'ddate_start' =>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
||||||
'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
||||||
'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
||||||
'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
||||||
@ -271,6 +284,32 @@ else
|
|||||||
$x_both[$my_paye_rate]['paye']['detail'] = array();
|
$x_both[$my_paye_rate]['paye']['detail'] = array();
|
||||||
|
|
||||||
foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy)
|
foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy)
|
||||||
|
{
|
||||||
|
// ExpenseReport
|
||||||
|
if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment')
|
||||||
|
{
|
||||||
|
$expensereport->id=$x_paye[$my_paye_rate]['facid'][$id];
|
||||||
|
$expensereport->ref=$x_paye[$my_paye_rate]['facnum'][$id];
|
||||||
|
$expensereport->type=$x_paye[$my_paye_rate]['type'][$id];
|
||||||
|
|
||||||
|
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
||||||
|
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||||
|
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||||
|
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||||
|
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||||
|
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||||
|
'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||||
|
'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||||
|
'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||||
|
'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||||
|
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||||
|
'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||||
|
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||||
|
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||||
|
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||||
|
'link' =>$expensereport->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
|
$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
|
||||||
$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
|
$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
|
||||||
@ -281,18 +320,19 @@ else
|
|||||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||||
'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id],
|
'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||||
'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||||
'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||||
'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||||
'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||||
'link' =>$invoice_supplier->getNomUrl(1,'',12));
|
'link' =>$invoice_supplier->getNomUrl(1,'',12));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//now we have an array (x_both) indexed by rates for coll and paye
|
//now we have an array (x_both) indexed by rates for coll and paye
|
||||||
|
|
||||||
|
|
||||||
@ -610,7 +650,7 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($x_paye) == 0) // Show a total ine if nothing shown
|
if (count($x_paye) == 0) // Show a total line if nothing shown
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|||||||
@ -515,6 +515,110 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expense Report
|
||||||
|
if ($direction == 'buy')
|
||||||
|
{
|
||||||
|
// Define sql request
|
||||||
|
$sql='';
|
||||||
|
|
||||||
|
// Count on payments date
|
||||||
|
$sql = "SELECT e.rowid, d.product_type as dtype, e.rowid as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
|
||||||
|
$sql .=" d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, ";
|
||||||
|
$sql.= " e.date_debut as date_start, e.date_fin as date_end,";
|
||||||
|
$sql.= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, s.nom as company_name, s.rowid as company_id, d.fk_c_type_fees as type,";
|
||||||
|
$sql.= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid, e.ref as pref";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."expensereport_det as d,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."expensereport as e,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."payment_expensereport as p";
|
||||||
|
$sql.= " WHERE e.entity = " . $conf->entity;
|
||||||
|
$sql.= " AND e.fk_statut in (6)";
|
||||||
|
$sql.= " AND e.rowid = p.fk_expensereport";
|
||||||
|
$sql.= " AND s.rowid = e.entity";
|
||||||
|
$sql.= " AND d.fk_expensereport = e.rowid";
|
||||||
|
if ($y && $m)
|
||||||
|
{
|
||||||
|
$sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($y,$m,false))."'";
|
||||||
|
$sql.= " AND p.datep <= '".$db->idate(dol_get_last_day($y,$m,false))."'";
|
||||||
|
}
|
||||||
|
else if ($y)
|
||||||
|
{
|
||||||
|
$sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($y,1,false))."'";
|
||||||
|
$sql.= " AND p.datep <= '".$db->idate(dol_get_last_day($y,12,false))."'";
|
||||||
|
}
|
||||||
|
if ($q) $sql.= " AND (date_format(p.datep,'%m') > ".(($q-1)*3)." AND date_format(p.datep,'%m') <= ".($q*3).")";
|
||||||
|
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
|
$sql.= " AND (d.product_type = -1";
|
||||||
|
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
|
||||||
|
$sql.= " ORDER BY e.rowid";
|
||||||
|
|
||||||
|
if (! $sql)
|
||||||
|
{
|
||||||
|
dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR);
|
||||||
|
return -1; // -1 = Not accountancy module enabled
|
||||||
|
}
|
||||||
|
if ($sql == 'TODO') return -2; // -2 = Feature not yet available
|
||||||
|
if ($sql != 'TODO')
|
||||||
|
{
|
||||||
|
dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$rate = -1;
|
||||||
|
$oldrowid='';
|
||||||
|
while($assoc = $db->fetch_array($resql))
|
||||||
|
{
|
||||||
|
if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0;
|
||||||
|
if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0;
|
||||||
|
if (! isset($list[$assoc['rate']]['localtax1'])) $list[$assoc['rate']]['localtax1']=0;
|
||||||
|
if (! isset($list[$assoc['rate']]['localtax2'])) $list[$assoc['rate']]['localtax2']=0;
|
||||||
|
|
||||||
|
if ($assoc['rowid'] != $oldrowid) // Si rupture sur d.rowid
|
||||||
|
{
|
||||||
|
$oldrowid=$assoc['rowid'];
|
||||||
|
$list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
|
||||||
|
$list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
|
||||||
|
$list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$list[$assoc['rate']]['vat'] = $assoc['total_vat'];
|
||||||
|
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||||
|
$list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment';
|
||||||
|
$list[$assoc['rate']]['datef'][] = $assoc['datef'];
|
||||||
|
$list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
|
||||||
|
$list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
|
||||||
|
$list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||||
|
$list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||||
|
|
||||||
|
$list[$assoc['rate']]['facid'][] = $assoc['facid'];
|
||||||
|
$list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
|
||||||
|
$list[$assoc['rate']]['type'][] = $assoc['type'];
|
||||||
|
$list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||||
|
$list[$assoc['rate']]['descr'][] = $assoc['descr'];
|
||||||
|
|
||||||
|
$list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
|
||||||
|
$list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
|
||||||
|
$list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||||
|
$list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||||
|
|
||||||
|
$list[$assoc['rate']]['pid'][] = $assoc['pid'];
|
||||||
|
$list[$assoc['rate']]['pref'][] = $assoc['pref'];
|
||||||
|
$list[$assoc['rate']]['ptype'][] = 'ExpenseReportPayment';
|
||||||
|
|
||||||
|
$list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
|
||||||
|
$list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
|
||||||
|
|
||||||
|
$rate = $assoc['rate'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1165,24 +1165,55 @@ class ExpenseReport extends CommonObject
|
|||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
|
* @param int $max Max length of shown ref
|
||||||
|
* @param int $short 1=Return just URL
|
||||||
|
* @param string $moretitle Add more text to title tooltip
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0)
|
function getNomUrl($withpicto=0,$max=0,$short=0,$moretitle='',$notooltip=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs, $conf;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?id='.$this->id.'">';
|
$url = DOL_URL_ROOT.'/expensereport/card.php?id='.$this->id;
|
||||||
$linkend='</a>';
|
|
||||||
|
if ($short) return $url;
|
||||||
|
|
||||||
$picto='trip';
|
$picto='trip';
|
||||||
|
$label = '<u>' . $langs->trans("ShowExpenseReport") . '</u>';
|
||||||
|
if (! empty($this->ref))
|
||||||
|
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
if (! empty($this->total_ht))
|
||||||
|
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
if (! empty($this->total_tva))
|
||||||
|
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
if (! empty($this->total_ttc))
|
||||||
|
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
if ($moretitle) $label.=' - '.$moretitle;
|
||||||
|
|
||||||
$label=$langs->trans("Show").': '.$this->ref;
|
$ref=$this->ref;
|
||||||
|
if (empty($ref)) $ref=$this->id;
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend);
|
$linkclose='';
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if (empty($notooltip))
|
||||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
{
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
|
{
|
||||||
|
$label=$langs->trans("ShowExpenseReport");
|
||||||
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
}
|
||||||
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
$linkclose.=' class="classfortooltip"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$linkstart = '<a href="'.$url.'"';
|
||||||
|
$linkstart.=$linkclose.'>';
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
|
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' ');
|
||||||
|
$result.=$linkstart.($max?dol_trunc($ref,$max):$ref).$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
# Dolibarr language file - Source file is en_US - trips
|
# Dolibarr language file - Source file is en_US - trips
|
||||||
ExpenseReport=Expense report
|
ExpenseReport=Expense report
|
||||||
ExpenseReports=Expense reports
|
ExpenseReports=Expense reports
|
||||||
|
ShowExpenseReport=Show expense report
|
||||||
Trips=Expense reports
|
Trips=Expense reports
|
||||||
TripsAndExpenses=Expenses reports
|
TripsAndExpenses=Expenses reports
|
||||||
TripsAndExpensesStatistics=Expense reports statistics
|
TripsAndExpensesStatistics=Expense reports statistics
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user