/var/www/enzatesting.onesolution.hk/01_20240711_full_backup/ord_engd_checkout.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
<?php 
$formid 
"Order";
require_once 
"inc/configure.php";

function 
egra_checkout($orddtl_refid$opr_param){
    
//write tx details to $param['subtable']
    
global $dbh;        
    
$sql "INSERT INTO ord_txegra (
                txmain_refid, worker, txqty, act_svc_duration,
                createby, createdate, lastupby, lastupdate
            ) VALUES (
                :txmain_refid, :worker, :txqty, :act_svc_duration,
                :createby, GETDATE(), :lastupby, GETDATE()
            )"
;
    
$sth $dbh->prepare($sql);
    
$q $sth->execute(  array( ':txmain_refid' => $opr_param['txmain_refid'],                                             
                            
':worker' => $opr_param['worker'], 
                            
':txqty' => $opr_param['txqty'],    
                            
':act_svc_duration' => $opr_param['act_svc_duration'],                                          
                            
':createby' => $opr_param['createby'],
                            
':lastupby' => $opr_param['lastupby']) );    
/*    echo $sth->getSQL( array( ':txmain_refid' => $opr_param['txmain_refid'],                                             
                            ':worker' => $opr_param['worker'], 
                            ':txqty' => $opr_param['txqty'],    
                            ':act_svc_duration' => $opr_param['act_svc_duration'],                                          
                            ':createby' => $opr_param['createby'],
                            ':lastupby' => $opr_param['lastupby']) );    */    
    
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_engd_checkout" && !empty($refid) ){
    
//vdump($_REQUEST); //exit;    

    
$opr_param['opr_code']    = "EGRA";
    
$opr_param['subtable']     = "ord_txegra";
    
$opr_param['php_function']    = "egra_checkout";
    
$opr_param['txqty']    = (float)filter_var($_REQUEST['qty'], FILTER_SANITIZE_NUMBER_FLOATFILTER_FLAG_ALLOW_FRACTION);
    
//$opr_param['uom_qty']    = filter_var($_REQUEST['uom_qty'], FILTER_SANITIZE_STRING);        
    
$opr_param['worker']     = filter_var($_REQUEST['worker'], FILTER_SANITIZE_STRING);
    
$opr_param['act_svc_duration']     = filter_var($_REQUEST['act_svc_duration'], 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);

    
$opr oprReadyForCheckout($refid$opr_param$status);
    
//vdump($opr);     
    
$opr_param['txqty'] *= (float)filter_var($opr['opr_svc'], FILTER_SANITIZE_NUMBER_FLOATFILTER_FLAG_ALLOW_FRACTION);
    
$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($status=="OK"){
        
$dbh->beginTransaction();
        
ord_updateJCLocation($refid$opr['refid'], $opr_param);
        
$checkout_time ord_checkout($refid$opr_param);
        
//exit;
        
$dbh->commit();            
        
//vdump($checkout_time);    exit;
        
header("Location: ord_engd_modifyform.php?refid=$refid&msg=Saved.");
        print 
"Saved.";
    }else{
        
//echo"Unable to checkout"; exit; 
        
header("Location: ord_engd_modifyform.php?refid=$refid");
    }
    exit;    
}
myerror("Invalid Request");


?>