@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | // Security check |
56 | 56 | $socid = GETPOST('socid', 'int'); |
57 | -if ($user->socid) $socid = $user->socid; |
|
57 | +if ($user->socid) { |
|
58 | + $socid = $user->socid; |
|
59 | +} |
|
58 | 60 | $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges'); |
59 | 61 | |
60 | 62 | $object = new ChargeSociales($db); |
@@ -98,17 +100,19 @@ discard block |
||
98 | 100 | { |
99 | 101 | $object->fetch($id); |
100 | 102 | $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); |
101 | - if ($result < 0) |
|
102 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
103 | -} |
|
103 | + if ($result < 0) { |
|
104 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
105 | + } |
|
106 | + } |
|
104 | 107 | |
105 | 108 | // payment mode |
106 | 109 | if ($action == 'setmode' && $user->rights->tax->charges->creer) { |
107 | 110 | $object->fetch($id); |
108 | 111 | $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
109 | - if ($result < 0) |
|
110 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
111 | -} |
|
112 | + if ($result < 0) { |
|
113 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
114 | + } |
|
115 | + } |
|
112 | 116 | |
113 | 117 | // bank account |
114 | 118 | if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) { |
@@ -242,8 +246,12 @@ discard block |
||
242 | 246 | } else { |
243 | 247 | $newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int')); |
244 | 248 | $newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int')); |
245 | - if ($newdateperiod) $object->periode = $newdateperiod; |
|
246 | - if ($newdateech) $object->date_ech = $newdateech; |
|
249 | + if ($newdateperiod) { |
|
250 | + $object->periode = $newdateperiod; |
|
251 | + } |
|
252 | + if ($newdateech) { |
|
253 | + $object->date_ech = $newdateech; |
|
254 | + } |
|
247 | 255 | } |
248 | 256 | |
249 | 257 | if ($object->check()) |
@@ -534,8 +542,9 @@ discard block |
||
534 | 542 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
535 | 543 | print $langs->trans('PaymentMode'); |
536 | 544 | print '</td>'; |
537 | - if ($action != 'editmode') |
|
538 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
545 | + if ($action != 'editmode') { |
|
546 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
547 | + } |
|
539 | 548 | print '</tr></table>'; |
540 | 549 | print '</td><td>'; |
541 | 550 | if ($action == 'editmode') { |
@@ -552,8 +561,9 @@ discard block |
||
552 | 561 | print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; |
553 | 562 | print $langs->trans('BankAccount'); |
554 | 563 | print '<td>'; |
555 | - if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) |
|
556 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; |
|
564 | + if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) { |
|
565 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; |
|
566 | + } |
|
557 | 567 | print '</tr></table>'; |
558 | 568 | print '</td><td>'; |
559 | 569 | if ($action == 'editbankaccount') { |
@@ -641,8 +651,9 @@ discard block |
||
641 | 651 | } |
642 | 652 | |
643 | 653 | print '<td class="right">'; |
644 | - if ($bankaccountstatic->id) |
|
645 | - print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
654 | + if ($bankaccountstatic->id) { |
|
655 | + print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
656 | + } |
|
646 | 657 | print '</td>'; |
647 | 658 | } |
648 | 659 | print '<td class="right">'.price($objp->amount)."</td>\n"; |
@@ -690,7 +701,9 @@ discard block |
||
690 | 701 | print '</div>'; |
691 | 702 | } |
692 | 703 | |
693 | - if ($action == 'edit') print "</form>\n"; |
|
704 | + if ($action == 'edit') { |
|
705 | + print "</form>\n"; |
|
706 | + } |
|
694 | 707 | |
695 | 708 | |
696 | 709 |
@@ -34,13 +34,17 @@ discard block |
||
34 | 34 | $id = GETPOST("id", 'int'); |
35 | 35 | $action = GETPOST("action", "alpha"); |
36 | 36 | $refund = GETPOST("refund", "int"); |
37 | -if (empty($refund)) $refund = 0; |
|
37 | +if (empty($refund)) { |
|
38 | + $refund = 0; |
|
39 | +} |
|
38 | 40 | |
39 | 41 | $lttype = GETPOST('localTaxType', 'int'); |
40 | 42 | |
41 | 43 | // Security check |
42 | 44 | $socid = GETPOST('socid', 'int'); |
43 | -if ($user->socid) $socid = $user->socid; |
|
45 | +if ($user->socid) { |
|
46 | + $socid = $user->socid; |
|
47 | +} |
|
44 | 48 | $result = restrictedArea($user, 'tax', '', '', 'charges'); |
45 | 49 | |
46 | 50 | $object = new Localtax($db); |
@@ -103,7 +107,10 @@ discard block |
||
103 | 107 | { |
104 | 108 | $accountline = new AccountLine($db); |
105 | 109 | $result = $accountline->fetch($object->fk_bank); |
106 | - if ($result > 0) $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) |
|
110 | + if ($result > 0) { |
|
111 | + $result = $accountline->delete($user); |
|
112 | + } |
|
113 | + // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) |
|
107 | 114 | } |
108 | 115 | |
109 | 116 | if ($result >= 0) |
@@ -47,9 +47,11 @@ discard block |
||
47 | 47 | } |
48 | 48 | $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); |
49 | 49 | $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); |
50 | -if (empty($date_start) || empty($date_end)) // We define date_start and date_end |
|
50 | +if (empty($date_start) || empty($date_end)) { |
|
51 | + // We define date_start and date_end |
|
51 | 52 | { |
52 | 53 | $q = GETPOST("q", "int"); |
54 | +} |
|
53 | 55 | if (empty($q)) |
54 | 56 | { |
55 | 57 | if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { |
@@ -67,12 +69,18 @@ discard block |
||
67 | 69 | // Define modetax (0 or 1) |
68 | 70 | // 0=normal, 1=option vat for services is on debit, 2=option on payments for products |
69 | 71 | $modetax = $conf->global->TAX_MODE; |
70 | -if (GETPOSTISSET("modetax")) $modetax = GETPOST("modetax", 'int'); |
|
71 | -if (empty($modetax)) $modetax = 0; |
|
72 | +if (GETPOSTISSET("modetax")) { |
|
73 | + $modetax = GETPOST("modetax", 'int'); |
|
74 | +} |
|
75 | +if (empty($modetax)) { |
|
76 | + $modetax = 0; |
|
77 | +} |
|
72 | 78 | |
73 | 79 | // Security check |
74 | 80 | $socid = GETPOST('socid', 'int'); |
75 | -if ($user->socid) $socid = $user->socid; |
|
81 | +if ($user->socid) { |
|
82 | + $socid = $user->socid; |
|
83 | +} |
|
76 | 84 | $result = restrictedArea($user, 'tax', '', '', 'charges'); |
77 | 85 | |
78 | 86 | |
@@ -281,11 +289,15 @@ discard block |
||
281 | 289 | |
282 | 290 | $total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0; |
283 | 291 | $i = 0; $mcursor = 0; |
284 | -while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mcursor is to avoid too large loop |
|
292 | +while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { |
|
293 | + // $mcursor is to avoid too large loop |
|
285 | 294 | { |
286 | 295 | //$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12); |
287 | 296 | if ($m == 13) $y++; |
288 | - if ($m > 12) $m -= 12; |
|
297 | +} |
|
298 | + if ($m > 12) { |
|
299 | + $m -= 12; |
|
300 | + } |
|
289 | 301 | $mcursor++; |
290 | 302 | |
291 | 303 | // Get array with details of each line |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | $socid = $user->socid; |
37 | 37 | } |
38 | 38 | |
39 | -if (!$user->rights->facture->lire) |
|
40 | -accessforbidden(); |
|
39 | +if (!$user->rights->facture->lire) { |
|
40 | + accessforbidden(); |
|
41 | +} |
|
41 | 42 | |
42 | 43 | // Load translation files required by the page |
43 | 44 | $langs->load("companies"); |
@@ -52,8 +53,12 @@ discard block |
||
52 | 53 | $offset = $limit * $page; |
53 | 54 | $pageprev = $page - 1; |
54 | 55 | $pagenext = $page + 1; |
55 | -if (!$sortorder) $sortorder = "ASC"; |
|
56 | -if (!$sortfield) $sortfield = "nom"; |
|
56 | +if (!$sortorder) { |
|
57 | + $sortorder = "ASC"; |
|
58 | +} |
|
59 | +if (!$sortfield) { |
|
60 | + $sortfield = "nom"; |
|
61 | +} |
|
57 | 62 | |
58 | 63 | |
59 | 64 | /* |
@@ -90,12 +95,18 @@ discard block |
||
90 | 95 | |
91 | 96 | $sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea"; |
92 | 97 | $sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta "; |
93 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; |
|
98 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
99 | + $sql .= ", sc.fk_soc, sc.fk_user "; |
|
100 | +} |
|
94 | 101 | $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st"; |
95 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
102 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
103 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
104 | +} |
|
96 | 105 | $sql .= " WHERE s.fk_stcomm = st.id AND s.client in (1, 3)"; |
97 | 106 | $sql .= " AND s.entity IN (".getEntity('societe').")"; |
98 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
107 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
108 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
109 | +} |
|
99 | 110 | if (dol_strlen($stcomm)) |
100 | 111 | { |
101 | 112 | $sql .= " AND s.fk_stcomm=".$stcomm; |
@@ -71,9 +71,11 @@ discard block |
||
71 | 71 | $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); |
72 | 72 | |
73 | 73 | // We define date_start and date_end |
74 | -if (empty($date_start) || empty($date_end)) // We define date_start and date_end |
|
74 | +if (empty($date_start) || empty($date_end)) { |
|
75 | + // We define date_start and date_end |
|
75 | 76 | { |
76 | 77 | $q = GETPOST("q") ?GETPOST("q") : 0; |
78 | +} |
|
77 | 79 | if ($q == 0) |
78 | 80 | { |
79 | 81 | // We define date_start and date_end |
@@ -88,9 +90,14 @@ discard block |
||
88 | 90 | $year_end--; |
89 | 91 | } |
90 | 92 | $month_end = $month_start - 1; |
91 | - if ($month_end < 1) $month_end = 12; |
|
92 | - else $year_end++; |
|
93 | - } else $month_end = $month_start; |
|
93 | + if ($month_end < 1) { |
|
94 | + $month_end = 12; |
|
95 | + } else { |
|
96 | + $year_end++; |
|
97 | + } |
|
98 | + } else { |
|
99 | + $month_end = $month_start; |
|
100 | + } |
|
94 | 101 | $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); |
95 | 102 | } |
96 | 103 | if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } |
@@ -125,14 +132,20 @@ discard block |
||
125 | 132 | |
126 | 133 | // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') |
127 | 134 | $modecompta = $conf->global->ACCOUNTING_MODE; |
128 | -if (!empty($conf->accounting->enabled)) $modecompta = 'BOOKKEEPING'; |
|
129 | -if (GETPOST("modecompta")) $modecompta = GETPOST("modecompta", 'alpha'); |
|
135 | +if (!empty($conf->accounting->enabled)) { |
|
136 | + $modecompta = 'BOOKKEEPING'; |
|
137 | +} |
|
138 | +if (GETPOST("modecompta")) { |
|
139 | + $modecompta = GETPOST("modecompta", 'alpha'); |
|
140 | +} |
|
130 | 141 | |
131 | 142 | // Security check |
132 | -if ($user->socid > 0) |
|
143 | +if ($user->socid > 0) { |
|
133 | 144 | accessforbidden(); |
134 | -if (!$user->rights->accounting->comptarapport->lire) |
|
145 | +} |
|
146 | +if (!$user->rights->accounting->comptarapport->lire) { |
|
135 | 147 | accessforbidden(); |
148 | +} |
|
136 | 149 | |
137 | 150 | $AccCat = new AccountancyCategory($db); |
138 | 151 | |
@@ -172,19 +185,26 @@ discard block |
||
172 | 185 | $name = $langs->trans("AnnualByAccountDueDebtMode"); |
173 | 186 | $calcmode = $langs->trans("CalcModeDebt"); |
174 | 187 | $calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=RECETTES-DEPENSES">', '</a>').')'; |
175 | - if (!empty($conf->accounting->enabled)) $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">', '</a>').')'; |
|
188 | + if (!empty($conf->accounting->enabled)) { |
|
189 | + $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">', '</a>').')'; |
|
190 | + } |
|
176 | 191 | $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); |
177 | 192 | //$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; |
178 | 193 | $description = $langs->trans("RulesResultDue"); |
179 | - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); |
|
180 | - else $description .= $langs->trans("DepositsAreIncluded"); |
|
194 | + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
|
195 | + $description .= $langs->trans("DepositsAreNotIncluded"); |
|
196 | + } else { |
|
197 | + $description .= $langs->trans("DepositsAreIncluded"); |
|
198 | + } |
|
181 | 199 | $builddate = dol_now(); |
182 | 200 | //$exportlink=$langs->trans("NotYetAvailable"); |
183 | 201 | } elseif ($modecompta == "RECETTES-DEPENSES") { |
184 | 202 | $name = $langs->trans("AnnualByAccountInputOutputMode"); |
185 | 203 | $calcmode = $langs->trans("CalcModeEngagement"); |
186 | 204 | $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=CREANCES-DETTES">', '</a>').')'; |
187 | - if (!empty($conf->accounting->enabled)) $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">', '</a>').')'; |
|
205 | + if (!empty($conf->accounting->enabled)) { |
|
206 | + $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">', '</a>').')'; |
|
207 | + } |
|
188 | 208 | $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); |
189 | 209 | //$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; |
190 | 210 | $description = $langs->trans("RulesResultInOut"); |
@@ -386,10 +406,12 @@ discard block |
||
386 | 406 | $cpts = $AccCat->getCptsCat($cat['rowid']); |
387 | 407 | |
388 | 408 | $arrayofaccountforfilter = array(); |
389 | - foreach ($cpts as $i => $cpt) // Loop on each account. |
|
409 | + foreach ($cpts as $i => $cpt) { |
|
410 | + // Loop on each account. |
|
390 | 411 | { |
391 | 412 | $arrayofaccountforfilter[] = $cpt['account_number']; |
392 | 413 | } |
414 | + } |
|
393 | 415 | |
394 | 416 | // N-1 |
395 | 417 | if (!empty($arrayofaccountforfilter)) { |
@@ -399,9 +421,11 @@ discard block |
||
399 | 421 | setEventMessages(null, $AccCat->errors, 'errors'); |
400 | 422 | $resultNP = 0; |
401 | 423 | } else { |
402 | - foreach ($cpts as $i => $cpt) // Loop on each account. |
|
424 | + foreach ($cpts as $i => $cpt) { |
|
425 | + // Loop on each account. |
|
403 | 426 | { |
404 | 427 | $resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']]) ? 0 : $AccCat->sdcperaccount[$cpt['account_number']]; |
428 | + } |
|
405 | 429 | |
406 | 430 | $totCat['NP'] += $resultNP; |
407 | 431 | $sommes[$code]['NP'] += $resultNP; |
@@ -412,18 +436,21 @@ discard block |
||
412 | 436 | |
413 | 437 | // Set value into column N and month M ($totCat) |
414 | 438 | // This make 12 calls for each accountancy account (12 monthes M) |
415 | - foreach ($cpts as $i => $cpt) // Loop on each account. |
|
439 | + foreach ($cpts as $i => $cpt) { |
|
440 | + // Loop on each account. |
|
416 | 441 | { |
417 | 442 | // We make 1 loop for each account because we may want detail per account. |
418 | 443 | // @todo Optimize to ask a 'group by' account and a filter with account in (..., ...) in request |
419 | 444 | |
420 | 445 | // Each month |
421 | 446 | $resultN = 0; |
447 | + } |
|
422 | 448 | foreach ($months as $k => $v) { |
423 | 449 | $monthtoprocess = $k + 1; // ($k+1) is month 1, 2, ..., 12 |
424 | 450 | $yeartoprocess = $start_year; |
425 | - if (($k + 1) < $start_month) |
|
426 | - $yeartoprocess++; |
|
451 | + if (($k + 1) < $start_month) { |
|
452 | + $yeartoprocess++; |
|
453 | + } |
|
427 | 454 | |
428 | 455 | //var_dump($monthtoprocess.'_'.$yeartoprocess); |
429 | 456 | $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc'] ? $cat['dc'] : 0, 'nofilter', $monthtoprocess, $yeartoprocess); |
@@ -458,22 +485,27 @@ discard block |
||
458 | 485 | // Label of group |
459 | 486 | print '<td>'; |
460 | 487 | print $cat['label']; |
461 | - if (count($cpts) > 0) // Show example of 5 first accounting accounts |
|
488 | + if (count($cpts) > 0) { |
|
489 | + // Show example of 5 first accounting accounts |
|
462 | 490 | { |
463 | 491 | $i = 0; |
492 | + } |
|
464 | 493 | foreach ($cpts as $cpt) { |
465 | 494 | if ($i > 5) { |
466 | 495 | print '...)'; |
467 | 496 | break; |
468 | 497 | } |
469 | - if ($i > 0) |
|
470 | - print ', '; |
|
471 | - else print ' ('; |
|
498 | + if ($i > 0) { |
|
499 | + print ', '; |
|
500 | + } else { |
|
501 | + print ' ('; |
|
502 | + } |
|
472 | 503 | print $cpt['account_number']; |
473 | 504 | $i++; |
474 | 505 | } |
475 | - if ($i <= 5) |
|
476 | - print ')'; |
|
506 | + if ($i <= 5) { |
|
507 | + print ')'; |
|
508 | + } |
|
477 | 509 | } else { |
478 | 510 | print ' - <span class="warning">'.$langs->trans("GroupIsEmptyCheckSetup").'</span>'; |
479 | 511 | } |
@@ -484,12 +516,14 @@ discard block |
||
484 | 516 | |
485 | 517 | // Each month |
486 | 518 | foreach ($totCat['M'] as $k => $v) { |
487 | - if (($k + 1) >= $date_startmonth) |
|
488 | - print '<td class="right">'.price($v).'</td>'; |
|
519 | + if (($k + 1) >= $date_startmonth) { |
|
520 | + print '<td class="right">'.price($v).'</td>'; |
|
521 | + } |
|
489 | 522 | } |
490 | 523 | foreach ($totCat['M'] as $k => $v) { |
491 | - if (($k + 1) < $date_startmonth) |
|
492 | - print '<td class="right">'.price($v).'</td>'; |
|
524 | + if (($k + 1) < $date_startmonth) { |
|
525 | + print '<td class="right">'.price($v).'</td>'; |
|
526 | + } |
|
493 | 527 | } |
494 | 528 | |
495 | 529 | print "</tr>\n"; |
@@ -88,14 +88,30 @@ discard block |
||
88 | 88 | |
89 | 89 | // Clean parameters |
90 | 90 | |
91 | - if (isset($this->code)) $this->code = trim($this->code); |
|
92 | - if (isset($this->sortorder)) $this->sortorder = trim($this->sortorder); |
|
93 | - if (isset($this->active)) $this->active = trim($this->active); |
|
94 | - if (isset($this->libelle)) $this->libelle = trim($this->libelle); |
|
95 | - if (isset($this->libelle_facture)) $this->libelle_facture = trim($this->libelle_facture); |
|
96 | - if (isset($this->type_cdr)) $this->type_cdr = trim($this->type_cdr); |
|
97 | - if (isset($this->nbjour)) $this->nbjour = trim($this->nbjour); |
|
98 | - if (isset($this->decalage)) $this->decalage = trim($this->decalage); |
|
91 | + if (isset($this->code)) { |
|
92 | + $this->code = trim($this->code); |
|
93 | + } |
|
94 | + if (isset($this->sortorder)) { |
|
95 | + $this->sortorder = trim($this->sortorder); |
|
96 | + } |
|
97 | + if (isset($this->active)) { |
|
98 | + $this->active = trim($this->active); |
|
99 | + } |
|
100 | + if (isset($this->libelle)) { |
|
101 | + $this->libelle = trim($this->libelle); |
|
102 | + } |
|
103 | + if (isset($this->libelle_facture)) { |
|
104 | + $this->libelle_facture = trim($this->libelle_facture); |
|
105 | + } |
|
106 | + if (isset($this->type_cdr)) { |
|
107 | + $this->type_cdr = trim($this->type_cdr); |
|
108 | + } |
|
109 | + if (isset($this->nbjour)) { |
|
110 | + $this->nbjour = trim($this->nbjour); |
|
111 | + } |
|
112 | + if (isset($this->decalage)) { |
|
113 | + $this->decalage = trim($this->decalage); |
|
114 | + } |
|
99 | 115 | |
100 | 116 | |
101 | 117 | // Check parameters |
@@ -231,7 +247,9 @@ discard block |
||
231 | 247 | if ($this->db->num_rows($resql)) |
232 | 248 | { |
233 | 249 | $obj = $this->db->fetch_object($resql); |
234 | - if ($obj) $ret = $obj->rowid; |
|
250 | + if ($obj) { |
|
251 | + $ret = $obj->rowid; |
|
252 | + } |
|
235 | 253 | } |
236 | 254 | $this->db->free($resql); |
237 | 255 | return $ret; |
@@ -257,14 +275,30 @@ discard block |
||
257 | 275 | |
258 | 276 | // Clean parameters |
259 | 277 | |
260 | - if (isset($this->code)) $this->code = trim($this->code); |
|
261 | - if (isset($this->sortorder)) $this->sortorder = trim($this->sortorder); |
|
262 | - if (isset($this->active)) $this->active = trim($this->active); |
|
263 | - if (isset($this->libelle)) $this->libelle = trim($this->libelle); |
|
264 | - if (isset($this->libelle_facture)) $this->libelle_facture = trim($this->libelle_facture); |
|
265 | - if (isset($this->type_cdr)) $this->type_cdr = trim($this->type_cdr); |
|
266 | - if (isset($this->nbjour)) $this->nbjour = trim($this->nbjour); |
|
267 | - if (isset($this->decalage)) $this->decalage = trim($this->decalage); |
|
278 | + if (isset($this->code)) { |
|
279 | + $this->code = trim($this->code); |
|
280 | + } |
|
281 | + if (isset($this->sortorder)) { |
|
282 | + $this->sortorder = trim($this->sortorder); |
|
283 | + } |
|
284 | + if (isset($this->active)) { |
|
285 | + $this->active = trim($this->active); |
|
286 | + } |
|
287 | + if (isset($this->libelle)) { |
|
288 | + $this->libelle = trim($this->libelle); |
|
289 | + } |
|
290 | + if (isset($this->libelle_facture)) { |
|
291 | + $this->libelle_facture = trim($this->libelle_facture); |
|
292 | + } |
|
293 | + if (isset($this->type_cdr)) { |
|
294 | + $this->type_cdr = trim($this->type_cdr); |
|
295 | + } |
|
296 | + if (isset($this->nbjour)) { |
|
297 | + $this->nbjour = trim($this->nbjour); |
|
298 | + } |
|
299 | + if (isset($this->decalage)) { |
|
300 | + $this->decalage = trim($this->decalage); |
|
301 | + } |
|
268 | 302 | |
269 | 303 | |
270 | 304 |
@@ -47,9 +47,15 @@ discard block |
||
47 | 47 | $date_endyear = GETPOST('date_endyear'); |
48 | 48 | |
49 | 49 | // Security check |
50 | -if ($user->socid > 0) $socid = $user->socid; |
|
51 | -if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat'); |
|
52 | -if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); |
|
50 | +if ($user->socid > 0) { |
|
51 | + $socid = $user->socid; |
|
52 | +} |
|
53 | +if (!empty($conf->comptabilite->enabled)) { |
|
54 | + $result = restrictedArea($user, 'compta', '', '', 'resultat'); |
|
55 | +} |
|
56 | +if (!empty($conf->accounting->enabled)) { |
|
57 | + $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); |
|
58 | +} |
|
53 | 59 | |
54 | 60 | /* |
55 | 61 | * Actions |
@@ -82,9 +88,12 @@ discard block |
||
82 | 88 | $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); |
83 | 89 | $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); |
84 | 90 | |
85 | -if (empty($date_start) || empty($date_end)) // We define date_start and date_end |
|
91 | +if (empty($date_start) || empty($date_end)) { |
|
92 | + // We define date_start and date_end |
|
86 | 93 | { |
87 | - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); |
|
94 | + $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); |
|
95 | +} |
|
96 | +$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); |
|
88 | 97 | } |
89 | 98 | |
90 | 99 | $name = $langs->trans("SellsJournal"); |
@@ -92,8 +101,11 @@ discard block |
||
92 | 101 | $exportlink = ''; |
93 | 102 | $builddate = dol_now(); |
94 | 103 | $description = $langs->trans("DescSellsJournal").'<br>'; |
95 | -if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); |
|
96 | -else $description .= $langs->trans("DepositsAreIncluded"); |
|
104 | +if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
|
105 | + $description .= $langs->trans("DepositsAreNotIncluded"); |
|
106 | +} else { |
|
107 | + $description .= $langs->trans("DepositsAreIncluded"); |
|
108 | +} |
|
97 | 109 | $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); |
98 | 110 | report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink); |
99 | 111 | |
@@ -119,11 +131,15 @@ discard block |
||
119 | 131 | } |
120 | 132 | |
121 | 133 | $sql .= " AND fd.product_type IN (0,1)"; |
122 | -if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; |
|
134 | +if ($date_start && $date_end) { |
|
135 | + $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; |
|
136 | +} |
|
123 | 137 | $sql .= " ORDER BY f.rowid"; |
124 | 138 | |
125 | 139 | // TODO Find a better trick to avoid problem with some mysql installations |
126 | -if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1'); |
|
140 | +if (in_array($db->type, array('mysql', 'mysqli'))) { |
|
141 | + $db->query('SET SQL_BIG_SELECTS=1'); |
|
142 | +} |
|
127 | 143 | |
128 | 144 | $result = $db->query($sql); |
129 | 145 | if ($result) |
@@ -150,8 +166,11 @@ discard block |
||
150 | 166 | $compta_prod = $obj->accountancy_code_sell; |
151 | 167 | if (empty($compta_prod)) |
152 | 168 | { |
153 | - if ($obj->product_type == 0) $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); |
|
154 | - else $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); |
|
169 | + if ($obj->product_type == 0) { |
|
170 | + $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); |
|
171 | + } else { |
|
172 | + $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); |
|
173 | + } |
|
155 | 174 | } |
156 | 175 | $cpttva = (!empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); |
157 | 176 | $compta_tva = (!empty($obj->account_tva) ? $obj->account_tva : $cpttva); |
@@ -181,14 +200,26 @@ discard block |
||
181 | 200 | $tabfac[$obj->rowid]["date"] = $obj->datef; |
182 | 201 | $tabfac[$obj->rowid]["ref"] = $obj->ref; |
183 | 202 | $tabfac[$obj->rowid]["type"] = $obj->type; |
184 | - if (!isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0; |
|
185 | - if (!isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0; |
|
186 | - if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0; |
|
187 | - if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; |
|
188 | - if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; |
|
203 | + if (!isset($tabttc[$obj->rowid][$compta_soc])) { |
|
204 | + $tabttc[$obj->rowid][$compta_soc] = 0; |
|
205 | + } |
|
206 | + if (!isset($tabht[$obj->rowid][$compta_prod])) { |
|
207 | + $tabht[$obj->rowid][$compta_prod] = 0; |
|
208 | + } |
|
209 | + if (!isset($tabtva[$obj->rowid][$compta_tva])) { |
|
210 | + $tabtva[$obj->rowid][$compta_tva] = 0; |
|
211 | + } |
|
212 | + if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) { |
|
213 | + $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; |
|
214 | + } |
|
215 | + if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) { |
|
216 | + $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; |
|
217 | + } |
|
189 | 218 | $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio; |
190 | 219 | $tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio; |
191 | - if ($obj->recuperableonly != 1) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; |
|
220 | + if ($obj->recuperableonly != 1) { |
|
221 | + $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; |
|
222 | + } |
|
192 | 223 | $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1; |
193 | 224 | $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2; |
194 | 225 | $tabcompany[$obj->rowid] = array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client); |
@@ -296,8 +296,9 @@ |
||
296 | 296 | { |
297 | 297 | $namef = "amount_".$objp->id; |
298 | 298 | $nameRemain = "remain_".$objp->id; |
299 | - if (!empty($conf->use_javascript_ajax)) |
|
300 | - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'"); |
|
299 | + if (!empty($conf->use_javascript_ajax)) { |
|
300 | + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'"); |
|
301 | + } |
|
301 | 302 | $remaintopay = $objp->amount - $sumpaid; |
302 | 303 | print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">'; |
303 | 304 | print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">'; |
@@ -56,25 +56,32 @@ discard block |
||
56 | 56 | $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); |
57 | 57 | $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); |
58 | 58 | // Quarter |
59 | -if (empty($date_start) || empty($date_end)) // We define date_start and date_end |
|
59 | +if (empty($date_start) || empty($date_end)) { |
|
60 | + // We define date_start and date_end |
|
60 | 61 | { |
61 | 62 | $q = GETPOST("q", "int"); |
63 | +} |
|
62 | 64 | if (empty($q)) |
63 | 65 | { |
64 | 66 | // We define date_start and date_end |
65 | 67 | $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); |
66 | 68 | $year_end = $year_start; |
67 | 69 | $month_end = $month_start; |
68 | - if (!GETPOST("month")) // If month not forced |
|
70 | + if (!GETPOST("month")) { |
|
71 | + // If month not forced |
|
69 | 72 | { |
70 | 73 | if (!GETPOST('year') && $month_start > $month_current) |
71 | 74 | { |
72 | 75 | $year_start--; |
76 | + } |
|
73 | 77 | $year_end--; |
74 | 78 | } |
75 | 79 | $month_end = $month_start - 1; |
76 | - if ($month_end < 1) $month_end = 12; |
|
77 | - else $year_end++; |
|
80 | + if ($month_end < 1) { |
|
81 | + $month_end = 12; |
|
82 | + } else { |
|
83 | + $year_end++; |
|
84 | + } |
|
78 | 85 | } |
79 | 86 | $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); |
80 | 87 | } else { |
@@ -92,20 +99,30 @@ discard block |
||
92 | 99 | $year_end = $tmpe['year']; |
93 | 100 | |
94 | 101 | $tmp_date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; |
95 | -if ($tmp_date_end < $date_end || $date_end < $date_start) $date_end = $tmp_date_end; |
|
102 | +if ($tmp_date_end < $date_end || $date_end < $date_start) { |
|
103 | + $date_end = $tmp_date_end; |
|
104 | +} |
|
96 | 105 | |
97 | 106 | $min = price2num(GETPOST("min", "alpha")); |
98 | -if (empty($min)) $min = 0; |
|
107 | +if (empty($min)) { |
|
108 | + $min = 0; |
|
109 | +} |
|
99 | 110 | |
100 | 111 | // Define modetax (0 or 1) |
101 | 112 | // 0=normal, 1=option vat for services is on debit, 2=option on payments for products |
102 | 113 | $modetax = $conf->global->TAX_MODE; |
103 | -if (GETPOSTISSET("modetax")) $modetax = GETPOST("modetax", 'int'); |
|
104 | -if (empty($modetax)) $modetax = 0; |
|
114 | +if (GETPOSTISSET("modetax")) { |
|
115 | + $modetax = GETPOST("modetax", 'int'); |
|
116 | +} |
|
117 | +if (empty($modetax)) { |
|
118 | + $modetax = 0; |
|
119 | +} |
|
105 | 120 | |
106 | 121 | // Security check |
107 | 122 | $socid = GETPOST('socid', 'int'); |
108 | -if ($user->socid) $socid = $user->socid; |
|
123 | +if ($user->socid) { |
|
124 | + $socid = $user->socid; |
|
125 | +} |
|
109 | 126 | $result = restrictedArea($user, 'tax', '', '', 'charges'); |
110 | 127 | |
111 | 128 | |
@@ -128,8 +145,10 @@ discard block |
||
128 | 145 | $listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday'); |
129 | 146 | foreach ($listofparams as $param) |
130 | 147 | { |
131 | - if (GETPOST($param) != '') $morequerystring .= ($morequerystring ? '&' : '').$param.'='.GETPOST($param); |
|
132 | -} |
|
148 | + if (GETPOST($param) != '') { |
|
149 | + $morequerystring .= ($morequerystring ? '&' : '').$param.'='.GETPOST($param); |
|
150 | + } |
|
151 | + } |
|
133 | 152 | |
134 | 153 | llxHeader('', $langs->trans("TurnoverReport"), '', '', 0, 0, '', '', $morequerystring); |
135 | 154 | |
@@ -146,9 +165,15 @@ discard block |
||
146 | 165 | // Show report header |
147 | 166 | $name = $langs->trans("xxx"); |
148 | 167 | $calcmode = ''; |
149 | -if ($modetax == 0) $calcmode = $langs->trans('OptionVATDefault'); |
|
150 | -if ($modetax == 1) $calcmode = $langs->trans('OptionVATDebitOption'); |
|
151 | -if ($modetax == 2) $calcmode = $langs->trans('OptionPaymentForProductAndServices'); |
|
168 | +if ($modetax == 0) { |
|
169 | + $calcmode = $langs->trans('OptionVATDefault'); |
|
170 | +} |
|
171 | +if ($modetax == 1) { |
|
172 | + $calcmode = $langs->trans('OptionVATDebitOption'); |
|
173 | +} |
|
174 | +if ($modetax == 2) { |
|
175 | + $calcmode = $langs->trans('OptionPaymentForProductAndServices'); |
|
176 | +} |
|
152 | 177 | $calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')'; |
153 | 178 | // Set period |
154 | 179 | $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); |
@@ -167,14 +192,24 @@ discard block |
||
167 | 192 | $description .= $fsearch; |
168 | 193 | $builddate = dol_now(); |
169 | 194 | |
170 | -if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description .= $langs->trans("RulesVATDueProducts"); |
|
171 | -if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description .= $langs->trans("RulesVATInProducts"); |
|
172 | -if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description .= '<br>'.$langs->trans("RulesVATDueServices"); |
|
173 | -if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description .= '<br>'.$langs->trans("RulesVATInServices"); |
|
195 | +if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') { |
|
196 | + $description .= $langs->trans("RulesVATDueProducts"); |
|
197 | +} |
|
198 | +if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') { |
|
199 | + $description .= $langs->trans("RulesVATInProducts"); |
|
200 | +} |
|
201 | +if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') { |
|
202 | + $description .= '<br>'.$langs->trans("RulesVATDueServices"); |
|
203 | +} |
|
204 | +if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') { |
|
205 | + $description .= '<br>'.$langs->trans("RulesVATInServices"); |
|
206 | +} |
|
174 | 207 | if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
175 | 208 | $description .= '<br>'.$langs->trans("DepositsAreNotIncluded"); |
176 | 209 | } |
177 | -if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); |
|
210 | +if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { |
|
211 | + $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); |
|
212 | +} |
|
178 | 213 | |
179 | 214 | // Customers invoices |
180 | 215 | $elementcust = $langs->trans("CustomersInvoices"); |
@@ -190,8 +225,12 @@ discard block |
||
190 | 225 | |
191 | 226 | |
192 | 227 | // TODO Report from bookkeeping not yet available, so we switch on report on business events |
193 | -if ($modecompta == "BOOKKEEPING") $modecompta = "CREANCES-DETTES"; |
|
194 | -if ($modecompta == "BOOKKEEPINGCOLLECTED") $modecompta = "RECETTES-DEPENSES"; |
|
228 | +if ($modecompta == "BOOKKEEPING") { |
|
229 | + $modecompta = "CREANCES-DETTES"; |
|
230 | +} |
|
231 | +if ($modecompta == "BOOKKEEPINGCOLLECTED") { |
|
232 | + $modecompta = "RECETTES-DEPENSES"; |
|
233 | +} |
|
195 | 234 | |
196 | 235 | // Show report header |
197 | 236 | if ($modecompta == "CREANCES-DETTES") { |
@@ -223,8 +262,11 @@ discard block |
||
223 | 262 | { |
224 | 263 | } |
225 | 264 | $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); |
226 | -if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; |
|
227 | -else $periodlink = ''; |
|
265 | +if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { |
|
266 | + $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; |
|
267 | +} else { |
|
268 | + $periodlink = ''; |
|
269 | +} |
|
228 | 270 | |
229 | 271 | $description .= ' <input type="hidden" name="modecompta" value="'.$modecompta.'">'; |
230 | 272 | |
@@ -244,7 +286,9 @@ discard block |
||
244 | 286 | $i = 0; |
245 | 287 | while ($i < 12) { |
246 | 288 | $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); |
247 | - if ($j > 12) $j -= 12; |
|
289 | + if ($j > 12) { |
|
290 | + $j -= 12; |
|
291 | + } |
|
248 | 292 | print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>'; |
249 | 293 | $i++; |
250 | 294 | } |
@@ -290,7 +334,9 @@ discard block |
||
290 | 334 | print '</td>'; |
291 | 335 | for ($i = 0; $i < 12; $i++) { |
292 | 336 | $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); |
293 | - if ($j > 12) $j -= 12; |
|
337 | + if ($j > 12) { |
|
338 | + $j -= 12; |
|
339 | + } |
|
294 | 340 | $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); |
295 | 341 | print '<td class="right" width="6%">'.price($obj->$monthj).'</td>'; |
296 | 342 | $totalpermonth[$j] = (empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]) + $obj->$monthj; |
@@ -307,7 +353,9 @@ discard block |
||
307 | 353 | print '<td></td>'; |
308 | 354 | for ($i = 0; $i < 12; $i++) { |
309 | 355 | $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); |
310 | - if ($j > 12) $j -= 12; |
|
356 | + if ($j > 12) { |
|
357 | + $j -= 12; |
|
358 | + } |
|
311 | 359 | $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); |
312 | 360 | print '<td class="right" width="6%">'.price($totalpermonth[$j]).'</td>'; |
313 | 361 | } |
@@ -325,7 +373,9 @@ discard block |
||
325 | 373 | while ($i < 12) |
326 | 374 | { |
327 | 375 | $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); |
328 | - if ($j > 12) $j -= 12; |
|
376 | + if ($j > 12) { |
|
377 | + $j -= 12; |
|
378 | + } |
|
329 | 379 | print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>'; |
330 | 380 | $i++; |
331 | 381 | } |
@@ -371,7 +421,9 @@ discard block |
||
371 | 421 | print '</td>'; |
372 | 422 | for ($i = 0; $i < 12; $i++) { |
373 | 423 | $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); |
374 | - if ($j > 12) $j -= 12; |
|
424 | + if ($j > 12) { |
|
425 | + $j -= 12; |
|
426 | + } |
|
375 | 427 | $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); |
376 | 428 | print '<td class="right" width="6%">'.price($obj->$monthj).'</td>'; |
377 | 429 | $totalpermonth[$j] = (empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j]) + $obj->$monthj; |
@@ -388,7 +440,9 @@ discard block |
||
388 | 440 | print '<td></td>'; |
389 | 441 | for ($i = 0; $i < 12; $i++) { |
390 | 442 | $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); |
391 | - if ($j > 12) $j -= 12; |
|
443 | + if ($j > 12) { |
|
444 | + $j -= 12; |
|
445 | + } |
|
392 | 446 | $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); |
393 | 447 | print '<td class="right" width="6%">'.price($totalpermonth[$j]).'</td>'; |
394 | 448 | } |