<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

        if (!$member[mb_id]) {
            $msg = "비회원은 접근권한이 없습니다..\\n\\n 아이디: test 패스워드: test  ";
            if ($cwin)
                alert_close($msg);
            else 
                alert($msg, "$g4[bbs_path]/login.php?url=".urlencode("../cate/cart.php?order=order"));
        }
?>

<!-------폼 복사 스크립----->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var buyer_name2 = "";
var buyer_tel2 = "";
var buyer_hp2 = "";
var buyer_email2 = "";
var buyer_addr1_2 = "";
var buyer_addr2_2 = "";
var ShipConfirm = 0;

function InitSaveVariables(form) {
    buyer_name2 = form.buyer_name2.value;
    buyer_tel2 = form.buyer_tel2.value;
    buyer_hp2 = form.buyer_hp2.value;
    buyer_email2 = form.buyer_email2.value;
    buyer_addr1_2 = form.buyer_addr1_2.value;
    buyer_addr2_2 = form.buyer_addr2_2.value;
    ShipConfirm = form.ShipConfirm.checked;
}

function ShipToBillPerson(form) {
    if (form.copy.checked) {
    InitSaveVariables(form);
    form.buyer_name2.value = form.buyer_name.value;
    form.buyer_tel2.value = form.buyer_tel.value;
    form.buyer_hp2.value = form.buyer_hp.value;
    form.buyer_email2.value = form.buyer_email.value;
    form.buyer_addr1_2.value = form.buyer_addr1.value;
    form.buyer_addr2_2.value = form.buyer_addr2.value;
    form.ShipConfirm.checked = form.BillConfirm.checked;
    }
    else {
    form.buyer_name2.value = buyer_name2;
    form.buyer_tel2.value = buyer_tel2;
    form.buyer_hp2.value = buyer_hp2;
    form.buyer_email2.value = buyer_email2;
    form.buyer_addr1_2.value = buyer_addr1_2;
    form.buyer_addr2_2.value = buyer_addr2_2;
    form.ShipConfirm.checked = ShipConfirm;
    }
    }
//  End -->
</script>





