Finish report forms

This commit is contained in:
ShabOl 2024-05-14 22:29:05 +04:00
parent 1ff73bce3a
commit fab7391ca7
10 changed files with 167 additions and 185 deletions

View File

@ -121,7 +121,7 @@ namespace AutoWorkshopBusinessLogic.BusinessLogics
public void SaveShopsToExcelFile(ReportBindingModel model)
{
_saveToExcel.CreateShopPizzasReport(new ExcelShopsInfo
_saveToExcel.CreateShopRepairsReport(new ExcelShopsInfo
{
FileName = model.FileName,
Title = "Загруженность магазинов",

View File

@ -79,7 +79,7 @@ namespace AutoWorkshopBusinessLogic.OfficePackage
SaveExcel(Info);
}
public void CreateShopPizzasReport(ExcelShopsInfo Info)
public void CreateShopRepairsReport(ExcelShopsInfo Info)
{
CreateExcel(Info);

View File

@ -28,104 +28,62 @@
/// </summary>
private void InitializeComponent()
{
panel = new Panel();
labelFrom = new Label();
dateTimePickerFrom = new DateTimePicker();
dateTimePickerTo = new DateTimePicker();
labelTo = new Label();
buttonMake = new Button();
buttonToPDF = new Button();
panel.SuspendLayout();
Panel = new Panel();
ToPdfButton = new Button();
CreateButton = new Button();
Panel.SuspendLayout();
SuspendLayout();
//
// panel
// Panel
//
panel.Controls.Add(buttonToPDF);
panel.Controls.Add(buttonMake);
panel.Controls.Add(dateTimePickerTo);
panel.Controls.Add(labelTo);
panel.Controls.Add(dateTimePickerFrom);
panel.Controls.Add(labelFrom);
panel.Dock = DockStyle.Top;
panel.Location = new Point(0, 0);
panel.Name = "panel";
panel.Size = new Size(958, 52);
panel.TabIndex = 0;
Panel.Controls.Add(ToPdfButton);
Panel.Controls.Add(CreateButton);
Panel.Dock = DockStyle.Top;
Panel.Location = new Point(0, 0);
Panel.Margin = new Padding(3, 2, 3, 2);
Panel.Name = "Panel";
Panel.Size = new Size(849, 39);
Panel.TabIndex = 1;
//
// labelFrom
// ToPdfButton
//
labelFrom.AutoSize = true;
labelFrom.Location = new Point(12, 14);
labelFrom.Name = "labelFrom";
labelFrom.Size = new Size(18, 20);
labelFrom.TabIndex = 0;
labelFrom.Text = "C";
ToPdfButton.Location = new Point(425, 9);
ToPdfButton.Margin = new Padding(3, 2, 3, 2);
ToPdfButton.Name = "ToPdfButton";
ToPdfButton.Size = new Size(360, 22);
ToPdfButton.TabIndex = 5;
ToPdfButton.Text = "В PDF";
ToPdfButton.UseVisualStyleBackColor = true;
ToPdfButton.Click += ButtonToPdf_Click;
//
// dateTimePickerFrom
// CreateButton
//
dateTimePickerFrom.Location = new Point(36, 9);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(199, 27);
dateTimePickerFrom.TabIndex = 1;
CreateButton.Location = new Point(43, 9);
CreateButton.Margin = new Padding(3, 2, 3, 2);
CreateButton.Name = "CreateButton";
CreateButton.Size = new Size(330, 22);
CreateButton.TabIndex = 4;
CreateButton.Text = "Сформировать";
CreateButton.UseVisualStyleBackColor = true;
CreateButton.Click += ButtonMake_Click;
//
// dateTimePickerTo
// FormReportGroupedOrders
//
dateTimePickerTo.Location = new Point(300, 9);
dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(199, 27);
dateTimePickerTo.TabIndex = 3;
//
// labelTo
//
labelTo.AutoSize = true;
labelTo.Location = new Point(254, 14);
labelTo.Name = "labelTo";
labelTo.Size = new Size(27, 20);
labelTo.TabIndex = 2;
labelTo.Text = "по";
//
// buttonMake
//
buttonMake.Location = new Point(542, 10);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(165, 29);
buttonMake.TabIndex = 4;
buttonMake.Text = "Сформировать";
buttonMake.UseVisualStyleBackColor = true;
buttonMake.Click += new System.EventHandler(ButtonMake_Click);
//
// buttonToPDF
//
buttonToPDF.Location = new Point(781, 9);
buttonToPDF.Name = "buttonToPDF";
buttonToPDF.Size = new Size(165, 29);
buttonToPDF.TabIndex = 5;
buttonToPDF.Text = "В PDF";
buttonToPDF.UseVisualStyleBackColor = true;
buttonToPDF.Click += new System.EventHandler(ButtonToPdf_Click);
//
// FormReportOrders
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(958, 450);
Controls.Add(panel);
Name = "FormReportOrders";
Text = "Заказы";
panel.ResumeLayout(false);
panel.PerformLayout();
ClientSize = new Size(849, 338);
Controls.Add(Panel);
Margin = new Padding(3, 2, 3, 2);
Name = "FormReportGroupedOrders";
Text = "Объединенные по датам заказы";
Panel.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private Panel panel;
private Button buttonToPDF;
private Button buttonMake;
private DateTimePicker dateTimePickerTo;
private Label labelTo;
private DateTimePicker dateTimePickerFrom;
private Label labelFrom;
private Panel Panel;
private Button ToPdfButton;
private Button CreateButton;
}
}

View File

@ -25,7 +25,7 @@ namespace AutoWorkshopView.Forms
Controls.Clear();
Controls.Add(_reportViewer);
Controls.Add(panel);
Controls.Add(Panel);
}
private void ButtonMake_Click(object sender, EventArgs e)

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -28,42 +28,42 @@
/// </summary>
private void InitializeComponent()
{
buttonSaveToExcel = new Button();
dataGridView = new DataGridView();
SaveToExcelButton = new Button();
DataGridView = new DataGridView();
ColumnShop = new DataGridViewTextBoxColumn();
ColumnRepair = new DataGridViewTextBoxColumn();
ColumnCount = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
SuspendLayout();
//
// buttonSaveToExcel
// SaveToExcelButton
//
buttonSaveToExcel.Location = new Point(12, 10);
buttonSaveToExcel.Margin = new Padding(3, 2, 3, 2);
buttonSaveToExcel.Name = "buttonSaveToExcel";
buttonSaveToExcel.Size = new Size(195, 27);
buttonSaveToExcel.TabIndex = 3;
buttonSaveToExcel.Text = "Сохранить в Excel";
buttonSaveToExcel.UseVisualStyleBackColor = true;
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
SaveToExcelButton.Location = new Point(12, 10);
SaveToExcelButton.Margin = new Padding(3, 2, 3, 2);
SaveToExcelButton.Name = "SaveToExcelButton";
SaveToExcelButton.Size = new Size(195, 27);
SaveToExcelButton.TabIndex = 3;
SaveToExcelButton.Text = "Сохранить в Excel";
SaveToExcelButton.UseVisualStyleBackColor = true;
SaveToExcelButton.Click += ButtonSaveToExcel_Click;
//
// dataGridView
// DataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToOrderColumns = true;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShop, ColumnRepair, ColumnCount });
dataGridView.Dock = DockStyle.Bottom;
dataGridView.Location = new Point(0, 50);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(523, 288);
dataGridView.TabIndex = 2;
DataGridView.AllowUserToAddRows = false;
DataGridView.AllowUserToDeleteRows = false;
DataGridView.AllowUserToOrderColumns = true;
DataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShop, ColumnRepair, ColumnCount });
DataGridView.Dock = DockStyle.Bottom;
DataGridView.Location = new Point(0, 50);
DataGridView.Margin = new Padding(3, 2, 3, 2);
DataGridView.Name = "DataGridView";
DataGridView.ReadOnly = true;
DataGridView.RowHeadersWidth = 51;
DataGridView.RowTemplate.Height = 29;
DataGridView.Size = new Size(523, 288);
DataGridView.TabIndex = 2;
//
// ColumnShop
//
@ -94,20 +94,20 @@
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(523, 338);
Controls.Add(buttonSaveToExcel);
Controls.Add(dataGridView);
Controls.Add(SaveToExcelButton);
Controls.Add(DataGridView);
Margin = new Padding(3, 2, 3, 2);
Name = "FormReportShop";
Text = "Загруженность магазинов";
Load += FormReportShop_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Button buttonSaveToExcel;
private DataGridView dataGridView;
private Button SaveToExcelButton;
private DataGridView DataGridView;
private DataGridViewTextBoxColumn ColumnShop;
private DataGridViewTextBoxColumn ColumnRepair;
private DataGridViewTextBoxColumn ColumnCount;

View File

@ -24,19 +24,19 @@ namespace AutoWorkshopView.Forms
var Shops = _logic.GetShops();
if (Shops != null)
{
dataGridView.Rows.Clear();
DataGridView.Rows.Clear();
foreach (var Shop in Shops)
{
dataGridView.Rows.Add(new object[] { Shop.ShopName, "", "" });
DataGridView.Rows.Add(new object[] { Shop.ShopName, "", "" });
foreach (var Repair in Shop.Repairs)
{
dataGridView.Rows.Add(new object[] { "", Repair.Item1, Repair.Item2 });
DataGridView.Rows.Add(new object[] { "", Repair.Item1, Repair.Item2 });
}
dataGridView.Rows.Add(new object[] { "Итого", "", Shop.TotalCount });
dataGridView.Rows.Add(Array.Empty<object>());
DataGridView.Rows.Add(new object[] { "Итого", "", Shop.TotalCount });
DataGridView.Rows.Add(Array.Empty<object>());
}
}

View File

@ -37,9 +37,12 @@
TransactionToolStripMenuItem = new ToolStripMenuItem();
SaleToolStripMenuItem = new ToolStripMenuItem();
ReportsToolStripMenuItem = new ToolStripMenuItem();
ComponentsToolStripMenuItem1 = new ToolStripMenuItem();
ComponentRepairToolStripMenuItem1 = new ToolStripMenuItem();
ReportRepairsToolStripMenuItem = new ToolStripMenuItem();
ReportRepCompToolStripMenuItem = new ToolStripMenuItem();
OrdersToolStripMenuItem = new ToolStripMenuItem();
ReportShopsToolStripMenuItem = new ToolStripMenuItem();
RepostBusyShopsToolStripMenuItem = new ToolStripMenuItem();
ReportGroupOrdersToolStripMenuItem = new ToolStripMenuItem();
DataGridView = new DataGridView();
CreateOrderButton = new Button();
TakeInWorkButton = new Button();
@ -71,21 +74,21 @@
// ComponentsStripMenuItem
//
ComponentsStripMenuItem.Name = "ComponentsStripMenuItem";
ComponentsStripMenuItem.Size = new Size(145, 22);
ComponentsStripMenuItem.Size = new Size(180, 22);
ComponentsStripMenuItem.Text = "Компоненты";
ComponentsStripMenuItem.Click += ComponentsStripMenuItem_Click;
//
// RepairStripMenuItem
//
RepairStripMenuItem.Name = "RepairStripMenuItem";
RepairStripMenuItem.Size = new Size(145, 22);
RepairStripMenuItem.Size = new Size(180, 22);
RepairStripMenuItem.Text = "Ремонты";
RepairStripMenuItem.Click += RepairsStripMenuItem_Click;
//
// ShopsToolStripMenuItem
//
ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
ShopsToolStripMenuItem.Size = new Size(145, 22);
ShopsToolStripMenuItem.Size = new Size(180, 22);
ShopsToolStripMenuItem.Text = "Магазины";
ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
//
@ -99,40 +102,65 @@
// TransactionToolStripMenuItem
//
TransactionToolStripMenuItem.Name = "TransactionToolStripMenuItem";
TransactionToolStripMenuItem.Size = new Size(125, 22);
TransactionToolStripMenuItem.Size = new Size(180, 22);
TransactionToolStripMenuItem.Text = "Поставка";
TransactionToolStripMenuItem.Click += TransactionToolStripMenuItem_Click;
//
// SaleToolStripMenuItem
//
SaleToolStripMenuItem.Name = "SaleToolStripMenuItem";
SaleToolStripMenuItem.Size = new Size(180, 22);
SaleToolStripMenuItem.Text = "Продажа";
SaleToolStripMenuItem.Click += SellToolStripMenuItem_Click;
//
// ReportsToolStripMenuItem
//
ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] {
ComponentsToolStripMenuItem1,
ComponentRepairToolStripMenuItem1,
OrdersToolStripMenuItem});
ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ReportRepairsToolStripMenuItem, ReportRepCompToolStripMenuItem, OrdersToolStripMenuItem, ReportShopsToolStripMenuItem, RepostBusyShopsToolStripMenuItem, ReportGroupOrdersToolStripMenuItem });
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
ReportsToolStripMenuItem.Size = new Size(60, 20);
ReportsToolStripMenuItem.Text = "Отчёты";
//
// ComponentsToolStripMenuItem1
// ReportRepairsToolStripMenuItem
//
ComponentsToolStripMenuItem1.Name = "ComponentsToolStripMenuItem1";
ComponentsToolStripMenuItem1.Size = new Size(205, 22);
ComponentsToolStripMenuItem1.Text = "Ремонты";
ComponentsToolStripMenuItem1.Click += new EventHandler(ComponentsToolStripMenuItem_Click);
ReportRepairsToolStripMenuItem.Name = "ReportRepairsToolStripMenuItem";
ReportRepairsToolStripMenuItem.Size = new Size(219, 22);
ReportRepairsToolStripMenuItem.Text = "Ремонты";
ReportRepairsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
//
// ComponentRepairToolStripMenuItem1
// ReportRepCompToolStripMenuItem
//
ComponentRepairToolStripMenuItem1.Name = "ComponentRepairToolStripMenuItem1";
ComponentRepairToolStripMenuItem1.Size = new Size(205, 22);
ComponentRepairToolStripMenuItem1.Text = "Ремонт с компонентами";
ComponentRepairToolStripMenuItem1.Click += new EventHandler(ComponentRepairToolStripMenuItem_Click);
ReportRepCompToolStripMenuItem.Name = "ReportRepCompToolStripMenuItem";
ReportRepCompToolStripMenuItem.Size = new Size(219, 22);
ReportRepCompToolStripMenuItem.Text = "Ремонт с компонентами";
ReportRepCompToolStripMenuItem.Click += ComponentRepairToolStripMenuItem_Click;
//
// OrdersToolStripMenuItem
//
OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
OrdersToolStripMenuItem.Size = new Size(205, 22);
OrdersToolStripMenuItem.Size = new Size(219, 22);
OrdersToolStripMenuItem.Text = "Заказы";
OrdersToolStripMenuItem.Click += new EventHandler(OrdersToolStripMenuItem_Click);
OrdersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
// ReportShopsToolStripMenuItem
//
ReportShopsToolStripMenuItem.Name = "ReportShopsToolStripMenuItem";
ReportShopsToolStripMenuItem.Size = new Size(219, 22);
ReportShopsToolStripMenuItem.Text = "Список магазинов";
ReportShopsToolStripMenuItem.Click += ReportShopsToolStripMenuItem_Click;
//
// RepostBusyShopsToolStripMenuItem
//
RepostBusyShopsToolStripMenuItem.Name = "RepostBusyShopsToolStripMenuItem";
RepostBusyShopsToolStripMenuItem.Size = new Size(219, 22);
RepostBusyShopsToolStripMenuItem.Text = "Загруженность магазинов";
RepostBusyShopsToolStripMenuItem.Click += ReportBusyShopsToolStripMenuItem_Click;
//
// ReportGroupOrdersToolStripMenuItem
//
ReportGroupOrdersToolStripMenuItem.Name = "ReportGroupOrdersToolStripMenuItem";
ReportGroupOrdersToolStripMenuItem.Size = new Size(219, 22);
ReportGroupOrdersToolStripMenuItem.Text = "Объединенные заказы";
ReportGroupOrdersToolStripMenuItem.Click += ReportGroupOrdersToolStripMenuItem_Click;
//
// DataGridView
//
@ -201,13 +229,6 @@
RefreshButton.UseVisualStyleBackColor = true;
RefreshButton.Click += RefreshButton_Click;
//
// SaleToolStripMenuItem
//
SaleToolStripMenuItem.Name = "SaleToolStripMenuItem";
SaleToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
SaleToolStripMenuItem.Text = "Продажа";
SaleToolStripMenuItem.Click += new System.EventHandler(SellToolStripMenuItem_Click);
//
// MainForm
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -249,8 +270,11 @@
private ToolStripMenuItem TransactionToolStripMenuItem;
private ToolStripMenuItem SaleToolStripMenuItem;
private ToolStripMenuItem ReportsToolStripMenuItem;
private ToolStripMenuItem ComponentsToolStripMenuItem1;
private ToolStripMenuItem ComponentRepairToolStripMenuItem1;
private ToolStripMenuItem ReportRepairsToolStripMenuItem;
private ToolStripMenuItem ReportRepCompToolStripMenuItem;
private ToolStripMenuItem OrdersToolStripMenuItem;
private ToolStripMenuItem ReportShopsToolStripMenuItem;
private ToolStripMenuItem RepostBusyShopsToolStripMenuItem;
private ToolStripMenuItem ReportGroupOrdersToolStripMenuItem;
}
}

