Completed
Push — master ( 0cae82...3ae2ae )
by Laurent
02:11
created

generateBilling.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * When a user generates the expense report for all pilots
4
 */
5
define("EXPENSE_REPORT_GENERATOR_ACTION_GENERATE", "generate");
6
7
/**
8
 * When a user has to select year and quartil
9
 */
10
define("EXPENSE_REPORT_GENERATOR_ACTION_SELECT", "select");
11
12
/**
13
 * \file    generateExpenseNote.php
14
 * \ingroup flightlog
15
 * \brief   Generate expense notes for a quartil
16
 *
17
 */
18
19
// Load Dolibarr environment
20
if (false === (@include '../main.inc.php')) {  // From htdocs directory
21
    require '../../documents/custom/main.inc.php'; // From "custom" directory
22
}
23
24
dol_include_once('/compta/facture/class/facture.class.php');
25
dol_include_once('/adherents/class/adherent.class.php');
26
dol_include_once("/flightlog/lib/flightLog.lib.php");
27
dol_include_once("/flightlog/class/bbctypes.class.php");
28
dol_include_once("/product/class/product.class.php");
29
dol_include_once('/core/modules/facture/modules_facture.php');
30
31
global $db, $langs, $user, $conf;
32
33
// Load translation files required by the page
34
$langs->load("mymodule@mymodule");
35
$langs->load("trips");
36
$langs->load("bills");
37
38
// Get parameters
39
$id = GETPOST('id', 'int');
40
$action = GETPOST('action', 'alpha');
41
$year = GETPOST('year', 'int', 3);
42
43
//post parameters
44
$additionalBonus = GETPOST('additional_bonus', 'array', 2);
45
$pilotIds = GETPOST('pilot', 'array', 2);
46
$amouts = GETPOST('amout', 'array', 2);
47
$amoutDiscounts = GETPOST('amoutDiscount', 'array', 2);
48
$publicNote = GETPOST('public_note', 'alpha', 2);
49
$privateNote = GETPOST('private_note', 'alpha', 2);
50
$type = GETPOST("type", "int", 3);
51
$conditionReglement = GETPOST("cond_reglement_id", "int", 3);
52
$modeReglement = GETPOST("mode_reglement_id", "int", 3);
53
$bankAccount = GETPOST("fk_account", "int", 3);
54
$documentModel = GETPOST("model", "alpha", 3);
55
56
//variables
57
$currentYear = date('Y');
58
59
$t1 = new Bbctypes($db);
60
$t1->fetch(1);
61
$t2 = new Bbctypes($db);
62
$t2->fetch(2);
63
$t3 = new Bbctypes($db);
64
$t3->fetch(3);
65
$t4 = new Bbctypes($db);
66
$t4->fetch(4);
67
$t5 = new Bbctypes($db);
68
$t5->fetch(5);
69
$t6 = new Bbctypes($db);
70
$t6->fetch(6);
71
$t7 = new Bbctypes($db);
72
$t7->fetch(7);
73
74
//Query
75
$sql = "SELECT USR.lastname AS nom , USR.firstname AS prenom ,COUNT(`idBBC_vols`) AS nbr,fk_pilot as pilot, TT.numero as type,SEC_TO_TIME(SUM(TIME_TO_SEC(TIMEDIFF(heureA,heureD)))) AS time";
76
$sql .= " FROM llx_bbc_vols, llx_user AS USR,llx_bbc_types AS TT ";
77
$sql .= " WHERE `fk_pilot`= USR.rowid AND fk_type = TT.idType AND YEAR(llx_bbc_vols.date) = " . $year;
78
$sql .= " GROUP BY fk_pilot,`fk_type`";
79
80
$flightYears = getFlightYears();
81
82
//pdf
83
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails',
84
    'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
85
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc',
86
    'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
87
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref',
88
    'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
