/home/mjc1/public_html/manage/bill.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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
<?
    
include("./include/ebill_include_header.php");

if(isset(
$_SESSION['ADMINID']) && ($_SESSION['ADMINID'] == "lys")){ 
    echo 
"
        <script>
            alert('Á¢±ÙÇÒ ¼ö Àִ ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.');
            history.go(-1);
        </script>"
;
}
    
    
$cm_nCount                =    10;
    
$cm_item_nCount        =    30;

    function 
pageListing($cur_page$total_page$n$url$mode$SearchMdiv ,$SearchMup,$SearchMper,$searchCode ,$keyword ,$SearchMsw1 $cm_nCount$menu$sub  ) {

        
$retValue "<div class='paging'>";
        if (
$cur_page 1) {

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

        
$retValue .= "";

        
$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) . "' 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'>$k</a>";
                    else 
$retValue .= "<a href='$url$k' class='on'>$k</a>";

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

        
$retValue .= "";

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

        } else {
            
$retValue .= "";
            
$retValue .= "";
        }

    
$retValue .= "</div>";
    return 
$retValue;
}
    
if( isset(
$keyword) && $keyword !== ""){

    if( 
$searchCode == '1') {
        
$vv preg_replace("/[^0-9]/"""$keyword);
        
$vx substr($vv,0,3)."-".substr($vv,3,2)."-".substr($vv,5,6);
        
$Code =  " and (p.companyNum like '%$vv%' or p.companyNum like '%$vx%')";
    }
    if( 
$searchCode == '2')  $Code =  " and p.companyName like '%$keyword%' ";
    if( 
$searchCode == '3')  $Code =  " and p.chiefName like '%$keyword%' ";
    if( 
$searchCode == '4'){
        
$vv preg_replace("/[^0-9]/"""$keyword);
        
$vx substr($vv,0,3)."-".substr($vv,3,2)."-".substr($vv,5,6);
        
$Code =  " and (m.companyNum like '%$vv%' or m.companyNum like '%$vx%')";
    }
    if( 
$searchCode == '5')  $Code =  " and m.companyName like '%$keyword%' ";
    if( 
$searchCode == '6')  $Code =  " and m.chiefName like '%$keyword%' ";

}
    
    
$strWhere="";
    
    if(
$keydate1 <> ""){
        
$strWhere="   AND concat(p.year, '-', p.MONTH, '-', p.DAY) BETWEEN '$keydate1' AND '$keydate2'  ";
    } else {
        
$keydate1 = ($keydate1 == "") ? date("Y-m-d"strtotime("-1 Month")) : $keydate1
        
$keydate2 = ($keydate2 == "") ? date("Y-m-d"time()) : $keydate2;    
        
$strWhere="   AND concat(p.year, '-', p.MONTH, '-', p.DAY) BETWEEN '$keydate1' AND '$keydate2'  ";
    }
    
    if(
$selapp == '1'){
        
$strWhere=$strWhere.
        
"   AND (admission = 1 OR admission = 2 OR admission = 3)";
    } elseif(
$selapp == '2'){
        
$strWhere=$strWhere.
        
"   AND admission = 2 ";
    } elseif(
$selapp == '3'){
        
$strWhere=$strWhere.
        
"   AND admission = 1 ";
    } elseif(
$selapp == '4'){
        
$strWhere=$strWhere.
        
"   AND admission = 3 ";
    }
        
    
// °øÅë Äõ¸®
      
$total_sql " SELECT p.admission, p.idx, p.year, p.MONTH, p.DAY, p.from_companynum, p.companyNum, p.companyName ".
                                 
", p.totalprice, p.chiefName, p.tax_visible, p.ismailsend, p.receive_mail ".
                   
",  m.companyName AS companyName2, m.chiefName AS chiefName2, m.send_mail AS send_mail ".
                         
" FROM bill_mijin m inner join bill_publish p on m.companyNum = p.from_companynum".
                         
" WHERE 1=1 $Code  ".
                         
$strWhere;

    
// ÇÕ°è±Ý¾× °è»êÇϱâÀ§ÇÑ Äõ¸®
       
$sum_sql " select SUM(p.totalprice) AS totalm ".
                             
"   from bill_mijin m inner join bill_publish p on m.companyNum = p.from_companynum".
                             
