/var/www/hkosl.com/littleark/webadmin/ajax_content.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
<?php
    
include_once('configure.php');

    if (!isset(
$_POST)) {
        exit;
    } else {
        if (
$_POST["for_page"] == "discount_addform_discount_3") {
            
$num_of_discount_3 $_POST["num_of_discount_3"];

            echo 
'<table class="discount_3_clone_table" id="discount_3_clone_table"><tr class="discount_3 discount discount_3_flag clone_' $num_of_discount_3 '">
                                    <td width="120" align="right" valign="top" class=" required_field">' 
_lang("Product Group") . '</td>
                                    <td class="" valign="top" style="width: 1px;">:&nbsp;</td>
                                    <td class="">

                                        <select name="condition_product_group_id[]" class="select_product_group" id="condition_product_group_id" data-placeholder="Choose a Item Group">'
;

            
$sql                "select * from product_group_master where deleted = 0 order by name_" $_SESSION["wlangcode"];
            
$product_group_item bind_pdo($sqlNULL"selectall");
            foreach (
$product_group_item as $group) {
                echo 
"<option value='" $group["id"] . "'>" $group["name_" $_SESSION["wlangcode"]] . "</option>";
            }


            echo 
'</select>
                                        <br><br>
                                    </td>
                                </tr>

                                <tr class="discount_3 discount clone_' 
$num_of_discount_3 '">
                                    <td width="120" align="right" valign="top" class=" required_field">' 
_lang("Min Quantity") . '</td>
                                    <td class="" valign="top">:&nbsp;</td>
                                    <td class="">
                                        <input type="number" name="condition_min_qty[]" min="1" class="condition_min_qty small_textfield"/> <br><br>
                                        <button type="button" onclick="remove_discount_3_clone(' 
$num_of_discount_3 ');">- ' _lang("Remove") . '</button>

                                    </td>
                                </tr>

                                <tr class="discount_3 discount clone_' 
$num_of_discount_3 '">
                                    <td colspan="3"><hr></td>
                                </tr></table>
                                '
;
        } else if (
$_POST["for_page"] == "discount_addform_discount_4") {
            
$num_of_discount_4 $_POST["num_of_discount_4"];


            
/*echo '<tr id="discount_condition" class="clone_' . $num_of_discount_4 . '">
                        <td colspan="3">
                            <hr>
                        </td>
                    </tr>';*/


            /*echo '<tr id="discount_condition" class="clone_' . $num_of_discount_4 . ' discount_4_flag">
                        <td width="120" align="right" valign="top" class=""></td>
                        <td class="" valign="top"></td>
                        <td class="">
                            <span style="font-size: 13px; font-weight: bold;">'._lang("Discount Conditions").'</span>
                            <br><br>
                        </td>
                    </tr>';*/

            
echo '<div class="col-md-12 form-group clone_' $num_of_discount_4 ' discount_4_flag" id="discount_condition">
                                    <hr>

                                    <label for="" class="col-sm-2 control-label"></label>

                                    <div class="col-sm-10">
                                        <label for="" class="col-sm-10 control-label" style="padding-left: 0;">' 
_lang("Discount Conditions") . '</label>
                                    </div>
                                </div>'
;


            
/*echo '<tr class="discount_4 discount clone_' . $num_of_discount_4 . '">
                        <td width="120" align="right" valign="top" class="">'._lang("Quantity Range").'</td>
                        <td class="" valign="top">:&nbsp;</td>
                        <td class="">
                            '._lang("Quantity From").': <input type="text" name="condition_min_from_qty[]" value="1" class="small_textfield"/>
                            &nbsp;&nbsp;&nbsp;
                            '._lang("Quantity To").': <input type="text" name="condition_min_to_qty[]" value="999" class="small_textfield"/>
                            <br><br>
                        </td>
                    </tr>';*/


            
echo '<div class="col-md-12 form-group discount_4 discount clone_' $num_of_discount_4 '">
                                    <label for="" class="col-sm-2 control-label required_field">' 
_lang("Quantity Range") . '</label>

                                    <div class="col-sm-10">
_lang("Quantity From") . ':
                                        <input type="number" name="condition_min_from_qty[]" value="1" min="1" class="form-control input-sm"><br>

                                        ' 
_lang("Quantity To") . '":
                                        <input type="number" name="condition_min_to_qty[]" value="999" min="1" class="form-control input-sm">
                                    </div>
                                </div>'
;

            
/*echo '<tr id = "discount_result" class="clone_' . $num_of_discount_4 . '">
                        <td width = "120" align = "right" valign = "top" class="" ></td >
                        <td class="" valign = "top" ></td >
                        <td class="" >
                            <span style = "font-size: 13px; font-weight: bold;" > '._lang("Discount Result").' </span >
                            <br ><br >
                        </td >
                    </tr > ';*/

            
echo '<div class="col-md-12 form-group clone_' $num_of_discount_4 '" id="discount_result">
                                    <hr>

                                    <label for="" class="col-sm-2 control-label"></label>

                                    <div class="col-sm-10">
                                        <label for="" class="col-sm-10 control-label" style="padding-left: 0;">' 
_lang("Discount Result") . '</label>
                                    </div>
                                </div>'
;

            
/*echo '<tr class="discount_4 discount clone_' . $num_of_discount_4 . '">
                        <td width="120" align="right" valign="top" class="">'._lang("Deduct Type").'</td>
                        <td class="" valign="top">:&nbsp;</td>
                        <td class="">
                            '._lang("Percentage").'
                            <br><br>
                        </td>
                    </tr>';*/

            
echo '<div class="col-md-12 form-group discount_4 discount clone_' $num_of_discount_4 '">
                                    <label for="" class="col-sm-2 control-label required_field">' 
_lang("Deduct Type") . '</label>

                                    <div class="col-sm-2">

                                        <label> ' 
_lang("Percentage") . ' </label>
                                    </div>
                                </div>'
;

            
/*echo '<tr class="discount_4 discount clone_' . $num_of_discount_4 . '">
                        <td width="120" align="right" valign="top" class="">' . _lang("Deduct Value") . '</td>
                        <td class="" valign="top">:&nbsp;</td>
                        <td class="">
                            <input type="text" name="result_discount_value[]" class="small_textfield" />
                            <br>
                            <div class="msg">' . _lang("If deduct type is \"Percentage\", it means that this discount will deduct x%.") . '</div>
                            <br>
                            <button type="button" onclick="remove_discount_4_clone(' . $num_of_discount_4 . ');">- ' . _lang("Remove") . '</button>
                            <br><br>
                        </td>
                    </tr>';*/

            
echo '<div class="col-md-12 form-group discount_4 discount clone_' $num_of_discount_4 '">
                                    <label for="" class="col-sm-2 control-label required_field">' 
_lang("Deduct Value") . '</label>

                                    <div class="col-sm-10">
                                        <input type="text" name="result_discount_value[]" class="form-control input-sm">
                                        <span class="msg deduct_value_remark" ></span>

                                        <p class="help-block">' 
_lang('If deduct type is "Percentage", it means that this discount will deduct x%.<br>If deduct type is "Fixed", it means that this discount will deduct x.') . '</p>

                                        <br>
                                        <button type="button" onclick="remove_discount_4_clone(' 
$num_of_discount_4 ');">- ' _lang("Remove") . '</button>
                                    </div>
                                </div>'
;

        } else if (
$_POST["for_page"] == "discount_itemgroup") {
            
$list "";

            if (!empty(
$_POST["item_group_list"])) {
                
$all_item_group $_POST["item_group_list"];

                foreach (
$all_item_group as $itemgroup_id) {
                    
$sql        "select * from jPOS_ItemGroupProdCodeList codelist INNER JOIN jPOS_ItemMaster itemmaster ON codelist.prod_code = itemmaster.PROD_CODE where codelist.item_group_id = ?";
                    
$parameters = array($itemgroup_id);
                    
$item_info  bind_pdo($sql$parameters"selectall");

                    foreach (
$item_info as $item) {
                        
$list .= $item["ITEM_DESC"] . "(" $item["PROD_CODE"] . "), ";
                    }
                }

                
$list substr_replace($list"", -2);
            }

            echo 
$list;
        } else if (
$_POST["for_page"] == "customer_points_status") {

            if (!empty(
$_POST["customer_points_id"])) {
                foreach (
$_POST["customer_points_id"] as $key => $customer_points_id) {
                    
$sql        "update customer_point set status = ?, lastupdate=?, lastupby=? where id = ?";
                    
$parameters = array($_POST["customer_points_status"][$key], date("Y-m-d H:i:s"), $_SESSION["cmsloginid"], $customer_points_id);
                    
bind_pdo($sql$parameters);
                }

                echo 
"success";
            }
        }
    }