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

13 lines
846 B
MySQL
Raw Normal View History

2026-10-10 20:11:12 +00:00
CREATE OR ALTER VIEW [dbo].[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,
i.ProductId, i.Quantity, i.UomId, i.FulfillmentMethod, i.DueDate, i.RequestReason, i.DeliveredQuantity,
2026-10-12 10:27:54 +00:00
i.PurchaseResponsibleUserId, 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 = 0;
GO