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
|
<?php $formid = "Order"; require_once "inc/configure.php";
function mqco_checkout($orddtl_refid, $opr_param){ //write tx details to $param['subtable'] global $dbh; foreach($opr_param['tx'] as $i=>$tx){ if($i>0){ $sql = "INSERT INTO ord_txmqco ( txmain_refid, status, category, reason, createby, createdate, lastupby, lastupdate )VALUES( :txmain_refid, :status, :category, :reason, :createby, GETDATE(), :lastupby, GETDATE() )"; $sth = $dbh->prepare($sql); $q = $sth->execute( array(':txmain_refid' => $opr_param['txmain_refid'], ':status' => filter_var($tx['status'], FILTER_SANITIZE_STRING), ':category' => filter_var($tx['category'], FILTER_SANITIZE_STRING), ':reason' => filter_var($tx['reason'], FILTER_SANITIZE_STRING), ':createby' => $opr_param['createby'], ':lastupby' => $opr_param['lastupby']) ); /* echo $sth->getSQL( array(':txmain_refid' => $opr_param['txmain_refid'], ':status' => filter_var($tx['status'], FILTER_SANITIZE_STRING), ':category' => filter_var($tx['category'], FILTER_SANITIZE_STRING), ':reason' => filter_var($tx['reason'], FILTER_SANITIZE_STRING), ':createby' => $opr_param['createby'], ':lastupby' => $opr_param['lastupby']) );*/ pdo_showerror($sth, $q); } } //write act_svc_duration to the route for calculate cost $sql = "UPDATE ord_route SET lastupby = :lastupby, lastupdate = GETDATE() where checkout_time is NULL AND ordtxmain_refid=:txmain_refid"; $sth = $dbh->prepare($sql); $q = $sth->execute( array(':lastupby' => $opr_param['lastupby'], ':txmain_refid' => $opr_param['txmain_refid']) ); /* echo $sth->getSQL( array(':act_opr_svc' => $opr_param['act_svc_duration'], ':lastupby' => $opr_param['lastupby'], ':txmain_refid' => $opr_param['txmain_refid']) ); */ pdo_showerror($sth, $q); }
$refid = (int) filter_var($_REQUEST['refid'], FILTER_SANITIZE_STRING); /*$route_refid = (int) filter_var($_REQUEST['route_refid'], FILTER_SANITIZE_STRING); $txmain_refid = (int) filter_var($_REQUEST['txmain_refid'], FILTER_SANITIZE_STRING); $qc = filter_var($_REQUEST['qc'], FILTER_SANITIZE_STRING); */ if( $_POST['action']=="ord_mqcd_checkout" && !empty($refid) ){ //vdump($_REQUEST); //exit;
$opr_param['opr_code'] = "MQCO"; $opr_param['subtable'] = "ord_txmqco"; $opr_param['php_function'] = "mqco_checkout"; $opr_param['tx'] = $_REQUEST['tx']; //array $opr_param['worker'] = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING); //$opr_param['act_svc_duration'] = (float)filter_var($_REQUEST['act_svc_duration'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); //$opr_param['checkout_wt'] = (float)filter_var($_REQUEST['ttl_wt'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); //$opr_param['ttl_wt'] = (float)filter_var($_REQUEST['ttl_wt'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); //$opr_param['uom_wt'] = filter_var($_REQUEST['uom_wt'], FILTER_SANITIZE_STRING); $opr_param['createby'] = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING); $opr_param['lastupby'] = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING); $opr = oprReadyForCheckout($refid, $opr_param); //vdump($opr); $opr_param['route_refid'] = (int) filter_var($opr['refid'], FILTER_SANITIZE_STRING); $opr_param['txmain_refid'] = (int) filter_var($opr['ordtxmain_refid'], FILTER_SANITIZE_STRING);
//vdump($opr_param); //exit;
if($opr === false){ //echo"Unable to checkout"; exit; myerror("Unable to checkout: " . $msg); exit; } else { $dbh->beginTransaction(); ord_updateJCLocation($refid, $opr['refid'], $opr_param); $checkout_time = ord_checkout($refid, $opr_param); //exit; $dbh->commit(); //vdump($checkout_time); exit; form_dest($_REQUEST['godest'], $_REQUEST['formdest']); header("Location: ord_mqcd_modifyform.php?refid=$refid"); print "Saved."; exit; } } myerror("Invalid Request");
?>
|