Flexible Report Chart hinzugefügt
serverseitges Filtern der NullDaten Soll Betrag aus dem Flexible Report entfernt
This commit is contained in:
@@ -8,50 +8,78 @@
|
||||
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
|
||||
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
|
||||
xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid" x:Class="BeWo.View.Detail.Report.FlexibleReportView"
|
||||
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
|
||||
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
|
||||
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
|
||||
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" Focusable="True">
|
||||
<Grid>
|
||||
<GroupBox Header="Flexibler Bericht" Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Startdatum:" Grid.Column="0" VerticalAlignment="Center" />
|
||||
<dxe:DateEdit MaskType="DateTimeAdvancingCaret" Grid.Column="1" x:Name="datePickerStartDate" Width="120" HorizontalAlignment="Left" Margin="3,0,0,0" />
|
||||
<Label Content="Enddatum:" Grid.Column="2" VerticalAlignment="Center" />
|
||||
<dxe:DateEdit MaskType="DateTimeAdvancingCaret" Grid.Column="3" x:Name="datePickerEndDate" HorizontalAlignment="Left" Width="120" Margin="3,0,0,0" />
|
||||
<Button Content="Aktualisieren" Grid.Column="4" Margin="5,0,0,0" x:Name="buttonRefresh" Click="buttonRefresh_Click" />
|
||||
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="6" >
|
||||
<dxpg:PivotGridControl x:Name="GridControl" RowTreeWidth="225" Visibility="Hidden" DataProcessingEngine="LegacyOptimized" Margin="0,10,0,0" dx:ThemeManager.ThemeName="Office2010Black" CustomCellDisplayText="GridControl_CustomCellDisplayText" CustomFieldValueCells="GridControl_CustomFieldValueCells">
|
||||
<dxpg:PivotGridControl.Fields>
|
||||
<dxpg:PivotGridField x:Name="FlexibleTeam" FieldName="Team" Area="FilterArea" Width="200" Caption="Team" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleKlient" FieldName="Customer" Area="RowArea" Width="200" Caption="Klient" AllowedAreas="RowArea,FilterArea,ColumnArea" AreaIndex="2" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleMitarbeiter" FieldName="Employee" Area="RowArea" Width="200" Caption="Mitarbeiter" AllowedAreas="RowArea,FilterArea,ColumnArea" AreaIndex="1" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleSupportConcept" FieldName="SupportConcept" Area="FilterArea" Width="200" Caption="Hilfeplan" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleLeistungskategorie" FieldName="Leistungskategorie" Area="FilterArea" Width="200" Caption="Leistungskategorie" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleLeistung" FieldName="Leistung" Area="FilterArea" Width="200" Caption="Leistung" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleGefahreneKilometer" FieldName="Kilometer" Area="FilterArea" Width="200" Caption="Gefahrene Kilometer" AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlMinIst" FieldName="AnzahlMinutenIst" Area="FilterArea" Width="60" Caption="Ist Min." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlStdIst" FieldName="AnzahlStundenIst" Area="DataArea" Width="80" Caption="Ist Std." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlMinSoll" FieldName="AnzahlMinutenSoll" Area="FilterArea" Width="60" Caption="Soll Min." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlStdSoll" FieldName="AnzahlStundenSoll" Area="DataArea" Width="80" Caption="Soll Std." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleJahr" FieldName="Datum" Area="ColumnArea" Width="100" Caption="Jahr" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateYear" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleMonat" FieldName="Datum" Area="ColumnArea" Width="80" Caption="Monat" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateMonth" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleWeek" FieldName="Datum" Area="ColumnArea" Width="80" Caption="Woche" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateWeekOfYear" ValueFormat="KW {0}" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleTag" FieldName="Datum" Area="FilterArea" Width="40" Caption="Tag" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateDay" />
|
||||
</dxpg:PivotGridControl.Fields>
|
||||
</dxpg:PivotGridControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<GroupBox Header="Flexibler Bericht" Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Content="Startdatum:" Grid.Column="0" VerticalAlignment="Center" />
|
||||
<dxe:DateEdit MaskType="DateTimeAdvancingCaret" Grid.Column="1" x:Name="datePickerStartDate" Width="120" HorizontalAlignment="Left" Margin="3,0,0,0" />
|
||||
<Label Content="Enddatum:" Grid.Column="2" VerticalAlignment="Center" />
|
||||
<dxe:DateEdit MaskType="DateTimeAdvancingCaret" Grid.Column="3" x:Name="datePickerEndDate" HorizontalAlignment="Left" Width="120" Margin="3,0,0,0" />
|
||||
<CheckBox Content="Ausführliche Ansicht" Margin="5,5,0,0" Grid.Column="4" x:Name="checkNullEntries"/>
|
||||
<Button Content="Aktualisieren" Grid.Column="5" Margin="5,0,0,0" x:Name="buttonRefresh" Click="buttonRefresh_Click" />
|
||||
<CheckBox Content="Graph einblenden" Grid.Column="7" Margin="0,5,5,0" x:Name="checkBoxChart" Checked="CheckChartChanged" Unchecked="CheckChartChanged"/>
|
||||
<dxlc:LayoutControl x:Name="mainLayout" AllowItemSizing="True" Padding="12" Orientation="Vertical" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="9">
|
||||
<dxlc:LayoutGroup dxlc:LayoutControl.AllowVerticalSizing="True" Margin="0,0,0,4">
|
||||
<dxpg:PivotGridControl x:Name="myPivotGridControl" RowTreeWidth="225" Visibility="Hidden" DataProcessingEngine="LegacyOptimized" Margin="0,10,0,0" dx:ThemeManager.ThemeName="Office2010Black" CustomCellDisplayText="GridControl_CustomCellDisplayText" CustomFieldValueCells="GridControl_CustomFieldValueCells"
|
||||
ChartProvideDataByColumns="False" ChartSelectionOnly="True" ChartProvideColumnGrandTotals="True" ChartProvideRowGrandTotals="True" ChartDataProvideMode="UseCustomSettings">
|
||||
<dxpg:PivotGridControl.Fields>
|
||||
<dxpg:PivotGridField x:Name="FlexibleTeam" FieldName="Team" Area="FilterArea" Width="200" Caption="Team" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleKlient" FieldName="Customer" Area="RowArea" Width="200" Caption="Klient" AllowedAreas="RowArea,FilterArea,ColumnArea" AreaIndex="2" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleMitarbeiter" FieldName="Employee" Area="RowArea" Width="200" Caption="Mitarbeiter" AllowedAreas="RowArea,FilterArea,ColumnArea" AreaIndex="1" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleSupportConcept" FieldName="SupportConcept" Area="FilterArea" Width="200" Caption="Hilfeplan" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleLeistungskategorie" FieldName="Leistungskategorie" Area="FilterArea" Width="200" Caption="Leistungskategorie" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleLeistung" FieldName="Leistung" Area="FilterArea" Width="200" Caption="Leistung" AllowedAreas="RowArea,FilterArea,ColumnArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleGefahreneKilometer" FieldName="Kilometer" Area="FilterArea" Width="200" Caption="Gefahrene Kilometer" AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlMinIst" FieldName="AnzahlMinutenIst" Area="FilterArea" Width="60" Caption="Ist Min." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlStdIst" FieldName="AnzahlStundenIst" Area="DataArea" Width="80" Caption="Ist Std." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlMinSoll" FieldName="AnzahlMinutenSoll" Area="FilterArea" Width="60" Caption="Soll Min." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleAnzahlStdSoll" FieldName="AnzahlStundenSoll" Area="DataArea" Width="80" Caption="Soll Std." AllowedAreas="DataArea,FilterArea" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleJahr" FieldName="Datum" Area="ColumnArea" Width="100" Caption="Jahr" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateYear" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleMonat" FieldName="Datum" Area="ColumnArea" Width="80" Caption="Monat" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateMonth" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleWeek" FieldName="Datum" Area="ColumnArea" Width="80" Caption="Woche" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateWeekOfYear" ValueFormat="KW {0}" />
|
||||
<dxpg:PivotGridField x:Name="FlexibleTag" FieldName="Datum" Area="FilterArea" Width="40" Caption="Tag" AllowedAreas="RowArea,FilterArea,ColumnArea" GroupInterval="DateDay" />
|
||||
</dxpg:PivotGridControl.Fields>
|
||||
</dxpg:PivotGridControl>
|
||||
</dxlc:LayoutGroup>
|
||||
<dxlc:LayoutGroup>
|
||||
<dxc:ChartControl Name="ChartControl" DataSource="{Binding ElementName=myPivotGridControl, Path=ChartDataSource}" Visibility="Collapsed" dx:ThemeManager.ThemeName="Office2010Black" >
|
||||
<dxc:ChartControl.CrosshairOptions>
|
||||
<dxc:CrosshairOptions ShowArgumentLine="False"/>
|
||||
</dxc:ChartControl.CrosshairOptions>
|
||||
<dxc:ChartControl.Legend>
|
||||
<dxc:Legend ReverseItems="True"/>
|
||||
</dxc:ChartControl.Legend>
|
||||
<dxc:XYDiagram2D>
|
||||
<dxc:XYDiagram2D.AxisY>
|
||||
<dxc:AxisY2D Visible="True"/>
|
||||
</dxc:XYDiagram2D.AxisY>
|
||||
<dxc:XYDiagram2D.AxisX>
|
||||
<dxc:AxisX2D Visible="True"/>
|
||||
</dxc:XYDiagram2D.AxisX>
|
||||
</dxc:XYDiagram2D>
|
||||
</dxc:ChartControl>
|
||||
</dxlc:LayoutGroup>
|
||||
</dxlc:LayoutControl>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</localView:BeWoView>
|
||||
@@ -22,201 +22,333 @@ using BS.Shared.Translation;
|
||||
using DevExpress.Xpf.Core;
|
||||
using DevExpress.Xpf.Printing;
|
||||
using DevExpress.Xpf.PivotGrid;
|
||||
using DevExpress.Xpf.Charts;
|
||||
|
||||
namespace BeWo.View.Detail.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FlexibleReportView.xaml
|
||||
/// </summary>
|
||||
public partial class FlexibleReportView : BeWoView
|
||||
{
|
||||
public FlexibleReportView()
|
||||
{
|
||||
InitializeComponent();
|
||||
/// <summary>
|
||||
/// Interaction logic for FlexibleReportView.xaml
|
||||
/// </summary>
|
||||
public partial class FlexibleReportView : BeWoView
|
||||
{
|
||||
public FlexibleReportView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
FlexibleAnzahlMinIst.CellFormat = "{0:N0}";
|
||||
FlexibleAnzahlStdIst.CellFormat = "{0:N2}";
|
||||
FlexibleAnzahlMinIst.CellFormat = "{0:N0}";
|
||||
FlexibleAnzahlStdIst.CellFormat = "{0:N2}";
|
||||
|
||||
FlexibleAnzahlMinSoll.CellFormat = "{0:N0}";
|
||||
FlexibleAnzahlStdSoll.CellFormat = "{0:N2}";
|
||||
FlexibleAnzahlMinSoll.CellFormat = "{0:N0}";
|
||||
FlexibleAnzahlStdSoll.CellFormat = "{0:N2}";
|
||||
|
||||
FlexibleKlient.TotalValueFormat = "{0}";
|
||||
FlexibleMitarbeiter.TotalValueFormat = "{0}";
|
||||
FlexibleLeistung.TotalValueFormat = "{0}";
|
||||
FlexibleLeistungskategorie.TotalValueFormat = "{0}";
|
||||
FlexibleKlient.TotalValueFormat = "{0}";
|
||||
FlexibleMitarbeiter.TotalValueFormat = "{0}";
|
||||
FlexibleLeistung.TotalValueFormat = "{0}";
|
||||
FlexibleLeistungskategorie.TotalValueFormat = "{0}";
|
||||
|
||||
datePickerStartDate.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
||||
datePickerEndDate.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);
|
||||
|
||||
datePickerStartDate.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
||||
datePickerEndDate.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);
|
||||
}
|
||||
checkBoxChart.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (GridControl.Visibility == Visibility.Hidden)
|
||||
GridControl.Visibility = Visibility.Visible;
|
||||
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var test = ChartControl.DataSource;
|
||||
|
||||
var filter = new FlexibleReportFilterDC()
|
||||
{
|
||||
StartDatum = datePickerStartDate.DateTime,
|
||||
EndDatum = datePickerEndDate.DateTime
|
||||
};
|
||||
if (myPivotGridControl.Visibility == Visibility.Hidden)
|
||||
myPivotGridControl.Visibility = Visibility.Visible;
|
||||
|
||||
ServiceFacade.DoOperationsServiceAsync(
|
||||
s => s.GetAllFlexibleReportEntrys(filter),
|
||||
r =>
|
||||
{
|
||||
this.Dispatch(delegate
|
||||
{
|
||||
var liste = new List<FlexibleReportEntry>();
|
||||
foreach (var item in r)
|
||||
{
|
||||
liste.Add(FlexibleReportEntry.InitByFlexibleReportEntryDC(item));
|
||||
}
|
||||
GridControl.DataSource = liste;
|
||||
});
|
||||
});
|
||||
}
|
||||
var filter = new FlexibleReportFilterDC()
|
||||
{
|
||||
StartDatum = datePickerStartDate.DateTime,
|
||||
EndDatum = datePickerEndDate.DateTime,
|
||||
NullDaten = checkNullEntries.IsChecked.Value
|
||||
};
|
||||
|
||||
private void GridControl_CustomCellDisplayText(object sender, PivotCellDisplayTextEventArgs e)
|
||||
{
|
||||
if (e.DataField.Name == "FlexibleAnzahlStdSoll")
|
||||
{
|
||||
if (e.RowField != null && (e.RowField.Name == "FlexibleLeistungskategorie" || e.RowField.Name == "FlexibleLeistung"))
|
||||
{
|
||||
e.DisplayText = "";
|
||||
}
|
||||
}
|
||||
if (e.Value != null && decimal.TryParse(e.Value.ToString(), out decimal d) && d == 0)
|
||||
e.DisplayText = "";
|
||||
}
|
||||
ServiceFacade.DoOperationsServiceAsync(
|
||||
s => s.GetAllFlexibleReportEntrys(filter),
|
||||
r =>
|
||||
{
|
||||
this.Dispatch(delegate
|
||||
{
|
||||
var liste = new List<FlexibleReportEntry>();
|
||||
foreach (var item in r)
|
||||
{
|
||||
liste.Add(FlexibleReportEntry.InitByFlexibleReportEntryDC(item));
|
||||
}
|
||||
myPivotGridControl.DataSource = liste;
|
||||
checkBoxChart.IsEnabled = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void GridControl_CustomFieldValueCells(object sender, PivotCustomFieldValueCellsEventArgs e)
|
||||
{
|
||||
PivotGridControl pivot = (PivotGridControl)sender;
|
||||
private void InitChart()
|
||||
{
|
||||
ChartControl.Diagram = ChartFactory.GenerateDiagram(typeof(BarStackedSeries2D), false);
|
||||
}
|
||||
|
||||
if (pivot.DataSource == null)
|
||||
return;
|
||||
private void GridControl_CustomCellDisplayText(object sender, PivotCellDisplayTextEventArgs e)
|
||||
{
|
||||
if (e.DataField.Name == "FlexibleAnzahlStdSoll")
|
||||
{
|
||||
if (e.RowField != null && (e.RowField.Name == "FlexibleLeistungskategorie" || e.RowField.Name == "FlexibleLeistung"))
|
||||
{
|
||||
e.DisplayText = "";
|
||||
}
|
||||
}
|
||||
if (e.Value != null && decimal.TryParse(e.Value.ToString(), out decimal d) && d == 0)
|
||||
e.DisplayText = "";
|
||||
}
|
||||
|
||||
// Iterates through all row headers.
|
||||
for (int i = e.GetCellCount(false) - 1; i >= 0; i--)
|
||||
{
|
||||
var cell = e.GetCell(false, i);
|
||||
if (cell == null)
|
||||
continue;
|
||||
private void GridControl_CustomFieldValueCells(object sender, PivotCustomFieldValueCellsEventArgs e)
|
||||
{
|
||||
PivotGridControl pivot = (PivotGridControl)sender;
|
||||
|
||||
if (cell.ValueType == FieldValueType.Total)
|
||||
{
|
||||
if (pivot.DataSource == null)
|
||||
return;
|
||||
|
||||
}
|
||||
// Iterates through all row headers.
|
||||
for (int i = e.GetCellCount(false) - 1; i >= 0; i--)
|
||||
{
|
||||
var cell = e.GetCell(false, i);
|
||||
if (cell == null)
|
||||
continue;
|
||||
|
||||
// If the current header corresponds to the "Employee B"
|
||||
// field value, and is not the Total Row header,
|
||||
// it is removed with all corresponding rows.
|
||||
if (Equals(cell.Value, null) && cell.ValueType == FieldValueType.Value)
|
||||
e.Remove(cell);
|
||||
if (string.IsNullOrWhiteSpace(cell.DisplayText) && cell.ValueType == FieldValueType.Total)
|
||||
e.Remove(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cell.ValueType == FieldValueType.Total)
|
||||
{
|
||||
|
||||
public class FlexibleReportEntry
|
||||
{
|
||||
public string Customer { get; set; }
|
||||
}
|
||||
|
||||
public string Employee { get; set; }
|
||||
// If the current header corresponds to the "Employee B"
|
||||
// field value, and is not the Total Row header,
|
||||
// it is removed with all corresponding rows.
|
||||
if (Equals(cell.Value, null) && cell.ValueType == FieldValueType.Value)
|
||||
e.Remove(cell);
|
||||
if (string.IsNullOrWhiteSpace(cell.DisplayText) && cell.ValueType == FieldValueType.Total)
|
||||
e.Remove(cell);
|
||||
}
|
||||
}
|
||||
|
||||
public string Team { get; set; }
|
||||
private void CheckChartChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(myPivotGridControl.DataSource != null)
|
||||
{
|
||||
ChartControl.Visibility = checkBoxChart.IsChecked.Value ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (ChartControl.Visibility == Visibility.Visible)
|
||||
{
|
||||
InitChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Leistungskategorie { get; set; }
|
||||
public class FlexibleReportEntry
|
||||
{
|
||||
public string Customer { get; set; }
|
||||
|
||||
public string Leistung { get; set; }
|
||||
public string Employee { get; set; }
|
||||
|
||||
public string SupportConcept { get; set; }
|
||||
public string Team { get; set; }
|
||||
|
||||
public decimal AnzahlMinutenIst { get; set; }
|
||||
public string Leistungskategorie { get; set; }
|
||||
|
||||
public decimal AnzahlStundenIst
|
||||
{
|
||||
get
|
||||
{
|
||||
return AnzahlMinutenIst / 60;
|
||||
}
|
||||
}
|
||||
public string Leistung { get; set; }
|
||||
|
||||
public decimal? AnzahlMinutenSoll { get; set; }
|
||||
public string SupportConcept { get; set; }
|
||||
|
||||
public decimal? AnzahlStundenSoll
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EintraegeProTag == 0)
|
||||
{
|
||||
return AnzahlMinutenSoll / 60;
|
||||
}
|
||||
return AnzahlMinutenSoll / 60 / EintraegeProTag;
|
||||
}
|
||||
}
|
||||
public decimal AnzahlMinutenIst { get; set; }
|
||||
|
||||
public DateTime Datum { get; set; }
|
||||
public decimal AnzahlStundenIst
|
||||
{
|
||||
get
|
||||
{
|
||||
return AnzahlMinutenIst / 60;
|
||||
}
|
||||
}
|
||||
|
||||
public int EintraegeProTag { get; set; }
|
||||
public decimal? AnzahlMinutenSoll { get; set; }
|
||||
|
||||
public FlexibleReportEntryType Type { get; set; }
|
||||
public decimal? AnzahlStundenSoll
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EintraegeProTag == 0)
|
||||
{
|
||||
return AnzahlMinutenSoll / 60;
|
||||
}
|
||||
return AnzahlMinutenSoll / 60 / EintraegeProTag;
|
||||
}
|
||||
}
|
||||
|
||||
public int? Kilometer { get; set; }
|
||||
public DateTime Datum { get; set; }
|
||||
|
||||
public static FlexibleReportEntry InitByFlexibleReportEntryDC(FlexibleReportEntryDC entryDC)
|
||||
{
|
||||
var returnValue = new FlexibleReportEntry()
|
||||
{
|
||||
AnzahlMinutenIst = entryDC.AnzahlMinuten,
|
||||
Datum = entryDC.Datum,
|
||||
//Klient = entryDC.Customer == null ? "<Nicht angegeben>" : string.Format("{0}, {1}", entryDC.Customer.LastName, entryDC.Customer.FirstName),
|
||||
SupportConcept = entryDC.SupportConcept == null ? "<Nicht angegeben>" : string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", entryDC.SupportConcept.StartDate, entryDC.SupportConcept.EndDate),
|
||||
Leistung = entryDC.Leistung,
|
||||
Leistungskategorie = entryDC.Leistungskategorie,
|
||||
//Mitarbeiter = entryDC.Employee == null ? "<Nicht angegeben>" : string.Format("{0}, {1}", entryDC.Employee.LastName, entryDC.Employee.FirstName),
|
||||
Team = entryDC.Team,
|
||||
AnzahlMinutenSoll = entryDC.AnzahlMinutenSoll,
|
||||
EintraegeProTag = entryDC.EintraegeProTag,
|
||||
Type = entryDC.Type,
|
||||
Kilometer = entryDC.Kilometer
|
||||
};
|
||||
public int EintraegeProTag { get; set; }
|
||||
|
||||
if (entryDC.Customer == null)
|
||||
{
|
||||
if (entryDC.Type == FlexibleReportEntryType.FullEntry)
|
||||
{
|
||||
returnValue.Customer = "<Nicht angegeben>";
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Customer = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Customer = string.Format("{0}, {1}", entryDC.Customer.LastName, entryDC.Customer.FirstName);
|
||||
}
|
||||
public FlexibleReportEntryType Type { get; set; }
|
||||
|
||||
if (entryDC.Employee == null)
|
||||
{
|
||||
if (entryDC.Type == FlexibleReportEntryType.FullEntry)
|
||||
{
|
||||
returnValue.Employee = "<Nicht angegeben>";
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Employee = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Employee = string.Format("{0}, {1}", entryDC.Employee.LastName, entryDC.Employee.FirstName);
|
||||
}
|
||||
public int? Kilometer { get; set; }
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
public static FlexibleReportEntry InitByFlexibleReportEntryDC(FlexibleReportEntryDC entryDC)
|
||||
{
|
||||
var returnValue = new FlexibleReportEntry()
|
||||
{
|
||||
AnzahlMinutenIst = entryDC.AnzahlMinuten,
|
||||
Datum = entryDC.Datum,
|
||||
SupportConcept = entryDC.SupportConcept == null ? "<Nicht angegeben>" : string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", entryDC.SupportConcept.StartDate, entryDC.SupportConcept.EndDate),
|
||||
Leistung = entryDC.Leistung,
|
||||
Leistungskategorie = entryDC.Leistungskategorie,
|
||||
Team = entryDC.Team,
|
||||
AnzahlMinutenSoll = entryDC.AnzahlMinutenSoll,
|
||||
EintraegeProTag = entryDC.EintraegeProTag,
|
||||
Type = entryDC.Type,
|
||||
Kilometer = entryDC.Kilometer
|
||||
};
|
||||
|
||||
if (entryDC.Customer == null)
|
||||
{
|
||||
if (entryDC.Type == FlexibleReportEntryType.ServiceRecordEntry)
|
||||
{
|
||||
returnValue.Customer = "<Nicht angegeben>";
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Customer = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Customer = string.Format("{0}, {1}", entryDC.Customer.LastName, entryDC.Customer.FirstName);
|
||||
}
|
||||
|
||||
if (entryDC.Employee == null)
|
||||
{
|
||||
if (entryDC.Type == FlexibleReportEntryType.ServiceRecordEntry)
|
||||
{
|
||||
returnValue.Employee = "<Nicht angegeben>";
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Employee = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue.Employee = string.Format("{0}, {1}", entryDC.Employee.LastName, entryDC.Employee.FirstName);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "'" + Employee + " -> " + Customer;
|
||||
}
|
||||
}
|
||||
|
||||
internal static class ChartFactory
|
||||
{
|
||||
static readonly Type XYDiagram2DType = typeof(XYDiagram2D);
|
||||
static readonly Type XYDiagram3DType = typeof(XYDiagram3D);
|
||||
static readonly Type SimpleDiagram3DType = typeof(SimpleDiagram3D);
|
||||
static readonly Type SimpleDiagram2DType = typeof(SimpleDiagram2D);
|
||||
static readonly Type DefaultSeriesType = typeof(BarStackedSeries2D);
|
||||
|
||||
static Dictionary<Type, SeriesTypeDescriptor> seriesTypes;
|
||||
public static Dictionary<Type, SeriesTypeDescriptor> SeriesTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (seriesTypes == null)
|
||||
seriesTypes = CreateSeriesTypes();
|
||||
return seriesTypes;
|
||||
}
|
||||
}
|
||||
static Dictionary<Type, SeriesTypeDescriptor> CreateSeriesTypes()
|
||||
{
|
||||
Dictionary<Type, SeriesTypeDescriptor> seriesTypes = new Dictionary<Type, SeriesTypeDescriptor>();
|
||||
seriesTypes.Add(typeof(AreaFullStackedSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText = "Area Full-Stacked Series 2D" });
|
||||
seriesTypes.Add(typeof(AreaSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText="Area Series 2D" });
|
||||
seriesTypes.Add(typeof(AreaStackedSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText="Area Stacked Series 2D" });
|
||||
seriesTypes.Add(typeof(BarFullStackedSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText="Bar Full-Stacked Series 2D" });
|
||||
seriesTypes.Add(typeof(BarStackedSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText="Bar Stacked Series 2D" });
|
||||
seriesTypes.Add(typeof(LineSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText="Line Series 2D" });
|
||||
seriesTypes.Add(typeof(PointSeries2D), new SeriesTypeDescriptor { DiagramType = XYDiagram2DType, DisplayText = "Point Series 2D" });
|
||||
seriesTypes.Add(typeof(AreaSeries3D), new SeriesTypeDescriptor { DiagramType = XYDiagram3DType, DisplayText="Area Series 3D" });
|
||||
seriesTypes.Add(typeof(AreaStackedSeries3D), new SeriesTypeDescriptor { DiagramType = XYDiagram3DType, DisplayText="Area Stacked Series 3D" });
|
||||
seriesTypes.Add(typeof(AreaFullStackedSeries3D), new SeriesTypeDescriptor { DiagramType = XYDiagram3DType, DisplayText="Area Full-Stacked Series 3D" });
|
||||
seriesTypes.Add(typeof(BarSeries3D), new SeriesTypeDescriptor { DiagramType = XYDiagram3DType, DisplayText="Bar Series 3D" });
|
||||
seriesTypes.Add(typeof(PointSeries3D), new SeriesTypeDescriptor { DiagramType = XYDiagram3DType, DisplayText="Point Series 3D" });
|
||||
seriesTypes.Add(typeof(PieSeries3D), new SeriesTypeDescriptor { DiagramType = SimpleDiagram3DType, DisplayText="Pie Series 3D" });
|
||||
seriesTypes.Add(typeof(PieSeries2D), new SeriesTypeDescriptor { DiagramType = SimpleDiagram2DType, DisplayText = "Pie Series 2D" });
|
||||
return seriesTypes;
|
||||
}
|
||||
|
||||
public class SeriesTypeDescriptor
|
||||
{
|
||||
public Type DiagramType { get; set; }
|
||||
public string DisplayText { get; set; }
|
||||
}
|
||||
|
||||
public static Diagram GenerateDiagram(Type seriesType, bool? showPointsLabels)
|
||||
{
|
||||
Series seriesTemplate = CreateSeriesInstance(seriesType);
|
||||
Diagram diagram = CreateDiagramBySeriesType(seriesType);
|
||||
if (diagram is XYDiagram2D)
|
||||
PrepareXYDiagram2D(diagram as XYDiagram2D);
|
||||
if (diagram is XYDiagram3D)
|
||||
PrepareXYDiagram3D(diagram as XYDiagram3D);
|
||||
if (diagram is Diagram3D)
|
||||
((Diagram3D)diagram).RuntimeRotation = true;
|
||||
diagram.SeriesDataMember = "Series";
|
||||
seriesTemplate.ArgumentDataMember = "Arguments";
|
||||
seriesTemplate.ValueDataMember = "Values";
|
||||
if (seriesTemplate.Label == null)
|
||||
seriesTemplate.Label = new SeriesLabel();
|
||||
seriesTemplate.LabelsVisibility = showPointsLabels == true;
|
||||
if (seriesTemplate is PieSeries2D || seriesTemplate is PieSeries3D)
|
||||
{
|
||||
seriesTemplate.LegendTextPattern = "{A}";
|
||||
seriesTemplate.Label.TextPattern = "{A}: {VP:P0}";
|
||||
}
|
||||
else
|
||||
{
|
||||
seriesTemplate.LegendTextPattern = "{A}: {V:G}";
|
||||
seriesTemplate.ShowInLegend = true;
|
||||
}
|
||||
diagram.SeriesTemplate = seriesTemplate;
|
||||
return diagram;
|
||||
}
|
||||
static void PrepareXYDiagram2D(XYDiagram2D diagram)
|
||||
{
|
||||
if (diagram == null)
|
||||
return;
|
||||
diagram.AxisX = new AxisX2D();
|
||||
diagram.AxisX.Label = new AxisLabel();
|
||||
diagram.AxisX.Label.Staggered = true;
|
||||
}
|
||||
static void PrepareXYDiagram3D(XYDiagram3D diagram)
|
||||
{
|
||||
if (diagram == null)
|
||||
return;
|
||||
diagram.AxisX = new AxisX3D();
|
||||
diagram.AxisX.Label = new AxisLabel();
|
||||
diagram.AxisX.Label.Visible = false;
|
||||
}
|
||||
public static Series CreateSeriesInstance(Type seriesType)
|
||||
{
|
||||
Series series = (Series)Activator.CreateInstance(seriesType);
|
||||
ISupportTransparency supportTransparency = series as ISupportTransparency;
|
||||
if (supportTransparency != null)
|
||||
{
|
||||
bool flag = series is AreaSeries2D || series is AreaSeries3D;
|
||||
supportTransparency.Transparency = flag ? 0.4 : 0;
|
||||
}
|
||||
return series;
|
||||
}
|
||||
static Diagram CreateDiagramBySeriesType(Type seriesType)
|
||||
{
|
||||
return (Diagram)Activator.CreateInstance(SeriesTypes[seriesType].DiagramType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1000,6 +1000,7 @@ namespace BS.Shared
|
||||
EmployeeNullEntry,
|
||||
CustomerNullEntry,
|
||||
CustomerEmployeeNullEntry,
|
||||
FullEntry
|
||||
ServiceRecordEntry,
|
||||
SollEntry
|
||||
}
|
||||
}
|
||||
@@ -22,5 +22,8 @@ namespace BS.Shared.DataContracts
|
||||
|
||||
[DataMember]
|
||||
public IList<ServiceDescriptionDC> Leistungen { get; set; }
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public bool NullDaten { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user