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

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

if(
$refid){
    
$sql "SELECT * from cn_cusmain_dtl WHERE refid = :refid"//should be cn_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['final_customer']) );

//override customer default template 
if(!empty($_REQUEST['tid'])){
    switch(
$_REQUEST['tid']){
        case 
1:
        
$template "pdf_cn_cus.php";
         break;
       case 
9:
        
$template "pdf_cn_cus_templateAJ.php";
        break;        
        case 
10:
        
$template "pdf_cn_cus_templateAtelier.php";
        break;
        case 
16:
        
$template "xls_cncus_template2.php";
        }                
}

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