장바구니를 활용한 견적서 출력부분

장바구니를 활용한 견적서 출력부분

QA

장바구니를 활용한 견적서 출력부분

본문

https://sir.kr/yc5_tip/829

 

롱달장군님께서 올려주신 장바구니를 이용한 견적서를 진행하려 합니다 ㅠ

 

3543063980_1611030323.0029.png

근데 텍스트폰트도 깨지고, lib파일 잘못됫다하고 문제가 이만저만이 아니네요 ㅠㅠ

 

저와같은 증상이 발생하신 분이나 해결책이 있으신 분은 도움 부탁드립니다 ㅠㅠ

 

cartprint.php 소스 부분 

 

 


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
include_once('./_common.php');
include_once(G5_PATH.'/head.sub.php');

//print_r($_GET);
//print_r($_POST);
# 세션데이터에서 장바구니 전송값을 가져온다. ---------------------------------------------------
# [cart.php -> ajax.cartprint.php 세션저장한 값]
$tmp_data = get_session("cartprint");
if($tmp_data) {
    $array = unserialize($tmp_data);
}
//print_r($array);
# 장바구니 데이터 검사 --------------------------------------------------------------------------
if(is_array($array) && is_array($array['it_id']) && is_array($array['ct_chk'])) {
    # 장바구니 전송됨
} else {
    # 장바구니 전송안됨
    echo "<h2>견적서를 출력할 제품이 없습니다.</h2>";
    include_once(G5_PATH.'/tail.sub.php');
    exit;
}

# 장바구니 no 가공 ---------------------------------------------------------------------------
/* 장바구니 상품번호와 체크여부(ct_chk)를 비교하여 견적할 제품번호만 남긴다. */
foreach($array['it_id'] as $key=>$val) {
    if(isset($array['ct_chk'][$key]) && $array['ct_chk'][$key]=="1") {
        $TMP['it'][] = $val;
    } else {
        continue;
    }
}
//print_r($TMP['it']);
if(is_array($TMP['it']) && is_array($TMP['it'])) {
    # 견적할 제품이 있음
} else {
    # 견적할 제품이 없음
    echo "<h2>견적서를 출력할 제품이 없습니다.</h2>";
    include_once(G5_PATH.'/tail.sub.php');
    exit;
}

# 장바구니 DB 가져오기 ---------------------------------------------------------------------------
$s_cart_id = get_session('ss_cart_id');
// $s_cart_id 로 현재 장바구니 자료 쿼리
$qry = " SELECT * FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$s_cart_id' AND it_id IN ( ". implode(",", $TMP['it']) ." ) ORDER BY it_id ";
$res = sql_query($qry);
if(sql_num_rows($res)>0) {
    $idx = 0;
    while($row = sql_fetch_array($res)) {
        $DATA['cart'][$idx] = $row;
        # 옵션DB 가져오기
        $qry2 = " SELECT * FROM {$g5['g5_shop_item_option_table']} WHERE it_id = '{$row['it_id']}' AND io_id='{$row['io_id']}' AND io_type='0' ";
        $res2 = sql_query($qry2);
        if(sql_num_rows($res2)>0) {
            $DATA['opt'][$idx] = sql_fetch_array($res2);
        }
        $idx++;
    }
}
//print_r($DATA);

# 출력화면 그리기      ---------------------------------------------------------------------------
?>

