/home/mjc1/public_html/adm/shop_admin/sale1month.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
<?php
$sub_menu 
'290100';
include_once(
'./_common.php');

auth_check($auth[$sub_menu], "r");

$fr_month preg_replace("/([0-9]{4})([0-9]{2})/""\\1-\\2"$fr_month);
$to_month preg_replace("/([0-9]{4})([0-9]{2})/""\\1-\\2"$to_month);

$g5['title'] = "$fr_month ~ $to_month 월간 매출현황";
include_once (
G5_ADMIN_PATH.'/admin.head.php');

function 
print_line($save)
{
    
$date preg_replace("/-/"""$save['od_date']);

    
?>
    <tr>
        <td class="td_alignc"><a href="./sale1date.php?fr_date=<?php echo $date?>01&amp;to_date=<?php echo $date?>31"><?php echo $save['od_date']; ?></a></td>
        <td class="td_num"><?php echo number_format($save['ordercount']); ?></td>
        <td class="td_numsum"><?php echo number_format($save['orderprice']); ?></td>
        <td class="td_numcoupon"><?php echo number_format($save['ordercoupon']); ?></td>
        <td class="td_numincome"><?php echo number_format($save['receiptbank']); ?></td>
        <td class="td_numincome"><?php echo number_format($save['receiptvbank']); ?></td>
        <td class="td_numincome"><?php echo number_format($save['receiptiche']); ?></td>
        <td class="td_numincome"><?php echo number_format($save['receiptcard']); ?></td>
        <td class="td_numincome"><?php echo number_format($save['receipthp']); ?></td>
        <td class="td_numincome"><?php echo number_format($save['receiptpoint']); ?></td>
        <td class="td_numcancel1"><?php echo number_format($save['ordercancel']); ?></td>
        <td class="td_numrdy"><?php echo number_format($save['misu']); ?></td>
    </tr>
    <?php
}

$sql " select od_id,
            SUBSTRING(od_time,1,7) as od_date,
            od_send_cost,
            od_settle_case,
            od_receipt_price,
            od_receipt_point,
            od_cart_price,
            od_cancel_price,
            od_misu,
            (od_cart_price + od_send_cost + od_send_cost2) as orderprice,
            (od_cart_coupon + od_coupon + od_send_coupon) as couponprice
       from 
{$g5['g5_shop_order_table']}
      where SUBSTRING(od_time,1,7) between '
$fr_month' and '$to_month'
      order by od_time desc "
;
$result sql_query($sql);
?>

<div class="tbl_head01 tbl_wrap">

    <table>
    <caption><?php echo $g5['title']; ?></caption>
    <thead>
    <tr>
        <th scope="col">주문월</th>
        <th scope="col">주문수</th>
        <th scope="col">주문합계</th>
        <th scope="col">쿠폰</th>
        <th scope="col">무통장</th>
        <th scope="col">가상계좌</th>
        <th scope="col">계좌이체</th>
        <th scope="col">카드입금</th>
        <th scope="col">휴대폰</th>
        <th scope="col">포인트입금</th>
        <th scope="col">주문취소</th>
        <th scope="col">미수금</th>
    </tr>
    </thead>
    <tbody>
    <?php
    
unset($save);
    unset(
$tot);
    for (
$i=0$row=sql_fetch_array($result); $i++)
    {
        if (
$i == 0)
            
$save['od_date'] = $row['od_date'];

        if (
$save['od_date'] != $row['od_date']) {
            
print_line($save);
            unset(
$save);
            
$save['od_date'] = $row['od_date'];
        }

        
$save['ordercount']++;
        
$save['orderprice']    += $row['orderprice'];
        
$save['ordercancel']   += $row['od_cancel_price'];
        
$save['ordercoupon']   += $row['couponprice'];
        if(
$row['od_settle_case'] == '무통장')
            
$save['receiptbank']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '가상계좌')
            
$save['receiptvbank']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '계좌이체')
            
$save['receiptiche']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '휴대폰')
            
$save['receipthp']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '신용카드')
            
$save['receiptcard']   += $row['od_receipt_price'];
        
$save['receiptpoint']  += $row['od_receipt_point'];
        
$save['misu']          += $row['od_misu'];

        
$tot['ordercount']++;
        
$tot['orderprice']    += $row['orderprice'];
        
$tot['ordercancel']   += $row['od_cancel_price'];
        
$tot['ordercoupon']   += $row['couponprice'];
        if(
$row['od_settle_case'] == '무통장')
            
$tot['receiptbank']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '가상계좌')
            
$tot['receiptvbank']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '계좌이체')
            
$tot['receiptiche']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '휴대폰')
            
$tot['receipthp']   += $row['od_receipt_price'];
        if(
$row['od_settle_case'] == '신용카드')
            
$tot['receiptcard']   += $row['od_receipt_price'];
        
$tot['receiptpoint']  += $row['od_receipt_point'];
        
$tot['misu']          += $row['od_misu'];
    }

    if (
$i == 0) {
        echo 
'<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
    } else {
        
print_line($save);
    }
    
?>
    </tbody>
    <tfoot>
    <tr>
        <td>합 계</td>
        <td><?php echo number_format($tot['ordercount']); ?></td>
        <td><?php echo number_format($tot['orderprice']); ?></td>
        <td><?php echo number_format($tot['ordercoupon']); ?></td>
        <td><?php echo number_format($tot['receiptbank']); ?></td>
        <td><?php echo number_format($tot['receiptvbank']); ?></td>
        <td><?php echo number_format($tot['receiptiche']); ?></td>
        <td><?php echo number_format($tot['receiptcard']); ?></td>
        <td><?php echo number_format($tot['receipthp']); ?></td>
        <td><?php echo number_format($tot['receiptpoint']); ?></td>
        <td><?php echo number_format($tot['ordercancel']); ?></td>
        <td><?php echo number_format($tot['misu']); ?></td>
    </tr>
    </tfoot>
    </table>
</div>


<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>