Реализовано сохранение статуса заказов в PDF и в отчете

This commit is contained in:
Никита Потапов 2024-03-24 22:50:41 +04:00
parent 9f481f8879
commit 464cebeb0f
5 changed files with 98 additions and 14 deletions

View File

@ -71,6 +71,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogics
Id = x.Id,
DateCreate = x.DateCreate,
SecureName = x.SecureName,
Status = x.Status.ToString(),
Sum = x.Sum
})
.ToList();

View File

@ -20,10 +20,10 @@ namespace SecuritySystemBusinessLogic.OfficePackage
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@ -31,7 +31,7 @@ namespace SecuritySystemBusinessLogic.OfficePackage
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SecureName, order.Sum.ToString() },
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SecureName, order.Status.ToString(), order.Sum.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});

View File

@ -5,6 +5,7 @@
public int Id { get; set; }
public DateTime DateCreate { get; set; }
public string SecureName { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public double Sum { get; set; }
}
}

View File

@ -70,11 +70,15 @@ namespace SecuritySystemView.Report
{
try
{
DateTime dateFrom = dateTimePickerFrom.Value;
DateTime dateTo = dateTimePickerTo.Value;
dateFrom = new DateTime(dateFrom.Year, dateFrom.Month, dateFrom.Day, 0, 0, 0);
dateTo = new DateTime(dateTo.Year, dateTo.Month, dateTo.Day, 23, 59, 59);
_logic.SaveOrdersToPdfFile(new ReportBindingModel
{
FileName = dialog.FileName,
DateFrom = dateTimePickerFrom.Value,
DateTo = dateTimePickerTo.Value
DateFrom = dateFrom,
DateTo = dateTo
});
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@ -29,6 +29,10 @@
<DataField>SecureName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
@ -116,16 +120,19 @@
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>2.5cm</Width>
<Width>1.39933cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>8.23317cm</Width>
<Width>9.18567cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
<Width>2.64817cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.47367cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
@ -228,6 +235,40 @@
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox7">
@ -243,7 +284,9 @@
</Style>
</TextRun>
</TextRuns>
<Style />
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox7</rd:DefaultName>
@ -357,6 +400,38 @@
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Status">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Status.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Status</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Sum">
@ -370,7 +445,9 @@
<Style />
</TextRun>
</TextRuns>
<Style />
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName>
@ -397,6 +474,7 @@
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
@ -413,7 +491,7 @@
<Top>2.48391cm</Top>
<Left>0.55245cm</Left>
<Height>1.2cm</Height>
<Width>16.44755cm</Width>
<Width>19.92122cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
@ -440,7 +518,7 @@
</Paragraph>
</Paragraphs>
<Top>4cm</Top>
<Left>12cm</Left>
<Left>14.5cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<ZIndex>3</ZIndex>
@ -473,9 +551,9 @@
</Paragraph>
</Paragraphs>
<Top>4cm</Top>
<Left>14.5cm</Left>
<Left>17cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<Width>3.47367cm</Width>
<ZIndex>4</ZIndex>
<Style>
<Border>