| 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
 | <?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
 // $sql = "SELECT * from cn_cusmain_dtl WHERE refid = :refid"; //should be cn_cus 20220727
 $sql = "SELECT * from cn_cus_main WHERE refid = :refid"; //should be cn_cus 20220811
 
 $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 = getCusIvcTemplateSrc( getCusIvcTemplate_refid($row['ivc_customer']) );
 $template = getCusIvcTemplateSrc( getCusIvcTemplate_refid($row['cn_customer']) ); //20220727
 
 //override customer default template
 if(!empty($_REQUEST['tid'])){
 switch($_REQUEST['tid']){
 case 1:
 $template = "xls_bal_cus_template.php";
 break;
 }
 }
 
 if( !empty($template) ){
 include $template;
 }
 ?>
 |