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

$refid                 filter_var($_REQUEST['refid'], FILTER_SANITIZE_NUMBER_INT);

if(
$refid){
    
$sql "SELECT * from ivc_cus WHERE refid = :refid"//should be ivc_cus
    
$sth $dbh->prepare($sql);
    
$sth->execute(  array(':refid' => $refid) );            

$row $sth->fetch();
$sth=null;
if( empty(
$row) ){
    
vdump($_REQUEST); exit;
    
myerror(INVALID.WS.REQUESET); 
    exit;    
}

//check permission before printing
if( havePermission("DPr")==false || havePermission("DCr")==false ){
    
myerror(INVALID.WS.PERMISSION);
}

//get customer prefered template
$template getCusIvcTemplateSrcgetCusIvcTemplate_refid($row['ivc_customer']) );

//override customer default template 
if(!empty($_REQUEST['tid'])){
    switch(
$_REQUEST['tid']){
    case 
1:
       
$template "xls_ivcrpt_template1.php";
        break;
    case 
2:
        
$template "xls_ivcrpt_template2.php";
        break;
    case 
3:
        
$template "pdf_ivcrpt_template3.php";
        break;
    case 
4:
        
$template "pdf_ivcrpt_template4.php";
        break;        
    case 
5:
        
$template "xls_ivcrpt_template5.php";
        break;        
    case 
6:
        
$template "pdf_ivcrpt_template6.php";
        break;        
    }        
}

if( !empty(
$template) ){
    include 
$template;
}
?>