<?xml version="1.0" encoding="utf-8"?>
<Dashboard>
  <Title Text="Giza_Genel Borç Alacak Raporu" />
  <DataSources>
    <SqlDataSource Name="CustomSqlQuery" ComponentName="sqlDataSource1">
      <Connection Name="RaporVeriKaynagi" FromAppConfig="true" />
      <Query Type="CustomSqlQuery" Name="CustomSqlQuery">
        <Sql>SELECT h.CARI_KOD AS 'CariKodu',
       dbo.TRK(s.CARI_ISIM) AS 'Müşteri Adı',
       CAST(SUM(BORC) AS MONEY) AS 'Borç',
       CAST(SUM(ALACAK) AS MONEY) AS 'Alacak',
       CASE
           WHEN SUM(BORC) - SUM(ALACAK) &gt; 0 THEN
               CAST((SUM(BORC) - SUM(ALACAK)) AS MONEY)
           ELSE
               CAST(0 AS MONEY)
       END AS 'Borç Bakiyesi',
       CASE
           WHEN SUM(ALACAK) - SUM(BORC) &gt; 0 THEN
               CAST((SUM(ALACAK) - SUM(BORC)) AS MONEY)
           ELSE
               CAST(0 AS MONEY)
       END AS 'Alacak Bakiyesi'
FROM TBLCAHAR h
    JOIN TBLCASABIT s
        ON s.CARI_KOD = h.CARI_KOD
GROUP BY h.CARI_KOD,
         s.CARI_ISIM;</Sql>
      </Query>
      <Query Type="CustomSqlQuery" Name="CustomSqlQuery_1">
        <Sql>SELECT 
  CARI_KOD AS 'CariKodu'
 ,TARIH AS Tarih
 ,RIGHT(BELGE_NO, 10) AS FisNo
 ,dbo.TRK(ACIKLAMA) AS Aciklama
 ,VADE_TARIHI AS VadeTarihi
 ,BORC AS BorcTutari
 ,ALACAK AS AlacakTutari
 ,CASE
    WHEN (BORC &gt; 0) THEN BORC
      
    ELSE 0
  END AS BorcBakiye
 ,CASE
    WHEN (ALACAK &gt; 0) THEN ALACAK
    ELSE 0
  END AS AlacakBakiye
  --,SUM(ISNULL(BORC, 0) - ISNULL(ALACAK, 0)) AS BAKIYE
FROM dbo.TBLCAHAR WITH (NOLOCK)
--WHERE CARI_KOD = '120-42-0370'
ORDER BY Tarih</Sql>
      </Query>
      <Query Type="CustomSqlQuery" Name="CustomSqlQuery_2">
        <Sql>SELECT b.CARI_KOD AS CariKodu,
       CASE
           WHEN (b.ToplamBorc - b.ToplamAlacak) &gt; 0 THEN
               'BORCLU'
           WHEN (b.ToplamAlacak - b.ToplamBorc) &gt; 0 THEN
               'ALACAKLI'
           ELSE
               'BORC/ALACAK YOK'
       END AS Durumu,
       CASE
           WHEN (b.ToplamBorc - b.ToplamAlacak) &gt; 0 THEN
               b.ToplamBorc - b.ToplamAlacak
           WHEN (b.ToplamAlacak - b.ToplamBorc) &gt; 0 THEN
               b.ToplamAlacak - b.ToplamBorc
           ELSE
               0
       END AS Tutar
