postgresql – Retrieve all records if no record exist in the joining table

I have these three tables,

**PO_HEADER**
| po_number | vendor_name |
| -------- | -------------- |
| 10001| Xyz|
| 100002| ABC            |

**PO_LINEITEM**
| line_number| po_number|item_quantity | recieved_quantity
| -------- | -------------- |---------|---------
| 0001| 10001|20|10
| 0002| 10001|80|10
| 0002| 10002||40|35

**SHIPMENT_LINEITEM**
| line_number| po_number|shipping_quant
| -------- | -------------- |---------
| 0001| 10001|20|

How to retrieve order_master based on these two conditions

  1. if any po_lineitem having item_quantity > recieved quantity.
  2. if po_lineitem having item_quantity > (sum of previously shippingquantity from asn_lineitem for same line_number & poNumber) .2(b) if there no items in the asn_lineitem this should return true

I wrote this query but was not able to acheive 2(b)

select count(*) from erp_po_header 
where po_number in
(select erlitms.po_number from erp_po_line_items erlitms
JOIN
    (select sum(shipping_quantity) as total_prev_shipped_items,po_number,item_number from asn_lineitem
    Group by po_number,item_number) 
    asn_items 
ON erlitms.po_number = asn_items.po_number
and erlitms.item_number = asn_items.item_number
    and erlitms.item_quantity > CAST (erlitms.received_quantity AS INTEGER)
and erlitms.item_quantity > asn_items.total_prev_shipped_items )