89
90
$object = new Facture($db);
91
$vatrate = "0.000";
92
93
// Access control
94
if (!$conf->facture->enabled || !$user->rights->flightlog->vol->status || !$user->rights->flightlog->vol->financialGenerateDocuments) {
95
    accessforbidden();
96
}
97
98
// Default action
99
if (empty($action)) {
100
    $action = EXPENSE_REPORT_GENERATOR_ACTION_SELECT;
101
}
102
103
llxHeader('', $langs->trans('Generate billing'), '');
104
print load_fiche_titre("Générer factures");
105
106
/*
107
 * ACTIONS
108
 *
109
 * Put here all code to do according to value of "action" parameter
110
 */
111
112
if ($action == EXPENSE_REPORT_GENERATOR_ACTION_GENERATE) {
113
114
    if ($year < $currentYear) {
115
116
        if (empty($documentModel) || $conditionReglement == 0 || empty($conditionReglement) || $modeReglement == 0 || empty($modeReglement)) {
117
            dol_htmloutput_errors("Erreur de configuration !");
118
        } else {
119
            $table = sqlToArray($db, $sql, true, $year);
120
            $startYearTimestamp = (new \DateTime())->setDate($year, 1, 1)->getTimestamp();
121
            $endYearTimestamp = (new \DateTime())->setDate($year, 12, 31)->getTimestamp();
122
123
            foreach ($table as $currentMissionUserId => $value) {
124
125
                $expenseNoteUser = new User($db);
126
                $expenseNoteUser->fetch($currentMissionUserId);
127
128
                $adherent = new Adherent($db);
129
                $adherent->fetch($expenseNoteUser->fk_member);
130
131
                $addBonus = (int)$additionalBonus[$currentMissionUserId];
132
                if ($addBonus < 0) {
133
                    dol_htmloutput_mesg("Facture ignorée " . $adherent->getFullName($langs), '', 'warning');
134
                    continue;
135
                }
136
137
                $totalFlights = $value['1']['count'] + $value['2']['count'] + $value['orga']['count'] + $value['3']['count'] + $value['4']['count'] + $value['6']['count'] + $value['7']['count'];
138
                $totalBonus = $value['1']['count'] * $t1->service->price_ttc + $value['2']['count'] * $t2->service->price_ttc + $value['orga']['count'] * 25 + $addBonus + $value['orga_T6']['count'] * 50;
139
140
                $totalFacture = $value['3']['count'] * $t3->service->price_ttc + $value['4']['count'] * $t4->service->price_ttc + $value['6']['count'] * $t6->service->price_ttc + $value['7']['count'] * $t7->service->price_ttc;
141
142
                $facturable = ($totalFacture - $totalBonus < 0 ? 0 : $totalFacture - $totalBonus);
143
144
                if ($facturable == 0) {
145
                    continue;
146
                }
147
148
                $object = new Facture($db);
149
                $object->fetch_thirdparty();
150
151
                $object->socid = $adherent->fk_soc;
152
                $object->type = $type;
153
                $object->number = "provisoire";
154
                $object->date = (new DateTime())->getTimestamp();
155
                $object->date_pointoftax = "";
156
                $object->note_public = $publicNote;
157
                $object->note_private = $privateNote;
158
                $object->ref_client = "";
159
                $object->ref_int = "";
160
                $object->modelpdf = $documentModel;
161
                $object->cond_reglement_id = $conditionReglement;
162
                $object->mode_reglement_id = $modeReglement;
163
                $object->fk_account = $bankAccount;
164
165
                $id = $object->create($user);
166
167
                $soc = new Societe($db);
168
                $soc->fetch($adherent->fk_soc);
169
170
                if ($id <= 0) {
171
                    setEventMessages($object->error, $object->errors, 'errors');
172
                }
173
174
                $localtax1_tx = get_localtax(0, 1, $object->thirdparty);
175
                $localtax2_tx = get_localtax(0, 2, $object->thirdparty);
176
177
                //T3
178
                $pu_ht = price2num($t3->service->price, 'MU');
179
                $pu_ttc = price2num($t3->service->price_ttc, 'MU');
180
                $pu_ht_devise = price2num($t3->service->price, 'MU');
181
                $qty = $value['3']['count'];
182
183
                $result = $object->addline(
184
                    $t3->service->description,
185
                    $pu_ht,
186
                    $qty,
187
                    0,
188
                    $localtax1_tx,
189
                    $localtax2_tx,
190
                    $t3->service->id,
191
                    0,
192
                    $startYearTimestamp,
193
                    $endYearTimestamp,
194
                    0,
195
                    0,
196
                    '',
197
                    'TTC',
198
                    $pu_ttc,
199
                    1,
200
                    -1,
201
                    0,
202
                    '',
203
                    0,
204
                    0,
205
                    '',
206
                    '',
207
                    $t3->service->label,
208
                    [],
209
                    100,
210
                    '',
211
                    0,
212
                    0
213
                );
214
215
                //T4
216
                $pu_ht = price2num($t4->service->price, 'MU');
217
                $pu_ttc = price2num($t4->service->price_ttc, 'MU');
218
                $pu_ht_devise = price2num($t4->service->price, 'MU');
219
                $qty = $value['4']['count'];
220
221
                $result = $object->addline(
222
                    $t4->service->description,
223
                    $pu_ht,
224
                    $qty,
225
                    0,
226
                    $localtax1_tx,
227
                    $localtax2_tx,
228
                    $t4->service->id,
229
                    0,
230
                    $startYearTimestamp,
231
                    $endYearTimestamp,
232
                    0,
233
                    0,
234
                    '',
235
                    'HT',
236
                    $pu_ttc,
237
                    1,
238
                    -1,
239
                    0,
240
                    '',
241
                    0,
242
                    0,
243
                    '',
244
                    '',
245
                    $t4->service->label,
246
                    [],
247
                    100,
248
                    '',
249
                    0,
250
                    0
251
                );
252
253
                //T6
254
                $pu_ht = price2num($t6->service->price, 'MU');
255
                $pu_ttc = price2num($t6->service->price, 'MU');
256
                $pu_ht_devise = price2num($t6->service->price, 'MU');
257
                $qty = $value['6']['count'];
258
259
                $result = $object->addline(
260
                    $t6->service->description,
261
                    $pu_ht,
262
                    $qty,
263
                    0,
264
                    $localtax1_tx,
265
                    $localtax2_tx,
266
                    $t6->service->id,
267
                    0,
268
                    $startYearTimestamp,
269
                    $endYearTimestamp,
270
                    0,
271
                    0,
272
                    '',
273
                    'HT',
274
                    $pu_ttc,
275
                    1,
276
                    -1,
277
                    0,
278
                    '',
279
                    0,
280
                    0,
281
                    '',
282
                    '',
283
                    $t6->service->label,
284
                    [],
285
                    100,
286
                    '',
287
                    0,
288
                    0
289
                );
290
291
                //T7
292
                $pu_ht = price2num($t7->service->price, 'MU');
293
                $pu_ttc = price2num($t7->service->price_ttc, 'MU');
294
                $pu_ht_devise = price2num($t7->service->price, 'MU');
295
                $qty = $value['7']['count'];
296
297
                $result = $object->addline(
298
                    $t7->service->description,
299
                    $pu_ht,
300
                    $qty,
301
                    0,
302
                    $localtax1_tx,
303
                    $localtax2_tx,
304
                    $t7->service->id,
305
                    0,
306
                    $startYearTimestamp,
307
                    $endYearTimestamp,
308
                    0,
309
                    0,
310
                    '',
311
                    'HT',
312
                    $pu_ttc,
313
                    1,
314
                    -1,
315
                    0,
316
                    '',
317
                    0,
318
                    0,
319
                    '',
320
                    '',
321
                    $t7->service->label,
322
                    [],
323
                    100,
324
                    '',
325
                    0,
326
                    0
327
                );
328
329
                //### DISCOUNTS
330
331
                //T1
332
                $pu_ht = price2num(50 * $value['1']['count'], 'MU');
333
                $desc = $year . " - " . $t1->service->label . " - (" . $value['1']['count'] . " * 50)";
334
335
                $discountid = $soc->set_remise_except($pu_ht, $user, $desc, 0);
336
                $object->insert_discount($discountid);
337
338
                //T2
339
                $pu_ht = price2num(50 * $value['2']['count'], 'MU');
340
                $desc = $year . " - " . $t2->service->label . "  - (" . $value['2']['count'] . " * 50)";
341
342
                $discountid = $soc->set_remise_except($pu_ht, $user, $desc, 0);
343
                $object->insert_discount($discountid);
344
345
                //Orga
346
                $pu_ht = price2num(25 * $value['orga']['count'], 'MU');
347
                $desc = $year . " - Vols dont vous êtes organisateur - (" . $value['orga']['count'] . " * 25)";
348
349
                $discountid = $soc->set_remise_except($pu_ht, $user, $desc, 0);
350
                $object->insert_discount($discountid);
351
352
                //Instructeur / examinateur
353
                if($value['orga_T6']['count'] > 0){
354
                    $pu_ht = price2num($value['orga_T6']['count'] * 50, 'MU');
355
                    $desc = $year . " - Vols dont vous êtes instructeur/examinateur - (" . $value['orga_T6']['count'] . " * 50)";
356
357
                    $discountid = $soc->set_remise_except($pu_ht, $user, $desc, 0);
358
                    $object->insert_discount($discountid);
359
                }
360
361
                //Additional bonus
362
                if ((int)$addBonus > 0) {
363
364
                    $pu_ht = price2num($addBonus, 'MU');
365
366
                    $desc = sprintf("%s - %s", $year, GETPOST("additional_message", 3));
367
368
                    $discountid = $soc->set_remise_except($pu_ht, $user, $desc, 0);
369
                    $object->insert_discount($discountid);
370
                }
371
372
                $ret = $object->fetch($id);
373
                $result = $object->generateDocument($documentModel, $langs, $hidedetails, $hidedesc, $hideref);
374
375
                // Validate
376
                $object->fetch($id);
377
                $object->validate($user);
378
379
                // Generate document
380
                $object->fetch($id);
381
                $result = $object->generateDocument($documentModel, $langs, $hidedetails, $hidedesc, $hideref);
382
383
            }
384
385
            if ($result > 0) {
386
                dol_htmloutput_mesg("Facture créées");
387
            } else {
388
                dol_htmloutput_errors("Note de frais non créée");
389
            }
390
        }
391
392
    } else {
393
        //Quarter not yet finished
394
        dol_htmloutput_errors("L'année n'est pas encore finie !");
395
    }
396
}
397
398
/*
399
 * VIEW
400
 *
401
 * Put here all code to build page
402
 */
