미수금등의 주문정보 함수 get_order_info 추가
This commit is contained in:
@ -18,40 +18,7 @@ if ($od_receipt_time)
|
||||
alert('결제일시 오류입니다.');
|
||||
}
|
||||
|
||||
// 주문 합계
|
||||
$sql = " select SUM( IF( ct_notax = 0, ( IF(io_type = 1, (io_price * ct_qty), ( (ct_price + io_price) * ct_qty) ) - cp_price ), 0 ) ) as tax_mny,
|
||||
SUM( IF( ct_notax = 1, ( IF(io_type = 1, (io_price * ct_qty), ( (ct_price + io_price) * ct_qty) ) - cp_price ), 0 ) ) as free_mny
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '{$od['od_id']}'
|
||||
and ct_status IN ( '주문', '준비', '배송', '완료' ) ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$tax_mny = $sum['tax_mny'];
|
||||
$free_mny = $sum['free_mny'];
|
||||
|
||||
// 과세, 비과세
|
||||
if($od['od_tax_flag']) {
|
||||
$tot_tax_mny = ( $tax_mny + $od_send_cost + $od_send_cost2 )
|
||||
- ( $od['od_coupon'] + $od['od_send_coupon'] + $od_receipt_point );
|
||||
if($tot_tax_mny < 0) {
|
||||
$free_mny += $tot_tax_mny;
|
||||
$tot_tax_mny = 0;
|
||||
}
|
||||
} else {
|
||||
$tot_tax_mny = ( $tax_mny + $free_mny + $od_send_cost + $od_send_cost2 )
|
||||
- ( $od['od_coupon'] + $od['od_send_coupon'] + $od_receipt_point );
|
||||
$free_mny = 0;
|
||||
}
|
||||
|
||||
$od_tax_mny = round($tot_tax_mny / 1.1);
|
||||
$od_vat_mny = $tot_tax_mny - $od_tax_mny;
|
||||
$od_free_mny = $free_mny;
|
||||
|
||||
// 미수
|
||||
$od_misu = ( $od['od_cart_price'] + $od_send_cost + $od_send_cost2 )
|
||||
- ( $od['od_cart_coupon'] + $od['od_coupon'] + $od['od_send_coupon'] )
|
||||
- ( $od_receipt_price + $od_receipt_point - $od_refund_price );
|
||||
|
||||
// 결제정보 반영
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_deposit_name = '$od_deposit_name',
|
||||
od_bank_account = '$od_bank_account',
|
||||
@ -59,10 +26,6 @@ $sql = " update {$g5['g5_shop_order_table']}
|
||||
od_receipt_price = '$od_receipt_price',
|
||||
od_receipt_point = '$od_receipt_point',
|
||||
od_refund_price = '$od_refund_price',
|
||||
od_misu = '$od_misu',
|
||||
od_tax_mny = '$od_tax_mny',
|
||||
od_vat_mny = '$od_vat_mny',
|
||||
od_free_mny = '$od_free_mny',
|
||||
dl_id = '$dl_id',
|
||||
od_invoice = '$od_invoice',
|
||||
od_invoice_time = '$od_invoice_time',
|
||||
@ -71,6 +34,22 @@ $sql = " update {$g5['g5_shop_order_table']}
|
||||
where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 주문정보
|
||||
$info = get_order_info($od_id);
|
||||
|
||||
if(!$info)
|
||||
alert('주문자료가 존재하지 않습니다.');
|
||||
|
||||
// 미수금 정보 등 반영
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_misu = '{$info['od_misu']}',
|
||||
od_tax_mny = '{$info['od_tax_mny']}',
|
||||
od_vat_mny = '{$info['od_vat_mny']}',
|
||||
od_free_mny = '{$info['od_free_mny']}',
|
||||
od_send_cost = '{$info['od_send_cost']}'
|
||||
where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
|
||||
// 메일발송
|
||||
define("_ORDERMAIL_", true);
|
||||
|
||||
Reference in New Issue
Block a user