Skip to content
Snippets Groups Projects
Commit 569e9988 authored by Radek Puš's avatar Radek Puš
Browse files

changed loading type of constant symbol

parent fba90209
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,7 @@ namespace Core.Controllers
};
}
 
private List<TransactionContainer> MakeGroup(IQueryable<Tuple<double, AbstractConstantSymbolVariation>> transactions, double undeterminedAmount)
private List<TransactionContainer> MakeGroup(IQueryable<Tuple<double, AbstractConstantSymbolVariation>> transactions, double undeterminedAmount = 0)
{
const string labelUndefined = "Nezařazeno";
 
......@@ -99,6 +99,9 @@ namespace Core.Controllers
group.First().Item2 != null ? group.First().Item2.Value : labelUndefined
)).ToList();
 
if (undeterminedAmount == 0)
return list;
 
int index = list.FindIndex(t => t.name == labelUndefined);
 
......@@ -116,12 +119,21 @@ namespace Core.Controllers
.Where(t => t.ConstantSymbol != null)
.Select(t => new { t.Amount, t.ConstantSymbol });
 
decimal undeterminedAmount = transactions.Where(t => t.ConstantSymbol == null || t.ConstantSymbol.LastNumber == null).Sum(t => t.Amount);
var paymentTypes = MakeGroup(symbols.Select(t => new Tuple<double, AbstractConstantSymbolVariation>((double)t.Amount, t.ConstantSymbol.LastNumber)), (double)undeterminedAmount);
//if reserved symbol = other symbols not possible
var reserved = symbols.Where(t => t.ConstantSymbol.ReservedSymbol != null);
var reservedSymbols = MakeGroup(reserved.Select(t => new Tuple<double, AbstractConstantSymbolVariation>((double)t.Amount, t.ConstantSymbol.ReservedSymbol)));
 
undeterminedAmount = transactions.Where(t => t.ConstantSymbol == null || t.ConstantSymbol.MinistryPredefined == null).Sum(t => t.Amount);
decimal undeterminedAmount = transactions.Where(t => t.ConstantSymbol == null).Sum(t => t.Amount);
symbols = symbols.Where(t => t.ConstantSymbol.ReservedSymbol == null);
//var paymentTypes = MakeGroup(symbols.Select(t => new Tuple<double, AbstractConstantSymbolVariation>((double)t.Amount, t.ConstantSymbol.LastNumber)), (double)undeterminedAmount);
var paymentTypes = MakeGroup(symbols.Select(t => new Tuple<double, AbstractConstantSymbolVariation>((double)t.Amount, t.ConstantSymbol.Kind)), (double)undeterminedAmount);
var paymentCategories = MakeGroup(symbols.Select(t => new Tuple<double, AbstractConstantSymbolVariation>((double)t.Amount, t.ConstantSymbol.MinistryPredefined)), (double)undeterminedAmount);
 
paymentCategories.AddRange(reservedSymbols);
paymentTypes.AddRange(reservedSymbols);
return (paymentTypes, paymentCategories);
}
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment