/var/www/hkosl.com/oneMotorChunHing_delete20240201/html/invoicedelete.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
<?
require("inc/configure.php");
require(
"inc/global.php");
require(
"inc/checklogin.php");
if (
$logged_in == 0) {
    
//echo 'Not logged in. <a href="login.php">Login</a>';
    
header('Window-target: _parent');
    
header('Location: login.php');
    exit();
}
if (
checkObject(16) <> 1){
    die(
"Unauthorized Access");
    exit();
}
?>
<?
$invoiceno    
$_GET['invoiceno'];
$act        $_POST['act'];
if (
$act == 1)
{
    
$sql "
    update OM_INVOICE_HDR
    set status = 3
    where invoiceno = 
$invoiceno
    "
;
    
$result mysql_query($sql);
    
    if (!
$result) {
        die(
'Invalid query: ' mysql_error());
    }

    
$sql "
    update INV_STOCK_TRANSACTION 
    set qty = 0
    where docno = 
$invoiceno
    "
;
    
$result mysql_query($sql);
    
    if (!
$result) {
        die(
'Invalid query: ' mysql_error());
    }

    
header("Location: invoice.php?msg=Delete invoice ".$invoiceno." successful");
}
else
{
?>
    <html>
    <head>
    <title><?=$systitle?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="main.css" type="text/css">
    <script type="text/javascript" src="calendarDateInput.js"></script>
    <!--popup start-->
    <script language="javascript">
    function popups(lnk)
    {
        window.open(lnk,"Popup","height=400,width=550,scrollbars=yes")
    }
    </script>
    <!--popup end-->
    </head>
    <body bgcolor="#FFFFFF" leftmargin="10" topmargin="10" marginwidth="0" marginheight="0">
    <form action="invoicedelete.php?invoiceno=<?=$invoiceno?>" name="deleteform" method="post">
    <input type="hidden" name="act" value="1">
    <p>Are you sure want to delete invoice "<?=$invoiceno?>"?
    <input type="submit" value="Yes" class="content">
    <input type="button" value="No" class="content" onClick="javascript:history.back()">
    </form>
    </body>
    </html>
<?
}    
?>