View File

@ -230,7 +230,7 @@ namespace AutoWorkshopView
}
}
private void InfoToolStripMenuItem_Click(object sender, EventArgs e)
private void ReportShopsToolStripMenuItem_Click(object sender, EventArgs e)
{
using var Dialog = new SaveFileDialog { Filter = "docx|*.docx" };
@ -241,7 +241,7 @@ namespace AutoWorkshopView
}
}
private void BusyShopsToolStripMenuItem_Click(object sender, EventArgs e)
private void ReportBusyShopsToolStripMenuItem_Click(object sender, EventArgs e)
{
var Service = Program.ServiceProvider?.GetService(typeof(FormReportShop));
@ -251,7 +251,7 @@ namespace AutoWorkshopView
}
}
private void GroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
private void ReportGroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var Service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));

View File

@ -47,11 +47,11 @@ namespace AutoWorkshopView
Services.AddTransient<IOrderLogic, OrderLogic>();
Services.AddTransient<IRepairLogic, RepairLogic>();
Services.AddTransient<IReportLogic, ReportLogic>();
Services.AddTransient<IShopLogic, ShopLogic>();
Services.AddTransient<AbstractSaveToWord, SaveToWord>();
Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
Services.AddTransient<IShopLogic, ShopLogic>();
Services.AddTransient<MainForm>();
Services.AddTransient<FormComponent>();