/home/mjc1/public_html/manage/m_happy.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
 <?php
include("./_common.php");
include(
"./include/admin_include_header.php");

$table "mBoard_happy";
$order_key "uid DESC";
$where "";

if(
$stx!=''){
    
$where .= " and {$sti} like '%{$stx}%' ";
}

if(
$st1!=''){
    
$where .= " and smtel = '{$st1}' ";
}
if(
$st2!=''){
    
$where .= " and smoption = '{$st2}' ";
}
if(
$st3!=''){
    
$where .= " and smemail = '{$st3}' ";
}

$sql  =   "select count(*) as cnt from {$table} a WHERE 1=1 {$where} ";
$result      =    mysql_query($sql,$connect_web);
$row mysql_fetch_array($result);
$total_count $row['cnt'];

$list_num 15;
$total_page  ceil($total_count $list_num);  // Àüü ÆäÀÌÁö °è»ê
if ($page 1) { $page 1; } // ÆäÀÌÁö°¡ ¾øÀ¸¸é Ã¹ ÆäÀÌÁö (1 ÆäÀÌÁö)
$from_record = ($page 1) * $list_num// ½ÃÀÛ ¿­À» ±¸ÇÔ

$sql "select * from {$table} a WHERE 1=1 {$where} order by {$order_key} limit {$from_record}{$list_num}";
$result      =    mysql_query($sql,$connect_web);

//_pr($sql);
while($cus_info=mysql_fetch_array($result)){
    
$list_array[] = $cus_info;
}

$qstr $_SERVER['QUERY_STRING'];

?>
<link rel='stylesheet' type='text/css' href='./css/base_add.css'>
<div id="contents" style="height:2px;border-bottom:1px solid #eee;background:#2f6ba9">
    <span class="screen_out">header ÇÏ´Ü ¼±</span>
</div>

<div id="wrap" class='container_wrap'>
    <div id="sub-title">
        <h2>¸¸Á·µµÁ¶»ç ¸®½ºÆ®</h2>
        <div class="sub-location">
            <a href="./index.php" class="home"><span class="screen_out">Ȩ</span></a>
            <span class="location-gt"></span>
            <a>°ü¸®ÀÚ</a>
            <span class="location-gt"></span>
            <a>¸¸Á·µµÁ¶»ç ¸®½ºÆ®</a>
        </div>
    </div>
<form name='customer_search_form' method='get'>
    <input type='hidden' name='biztype' size='' value='<?php echo $biztype;?>'>
    <div id="sub-contents-area">
        <div class="sub-btn-area">
            <div class="sub-btn">
                <!--<select name='order_key' class='order_key_class'>
                    <option value='comp_name' <?php if($order_key=='comp_name'){?>selected<?php }?>>»óÈ£¸í¼ø</option>
                    <option value='code1' <?php if($order_key=='code1'){?>selected<?php }?>>ÄÚµå¼ø</option>
                </select>-->
                <!--<a class="lignt-blue-btn" id='btn_qatxt_new'>½Å±Ôµî·Ï</a>--><!--<a class="blue-btn">ÁÖ¹®º¹»ç</a><?php if($Orow['ordstate']==0){ ?><a class="black-btn">Àüü»èÁ¦</a><?php }?><a class="gray-btn" id='buy_print'>Àμâ</a><a class="gray-btn" id='xls_down'>¿¢¼¿</a>--><a class="black-btn" id='sel_delete'>¼±ÅûèÁ¦</a>
            </div>
        </div>
        <div class="sub-btn-area">
            <div class="sub-btn sub-btn-search">
                <!--<select name='st1'>
                    <option value=''>==»óǰÁ¾·ù==</option>
                    <option value='õ³â3' <?php if($st1=='õ³â3'){ echo "selected"; }?>>õ³â3</option>
                    <option value='õ³â3CS' <?php if($st1=='õ³â3CS'){ echo "selected"; }?>>õ³â3CS</option>
                    <option value='õ³âII' <?php if($st1=='õ³âII'){ echo "selected"; }?>>õ³âII</option>
                    <option value='õ³âCS' <?php if($st1=='õ³âCS'){ echo "selected"; }?>>õ³âCS</option>
                    <option value='õ³âLite' <?php if($st1=='õ³âLite'){ echo "selected"; }?>>õ³âLite</option>
                    <option value='Á¦Á¶II' <?php if($st1=='Á¦Á¶II'){ echo "selected"; }?>>Á¦Á¶II</option>
                    <option value='Á¦Á¶CS' <?php if($st1=='Á¦Á¶CS'){ echo "selected"; }?>>Á¦Á¶CS</option>
                    <option value='Á¦Á¶Pro' <?php if($st1=='Á¦Á¶Pro'){ echo "selected"; }?>>Á¦Á¶Pro</option>
                    <option value='Á¦Á¶ProCS' <?php if($st1=='Á¦Á¶ProCS'){ echo "selected"; }?>>Á¦Á¶ProCS</option>
                    <option value='ÀÌÁöÅØ½º' <?php if($st1=='ÀÌÁöÅØ½º'){ echo "selected"; }?>>ÀÌÁöÅØ½º</option>
                </select>
                <select name='st2'>
                    <option value=''>==»ó´ã³»¿ë==</option>
                    <option value='»ç¿ë¹ý¹®ÀÇ' <?php if($st2=='»ç¿ë¹ý¹®ÀÇ'){ echo "selected"; }?>>»ç¿ë¹ý¹®ÀÇ</option>
                    <option value='±â´É¹®ÀÇ' <?php if($st2=='±â´É¹®ÀÇ'){ echo "selected"; }?>>±â´É¹®ÀÇ</option>
                    <option value='¿À·ù¹®ÀÇ' <?php if($st2=='¿À·ù¹®ÀÇ'){ echo "selected"; }?>>¿À·ù¹®ÀÇ</option>
                    <option value='¼³Ä¡ ¹× º¹±¸°ü·Ã¹®ÀÇ' <?php if($st2=='¼³Ä¡ ¹× º¹±¸°ü·Ã¹®ÀÇ'){ echo "selected"; }?>>¼³Ä¡ ¹× º¹±¸°ü·Ã¹®ÀÇ</option>
                    <option value='±Ý¾×°ü·Ã¹®ÀÇ' <?php if($st2=='±Ý¾×°ü·Ã¹®ÀÇ'){ echo "selected"; }?>>±Ý¾×°ü·Ã¹®ÀÇ</option>
                    <option value='±âŸ' <?php if($st2=='±âŸ'){ echo "selected"; }?>>±âŸ</option>
                </select>-->
                <select name='st3'>
                    <option value=''>==»ó´ã°á°ú==</option>
                    <option value='¾ÆÁÖ¸¸Á·' <?php if($st3=='¾ÆÁÖ¸¸Á·'){ echo "selected"; }?>>¾ÆÁÖ¸¸Á·</option>
                    <option value='¸¸Á·' <?php if($st3=='¸¸Á·'){ echo "selected"; }?>>¸¸Á·</option>
                    <option value='º¸Åë' <?php if($st3=='º¸Åë'){ echo "selected"; }?>>º¸Åë</option>
                    <option value='ºÒ¸¸Á·' <?php if($st3=='ºÒ¸¸Á·'){ echo "selected"; }?>>ºÒ¸¸Á·</option>
                </select>
                <select name='sti'>
                    <option value='smcompany' <?php if($sti=='smcompany'){?>selected<?php }?>>»óÈ£¸í</option>
                    <option value='cus_date' <?php if($sti=='cus_date'){?>selected<?php }?>>»ó´ãÀÏÀÚ</option>
                    <option value='smname' <?php if($sti=='smname'){?>selected<?php }?>>»ó´ã¿ø</option>
                    <option value='smdetail' <?php if($sti=='smdetail'){?>selected<?php }?>>Àü´Þ»çÇ×</option>
                </select>
                <input type='text' id='stx' name='stx' size='' value='<?php echo $stx;?>' class="stx_class">&nbsp;<a href="#" class="black-btn" id='search_btn_press'>°Ë»ö</a>
            </div>
        </div>
    </div>
