(SELECT SUM(reservation_num) FROM logpm_distribution_reservation_stocklist WHERE reservation_id = ldr.id ) inventoryNub,
(SELECT SUM(reservation_num) FROM logpm_distribution_reservation_stocklist WHERE reservation_id = ldr.id ) inventoryNub,
IFNULL((SELECT SUM(loaded_nub) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_abnormal_loading != 2 AND is_deleted = 0 AND scan_status != 1),0) + IFNULL((SELECT SUM(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ),0) AS loadingNub,
IFNULL((SELECT SUM(loaded_nub) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1),0) + IFNULL((SELECT SUM(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ),0) AS loadingNub,
IFNULL((SELECT SUM(stock_quantity) FROM logpm_distribution_stock WHERE reservation_id = lds.reservation_id AND is_deleted = 0 ),0) AS stockupNum,
IFNULL((SELECT SUM(stock_quantity) FROM logpm_distribution_stock WHERE reservation_id = lds.reservation_id AND is_deleted = 0 ),0) AS stockupNum,