/home/mjc1/public_html/onlinecs/mobile/popcategory_test.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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
<? 
include_once("./_common.php");
include(
"./header.php");
include(
"./commonST.php");

if(( 
$id == "" ) && ( $sid == "" )) { 
    echo 
"<script>alert('천년스마트발주 로그인 후에 이용가능합니다.');location.href = './index.php';</script>"
}

if(
$custom_order=='1'){ // 커스텀 주문일경우
    
echo "<script>location.href = './buyWrite_new1.php';</script>"
    exit;
}

include(
"./checkLicenses.php");

if (!isset(
$idx)) $idx "";
if (!isset(
$keyword)) $keyword "";

if(!isset(
$_GET['uid'])){
    
$uid $_GET['uid'];
}

$sql "SELECT * FROM customer WHERE code = '{$cuscode}'";
$result mysql_query($sql);
$cuso mysql_fetch_array($result);

// 2015-01-30 김준표 초기발주등록시 주문일자, 납품일자 , 비고 등이 저장 되지않는 버그 개선 #3075 //
// 주문일자, 납품일자, 비고 데이터 넘겨받음
if(!isset($_GET['orddate'])){
    
$orddate "";
}else{
    
$orddate $_GET['orddate']; 
}


if(!isset(
$_GET['deldate'])){
    
$deldate "";
}else{
    
$deldate $_GET['deldate']; 
}


if(!isset(
$_GET['bigo'])){
    
$bigo "";
}else{
    
$bigo $_GET['bigo']; 
}

if(
$uid!=''){
    
$sql "select * from ordbook_m where ordno = '{$uid}' ";
    
$res mysql_query($sql);
    
$info mysql_fetch_array($res);
    if(
$info['ordstate']>1){
?>
    <script>
        alert('접수이상 상태에서는 상품변경이 불가능합니다.');
        window.history.go(-1);
    </script>
<?
        
exit;
    }
}

$charSet_sql "set names utf8";      
mysql_query($charSet_sql);   

$optionqry "SELECT optname, optvalue FROM options";
$optresult mysql_query($optionqry);
while( 
$optrow mysql_fetch_array($optresult)){
    if(
$optrow['optname'] == "ON라인신규고객등록")    $optnew            $optrow['optvalue'];
    if(
$optrow['optname'] == "ON주문시금액숨김")    $optmhide        $optrow['optvalue'];
    if(
$optrow['optname'] == "주문한도숨김")        $optlimit        $optrow['optvalue'];
    if(
$optrow['optname'] == "선수금주문방식")        $optsmoney        $optrow['optvalue'];    
    if(
$optrow['optname'] == "ON주문시박스관리")    $optbox            $optrow['optvalue'];    
    if(
$optrow['optname'] == "ON지정상품분류")        $optcate        $optrow['optvalue'];    
    if(
$optrow['optname'] == "ON지정상품")            $optpro            $optrow['optvalue'];    
    if(
$optrow['optname'] == "ON특별단가적용")        $optspe            $optrow['optvalue'];    
    if(
$optrow['optname'] == "다중단가계산기준")        $optdac            $optrow['optvalue'];    //0 매입단가 1매출단가 2기준단가
    
if($optrow['optname'] == "상품매출가숨김")        $optpophide     $optrow['optvalue'];    
    if(
$optrow['optname'] == "온주현재고표시")        $optinvnqnt     $optrow['optvalue'];
    if(
$optrow['optname'] == "온주상품비고숨김")        $optproductbigo $optrow['optvalue'];
    if(
$optrow['optname'] == "금액소수점수")        $pricepoint     $optrow['optvalue'];
    if(
$optrow['optname'] == "단가소수점수")        $unitpoint        $optrow['optvalue'];
    if(
$optrow['optname'] == "수량소수점수")        $amountpoint    $optrow['optvalue'];        
}

if(
$sid=='ryunen1'){ // 특정 업체만 즐겨찾기 보이게 처리
    
$wish_show "Y";
}
       
?>
<script type="text/javascript"> 
function convert(){
    var num = document.getElementsByName("color");
    
    for(var i=0;i<num.length;i++)
        num[i].value = Number(num[i].value).toString(16);
        tdchg();
}

function tdchg(){
    var color1 = 0;
    var color1 = document.getElementsByName("color"); 
    var color2 = document.getElementsByName("tdcolor");
    for(var i=0;i<color2.length;i++){
        color2[i].style.background  = color1[i].value;
    }
}