</form>
    <!--<div class="item_tab">
        <div class="item_tab_navi">
            <a value='0'><span>¸ÅÀÔó °ü¸®</span></a>
            <a value='1' class="on"><span>¸ÅÃâó °ü¸®</span></a>
        </div>
    </div>--><!--//item_tab-->

<form name='qatxt_list_form' id='qatxt_list_form' method='post'>
<input type='hidden' name='sel_del' value=''>
    <div class="div-list-area">
        <div class="cust-list-area">
            <table class="order-sheet2">
                <caption class="screen_out">Á¶È¸<caption>
                <colgroup>
                <col style="width:30px;">
                </colgroup>

                <thead>
                    <tr>
                        <th scope="col"><input type='checkbox' name='ck_all' class='check_all_class'></th>
                        <th scope="col">¾÷ü¸í</th><th scope="col">»ó´ãÀÏÀÚ</th><th scope="col">»ç¿ëÁ¦Ç°</th><th scope="col">»óÈ£¸í(ĪÂùÁ÷¿ø)</th>
                        <th scope="col">»ó´ã³»¿ë</th><th scope="col">»ó´ã°á°ú<br>(¸¸Á·/ºÒ¸¸Á·)</th><th scope="col">µî·ÏÀÏÀÚ</th><th scope="col">»ó´ã°á°ú</th>
                    </tr>
                </thead>
                <tbody>
<?php 
    
