영카트로 직원별 매출 현황 만들어야하는데요~~

영카트로 직원별 매출 현황 만들어야하는데요~~

밑에 표처럼 그래프는 아니어도 금액숫자로 나오면 될듯합니다.


12월
직원1 매출액 1000만원 판매갯수 5개 합 = 얼마
직원2 매출액 2000만원 판매갯수 10 합 = 얼마
직원3 매출액 100만원 판매갯수 1 합 = 얼마


11월
직원1 매출액 1000만원 판매갯수 5개 합 = 얼마
직원2 매출액 2000만원 판매갯수 10 합 = 얼마
직원3 매출액 100만원 판매갯수 1 합 = 얼마


>> 영카트 기본 매출현황을 인용해보면

$sql = " select on_uid,
SUBSTRING(od_time,1,7) as od_date,
od_send_cost,
od_receipt_bank,
od_receipt_card,
od_receipt_point,
od_dc_amount,
(od_receipt_bank + od_receipt_card + od_receipt_point) as receiptamount,
(od_refund_amount + od_cancel_card) as receiptcancel
from $g4[yc4_order_table]
where SUBSTRING(od_time,1,7) between '$fr_date' and '$to_date'
order by od_time desc ";
$result = sql_query($sql);
for ($i=0; $row=mysql_fetch_array($result); $i++)
{
if ($i == 0)
$save[od_date] = $row[od_date];

if ($save[od_date] != $row[od_date]) {
static $count = 0;

if ($count++ > 0)
echo "<tr><td colspan=9 height=1 bgcolor=#EEEEEE></td></tr>\n";

unset($save);
$save[od_date] = $row[od_date];
}

// 장바구니 상태별 금액
$sql1 = " select (SUM(ct_amount * ct_qty)) as orderamount, /* 주문합계 */
(SUM(IF(ct_status = '취소' OR ct_status = '반품' OR ct_status = '품절', ct_amount * ct_qty, 0))) as ordercancel /* 주문취소 */
from $g4[yc4_cart_table]
where on_uid = '$row[on_uid]' ";
$row1 = sql_fetch($sql1);

$row1[orderamount] += $row[od_send_cost];
$misu = $row1[orderamount] - $row1[ordercancel] - $row[od_dc_amount] - $row[receiptamount] + $row[receiptcancel];

$save[ordercount]++;
$save[orderamount] += $row1[orderamount];
$save[ordercancel] += $row1[ordercancel];
$save[dc] += $row[od_dc_amount];
$save[receiptbank] += $row[od_receipt_bank];
$save[receiptcard] += $row[od_receipt_card];
$save[receiptpoint] += $row[od_receipt_point];
$save[receiptcancel] += $row[receiptcancel];
$save[misu] += $misu;

$tot[ordercount]++;
$tot[orderamount] += $row1[orderamount];
$tot[ordercancel] += $row1[ordercancel];
$tot[dc] += $row[od_dc_amount];
$tot[receiptbank] += $row[od_receipt_bank];
$tot[receiptcard] += $row[od_receipt_card];
$tot[receiptpoint] += $row[od_receipt_point];
$tot[receiptamount] += $row[receiptamount];
$tot[receiptcancel] += $row[receiptcancel];
$tot[misu] += $misu;
}



이렇게 되어있는데요


우선 후덜덜 하군요 ㅎㅎㅎ 리스트는 현재 12월 얼마 11월 얼마로 되어있는걸

리스트에 판매직원만 넣으면 될듯한데요 쉽지가 않군요


이런쿼리 손대본적도 없는터라 ㅎㅎ


고수님들 도와주세요^^
|

댓글 1개

총체적으로

select on_uid, SUBSTRING(od_time,1,7) as od_date, od_send_cost, od_receipt_bank, od_receipt_card, od_receipt_point, od_dc_amount, (od_receipt_bank + od_receipt_card + od_receipt_point) as receiptamount, (od_refund_amount + od_cancel_card) as receiptcancel from yc4_order where SUBSTRING(od_time,1,7) between '2013-12' and '2013-12' order by od_time desc

쿼리가 이거같은데요 이래도 후덜덜하군요
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 1,980
12년 전 조회 1,970
12년 전 조회 1,737
12년 전 조회 1,905
12년 전 조회 1,952
12년 전 조회 1,854
12년 전 조회 1,843
12년 전 조회 1,707
12년 전 조회 2,895
12년 전 조회 2,479
12년 전 조회 1,902
12년 전 조회 8,532
12년 전 조회 4,291
12년 전 조회 2,155
12년 전 조회 2,292
12년 전 조회 6,489
12년 전 조회 2,109
12년 전 조회 2,646
12년 전 조회 1,915
12년 전 조회 1,745
🐛 버그신고