/var/www/hkosl.com/innoutstorage/webadmin/discount_addform.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?php
require_once('check_login.php');

if (empty(
$_GET["location_id"])) {
    
$location_id 1;
} else {
    
$location_id = (int)$_GET["location_id"];
}

$discount_type = (int)$_GET["discount_type"];

if (
$discount_type == 1) {    //預繳優惠
    
$title "預繳";

    
$sql "select * from master_type_code where typeid = ? and code != ? and deleted = ? order by sort ASC";
    
$parameters = array("PAYMENT_TERM""SPECIFIC_SIZE"0);
    
$discount_option_info bind_pdo($sql$parameters"selectall");
}

if (
$discount_type == 2) {    //指定單位優惠
    
$title "指定單位";
    
$sql "select * from master_type_code where typeid = ? and code = ? and deleted = ? order by sort ASC";
    
$parameters = array("PAYMENT_TERM""SPECIFIC_SIZE"0);
    
$discount_option_info bind_pdo($sql$parameters"selectall");
}

$master_room_info get_master_room(null$location_id);
$locations get_location();
?>
<!DOCTYPE html>
<html>
<head>
    <?php require_once('html_head.php'); ?>

    <script type="text/javascript">
        $(function () {
            $("#effectivedate_from").datepicker({dateFormat: 'yy-mm-dd'});
            $("#effectivedate_to").datepicker({dateFormat: 'yy-mm-dd'});

            $("#check_all").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".master_room").attr("checked", true);
                } else {
                    $(".master_room").attr("checked", false);
                }

                if ($("#check_all_remark").text() == "全選") {
                    $("#check_all_remark").text("取消全選");
                } else {
                    $("#check_all_remark").text("全選");
                }
            });
        });
    </script>

    <style>
        .room_size_checkbox {
            width: 160px;
            height: 30px;
            display: inline-block;
            vertical-align: top;
            margin-top: 10px;
        }
    </style>
</head>
<body>
<form action="discount_add.php" method="post" name="addform" enctype="multipart/form-data">
    <input type="hidden" name="discount_type" value="<?= (int)$_GET["discount_type"?>"/>
    <input type="hidden" name="location_id" value="<?= (int)$_GET["location_id"?>"/>
    <table width="1100" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td height="70" align="right" valign="middle" class="icontxt">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="50" align="center" style="font-size: 12px;">
                            <input type="image" alt="submit" src="images/iconSave.png" width="32" height="32" border="0"><br>
                            &nbsp;儲存&nbsp;&nbsp;</a></td>
                        <td width="50" align="center">
                            <a href="discount_index.php?discount_type=<?= (int)$_GET["discount_type"?>&msg=取消&location_id=<?= (int)$_GET["location_id"?>"><img
                                    src="images/iconCancel.png" alt="Cancel" width="32" height="32" border="0"><br>
                                &nbsp;取消&nbsp;&nbsp;</a></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="pagetitletxt">
                &nbsp;&nbsp;<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/>新增 優惠設定(<?= $title ?>)</b>
            </td>
        </tr>
        <tr>
            <td align="left" valign="middle"><!-- Content -->
                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>樓層</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <select name="location_id" style="margin-bottom: 10px;"
                                    onchange="location.href='discount_addform.php?discount_type=<?= $discount_type ?>&location_id='+this.value;">
                                <?php
                                
foreach ($locations as $location) {
                                    if (
$location["location_id"] == 1) {
                                        
$name "所有樓層";
                                    } else {
                                        
$name "只限" $location["location_code"] . " " $location["location_name_tc"];
                                    }
                                    echo 
"<option value='" $location["location_id"] . "' " . ($location_id == $location["location_id"] ? "selected" "") . ">" $name "</option>";
                                }
                                
?>
                            </select>
                            <br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>倉庫尺寸</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <!--<select name="master_room_id">
                            <?php
                            
/*                                if($_GET["discount_type"] == 1)
                                                                echo "<option value='ALL'>所有</option>";
                                                            foreach($master_room_info as $master_room){
                                                                echo "<option value='".$master_room["id"]."'>".$master_room["length"]." X ".$master_room["width"]." X ".$master_room["height"]."</option>";
                                                            }
                                                        */ 
?>
                            </select>-->

                            <div style="width: 800px;">
                                <input type="checkbox" id="check_all"> <span id="check_all_remark">全選</span>
                                <br>

                                <?php
                                
