-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlivereport.php
133 lines (116 loc) · 4.32 KB
/
livereport.php
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
132
133
<?php
/*
* Copyright (C) 2019-2020 SSM Communication Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
// hide all error
error_reporting(0);
if (!isset($_SESSION["ssmonline"])) {
header("Location:../admin.php?id=login");
} else {
// load session MikroTik
$session = $_GET['session'];
// set timezone
date_default_timezone_set($_SESSION['timezone']);
// lang
include('../include/lang.php');
include('../lang/'.$langid.'.php');
// load config
include('../include/config.php');
include('../include/readcfg.php');
// routeros api
include_once('../lib/routeros_api.class.php');
include_once('../lib/formatbytesbites.php');
$API = new RouterosAPI();
$API->debug = false;
$API->connect($iphost, $userhost, decrypt($passwdhost));
if ($livereport == "disable") {
$logh = "457px";
$lreport = "style='display:none;'";
} else {
$logh = "350px";
$lreport = "style='display:block;'";
// get selling report
$thisD = date("d");
$thisM = strtolower(date("M"));
$thisY = date("Y");
if (strlen($thisD) == 1) {
$thisD = "0" . $thisD;
} else {
$thisD = $thisD;
}
$idhr = $thisM . "/" . $thisD . "/" . $thisY;
$idbl = $thisM . $thisY;
$_SESSION[$session.'idhr'] = $idhr;
/* $getSRHr = $API->comm("/system/script/print", array(
"?source" => "$idhr",
));
$TotalRHr = count($getSRHr);
$_SESSION[$session.'totalHr'] = $TotalRHr;*/
$getSRBl = $API->comm("/system/script/print", array(
"?owner" => "$idbl",
));
$TotalRBl = count($getSRBl);
$_SESSION[$session.'totalBl'] = $TotalRBl;
/*
for ($i = 0; $i < $TotalRHr; $i++) {
$tHr += explode("-|-", $getSRHr[$i]['name'])[3];
}*/
foreach($getSRBl as $row){
if((explode("-|-", $row['name'])[0]) == $idhr){
$tHr += explode("-|-", $row['name'])[3];
$TotalRHr += count($row['source']);
}
$tBl += explode("-|-", $row['name'])[3];
if($TotalRHr == ""){
$TotalRHr = "0";
$_SESSION[$session.'totalHr'] = "0";
}else{
$_SESSION[$session.'totalHr'] = $TotalRHr;
}
}
}
}
?>
<div id="r_4" class="row">
<div <?= $lreport; ?> class="box bmh-75 box-bordered">
<div class="box-group">
<div class="box-group-icon"><i class="fa fa-money"></i></div>
<div class="box-group-area">
<span >
<div id="reloadLreport">
<?php
if ($currency == in_array($currency, $cekindo['indo'])) {
$dincome = number_format($tHr, 0, ",", ".");
$mincome = number_format($tBl, 0, ",", ".");
$_SESSION[$session.'dincome'] = $dincome;
$_SESSION[$session.'mincome'] = $mincome;
}else{
$dincome = number_format($tHr, 2);
$mincome = number_format($tBl, 2);
$_SESSION[$session.'dincome'] = $dincome;
$_SESSION[$session.'mincome'] = $mincome;
}
echo $_income."<br/>" . "
".$_today." " . $TotalRHr . "vcr : " . $currency . " " . $dincome . "<br/>
".$_this_month." " . $TotalRBl . "vcr : " . $currency . " " . $mincome;
?>
</div>
</span>
</div>
</div>
</div>
</div>