"   WHERE 1=1 $Code  ".
                             
$strWhere;
                
    
$result      mysql_query($total_sql) or die (mysql_error());
    
  
$result_sum      mysql_query($sum_sql) or die (mysql_error());

    
$nTotalCount mysql_num_rows($result);
    
$nPage       ceil($nTotalCount $cm_nCount);
    if (
$pg == ""$pg 1;
    
$nFrom = ($pg 1) * $cm_nCount;

    
//$sql    = $total_sql . "  order by p.year DESC , p.MONTH DESC , p.DAY DESC limit $nFrom, $cm_nCount ";    //°è»ê¼­ ³¯Â¥º°·Î Á¤·Ä
    
$sql    $total_sql "  order by p.idx DESC limit $nFrom$cm_nCount ";    //µî·Ï¼ø¼­·Î Á¤·É
    //echo $sql;

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

?>

<script src="calender.js" language="javascript"></script> <!-- ¹Ì´Ï´Þ·Â ½ºÅ©¸¯Æ® -->

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
    if (init==true) with (navigator) {
        if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
            document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
        }
    }
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->

//Àç¹ß¼ÛÀÇ ÆíÀǸ¦ À§Çؼ­ ¹ß¼ÛµÈ°ÇÀ» ¹Ì¹ß¼ÛÀ¸·Î º¯°æÇϴ ±â´É
function ChangSend(idx,val){

    if(confirm("¹ß¼Û¿©ºÎ¸¦ º¯°æÇϽðڽÀ´Ï±î?")){

       document.location.href = "billProcess.php?exCode=ChangSend&idx=" + idx + "&val=" + val +"&pg=<?=$pg;?>&mode=search&searchCode=<?=$searchCode;?>&SearchMsw1=<?=$SearchMsw1;?>&keyword=<?=$keyword;?>";

    }
}

function CheckAll() {

    if( document.billFrm.all.value == 1){
        document.chkImg.src = "bt_allcheck_not.gif";

        for (var i=0;i<document.billFrm.elements.length;i++){
            if (document.billFrm.elements[i].name == 'billForm[]'){
                document.billFrm.elements[i].checked = true;
            }
        }
        document.billFrm.all.value = '0';
    }
    else{
        document.chkImg.src = "bt_allcheck.gif";

        for (var i=0;i<document.billFrm.elements.length;i++){
            if (document.billFrm.elements[i].name == 'billForm[]'){

                document.billFrm.elements[i].checked = false;
            }
        }

        document.billFrm.all.value = '1';
    }
}

<!-- »èÁ¦ ½ºÅ©¸³Æ® -->
function allDel(){
    var cnt=0;
    for (var i=0;i<document.billFrm.elements.length;i++){
        if (document.billFrm.elements[i].name == 'billForm[]'){

            if( document.billFrm.elements[i].checked == true ) cnt++;
        }
    }

    if(cnt>0){

        if(confirm("¼±ÅÃÇϽŠ"+ cnt +" °³ÀÇ °Ô½Ã¹°À» »èÁ¦ÇϽðڽÀ´Ï±î?") ){

            document.billFrm.action = "billProcess.php" ;
            document.billFrm.submit();
        }
    }
    else{
        alert("»èÁ¦ÇÒ Ç׸ñÀ» ¼±ÅÃÇϼ¼¿ä.")
        return;
    }
}

<!-- "¹ßÇàÇã¿ë" ½ºÅ©¸³Æ® -->
function allpos(){
  
    var cnt=0;
    for (var i=0;i<document.billFrm.elements.length;i++){
        if (document.billFrm.elements[i].name == 'billForm[]'){

            if( document.billFrm.elements[i].checked == true ) cnt++;
        }
    }

    if(cnt>0){

        if(confirm("¼±ÅÃÇϽŠ"+ cnt +" °³ÀÇ °Ô½Ã¹°À» '¹ßÇàÇã¿ë' ÇϽðڽÀ´Ï±î?") ){

            document.billFrm.action = "bill_allpos.php" ;
            document.billFrm.submit();
        }
    }
    else{
        alert("¹ßÇàÇã¿ë ÇÒ °è»ê¼­¸¦ ¼±ÅÃÇϼ¼¿ä.")
        return;
    }
}

