Add exepnse report into accoutnacy standard report
This commit is contained in:
parent
b95e9f0097
commit
0582c78131
@ -665,13 +665,10 @@ if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
while ($obj = $db->fetch_object($result))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$total_ht -= $obj->amount_ht;
|
||||
$total_ttc -= $obj->amount_ttc;
|
||||
$subtotal_ht += $obj->amount_ht;
|
||||
@ -685,7 +682,6 @@ if (! empty($conf->expensereport->enabled))
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount_ht).'</td>';
|
||||
print '<td align="right">'.price(-$obj->amount_ttc).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -521,6 +521,58 @@ if (! empty($conf->salaries->enabled))
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
$langs->load('trips');
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
$sql.= " AND p.fk_statut>5";
|
||||
|
||||
$column='p.date_valid';
|
||||
|
||||
} else {
|
||||
$sql = "SELECT date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
$sql.= " AND p.fk_statut=6";
|
||||
|
||||
$column='pe.datep';
|
||||
}
|
||||
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get expense report outcome");
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
if ($num)
|
||||
{
|
||||
while ($obj = $db->fetch_object($result))
|
||||
{
|
||||
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
|
||||
$decaiss[$obj->dm] += $obj->amount_ht;
|
||||
|
||||
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Donation get dunning paiement
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user