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


$refid                 = (int) filter_var($_REQUEST['refid'], FILTER_SANITIZE_STRING);

if( 
$_REQUEST['action']=="ord_pick_print_label" && !empty($refid) ){
    
//vdump($_REQUEST); 
    
    
$sql "SELECT
            dbo.ord_item_bom.refid,
            dbo.ord_item_bom.orddtl_refid
            
            FROM
            dbo.ord_item_bom
            WHERE
            dbo.ord_item_bom.refid = :refid
            "
;
    
$sth $dbh->prepare($sql);
    
$q   $sth->execute(array(':refid' =>$refid));    
        
    if(
$row $sth->fetch()){                        
        
//$dbh->beginTransaction();    
        
$sql2 "INSERT INTO prn_txlabel (
                    label_type, orddtl_refid, ordbom_refid, barcode, label_refid,
                    barcode_readable, status, computername,
                    createby, createdate, lastupby, lastupdate
                ) VALUES (
                    :labeltype, :orddtl_refid, :ordbom_refid, :barcode, :label_refid,
                    :barcode_readable, :status, :computername,
                    :createby, GETDATE(), :lastupby, GETDATE()
                )"
;
        
$sth2 $dbh->prepare($sql2);
        
$q   $sth2->execute(array(
            
':labeltype' => 2//picking label
            
':orddtl_refid' => $row['orddtl_refid'],
            
':ordbom_refid' => $row['refid'],
            
':label_refid' => $row['refid'],
            
':barcode_readable' => 1,
            
':barcode' => generateJCBarcode($row['orddtl_refid']),            
            
':status' => 0,
            
':computername' => gethostbyaddr(getRealIpAddr()),
            
':createby' => filter_var($_SESSION['user'], FILTER_SANITIZE_STRING),
            
':lastupby' => filter_var($_SESSION['user'], FILTER_SANITIZE_STRING)
        ));    
/*        echo $sth2->getSQL(array(
            ':labeltype' => 2, //picking label
            ':orddtl_refid' => $row['orddtl_refid'],
            ':ordbom_refid' => $row['refid'],
            ':barcode_readable' => 1,
            ':barcode' => generateJCBarcode($row['orddtl_refid']),            
            ':status' => 0,
            ':computername' => generateJCBarcode($row['orddtl_refid']),
            ':createby' => filter_var($_SESSION['user'], FILTER_SANITIZE_STRING),
            ':lastupby' => filter_var($_SESSION['user'], FILTER_SANITIZE_STRING)
        ));        */    
        //$dbh->commit();
    
        //exit;
        
header("Location: sys_labelqueue.php");
        print 
"Saved.";
        exit;
    }else {
        
myerror("Invalid Request");
        exit;
    }
}else {
    
myerror("Invalid Request");
    exit;
}


?>