|
|
@@ -146,6 +146,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
generator.CustomizeGroupColumnSummary += new CustomizeColumnGroupSummaryEventHandler(generator_CustomizeGroupColumnSummary);
|
|
|
generator.CustomizeTotalColumnSummary += new CustomizeColumnTotalSummaryEventHandler(generator_CustomizeTotalColumnSummary);
|
|
|
generator.PageSummaryGetResult += new SummaryGetResultHandler(generator_PageSummaryGetResult);
|
|
|
+ generator.TotalSummaryGetResult += new SummaryGetResultHandler(generator_TotalSummaryGetResult);
|
|
|
|
|
|
var report = generator.GenerateMVCReport(gridViewState, appendixModels, "Nachtragsliste");
|
|
|
|
|
|
@@ -173,11 +174,15 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
{
|
|
|
case "xlsx":
|
|
|
settings.TotalSummary["OfferingValue"].DisplayFormat = "{0:c2}";
|
|
|
+ settings.TotalSummary["Percentage"].DisplayFormat = "{0:p2}";
|
|
|
+ settings.TotalSummary["PercentageValue"].DisplayFormat = "{0:c2}";
|
|
|
settings.TotalSummary["NegotiationValue"].DisplayFormat = "{0:c2}";
|
|
|
settings.TotalSummary["Description"].DisplayFormat = "Anzahl = {0:n0}";
|
|
|
return GridViewExtension.ExportToXlsx(settings, appendixModels);
|
|
|
case "xls":
|
|
|
settings.TotalSummary["OfferingValue"].DisplayFormat = "{0:c2}";
|
|
|
+ settings.TotalSummary["Percentage"].DisplayFormat = "{0:p2}";
|
|
|
+ settings.TotalSummary["PercentageValue"].DisplayFormat = "{0:c2}";
|
|
|
settings.TotalSummary["NegotiationValue"].DisplayFormat = "{0:c2}";
|
|
|
settings.TotalSummary["Description"].DisplayFormat = "Anzahl = {0:n0}";
|
|
|
return GridViewExtension.ExportToXls(settings, appendixModels);
|
|
|
@@ -192,9 +197,14 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
else
|
|
|
return new EmptyResult();
|
|
|
}
|
|
|
-
|
|
|
private decimal accumulatedCustomSummaryOfferingValue = 0;
|
|
|
+ private decimal accumulatedCustomSummaryPercentage = 0;
|
|
|
+ private decimal accumulatedCustomSummaryPercentageValue = 0;
|
|
|
private decimal accumulatedCustomSummaryNegotiationValue = 0;
|
|
|
+ private decimal accumulatedRelationOfferingToNegotiationSum = 0;
|
|
|
+ private int accumulatedRelationOfferingToNegotiationCount = 0;
|
|
|
+ private decimal accumulatedRelationOfferingToDeviationsSum = 0;
|
|
|
+ private int accumulatedRelationOfferingToDeviationsCount = 0;
|
|
|
private decimal accumulatedCustomSummaryCount = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -206,27 +216,104 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
{
|
|
|
var label = (XRLabel)source;
|
|
|
|
|
|
+ if (label.Tag.ToString() == "Description")
|
|
|
+ {
|
|
|
+ accumulatedCustomSummaryCount += e.CalculatedValues.Count;
|
|
|
+ e.Result = accumulatedCustomSummaryCount;
|
|
|
+ }
|
|
|
+
|
|
|
if (label.Tag.ToString() == "OfferingValue")
|
|
|
{
|
|
|
accumulatedCustomSummaryOfferingValue += e.CalculatedValues.OfType<decimal>().Sum();
|
|
|
e.Result = accumulatedCustomSummaryOfferingValue;
|
|
|
}
|
|
|
|
|
|
+ if (label.Tag.ToString() == "Percentage")
|
|
|
+ {
|
|
|
+ accumulatedCustomSummaryPercentage += e.CalculatedValues.OfType<decimal>().Sum();
|
|
|
+ e.Result = accumulatedCustomSummaryPercentage /
|
|
|
+ (accumulatedCustomSummaryCount == 0 ? 1 : accumulatedCustomSummaryCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (label.Tag.ToString() == "PercentageValue")
|
|
|
+ {
|
|
|
+ accumulatedCustomSummaryPercentageValue += e.CalculatedValues.OfType<decimal>().Sum();
|
|
|
+ e.Result = accumulatedCustomSummaryPercentageValue;
|
|
|
+ }
|
|
|
+
|
|
|
if (label.Tag.ToString() == "NegotiationValue")
|
|
|
{
|
|
|
accumulatedCustomSummaryNegotiationValue += e.CalculatedValues.OfType<decimal>().Sum();
|
|
|
e.Result = accumulatedCustomSummaryNegotiationValue;
|
|
|
}
|
|
|
|
|
|
- if (label.Tag.ToString() == "Description")
|
|
|
+ if (label.Tag.ToString() == "RelationOfferingToNegotiation")
|
|
|
{
|
|
|
- accumulatedCustomSummaryCount += e.CalculatedValues.Count;
|
|
|
- e.Result = accumulatedCustomSummaryCount;
|
|
|
+ var nonNull = e.CalculatedValues
|
|
|
+ .OfType<decimal?>()
|
|
|
+ .Where(d => d.HasValue)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ accumulatedRelationOfferingToNegotiationSum += nonNull.Sum(d => d.Value);
|
|
|
+ accumulatedRelationOfferingToNegotiationCount += nonNull.Count;
|
|
|
+
|
|
|
+ e.Result = accumulatedRelationOfferingToNegotiationSum /
|
|
|
+ (accumulatedRelationOfferingToNegotiationCount == 0 ? 1 : accumulatedRelationOfferingToNegotiationCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (label.Tag.ToString() == "RelationOfferingToDeviations")
|
|
|
+ {
|
|
|
+ var nonNull = e.CalculatedValues
|
|
|
+ .OfType<decimal?>()
|
|
|
+ .Where(d => d.HasValue)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ accumulatedRelationOfferingToDeviationsSum += nonNull.Sum(d => d.Value);
|
|
|
+ accumulatedRelationOfferingToDeviationsCount += nonNull.Count;
|
|
|
+
|
|
|
+ e.Result = accumulatedRelationOfferingToDeviationsSum /
|
|
|
+ (accumulatedRelationOfferingToDeviationsCount == 0 ? 1 : accumulatedRelationOfferingToDeviationsCount);
|
|
|
}
|
|
|
|
|
|
e.Handled = true;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Set custom summary result for full report
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="source"></param>
|
|
|
+ /// <param name="e"></param>
|
|
|
+ private void generator_TotalSummaryGetResult(object source, SummaryGetResultEventArgs e)
|
|
|
+ {
|
|
|
+ var label = (XRLabel)source;
|
|
|
+
|
|
|
+ if (label.Tag.ToString() == "PercentageValue")
|
|
|
+ {
|
|
|
+ e.Result = accumulatedCustomSummaryPercentageValue;
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (label.Tag.ToString() == "NegotiationValue")
|
|
|
+ {
|
|
|
+ e.Result = accumulatedCustomSummaryNegotiationValue;
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (label.Tag.ToString() == "RelationOfferingToNegotiation")
|
|
|
+ {
|
|
|
+ e.Result = accumulatedRelationOfferingToNegotiationSum /
|
|
|
+ (accumulatedRelationOfferingToNegotiationCount == 0 ? 1 : accumulatedRelationOfferingToNegotiationCount);
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (label.Tag.ToString() == "RelationOfferingToDeviations")
|
|
|
+ {
|
|
|
+ e.Result = accumulatedRelationOfferingToDeviationsSum /
|
|
|
+ (accumulatedRelationOfferingToDeviationsCount == 0 ? 1 : accumulatedRelationOfferingToDeviationsCount);
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Customize formatting
|
|
|
/// </summary>
|
|
|
@@ -263,12 +350,14 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
if (column.FieldName == "SiteCustomNumber") { column.IsVisible = false; column.IsDetail = true; }
|
|
|
if (column.FieldName == "UserDescription") { column.IsVisible = false; column.IsDetail = true; }
|
|
|
if (column.FieldName == "OfferingValue") { column.ColumnWidth = 80; }
|
|
|
- if (column.FieldName == "NegotiationValue") { column.ColumnWidth = 80; }
|
|
|
+ if (column.FieldName == "NegotiationValue") { column.ColumnWidth = 60; }
|
|
|
if (column.FieldName == "DeviationDescription") { column.ColumnWidth = 40; }
|
|
|
if (column.FieldName == "RelationOfferingToNegotiation") { column.ColumnWidth = 50; }
|
|
|
if (column.FieldName == "RelationOfferingToDeviations") { column.ColumnWidth = 50; }
|
|
|
if (column.FieldName == "StateDescription") { column.ColumnWidth = 70; }
|
|
|
if (column.FieldName == "CategoryValuesDescription") { column.IsVisible = false; column.IsDetail = true; }
|
|
|
+ if (column.FieldName == "OrderNumber") { column.IsVisible = false; column.IsDetail = true; }
|
|
|
+ if (column.FieldName == "OrderDate") { column.IsVisible = false; column.IsDetail = true; }
|
|
|
if (column.FieldName == "OrderInvoiceCreatedDescription") { column.ColumnWidth = 45; }
|
|
|
if (column.FieldName == "Comment") { column.IsVisible = false; column.IsDetail = true; }
|
|
|
}
|
|
|
@@ -280,7 +369,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
private void generator_CustomizeGroupColumnSummary(object source, ColumnSummaryCreationEventArgs e)
|
|
|
{
|
|
|
if (e.FieldName == "OfferingValue") { e.Summary.FormatString = "Angeb. ∑ = {0:c2}"; }
|
|
|
+ if (e.FieldName == "Percentage") { e.Summary.FormatString = "Bew. Ø = {0:p2}"; }
|
|
|
+ if (e.FieldName == "PercentageValue") { e.Summary.FormatString = "Ang. Bew. ∑ = {0:c2}"; }
|
|
|
if (e.FieldName == "NegotiationValue") { e.Summary.FormatString = "Verhand. ∑ = {0:c2}"; }
|
|
|
+ if (e.FieldName == "RelationOfferingToNegotiation") { e.Summary.FormatString = "Verh. Quo. Ø = {0:p2}"; }
|
|
|
+ if (e.FieldName == "RelationOfferingToDeviations") { e.Summary.FormatString = "Fak. Ang. zu VA Ø = {0:n2}"; }
|
|
|
if (e.FieldName == "Description") { e.Summary.FormatString = "Alle = {0:n0}"; }
|
|
|
}
|
|
|
|
|
|
@@ -290,7 +383,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
|
|
|
private void generator_CustomizeTotalColumnSummary(object source, ColumnSummaryCreationEventArgs e)
|
|
|
{
|
|
|
if (e.FieldName == "OfferingValue") { e.Summary.FormatString = "{0:c2}"; }
|
|
|
+ if (e.FieldName == "Percentage") { e.Summary.FormatString = "{0:p2}"; }
|
|
|
+ if (e.FieldName == "PercentageValue") { e.Summary.FormatString = "{0:c2}"; }
|
|
|
if (e.FieldName == "NegotiationValue") { e.Summary.FormatString = "{0:c2}"; }
|
|
|
+ if (e.FieldName == "RelationOfferingToNegotiation") { e.Summary.FormatString = "{0:p2}"; }
|
|
|
+ if (e.FieldName == "RelationOfferingToDeviations") { e.Summary.FormatString = "{0:n2}"; }
|
|
|
if (e.FieldName == "Description") { e.Summary.FormatString = "Alle = {0:n0}"; }
|
|
|
}
|
|
|
|