<?
session_start();

$document = array();
$script = "";
$init = "";

require "../lib/getnpost.php";
require "../lib/config.php";
require "../lib/dbconnect.php";
require "../lib/auth.php";
require "../lib/common.php";

require "shop_common.php";      // shoptopmenu, leftmenu

function mkShopRecordRow(
	&$shoprecordlist, $gdid, $gdn,
	$sgprco, $sgprc, $sgq,
	$sgsumo, $sgsum, $gdbns, $gdbonus,
	$cpn, $ciid, $cpprc, $cprt,
	$idx, $count, $usid
) {
	$gdbnsc = number_format($gdbns);
	$gdbonusc = number_format($gdbonus);

	if ($count % 2) {	// $count´Â 1ºÎÅÍ ½ÃÀÛ
		$bgcolor = "#F3F3F3";
	} else {
		$bgcolor = "#FFFFFF";
	}

	if ($ciid) {
//		$sgprcoc = number_format($sgprco) . "<br />";
		$sgprcoc = "";
		$sgsumoc = number_format($sgsumo) . "<br />";

		$couponstring = "<br />$cpn »ç¿ë";
	} else {
		$sgprcoc = "";
		$sgsumoc = "";

		$couponstring = "";
	}

	$sgprcc = number_format($sgprc);
	$sgsumc = number_format($sgsum);

	$shoprecordlist .= <<<EOS
              <tr>
		<td width="15" height="60" bgcolor="$bgcolor"></td>
                <td width="54" align="center" bgcolor="$bgcolor">$count</td>
                <td width="284" align="center" bgcolor="$bgcolor"><b>$gdn</b>
$couponstring
</td>
                <td width="94" align="center" bgcolor="$bgcolor">
<span id="sgprcorig[$idx]" style="font-weight: normal; text-decoration: line-through;">$sgprcoc</span>
<span id="sgprcoff[$idx]" style="font-weight: bold;">$sgprcc</span><br />
($gdbnsc)</td>
                <td width="63" align="center" bgcolor="$bgcolor" >$sgq</td>
                <td width="94" align="center" bgcolor="$bgcolor">
<span id="sgsumorig[$idx]" style="font-weight: normal; text-decoration: line-through;">$sgsumoc</span>
<span id="sgsumoff[$idx]" style="font-weight: bold;">$sgsumc</span><br />
($gdbonusc)</td>
		<td width="15" height="60" bgcolor="$bgcolor"></td>
              </tr>

EOS;
}

