/home/mjc1/public_html/ryunen/adm/recom_report.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
<?php
$sub_menu 
"200580";
include(
"./_common.php");
include(
"./auth_check.php"); // 관리자 권한 체크
include($j3_adm_path."/shop_header.php");

if(
$sdate==''){ $sdate date("Y-m-d",time()-(60*60*24*7)); }
if(
$edate==''){ $edate date("Y-m-d",time()); }

//$sql = "select a.*, b.login_id, b.comp_name from point_edit a left join customers b on a.ccode = b.code WHERE 1=1 $where order by $order_key limit $from_record, $list_num";
$sql "select t_id, b.comp_name, b.hpno, count(t_id) as cnt, sum(ct_price) as tot_price, sum(recom_pt) as tot_recom_pt 
                from customers_recom_log a
                inner join customers b on a.t_id = b.login_id
                where a.reg_date between '
{$sdate} 00:00:00' and '{$edate} 23:59:59'
                group by t_id
            order by tot_recom_pt desc  "
;
$result      =    mysql_query($sql,$connect_j3);

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

//_pr($list_array);

$qstr $_SERVER['QUERY_STRING'];
?>
<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>
<!-- 검색영역 -->
    <input type='hidden' name='search_form_name' id='search_form_name' value='point_search_form'>
    <form name='point_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">
                <a class="lignt-blue-btn" id='btn_sms_send'>문자발송</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">
                기간 : <input type='text' name='sdate' id='sdate' value='<?php echo $sdate;?>' class='width_80'> ~ <input type='text' name='edate' id='edate' value='<?php echo $edate;?>' class='width_80'>
                &nbsp;&nbsp;
                <!--<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 screen_out">
        <div class="item_tab_navi">
            <a value='0'><span>매입처 관리</span></a>
            <a value='1' class="on"><span>매출처 관리</span></a>
            <!--<a value='2'><span>매입.매출처 관리</span></a>-->
        </div>
    </div><!--//item_tab-->
<!-- 탭 구분 영역 끝 -->

    <form name='customer_list_form' method='post'>
    <input type='hidden' name='sel_del' value='recom_report_send'>
    <div class="div-list-area">
        <div class="cust-list-area">
            <table class="order-sheet2">
                <caption class="screen_out">포인트 조회<caption>
                <colgroup>
                <col style="width:30px;">
                <col style="width:120px;"><col style="width:80px;"><col style="width:150px;">
                <col style="width:50px;">
                </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>
                    </tr>
                </thead>
                <tbody>
<?php 
    
for($i=0;$i<count($list_array);$i++){ 
        
$info $list_array[$i];
?>
                    <tr>
                        <td class="tcenter ">
                            <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>'>
                            <input type='hidden' name='codes[]' value='<?php echo $info['nidx'];?>'>

                            <input type='hidden' name='t_id[]' value='<?php echo $info['t_id'];?>'>
                            <input type='hidden' name='comp_name[]' value='<?php echo $info['comp_name'];?>'>
                            <input type='hidden' name='tot_recom_pt[]' value='<?php echo $info['tot_recom_pt'];?>'>
                            <input type='hidden' name='hpno[]' value='<?php echo $info['hpno'];?>'>
                        </td>
                        <td class="tcenter "><?php echo $info['t_id']." ({$info['comp_name']})";?></td>
                        <td class="tcenter"><?php echo $info['cnt'];?></td>
                        <td class="cost"><?php echo number_format($info['tot_price']);?></td>
                        <td class="cost"><?php echo number_format($info['tot_recom_pt']);?></td>
                    </tr>
<?php 
    

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

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

<script>
var qstr = '<?php echo $qstr;?>';
$(function(){

    $(".check_all_class").click(function(){ // 전체선택 전체선택 해제
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $("#btn_sms_send").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('정말로 전송하시겠습니까?')){    
            form_data = $("form[name='customer_list_form']").serialize();
            $.post("./ajax.customer_recom_process.php",form_data,function(rtn){
                $("#modal_member_box").html(rtn);
            });
        }
    });

    $("#search_btn_press").click(function(){ // 검색버튼 누를때
        document.point_search_form.action='?';
        document.point_search_form.target = '';
        document.point_search_form.submit();
    });
});
</script>

<?php
include($j3_adm_path."/shop_footer.php");
?>
<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>
<div id="modal_member_box2" title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"></div>