<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0>
<tr>
  <td>
    <form name="fcart_list" method="post" style="margin:0px;">
    <input type = "hidden" name = "save" value = "true" />

    <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td height="5" colspan=<?=$colspan?> ></td></tr>
    <tr><td colspan=<?=$colspan?> ><img src="<?=$cart_skin_path?>/img/title_icon.gif" border="0">&nbsp;&nbsp;<img src="<?=$cart_skin_path?>/img/title_name.gif" border="0"></td></tr>
    <tr><td height="5" colspan=<?=$colspan?>></td></tr>
    <tr><td height="2"  bgcolor=#3acac2 colspan=<?=$colspan?>></td></tr>
    <tr height="35" align="center">
      <td><img src="<?=$cart_skin_path?>/img/t_product.gif" border="0"></td>
      <td width=60><img src="<?=$cart_skin_path?>/img/t_price.gif" border="0"></td>
      <td width=60><img src="<?=$cart_skin_path?>/img/t_qt.gif" border="0"></td>
      <td width=90><img src="<?=$cart_skin_path?>/img/t_price_sum.gif" border="0"></td>
      <td width=60></td>
      <td width=60></td>
      <td width=90><img src="<?=$cart_skin_path?>/img/t_etc.gif" border="0"></td>
    </tr>
    <tr><td height="2"  bgcolor=#e2e2e2 colspan=<?=$colspan?>></td></tr>

    <?
                                while ($row = sql_fetch_array($result)){

                                    $list = sql_fetch(" select * from $m_table where wr_id = '$row[wr_subject]' ");

                                $qty  = $row[wr_content];

                            $p_price  =  $list['wr_1']*$qty;

                        $sum_price     +=  $p_price;


                    ///////////////////////////////////dq//////////////////////////////////////////
                    $thumb_width     =$sum_width;
                $thumb_height    =$sum_height;

            $list['file'] = get_file($bo_table, $list['wr_id']);

        $image = urlencode($list[file][0][file]); // 첫번째 파일이 이미지라면

        if (preg_match("/\.(gif|jpg|png)$/i", $image))
        {
            //DQ엔진 인클루드 2005-03-22 석훈
            //// 이 스킨에서 DQ 가 작동하기 위해서는 입력하는 이미지보다는 작게 설정해야 됨
            //// $thumbimg,img src 이미지 디렉토리를 변경해야 함
            include_once "$g4[path]/thumbEngine/dq_thumb_engine2.php";
            $dqEngine['using_usm'] = 1;
            // 1또는 0 사용, 썸네일 이미지에 언샵마스크 필터를 적용한다. (샤픈필터의 한 종류)
            // GD2.0 이상, PHP 4.3.2 이외의 버전일때 기본값 1, 그외 상황에서는 기본값 0 자동선택
            // 1로 지정 하더라도 GD2.0이 아니거나 PHP 4.3.2 환경이면 자동으로 0으로 재설정 된다.
            $dqEngine['usm_option1']	= 60;	// USM 필터의 amount(강도) 수치, 기본값 : 60
            $dqEngine['usm_option2']	= 0.5;	// USM 필터의 radius(반경) 수치, 기본값 : 0.5
            $dqEngine['usm_option3']	= 1;	// USM 필터의 threshold(제외픽셀) 수치, 기본값 : 1
            // USM 필터의 세부 설정은 포토샵의 그것과 사용법이 동일합니다.
            $dqEngine['thumb_resize']	= "2";
            // 0, 1, 2 사용
            // 0: 원본 비율 대칭 리사이즈, 1: 비율유지 안함(찌그러짐), 2: 원본비율 리사이즈 + Center Crop

            $thumbsource="$g4[path]/data/file/{$bo_table}/" . $image;
            $thumb_path ="$g4[path]/data/file/{$bo_table}/" . 'dq_thumb';

            if (!is_dir($thumb_path))
            {
                @mkdir($thumb_path, 0707);
                @chmod($thumb_path, 0707);
            }

            $thumbimg="$thumb_path/thumb_onlyphotosY_" . $image;
            make_thumb($thumb_width,$thumb_height,$thumbsource,$thumbimg);

            @chmod($thumbimg, 0707);

            $thumbimg2 = "<img src='{$thumbimg}' width='".$thumb_width."' height='".$thumb_height."' style='border:1  #c1c1c1 solid'>";
        }
        else{
            $thumbimg2 = "";
        }




        ///////////////////////////////////dq//////////////////////////////////////////

        //상품 링크
        $product_url  =  "./board.php?bo_table={$bo_table}&wr_id={$list['wr_id']}";

        //제목
        $view_subject = cut_str(strip_tags($list['wr_subject']),60,"");
        $view_subject = "<span style='font-family:돋움;font-size:10pt;color:#5f5f5f;'><b>{$view_subject}</b></span></a>";

        //내용길이조정
        // nl2br(stripslashes(cut_str($list[$i][wr_content], 200, '....' )))
        $view_content   = $list['wr_content'];
        $view_content   = cut_str(strip_tags($view_content),58,"");
        $view_content   = "<span style='font-family:굴림;font-size:9pt;color:#787775;'>{$view_content}</span></a>";


    ?>
    <tr><td height="5"  colspan=<?=$colspan?>></td></tr>
    <tr height="<?=$ph_height?>">
      <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="25"></td>
          <td width="<?=$ph_width?>"><a href="<?=$product_url?>"><?=$thumbimg2?></a></td>
          <td width="10"></td>
          <td valign="top">
            <a href="<?=$product_url?>"><?=$list[wr_subject]?></a>
          </td>
        </tr>
        </table>
      </td>
      <td>&nbsp;&nbsp;&nbsp;&nbsp;<b><?=number_format($list['wr_1'],0)?> 원</b></td>
      <td align="center">
        <?=$qty?>
      </td>
      <td align="center"><b><span style='font-family:Tahoma;font-size:10pt;color:#f5550d;'><?=number_format($list['wr_1']*$qty,0)?></span> 원</b></td>
      <td align="center"></td>
      <td align="center"></td>
      <td align="center"><?=//$view_content?>비고</td>
    </tr>
    <tr><td height="5"  colspan=<?=$colspan?>></td></tr>
    <tr><td height="1"  bgcolor=#e0e0e0 colspan=<?=$colspan?>></td></tr>

    <?
    }


    ?>

    <tr><td height="1"  bgcolor=#e2e2e2 colspan=<?=$colspan?>></td></tr>
    <tr><td height="10" colspan=<?=$colspan?>></td></tr>
    <tr><td height="1"  bgcolor=#e2e2e2 colspan=<?=$colspan?>></td></tr>
    <tr height="46">
      <td align = "center" colspan ="2" bgcolor="#f3f3f3"><b>총결재금액</b></td>
      <td align ="center" bgcolor="#f3f3f3" colspan="5">
        주문금액: <?=number_format($sum_price, 0)?> 원
        &nbsp;+&nbsp;배송비: <?=number_format($trance_price, 0)?> 원
        &nbsp;&nbsp;=&nbsp;&nbsp;
        <?
        $sum_price = $sum_price + $trance_price ;
        echo "<b><span style='font-family:Tahoma;font-size:12pt;color:#f5550d;'>";
        echo number_format($sum_price, 0);
        echo "</span> 원</b>";
        ?>
      </td>
    </tr>
    </table>
    </form>


    <!----------------주문입력폼 시작------------->
    <form name="order_list" method="post" style="margin:0px;">
    <!-----실재 결재금액---->
    <input type = "hidden" name = "sum_price" value = "<?=$sum_price?>" />
    <input type = "hidden" name = "order" value = "cash_order" />

	<?=$order?>
    <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr><td colspan=2 height=10 ></td></tr>
    <tr><td colspan=2 height="30" > 01. 주문자 정보</td></tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 이   름</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_name" value="<?=$member[mb_name]?>"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 전화번호</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_tel" value="<?=$member[mb_tel]?>"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 핸드폰번호</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_hp" value="<?=$member[mb_hp]?>"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 이메일주소</td>
      <td style='padding-left:10px;'><input type="text" size="35" maxlength="50" name="buyer_email" value="<?=$member[mb_email]?>"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 주소</td>
      <td style='padding-left:10px;'><input type="text" size="55" maxlength="70" name="buyer_addr1" value="<?=$member[mb_addr1]?>"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 주소2</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_addr2" value="<?=$member[mb_addr2]?>"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td colspan=2><input type="checkbox" name="BillConfirm" selected>배송정보를 메일로받음 </td>
    </tr>
    <tr><td colspan=2 height=5 ></td></tr>
    <tr bgcolor="#ffffff">
      <td colspan=2 width="100%" height="35">
        <b><font color="#585858"> 수취인 정보</b>
        <font color="#585858"> ( <input type="checkbox" name="copy" OnClick="javascript:ShipToBillPerson(this.form);" value="checkbox"> 주문자 정보와 수취인정보가 같음 )
      </td>
    </tr>
    <tr><td colspan=2 height=5 ></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 이   름</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_name2" ></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 전화번호</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_tel2" ></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 핸드폰번호</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_hp2" ></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 이메일주소</td>
      <td style='padding-left:10px;'><input type="text" size="35" maxlength="50" name="buyer_email2"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 주소</td>
      <td style='padding-left:10px;'><input type="text" size="55" maxlength="70" name="buyer_addr1_2"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td style='padding-left:10px; height:30px;' bgcolor=#fffbf7>· 주소2</td>
      <td style='padding-left:10px;'><input type="text" size="15" maxlength="50" name="buyer_addr2_2"></td>
    </tr>
    <tr><td colspan=2 height=1 bgcolor=#dedfde></td></tr>
    <tr>
      <td colspan=2>
        <input type="checkbox" name="ShipConfirm" selected>배송정보를 메일로받음
      </td>
    </tr>
    <tr><td colspan=2 height=5 ></td></tr>
    <tr>
      <td colspan=2>
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr><td height="15"></td></tr>
        <tr>
          <td width="33%"></td>
          <td width="33%" align="center"><a href="javascript:cash_order();"><img src="<?=$cart_skin_path?>/img/cart_order.gif" border="0"></a></td>
          <td width="33%" align="right"><a href="board.php?bo_table=<?=$bo_table?>" >주문취소</a></td>
        </tr>
        <tr><td height="15"></td></tr>
        </table>
      </td>
    </tr>
    </table>
    </form>

    <!---------------//주문입력폼----------------->




  </td>
</tr>
</table>


<script language="JavaScript">
// 부분삭제
function cart_del(se_01) {
    var f = document.fcart_list;

    f.action = "./cart.php?del="+se_01;
    f.submit();
}

// 주문하기
function cart_order() {
    var f = document.fcart_list;


    f.action = "./cart.php?order=order";
    f.submit();
}

// 카드결재
function cash_order() {
    var f = document.order_list;


    f.action = g4_path+"/kcp/order.php";
    f.submit();
}

</script>