function mkShopRecord(&$document, &$script, &$init, $said) {
	global $PSYCHEID, $PsycheAdmin;

	// Sales

	$result = mysql_query("select
sa.usid, us.usname, us.ustel1, us.ustel3, us.usmail1,
sa.sadate, sa.satime, sa.sasum, sa.sapoint,
sa.saduedate, sa.pmid, pm.pmname, pm.pmnumber, pm.pmetc, pm.pmtype,
sa.sapayer, sa.samemo, sa.sastat
from sales as sa
left join users as us on sa.usid = us.usid
left join paymethods as pm on sa.pmid = pm.pmid
where sa.said = '$said'");

	list(
		$usid, $usname, $ustel1, $ustel3, $usmail1,
		$sadate, $satime, $sasum, $sapoint,
		$saduedate, $pmid, $pmname, $pmnumber, $pmetc, $pmtype,
		$sapayer, $samemo, $sastat
	) = mysql_fetch_row($result);

	if ($usid != $PSYCHEID && !$PsycheAdmin) {
		header("Location: shophistory.php");

		return;
	}

	$sasum += 0;
	$sapoint += 0;

	$sadate2 = str_replace("-", "", $sadate);

	// Delivery

	$result = mysql_query("select
dl.dlname, dl.dltel1, dl.dltel3, dl.dlzipcode, dl.dladdress, dl.dlmemo,
dl.dcid, dc.dcname, dl.dlnumber
from delivery as dl
left join dlcompany as dc on dl.dcid = dc.dcid
where dl.said = '$said'");

	list($dlname, $dltel1, $dltel3, $dlzipcode, $dladdress, $dlmemo,
	$dcid, $dcname, $dlnumber) = mysql_fetch_row($result);

	// SaGoods

	$result = mysql_query("select
sg.gdid, gd.gdname, gd.gdtype,
sg.sgpriceo, sg.sgprice, sg.sgqty, sg.sgsumo, sg.sgsum, gd.gdbonus,
sg.ciid, cp.cpname
from sagoods as sg
left join goods as gd on sg.gdid = gd.gdid
left join cpissue as ci on sg.ciid = ci.ciid
left join coupon as cp on ci.cpid = cp.cpid
where sg.said = '$said'");

	$hasESD = false;
	$hasPACK = false;

	$count = 0;
	$sgtotal = 0;

	while (
		list($gdid, $gdn, $gdtp, $sgprco, $sgprc, $sgq,
		$sgsumo, $sgsum, $gdbns, $cii, $cpn) = mysql_fetch_row($result)
	) {
		$sgprco += 0;
		$sgprc += 0;
		$sgq += 0;
		$sgsumo += 0;
		$sgsum += 0;
		$gdbns += 0;

		switch ($gdtp) {
		    case "P":
			$hasPACK = true;
			break;
		    case "E":
			$hasESD = true;
			break;
		    case "M":
			$hasESD = true;
			$hasPACK = true;
			break;
		}

		$totalsumo += $sgsumo;

		$gdbonus = $gdbns * $sgq;
		$totalgdbonus += $gdbonus;

		$sgtotal += $sgsum;

		mkShopRecordRow(
			$shoprecordlist, $gdid, $gdn,
			$sgprco, $sgprc, $sgq,
			$sgsumo, $sgsum, $gdbns, $gdbonus,
			$cpn, $cii, $cpprc, $cprt,
			$idx, ++$count, $usid
		);
	}

	$totaloff = $totalsumo - $sgtotal;

	$totalsumoc2 = number_format($totalsumo);
	$sasumc = number_format($sasum);
	$totaloffc = number_format($totaloff);
	$totalgdbonusc = number_format($totalgdbonus);

	if ($sasum == $totalsumo) {
		$totalsumoc = "";
		$totaloffstring = "";
	} else {
		$totalsumoc = number_format($totalsumo) . "<br />";

		if ($totaloff) {
			$totaloffstring = "&nbsp;- ÇÒÀÎ±Ý¾× <b>" . number_format($totaloff) . "¿ø</b>";
		}

		if ($sapoint) {
			$sapointc = number_format($sapoint);

			$sapointstring = "&nbsp;- Àû¸³±Ý <b>{$sapointc}¿ø</b>";

			$usingpointstring = <<<EOS
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="1"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="1" bgcolor="#F3F3F3"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="10"></td>
              </tr>
            </table>

            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="425"></td>
                <td width="175" align="center">»ç¿ë Àû¸³±Ý {$sapointc}¿ø</td>
              </tr>
            </table>

EOS;
		}
	}

# sastat: O ÁÖ¹®Á¢¼ö, C ½ÂÀÎ,
#         G ¹è¼ÛÁß(ÅÃ¹è ½Ã½ºÅÛ°ú ¿¬°èµÇ¸é È°¿ë),
#         F ¹è¼Û¿Ï·á, X Ãë¼Ò

	switch ($sastat) {
	    case "O":
		$dlstatstring = "¹è¼ÛÀü";
		$ststatstring = "°áÁ¦Àü";
		$dlimagearray = array(
			"delivery_011.gif",
			"delivery_02.gif",
			"delivery_03.gif",
			"delivery_04.gif"
		);
		break;
	    case "C":
		$dlstatstring = "»óÇ°ÁØºñÁß";
		$ststatstring = "°áÁ¦¿Ï·á";
		$dlimagearray = array(
			"delivery_011.gif",
			"delivery_021.gif",
			"delivery_031.gif",
			"delivery_04.gif"
		);
		break;
	    case "F":
		$dlstatstring = "¹è¼Û¿Ï·á";
		$ststatstring = "°áÁ¦¿Ï·á";
		$dlimagearray = array(
			"delivery_011.gif",
			"delivery_021.gif",
			"delivery_031.gif",
			"delivery_041.gif"
		);
		break;
	    default:	// "X"
		$dlstatstring = "ÁÖ¹®Ãë¼Ò";
		$ststatstring = "ÁÖ¹®Ãë¼Ò";
		$dlimagearray = array(
			"delivery_01.gif",
			"delivery_02.gif",
			"delivery_03.gif",
			"delivery_04.gif"
		);
	}

	$settleinfo = <<<EOS
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  <b>°áÁ¦»óÈ²</b> </font></td>
                <td style="padding: 5px; line-height:18px;"><b>$ststatstring</b></td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  <b>ÃÑ°áÁ¦±Ý¾× </b></font></td>
                <td style="padding: 5px; line-height:18px;"><b>{$sasumc}¿ø</>
( = »óÇ°ÇÕ°è <b>{$totalsumoc2}¿ø</b>{$totaloffstring}{$sapointstring})</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>

EOS;

	if ($pmtype == "C") {
		$pmidstring = "<b>$pmname</b> ($pmetc)";

		if ($sastat == "O" && $sasum > 0) {
			$pmidstring .= <<<EOS
 &nbsp;
<a href="javascript:epaywindow($said)">[´Ù½Ã °áÁ¦ÇÏ±â]</a>

EOS;
		}

		$script .= <<<EOS
function epaywindow(n) {
        open("shopepay.php?said="+n, "EPay", "width=550,height=500,scrollbars=yes");
}

EOS;

		$settleinfo .= <<<EOS
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  <b>°áÁ¦¹æ¹ý</b></font></td>
                <td style="padding: 5px;">$pmidstring</td>
              </tr>

EOS;
	} else {
		$pmidstring = "<b>$pmname ($pmnumber &nbsp; $pmetc)</b>";

		$settleinfo .= <<<EOS
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  <b>°áÁ¦¹æ¹ý</b></font></td>
                <td style="padding: 5px; line-height:18px;"><b>¹«ÅëÀåÀÔ±Ý</b></td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÀÔ±ÝÀºÇà </font></td>
                <td style="padding: 5px; line-height:18px;">$pmidstring</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÀÔ±Ý¿¹Á¤ÀÏ </font></td>
                <td style="padding: 5px; line-height:18px;"><b>$saduedate</b></td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="103" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÀÔ±ÝÀÚ¼º¸í </font></td>
                <td style="padding: 5px; line-height:18px;"><b>$sapayer</b></td>
              </tr>

EOS;
	}

	if ($hasESD) {
		$hasesdstring = <<<EOS
            <br>
            <table width="570" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="1" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td style="padding: 10px; line-height:18px;">°í°´´Ô²²¼­ ÇöÀç ÁÖ¹®ÇÏ½Å »óÇ°¿¡´Â ´Ù¿î·Îµå »óÇ°ÀÌ Æ÷ÇÔµÇ¾î 
                  ÀÖ½À´Ï´Ù. 
                  <p>±×·¯¹Ç·Î º°µµÀÇ ¹è¼Û °úÁ¤ ¾øÀÌ, <br>
                    ±¸¸Å °áÁ¦ ¿Ï·á Á÷ÈÄ, <a href="/mypage/mydownload.php">[³»Á¤º¸]</a> ÆäÀÌÁö¿¡¼­ ´Ù¿î·Îµå ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.</p>
                  <p>±¸ÀÔÇÏ½Å ´Ù¿î·Îµå »óÇ°ÀÇ °æ¿ì, ÇØ´ç ´Ù¿î·Îµå È½¼ö¿Í ¼³Ä¡ È½¼ö°¡ Á¦ÇÑµÇ¾î ÀÖ½À´Ï´Ù. Á¦ÇÑ È½¼ö¸¦ ÃÊ°úÇÏ¸é 
                    ¼ÒÁ¤ÀÇ Á¤Ç°»ç¿ëÀÚ È®ÀÎ °úÁ¤À» °ÅÃÄ ÃÊ±âÈ­ ¹ÞÀ¸¼Å¾ß ÇÕ´Ï´Ù. ÀÌÁ¡ ÃæºÐÈ÷ Âü°íÇÏ¼Å¼­ ±¸¸Å¿Í ÀÌ¿ë¿¡ Âø¿À¾øÀ¸½Ã±æ 
                    ¹Ù¶ø´Ï´Ù.</p></td>
              </tr>
              <tr> 
                <td height="1" background="/images/dot_01.gif"></td>
              </tr>
            </table>
            <br>

EOS;
	}

	if ($hasPACK) {
		if ($dcid) {
			$deliverystring = <<<EOS
<a href="javascript:traceDelivery($dcid,'$dlnumber')">($dcname $dlnumber)</a>

EOS;

			$script .= <<<EOS
function traceDelivery(n, m) {
	if (!n || !m) return;

	switch (n) {
	    case 1:
		open("http://service.epost.go.kr/trace.RetrieveRegiPrclDeliv.postal?sid1=" + m, "TraceDelivery", "width=470,height=440,scrollbars=yes");

		break;
	    case 5:
		open("http://www.yellowcap.co.kr/branch/chase/listbody.html?a_gb=branch&a_cd=5&a_item=0&f_slipno=" + m, "TraceDelivery", "width=1024,height=768,scrollbars=yes");

		break;
	}
}

EOS;
		}

		$haspackstring = <<<EOS
            <br>
            <table width="600" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td width="134"><img src="/shop/images/title_02.gif" width="96" height="15"></td>
                <td width="446">&nbsp; </td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="22" background="/company/images/subjectbox_pat.gif">&nbsp;</td>
              </tr>
            </table>
            <table width="570" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  <b>¹è¼Û»óÈ² </b></font></td>
                <td width="445" style="padding: 5px;"><b>$dlstatstring</b> $deliverystring</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ¼öÃëÀÎÀÌ¸§ </font></td>
                <td width="445" style="padding: 5px;">$dlname</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÀüÈ­¹øÈ£</font></td>
                <td width="445" style="padding: 5px;">$dltel1</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÇÚµåÆù¹øÈ£ </font></td>
                <td width="445" style="padding: 5px;">$dltel3</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ¿ìÆí¹øÈ£ </font></td>
                <td width="445" style="padding: 5px;">$dlzipcode</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÁÖ¼Ò </font></td>
                <td width="445" style="padding: 5px;">$dladdress</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" valign="top" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ¹è¼Û½Ã ¿äÃ»»çÇ×</font></td>
                <td width="445" valign="top" style="padding: 5px;">$dlmemo</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
            </table>

EOS;
	}

	$document['main'] = <<<EOS
      <table width="938" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="160" valign="top" background="/shop/images/left_pat.gif"> 
            <img src="/shop/images/left_pat.gif" width="160" />
            <!--shop leftamenu//------------>

            {$document['leftmenu']}

            <!--//shop leftamenu------------>
          
          </td>
          <td width="623" height="673" align="center" valign="top">
            <table width="623" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="69" height="26" align="center" background="/shop/images/mall_locationbar_title_bg.gif"><img src="/shop/images/mall_locationbar_title.gif"></td>
                <td width="434" background="/shop/images/mall_locationbar_title_bg.gif"><font color="00355E"><a href="/" style="color: #00355E;">È¨</a> &gt; <a href="/shop/shopmain.php" style="color: #00355E;">¼îÇÎ¸ô</a> &gt; ÁÖ¹®/¹è¼Û Á¶È¸</font></td>
              </tr>
            </table>
            <table width="623" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="99"><img src="/shop/images/ordersearch_t.gif" width="623" height="99"></td>
              </tr>
            </table>
            
            <br>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td><img src="/shop/images/process_up.gif" width="600" height="14"></td>
              </tr>
              <tr> 
                <td align="center" background="/shop/images/process_md.gif"><table width="580" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="155" align="center"><img src="/shop/images/delivery_t.gif" width="143" height="65"></td>
                      <td width="421"><table width="425" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td><img src="/shop/images/{$dlimagearray[0]}" width="89" height="88"></td>
                            <td><img src="/shop/images/process_arrow.gif" width="23" height="28"></td>
                            <td><img src="/shop/images/{$dlimagearray[1]}" width="89" height="88"></td>
                            <td><img src="/shop/images/process_arrow.gif" width="23" height="28"></td>
                            <td><img src="/shop/images/{$dlimagearray[2]}" width="89" height="88"></td>
                            <td><img src="/shop/images/process_arrow.gif" width="23" height="28"></td>
                            <td><img src="/shop/images/{$dlimagearray[3]}" width="89" height="88"></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td><img src="/shop/images/process_dn.gif" width="600" height="14"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td height="50" valign="bottom" ><img src="/shop/images/arrow_01.gif" align="absmiddle"> 
                  <b>$usname</b>´Ô²²¼­ ÁÖ¹®ÇÏ½Å »óÇ°ÀÔ´Ï´Ù.</td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="5" bgcolor="54AEAF"></td>
              </tr>
              <tr> 
                <td height="2"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="15"><img src="/community/images/boxleft.gif" width="15" height="35"></td>
                <td width="570" background="/community/images/boxpat.gif"><table width="570" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="53" align="center"><img src="/shop/images/t_number.gif" width="21" height="12"></td>
                      <td width="1"><img src="/shop/images/boxtitlebar.gif" width="1" height="15"></td>
                      <td width="284" align="center"><img src="/shop/images/t_goods.gif" width="31" height="12"></td>
                      <td width="1"><img src="/shop/images/boxtitlebar.gif" width="1" height="15"></td>
                      <td width="93" align="center"><img src="/shop/images/t_money.gif" width="35" height="24"></td>
                      <td width="1"><img src="/shop/images/boxtitlebar.gif" width="1" height="15"></td>
                      <td width="63" align="center"><img src="/shop/images/t_volume.gif" width="23" height="12"></td>
                      <td width="1"><img src="/shop/images/boxtitlebar.gif" width="1" height="15"></td>
                      <td width="93" align="center"><img src="/shop/images/t_total.gif" width="54" height="24"></td>
                    </tr>
                  </table></td>
                <td width="15"><img src="/community/images/boxright.gif" width="15" height="35"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="10"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
<!-- ¸ñ·Ï ½ÃÀÛ -->

$shoprecordlist

<!-- ¸ñ·Ï ³¡ -->
            </table>
$usingpointstring
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="10"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="9"><img src="/shop/images/totalmoney_left.gif" width="9" height="40"></td>
                <td align="right" background="/shop/images/totalmoney_pat.gif">
                  <table width="400" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="15"><b><font color="1B7678"></font></b></td>
                      <td width="147"><b><font color="1B7678"></font></b></td>
                      <td width="83" align="center"><img src="/shop/images/totalmoney_t.gif" width="56" height="40"></td>
                      <td width="98" align="center"><b><font color="BD3510">
<span id="totalsumorig" style="color: #BD3510; font-weight: normal; text-decoration: line-through;">$totalsumoc</span>
<span id="totalsumoff" style="color: #BD3510; font-weight: bold;">$sasumc</span>
</td>
                      <td width="14" background="/shop/images/totalmoney_t02.gif">&nbsp;</td>
                      <td width="43">&nbsp;</td>
                    </tr>
                  </table>
                </td>
                <td width="9"><img src="/shop/images/totalmoney_right.gif" width="9" height="40"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td align="right"><font color="1B7678">[¹è¼Û °³½Ã ÈÄ 20ÀÏ ÀÌÈÄ¿¡ <b>{$totalgdbonusc}¿ø</b>ÀÇ Àû¸³±ÝÀÌ Àû¸³µË´Ï´Ù.] </font></td>
              </tr>
            </table>
            <br> <table width="600" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td><img src="/shop/images/title_01.gif" width="109" height="15"> 
                </td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="22" background="/company/images/subjectbox_pat.gif">&nbsp;</td>
              </tr>
            </table>
            <table width="570" border="0" cellspacing="0" cellpadding="0">
			 <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÁÖ¹®¹øÈ£ </font></td>
                <td width="445" style="padding: 5px;"><b>$sadate2-$said</b></td>
              </tr>
			  <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÁÖ¹®ÀÏ½Ã</font></td>
                <td width="445" style="padding: 5px;">$sadate $satime</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÁÖ¹®ÀÚÀÌ¸§ </font></td>
                <td width="445" style="padding: 5px;">$usname</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÀüÈ­¹øÈ£</font></td>
                <td width="445" style="padding: 5px;">$ustel1</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  ÇÚµåÆù¹øÈ£ </font></td>
                <td width="445" style="padding: 5px;">$ustel3</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
              <tr> 
                <td width="105" style="padding: 5px;"><font color="1F8ABF"><img src="/images/ball_black.gif" width="3" height="11"> 
                  E-Mail</font></td>
                <td width="445" style="padding: 5px;">$usmail1</td>
              </tr>
              <tr> 
                <td height="1" colspan="2" background="/images/dot_01.gif"></td>
              </tr>
            </table>
            <br>
<!-- ¹è¼ÛÁö ½ÃÀÛ -->
$haspackstring
<!-- ¹è¼ÛÁö ³¡ -->

<!-- ´Ù¿î·Îµå »óÇ° ½ÃÀÛ -->
$hasesdstring
<!-- ´Ù¿î·Îµå »óÇ° ³¡ -->
            <br> 
            <br>
            <table width="600" border="0" cellspacing="0" cellpadding="5">
              <tr> 
                <td><img src="/shop/images/title_05.gif" width="73" height="15"></td>
              </tr>
            </table>
            <table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="22" background="/company/images/subjectbox_pat.gif">&nbsp;</td>
              </tr>
            </table>
            <table width="570" border="0" cellspacing="0" cellpadding="0">
<!-- °áÁ¦ Á¤º¸ ½ÃÀÛ -->

$settleinfo

<!-- °áÁ¦ Á¤º¸ ³¡ -->
            </table>
            <br>
            <br>
          </td>
          <td width="155" align="right" valign="top" background="/shop/images/right_pat.gif" style="padding-right:5px;padding-top:8px">{$document['rightbanner']}</td>
        </tr>
      </table>

EOS;
}

## Start

if (!$PSYCHEID) {
	header("Location: https://www.prosigner.com/member/signin.php?from=$ReqURI");

	return;
}

if (!$said) {
	header("Location: shophistory.php");

	return;
}

mkShopRecord($document, $script, $init, $said);

require "shop_template.php";
?>
