private List<SenderCalculationGroup> GetGroups(SenderCalculationItem[] items)
		{
			var awbsData = _awbs.Get(items.Select(x => x.AirWaybillId ?? 0).ToArray());

			var groups = items.GroupBy(x => x.AirWaybillId).Select(g =>
			{
				var itemsGroup = g.Key.HasValue
					? g.OrderBy(x => x.ClientNic).ThenByDescending(x => x.ApplicationId).ToArray()
					: g.OrderByDescending(x => x.ApplicationId).ToArray();

				var awb = awbsData.FirstOrDefault(x => x.Id == g.Key);

				var text = awb != null
					? AwbHelper.GetAirWaybillDisplay(awb)
					: Pages.NoAirWaybill;

				return new SenderCalculationGroup
				{
					AirWaybillId = g.Key,
					items = itemsGroup,
					value = new { id = g.Key, text },
					aggregates = new SenderCalculationGroup.Aggregates(itemsGroup),
					FlightCost = awb != null
						? awb.FlightCost ?? 0
						: 0,
					TotalCostOfSenderForWeight = awb != null
						? awb.TotalCostOfSenderForWeight ?? 0
						: 0
				};
			}).ToList();

			return groups;
		}
			public Aggregates(SenderCalculationItem[] items)
			{
				Profit = new SumHolder<decimal>(items.Sum(x => x.Profit));
				TotalSenderRate = new SumHolder<decimal>(items.Sum(x => x.TotalSenderRate));

				Count = new SumHolder<int>(items.Sum(x => x.Count ?? 0));
				Weight = new SumHolder<float>(items.Sum(x => x.Weight ?? 0));
				Value = new SumHolder<decimal>(items.Sum(x => x.Value));
				SenderScotchCost = new SumHolder<decimal>(items.Sum(x => x.SenderScotchCost ?? 0));
				PickupCost = new SumHolder<decimal>(items.Sum(x => x.PickupCost ?? 0));
				FactureCost = new SumHolder<decimal>(items.Sum(x => x.FactureCost ?? 0));
				FactureCostEx = new SumHolder<decimal>(items.Sum(x => x.FactureCostEx ?? 0));
			}
		private static void DrawRow(ExcelWorksheet ws, SenderCalculationItem item, int iRow)
		{
			var iColumn = 1;
			ws.Cells[iRow, iColumn++].Value = item.ClientNic;
			ws.Cells[iRow, iColumn++].Value = item.DisplayNumber;
			ws.Cells[iRow, iColumn++].Value = item.Factory;
			ws.Cells[iRow, iColumn++].Value = item.Mark;
			ws.Cells[iRow, iColumn++].Value = item.Invoice;
			ws.Cells[iRow, iColumn++].Value = item.Value;
			ws.Cells[iRow, iColumn++].Value = item.Count;
			ws.Cells[iRow, iColumn++].Value = item.Weight;
			ws.Cells[iRow, iColumn++].Value = item.SenderRate;
			ws.Cells[iRow, iColumn].Style.Font.Bold = true;
			ws.Cells[iRow, iColumn++].Value = item.TotalSenderRate;
			ws.Cells[iRow, iColumn++].Value = item.SenderScotchCost;
			ws.Cells[iRow, iColumn++].Value = item.FactureCost;
			ws.Cells[iRow, iColumn++].Value = item.FactureCostEx;
			ws.Cells[iRow, iColumn++].Value = item.PickupCost;
			ws.Cells[iRow, iColumn].Style.Font.Bold = true;
			ws.Cells[iRow, iColumn].Value = item.Profit;
		}