2
0
forked from Wavyzz/dolibarr

Try some fixes

This commit is contained in:
ldestailleur
2025-04-20 13:36:11 +02:00
parent 5158e565b8
commit 6ed5e7e175

View File

@@ -55,11 +55,11 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills', 'donation', 'salaries', 'accountancy', 'loan'));
$date_startmonth = GETPOSTINT('date_startmonth');
$date_startday = GETPOSTINT('date_startday');
$date_startmonth = GETPOSTINT('date_startmonth');
$date_startyear = GETPOSTINT('date_startyear');
$date_endmonth = GETPOSTINT('date_endmonth');
$date_endday = GETPOSTINT('date_endday');
$date_endmonth = GETPOSTINT('date_endmonth');
$date_endyear = GETPOSTINT('date_endyear');
$showaccountdetail = GETPOST('showaccountdetail', 'aZ09') ? GETPOST('showaccountdetail', 'aZ09') : 'yes';
@@ -83,16 +83,16 @@ if (!$sortorder) {
// Date range
$year = GETPOSTINT('year'); // this is used for navigation previous/next. It is the last year to show in filter
if (empty($year)) {
$year_current = dol_print_date(dol_now(), "%Y");
$month_current = dol_print_date(dol_now(), "%m");
$year_current = (int) dol_print_date(dol_now(), "%Y");
$month_current = (int) dol_print_date(dol_now(), "%m");
$year_start = $year_current;
} else {
$year_current = $year;
$month_current = dol_print_date(dol_now(), "%m");
$month_current = (int) dol_print_date(dol_now(), "%m");
$year_start = $year;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver');
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver');
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
@@ -107,10 +107,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_start--;
$year_end--;
}
if (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1) {
$month_end = $month_start - 1;
$year_end = $year_start + 1;
}
$month_end = $month_start - 1;
if ($month_end < 1) {
$month_end = 12;
}
@@ -149,8 +146,7 @@ $nbofyear = ($year_end - $year_start) + 1;
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = getDolGlobalString('ACCOUNTING_MODE');
if (isModEnabled('accounting')) {
// $modecompta = 'BOOKKEEPING';
$modecompta = 'CREANCES-DETTES';
$modecompta = 'BOOKKEEPING';
}
if (GETPOST("modecompta", 'alpha')) {
$modecompta = GETPOST("modecompta", 'alpha');
@@ -195,12 +191,24 @@ if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByProjects");
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesAmountWithTaxExcluded");
$description .= '<br>'.$langs->trans("RulesResultDue");
if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
$description .= "<br>".$langs->trans("DepositsAreNotIncluded");
} else {
$description .= "<br>".$langs->trans("DepositsAreIncluded");
}
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByProjects");
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesAmountWithTaxIncluded");
$description .= '<br>'.$langs->trans("RulesResultInOut");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") {
@@ -209,6 +217,8 @@ if ($modecompta == "CREANCES-DETTES") {
$arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
$period .= ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("DetailBy").'</span> '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesAmountOnInOutBookkeepingRecord");
$description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts")).')';
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
@@ -232,7 +242,13 @@ if (isModEnabled('accounting')) {
}
$calcmode .= '</label>';
report_header($name, '', $period, $periodlink, "", $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode);
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode);
/*
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1');
}
*/
// Show report array
$param = '&modecompta='.urlencode($modecompta).'&showaccountdetail='.urlencode($showaccountdetail);
@@ -288,7 +304,8 @@ $total_ht_outcome = $total_ttc_outcome = $total_ht_income = $total_ttc_income =
if ($modecompta == 'BOOKKEEPING') {
echo "<p>BOOKKEEPING mode not implemented for this report type by project.</p>";
} else {
}
if (isModEnabled('invoice') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
/*
* Customer invoices
*/
@@ -972,12 +989,14 @@ $parameters["date_start"] = $date_start;
$parameters["date_end"] = $date_end;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('addReportInfo', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
echo $hookmanager->resPrint;
// Total
$nbcols = 0;
echo '<tr>';
echo '<td colspan="'.($modecompta == 'BOOKKEEPING' ? 3 : 4).'">&nbsp;</td>';
echo '</tr>';