12 lines
846 B
Transact-SQL
12 lines
846 B
Transact-SQL
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,
|
||
i.PurchaseResponsibleUserId, i.LineStatus, r.BranchId
|
||
FROM Prc_T_MaterialRequest r
|
||
LEFT JOIN Prc_T_MaterialRequestItem i ON i.MaterialRequestId = r.Id AND i.IsDeleted = 0;
|
||
GO
|