FETCH ORDERS CALLED
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.sysid AS sysid, o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.sysid DESC
            LIMIT 200
ERROR: Prepare failed: Unknown column 'o.sysid' in 'field list'
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.sysid DESC
            LIMIT 200
ERROR: Prepare failed: Unknown column 'o.sysid' in 'order clause'
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.sysid DESC
            LIMIT 200
ERROR: Prepare failed: Unknown column 'o.sysid' in 'order clause'
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 9
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 11
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 9
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 9
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 9
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 9
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 10
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 15
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 16
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 17
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 16
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 15
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 14
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 13
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 12
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 18
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 18
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 24
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 23
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 28
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 28
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 28
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%'))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 33
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 33
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 35
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 34
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 31
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 29
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 28
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 22
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE())
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 22
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 31
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 29
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%'))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%'))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%')) AND o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%')) AND o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%')) AND o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 30
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 32
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(CURDATE()) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(CURDATE()) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE MONTH(STR_TO_DATE(o.date, '%d-%m-%Y')) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(STR_TO_DATE(o.date, '%d-%m-%Y')) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE STR_TO_DATE(o.date, '%d-%m-%Y') BETWEEN ? AND ? AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE() AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND o.username = ?
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE o.username = ? AND DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 42
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 40
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 40
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 3
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 7
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 8
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 8
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 8
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 48
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 46
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 45
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 44
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%'))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%'))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE (o.orderid LIKE CONCAT('%',?,'%') OR o.customerid LIKE CONCAT('%',?,'%') OR c.custname LIKE CONCAT('%',?,'%'))
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 45
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 45
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 44
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 0
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 5
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 48
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 6
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 4
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 1
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
FETCH ORDERS CALLED
STEP 1: Starting fetch_orders logic
STEP 2: Preparing SQL: SELECT o.orderid, o.date, o.customerid, COALESCE(c.custname,'') AS custname, o.username, o.orderstatus, o.totalbilledamount, 
               (SELECT COUNT(*) FROM ordertransdetail d WHERE d.orderid = o.orderid) AS itemcount
            FROM ordertrans o
            LEFT JOIN customermaster c ON o.customerid = c.mobile
            WHERE DATE(STR_TO_DATE(o.date, '%d-%m-%Y')) = CURDATE()
            ORDER BY STR_TO_DATE(o.date,'%d-%m-%Y') DESC, o.orderid DESC
            LIMIT 200
STEP 3: Execute OK
STEP 4: Rows count = 2
