Here's my attempt
SELECT sale_date
, sum(cashpaid) + sum(cashpartpaid) + sum(codpaid) as total_cash_sales
, sum(cashdue) + sum(cashpartdue) + sum(carddue) + sum(coddue) as total_credit_sales
, sum(codpaid) + sum(coddue) as total_cod_sales
, sum(cardpaid) as total_card_sales
FROM (
SELECT bad.basket_id
, bad.amount_due as due
, SUM(p.amount_paid) as paid
, p.payment_method_id
, b.payment_status
, DATE(bad.sale_time) as sale_date
, CASE WHEN payment_method_id = 1 AND payment_status = 'paid'
THEN sum(p.amount_paid) ELSE 0
END as cashpaid
, CASE WHEN payment_method_id = 1 AND payment_status = 'due'
THEN bad.amount_due ELSE 0
END as cashdue
, CASE WHEN payment_method_id = 1 AND payment_status = 'partial'
THEN SUM(p.amount_paid) ELSE 0
END as cashpartpaid
, CASE WHEN payment_method_id = 1 AND payment_status = 'partial'
THEN bad.amount_due - SUM(p.amount_paid) ELSE 0
END as cashpartdue
, CASE WHEN payment_method_id = 2
THEN SUM(p.amount_paid) ELSE 0
END as cardpaid
, CASE WHEN payment_method_id = 2
THEN bad.amount_due - SUM(p.amount_paid) ELSE 0
END as carddue
, CASE WHEN payment_method_id = 4 AND payment_status <> 'due'
THEN SUM(p.amount_paid) ELSE 0
END as codpaid
, CASE WHEN payment_method_id = 4 AND payment_status = 'due'
THEN bad.amount_due ELSE 0
END as coddue
FROM basket_amount_due bad
JOIN basket b USING (basket_id)
LEFT JOIN basket_payment p USING (basket_id)
GROUP BY basket_id, payment_method_id
) detail
GROUP BY sale_date;