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

//$refid                 = filter_var($_REQUEST['refid'], FILTER_SANITIZE_NUMBER_INT);
$invno             filter_var($_REQUEST['invno'], FILTER_SANITIZE_STRING);    
$companyid            filter_var($_REQUEST['companyid'], FILTER_SANITIZE_STRING);
$createby            filter_var($_SESSION['user'], FILTER_SANITIZE_STRING);
$lastupby            filter_var($_SESSION['user'], FILTER_SANITIZE_STRING);

if( 
$_REQUEST['action']=="stocktake_start" ){
    
    if(
inv_underStocktake($companyid)===true){
        
myerror(STOCKTAKE.WS.IN_PROGRESS);
        exit;    
    }
    
    
$sql "INSERT INTO inv_stocktake ( 
                invno, startdate, companyid,
                createby, createdate, lastupby, lastupdate 
            ) Values (
                :invno, GETDATE(), :companyid,
                :createby, GETDATE(), :lastupby, GETDATE()
            ) "
;
            
    
$sth $dbh->prepare($sql);
    
$q $sth->execute( array(':invno'=>$invno,
                                
':companyid'=>$companyid,
                                
':createby'=>$createby,
                                
':lastupby'=>$lastupby) );
/*    echo $sth->getSQL( array(':invno'=>$invno,
                                ':companyid'=>$companyid,
                                ':createby'=>$createby,
                                ':lastupby'=>$lastupby) ). HTML_EOL;*/
    
pdo_showerror($sth$q);
    
$refid $dbh->lastInsertId();

//vdump($_REQUEST); exit;        
    /*exit;*/                
    //header("Location: inv_stone_index.php?act=resume&msg=Saved."); 
    
header("Location: inv_stocktake_index.php?companyid=$companyid&msg=Started");
    print 
"Saved.";
    exit;
    
    
}
print 
"Invalid Request";