/* 대분류 카테고리 리스트 */
function loadData(m){
    var lo_table = document.getElementById("tb_list");
    jQuery("#tb_list > li").remove();
    var mvalue = m.options[m.selectedIndex].value;
    mainfrm.location.href = "loadData.php?mvalue="+mvalue;
    document.getElementsByName("cate")[0].value = '';
}    

/* 중분류 카테고리 리스트 */
function loadData_2(s){
    var lo_table = document.getElementById("tb_list");
    jQuery("#tb_list > li").remove();
    var sub = s.options[s.selectedIndex].value;

    subfrm.location.href = "loadData_2.php?sub="+sub+"&uid=<?=$uid?>&idx=<?=$idx?>&nidx=<?=$nidx?>";
}    

/*소분류 카테고리 리스트 사용안함 */
function loadData_3(d){ 

    var detail = d.options[d.selectedIndex].value;
    var idx = document.getElementById("idx").value;
    var nidx = document.getElementById("nidx").value;
    location.href = "popcategory.php?idx="+idx+"&nidx="+nidx+"&detail="+detail+"";
}

function rightpage(u){
    var code = document.getElementsByName("leftcode")[u].value;
    var len = document.getElementsByName("leftcode").length;

    var orddate = document.getElementById('orddate').value;
    var deldate = document.getElementById('deldate').value;
    var bigo = document.getElementById('bigo').value;

    document.getElementsByName("cate")[0].value = code;
    //resultdata.location.href = "loadResult.php?idx=<?=$idx?>&nidx=<?=$nidx?>&detail="+code;
    //url = "loadResult.php?uid=<?=$uid?>&idx=<?=$idx?>&nidx=<?=$nidx?>&detail="+code;

    // 2015-01-30 김준표 초기발주등록시 주문일자, 납품일자 , 비고 등이 저장 되지않는 버그 개선 #3075 //
    url = "loadResult_test.php?s1=<?=$sid?>&s2=<?=$id?>&uid=<?=$uid?>&idx=<?=$idx?>&nidx=<?=$nidx?>&detail="+code+"&orddate="+orddate+"&deldate="+deldate+"&bigo="+bigo;
    
    resultdata.location.replace(url);

    var lefttable = document.getElementById('lefttable');
    var leftcode = document.getElementsByName("leftname");
    
    document.getElementById('chb_all').checked = ""; // 상품 전체선택 checkbox 해제
}

function search(){

    //var leftcode = document.getElementsByName("leftname");
    //var code = document.getElementsByName("leftcode")[1].value; // 더이상 여기 코드 사용안해서 주석 처리 2021-06-02 
    var orddate = document.getElementById('orddate').value;
    var deldate = document.getElementById('deldate').value;
    var bigo = document.getElementById('bigo').value;


    <? if ($idx 0){ ?>
            
    <?}else if ($nidx 0){?>
    document.getElementById('chb_all').checked = ""; // 상품 전체선택 checkbox 해제                                     

    <?}?>
    document.searchFrm.target = "resultdata";
    //document.searchFrm.action="loadResult.php?uid=<?=$uid?>";

    // 2015-01-30 김준표 초기발주등록시 주문일자, 납품일자 , 비고 등이 저장 되지않는 버그 개선 #3075 //
    document.searchFrm.action=  "loadResult_test.php?s1=<?=$sid?>&s2=<?=$id?>&uid=<?=$uid?>&orddate="+orddate+"&deldate="+deldate+"&bigo="+bigo;
    document.searchFrm.submit();

    if($("input[name='code_view']").eq(0).is(":checked")){
        $(".code_view_class").html("관리코드");
    } else {
        $(".code_view_class").html("바코드");
    }

    $("input[name='ard_search']").prop("checked",false);

}

