/home/mjc1/public_html/emillennium/day_balance.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
<?php

/* 귀요미 : 명세표 필드가 추가되었습니다. */

$dir ".";
include_once(
$dir."/_common.php");
include(
'./include/header.php'); 

if(
$eid==''){
    
alert('e천년경영 로그인 후에 이용가능합니다.',"index.php"); exit;
}

$sdate date("Y-m-d",time()); $edate date("Y-m-d",time());
$sql "select * from 
    (select ifnull(sum(b.sup_amt),0) as sum_tot, ifnull(sum(b.vat),0) as sum_vat
        from sale_m a left join sale_d b on a.midx = b.midx    where 1=1 and a.dealdate >= '
$sdate' and a.dealdate <= '$edate') aa,
    (select ifnull(sum(amount),0) as sum_amount 
        from receive c    where 1=1 and c.dealdate >= '
$sdate' and c.dealdate <= '$edate') bb
"
;
$res mysql_query($sql,$connect_e1000y);
$d_info mysql_fetch_array($res); // 일간 매출현황

$sdate date("Y-m-",time())."01"$edate date("Y-m-d",time());
$sql "select * from 
    (select ifnull(sum(b.sup_amt),0) as sum_tot, ifnull(sum(b.vat),0) as sum_vat
        from sale_m a left join sale_d b on a.midx = b.midx    where 1=1 and a.dealdate >= '
$sdate' and a.dealdate <= '$edate') aa,
    (select ifnull(sum(amount),0) as sum_amount 
        from receive c    where 1=1 and c.dealdate >= '
$sdate' and c.dealdate <= '$edate') bb
"
;
$res mysql_query($sql,$connect_e1000y);
$m_info mysql_fetch_array($res); // 월간 매출현황

$sdate date("Y-",time())."01-01"$edate date("Y-m-d",time());
$sql "select * from 
    (select ifnull(sum(b.sup_amt),0) as sum_tot, ifnull(sum(b.vat),0) as sum_vat
        from sale_m a left join sale_d b on a.midx = b.midx    where 1=1 and a.dealdate >= '
$sdate' and a.dealdate <= '$edate') aa,
    (select ifnull(sum(amount),0) as sum_amount 
        from receive c    where 1=1 and c.dealdate >= '
$sdate' and c.dealdate <= '$edate') bb
"
;
$res mysql_query($sql,$connect_e1000y);
$y_info mysql_fetch_array($res); // 년간 매출현황

$PointSQL "SELECT curpoint FROM cust_cash WHERE id = '$eid'";
$PointResult MYSQL_QUERY($PointSQL,$connect_cash);
$PointRow MYSQL_FETCH_ARRAY($PointResult);

$mypoint $PointRow[curpoint];

?>
<input type='hidden' name='d_sup' value='<?php echo round($d_info['sum_tot']);?>'>
<input type='hidden' name='d_vat' value='<?php echo round($d_info['sum_vat']);?>'>
<input type='hidden' name='d_amount' value='<?php echo round($d_info['sum_amount']);?>'>
<input type='hidden' name='m_sup' value='<?php echo round($m_info['sum_tot']);?>'>
<input type='hidden' name='m_vat' value='<?php echo round($m_info['sum_vat']);?>'>
<input type='hidden' name='m_amount' value='<?php echo round($m_info['sum_amount']);?>'>
<input type='hidden' name='y_sup' value='<?php echo round($y_info['sum_tot']);?>'>
<input type='hidden' name='y_vat' value='<?php echo round($y_info['sum_vat']);?>'>
<input type='hidden' name='y_amount' value='<?php echo round($y_info['sum_amount']);?>'>

<div id="user_area">
    <div id="wrap">
        <div class="user_info">
            <p class="user_name"><?php echo iconv("euckr","utf-8",$sa_name);?>님 환영합니다.</p>
            <p>ID : <?php echo $eid;?> &nbsp;&nbsp;/&nbsp;&nbsp;<span class='limit_day_class'>만료일 : <?php echo $e1000y_limitdate;?></span> / 보유포인트 : <?php echo number_format($mypoint);?>P</p>
        </div>
        <div class="charge_btn">
            <h2>부가서비스 신청 : </h2>
            <ol>
                <li class="first"><a href='http://mjsoft.co/html/millennium/buypaper.php' target='_blnak'><span>용지주문</span></a></li>
                <li><a href='http://mjsoft.co/html/millennium/pointbuynow.php' target='_blank'><span>포인트충전</span></a></li>
                <li class="last"><a id="sms_btn"><span>SMS충전</span></a></li>
            </ol>
        </div>
    </div>
</div><!-- //user_area -->

<div id="graph_area">
    <div id="wrap">
        <div class="graph1">
            <div class="graph_section">
                <h3>주간 매출현황</h3>
                <iframe frameborder=0 scrolling=no style='width:370px; height:250px;' src='jsondata_sale.php'></iframe>
                <!--<div class="jqPlot" id="chart1" style="width:364px; height:241px; "></div>-->
            </div>
        </div>
        <div class="graph2">
            <div class="graph_section">
                <h3>주간 매입현황</h3>
                <iframe frameborder=0 scrolling=no style='width:370px; height:250px;' src='jsondata_buy.php'></iframe>
                <!--<div class="jqPlot" id="chart2" style="width:364px; height:241px; "></div>-->
            </div>
        </div>
        <div class="graph_info">
            <div class="graph_section">
                <h3><span class='hh_title'>일간</span> 매출집계</h3>
                <dl class="total">
                    <dt>공급가 : </dt>
                    <dd class='dd_sup'><?php echo number_format($d_info['sum_tot']);?> 원</dd>
                </dl>
                <dl class="total">
                    <dt>부가세 : </dt>
                    <dd class='dd_vat'><?php echo number_format($d_info['sum_vat']);?> 원</dd>
                </dl>
                <dl class="total">
                    <dt>합계금액 : </dt>
                    <dd><span class="orange dd_sum"><?php echo number_format($d_info['sum_tot']+$d_info['sum_vat']);?></span> 원</dd>
                </dl>
                <dl class="total">
                    <dt>수금액 : </dt>
                    <dd><span class="black dd_amount"><?php echo number_format($d_info['sum_amount']);?></span> 원</dd>
                </dl>
                <select name='sum_select' id='sum_select'>
                    <option value='1' selected>일간</option>
                    <option value='2'>월간</option>
                    <option value='3'>년간</option>
                </select>
            </div>
        </div><!-- //graph_info -->
    </div><!-- //wrap -->
</div><!-- //graph_area -->

<div id="wrap">

    <!--<img src="./images/index/day_balance2.png" alt="샘플1">-->
    <input type='hidden' name='sale_buy_tab' value='0'>
    <div class="item_tab">
        <div class="item_tab_navi">
            <a value='0' class="on"><span>매출 현황</span></a>
            <a value='1'><span>매입 현황</span></a>
        </div>
    </div>

    <div class="div-list-area">
        <div class="cust-list-btn">
            <input type="radio" name='day_week' id="day" class='day_week_class' checked><label for="day">일간</label>
            <input type="radio" name='day_week' id="week" class='day_week_class'><label for="week">주간</label>
        </div>
        <div class="cust-list-area sale_list_area">

        </div>
    </div>
    
<style>
    .detail_table {width:100%; border-top:1px solid #e0e0e0; border-left:1px solid #e0e0e0;margin-top:2px;}
    .detail_table tr { height:31px; }
    .detail_table th { border-bottom:1px solid #e0e0e0; border-right:1px solid #e0e0e0;width:130px;text-align:center; background:#F7F7F7;font-weight:bold;}
    .detail_table td { border-bottom:1px solid #e0e0e0; border-right:1px solid #e0e0e0;background:#FFFFE0; text-align:right; padding-right:10px;}
    .detail_table td span { color:blue; }
</style>
    <div class="div-list-area">
        <div class='detail_div_class' style='border-top:2px solid #000; border-left:1px solid #eee; border-right:1px solid #eee; border-bottom:1px solid #eee; height:160px;padding:10px;'>
            <div class='detail_item_class' style='float:left;width:800px;height:160px;overflow-x:hidden; max-height:160px;padding-top:2px;'></div>
            <div class='detail_recieve_class' style='float:left;width:365px;height:160px;padding-left:10px;overflow-x:auto;'>
                <table border=0 class='detail_table'>
                    <tr>
                        <th>수금액</th>
                        <td><span>&nbsp;</span></td>
                    </tr>
                    <tr>
                        <th>공급가</th>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <th>부가세</th>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <th>합계금액</th>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <th class='misu_mibul_title'>미수금</th>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div><!--//wrap-->

<script>
$(document).ready(function(){

    $("#sum_select").change(function(){
        if($(this)    .val()==1){
            var keystr = "d"; var keytitle = "일간";
        } else if($(this).val()==2){
            var keystr = "m"; var keytitle = "월간";
        } else if($(this).val()==3){
            var keystr = "y"; var keytitle = "년간";
        }
        $(".dd_sup").text(formatCurrency($("input[name='"+keystr+"_sup']").val())+" 원");
        $(".dd_vat").text(formatCurrency($("input[name='"+keystr+"_vat']").val())+" 원");
        $(".dd_sum").text(formatCurrency(parseInt($("input[name='"+keystr+"_sup']").val()) + parseInt($("input[name='"+keystr+"_vat']").val()))+"");
        $(".dd_amount").text(formatCurrency($("input[name='"+keystr+"_amount']").val())+"");
        $(".hh_title").text(keytitle);
    });

    $(".day_week_class").click(function(){ // 일간/주간 클릭시
        var v_sale_buy_tab = $("input[name='sale_buy_tab']").val();
        if(v_sale_buy_tab==0){
            if($(this).attr("id")=='day'){ sale_state("today"); }
            if($(this).attr("id")=='week'){ sale_state("week"); }
        } else {
            if($(this).attr("id")=='day'){ buy_state("today"); }
            if($(this).attr("id")=='week'){ buy_state("week"); }
        }
    });

    $(".item_tab_navi a").click(function(){ //네비게이션 탭 처리
        v = $(this).attr("value");
        if(v==0){
            if($(".day_week_class:checked").attr("id")=='day'){
                sale_state("today");
            } else {
                sale_state("week");
            }
            $(".item_tab_navi a").eq(0).addClass("on");
            $(".item_tab_navi a").eq(1).removeClass("on");
            $("input[name='sale_buy_tab']").val("0");
            $(".misu_mibul_title").text("미수금");
        } else if(v==1){
            if($(".day_week_class:checked").attr("id")=='day'){
                buy_state("today");
            } else {
                buy_state("week");
            }
            $(".item_tab_navi a").eq(1).addClass("on");
            $(".item_tab_navi a").eq(0).removeClass("on");
            $("input[name='sale_buy_tab']").val("1");
            $(".misu_mibul_title").text("미불금");
        }
    });

    $(document).on("dblclick",".click_edit",function(){ // 전표관리의 상세보기로
        var v_midx = $(this).closest("tr").find("input[name='codes[]']").val();
        var v_sale_buy_tab = $("input[name='sale_buy_tab']").val();

        if(v_sale_buy_tab==0){
            var url = "sale.php?midx="+v_midx;
        } else {
            var url = "buy.php?midx="+v_midx;
        }
        document.location.href=url;
    });

    $(document).on("click",".click_edit",function(){ // 하단에 상세보기 처리
        var v_midx = $(this).closest("tr").find("input[name='codes[]']").val();
        var v_sale_buy_tab = $("input[name='sale_buy_tab']").val();

        if(v_sale_buy_tab==0){
            var url = "ajax.sale_detail.php?midx="+v_midx;
        } else {
            var url = "ajax.buy_detail.php?midx="+v_midx;
        }
        $.get(url,function(rtn){
            $(".detail_item_class").html(rtn);
            var v_detail_amount = $("input[name='detail_amount']").val();
            var v_detail_sup = $("input[name='detail_sup']").val();
            var v_detail_vat = $("input[name='detail_vat']").val();
            var v_detail_tot = $("input[name='detail_tot']").val();
            var v_detail_mibul = $("input[name='detail_mibul']").val();
            $(".detail_table tr td").eq(0).html("<span>"+formatCurrency(v_detail_amount)+"</span>");
            $(".detail_table tr td").eq(1).html(formatCurrency(v_detail_sup));
            $(".detail_table tr td").eq(2).html(formatCurrency(v_detail_vat));
            $(".detail_table tr td").eq(3).html(formatCurrency(v_detail_tot));
            $(".detail_table tr td").eq(4).html(formatCurrency(v_detail_mibul));
        });
    });

    sale_state("today");
    if('<?php echo $e1000y_limitdate;?>'<'<?php echo date("Y-m-d",time()+(60*60*24*7))?>'){ // 만료일이 일주일 남으면 깜빡임
        blink("limit_day_class");
    }

    /*url = "./jsondata_sale.php";
    $.ajax({
      // have to use synchronous here, else the function 
      // will return before the data is fetched
      async: false,
      url: url,
      dataType:"json",
      success: function(data) {
        //alert(data);
            graph1(data,'chart1',"매출");
        ret = data;
      }
    });

    url = "./jsondata_buy.php";
    $.ajax({
      // have to use synchronous here, else the function 
      // will return before the data is fetched
      async: false,
      url: url,
      dataType:"json",
      success: function(data) {
        //alert(data);
            graph1(data,'chart2',"매입");
        ret = data;
      }
    });*/

    $("#sms_btn").click(function(){ // SMS충전안내
        $("#modal_member_box5").dialog({
            resizable: true, height:470, width:500, modal: true, title: "SMS충전안내",
            buttons: {
                닫기: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    });
});


function sale_state(days){
    url = "./sale_list.php?mode=ajax&show_date="+days;
    $.get(url,function(rtn){
        $(".sale_list_area").html(rtn);
    });
}

function buy_state(days){
    url = "./buy_list.php?mode=ajax&show_date="+days;
    $.get(url,function(rtn){
        $(".sale_list_area").html(rtn);
    });
}

function blink(v_class){
    $obj = $("."+v_class);
    $obj.css("color","#FFAEC9");
    if($obj.css("display")=='none'){
        $obj.css("display","");
    } else {
        $obj.css("display","none");
    }
    setTimeout(function(){
        blink(v_class);
    },500);
}
</script>
<?php include('./include/footer.php'); ?>
<?php 
//_pr($_COOKIE);?>

<style>
.sms_txt {padding:10px 30px;}
.sms_txt p {margin:0 0 5px;font-size:0.92em;letter-spacing:-0.5px;}
.sms_txt p em {font-weight:600;}
.sms_txt p .blue {color:#2d71c4;}
.sms_txt .indent {text-indent:10px;}
</style>
<div id="modal_member_box5" title="거래처수정" style="display:none;width:100%;height:100%; padding:5px;background-color:#FFFFFF;position:relative;">
    <div class="sms_txt">
        <p>※ 결제 후 문자 30건 무료추가 서비스 제공</p>
        <p>- 관련문의 : <em class="blue">1566-8680</em></p>
        <p>- 결제계좌 : <em class="orange">농협 301-0170-9544-01 정일영(엠제이소프트)</em></p>
    </div>
    <iframe src='http://mjsoft.co/html/millennium/programbanner/sms_price.html' style='width:100%;height:45%;margin:0 auto;' scrolling=no frameborder=0></iframe>
    <div class="sms_txt">
        <p>1. 선불결제(충전)를 합니다. <em>[환불불가]</em></p>
        <p class="indent">- 건별 최소 요금 건당 : 18원</p>
        <p>2. 당사로 사용할 ID를 통보합니다.</p>
        <p>3. ID통보 후 15분 뒤 사용 가능합니다.</p>
    </div>
</div>