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
|
<?php $formid = "Order"; require_once "inc/configure.php";
$casd_refid = (int)filter_var($_REQUEST['casd_refid'], FILTER_SANITIZE_STRING);
if( $casd_refid ){ $row = getDB('ord_txcasd', $casd_refid); $refid = $casd_refid; //vdump($row); if($row['status']=='finished'){ myerror(INVALID.WS.REQUEST); exit; } } else { myerror(INVALID.WS.REQUEST); exit; }
//find the total standard weight in MELT $stdWeight = $row['exp_qty'];
$sql = "SELECT top (1) * FROM dbo.dgn_master_mold WHERE dbo.dgn_master_mold.pdt_moldno = :pdt_moldno ORDER BY dbo.dgn_master_mold.refid DESC"; $sth = $dbh->prepare($sql); $sth->execute( array(':pdt_moldno' => $row['pdt_moldno']) ); $master_mold = $sth->fetch();
//vdump($_REQUEST, $row); exit;
if( $_REQUEST['action']=="ord_checkout_tc_submit" && !empty($refid) ){
$opr_param['ttl_wt'] = filter_var($_REQUEST['act_returnwt'], FILTER_SANITIZE_STRING); $opr_param['uom_wt'] = filter_var($_REQUEST['uom_wt'], FILTER_SANITIZE_STRING); $opr_param['worker'] = filter_var($_REQUEST['worker'], FILTER_SANITIZE_STRING); $opr_param['act_returndate'] = filter_var($_REQUEST['act_returndate'], FILTER_SANITIZE_STRING); $opr_param['qc'] = filter_var($_REQUEST['qc'], FILTER_SANITIZE_STRING); $opr_param['createby'] = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING); $opr_param['lastupby'] = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING); $dbh->beginTransaction(); //finish casting deal $sql = "UPDATE ord_txcasd SET act_returndate = :act_returndate, status = 'finished', act_qty = :act_qty, pure_act_qty = :pure_act_qty, lastupby = :lastupby, lastupdate = GETDATE() WHERE refid = :refid"; $sth = $dbh->prepare($sql); $q = $sth->execute( array(':act_returndate' => $opr_param['act_returndate'], ':act_qty' => (float)$opr_param['ttl_wt'], ':pure_act_qty' => (float)convToPureMatWt($row['mattype'], $opr_param['ttl_wt']), ':lastupby' => $opr_param['lastupby'], ':refid' => $row['refid']) ); pdo_showerror($sth, $q);
//update design master mold $sql = "UPDATE dgn_master_mold SET status = 'CAS-CHO', lastupby = :lastupby, lastupdate = GETDATE() WHERE refid = :refid"; $sth = $dbh->prepare($sql); $q = $sth->execute( array(':lastupby' => $opr_param['lastupby'], ':refid' => $master_mold['refid']) ); pdo_showerror($sth, $q);
$dbh->commit();
//echo "msg=$msg"; //exit; header("Location: ord_castcheckout_tc_submitform.php?casd_refid=$casd_refid&msg=Saved."); print "Saved."; exit; } print "Invalid Request";
?>
|