function wish_search(){ // 관심상품만 보이기 
    //var leftcode = document.getElementsByName("leftname");
    var code = document.getElementsByName("leftcode")[1].value;
    var orddate = document.getElementById('orddate').value;
    var deldate = document.getElementById('deldate').value;
    var bigo = document.getElementById('bigo').value;


    <? if ($idx 0){ ?>
            
    <?}else if ($nidx 0){?>
    document.getElementById('chb_all').checked = ""; // 상품 전체선택 checkbox 해제                                     

    <?}?>
    document.searchFrm.target = "resultdata";
    //document.searchFrm.action="loadResult.php?uid=<?=$uid?>";

    // 2015-01-30 김준표 초기발주등록시 주문일자, 납품일자 , 비고 등이 저장 되지않는 버그 개선 #3075 //
    document.searchFrm.action=  "loadResult_test.php?s1=<?=$sid?>&s2=<?=$id?>&uid=<?=$uid?>&orddate="+orddate+"&deldate="+deldate+"&bigo="+bigo+"&wish=Y";
    document.searchFrm.submit();

    if($("input[name='code_view']").eq(0).is(":checked")){
        $(".code_view_class").html("관리코드");
    } else {
        $(".code_view_class").html("바코드");
    }
}
$(function(){
    $("input[name='ard_search']").click(function(){
        $cnt = 0;
        if($(this).is(":checked")){
            resultdata.ard_show("hidden");
        } else {
            resultdata.ard_show("show");
        }    
    }); // 이전거래상품만 보기    
});

function defaultresult(){
    /*var leftcode = document.getElementsByName("leftname");
    var code = document.getElementsByName("leftcode")[1].value;
    leftcode[1].style.background='#ffe6d0';*/
    // 더이상 검색에 위에 leftcode와 code값을 사용하지 않아서 주석처리 2021-06-02

    // 2015-01-30 김준표 초기발주등록시 주문일자, 납품일자 , 비고 등이 저장 되지않는 버그 개선 #3075 //
    //resultdata.location.href = "loadResult.php?uid=<?=$uid?>&idx=<?=$idx?>&nidx=<?=$nidx?>&detail="+code+"&orddate=<?=$orddate?>&deldate=<?=$deldate?>&bigo=<?=$bigo?>";
    // 첫 화면시 첫번째 카테고리코드를 들고와서 카테고리 넘기지 않게 처리
    resultdata.location.href = "loadResult_test.php?s1=<?=$sid?>&s2=<?=$id?>&uid=<?=$uid?>&idx=<?=$idx?>&nidx=<?=$nidx?>&orddate=<?=$orddate?>&deldate=<?=$deldate?>&bigo=<?=$bigo?>&orderby=<?=$_COOKIE['cookie_orderby']?>";


}
/* 부모창 수량*단가 금액 전달을 위한 계산 */
function hap(){
    var ordqnt = document.getElementsByName("qnt");        // 수량
    var price = document.getElementsByName("price2");    // 가격
    var money = document.getElementsByName("money");    // 합계금액
    var money2 = document.getElementsByName("money2");    // 합계금액

    for(var i=0; i<ordqnt.length; i++) {
        // 한줄 금액 계산
        rowsum = new Number(ordqnt[i].value) * new Number(price[i].value); 
        money[i].value = formatCurrency(rowsum);
        money2[i].value = rowsum;
    }
}

/* 세자리 컴마 */
function formatCurrency(amount){
    amount = new String(amount);
    var amountLength = amount.length;
    var modulus = amountLength % 3;
    var currencyString = amount.substr(0,modulus);
    
    for(i=modulus; i<amountLength; i=i+3){
        if(currencyString != ""){
            currencyString += ",";
            currencyString += amount.substr(i, 3);
        }
    }
    return currencyString;
}

function insertform(tbl_name, onevent){
    var $list = $("#tb_list");
    var tbl     = document.getElementById(tbl_name);
    var num     = $list.find("li").length + 1;    
    $("#tb_list").append("<li><input name ='leftcode' type='hidden' ><input name ='leftname' type='hidden' readonly /><a href='javascript:rightpage("+num+");' style='height:100%;' class='cate_list_class'><p name ='leftname2' style='display:table-cell;word-break:break-all;width:81px;'></p></a></li>"); 
}


