Merge pull request #21096 from SylvainLegrand/Fix_accountancy_supplier_index_14
Fix deposit management on accountancy supplier index
This commit is contained in:
commit
edf116814d
@ -375,10 +375,14 @@ $sql .= " AND ff.fk_statut > 0";
|
|||||||
$sql .= " AND ffd.product_type <= 2";
|
$sql .= " AND ffd.product_type <= 2";
|
||||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
|
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND ff.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND ff.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.")";
|
||||||
|
}
|
||||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
$sql .= ' ORDER BY aa.account_number';
|
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -476,11 +480,17 @@ $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
|||||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||||
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||||
}
|
}
|
||||||
|
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND ff.fk_statut > 0";
|
$sql .= " AND ff.fk_statut > 0";
|
||||||
$sql .= " AND ffd.product_type <= 2";
|
$sql .= " AND ffd.product_type <= 2";
|
||||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND ff.type IN (".FactureFournisseur::TYPE_STANDARD.", ".FactureFournisseur::TYPE_REPLACEMENT.", ".FactureFournisseur::TYPE_CREDIT_NOTE.")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND ff.type IN (".FactureFournisseur::TYPE_STANDARD.", ".FactureFournisseur::TYPE_REPLACEMENT.", ".FactureFournisseur::TYPE_CREDIT_NOTE.", ".FactureFournisseur::TYPE_DEPOSIT.")";
|
||||||
|
}
|
||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
$sql .= ' ORDER BY aa.account_number';
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -496,13 +506,15 @@ if ($resql) {
|
|||||||
print length_accountg($row[0]);
|
print length_accountg($row[0]);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
|
||||||
|
print '<td class="left">';
|
||||||
if ($row[0] == 'tobind') {
|
if ($row[0] == 'tobind') {
|
||||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||||
} else {
|
} else {
|
||||||
print $row[1];
|
print $row[1];
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
for ($i = 2; $i <= 13; $i++) {
|
for ($i = 2; $i <= 13; $i++) {
|
||||||
print '<td class="right nowraponall amount">';
|
print '<td class="right nowraponall amount">';
|
||||||
print price($row[$i]);
|
print price($row[$i]);
|
||||||
@ -525,7 +537,6 @@ print "</table>\n";
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -562,9 +573,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
|||||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||||
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||||
}
|
}
|
||||||
|
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||||
$sql .= " AND ff.fk_statut > 0";
|
$sql .= " AND ff.fk_statut > 0";
|
||||||
$sql .= " AND ffd.product_type <= 2";
|
$sql .= " AND ffd.product_type <= 2";
|
||||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND ff.type IN (".FactureFournisseur::TYPE_STANDARD.", ".FactureFournisseur::TYPE_REPLACEMENT.", ".FactureFournisseur::TYPE_CREDIT_NOTE.")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND ff.type IN (".FactureFournisseur::TYPE_STANDARD.", ".FactureFournisseur::TYPE_REPLACEMENT.", ".FactureFournisseur::TYPE_CREDIT_NOTE.", ".FactureFournisseur::TYPE_DEPOSIT.")";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user