Plasiyer koduna göre ön muhasebeden kümüle rapor almak
USE [SIRKET2018]
GO
/****** Object: View [dbo].[SMG_2_PLASIYER] Script Date: 03/27/2019 14:59:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE view [dbo].[SMG_2_PLASIYER]
AS
select
'Kasa' as KayitYapilanModul,
ks.plasiyer_kodu as Plasiyer_kodu,
ks.kayityapankul as KayityapanKullanici,
MF.TARIH,
MF.HES_KOD AS HesapKodu,
mp.HS_ADI AS hesapAdi,
mf.aciklama as Aciklama,
mf.ba as Borc_Alacak,
mf.tutar as Tutar,
mf.proje_kodu as ProjeKodu,
mf.ref_kod as ReferasnKodu
from tblmuhfis MF
LEFT OUTER JOIN TBLMUPLAN MP ON MP.HESAP_KODU=MF.HES_KOD
LEFT OUTER JOIN tblkasa ks ON ks.ENTEGREFKEY=MF.ENTEGREFKEY
where ks.plasiyer_kodu is not null
UNION ALL
SELECT
'CariHareket' as KayitYapilanModul,
ch.plasiyer_kodu as Plasiyer_kodu,
mf.kayityapankul as KayityapanKullanici,
MF.TARIH,
MF.HES_KOD AS HesapKodu,
mp.HS_ADI AS hesapAdi,
mf.aciklama as Aciklama,
mf.ba as Borc_Alacak,
mf.tutar as Tutar,
mf.proje_kodu as ProjeKodu,
mf.ref_kod as ReferasnKodu
from tblmuhfis MF
LEFT OUTER JOIN TBLMUPLAN MP ON MP.HESAP_KODU=MF.HES_KOD
LEFT OUTER JOIN tblcahar ch ON ch.ENT_REF_KEY=MF.ENTEGREFKEY
where ch.plasiyer_kodu is not null
UNION ALL
SELECT
'Dekont' as KayitYapilanModul,
dk.plasiyer as Plasiyer_kodu,
mf.kayityapankul as KayityapanKullanici,
MF.TARIH,
MF.HES_KOD AS HesapKodu,
mp.HS_ADI AS hesapAdi,
mf.aciklama as Aciklama,
mf.ba as Borc_Alacak,
mf.tutar as Tutar,
mf.proje_kodu as ProjeKodu,
mf.ref_kod as ReferasnKodu
from tblmuhfis MF
LEFT OUTER JOIN TBLMUPLAN MP ON MP.HESAP_KODU=MF.HES_KOD
LEFT OUTER JOIN tbldekotra dk ON dk.ENTEGREFKEY=MF.ENTEGREFKEY
where dk.plasiyer is not null
UNION ALL
select
'Kasa' as KayitYapilanModul,
ks.plasiyer_kodu as Plasiyer_kodu,
ks.kayityapankul as KayityapanKullanici,
MF.TARIH,
MF.HES_KOD AS HesapKodu,
mp.HS_ADI AS hesapAdi,
mf.aciklama as Aciklama,
mf.ba as Borc_Alacak,
mf.tutar as Tutar,
mf.proje_kodu as ProjeKodu,
mf.ref_kod as ReferasnKodu
from SIRKET2017..tblmuhfis MF
LEFT OUTER JOIN SIRKET2017..TBLMUPLAN MP ON MP.HESAP_KODU=MF.HES_KOD
LEFT OUTER JOIN SIRKET2017..tblkasa ks ON ks.ENTEGREFKEY=MF.ENTEGREFKEY
where ks.plasiyer_kodu is not null
UNION ALL
SELECT
'CariHareket' as KayitYapilanModul,
ch.plasiyer_kodu as Plasiyer_kodu,
mf.kayityapankul as KayityapanKullanici,
MF.TARIH,
MF.HES_KOD AS HesapKodu,
mp.HS_ADI AS hesapAdi,
mf.aciklama as Aciklama,
mf.ba as Borc_Alacak,
mf.tutar as Tutar,
mf.proje_kodu as ProjeKodu,
mf.ref_kod as ReferasnKodu
from SIRKET2017..tblmuhfis MF
LEFT OUTER JOIN SIRKET2017..TBLMUPLAN MP ON MP.HESAP_KODU=MF.HES_KOD
LEFT OUTER JOIN SIRKET2017..tblcahar ch ON ch.ENT_REF_KEY=MF.ENTEGREFKEY
where ch.plasiyer_kodu is not null
UNION ALL
SELECT
'Dekont' as KayitYapilanModul,
dk.plasiyer as Plasiyer_kodu,
mf.kayityapankul as KayityapanKullanici,
MF.TARIH,
MF.HES_KOD AS HesapKodu,
mp.HS_ADI AS hesapAdi,
mf.aciklama as Aciklama,
mf.ba as Borc_Alacak,
mf.tutar as Tutar,
mf.proje_kodu as ProjeKodu,
mf.ref_kod as ReferasnKodu
from SIRKET2017..tblmuhfis MF
LEFT OUTER JOIN SIRKET2017..TBLMUPLAN MP ON MP.HESAP_KODU=MF.HES_KOD
LEFT OUTER JOIN SIRKET2017..tbldekotra dk ON dk.ENTEGREFKEY=MF.ENTEGREFKEY
where dk.plasiyer is not null