Реализовано сохранение статуса заказов в 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, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
SecureName = x.SecureName, SecureName = x.SecureName,
Status = x.Status.ToString(),
Sum = x.Sum Sum = x.Sum
}) })
.ToList(); .ToList();

View File

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

View File

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

View File

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

View File

@ -29,6 +29,10 @@
<DataField>SecureName</DataField> <DataField>SecureName</DataField>
<rd:TypeName>System.String</rd:TypeName> <rd:TypeName>System.String</rd:TypeName>
</Field> </Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum"> <Field Name="Sum">
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Decimal</rd:TypeName>
@ -116,16 +120,19 @@
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>1.39933cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>3.21438cm</Width> <Width>3.21438cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>8.23317cm</Width> <Width>9.18567cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.64817cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.47367cm</Width>
</TablixColumn> </TablixColumn>
</TablixColumns> </TablixColumns>
<TablixRows> <TablixRows>
@ -228,6 +235,40 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </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> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox7"> <Textbox Name="Textbox7">
@ -243,7 +284,9 @@
</Style> </Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox7</rd:DefaultName> <rd:DefaultName>Textbox7</rd:DefaultName>
@ -357,6 +400,38 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </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> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Sum"> <Textbox Name="Sum">
@ -370,7 +445,9 @@
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName> <rd:DefaultName>Sum</rd:DefaultName>
@ -397,6 +474,7 @@
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember />
</TablixMembers> </TablixMembers>
</TablixColumnHierarchy> </TablixColumnHierarchy>
<TablixRowHierarchy> <TablixRowHierarchy>
@ -413,7 +491,7 @@
<Top>2.48391cm</Top> <Top>2.48391cm</Top>
<Left>0.55245cm</Left> <Left>0.55245cm</Left>
<Height>1.2cm</Height> <Height>1.2cm</Height>
<Width>16.44755cm</Width> <Width>19.92122cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>
@ -440,7 +518,7 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>4cm</Top> <Top>4cm</Top>
<Left>12cm</Left> <Left>14.5cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>3</ZIndex> <ZIndex>3</ZIndex>
@ -473,9 +551,9 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>4cm</Top> <Top>4cm</Top>
<Left>14.5cm</Left> <Left>17cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>3.47367cm</Width>
<ZIndex>4</ZIndex> <ZIndex>4</ZIndex>
<Style> <Style>
<Border> <Border>