sozsoft-platform/configs/seeds/postgres/object/Prc_V_MaterialRequestLine.sql

12 lines
864 B
MySQL
Raw Permalink Normal View History

2026-10-10 20:11:12 +00:00
CREATE OR REPLACE VIEW public."Prc_V_MaterialRequestLine"
AS
-- Tüm Talepler listesinin kaynağı: talep başlığı × kalem, her kalem bir satır. Kalemi olmayan talep de
-- listeden düşmesin diye LEFT JOIN; o satırın anahtarı talebin kendi Id'sidir.
SELECT COALESCE(i."Id", r."Id") AS "Id", r."Id" AS "MaterialRequestId", r."TenantId", r."IsDeleted",
r."RequestNo", r."Priority", r."RequesterUserId", r."DepartmentId", r."WarehouseId", r."LocationId", r."RequestDate",
r."Description", r."ApprovalStatus", r."ApprovalUserName", r."ApprovalDate", r."ApprovalDescription",
2026-10-14 09:07:11 +00:00
i."ProductId", i."Quantity", i."UomId", i."DueDate", i."RequestReason", i."DeliveredQuantity",
i."LineStatus", r."BranchId"
2026-10-10 20:11:12 +00:00
FROM "Prc_T_MaterialRequest" r
LEFT JOIN "Prc_T_MaterialRequestItem" i ON i."MaterialRequestId" = r."Id" AND i."IsDeleted" = FALSE;