-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path30day-order-status.php
54 lines (35 loc) · 1.62 KB
/
30day-order-status.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
<?php
require_once('core.php');
require_once('config.php');
// first of the month
// $ts = date("Y-m-d H:i:s", mktime(0, 0, 0, date('m'), 1, date('Y')));
// $te = date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')));
// $ys = date("Y-m-d H:i:s", mktime(0, 0, 0, date('m')-1, 1, date('Y')));
// $ye = $ts;
// compare with this time a month ago
$ts = date('Y-m-d H:i:s', strtotime('-1 month'));
$te = date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')));
$ys = date('Y-m-d H:i:s', strtotime('-1 month',strtotime('-1 month')));
$ye = date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m')-1, date('d'), date('Y')));
// if (isset($_POST) && isset($_SERVER['PHP_AUTH_USER'])) {
// /* Check API key */
// if ($apiKey === $_SERVER['PHP_AUTH_USER']) {
$currentOrders = getOrders($ts,$te);
$countAtProcessing = countAtProcessing($ts,$te);
$countAtComplete = countAtComplete($ts,$te);
$countAtClosed = countAtClosed($ts,$te);
$ordersRefunded = array("value"=>$countAtClosed, "text"=>"Orders Refunded");
$ordersProcessing = array("value"=>$countAtProcessing, "text"=>"Orders Processing");
$ordersComplete = array("value"=>$countAtComplete, "text"=>"Orders Invoiced");
$response = array("item"=>array($ordersRefunded,$ordersProcessing,$ordersComplete));
$json = json_encode($response);
echo $json;
// } else {
// Header("HTTP/1.1 403 Access denied");
// $data = array('error' => 'Nice try, asshole.');
// echo $data;
// }
// } else {
// Header("HTTP/1.1 404 Page not found");
// }
?>