11 lines
934 B
SQL
11 lines
934 B
SQL
-- Alternatif Oluştur › Tedarikçiler: açık (teklif aşamasındaki) her teklif talebi, ihalesinde henüz iptal olmayan belgesi
|
||
-- bulunmayan aktif kontaklarla eşlenir. Id = teklif|kontak; seçilen satırlar için Prc_P_PurchaseRfqCreateAlternative belge açar.
|
||
CREATE OR REPLACE VIEW public."Prc_V_PurchaseRfqAlternativeSupplier" AS
|
||
SELECT r."Id"::text || '|' || c."Id"::text AS "Id", r."Id" AS "BaseId", c."TenantId",
|
||
c."Name", c."City", c."Phone", c."Email", c."SupplierCurrency"
|
||
FROM "Prc_T_PurchaseRfq" r
|
||
INNER JOIN "Adm_T_Contact" c ON c."TenantId" IS NOT DISTINCT FROM r."TenantId"
|
||
AND c."IsDeleted" = false AND c."IsActive" = true
|
||
WHERE r."IsDeleted" = false AND r."Status" IN ('Draft', 'Sent')
|
||
AND NOT EXISTS (SELECT 1 FROM "Prc_T_PurchaseRfq" x
|
||
WHERE x."TenderGroupId" = r."TenderGroupId" AND x."SupplierId" = c."Id" AND x."IsDeleted" = false AND x."Status" <> 'Cancelled');
|