( 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 inventoryNub) AS planNum,
(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 inventoryNub) AS planNum,
IFNULL((SELECT SUM(quantity) FROM logpm_distribution_delivery_details WHERE bill_lading_id = ldbl.id AND is_deleted = 0),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