-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard_update.php
94 lines (86 loc) · 3.38 KB
/
card_update.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
include_once "includes/db_configms.php";
include_once "includes/common_class.php";
$mode = ($_GET['mode']) ? $_GET['mode'] : $_POST['mode'];
$cId = ($_GET['cId']) ? $_GET['cId'] : $_POST['cId'];
$cardid = ($_GET['cardid']) ? $_GET['cardid'] : $_POST['cardid'];
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$phoneno = ($_GET['phoneno']) ? $_GET['phoneno'] : $_POST['phoneno'];
$stype = ($_GET['stype']) ? $_GET['stype'] : $_POST['stype'];
$sstatus = ($_GET['sstatus']) ? $_GET['sstatus'] : $_POST['sstatus'];
if($stype == "Customer") $strType = 1;
else if($stype == "Vendor") $strType = 2;
else if($stype == "Employee") $strType = 3;
else if($stype == "Bank") $strType = 4;
else $strType = 0;
if($mode == "delete")
{
$Query = "DELETE FROM Card ".
"WHERE CID='".$cId."' AND CardType =".$strType." AND CardID=".$cardid;
mssql_query($Query);
}
else
{
if ($name == "") {
echo ("<script>alert('상호명 또는 성명을 입력하세요.');</script>");
echo ("<script>history.back(-1);</script>");
}
$terms = ($_GET['terms']) ? $_GET['terms'] : $_POST['terms'];
$limit = ($_GET['limit']) ? $_GET['limit'] : $_POST['limit'];
if ($terms == "") $terms = 0;
if ($limit == "") $limit = 0;
$CustomList1 = ($_GET['CustomList1']) ? $_GET['CustomList1'] : $_POST['CustomList1'];
$CustomList2 = ($_GET['CustomList2']) ? $_GET['CustomList2'] : $_POST['CustomList2'];
$CustomList3 = ($_GET['CustomList3']) ? $_GET['CustomList3'] : $_POST['CustomList3'];
$CustomField1 = ($_GET['CustomField1']) ? $_GET['CustomField1'] : $_POST['CustomField1'];
$CustomField2 = ($_GET['CustomField2']) ? $_GET['CustomField2'] : $_POST['CustomField2'];
$CustomField3 = ($_GET['CustomField3']) ? $_GET['CustomField3'] : $_POST['CustomField3'];
$today = date("Y-m-d H:i:s");
if($cardid =="" && readCardName($cId,$name,$strType) == "")
{
$strCardID = getCardID($cId,$strType);
$Query = "INSERT INTO Card (CID,CardType,CardID,Name,Phone,cType,Status,cTerm,cLimit,CustomList1,CustomList2,CustomList3,".
"CustomField1,CustomField2,CustomField3,regDate) VALUES ('".
$cId."',".
$strType.",".
$strCardID.",'".
Br_dconv(trim($name))."','".
$phoneno."','".
$stype."','".
$sstatus."',".
trim($terms).",".
trim($limit).",'".
Br_dconv($CustomList1)."','".
Br_dconv($CustomList2)."','".
Br_dconv($CustomList3)."','".
Br_dconv($CustomField1)."','".
Br_dconv($CustomField2)."','".
Br_dconv($CustomField3)."','".
$today."')";
mssql_query($Query);
}
else if(readCard($cId,$cardid,$strType))
{
$Query = "UPDATE Card SET ".
"Name='".Br_dconv($name)."',".
"Phone='".$phoneno."',".
"cType='".$stype."',".
"Status='".$sstatus."',".
"cTerm=".trim($terms).",".
"cLimit=".trim($limit).",".
"CustomList1='".Br_dconv($CustomList1)."',".
"CustomList2='".Br_dconv($CustomList2)."',".
"CustomList3='".Br_dconv($CustomList3)."',".
"CustomField1='".Br_dconv($CustomField1)."',".
"CustomField2='".Br_dconv($CustomField2)."',".
"CustomField3='".Br_dconv($CustomField3)."',".
"regDate='".$today."' ".
"WHERE CID='".$cId."' AND CardType =".$strType." AND CardID=".$cardid;
mssql_query($Query);
//echo $Query;
}
}
?>
<script>
history.back(-1);
</script>