-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
73 lines (65 loc) · 1.88 KB
/
index.php
File metadata and controls
73 lines (65 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
require_once 'includes/preload.php';
$page->TJavascript[] = 'js/spe-index.js';
$page->TJavascript[] = 'js/huebee.pkgd.min.js';
$page->TCss[] = 'css/huebee.css';
$controller->check_user();
$page->name = 'index';
$page->title = 'Gestion des paiements';
$end_year = (int) date("Y", strtotime("+1 year", time()));
for($i = 2016; $i <= $end_year; $i ++) {
$TFilterYears[$i] = $i;
}
$action = GETPOST('action');
$id = GETPOST('id');
$year = (int) GETPOST('year');
$posy = GETPOST('posy');
$sort = GETPOST('sort');
if (empty($id)) {
$id = 1;
}
if (empty($year)) {
$year = date("Y", time());
}
if (empty($sort)) {
$sort = "date_facture";
}
$compte = new Account($PDOdb);
$compte->fetch($id, $year);
$TComptes = $compte->fetchAll();
$compta = new ComptaCateg($PDOdb);
$TCompta = $compta->fetchAll();
$payment = new Payment($PDOdb);
$TWaitingPayments = $payment->fetchForBank(null, 1, null, $sort);
$TPayments = $payment->fetchForBank($id);
$TAmount = Account::calcul_totaux($compte, $TPayments);
$TNotAllowed = array(TRESO_CA_CATEG_ID, TRESO_CH1_CATEG_ID, TRESO_CH2_CATEG_ID);
switch ($action) {
case 'new' :
$payment->set_vars();
$payment->save();
header('Location:./index.php?id=' . $id . '&year=' . $year . '&posy=' . $posy);
break;
case 'edit' :
$payment->set_vars();
if (! empty($payment->status) && ($payment->datep == '1970-01-01' || empty($payment->datep))) $payment->status = 0;
$payment->save();
//var_dump($_POST);exit;
header('Location:./index.php?id=' . $id . '&year=' . $year . '&posy=' . $posy);
break;
case 'delete' :
$payment->set_vars();
$payment->delete();
header('Location:./index.php?id=' . $id . '&year=' . $year . '&posy=' . $posy);
break;
default :
$action = 'view';
break;
}
// Cas vue interface pour login
if ($action == 'view') {
include 'tpl/header.tpl.php';
include 'tpl/menu.tpl.php';
include 'tpl/index.tpl.php';
include 'tpl/footer.tpl.php';
}