IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = ldr.id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = ldr.id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingNub,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = ldr.id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = ldr.id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingNub,
(ldr.reservation_num + ldr.reservation_stock_list_num) AS planNum
(ldr.reservation_num + ldr.reservation_stock_list_num) AS planNum,
IFNULL((SELECT COUNT(1) FROM logpm_distribution_reservation_stockarticle WHERE reservation_id = ldr.id AND is_deleted = 0 AND stock_article_status != 2),0 ) AS orderNum