SELECT 'V' as Ind , Voucher_No as 'Voucher No',Voucher_Prefix,'SALESVOUCHER' as VoucherType,  Voucher_Date as 'Voucher Date', Reference as Reference, cast(SUM(Discount_In_Amount) as Decimal(10,2)) as Discount FROM $trans_db.Sales_Invoice_Main stable  where Discount_In_Amount >0 and  ( str_to_Date(concat(stable.Voucher_Date, substr(`TimeStamp`, 11,19)) ,'%Y-%m-%d %H:%i:%s')>= str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') and str_to_Date(concat(stable.Voucher_Date, substr(`TimeStamp`, 11,19)) ,'%Y-%m-%d %H:%i:%s')<= str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s')) GROUP BY Voucher_No Order BY Voucher_No