403
404
405
$form = new Form($db);
406
407
$tabLinks = [];
408 View Code Duplication
foreach ($flightYears as $currentFlightYear) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
409
    $tabLinks[] = [
410
        DOL_URL_ROOT . "/flightlog/generateBilling.php?year=" . $currentFlightYear,
411
        $currentFlightYear,
412
        "tab_" . $currentFlightYear
413
    ];
414
}
415
416
if (!$t1->service || !$t2->service || !$t3->service || !$t4->service || !$t5->service || !$t6->service || !$t7->service) {
417
    dol_htmloutput_mesg("Un service n'a pas été configuré", '', 'warning');
418
}
419
dol_fiche_head($tabLinks, "tab_" . $year);
420
421
?>
422
    <form method="POST">
423
424
        <!-- action -->
425
        <input type="hidden" name="action" value="<?= EXPENSE_REPORT_GENERATOR_ACTION_GENERATE ?>">
426
427
        <?php
428
429
        //tableau par pilote
430
431
        $resql = $db->query($sql);
432
        $pilotNumberFlight = array();
433
        if ($resql):
434
435
            print '<div class="tabBar">';
436
            print '<table class="border" width="100%">';
437
438
            print '<tr class="liste_titre">';
439
            print '<td colspan="2">Nom</td>';