function deleteform(){
    var lo_table = document.getElementById("tb_list");
    
    for(var i = parseInt(lo_table.rows.length)-1; i>=0; i--){
        lo_table.deleteRow(i);
        lo_table.id = 1;
    }
}
</script>
<style>
<?php if($sid=='ryunen'){ ?>
    .pw1{width:7%;}
    .pw2{width:11%;}
    .pw3{width:11%;}
    .pw4{width:11%;}
    .pw5{width:11%;}
    .pw6{width:18%;}
    .pw7{width:9%;}
    .pw8{width:9%;}
    .pw8{width:7%;}
<?php ?>
</style>
        <form name="searchFrm" target="resultdata" method="post" action="loadResult_test.php?s1=<?=$sid?>&s2=<?=$id?>&uid=<?=$uid?>">
        <div class="snb">
            <p class="txt">상품검색 <span class="f11 blue">주문할 상품을 선택하세요.</span>
<?if($_SESSION['sa_uid']=='hschina'){?>
            <span class="f11 blue" style='position:absolute;right:20px;top:90px;'>&nbsp;&nbsp;&nbsp;발주처 : <?=$cuso['compname']?></span>
<?}?>
            </p>
        </div>

        <div class="product_section">
            <div class="search">
                <h2>상품검색</h2>
                
                <dl class="wr1">
                    <dt  style="margin-left:-10px;"><label>검색 수</label></dt>
                    <dd  style="margin-left:-10px;">
                    <table>
                        <colgroup><col class="cw6"><col class="cw7"><col class="cw8"></colgroup>

                        <tbody>
                        <tr>
                            <td>
                                <select title="선택" id="count" name="count">
                                    <option value='50' <?php if($_COOKIE['cookie_count']=='50'){ echo "selected"; }?>>50건</option>
                                    <option value='100' <?php if($_COOKIE['cookie_count']=='100'){ echo "selected"; }?>>100건</option>
                                    <option value='200' <?php if($_COOKIE['cookie_count']=='200'){ echo "selected"; }?>>200건</option>    
                                    <option value='500' <?php if($_COOKIE['cookie_count']=='500' || $_COOKIE['set_list_count']==''){ echo "selected"; }?>>500건</option>    
                                </select>
                            </td>
                            <td class="cw_text" colspan="2">
                                <label for="통합검색">모든분류 검색</label>
                                <input class="check" type="checkbox" NAME="allcate" id="통합검색">
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    </dd>
                </dl>

                <dl class="wr1">
                    <dt style="margin-left:-10px;"><label>검색</label></dt>
                    <dd style="margin-left:-10px;">
                    <table> 
                        <colgroup><col class="cw6"><col class="cw7"><col class="cw8"></colgroup>
                        <tbody>
                        <tr>
                            <td>
                                <select title="선택" id="stype" name="stype">                                
                                    <option value='stotal' <?php if($_COOKIE['cookie_stype']=='stotal'){ echo "selected"; }?>>통합검색</option>
                                    <option value='sename' <?php if($_COOKIE['cookie_stype']=='sename'){ echo "selected"; }?>>상품명</option>
                                    <option value='ssize' <?php if($_COOKIE['cookie_stype']=='ssize'){ echo "selected"; }?>>규격</option>    
                                    <option value='sbigo' <?php if($_COOKIE['cookie_stype']=='sbigo'){ echo "selected"; }?>>비고</option>    
                                    <!-- 2015-03-26 김준표 관리코드검색조건추가 #3222 송영훈 -->
                                    <option value='scode2' <?php if($_COOKIE['cookie_stype']=='scode2'){ echo "selected"; }?>>관리코드</option>    
                                    <option value='bcode' <?php if($_COOKIE['cookie_stype']=='bcode'){ echo "selected"; }?>>바코드</option>    
                                </select>
                            </td>

                            <td>
                                <input type="text" name="stext" id="stext" value="<?=$keyword?>" class="it">
                            </td>

                        </tr>
                        </tbody>
                    </table>
                    </dd>
                </dl>

                <!-- 2014-12-10 김준표 #2607, #2550 상품정렬방식 추가-->
                <dl class="wr1">
                    <dt style="margin-left:-10px;"><label>정렬</label></dt>
                    <dd style="margin-left:-10px;">
                    <table> 
                        <colgroup><col class="cw6"><col class="cw7"><col class="cw8"></colgroup>
                        <tbody>
                        <tr>
                            <td>
                                <select title="선택" id="orderby" name="orderby" onChange="search()">                
                                    <option value='orderby_code' <?php if($_COOKIE['cookie_orderby']=='orderby_code'){ echo "selected"; }?>>코드순</option>
                                    <!-- 2015-03-26 김준표 관리코드순 추가 #3222 송영훈 -->
                                    <option value='orderby_code2' <?php if($_COOKIE['cookie_orderby']=='orderby_code2'){ echo "selected"; }?>>관리코드순</option>
                                    <option value='orderby_name' <?php if($_COOKIE['cookie_orderby']=='orderby_name' || ($_COOKIE['cookie_orderby']=='' && $sid=='gustnr686')){ echo "selected"; }?>>상품명순</option>
                                </select>
                            </td>

                            <td>
                                <select title="선택" id="orderby_type" name="orderby_type" onChange="search()">            
                                    <option value='orderby_asc' <?php if($_COOKIE['cookie_orderby_type']=='orderby_asc'){ echo "selected"; }?>>올림차순</option>
                                    <option value='orderby_desc' <?php if($_COOKIE['cookie_orderby_type']=='orderby_desc'){ echo "selected"; }?>>내림차순</option>
                                </select>
                            </td>

                            <td>
                                <input type="hidden" name='' id='' value="">            
                                <div class="pr prSearch">
                                    <div class="b_gray" >
                                        <a href="javascript:search();"><div> 조 회 </div></a>
                                    </div>        
                                </div>
                            </td>

                        </tr>
                        </tbody>
                    </table>
                    </dd>
                </dl>
                <dl class="wr1">
                    <dt style="margin-left:-10px;"><label>표시코드</label></dt>
                    <dd style="margin-left:10px;">
                    <table style='margin-top:5px;'> 
                        <colgroup><col class="cw6"><col class="cw7"><col class="cw8"></colgroup>
                        <tbody>
                        <tr>
                            <td>
                                <input type='radio' name='code_view' class='code_view_class' value='code2' style='height:12px;' <?php if($code_view=='code2' || $code_view=='' || $_COOKIE['cookie_code_view']=='code2'){?>checked<?php }?>> 관리코드&nbsp;&nbsp;
                                <input type='radio' name='code_view' class='code_view_class'  value='bcode' style='height:12px;' <?php if($code_view=='bcode' || $_COOKIE['cookie_code_view']=='bcode'){?>checked<?php }?>> 바코드

                        <?php if($wish_show=="Y"){ ?>
                                &nbsp;&nbsp;
                                    <div class="b_gray" style='width:70px;display:inline-block;'>
                                        <a href="javascript:wish_search();"><div>관심조회</div></a>
                                    </div>        
                        <?php ?>
                                    &nbsp;
                                    <div style='height:15px;display:inline-block;'>
                                        <input type='checkbox' name='ard_search' style='height:20px;'> 거래상품
                                    </div>

                            </td>

                        </tr>
                        </tbody>
                    </table>
                    </dd>
                </dl>
<?php //if($sid=='ryunen'){?>
<style>
    #item_def_qty { width:50px; display:none; }
    .qust_btn { width:20px; height:20px; padding-left:0px; }
</style>
                <dl class="wr1">
                    <dt style="margin-left:-10px;"><label>기본수량설정</label></dt>
                    <dd style="margin-left:30px;">
                    <table style='margin-top:5px;'> 
                        <tbody>
                        <tr>
                            <td>
                                <select name='item_def_qty_type' id='item_def_qty_type' style='width:90px;'>
                                    <option value='0' <?php if($item_def_qty_type=='0' || $item_def_qty_type==''){ echo "selected"; }?>>사용안함</option>
                                    <option value='1' <?php if($item_def_qty_type=='1'){ echo "selected"; }?>>공백</option>
                                    <option value='2' <?php if($item_def_qty_type=='2'){ echo "selected"; }?>>지정값</option>
                                </select>
                                &nbsp;
                                <input type='number' name='item_def_qty' id='item_def_qty' value='<?php echo $item_def_qty;?>' class="it" maxlength=2>
                                &nbsp;
                                <input type='button' value='?' onclick="alert('기본수량설정은 박스칸에 표기됩니다');" class='qust_btn'>
                            </td>
                            <td>
                                <div class="b_gray" >
                                    <a href="javascript:idq_save();"><div> 저장 </div></a>
                                </div>    
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    </dd>
                </dl>
                <script>
                    $(function(){
                        $("#item_def_qty_type").change(function(){
                            if($(this).val()=='2'){
                                $("#item_def_qty").show();
                            } else {
                                $("#item_def_qty").hide();
                            }
                        });

                        if('<?php echo $item_def_qty_type;?>'=='2'){
                            $("#item_def_qty").show();
                        }
                    });

                    function idq_save(){
                        if(confirm('기본수량설정 저장하시겠습니까?')){
                            $idqt = $("#item_def_qty_type").val();
                            $idq = $("#item_def_qty").val();
                            setsave("item_def_qty_type", $idqt, 365);
                            setsave("item_def_qty", $idq, 365);

                            document.location.reload();
                        }
                    }

                    function setsave(name, value, expiredays){
                        var today = new Date();
                        today.setDate( today.getDate() + expiredays );
                        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
                    }
                </script>
<?php //}?>
                <!------------------------------------->

                

            </div><!-- class="search" 상품검색 -->
            <input type='hidden' name='mode' value='search'>
            <input type='hidden' name='nidx' id="nidx" value='<?=$nidx?>'>
            <!-- <input type='hidden' name='idx' id="idx" value='<?/*=$idx*/?>'> -->
            <input type='hidden' name='idx' id="idx" value='<?=$idx?>'>
            <input type='hidden' name='cate' value=''>    
            


            <!-- 2015-01-30 김준표 초기발주등록시 주문일자, 납품일자 , 비고 등이 저장 되지않는 버그 개선 #3075 -->

            <INPUT NAME="orddate" type='hidden' id="orddate" value='<?=$orddate?>'>
            <INPUT NAME="deldate" type='hidden' id="deldate" value='<?=$deldate?>'>
            <INPUT NAME="bigo" type='hidden' id="bigo" value='<?=$bigo?>'>

            <!--------------------------------------------------------------------------------------------------->



            </form>

            <? if ($optcate != "1" || 1==1){ ?>
            <form name="category">
            <div class="search">
                <div class="b_gray" style="margin-bottom:5px;"><div><div name="viewProduct" id="viewProduct">분류 열기</div></div></div>            
                <dl class="category_list" style="display:none;">
                    <h2 class="screen_out">상품검색</h2>
                    <dt>
                    <div class="category_s">
                        <select class="select_l" title="선택" id="tabMenu1" name=main onChange="loadData(this)">
                            <option value=''>대분류</option>
                            <?                                    
                                $bqry 
"select * from pclass where plevel ='0'";
                                
$bresult mysql_query($bqry);
                                while(
$bdate mysql_fetch_array($bresult)){
                            
?>
                                <option value='<?=$bdate['fullpath']?>'><?=$bdate['name']?>
                
                            <? ?>                            
                        </select>
                        <select class="select_r" title="선택" name='sub' id='sub' onChange="loadData_2(this)">
                            <option value='1'>중분류</option>
                        </select>
                    </div>
                    </dt>                    
                    <dd>                    
                        <ul class="lst" id="tb_list">
                            <input name ="leftcode" type="hidden" /><input name ="leftname" type="hidden" /><span name ="leftname2"></span>                
                        </ul>
                    </dd>
                </dl>
            </div><!-- class="search2" 분류별 -->
            </form>
                         
            <?}?>
            <? if ($idx 0){ ?>
                &nbsp;
            <?}else if ($nidx 0){?>            
            <div class="chb_all">
                <input type="checkbox" name="" id="chb_all" class="css_checkbox" onclick="javascript:resultdata.checkall();" />
                <label for="chb_all" class="checkbox_label">상품 전체선택</label>                
                <div class="prAdd2 sbt1"><input type="button" class="save_icon" value="발주등록" onclick="javascript:resultdata.selectadd();"></div>                
            </div>
            <?}?>            

            <div class="list">
                <table class="product" style="table-layout: fixed;">
                    <caption>주문할 상품을 선택해주세요.</caption>
                    <colgroup>
                        <col class="pw1">
                        <col class="pw2">
                        <col class="pw3">
                        <col class="pw4">
                        <col class="pw5">
                        <col class="pw6">
                        <col class="pw7">
                        <col class="pw8">
                        <?php
                            
if($wish_show=="Y"){
                        
?>
                        <col class="pw1">
                        <?php
                            
}
                        
?>
                    </colgroup>
                    <thead>
                        <tr class="product_first"><!-- class="line" -->
                            <th style="width:10%" scope="row" rowspan="2">선<br>택</th>
                            <!-- 2015-03-26 김준표 관리코드표시 추가 #3222 송영훈 -->
                            <td style="width:20%" <?php if($sid=="kak0936" || $sid=='gustnr686'){?> rowspan="2" <?php }?>>코드<br><FONT SIZE = 1 class='code_view_class'>관리코드</FONT></td>
                        <?php if($optbox=="1"){?>
                            <td>박스</td>
                            <td>낱개</td>
                            <td>수량</td>
                            <td style="width:35%">상품명</td>
                        <?php } else{?>
                            <td colspan="2">수량</td>
                            <td style="width:35%" colspan="2">상품명</td>
                        <?php }?>
                            <td style="width:35%">규격</td>
                            <td>단위</td>
<?php
    
if($wish_show=="Y"){
?>
                            <th rowspan="2">관심</td>
<?php
    
}
?>
                        </tr>
                        <tr>
                        <?php if($sid!="kak0936" && $sid!='gustnr686' && $sid!='seafood8639'){?>
                            <td>색상</td>
                        <?php } else if($sid=='seafood8639') { ?>
                            <td>이미지</td>
                        <?php ?>
                        <?php if($optbox=="1"){?>
                            <td>세금</td>
                            <td colspan="2">내품수</td>
                            <td>매출가</td>
                        <?php } else{?>
                            <?php if($sid=='kak0936' || $sid=='gustnr686'){?>
                            <td>세금</td>
                            <td>내품수</td>
                            <td colspan="2">매출가</td>
                            <?php } else{?>
                            <td colspan="2">세금</td>
                            <td colspan="2">매출가</td>
                            <?php }?>
                        <?php }?>
                            <?if($optinvnqnt == "1"){?>
                                <td>비고</td>                            
                                <td>재고</td>                            
                            <?}else{?>
                                <td colspan="2">비고</td>                            
                            <?}?>
                        </tr>
                    </thead>
                </table>
                <iframe name="resultdata" id="contentFrame" style="border:0px;" width="100%" height="0" background="none" frameborder="0" scrolling='no'></iframe>                
            </div><!-- id="list" -->
            
            <div class="save_bottom">
                <h2 class="screen_out">하단 취소, 발주등록 버튼입니다.</h2>
                <p class="pl bt25"><a href="javascript:history.back(-1);" onclick="">취소</a></p>
                <?if ($nidx 0){?><p class="pr sbt1"><input type="button" class="save_icon" value="발주등록" onclick="javascript:resultdata.selectadd();"></p><?}?>
            </div>

            <iframe name="picture" width="0" height="0" style="border:0px;" frameborder="0"></iframe>            
            <iframe width="0" height ="0" name="mainfrm" style="border:0px;width:0px;height:0px;"></iframe>
            <iframe width="0" height ="0" name="subfrm" style="border:0px;"></iframe>
            
<!-- 페이지 로드시 모든 소분류 보여 주기 --- 시작 -->
<?
$i 
1;
/* 지정상품분류 */
if($optcate == "1"){
    
$Lqry "SELECT p.code, p.fullpath, p.name, c.ccode, c.pccode, c.btype FROM pclass AS p INNER JOIN custpclassmatch AS c ON(p.code = c.pccode) WHERE plevel = '2' AND ccode = '{$cuscode}' order by fullpath";
}else{
    
$Lqry "SELECT fullpath, name FROM  pclass WHERE plevel = '2' order by fullpath";
}
//echo $Lqry;

$Lresult mysql_query($Lqry);
while(
$Ldata mysql_fetch_array($Lresult)){
?>
<script>
    $(function(){
        insertform('tb_list','0'); 
        document.getElementsByName("leftcode")[<?=$i?>].value        = '<?=$Ldata['fullpath']?>';
        document.getElementsByName("leftname")[<?=$i?>].value        = '<?=$Ldata['name']?>';
        document.getElementsByName('leftname2')[<?=$i?>].innerHTML    = "<?=$Ldata['name']?>";        
    });

</script>
<?
    $i
++;
}
?>
<script>
    $(function(){
        convert();
        defaultresult();
    });
</script>
<?
if(!$keyword == ""){
?>
<script type="text/javascript">
    search();
</script>
<? ?>

<?php

if($sid!=''){ // 로그인시 공지사항

    
$sql  =   " select * from ordnotice WHERE 1=1  and (ccode='' or ccode='$cuscode' or ccode is null ) and ocode = '$sacode' order by regdate desc limit 1";
    
//echo $sql;
    
$result      =    mysql_query($sql) or die (mysql_error());
    while(
$notice_info=mysql_fetch_array($result)){
        
$notice_info['uid'] = $notice_info['nidx'];
        
$notice_info['subject'] = $notice_info['title'];
        
$notice_info['content'] = $notice_info['cont'];
        
$notice_info['reg_date'] = strtotime($notice_info['data_created']);

        
$pop_notice $notice_info;
    }
    
//print_r($pop_notice);
}
?>

<script type="text/javascript">
    $("#viewProduct").click(function() {
        //$(".toggle_gnb_wrap").slideToggle("fast");
        if($("#viewProduct").text() == "분류 열기"){
            $("#viewProduct").text("분류 접기");
        }else{
            $("#viewProduct").text("분류 열기");            
        }
        $(".category_list").slideToggle("slow");

        $v_height = 0;
        cate_li_init();
    })

    function cate_li_init(){ // 분류 li 높이 맞춰는 프로세서
        $(".cate_list_class").each(function(){
            $v = $(this)    .height();
            if($v_height<$v){ $v_height = $v; }
        });
        $(".cate_list_class").css("height",$v_height+"px");
    }

    $(function(){
        <?php if($sid!=''){?>

            <?php if($sid == "gustnr686" || $sid == "hyein1127") { /*2024-06-28 해당업체만 더이상 안보기와 더이상안보기한 사람도 무조건 공지가 나올 수 있도록 함*/ ?>

            if('<?php echo count($pop_notice);?>'>'0' && "<?php echo $nflg?>" != "y"){
                setTimeout(function(){
                    $("#modal_member_box" ).dialog({
                        resizable: true, height:400, width:320, modal: true,
                        buttons: {
                            "닫기": function() {
                                $( this ).dialog( "close" );
                            }
                        }
                    });
                },750);
            }

            <?php } else { ?>

            <?php if($_COOKIE["ordnotice_{$sid}_{$pop_notice['nidx']}"]!='close'){?>
            if('<?php echo count($pop_notice);?>'>'0'){
                setTimeout(function(){
                    $("#modal_member_box" ).dialog({
                        resizable: true, height:400, width:320, modal: true,
                        buttons: {
                            "닫기": function() {
                                $( this ).dialog( "close" );
                            },
                            "오늘하루 안보기": function() {
                                setsave("ordnotice_<?php echo $sid;?>_<?php echo $pop_notice['nidx']?>", "close", 1);
                                $( this ).dialog( "close" );
                            },
                            "더이상 안보기": function() {
                                setsave("ordnotice_<?php echo $sid;?>_<?php echo $pop_notice['nidx']?>", "close", 365);
                                $( this ).dialog( "close" );
                            }
                        }
                    });
                },750);
            }
            <?php } else {?>
                //setsave("ordnotice_<?php echo $sid;?>_<?php echo $pop_notice['nidx']?>", "", 1);
            <?php }?>

            <?php ?>
        <?php }?>

        $("#orderby").change(function(){
            $v = $(this)    .val();
            setsave("cookie_orderby",$v,31);
        });

        $("#stype").change(function(){
            $v = $(this)    .val();
            setsave("cookie_stype",$v,31);
        });

        $("#count").change(function(){
            $v = $(this)    .val();
            setsave("cookie_count",$v,31);
        });

        $("#orderby_type").change(function(){
            $v = $(this)    .val();
            setsave("cookie_orderby_type",$v,31);
        });

        $(".code_view_class").click(function(){
            $v = $(this)    .val();
            setsave("cookie_code_view",$v,31);
        });
    });

function setsave(name, value, expiredays){
    value = encodeURI(value); // 한글깨짐문제 처리
    var today = new Date();
    today.setDate( today.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
}
</script>
<!-- 페이지 로드시 모든 소분류 보여 주기 --- 끝  -->                        

<? include("./footer.php"); ?>
<?php
if($_SERVER['REMOTE_ADDR']=='58.151.27.172'){
    
//print_r($_POST); exit;
    //print_r($_COOKIE);
}
?>
<link rel="stylesheet" type="text/css" href="js/jqueryui/jquery-ui.css" />
<div id="modal_member_box" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;" title="공지사항">
<style>
    .notice_table { width:100%; border-left:1px solid #f0f0f0; border-top:1px solid #f0f0f0;}
    .notice_table th{ width:15%; border-right:1px solid #f0f0f0; border-bottom:1px solid #f0f0f0; background:#e0e0e0; height:30px;text-align:center;}
    .notice_table td{ width:85%; border-right:1px solid #f0f0f0; border-bottom:1px solid #f0f0f0; padding:10px; font-size:0.9em; }
</style>
<table class='notice_table' border=0>
    <tr>
        <th>제목</th>
        <td><?php echo $pop_notice['title'];?></td>
    </tr>
    <tr>
        <th>내용</th>
        <td><?php echo nl2br($pop_notice['content']);?></td>
    </tr>
</table>
</div>