sozsoft-platform/configs/seeds/postgres/object/Prc_V_PurchaseRfqAlternative.sql
2026-10-11 22:57:23 +03:00

15 lines
1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Aynı ihaledeki teklif talepleri. BaseId açık belgedir: teklif talebinde ihalenin diğer belgeleri,
-- satınalma siparişinde kaynak teklifin ihalesindeki bütün belgeler.
CREATE OR REPLACE VIEW public."Prc_V_PurchaseRfqAlternative" AS
SELECT b."Id" AS "BaseId", x."Id", x."TenantId", x."RfqNo", x."SupplierId", x."Status", x."SupplierResponse",
x."OrderDeadline", x."ExpectedArrival", x."UntaxedAmount", x."TotalAmount", x."CurrencyId", x."IsDeleted"
FROM "Prc_T_PurchaseRfq" b
INNER JOIN "Prc_T_PurchaseRfq" x ON x."TenderGroupId" = b."TenderGroupId" AND x."Id" <> b."Id"
WHERE b."IsDeleted" = false
UNION ALL
SELECT o."Id", x."Id", x."TenantId", x."RfqNo", x."SupplierId", x."Status", x."SupplierResponse",
x."OrderDeadline", x."ExpectedArrival", x."UntaxedAmount", x."TotalAmount", x."CurrencyId", x."IsDeleted"
FROM "Prc_T_PurchaseOrder" o
INNER JOIN "Prc_T_PurchaseRfq" s ON s."Id" = o."PurchaseRfqId"
INNER JOIN "Prc_T_PurchaseRfq" x ON x."TenderGroupId" = s."TenderGroupId"
WHERE o."IsDeleted" = false;