주문내역 phpexcel로 받는데 칸이 밀려요 채택완료
안녕하세요. 주문내역 엑셀출력에 회원가입에 작성한 정보를 불러오고자 쿼리 수정을 하고 출력을 했는데 엑셀 출력은 잘 되는데 아래 이미지처럼 특정부분이 한칸씩 밀려서 출력됩니다.. 혹시 어디에서 문제가 생긴건지 알 수 있을까요?

Copy
if ($csv == 'xls')
{
$fr_date = date_conv($fr_date);
$to_date = date_conv($to_date);
$sql = " SELECT
a.od_id,
od_b_zip1,
od_b_zip2,
od_b_addr1,
od_b_addr2,
od_b_addr3,
od_b_addr_jibeon,
od_b_name,
od_b_tel,
od_b_hp,
od_memo,
b.it_name,
ct_qty,
b.it_id,
a.od_id,
od_memo,
od_invoice,
b.ct_option,
b.ct_send_cost,
b.it_sc_type
FROM {$g5['g5_shop_order_table']} a, {$g5['g5_shop_cart_table']} b
where a.od_id = b.od_id ";
$sql2 = " select * from g5_member ";
if ($case == 1) // 출력기간
$sql .= " and a.od_time between '$fr_date 00:00:00' and '$to_date 23:59:59' ";
else // 주문번호구간
$sql .= " and a.od_id between '$fr_od_id' and '$to_od_id' ";
if ($ct_status)
$sql .= " and b.ct_status = '$ct_status' ";
$sql .=" order by od_time asc, b.it_id, b.io_type, b.ct_id ";
$result = sql_query($sql);
$result2 = sql_query($sql2);
$merged_results = array();
while ($row = sql_fetch_array($result)) {
$merged_results[] = $row;
}
while ($row = sql_fetch_array($result2)) {
$merged_results[] = $row;
}
$cnt = @sql_num_rows($result);
if (!$cnt)
alert("출력할 내역이 없습니다.");
include_once(G5_LIB_PATH.'/PHPExcel.php');
$headers = array('순번', '이름', '전화번호', '우편번호', '주소', '공동현관', '배송메모' , '주문번호' , '상품명', '선택사항', '수량', '배송비' );
$widths = array(10, 30, 10, 15, 15, 15, 10, 10, 20, 15, 20, 20, 50, 50);
$header_bgcolor = 'FFABCDEF';
$last_char = column_char(count($headers) - 1);
$no = 0;
for($i=0; $i<count($merged_results); $i++) {
$pull_address = print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']);
$save_it_id = '';
$ct_send_cost = '';
if($save_it_id != $row['it_id']) {
// 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(ct_qty) as qty
from {$g5['g5_shop_cart_table']}
where it_id = '{$row['it_id']}'
and od_id = '{$row['od_id']}' ";
$sum = sql_fetch($sql);
switch($row['ct_send_cost'])
{
case 1:
$ct_send_cost = '착불';
break;
case 2:
$ct_send_cost = '무료';
break;
default:
$ct_send_cost = '선불';
break;
}
// 조건부무료
if($row['it_sc_type'] == 2) {
$sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $row['od_id']);
if($sendcost == 0)
$ct_send_cost = '무료';
}
$save_it_id = $row['it_id'];
$ct_send_cost = $ct_send_cost;
}
$no++;
$row = $merged_results[$i];
$rows[] = array(
$no,
$row['od_b_name'],
' '.conv_telno($row['od_b_tel']),
' '.$row['od_b_zip1'].$row['od_b_zip2'],
$pull_address,
' '.$row['mb_3'],
' '.$row['od_memo'],
' '.$row['od_id'],
preg_replace("/\"/", """, $row['it_name']),
$row['ct_option'],
' '.$row['ct_qty'],
$ct_send_cost
);
}
답변 2개
답변을 작성하려면 로그인이 필요합니다.
로그인