엑셀 배송일괄처리시 엑셀 다운로드가 되지 않을때
엑셀 배송일괄처리시 엑셀 다운로드가 되지 않을때
/adm/shop_admin/orderdelivery.php 파일을 아래의 소스코드로 교체합니다.
<?php
/* orderdelivery.php */
$sub_menu = '400400';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
// 주문정보
$sql = " select *
from {$g5['g5_shop_order_table']}
where od_misu = '0'
and od_status = '준비'
order by od_id desc ";
$result = sql_query($sql);
if(!@sql_num_rows($result))
alert_close('배송처리할 주문 내역이 없습니다.');
/*================================================================================
php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
=================================================================================*/
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');
$fname = tempnam(G5_DATA_PATH, "tmp-deliverylist.xls");
$workbook = new writeexcel_workbook($fname);
$worksheet = $workbook->addworksheet();
// Put Excel data
$data = array('주문번호', '주문자명', '주문자전화1', '주문자전화2', '배송자명', '배송지전화1', '배송지전화2', '배송지주소', '배송회사', '운송장번호');
$data = array_map('iconv_euckr', $data);
$col = 0;
foreach($data as $cell) {
$worksheet->write(0, $col++, $cell);
}
for($i=1; $row=sql_fetch_array($result); $i++) {
$row = array_map('iconv_euckr', $row);
$worksheet->write($i, 0, ' '.$row['od_id']);
$worksheet->write($i, 1, $row['od_name']);
$worksheet->write($i, 2, ' '.$row['od_tel']);
$worksheet->write($i, 3, ' '.$row['od_hp']);
$worksheet->write($i, 4, $row['od_b_name']);
$worksheet->write($i, 5, ' '.$row['od_b_tel']);
$worksheet->write($i, 6, ' '.$row['od_b_hp']);
$worksheet->write($i, 7, print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']));
$worksheet->write($i, 8, $row['od_delivery_company']);
$worksheet->write($i, 9, $row['od_invoice']);
}
$workbook->close();
header("Content-Type: application/x-msexcel; name=\"deliverylist-".date("ymd", time()).".xls\"");
header("Content-Disposition: inline; filename=\"deliverylist-".date("ymd", time()).".xls\"");
$fh=fopen($fname, "rb");
fpassthru($fh);
unlink($fname);
?>
/adm/shop_admin/orderdelivery.php 파일을 아래의 소스코드로 교체합니다.
<?php
/* orderdelivery.php */
$sub_menu = '400400';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
// 주문정보
$sql = " select *
from {$g5['g5_shop_order_table']}
where od_misu = '0'
and od_status = '준비'
order by od_id desc ";
$result = sql_query($sql);
if(!@sql_num_rows($result))
alert_close('배송처리할 주문 내역이 없습니다.');
/*================================================================================
php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
=================================================================================*/
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');
$fname = tempnam(G5_DATA_PATH, "tmp-deliverylist.xls");
$workbook = new writeexcel_workbook($fname);
$worksheet = $workbook->addworksheet();
// Put Excel data
$data = array('주문번호', '주문자명', '주문자전화1', '주문자전화2', '배송자명', '배송지전화1', '배송지전화2', '배송지주소', '배송회사', '운송장번호');
$data = array_map('iconv_euckr', $data);
$col = 0;
foreach($data as $cell) {
$worksheet->write(0, $col++, $cell);
}
for($i=1; $row=sql_fetch_array($result); $i++) {
$row = array_map('iconv_euckr', $row);
$worksheet->write($i, 0, ' '.$row['od_id']);
$worksheet->write($i, 1, $row['od_name']);
$worksheet->write($i, 2, ' '.$row['od_tel']);
$worksheet->write($i, 3, ' '.$row['od_hp']);
$worksheet->write($i, 4, $row['od_b_name']);
$worksheet->write($i, 5, ' '.$row['od_b_tel']);
$worksheet->write($i, 6, ' '.$row['od_b_hp']);
$worksheet->write($i, 7, print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']));
$worksheet->write($i, 8, $row['od_delivery_company']);
$worksheet->write($i, 9, $row['od_invoice']);
}
$workbook->close();
header("Content-Type: application/x-msexcel; name=\"deliverylist-".date("ymd", time()).".xls\"");
header("Content-Disposition: inline; filename=\"deliverylist-".date("ymd", time()).".xls\"");
$fh=fopen($fname, "rb");
fpassthru($fh);
unlink($fname);
?>
댓글 2개
adsdsf
5년 전
123412341234
5년 전
필요했던 정보인데 감사합니다ㅠ
게시판 목록
영카트5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 71 | 10년 전 | 7874 | ||
| 70 | 11년 전 | 5645 | ||
| 69 | 11년 전 | 5788 | ||
| 68 | 11년 전 | 11895 | ||
| 67 | 11년 전 | 8074 | ||
| 66 | 11년 전 | 6186 | ||
| 65 | 11년 전 | 6315 | ||
| 64 | 11년 전 | 6626 | ||
| 63 | 11년 전 | 7039 | ||
| 62 | 11년 전 | 10232 | ||
| 61 | 11년 전 | 23166 | ||
| 60 |
xepiesta
|
11년 전 | 4876 | |
| 59 | 11년 전 | 8271 | ||
| 58 | 11년 전 | 9005 | ||
| 57 | 11년 전 | 6684 | ||
| 56 |
|
11년 전 | 7171 | |
| 55 |
|
11년 전 | 6207 | |
| 54 | 11년 전 | 15792 | ||
| 53 |
kiplayer
|
11년 전 | 6658 | |
| 52 | 11년 전 | 7177 | ||
| 51 | 11년 전 | 10054 | ||
| 50 |
|
11년 전 | 5162 | |
| 49 | 11년 전 | 8440 | ||
| 48 | 11년 전 | 6143 | ||
| 47 | 11년 전 | 7210 | ||
| 46 | 11년 전 | 4209 | ||
| 45 | 11년 전 | 8044 | ||
| 44 | 11년 전 | 3926 | ||
| 43 | 11년 전 | 5440 | ||
| 42 | 11년 전 | 8196 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기