( SELECT count( 1 ) FROM logpm_distrilbution_bill_stock WHERE bill_lading_id = ldbl.id AND order_status != 2 AND is_deleted = 0) AS orderNum ,
(IFNULL((SELECT SUM(quantity) FROM logpm_distribution_reservation_zero_package WHERE reservation_id = ldbl.id AND is_deleted = 0),0)) + (IFNULL((SELECT sum(packet_number) FROM logpm_distrilbution_bill_package WHERE bill_lading_id = ldbl.id AND is_deleted = 0),0))+(IFNULL((SELECT SUM(quantity) FROM logpm_distribution_delivery_details WHERE bill_lading_id = ldbl.id AND is_deleted = 0),0)) AS planNum,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_delivery_details WHERE bill_lading_id = ldbl.id AND is_deleted = 0),0) AS inventoryNub,
( SELECT count( 1 ) FROM logpm_distrilbution_bill_stock WHERE bill_lading_id = ldbl.id AND order_status != 2 AND is_deleted = 0 AND order_status != 2 ) AS orderNum ,
(IFNULL((SELECT SUM(quantity) FROM logpm_distribution_reservation_zero_package WHERE reservation_id = ldbl.id AND zero_package_status != 2 AND is_deleted = 0),0)) +
(IFNULL((SELECT sum(packet_number) FROM logpm_distrilbution_bill_package WHERE bill_lading_id = ldbl.id AND packet_bar_status != 2 AND is_deleted = 0),0))+
(IFNULL((SELECT SUM(quantity) FROM logpm_distribution_delivery_details WHERE bill_lading_id = ldbl.id AND inventory_status != 2 AND is_deleted = 0),0)) AS planNum,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_delivery_details WHERE bill_lading_id = ldbl.id AND is_deleted = 0 AND inventory_status != 2),0) AS inventoryNub,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_bill_lading_scan WHERE bill_lading_id = ldbl.id AND is_deleted = 0) ,0) AS signedNum