<!-- "¹ßÇàÁßÁö" ½ºÅ©¸³Æ® -->
function allimpos(){

    var cnt=0;
    for (var i=0;i<document.billFrm.elements.length;i++){
        if (document.billFrm.elements[i].name == 'billForm[]'){

            if( document.billFrm.elements[i].checked == true ) cnt++;
        }
    }

    if(cnt>0){

        if(confirm("¼±ÅÃÇϽŠ"+ cnt +" °³ÀÇ °Ô½Ã¹°À» '¹ßÇàÁßÁö' ÇϽðڽÀ´Ï±î?") ){

            document.billFrm.action = "bill_allimpos.php" ;

            document.billFrm.submit();
        }
    }
    else{
        alert("¹ßÇàÁßÁö ÇÒ °è»ê¼­¸¦ ¼±ÅÃÇϼ¼¿ä.")
        return;
    }
}


function popBillUseList(companyNum){
    window.open("popbilluselist.php?from_companynum="+companyNum,"popBillUseList","width=200px,height=400px,scrollbars=yes");
}

function popTaxIssueCount(){
    window.open("popTaxIssueCount.php","popTaxIssueCount","width=400px,height=600px,scrollbars=yes");
}

function billBasic(){
    window.open("billBasic.php","","width=580,height=210,scrollbars=no");
}

function Search(){
    SearchFrm.submit();
}

</script>
<link rel='stylesheet' type='text/css' href='./css/new.css'>

<div class="container">
    <div class="border_contents">
        <div class="admin_table">
            <h3 class="list_ttl">
                e¸ÞÀϰè»ê¼­
                <span class="list_sub_ttl bgpi">¹ßÇàµÈ ¼¼±Ý°è»ê¼­ ³»¿ªÀ» º¸¿©Áִ ÆäÀÌÁöÀÔ´Ï´Ù.</span>
                <span id="idcheck"></span>
            </h3>

            <FORM METHOD=POST ACTION='bill.php' name='SearchFrm' onSubmit="if(!Search()) return false;">
                <div class="searchArea searchAreaPlus" style="height: 64px !important;">
                    <span class="searchAreaL"></span>
                    <span class="searchAreaR"></span>
                    
                    <dl class="search_tender requestSearchArea" style="width: 914px;">
                        <dt class="screen_out">e¸ÞÀϰè»ê¼­ °Ë»ö</dt>
                        <dd class="first relative">
                            <p class="arrow"></p>
                            <select name="selapp" size="1" class="nonearrow"> 
                                <option value=1 <? if($selapp == '1'){ echo "selected"; } ?>>Àüü ½ÂÀλóÅÂ</option> 
                                <option value=2 <? if($selapp == '2'){ echo "selected"; } ?>>½ÂÀÎ</option> 
                                <option value=3 <? if($selapp == '3'){ echo "selected"; } ?>>ºñ½ÂÀÎ</option> 
                                <option value=4 <? if($selapp == '4'){ echo "selected"; } ?>>¹Ý¼Û</option> 
                            </select>
                        </dd>
                        <dd>
                            <em class="title bgpi">±â°£</em>
<? 
if ($keydate1 == "") { 
    
$keydate1 = ($keydate1 == "") ? date("Y-m-d"strtotime("-1 Month")) : $keydate1
}

if (
$keydate2 == "") { 
    
$keydate2 = ($keydate2 == "") ? date("Y-m-d"time()) : $keydate2
}
?>    
                            <input type="text" name="keydate1" style="height:29px;" size="10" value='<?=$keydate1;?>' maxlength="10" onClick="check_mouse('SearchFrm.'+this.name)"><span> ~ </span><input type="text" name="keydate2" style="height:29px;" size="10" value='<?=$keydate2;?>' maxlength="10" onClick="check_mouse('SearchFrm.'+this.name)" >
                        </dd>
                        <dd class="relative">
                            <em class="title bgpi">Á¶°Ç</em>   
                            <p class="arrow"></p>
                            <select name='searchCode' style="width:150px;" class="nonearrow">
                                <option value=5  <?    if($searchCode == '5'){ echo "selected"; } ?>>°ø±ÞÀڠȸ»ç¸í</option>
                                <option value=6  <?    if($searchCode == '6'){ echo "selected"; } ?>>°ø±ÞÀÚ ´ëÇ¥ÀÚ¸í</option>
                                <option value=4  <?    if($searchCode == '4'){ echo "selected"; } ?>>°ø±ÞÀÚ »ç¾÷ÀÚµî·Ï¹øÈ£</option>
                                <option value=2  <?    if($searchCode == '2'){ echo "selected"; } ?>>°ø±Þ¹Þ´ÂÀڠȸ»ç¸í</option>
                                <option value=3  <?    if($searchCode == '3'){ echo "selected"; } ?>>°ø±Þ¹Þ´ÂÀÚ ´ëÇ¥ÀÚ¸í</option>
                                <option value=1  <?    if($searchCode == '1'){ echo "selected"; } ?>>°ø±Þ¹Þ´ÂÀÚ »ç¾÷ÀÚµî·Ï¹øÈ£</option>
                            </select>
                        </dd>
                        <dd>