foreach ($master_room_info as $master_room) {

                                    if (
$master_room["location_id"] > 1) {
                                        
$check_if_f12_has_this_size check_if_f12_has_this_size($master_room["id"]);
                                        if (!
$check_if_f12_has_this_size) {
                                            
//echo '<div style="width: 160px; height: 50px; display: inline-block;vertical-align: top;"><input type="checkbox" name="master_room_ids[]" value="'.$master_room["id"].'" class="master_room">'.$master_room["length"]." X ".$master_room["width"]." X ".$master_room["height"]. ($master_room{"display_size"} != ($master_room{'length'}) . "' x " . ($master_room{'width'}) . "' x " . ($master_room{'height'}) . "'" ? "<br> &nbsp;&nbsp;&nbsp;&nbsp;(" . $master_room{"display_size"} . ")" : "").'</div>';
                                            //echo '<div style="width: 160px; height: 30px; display: inline-block;vertical-align: top;"><input type="checkbox" name="master_room_ids[]" value="'.$master_room["id"].'" class="master_room">'.$master_room["length"]." X ".$master_room["width"]." X ".$master_room["height"].'</div>';
                                            
echo '<div class="room_size_checkbox"><input type="checkbox" name="master_room_ids[]" value="' $master_room["id"] . '" class="master_room">' $master_room["length"] . " X " $master_room["width"] . " X " $master_room["height"] . '' . ($master_room{"display_size"} != ($master_room{'length'}) . "' x " . ($master_room{'width'}) . "' x " . ($master_room{'height'}) . "'" "<br> &nbsp;&nbsp;&nbsp;&nbsp;(" $master_room{"display_size"} . ")" "") . '</div>';
                                        }
                                    } else {
                                        
//echo '<div style="width: 160px; height: 50px; display: inline-block; vertical-align: top;"><input type="checkbox" name="master_room_ids[]" value="'.$master_room["id"].'" class="master_room">'.$master_room["length"]." X ".$master_room["width"]." X ".$master_room["height"]. ($master_room{"display_size"} != ($master_room{'length'}) . "' x " . ($master_room{'width'}) . "' x " . ($master_room{'height'}) . "'" ? "<br> &nbsp;&nbsp;&nbsp;&nbsp;(" . $master_room{"display_size"} . ")" : "").'</div>';
                                        //echo '<div style="width: 160px; height: 30px; display: inline-block; vertical-align: top;"><input type="checkbox" name="master_room_ids[]" value="'.$master_room["id"].'" class="master_room">'.$master_room["length"]." X ".$master_room["width"]." X ".$master_room["height"].'</div>';
                                        
echo '<div class="room_size_checkbox"><input type="checkbox" name="master_room_ids[]" value="' $master_room["id"] . '" class="master_room">' $master_room["length"] . " X " $master_room["width"] . " X " $master_room["height"] . ($master_room{"display_size"} != ($master_room{'length'}) . "' x " . ($master_room{'width'}) . "' x " . ($master_room{'height'}) . "'" "<br> &nbsp;&nbsp;&nbsp;&nbsp;(" $master_room{"display_size"} . ")" "") . '</div>';
                                    }

                                    
//echo '<div style="width: 120px; float: left;"><input type="checkbox" name="master_room_ids[]" value="'.$master_room["id"].'" class="master_room">'.$master_room["length"]." X ".$master_room["width"]." X ".$master_room["height"].'</div>';
                                
}

                                
?>
                                <div style="clear: both;"></div>
                            </div>

                            <br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>優惠類型</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <select name="payment_term">
                                <?php
                                
foreach ($discount_option_info as $discount_option) {
                                    echo 
"<option value='" $discount_option["code"] . "'>" $discount_option["name_tc"] . " </option>";
                                }
                                
?>
                            </select>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>優惠折扣</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <input type="text" name="discount" class="content" required="required"/> % (eg: 20% -> 8折)
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>最後折扣 (不可折上折)</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <input type="checkbox" class="content" name="is_final_discount" id="is_final_discount" value="1">
                            <br>
                            <span class="msg">折扣順序: 先進行預繳折扣,然後進行指定尺寸折扣。</span>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>開始日期</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="effectivedate_from" id="effectivedate_from" required="required">
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>完結日期</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="effectivedate_to" id="effectivedate_to" required="required">
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>前台顯示優惠</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <input type="radio" class="content" name="show_frontend" id="show_frontend" value="1"> 顯示
                            <input type="radio" class="content" name="show_frontend" id="show_frontend" value="0" checked> 不顯示
                            <br>
                            <span class="msg">同尺寸的優惠最多在前台顯示2個,按預付月份較大排序。</span>
                            <br><br>
                        </td>
                    </tr>

                </table>
                <!-- End Content -->
            </td>
        </tr>

        <tr>
            <td align="left" valign="middle">&nbsp;</td>
        </tr>
    </table>
</form>
</body>
</html>