CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_shipments AS
 SELECT sm."intLotId",
    sm."intProductId",
    sm."intFromLocationId",
    sm."intToLocationId",
    sm."intShipmentId",
    sm."strMovementType" AS "Movement Type",
    sm."intPurchaseLineId",
    sm."intSaleLineId",
    sm."dblQuantity" AS "Shipped Quantity",
    sm."strUnit" AS "Quantity Unit",
    COALESCE(p."dblUnitPrice", (0)::numeric) AS "Purchase Price",
    COALESCE(s."dblUnitPrice", (0)::numeric) AS "Sale Price",
    shipment."dtmBillOfLadingDate" AS "BL Date"
   FROM (((vw_utility_stock_movements sm
     JOIN vw_utility_shipment_in shipment ON ((sm."intShipmentId" = shipment."intShipmentId")))
     LEFT JOIN vw_utility_purchase_physical_contract p ON ((sm."intPurchaseLineId" = p."intPurchaseLineId")))
     LEFT JOIN vw_utility_sale_physical_contract s ON ((sm."intSaleLineId" = s."intSaleLineId")));;