<? 
$row  
mysql_fetch_array($result_sum)
?>

                            <input type='text' name='keyword' style="height:29px;" size=20 value='<?=$keyword;?>'>
                        </dd>
                        <dd class="searchbtnarea">
                            <a href='javascript:Search();' class="searchBtn bgpi">°Ë»ö</a>
                            <input type='hidden' name='mode' value='search'>
                        </dd>
                    </dl><!--//search_tender-->

                    <dl class="search_tender requestSearchArea mt10" style="width: 762px;">
                        <dt class="screen_out">e¸ÞÀϰè»ê¼­ °Ë»ö</dt>
                        <dd class="first">
                            <a href='bill_insert.php?menu=7&sub=2' class="billBtn"><span class="orange">¼¼±Ý°è»ê¼­ µî·Ï</span></a>
                        </dd>
                        <dd>
                            <a href='javascript:popTaxIssueCount();' class="billBtn"><span class="green">¼¼±Ý°è»ê¼­ ¹ßÇà°Ç¼ö</span></a>
                        </dd>
                        <dd>
                            <a href='javascript:billBasic();' class="billBtn"><span class="blue">±âº»Á¤º¸ µî·Ï</span></a>
                        </dd>
                        <dd>
                            <a href='bill_excel.php' class="xls"><span class="green">¿¢¼¿Àüȯ</span></a>
                        </dd>
                        <dd>
                            <em class="title bgpi">ÇÕ°è±Ý¾×</em>
                            <input type="text" name="totalbox" value="<?=number_format($row['totalm']);?>">
                        </dd>
                        <dd>
                        <a href="http://www.mijinsoft.co.kr/tax_mailer.php"class="billBtn"><span class="red">¹Ì¹ß¼Û ¸ÞÀϺ¸³»±â</span></a>
                        </dd>
                    <dl><!--//search_tender-->
                </div><!-- //searchBox -->
            </form>



            <form name='billFrm'>
                <input type=hidden name=all value=1>
                <input type=hidden name=exCode value=alldel>
                <input type=hidden name=expos value=allpos>
                <input type=hidden name=eximpos value=allimpos>
                <input type=hidden name=keydate1 value=<?=$keydate1;?>>
                <input type=hidden name=keydate2 value=<?=$keydate2;?>>
                <input type=hidden name=selapp value=<?=$selapp;?>>
                <input type=hidden name=searchCode value=<?=$searchCode;?>>
                <input type=hidden name=keyword value=<?=$keyword;?>>
                <input type=hidden name=pg value=<?=$pg;?>>
                <div class="borderWarp" style="width:1100px; margin-left:-50px;">
                    <table class="borderTable requestarea">
                        <tr class="bgpi">
                            <th style="width:40px;"><img src="./images/common/bt_allcheck_all.gif" alt="¸ðµÎ¼±ÅÃ" style="cursor:pointer;" name="chkImg" onClick="CheckAll();"></th>
                            <th style="width:49px;">No</th>
                            <th style="width:69px;">¹ßÇàÀÏ</th>
                            <th style="width:89px; letter-spacing:-1px;">»ç¾÷ÀÚµî·Ï¹øÈ£</th>
                            <th style="width:204px;">ȸ»ç¸í</th>
                            <th style="width:59px;">´ëÇ¥ÀÚ¸í</th>
                            <th style="width:69px;">±Ý¾×</th>
                            <th style="width:59px;">½ÂÀλóÅÂ</th>
                            <th style="width:74px;">¹ßÇàÇã¿ë</th>
                            <th style="width:59px;">¸ÞÀϹ߼Û</th>
                            <th style="width:159px;">º¸³»´Â ¸ÞÀÏ</th>
                            <th style="width:159px;" class="last">¹Þ´Â ¸ÞÀÏ</th>
                        </tr>
