Fix report
This commit is contained in:
parent
bf441dda14
commit
9a253d50c9
@ -857,7 +857,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
//$column = 's.dateep'; // We use the date of salary
|
||||
$column = 'p.datep';
|
||||
} else {
|
||||
$column = 'p.datep';
|
||||
}
|
||||
@ -866,13 +867,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
||||
|
||||
// For backward compatibility with old module salary
|
||||
$column = 'p.datep';
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
|
||||
@ -417,10 +417,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($decaiss[$obj->dm])) {
|
||||
/*if (!isset($decaiss[$obj->dm])) {
|
||||
$decaiss[$obj->dm] = 0;
|
||||
}
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss[$obj->dm] += $obj->amount;*/
|
||||
|
||||
if (!isset($decaiss_ttc[$obj->dm])) {
|
||||
$decaiss_ttc[$obj->dm] = 0;
|
||||
@ -457,10 +457,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($encaiss[$obj->dm])) {
|
||||
/*if (!isset($encaiss[$obj->dm])) {
|
||||
$encaiss[$obj->dm] = 0;
|
||||
}
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss[$obj->dm] += $obj->amount;*/
|
||||
|
||||
if (!isset($encaiss_ttc[$obj->dm])) {
|
||||
$encaiss_ttc[$obj->dm] = 0;
|
||||
@ -493,10 +493,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($decaiss[$obj->dm])) {
|
||||
/*if (!isset($decaiss[$obj->dm])) {
|
||||
$decaiss[$obj->dm] = 0;
|
||||
}
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss[$obj->dm] += $obj->amount;*/
|
||||
|
||||
if (!isset($decaiss_ttc[$obj->dm])) {
|
||||
$decaiss_ttc[$obj->dm] = 0;
|
||||
@ -528,10 +528,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($encaiss[$obj->dm])) {
|
||||
/*if (!isset($encaiss[$obj->dm])) {
|
||||
$encaiss[$obj->dm] = 0;
|
||||
}
|
||||
$encaiss[$obj->dm] += -$obj->amount;
|
||||
$encaiss[$obj->dm] += -$obj->amount;*/
|
||||
|
||||
if (!isset($encaiss_ttc[$obj->dm])) {
|
||||
$encaiss_ttc[$obj->dm] = 0;
|
||||
@ -615,7 +615,8 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
|
||||
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 's.dateep';
|
||||
//$column = 's.dateep'; // we use the date of salary
|
||||
$column = 'p.datep';
|
||||
}
|
||||
if ($modecompta == "RECETTES-DEPENSES") {
|
||||
$column = 'p.datep';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user