diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 74685c8cbd6..91e53b694f5 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -49,7 +49,7 @@ $date_startyear = GETPOST('date_startyear', 'int'); $date_endmonth = GETPOST('date_endmonth', 'int'); $date_endday = GETPOST('date_endday', 'int'); $date_endyear = GETPOST('date_endyear', 'int'); -$showaccountdetail = GETPOST('showaccountdetail', 'aZ09') ?GETPOST('showaccountdetail', 'aZ09') : 'no'; +$showaccountdetail = GETPOST('showaccountdetail', 'aZ09') ? GETPOST('showaccountdetail', 'aZ09') : 'yes'; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -210,9 +210,9 @@ if ($modecompta == "CREANCES-DETTES") { $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); - $arraylist = array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); + $arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); $period .= '     '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); - $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); + $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesResultBookkeepingPredefined"); $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(); @@ -221,7 +221,7 @@ if ($modecompta == "CREANCES-DETTES") { $hselected = 'report'; -report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta), $calcmode); +report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); @@ -300,7 +300,6 @@ if ($modecompta == 'BOOKKEEPING') { $sql .= $db->order($sortfield, $sortorder); $oldpcgtype = ''; - $oldpcgsubtype = ''; dol_syslog("get bookkeeping entries", LOG_DEBUG); $result = $db->query($sql); @@ -313,19 +312,26 @@ if ($modecompta == 'BOOKKEEPING') { if ($showaccountdetail == 'no') { if ($objp->pcg_type != $oldpcgtype) { - print ''.$objp->pcg_type.''; + print ''.$objp->pcg_type.''; $oldpcgtype = $objp->pcg_type; } - } else { - print ''; - print ' '; - print ''.$objp->pcg_type; - print ($objp->name ? ' ('.$objp->name.')' : ''); - print "\n"; - print ''.price($objp->amount)."\n"; - print "\n"; } + print ''; + if ($showaccountdetail == 'no') { + print ''; + print ''; + print $objp->pcg_type; + print ($objp->name ? ' ('.$objp->name.')' : ' ('.$langs->trans("Unknown").')'); + print "\n"; + } else { + print ''; + print $objp->pcg_type; + print "\n"; + } + print ''.price($objp->amount)."\n"; + print "\n"; + $total_ht += (isset($objp->amount) ? $objp->amount : 0); $total_ttc += (isset($objp->amount) ? $objp->amount : 0); @@ -371,7 +377,7 @@ if ($modecompta == 'BOOKKEEPING') { $i++; } } else { - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } } else { dol_print_error($db); @@ -428,12 +434,15 @@ if ($modecompta == 'BOOKKEEPING') { while ($i < $num) { $objp = $db->fetch_object($result); - print ' '; + print ''; + print ' '; print "".$langs->trans("Bills").' '.$objp->name."\n"; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($objp->amount_ht)."\n"; + print ''.price($objp->amount_ht).""; } + print "\n"; print ''.price($objp->amount_ttc)."\n"; $total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0); @@ -473,12 +482,15 @@ if ($modecompta == 'BOOKKEEPING') { $objp = $db->fetch_object($result); - print ' '; + print ''; + print ' '; print "".$langs->trans("Bills")." ".$langs->trans("Other")." (".$langs->trans("PaymentsNotLinkedToInvoice").")\n"; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($objp->amount_ht)."\n"; + print ''.price($objp->amount_ht)."\n"; } + print ''; print ''.price($objp->amount_ttc)."\n"; $total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0); @@ -495,7 +507,8 @@ if ($modecompta == 'BOOKKEEPING') { } if ($total_ttc == 0) { - print ' '; + print ''; + print ' '; print ''.$langs->trans("None").''; print ''; } @@ -504,10 +517,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_income += $total_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($total_ht).''; + print price($total_ht); } - print ''.price($total_ttc).''; + print ''; + print ''.price($total_ttc).''; print ''; /* @@ -564,13 +581,16 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht += $obj->amount; $subtotal_ttc += $obj->amount; - print ' '; + print ''; + print ' '; print "".$langs->trans("Donation")." name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."\n"; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($obj->amount).''; + print ''.price($obj->amount).''; } + print ''; print ''.price($obj->amount).''; print ''; $i++; @@ -588,10 +608,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_income += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($subtotal_ht).''; + print price($subtotal_ht); } - print ''.price($subtotal_ttc).''; + print ''; + print ''.price($subtotal_ttc).''; print ''; } @@ -646,12 +670,15 @@ if ($modecompta == 'BOOKKEEPING') { while ($i < $num) { $objp = $db->fetch_object($result); - print ' '; + print ''; + print ' '; print "".$langs->trans("Bills").' '.$objp->name.''."\n"; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$objp->amount_ht)."\n"; + print ''.price(-$objp->amount_ht).""; } + print "\n"; print ''.price(-$objp->amount_ttc)."\n"; $total_ht -= (isset($objp->amount_ht) ? $objp->amount_ht : 0); @@ -663,7 +690,8 @@ if ($modecompta == 'BOOKKEEPING') { $i++; } } else { - print ' '; + print ''; + print ' '; print ''.$langs->trans("None").''; print ''; } @@ -677,10 +705,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_outcome += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$subtotal_ht).''; + print price(-$subtotal_ht); } - print ''.price(-$subtotal_ttc).''; + print ''; + print ''.price(-$subtotal_ttc).''; print ''; @@ -742,17 +774,21 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht += $obj->amount; $subtotal_ttc += $obj->amount; - print ' '; + print ''; + print ' '; print ''.$obj->label.''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; } + print ''; print ''.price(-$obj->amount).''; print ''; $i++; } } else { - print ' '; + print ''; + print ' '; print ''.$langs->trans("None").''; print ''; } @@ -764,10 +800,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_outcome += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$subtotal_ht).''; + print price(-$subtotal_ht); } - print ''.price(-$subtotal_ttc).''; + print ''; + print ''.price(-$subtotal_ttc).''; print ''; @@ -829,17 +869,21 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht += $obj->amount; $subtotal_ttc += $obj->amount; - print ' '; + print ''; + print ' '; print ''.$obj->label.''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; } + print ''; print ''.price(-$obj->amount).''; print ''; $i++; } } else { - print ' '; + print ''; + print ' '; print ''.$langs->trans("None").''; print ''; } @@ -851,10 +895,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_outcome += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$subtotal_ht).''; + print price(-$subtotal_ht); } - print ''.price(-$subtotal_ttc).''; + print ''; + print ''.price(-$subtotal_ttc).''; print ''; @@ -930,16 +978,18 @@ if ($modecompta == 'BOOKKEEPING') { $userstatic->fetch($obj->fk_user); print "".$langs->trans("Salary")." getFullName($langs))."\">".$obj->firstname." ".$obj->lastname."\n"; - + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; } + print ''; print ''.price(-$obj->amount).''; print ''; $i++; } } else { - print ' '; + print ''; + print ' '; print ''.$langs->trans("None").''; print ''; } @@ -951,10 +1001,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_outcome += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$subtotal_ht).''; + print price(-$subtotal_ht); } - print ''.price(-$subtotal_ttc).''; + print ''; + print ''.price(-$subtotal_ttc).''; print ''; } @@ -1013,18 +1067,20 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht += $obj->amount_ht; $subtotal_ttc += $obj->amount_ttc; - print ' '; - + print ''; + print ' '; print "".$langs->trans("ExpenseReport")." userid."\">".$obj->firstname." ".$obj->lastname."\n"; - + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$obj->amount_ht).''; + print ''.price(-$obj->amount_ht).''; } + print ''; print ''.price(-$obj->amount_ttc).''; print ''; } } else { - print ' '; + print ''; + print ' '; print ''.$langs->trans("None").''; print ''; } @@ -1036,10 +1092,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_outcome += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$subtotal_ht).''; + print price(-$subtotal_ht); } - print ''.price(-$subtotal_ttc).''; + print ''; + print ''.price(-$subtotal_ttc).''; print ''; } @@ -1076,11 +1136,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ht_outcome += $obj->amount; $total_ttc_outcome += $obj->amount; } - print ' '; + print ''; + print ' '; print "".$langs->trans("Debit")."\n"; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; } + print ''; print ''.price(-$obj->amount)."\n"; print "\n"; @@ -1095,9 +1158,11 @@ if ($modecompta == 'BOOKKEEPING') { } print ' '; print "".$langs->trans("Credit")."\n"; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($obj->amount).''; + print ''.price($obj->amount).''; } + print ''; print ''.price($obj->amount)."\n"; print "\n"; @@ -1105,10 +1170,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ht += $subtotal_ht; $total_ttc += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($subtotal_ht).''; + print price($subtotal_ht); } - print ''.price($subtotal_ttc).''; + print ''; + print ''.price($subtotal_ttc).''; print ''; } else { dol_print_error($db); @@ -1160,10 +1229,14 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_income += $subtotal_ttc; print ''; + print ''; + print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') { - print ''.price($subtotal_ht).''; + print price($subtotal_ht); } - print ''.price($subtotal_ttc).''; + print ''; + print ''.price($subtotal_ttc).''; print ''; } else { dol_print_error($db); @@ -1231,7 +1304,8 @@ if ($modecompta == 'BOOKKEEPING') { $total_ht_outcome -= 0; $total_ttc_outcome -= $amount; - print ' '; + print ''; + print ' '; print "".$langs->trans("VATToPay")."\n"; print ' '."\n"; print ''.price($amount)."\n"; @@ -1289,7 +1363,8 @@ if ($modecompta == 'BOOKKEEPING') { $total_ht_income += 0; $total_ttc_income += $amount; - print ' '; + print ''; + print ' '; print ''.$langs->trans("VATToCollect")."\n"; print ' '."\n"; print ''.price($amount)."\n"; @@ -1343,11 +1418,10 @@ if ($modecompta == 'BOOKKEEPING') { $total_ht_outcome -= 0; $total_ttc_outcome -= $amount; - print ' '; + print ''; + print ' '; print "".$langs->trans("VATPaid")."\n"; - if ($modecompta == 'CREANCES-DETTES') { - print ''."\n"; - } + print ''."\n"; print ''.price($amount)."\n"; print "\n"; @@ -1399,11 +1473,10 @@ if ($modecompta == 'BOOKKEEPING') { $total_ht_income += 0; $total_ttc_income += $amount; - print ' '; + print ''; + print ' '; print "".$langs->trans("VATCollected")."\n"; - if ($modecompta == 'CREANCES-DETTES') { - print ''."\n"; - } + print ''."\n"; print ''.price($amount)."\n"; print "\n"; } @@ -1411,10 +1484,10 @@ if ($modecompta == 'BOOKKEEPING') { if ($mysoc->tva_assuj != '0') { // Assujetti print ''; - if ($modecompta == 'CREANCES-DETTES') { - print ' '; - } - print ''.price(price2num($subtotal_ttc, 'MT')).''; + print ''; + print ''; + print ' '; + print ''.price(price2num($subtotal_ttc, 'MT')).''; print ''; } } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index aa7893b8490..6aab9093c05 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -60,11 +60,11 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end - $q = GETPOST("q") ?GETPOST("q") : 0; + $q = GETPOST("q") ? GETPOST("q", 'int') : 0; if ($q == 0) { // We define date_start and date_end $year_end = $year_start + ($nbofyear - 1); - $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (!GETPOST('month')) { if (!GETPOST("year") && $month_start > $month_current) { $year_start--;