<?
if($num mysql_num_rows($result)){

    while(
$row  mysql_fetch_array($result)) {
    
        if(
$row[admission] == "1" )                $statu =  "ºñ½ÂÀÎ";
            else if (
$row[admission] == "3" $statu =  "<span class='red'>¹Ý¼Û</span>";
            else                                                            
$statu =  "<span class='blue'>½ÂÀÎ</span>";
        
        if(
$row[ismailsend] == )                $sSend =  "<span class='blue'>¹ß¼Û</span>";
            else                                                            
$sSend =  "<span class='red'>¹Ì¹ß¼Û</span>";
?>

<?
    
if($row[tax_visible] == "0" $visi "Çã¿ë";
        else                          
$visi "ÁßÁö";
?>
                        <tr>
                            <td><input name="billForm[]" type="checkbox" value="<?=$row[idx];?>"></td>
                            <td class="family"><?=$row[idx];?></td>
                            <td><?=$row[year];?>-<?=$row[MONTH];?>-<?=$row[DAY];?></td>
                            
                            <td>
                                <p><?=$row[from_companynum]?></p>
                                <p><?=$row[companyNum];?></p>
                            </td>
                            <td><a href='billReg.php?menu=<?=$menu?>&sub=<?=$sub?>&idx=<?=$row[idx];?>'>
                                <p><?=$row[companyName2];?></p>
                                <p><?=$row[companyName];?></p>
                            </a></td>
                            <td>
                                <p><?=$row[chiefName2];?></p>
                                <p><?=$row[chiefName];?></p>
                            </td>
                            
                            <td><?=number_format($row['totalprice']);?></td>
                            <td><?=$statu;?></td>
                            <td><?=$visi;?></td>
                            <td><A HREF="#" onClick="ChangSend('<?=$row[idx];?>', <? if($row[ismailsend] == ) {echo '0';} else {echo '1';} ?>);"><?=$sSend;?></A></td>
                            <td><?=$row[send_mail];?></td>
                            <td class="last"><?=$row[receive_mail];?></td>
                        </tr>
                            

<?
        
}
    }
    else{
?>
                        <tr>
                            <td colspan="12" class="last">µ¥ÀÌÅͰ¡ ¾ø½À´Ï´Ù.</td>
                        </tr>
<?
    
}
?>
                        <tr>
                            <td colspan="2" class="bottom last">
                                <a href='javascript:allDel();' class="allDelBtn">Àϰý»èÁ¦</a>
                            </td>
                            <td colspan="6" class="bottom last"></td>
                            <td class="bottom last">
<? 
$tpos 
"¹ßÇàÇã¿ë";
$timpos "¹ßÇàÁßÁö";
?>
                                <p><input type="button" name="expos" value=<?=$tpos;?> Onclick="allpos();" style="width:70px;"></p>
                                <p><input type="button" name="eximpos" value=<?=$timpos;?> Onclick="allimpos();" style="width:70px; margin-bottom:2px;"></p>
                            </td>
                            <td colspan="3" class="bottom last"></td>
                        </tr>
                    </table><!-- //borderTable -->
                </div><!-- //borderWarp -->
            </form>
                    
            <?    echo pageListing($pg$nPage$cm_nCount"bill.php?menu=7&sub=2&keydate1=$keydate1&keydate2=$keydate2&selapp=$selapp&searchCode=$searchCode&keyword=$keyword&mode=$mode&totalbox=$totalbox&pg=" $mode$selapp$keydate1$keydate2$searchCode ,$keyword,  $menu$sub )?>
            <?//print_r($_REQUEST)?>

        </div><!-- //admin_table -->

        <p class="navi">°ü¸®ÀÚ¸ðµå > °è»ê¼­°ü¸® > e¸ÞÀϰè»ê¼­</p>

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


    </div><!-- //border_contents -->
</div><!-- //container -->
</div><!-- //wrap -->

</body>
</html>