CREATE OR ALTER VIEW [dbo].[Prc_V_PurchaseOrderLine] AS -- Sipariş Ürünleri listesinin kaynağı: satınalma siparişi başlığı × kalem, her kalem bir satır; kalemi olmayan -- sipariş gelmez. Vergi hariç ve KDV kalemin KDV dahil tutarından (Prc_P_PurchaseOrderRecalc) ayrıştırılır. SELECT l.Id, l.PurchaseOrderId, o.TenantId, o.IsDeleted, o.OrderNo, o.Status, o.SupplierId, o.BranchId, o.WarehouseId, o.OperationTypeId, o.CurrencyId, o.ConfirmDate, o.ExpectedArrival, o.ArrivalDate, o.BuyerUserId, o.SourceDocument, l.ProductId, l.Description, l.Quantity, l.UomId, l.UnitPrice, l.TaxRate, ROUND(l.Quantity * l.UnitPrice, 2) AS UntaxedAmount, l.Amount - ROUND(l.Quantity * l.UnitPrice, 2) AS TaxAmount, l.Amount, l.DeliveryDate, m.RequestNo FROM Prc_T_PurchaseOrderLine l INNER JOIN Prc_T_PurchaseOrder o ON o.Id = l.PurchaseOrderId AND o.IsDeleted = 0 LEFT JOIN Prc_T_MaterialRequestItem i ON i.Id = l.MaterialRequestItemId LEFT JOIN Prc_T_MaterialRequest m ON m.Id = i.MaterialRequestId WHERE l.IsDeleted = 0; GO