440
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Type 1 : Sponsor") . '</td>';
441
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Type 2 : Baptême") . '</td>';
442
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Organisateur (T1/T2)") . '</td>';
443
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Total bonus") . '</td>';
444
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Type 3 : Privé") . '</td>';
445
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Type 4: Meeting") . '</td>';
446
            print '<td class="liste_titre" colspan="1">' . $langs->trans("Type 5: Chambley") . '</td>';
447
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Type 6: instruction") . '</td>';
448
            print '<td class="liste_titre" colspan="2">' . $langs->trans("Type 7: vols < 50 ") . '</td>';
449
            print '<td class="liste_titre" colspan="1">' . $langs->trans("Facture") . '</td>';
450
            print '<td class="liste_titre" colspan="1">' . $langs->trans("A payer") . '</td>';
451
            print '<tr>';
452
453
            print '<tr class="liste_titre">';
454
            print '<td colspan="2" class="liste_titre"></td>';
455
456
            print '<td class="liste_titre"> # </td>';
457
            print '<td class="liste_titre"> Pts </td>';
458
459
            print '<td class="liste_titre"> # </td>';
460
            print '<td class="liste_titre"> Pts </td>';
461
462
            print '<td class="liste_titre"> # </td>';
463
            print '<td class="liste_titre"> Pts </td>';
