SELECT 'V' as Ind, Voucher_No as 'Voucher No', Voucher_Prefix,'SALES ORDER' as voucher_type, Voucher_Date as 'Booking Date', Delivery_Date as 'Delivery Date', POC_Name as 'Customer Name', Total as 'Total Amount'  FROM $trans_db.Sales_Order_Main WHERE Delivery_Date <= str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s') AND Delivery_Date >= str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') AND VoucherStatus < 170 ORDER BY Delivery_Date, Voucher_No