-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.php
More file actions
executable file
·131 lines (115 loc) · 5.68 KB
/
run.php
File metadata and controls
executable file
·131 lines (115 loc) · 5.68 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
require_once("assets/Label.php");
require_once("assets/Sap.php");
require_once("assets/Lock.php");
require_once("assets/Message.php");
require_once("session.inc");
/**
* Page to manage a plateform facturation run
*/
if(!isset($_GET["plateforme"]) || !isset($_GET["year"]) || !isset($_GET["month"]) || !isset($_GET["version"]) || !isset($_GET["run"])) {
$_SESSION['alert-danger'] = "Manque un paramètre !";
header('Location: index.php');
exit;
}
$plateforme = $_GET['plateforme'];
checkPlateforme("facturation", $plateforme);
$year = $_GET['year'];
$month = $_GET['month'];
$version = $_GET['version'];
$run = $_GET['run'];
$dir = DATA.$plateforme."/".$year."/".$month."/".$version."/".$run;
$name = DATA_GEST['facturation'][$plateforme];
$messages = new Message();
$label = Label::load($dir);
if(empty($label)) {
$label = $run;
}
$sap = new Sap($dir);
$status = $sap->status();
$lockRun = Lock::load($dir, "run");
$lockVersion = Lock::load(DATA.$plateforme."/".$year."/".$month."/".$version, "version");
$archive = file_exists(DATA.$plateforme."/".$year."/".$month."/archive.csv");
include("includes/lock.inc");
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<?php include("includes/header.inc");?>
</head>
<body>
<div class="container-fluid">
<div id="head">
<div id="div-logo">
<a href="index.php"><img src="icons/epfl-logo.png" alt="Logo EPFL" id="logo"/></a>
</div>
<div id="div-path">
<p><a href="index.php">Accueil</a> > <a href="facturation.php?plateforme=<?= $plateforme ?>">Facturation <?= $name ?></a> > Prefacturation <?= $label ?></p>
<p><a href="logout.php">Logout</a></p>
</div>
</div>
<div class="title <?php if(TEST_MODE) echo "test";?>">
<h1 class="text-center p-1"><?= $label ?></h1>
</div>
<input type="hidden" id="plate" value="<?= $plateforme ?>" />
<input type="hidden" id="year" value="<?= $year ?>" />
<input type="hidden" id="month" value="<?= $month ?>" />
<input type="hidden" id="version" value="<?= $version ?>" />
<input type="hidden" id="run" value="<?= $run ?>" />
<div id="actions" class="text-center">
<button type="button" id="open-label" class="btn but-line">Etiqueter</button>
<button type="button" id="open-info" class="btn but-line">Afficher les infos</button>
<?php
if(!$archive) {
?>
<button type="button" id="open-bills" class="btn but-line">Afficher la liste des factures</button>
<button type="button" id="open-ticket" class="btn but-line">Contrôler le ticket</button>
<button type="button" id="open-changes" class="btn but-line">Afficher les modifications</button>
<?php
if(($status < 4) && is_null($lockRun)) {
echo '<button type="button" id="invalidate" '.$disabled.' class="btn but-line lockable">Invalider</button>';
}
}
if(in_array($status, [0, 1, 4, 5, 6, 7]) && !is_null($lockVersion) && ($lockVersion == $run)) { ?>
<button type="button" id="bilans" class="btn but-line">Exporter Bilans & Stats</button>
<?php if(!$archive) { ?>
<button type="button" id="annexes" class="btn but-line">Exporter Annexes csv</button>
<?php }
}
?>
<button type="button" id="all" class="btn but-line">Exporter Tout</button>
<?php
if(!$archive && in_array($status, [1, 2, 3, 5, 6, 7]) && is_null($lockRun)) {
echo '<button type="button" id="send" '.$disabled.' class="btn but-line-green lockable">Envoi SAP</button>';
}
if(!$archive && in_array($status, [0, 1, 5, 6, 7]) && is_null($lockRun)) {
echo '<button type="button" id="finalize" '.$disabled.' class="btn but-line-blue lockable">Finaliser SAP</button>';
}
if(!$archive && (in_array($status, [5, 6, 7]) && is_null($lockRun)) || (in_array($status, [1, 4, 5, 6, 7]) && !is_null($lockVersion) && ($lockVersion == $run))) {
echo '<button type="button" id="resend" data-msg="'.$messages->getMessage('msg5').'" '.$disabled.' class="btn but-line-red lockable">Renvoi SAP</button>';
}
if(!$archive && $status > 1) {
?>
<button type="button" id="open-report" class="btn but-line">Rapports d'envoi SAP</button>
<?php
}
?>
</div>
<?php include("includes/message.inc");
if(!empty($lockProcess)) {
$other = "";
if($lockedPlate != $plateforme) {
$other = " pour une autre plateforme";
}
echo'<div class="text-center" >'.$lockedProcessus.' est en cours'.$other.'. Veuillez patientez et rafraîchir la page...</div>';
}
if(!empty($lockUser)) {
echo'<div class="text-center">'.$dlTxt.'</div>';
}
?>
<div class="text-center" id="prefa-content"></div>
</div>
<?php include("includes/footer.inc");?>
<script src="js/run.js"></script>
</body>
</html>