464
465
            print '<td class="liste_titre"> Bonus gagnés </td>';
466
            print '<td class="liste_titre"> Bonus additional (ROI) </td>';
467
468
            print '<td class="liste_titre"> # </td>';
469
            print '<td class="liste_titre"> € </td>';
470
471
            print '<td class="liste_titre"> # </td>';
472
            print '<td class="liste_titre"> € </td>';
473
474
            print '<td class="liste_titre"> # </td>';
475
476
            print '<td class="liste_titre"> # </td>';
477
            print '<td class="liste_titre"> € </td>';
478
479
            print '<td class="liste_titre"> #</td>';
480
            print '<td class="liste_titre"> €</td>';
481
482
            print '<td class="liste_titre"> € </td>';
483
            print '<td class="liste_titre"> Balance (A payer) €</td>';
484
485
            print'</tr>';
486
            $table = sqlToArray($db, $sql, true, $year);
487
            $total = 0;
488
            foreach ($table as $key => $value) {
489
490
                $totalBonus = $value['1']['count'] * 50 + $value['2']['count'] * 50 + $value['orga']['count'] * 25;
491
                $totalFacture = $value['3']['count'] * 150 + $value['4']['count'] * 100 + $value['6']['count'] * 50 + $value['7']['count'] * 75;
492
                $facturable = ($totalFacture - $totalBonus < 0 ? 0 : $totalFacture - $totalBonus);
493
                $total += $facturable;
494
495
                $pilotNumberFlight[$value['id']] = array(
496
                    "1" => $value['1']['count'],
497
                    "2" => $value['2']['count'],
498
                    "3" => $value['3']['count'],
499
                    "4" => $value['4']['count'],
500
                    "5" => $value['5']['count'],
501
                    "6" => $value['6']['count'],
502
                    "7" => $value['7']['count'],
503
                );
504
505
                print '<tr>';
506
                print '<td>' . $key;
507
                print sprintf('<input type="hidden" name="pilot[%s]" value="%s" />', $key, $key);
508
                print '</td>';
509
                print '<td>' . $value['name'] . '</td>';
510
511
                print '<td>' . $value['1']['count'] . '</td>';
512
                print '<td>' . $value['1']['count'] * 50 . '</td>';
513
514
                print '<td>' . $value['2']['count'] . '</td>';
515
                print '<td>' . $value['2']['count'] * 50 . '</td>';
516
517
                print '<td>' . $value['orga']['count'] . '</td>';
518
                print '<td>' . $value['orga']['count'] * 25 . '</td>';
519
520
                print '<td><b>' . ($totalBonus) . '</b></td>';
521
                print '<td>' . sprintf('<input type="number" value="0" name="additional_bonus[%s]"/>',
522
                        $key) . '</b></td>';
523
524
                print '<td>' . $value['3']['count'] . '</td>';
525
                print '<td>' . price($value['3']['count'] * 150) . '€</td>';
526
527
                print '<td>' . $value['4']['count'] . '</td>';
528
                print '<td>' . price($value['4']['count'] * 100) . '€</td>';
529
530
                print '<td>' . $value['5']['count'] . '</td>';
531
532
                print '<td>' . $value['6']['count'] . '</td>';
533
                print '<td>' . price($value['6']['count'] * 50) . '€</td>';
534
535
                print '<td>' . $value['7']['count'] . '</td>';
536
                print '<td>' . price($value['7']['count'] * 75) . '€</td>';
537
538
                print '<td>';
539
                print sprintf('<input type="hidden" value="%d" name="amout[%d]"/>', $totalFacture, $key);
540
                print price($totalFacture);
541
                print '€ </td>';
542
543
544
                print '<td>';
545
                print sprintf('<input type="hidden" value="%d" name="amoutDiscount[%d]"/>', $facturable, $key);
546
                print price($facturable);
547
                print '€ </td>';
548
549
                print '</tr>';
550
551
            }