<style type="text/css">
.print-wrap { width:600px; box-sizing:border-box; margin:5px auto; }
/* 표제부 */
.table-info { border-collapse:collapse; width:100%; }
.table-info * { font-size: 12px;}
.table-info td { border:1px solid #09a4b6; height:20px; }
.table-info .td-row-6 { background:#06899f; color:#ffffff; text-align:center; }
.table-info .td-head { background:#67b9c2; text-align:center; color:#ffffff; }
/* 제품리스트 */
.table-list { border-collapse:collapse; width:100%; margin:20px 0 0 0; }
.table-list * { font-size:12px;}
.table-list td { border:1px solid #09a4b6; height:20px; }
.table-list .td-head { background:#67b9c2; text-align:center; color:#ffffff; }
.table-list .td-body { font-size:11px !important; }
/* 공통 */
.input-1 { width:174px; }
.td-right { text-align:right; }
.td-center { text-align:center; }
/* 기타 */
.div-help { margin:10px 0; color:#2861c8; }
.print-button { width:600px; margin:10px auto; text-align:right; }
.print-button button { padding:4px 10px; background:#2548a5; color:#ffffff; border:0; }
@media print {
    .print-button { display:none; }
}
</style>
<div class="print-wrap">
    <table class="table-info">
    <col width="20">
    <col width="60">
    <col width="180">
    <col width="20">
    <col width="60">
    <col width="">
    <col width="60">
    <col width="">
    <tr>
        <td class="td-row-6" rowspan="6">의<br>뢰<br>자</td>
        <td class="td-head">견적일</td>
        <td class="td-body"><input type="text" class="input-1" value="<?=date("Y-m-d")?>"></td>
        <td class="td-row-6" rowspan="6">공<br>급<br>자</td>
        <td class="td-head">등록번호</td>
        <td class="td-body" colspan="3"><?=$default['de_admin_company_saupja_no']?></td>
    </tr>
    <tr>
        <td class="td-head">업체명</td>
        <td class="td-body"><input type="text" class="input-1"></td>
        <td class="td-head">회사명</td>
        <td class="td-body"><?=$default['de_admin_company_name']?></td>
        <td class="td-head">성명</td>
        <td class="td-body"><?=$default['de_admin_company_owner']?></td>
    </tr>
    <tr>
        <td class="td-head">담당자</td>
        <td class="td-body"><input type="text" class="input-1"></td>
        <td class="td-head">주소</td>
        <td class="td-body" colspan="3"><?=$default['de_admin_company_addr']?></td>
    </tr>
    <tr>
        <td class="td-head">전화</td>
        <td class="td-body"><input type="text" class="input-1"></td>
        <td class="td-head">업태</td>
        <td class="td-body"><?=$default['de_biztype_a']?></td>
        <td class="td-head">종목</td>
        <td class="td-body"><?=$default['de_biztype_b']?></td>
    </tr>
    <tr>
        <td class="td-head">팩스</td>
        <td class="td-body"><input type="text" class="input-1"></td>
        <td class="td-head">전화</td>
        <td class="td-body"><?=$default['de_admin_company_tel']?></td>
        <td class="td-head">팩스</td>
        <td class="td-body"><?=$default['de_admin_company_fax']?></td>
    </tr>
    <tr>
        <td class="td-head">E-mail</td>
        <td class="td-body"><input type="text" class="input-1"></td>
        <td class="td-head">담당자</td>
        <td class="td-body" colspan="3"></td>
    </tr>
    </table>
    <table class="table-list">
    <col width="80">
    <col width="80">
    <col width="80">
    <col width="">
    <col width="60">
    <col width="40">
    <col width="70">
    <tr>
        <td class="td-head">제품번호</td>
        <td class="td-head">제품명</td>
        <td class="td-head">형식번호</td>
        <td class="td-head">제품사양</td>
        <td class="td-head">단가</td>
        <td class="td-head">수량</td>
        <td class="td-head">가격</td>
    </tr>
    <?
    $total_price = 0;
    $this_price = 0;                          
    foreach($DATA['cart'] as $key=>$val) {
        $this_price = ($val['ct_price']+$val['io_price']) * $val['ct_qty'];
        $total_price += $this_price;
        
    ?>
    <tr>
        <td class="td-body"><?=$val['io_id']?></td>
        <td class="td-body"><?=$val['it_name']?></td>
        <td class="td-body"><?=$DATA['opt'][$key]['io_misc01']?></td>
        <td class="td-body"><?=$DATA['opt'][$key]['io_misc02']?></td>
        <td class="td-body td-right"><?=number_format($val['ct_price']+$val['io_price'])?></td>
        <td class="td-body td-center"><?=number_format($val['ct_qty'])?></td>
        <td class="td-body td-right"><?=number_format($this_price)?></td>
    </tr>
    <?
    } # end foreach;
    ?>
    <tr>
        <td class="td-body td-center" colspan="6"><strong>합계금액</strong></td>
        <td class="td-body td-right"><strong><?=number_format($total_price)?></strong></td>
    </tr>

    </table>
    <div class="div-help">
        상기 견적내용은 환율에 따라 가격이 변동될 수 있으니 참고용으로만 활용하시기 바랍니다.<br>
        (견적내용 및 입력사항은 서버로 전송되지 않습니다)<br>
        자세한 견적상담을 원하시면 <?=$default['de_admin_company_tel']?>로 전화바랍니다.
    </div>
</div>
<div class="print-button">
    <button type="button" onClick="print();">인쇄</button>
    <button type="button" onClick="window.close();">닫기</button>
</div>
<?
include_once(G5_PATH.'/tail.sub.php');
?>
 

 

스킨을 사용해서 그런건지... 좀 의심을 해보고 있습니다 ㅠ

이 질문에 댓글 쓰기 :

답변 2

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

삭제해보세요

원래 사용중인 문자셋이 euc-kr 이신것 같네요

다운받으신 파일 cartprint.php 파일의 인코딩을 확인해보세요. 

ANSI 를 UTF-8로 바꾸시고요...

common.php 파일 이전에 문자열이 있으면 안되니

meta 태그는 지우시는게 좋겠네요

답변을 작성하시기 전에 로그인 해주세요.
전체 293
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT