-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanda_billing_update.php
66 lines (58 loc) · 2.02 KB
/
panda_billing_update.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
<?php
######################
# 記帳更新資料控制 #
# author: Panda #
# date : 20180123 #
######################
include_once ("panda_inc_global.php");
//檢查modal的input
//$id=$_POST['editID'];
$id = isset($_POST['editID'])?$_POST['editID']:'';
$subject = isset($_POST['subject'])?$_POST['subject']:''; //variable subject
if(trim($subject ) == ''){
$msg = array(
'error' => true,
'msg' => 'Please check column Subject!!!!'
);
exit(json_encode($msg));
}
$balance = isset($_POST['balance'])?$_POST['balance']:'';
if(trim($balance ) == ''){
$msg = array(
'error' => true,
'msg' => 'Please check option Balance!!!!'
);
exit(json_encode($msg));
}
$type = isset($_POST['type'])?$_POST['type']:'';
if(trim($type ) == ''){
$msg = array(
'error' => true,
'msg' => 'Please check selection Type!!!!'
);
exit(json_encode($msg));
}
$cash = isset($_POST['cash'])?$_POST['cash']:'';
if(trim($cash ) == ''){
$msg = array(
'error' => true,
'msg' => 'Please check column Cash!!!!'
);
exit(json_encode($msg));
}
$currentTime = isset($_POST['update_datetime']);
// echo $currentTime;
$currentTime = date ("Y-m-d H:i:s" , mktime(date('H')+7, date('i'), date('s'), date('m'), date('d'), date('Y')));
$sql = "UPDATE `billing_2` SET `subject` =?, `balance` =?, `type` =?, `cash` =?, `update_datetime` = ? WHERE `billing_2`.`id` =?";
$msg = array(
'error' => false,
'msg' => 'success'
);
//## return error message ##//
if ($DB->Execute($sql, array($subject, $balance, $type, $cash, $currentTime, $id)) === false) {
$msg = array(
'error' => true,
'msg' => $DB->ErrorMsg()
);
}
echo json_encode($msg);