552
553
554
            ?>
555
556
            <tr>
557
                <td colspan='19'></td>
558
                <td>Total à reçevoir</td>
559
                <td><?= price($total) ?>€</td>
560
            </tr>
561
562
            </table>
563
564
        <?php endif; ?>
565
566
567
        <!-- Additional Point message -->
568
        <label>Message de réduction pour points supplémentaire (Commun à toutes les factures)</label><br/>
569
        <textarea name="additional_message" wrap="soft" class="quatrevingtpercent" rows="2">
570
            Points additionel (cf.annexe du ROI)
571
        </textarea>
572
        <br/>
573
        <br/>
574
575
        <!-- Billing type -->
576
        <label><?= $langs->trans("Type de facture"); ?></label><br/>
577
        <input type="radio" id="radio_standard" name="type" value="0" checked="checked"/>
578
        <?= $form->textwithpicto($langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1,
579
            'help', '', 0, 3) ?>
580
        <br/>
581
        <br/>
582
583
        <!-- Payment mode -->
584
        <label><?= $langs->trans("Mode de payement"); ?></label><br/>
585
        <?php $form->select_types_paiements(0, 'mode_reglement_id', 'CRDT'); ?>
586
        <br/>
587
        <br/>
588
589
        <!-- Payment condition -->
590
        <label><?= $langs->trans("Condition de payement"); ?></label><br/>
591
        <?php $form->select_conditions_paiements(0, 'cond_reglement_id'); ?>
592
        <br/>
593
        <br/>
594
595
        <!-- bank account -->
596
        <label><?= $langs->trans("Compte en banque"); ?></label><br/>
597
        <?php $form->select_comptes(0, 'fk_account', 0, '', 1); ?>
598
        <br/>
599
        <br/>
600
601
        <!-- Public note -->
602
        <label><?= $langs->trans("Note publique (commune à toutes les factures)"); ?></label><br/>
603
        <textarea name="public_note" wrap="soft" class="quatrevingtpercent" rows="2">
604
            Les vols sont facturés comme le stipule l'annexe du ROI.
605
        </textarea>
606
        <br/>
607
        <br/>
608
609
        <!-- Private note -->
610
        <label><?= $langs->trans("Note privée (commune à toutes les factures)"); ?></label><br/>
611
        <textarea name="private_note" wrap="soft" class="quatrevingtpercent" rows="2">
612
            Aux points de vols, s'ajoutent une indemnité pour les membres du CA/CD de 300 points.
613
        </textarea>
614
        <br/>
615
616
        <!-- model document -->
617
        <label><?= $langs->trans("Model de document "); ?></label><br/>
618
        <?php $liste = ModelePDFFactures::liste_modeles($db); ?>
619
        <?= $form->selectarray('model', $liste, $conf->global->FACTURE_ADDON_PDF); ?>
620
        <br/>
621
        <br/>
622
623
        <?php if ($year >= $currentYear || !$t1->service || !$t2->service || !$t3->service || !$t4->service || !$t5->service || !$t6->service || !$t7->service) : ?>
624
            <a class="butActionRefused" href="#">Générer</a>
625
        <?php else: ?>
626
            <button class="butAction" type="submit">Générer</button>
627
        <?php endif; ?>
628
629
    </form>
630
631
<?php
632
llxFooter();