엑셀 배송일괄처리시 엑셀 다운로드가 되지 않을때
엑셀 배송일괄처리시 엑셀 다운로드가 되지 않을때
/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 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 131 |
Lemios
|
9년 전 | 5856 | |
| 130 | 9년 전 | 7348 | ||
| 129 | 9년 전 | 6292 | ||
| 128 | 9년 전 | 4835 | ||
| 127 | 9년 전 | 5634 | ||
| 126 | 9년 전 | 10772 | ||
| 125 | 9년 전 | 8725 | ||
| 124 | 9년 전 | 6687 | ||
| 123 |
|
9년 전 | 5862 | |
| 122 |
사노라가노라
|
9년 전 | 5838 | |
| 121 | 9년 전 | 6644 | ||
| 120 | 9년 전 | 7678 | ||
| 119 | 10년 전 | 6083 | ||
| 118 | 10년 전 | 6236 | ||
| 117 | 10년 전 | 6466 | ||
| 116 | 10년 전 | 8089 | ||
| 115 | 10년 전 | 5735 | ||
| 114 | 10년 전 | 5369 | ||
| 113 | 10년 전 | 8492 | ||
| 112 | 10년 전 | 10120 | ||
| 111 | 10년 전 | 7299 | ||
| 110 | 10년 전 | 13199 | ||
| 109 |
|
10년 전 | 12084 | |
| 108 | 10년 전 | 6994 | ||
| 107 |
마인드맨김영진
|
10년 전 | 4436 | |
| 106 |
마인드맨김영진
|
10년 전 | 5724 | |
| 105 | 10년 전 | 6239 | ||
| 104 | 10년 전 | 6442 | ||
| 103 | 10년 전 | 5237 | ||
| 102 | 10년 전 | 5773 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기