/home/mjc1/public_html/mjmall/mypagepoint.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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<? 
include_once("./_common.php");
include(
"./include/common/header.php"); ?>

<?
    
if (!isset($pg)) $pg ""//20130909 ¼öÁ¤
    
if (!isset($mode)) $mode "";
    if (!isset(
$txtdate)) $txtdate "";    
    if (!isset(
$txtdate2)) $txtdate2 "";
    if (!isset(
$searchCode)) $searchCode "";
    if (!isset(
$SearchMper)) $SearchMper "";
    if (!isset(
$SearchMsw1)) $SearchMsw1 "";
    if (!isset(
$SearchMdiv)) $SearchMdiv "";
    if (!isset(
$SearchMup)) $SearchMup "";
    if (!isset(
$searchid)) $searchid "";
    if (!isset(
$sumusepoint)) $sumusepoint "";
    
    if(!isset(
$_COOKIE['USERID'])) $_COOKIE['USERID'] = "";

    if( !isset(
$_COOKIE['USERID']) || $_COOKIE['USERID'] == "" ) { //20130909 ¼öÁ¤
?>

<script>
    location.href = "./logingo.php?menu=5";
</script>

<?
    
mysql_close();
?>

<? 
    
if ($txtdate == "") { 
        
$txtdate = ($txtdate == "") ? date("Y-m-d"strtotime("-7 Day")) : $txtdate
    }
    if (
$txtdate2 == "") { 
        
$txtdate2 = ($txtdate2 == "") ? date("Y-m-d"time()) : $txtdate2
    }
?>


<script type="text/javascript" src="./js/calendar.js"></script>

<script>
function Search(){ 
    searchFrm.submit();
}

/* ³¯Â¥±â°£°Ë»ö*/
function setDay(t){// ÀÏÂ÷¸¦ ÆÄ¶ó¸ÞÅͷΠ¹Þ´Â´Ù

    var now = new Date;

    if ((now.getMonth()+1) < 10){
        month = "0"+(now.getMonth()+1);
    }else{
        month = (now.getMonth()+1);
    }
 
    if (now.getDate() < 10){
        date = "0"+now.getDate();
    }else{
        date = now.getDate();
    }

    var today = now.getFullYear() + "-" + month + "-" + date;//ÇöÀ糯¥
        document.searchFrm.txtdate2.value = today; 
        document.searchFrm.txtdate.value = getThatday(today,t); //ÇöÀ糯¥¿Í ÀÏÂ÷¸¦ ÆÄ¶ó¹ÌÅͷΠº¸³»¼­ °á°ú¸®ÅÏÇÑ´Ù.
    }

function getThatday(today,t){ //³¯Â¥, ÀÏÂ÷¸¦ ÆÄ¶ó¸ÞÅͷΠ¹Þ´Â´Ù.

    var pdate=new Array(); 
    var pday=today.split("-"); //³¯Â¥¸¦ ±¸ºÐÀڷΠ³ª´©¾î ¹è¿­·Î º¯È¯ÇÑ´Ù.
    var ptoday=new Date(pday[0],pday[1]-1,pday[2]); //µ¥ÀÌÆ®°´Ã¼ »ý¼ºÇÑ´Ù.
    var ptimestamp=ptoday.valueOf()+1000*60*60*24*t; //tÀÏÈÄÀǠŸÀÓ½ºÅÆÇÁ¸¦ ¾ò´Â´Ù. À½¼ö¶ó¸é ÀÌÀü³¯Â¥¸¦ ¾ò´Â´Ù.
    var thatday=new Date(ptimestamp); //tÀÏÈÄÀÇ ³¯Â¥°´Ã¼ »ý¼ºÇÑ´Ù.

    pdate[pdate.length]=thatday.getFullYear(); //³â

    if (thatday.getMonth()+1 < 10){
        pdate[pdate.length]="0"+(thatday.getMonth()+1); //¿ù
    }else{
        pdate[pdate.length]=thatday.getMonth()+1; //¿ù
    } 

    if (thatday.getDate() < 10){
        pdate[pdate.length]="0"+thatday.getDate(); //ÀÏ
    }else{
        pdate[pdate.length]=thatday.getDate(); //ÀÏ
    }

    return pdate.join("-"); //¹è¿­À» / ±¸ºÐÀڷΠÇÕÃÄ ½ºÆ®¸µÀ¸·Î º¯È¯ÈÄ ¹Ýȯ
}

function txtdatechange(date){
    var fm = document.searchFrm;
    fm.searchFrm.value = date;
}

function Msg(t){
    alert(t);
}
</script>

<?
//include("../manage/category/pointcommon.php");
include("./include/pointcommon.php");

$userid $_COOKIE['USERID']; 

$cm_nCount                =    15;
$cm_item_nCount        =    30;

function 
pageListing($cur_page$total_page$n$url$cm_nCount$txtdate$txtdate2 ) {

    
$retValue "";
    
$retValue .= "<div class='paging'>";

    if (
$cur_page 1) {
        
$retValue .= "<a href='" $url . ($cur_page-1) ."&SortCnt=".$cm_nCount."&txtdate=".$txtdate."&txtdate2=".$txtdate2."' class='page'><span class='next'>ÀÌÀü</span></a>";
    } else {
        
$retValue .= "";
        
$retValue .= "";
    }

    
$retValue .= "&nbsp;";

    
$start_page = ( ( (int)( ($cur_page ) / 10 ) ) * 10 ) + 1;

    
$end_page $start_page 9;
    if (
$end_page >= $total_page$end_page $total_page;

        if (
$start_page 1$retValue .= "<a href='" $url . ($start_page-1) . "&SortCnt=".$cm_nCount."&txtdate=".$txtdate."&txtdate2=".$txtdate2."'class='page'><span class='next10'>ÀÌÀü 10°³</span></a>";

        if (
$total_page 1)
            for (
$k=$start_page;$k<=$end_page;$k++)
        if (
$cur_page != $k$retValue .= "<a href='$url$k&SortCnt=".$cm_nCount."&txtdate=".$txtdate."&txtdate2=".$txtdate2."'>$k</a>";
            else 
$retValue .= "<a href='$url$k' class='on'>$k</a>";

        if (
$total_page $end_page$retValue .= "<a href='" $url . ($end_page+1) . "&SortCnt=".$cm_nCount."&txtdate=".$txtdate."&txtdate2=".$txtdate2."'class='page'><span class='pro10'>´ÙÀ½ 10°³</span></a>";

        
$retValue .= "";

        if (
$cur_page $total_page) {
            
$retValue .= "<a href='$url. ($cur_page+1) ."&SortCnt=".$cm_nCount."&txtdate=".$txtdate."&txtdate2=".$txtdate2."' class='page'><span class='pro'>´ÙÀ½</span></a>";

        } else {
            
$retValue .= "";
            
$retValue .= "";
    }
    
$retValue .= "</div>";
    return 
$retValue;
}

$Dgubun =  " SELECT 0, f.idx, f.cust_id, f.rgst_dtm, f.price, f.addpoint, '' AS usepoint, '' AS use_type,  f.delkey, '' AS bigo, '' AS curpoint
                    FROM cash_fill AS f
                    WHERE f.rgst_dtm BETWEEN '
$txtdate 00:00:00' AND '$txtdate2 23:59:59' AND cust_id = '$userid' AND delkey = '0' AND addpoint > '0'
                    UNION ALL
                    SELECT 1, f.idx, f.cust_id, f.rgst_dtm, '' AS price, '' AS addpoint, f.usepoint, f.use_type, '' AS delkey, f.bigo, f.curpoint
                    FROM cash_use AS f
                    WHERE f.rgst_dtm BETWEEN '
$txtdate 00:00:00' AND '$txtdate2 23:59:59' AND cust_id = '$userid' AND usepoint > '0'";    //±âº» °Ë»öÄõ¸®

if ( isset($mode ) && $mode == "search"){  //°Ë»öÆû

    
if( isset($searchid) && $searchid !== ""){
        if(
$searchid !== "")  $Code =  " AND cust_id = '$searchid' ";
    }

    if( 
$searchCode == '1')  
        
$Dgubun =  " SELECT 0, f.idx, f.cust_id, f.rgst_dtm, f.price, f.addpoint, '' AS usepoint, '' AS use_type,  f.delkey, '' AS bigo, '' AS curpoint
                    FROM cash_fill AS f
                    WHERE f.rgst_dtm BETWEEN '
$txtdate 00:00:00' AND '$txtdate2 23:59:59' AND cust_id = '$userid' AND delkey = '0' AND addpoint > '0'
                    UNION ALL
                    SELECT 1, f.idx, f.cust_id, f.rgst_dtm, '' AS price, '' AS addpoint, f.usepoint, f.use_type, '' AS delkey, f.bigo, f.curpoint
                    FROM cash_use AS f
                    WHERE f.rgst_dtm BETWEEN '
$txtdate 00:00:00' AND '$txtdate2 23:59:59' AND cust_id = '$userid' AND usepoint > '0'";

    if( 
$searchCode == '2')  
        
$Dgubun =  " SELECT 0, f.idx, f.cust_id, f.rgst_dtm, f.price, f.addpoint, '' AS usepoint, '' AS use_type, '' AS bigo, '' AS curpoint
                    FROM cash_fill AS f
                    WHERE f.rgst_dtm BETWEEN '
$txtdate 00:00:00' AND '$txtdate2 23:59:59' AND cust_id = '$userid' AND delkey = '0' AND addpoint > '0' ";

    if( 
$searchCode == '3')  
        
$Dgubun =  "SELECT 1, f.idx, f.cust_id, f.rgst_dtm, '' AS price, '' AS addpoint, f.usepoint, f.use_type, f.bigo, f.curpoint
                    FROM cash_use AS f
                    WHERE f.rgst_dtm BETWEEN '
$txtdate 00:00:00' AND '$txtdate2 23:59:59' AND cust_id = '$userid' AND usepoint > '0' ";

}
?>

    <div class="location">
        <div class="wrap">
            <a href="./mall.php" class="home"><span class="screen_out">Home</span></a>
            <span>></span><a href="./mypageedit.php"><span class="depth1">¸¶ÀÌÆäÀÌÁö</span></a>
            <span>></span><span class="depth2">Æ÷ÀÎÆ®°ü¸®</span>
        </div><!-- //wrap -->
    </div><!-- //location -->


    <div class="wrap">
        <div class="contents">

            <? include("./include/mypage/sub_lnb.html"); ?>

<? 

    $result      
mysql_query($Dgubun) or die (mysql_error());
    
$nTotalCount mysql_num_rows($result);
    
$nPage       ceil($nTotalCount $cm_nCount);
    if (
$pg == ""$pg 1;
    
$nFrom = ($pg 1) * $cm_nCount;

    
$sql    $Dgubun "  order by rgst_dtm , idx  limit $nFrom$cm_nCount ";    

?>

            <form name='searchFrm' method='post'>
            <div class="chargeSection">
                <h3>³ªÀÇÃæÀü³»¿ª</h3>
                <div class="pointSearch">
                    <dl class="charge1">
                        <dt>±¸ºÐ</dt>
                        <dd>
                            <select>
                                <option value="1" <? if( $searchCode == 1){ echo "selected"; } ;?>>Àüü</option>
                                <option value="2" <? if( $searchCode == 2){ echo "selected"; } ;?>>ÃæÀü</option>
                                <option value="3" <? if( $searchCode == 3){ echo "selected"; } ;?>>»ç¿ë</option>
                            </select> 
                        </dd>
                    </dl>
                    <dl class="charge2">
                        <dt>°Ë»ö±â°£</dt>
                        <dd>
                            <div class="period">
                                <a onclick="javascript:setDay(-90)" class="first">3°³¿ù</a>
                                <a onclick="javascript:setDay(-30)">1°³¿ù</a>
                                <a onclick="javascript:setDay(-7)">1ÁÖ</a>
                                <a onclick="javascript:setDay(0)" class="last">¿À´Ã</a>
                            </div>
                            <div class="calendar">
                                <input type='text' readonly name='txtdate' id ='txtdate' size="10" value='<?=$txtdate;?>'><img src="./images/mypage/point_calendar.png" alt="´Þ·Â"  style="cursor:pointer;" onClick="calendar(event, 'txtdate')">
                                <span>~</span>
                                <input type='text' readonly name='txtdate2' id ='txtdate2' size="10" value='<?=$txtdate2;?>'><img src="./images/mypage/point_calendar.png" style="cursor:pointer;" alt="´Þ·Â" onClick="calendar(event, 'txtdate2');">
                            </div>
                        </dd>
                    </dl>
                    <div class="searchBtn"><a href='javascript:Search();'>Á¶È¸</a></div>
                </div><!-- //pointSearch -->


<?
    $Psql 
"SELECT 0,curpoint, '' AS sumaddpoint, '' AS sumusepoint FROM cust_cash 
        WHERE id = '
$userid
        UNION ALL
        SELECT 1,'' AS curpoint, SUM(addpoint) AS sumaddpoint, '' AS sumusepoint FROM cash_fill
        WHERE cust_id = '
$userid' AND rgst_dtm BETWEEN '$txtdate' AND '$txtdate2'
        UNION ALL
        SELECT 2,'' AS curpoint, '' AS sumaddpoint, SUM(usepoint) AS sumusepoint FROM cash_use
        WHERE cust_id = '
$userid' AND rgst_dtm BETWEEN '$txtdate' AND '$txtdate2'";

    
$Presult mysql_query($Psql) or die (mysql_error());
    while(
$Prow  mysql_fetch_array($Presult)){
        if(!isset(
$Prow['curpoint'])) $Prow['curpoint'] = "";

        if(
$Prow[0] == 0){
            
$Ptotal $Prow['curpoint'];
        }
        if(
$Prow[0] == 1){
            
$Padd $Prow['sumaddpoint'];
        }
        if(
$Prow[0] == 2){
            
$Puse $Prow['sumusepoint'];
        }

    }
?>

                <div class="myPoint">
                    <ul>
                        <li class="first">
                            <p class="title">º¸À¯Æ÷ÀÎÆ®</p>
                            <p class="point"><?=number_format($Ptotal);?><span>P</span></p>
                        </li>
                        <li class="second"> 
                            <p class="title">°Ë»ö±â°£ ³» ÃæÀüÆ÷ÀÎÆ®</p>
                            <p class="point"><?=number_format($Padd)?><span>P</span></p>
                        </li>
                        <li class="last">
                            <p class="title">°Ë»ö±â°£ ³» »ç¿ëÆ÷ÀÎÆ®</p>
                            <p class="point"><?=number_format($Puse)?><span>P</span></p>
                        </li>
                    </ul>
                    <input type="hidden" name='mode' value='search'>
                </div><!-- //myPoint -->
            </div><!-- //chargeSection -->
            </form>
            <!-- °Ë»ö¹Ú½º Á¾·á -->


            <div class="pointSection">
            <table class="deliveryTable">
                <caption>Æ÷ÀÎÆ®»ó¼¼³»¿ª</caption>
                <colgroup>
                    <col style="width:100px;"><col style="width:140px;"><col style="width:110px;">
                    <col style="width:100px;"><col style="width:80px;"><col style="width:110px;">
                    <col style="width:100px;"><col style="width:120px;"><col style="width:120px;">
                </colgroup>
                <tr>
                    <th>±¸ºÐ</th>
                    <th>ÀÏÀÚ</th>
                    <th>ÃæÀü±Ý¾×</th>
                    <th>ÃæÀüP</th>
                    <th>»ç¿ëP</th>
                    <th>ÀÜ¿©P</th>
                    <th>»ç¿ëÁ¤º¸</th>
                    <th>¼ö½ÅÀÚ</th>
                    <th>ÇÚµåÆù</th>
                </tr>

<?
    $Esql 
"
        SELECT 0,SUM(addpoint) AS sumaddpoint,SUM(price) AS sumaddprice, '' AS sumusepoint FROM cash_fill
        WHERE cust_id = '
$userid' AND rgst_dtm < '$txtdate'
        UNION ALL
        SELECT 1,'' AS sumaddpoint, '' AS sumaddprice,SUM(usepoint) AS sumusepoint FROM cash_use
        WHERE cust_id = '
$userid' AND rgst_dtm < '$txtdate'";

    
$Eresult mysql_query($Esql) or die (mysql_error());
    while(
$Erow  mysql_fetch_array($Eresult)){

        if(
$Erow[0] == 0){
            
$Epoint $Erow['sumaddpoint'];
            
$Eprice $Erow['sumaddprice'];
        }
        if(
$Erow[0] == 1){
            
$Eusepoint $Erow['sumusepoint'];
        }

    }
?>

                        <tr>
                            <td colspan="2" class="carryForward">[ÀÌ¿ù±Ý¾×]</td>
                            <td class="carryForward"><?=number_format($Eprice)?></td>
                            <td class="carryForward"><?=number_format($Epoint)?></td>
                            <td class="carryForward"><?=number_format($sumusepoint)?></td>
                            <td colspan="4"></td>
                        </tr>

<?
    $result 
mysql_query($sql) or die (mysql_error());

    if(
$num mysql_num_rows($result)){

        while(
$row  mysql_fetch_array($result)) {

        
$usecode $row['use_type'];

        
$usesql "select use_type_nam  from cash_price where use_type_cde = '$usecode'";
        
$coderesult mysql_query($usesql) or die (mysql_error());
        
$coderow    mysql_fetch_array($coderesult);

        
$usedetail $coderow['use_type_nam'];

        if(
$row[0] == "1"){
            
$bgcolor "#f8f8f8";
            
$type "[»ç¿ë]";
        } else {
            
$bgcolor "#fbf5ee";
            
$type "<b>[ÃæÀü]</b>";
        }

?>

                <tr bgcolor="<?=$bgcolor?>">
                    <td><?=$type;?></td>
                    <td><?=substr($row['rgst_dtm'],0,16);?></td>
                    <td>
                        <? if($row['price'] == ""){ } else { ?>
                        <?=number_format($row['price']); } ?>
                    </td>  
                    <td>
                        <? if($row['addpoint'] == ""){ } else { ?>
                        <?=number_format($row['addpoint']); } ?>
                    </td>
                    <td>
                        <? if($row['usepoint'] == ""){ } else { ?>
                        <?=number_format($row['usepoint']); } ?>
                    </td>
                    <td>
                        <? if($row['curpoint'] == ""){ } else { ?>
                        <?=number_format($row['curpoint']); } ?>
                    </td>
                    <td><?=$usedetail;?></td>

<? if((substr_count($row['bigo'],"/")) > 0){
    
$bigoexplode explode("/",$row['bigo']);
?>
                    <td>
                        <div style="width:100px; text-overflow:ellipsis; overflow:hidden;">
                            <nobr>&nbsp;<?=$bigoexplode[0]?></nobr>
                        </div>    
                    </td>
                    <td><?=str_replace("SMS:","",$bigoexplode[1]);?></td>

<? } else { ?>

                    <td colspan="2"></td>

<? ?>
                </tr>

<?
        
}    
    } else {
?>

                <tr>
                    <td colspan="9"><p class="noneData">µ¥ÀÌŸ°¡ ¾ø½À´Ï´Ù.</p></td>
                </tr>
<?  ?>
            </table><!-- //deliveryTable -->

            <p>
                <? 
                    
echo pageListing($pg$nPage$cm_nCount"mypagepoint.php?pg=" $cm_nCount$txtdate$txtdate2)
                
?>
            </p>

            <div class="joinBtn"><a href="./Order_point.php" class="listBtn">Æ÷ÀÎÆ®ÃæÀü</a></div>

            <input type="hidden" name="mode" value='update'>
            </div><!-- //pointSection -->

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

<? include("./include/common/footer.php"); ?>