Compare commits

..

No commits in common. "c28980e199ccc05cebbcd2e5dcc4b8d6d253fea8" and "081175a0021b7747a4231b80299a0f3dffab9617" have entirely different histories.

7 changed files with 35 additions and 24 deletions

View File

@ -161,7 +161,8 @@ namespace SushiBar.Forms
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
var service =
Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();

View File

@ -50,13 +50,13 @@
panel.Dock = DockStyle.Top;
panel.Location = new Point(0, 0);
panel.Name = "panel";
panel.Size = new Size(1242, 51);
panel.Size = new Size(800, 51);
panel.TabIndex = 0;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(317, 19);
label2.Location = new Point(272, 19);
label2.Name = "label2";
label2.Size = new Size(27, 20);
label2.TabIndex = 5;
@ -65,7 +65,7 @@
// label1
//
label1.AutoSize = true;
label1.Location = new Point(39, 19);
label1.Location = new Point(22, 19);
label1.Name = "label1";
label1.Size = new Size(18, 20);
label1.TabIndex = 4;
@ -73,23 +73,23 @@
//
// dateTimePickerTo
//
dateTimePickerTo.Location = new Point(366, 14);
dateTimePickerTo.Location = new Point(320, 14);
dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(210, 27);
dateTimePickerTo.Size = new Size(192, 27);
dateTimePickerTo.TabIndex = 3;
//
// dateTimePickerFrom
//
dateTimePickerFrom.Location = new Point(73, 14);
dateTimePickerFrom.Location = new Point(61, 14);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(214, 27);
dateTimePickerFrom.Size = new Size(192, 27);
dateTimePickerFrom.TabIndex = 2;
//
// buttonToPdf
//
buttonToPdf.Location = new Point(1076, 10);
buttonToPdf.Location = new Point(694, 12);
buttonToPdf.Name = "buttonToPdf";
buttonToPdf.Size = new Size(154, 29);
buttonToPdf.Size = new Size(94, 29);
buttonToPdf.TabIndex = 1;
buttonToPdf.Text = "В PdF";
buttonToPdf.UseVisualStyleBackColor = true;
@ -97,7 +97,7 @@
//
// buttonMake
//
buttonMake.Location = new Point(916, 10);
buttonMake.Location = new Point(534, 12);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(154, 29);
buttonMake.TabIndex = 0;
@ -109,14 +109,14 @@
//
panelBody.Location = new Point(0, 57);
panelBody.Name = "panelBody";
panelBody.Size = new Size(1242, 515);
panelBody.Size = new Size(800, 393);
panelBody.TabIndex = 1;
//
// FormReportOrders
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1242, 575);
ClientSize = new Size(800, 450);
Controls.Add(panelBody);
Controls.Add(panel);
Name = "FormReportOrders";

View File

@ -29,14 +29,14 @@
<DataField>SushiName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>SushiBarDataModels.OrderStatus</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>SushiBarContracts.ViewModels</rd:DataSetName>

View File

@ -1,5 +1,10 @@
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
using SushiBarBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage
{
@ -23,7 +28,7 @@ namespace SushiBarBusinessLogic.OfficePackage
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "4cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@ -35,7 +40,7 @@ namespace SushiBarBusinessLogic.OfficePackage
order.Id.ToString(),
order.DateCreate.ToShortDateString(),
order.SushiName,
$"{order.Sum:C2}",
order.Sum.ToString(),
order.OrderStatus.ToString()
},
Style = "Normal",
@ -44,7 +49,7 @@ namespace SushiBarBusinessLogic.OfficePackage
}
CreateParagraph(new PdfParagraph
{
Text = $"Итого: {info.Orders.Sum(x => x.Sum):C2}\t",
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
});

View File

@ -1,4 +1,10 @@
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
{
public enum PdfParagraphAlignmentType
{

View File

@ -12,7 +12,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
private Section? _section;
private Table? _table;
private static ParagraphAlignment
GetParagraphAlignment(PdfParagraphAlignmentType type)
GetParagraphAlignment(PdfParagraphAlignmentType type)
{
return type switch
{

View File

@ -8,9 +8,8 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="DocumentFormat.OpenXml.Framework" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="MigraDoc.Rendering.Standard" Version="1.0.10" />
</ItemGroup>
<ItemGroup>