for($i=0;$i<count($list_array);$i++){ 
        
$info $list_array[$i];
        if(
$info['state']=='1'){
            
$bgcolor " style='background-color:#C8EBFA;' ";
            
$std2 " selected"$std1 "";
        } else {
            
$bgcolor " style='background-color:#FBCFD0;' ";
            
$std1 " selected"$std2 "";
        }
?>
                    <tr>
                        <td class="tcenter ">
                            <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>'>
                            <input type='hidden' name='codes[]' value='<?php echo $info['uid'];?>'>
                        </td>
                        <td class="linetxt"><?php echo $info['smcompany'];?></td>
                        <td class="tcenter click_edit"><?php echo $info['cus_date'];?></td>
                        <td class="linetxt click_edit"><?php echo $info['smtel'];?></td>
                        <td class="linetxt"><?php echo $info['smname'];?></td>
                        <td class="linetxt"><?php echo $info['smoption'];?></td>
                        <td class="linetxt"><?php echo $info['smemail'];?></td>
                        <td class="tcenter "><?php echo $info['reg_date'];?></td>
                        <td class="tcenter ">
                            <select name='state' class='state' <?php echo $bgcolor;?> >
                                <option value='0' <?php echo $std1;?>>¹ÌÈ®ÀÎ</option>
                                <option value='1' <?php echo $std2;?>>È®ÀÎ</option>
                            </select>
                        </td>
                    </tr>
<?php 
    

?>
                </tbody>
            </table>
        </div>
    </div>
</form>

¡Ø Ãß°¡³»¿ë È®ÀÎÇϽǷÁ¸é »ó´ãÀÏÀÚ³ª »ç¿ëÁ¦Ç°À» Å¬¸¯Çϼ¼¿ä.
<br>
    <div class='pg_wrap' style='padding-top:0px;'>
        <?php echo get_paging($list_num$page$total_page"?$qstr");?>
    </div>

    <div class="footer">
        <?php include("./include/admin_include_footer.php"); ?>
    </div><!-- //footer -->

</div><!--//wrap-->

<script>
var qstr = '<?php echo $qstr;?>';
$(function(){
    $(".state").change(function(){
        $v = $(this).val();
        $vv = $(this).closest("tr").find(".state option").eq($v).text();
        if(confirm('ÇØ´ç »ó´ã°á°ú¸¦ '+$vv+'À¸·Î º¯°æÇϽðڽÀ´Ï±î?')){
            $uid = $(this).closest("tr").find("input[name='codes[]']").val();
            $url = "m_happy_process.php.php?mode=ch_state&state="+$v+"&uid="+$uid;
            $.get($url,function(rtn){
                if(rtn=='ok'){
                    document.location.reload();
                } else {
                    alert(rtn);
                }
            })
        } else {
            if($v=='1'){
                $("#state option").eq(0).prop("selected",true);
            } else {
                $("#state option").eq(1).prop("selected",true);
            }
        }
    });

    $(".item_tab_navi a").click(function(){ //³×ºñ°ÔÀ̼ǠÅǠó¸®
        v = $(this).attr("value");
        vv = qstr_rmv(qstr,"biztype");
        document.location.href="?"+vv+"&biztype="+v;
    });

    $(".check_all_class").click(function(){ // Àüü¼±ÅàÀüü¼±ÅÃ ÇØÁ¦
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $("#search_btn_press").click(function(){ // °Ë»ö¹öư
        $form_obj = $(this).closest("form");
        $form_obj.submit();
    });

    $(".click_edit").css("cursor","pointer").click(function(){ // »ó¿ë¹®±¸ ¼öÁ¤
        var code = $(this).closest("tr").find("input[name='codes[]']").val();
        $.get("m_happy_reg.php.php?code="+code,function(rtn){
            $("#modal_member_box").html(rtn).dialog({
                resizable: true, height:630, width:740, modal: true, title: "»ó¿ë¹®±¸ [¼öÁ¤]",
                buttons: {
                    /*ÀúÀå: function() {
                        form_save();
                    },*/
                    ´Ý±â: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        });
    });

    /*$("#btn_qatxt_new").click(function(){ // ½Å±Ôµî·Ï
        $.get("m_cusafter_reg.php",function(rtn){
            $("#modal_member_box").html(rtn).dialog({
                resizable: true, height:630, width:740, modal: true, title: "»ó¿ë¹®±¸ [½Å±Ô]",
                buttons: {
                    ÀúÀå: function() {
                        form_save();
                    },
                    ´Ý±â: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        });
    });*/

    $("#sel_delete").click(function(){ // ¼±ÅûèÁ¦
        var ck_cnt = 0;
        var v = $("input[name='code_idx[]']").each(function(){
            if($(this).is(":checked")){ ck_cnt++; }
        });
        if(ck_cnt==0){ alert('»èÁ¦ÇϽǠ°Ô½Ã¹°À» ¼±ÅÃÇϼ¼¿ä.'); return; }
        if(confirm('Á¤¸»·Î ¼±ÅÃÇϽŠ'+ck_cnt+'°³ÀÇ °Ô½Ã¹°À» »èÁ¦ÇϽðڽÀ´Ï±î?')){
            $("input[name='sel_del']").val("Y");
            var form_data = $("form[name='qatxt_list_form']").serialize();
            $("#qatxt_list_form").prop("action","m_happy_process.php");
            $("#qatxt_list_form").submit();

        }

    });

});

function form_save(){ // ÀúÀå/¼öÁ¤ ¹öư
    if($("#qatxt_reg_form input[name='subject']").val()==''){
        alert('Á¦¸ñÀ» ÀÔ·ÂÇϼ¼¿ä.'); return;
    }
    if($("#qatxt_reg_form input[name='content']").val()==''){
        alert('³»¿ëÀ» ÀÔ·ÂÇϼ¼¿ä.'); return;
    }
    if(confirm('ÀúÀåÇϽðڽÀ´Ï±î?')){
        $("#qatxt_reg_form input[name='qstr']").val('<?php echo $qstr;?>');
        $("#qatxt_reg_form").submit();
    }
}
</script>

</body>
</html>
<div id="modal_member_box" title="°Å·¡Ã³¼öÁ¤" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"></div>