change credit payment report query

This commit is contained in:
phyusin
2018-09-19 10:26:04 +06:30
parent 7cb23e5add
commit 7256469c4a

View File

@@ -1219,11 +1219,12 @@ def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,
sub_query2 = "SELECT (CASE WHEN shift_closed_at IS NOT NULL AND credit_payment > 0
THEN CONCAT(DATE_FORMAT(CONVERT_TZ(shift_started_at,'+00:00','+06:30'),'%d %b %y %h:%i%p'),' - ',DATE_FORMAT(CONVERT_TZ(shift_closed_at,'+00:00','+06:30'),'%d %b %y %h:%i%p'))
WHEN shift_started_at IS NOT NULL AND shift_closed_at IS NULL AND credit_payment > 0 THEN DATE_FORMAT(CONVERT_TZ(shift_started_at,'+00:00','+06:30'),'%d %b %y %h:%i%p')
ELSE '-' END)
FROM shift_sales
WHERE shift_sales.id = s.shift_sale_id"
sub_query3 = "SELECT (CASE WHEN shift_closed_at IS NOT NULL AND credit_payment > 0
sub_query3 = "SELECT (CASE WHEN shift_closed_at IS NOT NULL OR shift_closed_at IS NULL AND credit_payment > 0
THEN employees.name ELSE '-' END)
FROM shift_sales
INNER JOIN employees ON employees.id=shift_sales.employee_id