FROM
(
    SELECT CARI_KOD,
           SUM(BORC) AS ToplamBorc,
           SUM(ALACAK) AS ToplamAlacak
    FROM dbo.TBLCAHAR
    --WHERE CARI_KOD = '120-42-0370'
    GROUP BY CARI_KOD
) b;</Sql>
      </Query>
      <ConnectionOptions CloseConnection="true" />
    </SqlDataSource>
  </DataSources>
  <Items>
    <Grid ComponentName="gridDashboardItem1" Name="Genel Borç Alacak" ParentContainer="dashboardTabPage2" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" IsMasterFilterCrossDataSource="true">
      <InteractivityOptions MasterFilterMode="Single" />
      <DataItems>
        <Dimension DataMember="CariKodu" DefaultId="DataItem0" />
        <Dimension DataMember="Müşteri Adı" DefaultId="DataItem1" />
        <Measure DataMember="Borç" DefaultId="DataItem2">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="Alacak" DefaultId="DataItem3">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="Borç Bakiyesi" DefaultId="DataItem4">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="Alacak Bakiyesi" DefaultId="DataItem5">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
      </DataItems>
      <FormatRules>
        <GridItemFormatRule Name="Biçim kural 1" ApplyToRow="true" DataItem="DataItem4" DataItemApplyTo="DataItem4">
          <FormatConditionValue Condition="Greater">
            <AppearanceSettings AppearanceType="PaleRed" />
            <Value1 Type="System.Decimal" Value="1" />
          </FormatConditionValue>
        </GridItemFormatRule>
        <GridItemFormatRule Name="Biçim kural 2" ApplyToRow="true" DataItem="DataItem5" DataItemApplyTo="DataItem5">
          <FormatConditionValue Condition="Greater">
            <AppearanceSettings AppearanceType="PaleGreen" />
            <Value1 Type="System.Decimal" Value="1" />
          </FormatConditionValue>
        </GridItemFormatRule>
      </FormatRules>
      <GridColumns>
        <GridDimensionColumn>
          <Dimension DefaultId="DataItem0" />
        </GridDimensionColumn>
        <GridDimensionColumn>
          <Dimension DefaultId="DataItem1" />
        </GridDimensionColumn>
        <GridMeasureColumn Name="Borç">
          <Measure DefaultId="DataItem2" />
          <Totals>
            <Total Type="Auto" />
          </Totals>
        </GridMeasureColumn>
        <GridMeasureColumn Name="Alacak">
          <Measure DefaultId="DataItem3" />
          <Totals>
            <Total Type="Auto" />
          </Totals>
        </GridMeasureColumn>
        <GridMeasureColumn Name="Borç Bakiyesi">
          <Measure DefaultId="DataItem4" />
          <Totals>
            <Total Type="Auto" />
          </Totals>
        </GridMeasureColumn>
        <GridMeasureColumn Name="Alacak Bakiyesi">
          <Measure DefaultId="DataItem5" />
          <Totals>
            <Total Type="Auto" />
          </Totals>
        </GridMeasureColumn>
      </GridColumns>
      <GridOptions />
    </Grid>
    <Grid ComponentName="gridDashboardItem2" Name="Detay" ParentContainer="dashboardTabPage1" DataSource="sqlDataSource1" DataMember="CustomSqlQuery_1" IsMasterFilterCrossDataSource="true">
      <DataItems>
        <Dimension DataMember="CariKodu" DefaultId="DataItem0" />
        <Dimension DataMember="Tarih" DateTimeGroupInterval="DayMonthYear" DefaultId="DataItem1" />
        <Dimension DataMember="VadeTarihi" DateTimeGroupInterval="DayMonthYear" DefaultId="DataItem2" />
        <Dimension DataMember="Aciklama" DefaultId="DataItem3" />
        <Dimension DataMember="FisNo" DefaultId="DataItem4" />
        <Measure DataMember="BorcTutari" DefaultId="DataItem5">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="AlacakTutari" DefaultId="DataItem6">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="BorcBakiye" DefaultId="DataItem7">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Measure DataMember="AlacakBakiye" DefaultId="DataItem8">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Dimension DataMember="CariKodu" DefaultId="DataItem9" />
      </DataItems>
      <HiddenDimensions>
        <Dimension DefaultId="DataItem9" />
      </HiddenDimensions>
      <GridColumns>
        <GridDimensionColumn Name="Musteri Kodu" Weight="58.542931483087614">
          <Dimension DefaultId="DataItem0" />
        </GridDimensionColumn>
        <GridDimensionColumn Name="Tarih" Weight="50.346921075455342">
          <Dimension DefaultId="DataItem1" />
        </GridDimensionColumn>
        <GridDimensionColumn Weight="44.492627927146579">
          <Dimension DefaultId="DataItem4" />
        </GridDimensionColumn>
        <GridDimensionColumn Weight="105.96270598438856">
          <Dimension DefaultId="DataItem3" />
        </GridDimensionColumn>
        <GridDimensionColumn Name="Vade Tarihi" Weight="59.128360797918489">
          <Dimension DefaultId="DataItem2" />
        </GridDimensionColumn>
        <GridMeasureColumn Name="Borç" Weight="84.301821335646153">
          <Measure DefaultId="DataItem5" />
        </GridMeasureColumn>
        <GridMeasureColumn Name="Alacak" Weight="91.32697311361666">
          <Measure DefaultId="DataItem6" />
        </GridMeasureColumn>
        <GridMeasureColumn Name="Borç Bakiye" Weight="87.228967909800531">
          <Measure DefaultId="DataItem7" />
        </GridMeasureColumn>
        <GridMeasureColumn Name="Alacak Bakiye" Weight="93.668690372940162">
          <Measure DefaultId="DataItem8" />
        </GridMeasureColumn>
      </GridColumns>
      <GridOptions ColumnWidthMode="Manual" />
    </Grid>
    <Card ComponentName="cardDashboardItem1" Name="Durumu" ParentContainer="dashboardTabPage1" DataSource="sqlDataSource1" DataMember="CustomSqlQuery_2">
      <DataItems>
        <Measure DataMember="Tutar" DefaultId="DataItem0">
          <NumericFormat FormatType="Number" Unit="Ones" IncludeGroupSeparator="true" />
        </Measure>
        <Dimension DataMember="Durumu" DefaultId="DataItem1" />
      </DataItems>
      <SeriesDimensions>
        <SeriesDimension DefaultId="DataItem1" />
      </SeriesDimensions>
      <Card>
        <ActualValue DefaultId="DataItem0" />
        <AbsoluteVariationNumericFormat />
        <PercentVariationNumericFormat />
        <PercentOfTargetNumericFormat />
        <LayoutTemplate MinWidth="125" MaxWidth="270" Type="Compact">
          <MainValue Visible="true" ValueType="Title" DimensionIndex="0" />
          <SubValue Visible="true" ValueType="Subtitle" DimensionIndex="0" />
          <BottomValue Visible="true" ValueType="ActualValue" DimensionIndex="0" />
          <BottomSubValue1 Visible="true" ValueType="AbsoluteVariation" DimensionIndex="0" />
          <BottomSubValue2 Visible="true" ValueType="PercentVariation" DimensionIndex="0" />
          <DeltaIndicator Visible="true" />
          <Sparkline Visible="true" />
        </LayoutTemplate>
      </Card>
    </Card>
    <ComboBox ComponentName="comboBoxDashboardItem1" Name="Müşteri" DataSource="sqlDataSource1" DataMember="CustomSqlQuery" EnableSearch="true">
      <DataItems>
        <Dimension DataMember="CariKodu" DefaultId="DataItem0" />
        <Dimension DataMember="Müşteri Adı" DefaultId="DataItem1" />
      </DataItems>
      <FilterDimensions>
        <Dimension DefaultId="DataItem0" />
        <Dimension DefaultId="DataItem1" />
      </FilterDimensions>
    </ComboBox>
    <TabContainer ComponentName="tabContainerDashboardItem1" Name="Sekmesi konteyner 1">
      <Pages>
        <Page ComponentName="dashboardTabPage1" Name="Detay" />
        <Page ComponentName="dashboardTabPage2" Name="Sayfa 2" />
      </Pages>
    </TabContainer>
  </Items>
  <LayoutTree>
    <LayoutGroup>
      <LayoutGroup Orientation="Vertical">
        <LayoutItem DashboardItem="comboBoxDashboardItem1" Weight="0.88973384030418257" />
        <LayoutTabContainer DashboardItem="tabContainerDashboardItem1" Weight="1.1102661596958174">
          <LayoutTabPage DashboardItem="dashboardTabPage2">
            <LayoutItem DashboardItem="gridDashboardItem1" Weight="2.136111590998786" />
          </LayoutTabPage>
          <LayoutTabPage DashboardItem="dashboardTabPage1">
            <LayoutItem DashboardItem="gridDashboardItem2" Weight="1.2421568056021015" />
            <LayoutItem DashboardItem="cardDashboardItem1" Weight="0.25865843764220586" />
          </LayoutTabPage>
        </LayoutTabContainer>
      </LayoutGroup>
    </LayoutGroup>
  </LayoutTree>
</Dashboard>