<?xml version="1.0" encoding="utf-8"?>
<Dashboard>
  <Title Text="Giza_Satış Raporu (Stok ve Cari  Dağılımlı)" />
  <DataSources>
    <SqlDataSource Name="CustomSqlQuery" ComponentName="sqlDataSource1">
      <Connection Name="RaporVeriKaynagi" FromAppConfig="true" />
      <Query Type="CustomSqlQuery" Name="CustomSqlQuery">
        <Sql>select 
--distinct 
top 100
convert(varchar,year(h.STHAR_TARIH))				Yil,
--'2023' Yil,
h.STHAR_ACIKLAMA				CariKodu,
dbo.trk(c.CARI_ISIM   )			CariIsim,
dbo.trk(c.CARI_IL   )			CariIl,
h.STOK_KODU						StokKodu,
dbo.trk(s.STOK_ADI    )			StokAdi,
dbo.trk(sg.GRUP_ISIM  )			StokGrup,
dbo.trk(sk1.GRUP_ISIM )			StokKod1,
dbo.trk(sk2.GRUP_ISIM )			StokKod2,
dbo.trk(sk3.GRUP_ISIM )			StokKod3,
dbo.trk(sk4.GRUP_ISIM )			StokKod4,
dbo.trk(sk5.GRUP_ISIM )			StokKod5,
dbo.trk(cg.GRUP_ISIM  )			CariGrup,
dbo.trk(ck1.GRUP_ISIM )			CariKod1,
dbo.trk(ck2.GRUP_ISIM )			CariKod2,
dbo.trk(ck3.GRUP_ISIM )			CariKod3,
dbo.trk(ck4.GRUP_ISIM )			CariKod4,
dbo.trk(ck5.GRUP_ISIM )			CariKod5,
dbo.trk(p.PLASIYER_ACIKLAMA)	PlasiyerAdi,
--case h.STHAR_GCKOD	when 'C' then 'Cıkış' else 'Giriş' end	GirisCikis,
h.STHAR_GCMIK					Miktar,
h.STHAR_NF						NetFiyat,
h.STHAR_BF						BrutFiyat,
h.STHAR_TARIH					Tarih,
h.FISNO							Fisno
from tblsthar h WITH (NOLOCK)
left join TBLSTSABIt s WITH (NOLOCK) on s.STOK_KODU =h.STOK_KODU
left join TBLCASABIT c WITH (NOLOCK) on c.CARI_KOD = h.STHAR_ACIKLAMA
left join TBLCARIPLASIYER p WITH (NOLOCK) on p.PLASIYER_KODU = c.PLASIYER_KODU
left join TBLSTGRUP sg WITH (NOLOCK) on sg.GRUP_KOD = s.GRUP_KODU
left join TBLSTOKKOD1 sk1 WITH (NOLOCK) on sk1.GRUP_KOD = s.KOD_1
left join TBLSTOKKOD2 sk2 WITH (NOLOCK) on sk2.GRUP_KOD = s.KOD_2
left join TBLSTOKKOD3 sk3 WITH (NOLOCK) on sk3.GRUP_KOD = s.KOD_3
left join TBLSTOKKOD4 sk4 WITH (NOLOCK) on sk4.GRUP_KOD = s.KOD_4
left join TBLSTOKKOD5 sk5 WITH (NOLOCK) on sk5.GRUP_KOD = s.KOD_5
left join TBLCAGRUP cg WITH (NOLOCK) on cg.GRUP_KOD = c.GRUP_KODU
left join TBLCARIKOD1 ck1 WITH (NOLOCK) on ck1.GRUP_KOD = c.RAPOR_KODU1
left join TBLCARIKOD2 ck2 WITH (NOLOCK) on ck2.GRUP_KOD = c.RAPOR_KODU2
left join TBLCARIKOD3 ck3 WITH (NOLOCK) on ck3.GRUP_KOD = c.RAPOR_KODU3
left join TBLCARIKOD4 ck4 WITH (NOLOCK) on ck4.GRUP_KOD = c.RAPOR_KODU4
left join TBLCARIKOD5 ck5 WITH (NOLOCK) on ck5.GRUP_KOD = c.RAPOR_KODU5
LEFT JOIN TBLFATUIRS F WITH (NOLOCK) ON H.FISNO = F.FATIRS_NO
WHERE 
H.STHAR_GCKOD = 'C' AND 
H.STHAR_FTIRSIP='1' AND F.TIPI ='2'
and day(h.STHAR_TARIH) = 15</Sql>
      </Query>
      <ConnectionOptions CloseConnection="true" />
      <CalculatedFields>
        <CalculatedField Name="Tutar" Expression="[Miktar] * [NetFiyat] " DataType="Auto" DataMember="CustomSqlQuery" />
      </CalculatedFields>
    </SqlDataSource>
  </DataSources>
  <Items>
    <Pivot ComponentName="pivotDashboardItem1" Name="Satış Raporu" DataSource="sqlDataSource1" DataMember="CustomSqlQuery">
      <DataItems>
        <Measure DataMember="Miktar" Name="Miktar" DefaultId="DataItem0">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="Tutar" Name="Tutar" DefaultId="DataItem1">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Dimension DataMember="Tarih" DateTimeGroupInterval="Month" DefaultId="DataItem2" />
        <Dimension DataMember="Tarih" DefaultId="DataItem3" />
        <Measure DataMember="Fisno" Name="Belge" SummaryType="CountDistinct" DefaultId="DataItem5">
          <NumericFormat FormatType="Number" Precision="0" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="CariKodu" Name="Nokta" SummaryType="CountDistinct" DefaultId="DataItem6">
          <NumericFormat FormatType="Number" Precision="0" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Dimension DataMember="CariIsim" DefaultId="DataItem4" />
        <Dimension DataMember="StokAdi" DefaultId="DataItem7" />
        <Dimension DataMember="StokGrup" DefaultId="DataItem8" />
        <Dimension DataMember="CariGrup" DefaultId="DataItem9" />
      </DataItems>
      <Columns>
        <Column DefaultId="DataItem2" />
        <Column DefaultId="DataItem3" />
      </Columns>
      <Rows>
        <Row DefaultId="DataItem9" />
        <Row DefaultId="DataItem4" />
        <Row DefaultId="DataItem8" />
        <Row DefaultId="DataItem7" />
      </Rows>
      <Values>
        <Value DefaultId="DataItem6" />
        <Value DefaultId="DataItem5" />
        <Value DefaultId="DataItem0" />
        <Value DefaultId="DataItem1" />
      </Values>
    </Pivot>
    <ComboBox ComponentName="comboBoxDashboardItem1" Name="Cari Grup Kodu" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariGrup" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem2" Name="Cari Kod1" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariKod1" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem3" Name="Cari Kod2" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariKod2" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem4" Name="Cari Kod3" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariKod3" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem9" Name="Cari Kod4" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariKod4" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem10" Name="Cari Kod5" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariKod5" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem13" Name="Plasiyer" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="PlasiyerAdi" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem5" Name="Stok Grup Kodu" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="StokGrup" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem6" Name="Stok Kod1" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="StokKod1" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem7" Name="Stok Kod2" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="StokKod2" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem8" Name="Stok Kod3" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="StokKod3" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem11" Name="Stok Kod4" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="StokKod4" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem12" Name="Stok Kod5" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="StokKod5" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem14" Name="Yıl" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="Yil" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem15" Name="Ay/Yıl" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="Tarih" DateTimeGroupInterval="Month" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
    <ComboBox ComponentName="comboBoxDashboardItem16" Name="Cari İl" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true" ComboBoxType="Checked">
      <DataItems>
        <Dimension DataMember="CariIl" Name="Cari İl" DefaultId="DataItem0" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
      </FilterDimensions>
    </ComboBox>
  </Items>
  <LayoutTree>
    <LayoutGroup>
      <LayoutGroup Orientation="Vertical">
        <LayoutGroup>
          <LayoutItem DashboardItem="comboBoxDashboardItem14" />
          <LayoutItem DashboardItem="comboBoxDashboardItem15" />
          <LayoutItem DashboardItem="comboBoxDashboardItem16" />
          <LayoutItem DashboardItem="comboBoxDashboardItem13" />
        </LayoutGroup>
        <LayoutGroup>
          <LayoutItem DashboardItem="comboBoxDashboardItem1" />
          <LayoutItem DashboardItem="comboBoxDashboardItem2" />
          <LayoutItem DashboardItem="comboBoxDashboardItem3" />
          <LayoutItem DashboardItem="comboBoxDashboardItem4" />
          <LayoutItem DashboardItem="comboBoxDashboardItem9" />
          <LayoutItem DashboardItem="comboBoxDashboardItem10" />
        </LayoutGroup>
        <LayoutGroup>
          <LayoutItem DashboardItem="comboBoxDashboardItem5" />
          <LayoutItem DashboardItem="comboBoxDashboardItem6" />
          <LayoutItem DashboardItem="comboBoxDashboardItem7" />
          <LayoutItem DashboardItem="comboBoxDashboardItem8" />
          <LayoutItem DashboardItem="comboBoxDashboardItem11" />
          <LayoutItem DashboardItem="comboBoxDashboardItem12" />
        </LayoutGroup>
        <LayoutItem DashboardItem="pivotDashboardItem1" />
      </LayoutGroup>
    </LayoutGroup>
  </LayoutTree>
</Dashboard>