0
안녕 얘들 아, ive는 하나의 큰 데이터베이스 테이블 보고서 있어요.
내가 원하는대로, (pro_tan)을 제외하고 을 제외하고 금액을 40 %와 60 %로 나누십시오. 분할하지 마세요.PHP는 테이블 행을 계산
SHORT REPORT table:
--------------
id t_deep t_tanning amount cashier
-----------------------------------------
1 deep pro tan 30 1
2 facial tanning 25 2
3 deep pro tan 30 1
4 deep tanning 25 1
report html result:
table id cashier(40%) owns(60%) total
1 12 18 30
2 10 15 25
3 12 18 30
4 10 15 25
EXPECTING 결과 :
table id cashier owns total
1 0 30 30
2 10 15 25
3 0 30 30
4 10 15 25
PHP는 계산이 분할 40 %와 60 % :
$q = $db->query("SELECT cashier, SUM(r_amount) AS amount, SUM(r_amount*0.60) AS totalSixty, SUM(r_amount*0.40) AS totalFourty FROM report
LEFT JOIN cashier ON cashier.id_cashier = report.id_cashier
WHERE date='$today' GROUP BY id_cashier");
// query to search pro tan
$q1 = $db->query("SELECT cashier, SUM(r_amount) AS amount, SUM(r_amount*0.60) AS totalSixty, SUM(r_amount*0.40) AS totalFourty FROM report
LEFT JOIN cashier ON cashier.id_cashier = report.id_cashier
WHERE date='$today' AND t_tanning LIKE 'Pro Tan%' GROUP BY id_cashier");
$sixtyPercent = number_format($r['totalSixty'],2);
$fourtyPercent = number_format($r['totalFourty'],2);
무엇이 당신의 질문입니까? 그것은 "이게 효과가 있니?" 그렇다면 그렇습니까? – MJB