ИСЭбд-21. Иванова А.А. Лабораторная работа 4 #4
@ -18,7 +18,7 @@ public class RouteSheet
|
|||||||
[DisplayName("Дата конца")]
|
[DisplayName("Дата конца")]
|
||||||
public DateTime End_Date { get; private set; }
|
public DateTime End_Date { get; private set; }
|
||||||
|
|
||||||
[DisplayName("Смена")]
|
[DisplayName("Расход топлива")]
|
||||||
public float Fuel_Consumption { get; private set; }
|
public float Fuel_Consumption { get; private set; }
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
|
@ -67,6 +67,5 @@ namespace ProjectGSM.Forms
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
8
ProjectGSM/Forms/FormRouteSheets.Designer.cs
generated
8
ProjectGSM/Forms/FormRouteSheets.Designer.cs
generated
@ -39,9 +39,9 @@
|
|||||||
//
|
//
|
||||||
panel1.Controls.Add(buttonAdd);
|
panel1.Controls.Add(buttonAdd);
|
||||||
panel1.Dock = DockStyle.Right;
|
panel1.Dock = DockStyle.Right;
|
||||||
panel1.Location = new Point(641, 0);
|
panel1.Location = new Point(730, 0);
|
||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
panel1.Size = new Size(159, 450);
|
panel1.Size = new Size(159, 501);
|
||||||
panel1.TabIndex = 0;
|
panel1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// buttonAdd
|
// buttonAdd
|
||||||
@ -71,14 +71,14 @@
|
|||||||
dataGridView.RowHeadersVisible = false;
|
dataGridView.RowHeadersVisible = false;
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.Size = new Size(641, 450);
|
dataGridView.Size = new Size(730, 501);
|
||||||
dataGridView.TabIndex = 3;
|
dataGridView.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// FormRouteSheets
|
// FormRouteSheets
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(889, 501);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "FormRouteSheets";
|
Name = "FormRouteSheets";
|
||||||
|
@ -26,7 +26,7 @@ public class ChartReport
|
|||||||
{
|
{
|
||||||
new PDFBuilder(filePath)
|
new PDFBuilder(filePath)
|
||||||
.AddHeader("Отчет по заправкам")
|
.AddHeader("Отчет по заправкам")
|
||||||
.AddPieChart("Объем заправленного топлива по автомобилям", GetData(dateTime))
|
.AddPieChart($"Объем заправленного топлива по автомобилям {dateTime: dd MMMM yyyy}", GetData(dateTime))
|
||||||
.Build();
|
.Build();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -43,13 +43,13 @@ public class ChartReport
|
|||||||
.ReadRefills()
|
.ReadRefills()
|
||||||
.Where(x => x.Refill_Date.Date == dateTime.Date)
|
.Where(x => x.Refill_Date.Date == dateTime.Date)
|
||||||
.GroupBy(
|
.GroupBy(
|
||||||
x => x.Car_ID,
|
x => x.CarName,
|
||||||
(key, group) => new
|
(key, group) => new
|
||||||
{
|
{
|
||||||
CarId = key,
|
CarName = key,
|
||||||
TotalRefill = group.Sum(y => y.Quantity)
|
TotalRefill = group.Sum(y => y.Quantity)
|
||||||
})
|
})
|
||||||
.Select(x => ($"Автомобиль {x.CarId}", (double)x.TotalRefill))
|
.Select(x => ($"{x.CarName}", (double)x.TotalRefill))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using ProjectGSM.Repositories;
|
using ProjectGSM.Repositories;
|
||||||
|
using ProjectGSM.Repositories.Implementations;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -33,7 +34,7 @@ public class TableReport
|
|||||||
|
|
||||||
new ExcelBuilder(filePath)
|
new ExcelBuilder(filePath)
|
||||||
.AddHeader("Сводка по пополнению на заправках и поездкам автомобиля", 0, 4)
|
.AddHeader("Сводка по пополнению на заправках и поездкам автомобиля", 0, 4)
|
||||||
.AddParagraph($"за период с {startDate:yyyy-MM-dd} по {endDate:yyyy-MM-dd}", 0)
|
.AddParagraph($"за период с {startDate:dd.MM.yyyy} по {endDate:dd.MM.yyyy}", 0)
|
||||||
.AddTable(new[] { 15, 20, 20, 20 }, tableData)
|
.AddTable(new[] { 15, 20, 20, 20 }, tableData)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
@ -49,10 +50,10 @@ public class TableReport
|
|||||||
private List<string[]> GetData(int carId, DateTime startDate, DateTime endDate)
|
private List<string[]> GetData(int carId, DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
var refills = _refillRepository
|
var refills = _refillRepository
|
||||||
.ReadRefills()
|
.ReadRefills(dateFrom: startDate, dateTo: endDate, carId: carId)
|
||||||
.Where(x => x.Refill_Date >= startDate && x.Refill_Date <= endDate && x.Car_ID == carId)
|
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
|
x.CarName,
|
||||||
CarId = x.Car_ID,
|
CarId = x.Car_ID,
|
||||||
Date = x.Refill_Date,
|
Date = x.Refill_Date,
|
||||||
RefillAmount = (float?)x.Quantity,
|
RefillAmount = (float?)x.Quantity,
|
||||||
@ -61,10 +62,10 @@ public class TableReport
|
|||||||
.AsEnumerable();
|
.AsEnumerable();
|
||||||
|
|
||||||
var trips = _routeSheetRepository
|
var trips = _routeSheetRepository
|
||||||
.ReadRouteSheet()
|
.ReadRouteSheet(dateFrom: startDate, dateTo: endDate, carId: carId)
|
||||||
.Where(x => x.Start_Date >= startDate && x.End_Date <= endDate && x.Car_ID == carId)
|
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
|
x.CarName,
|
||||||
CarId = x.Car_ID,
|
CarId = x.Car_ID,
|
||||||
Date = x.Start_Date,
|
Date = x.Start_Date,
|
||||||
RefillAmount = (float?)null,
|
RefillAmount = (float?)null,
|
||||||
@ -79,8 +80,8 @@ public class TableReport
|
|||||||
new List<string[]>() { item }
|
new List<string[]>() { item }
|
||||||
.Union(data.Select(x => new string[]
|
.Union(data.Select(x => new string[]
|
||||||
{
|
{
|
||||||
x.CarId.ToString(),
|
x.CarName.ToString(),
|
||||||
x.Date.ToString("yyyy-MM-dd HH:mm"),
|
x.Date.ToString("dd.MM.yyyy"),
|
||||||
x.RefillAmount?.ToString() ?? string.Empty,
|
x.RefillAmount?.ToString() ?? string.Empty,
|
||||||
x.FuelConsumption?.ToString() ?? string.Empty
|
x.FuelConsumption?.ToString() ?? string.Empty
|
||||||
}))
|
}))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user