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"
   FROM ((vw_utility_stock_movements sm
     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")));;
