Добавлена реализация сохранения магазинов в pdf-file

This commit is contained in:
Данияр Аглиуллов 2023-03-02 04:28:14 +04:00
parent a6715682eb
commit 4a2b2a009b
5 changed files with 36 additions and 175 deletions

View File

@ -18,11 +18,11 @@ namespace ConfectioneryBusinessLogic.OfficePackage
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center }); ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" }); CreateTable(new List<string> { "3cm", "4cm", "5cm" });
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 ConfectioneryBusinessLogic.OfficePackage
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PastryName, Convert.ToString(order.OrderStatus), order.Sum.ToString() }, Texts = new List<string> { order.Date.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });

View File

@ -76,16 +76,15 @@ namespace ConfectioneryBusinessLogic
/// <returns></returns> /// <returns></returns>
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model) public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
{ {
return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo }) return _orderStorage.GetFullList()
.Select(x => new ReportOrdersViewModel .GroupBy(x => x.DateCreate.Date)
{ .Select(x => new ReportOrdersViewModel
Id = x.Id, {
DateCreate = x.DateCreate, Date = x.Key,
PastryName = x.PastryName, Count = x.Count(),
OrderStatus = Convert.ToString(x.Status) ?? string.Empty, Sum = x.Sum(y => y.Sum)
Sum = x.Sum }).ToList();
})
.ToList();
} }
/// <summary> /// <summary>

View File

@ -28,7 +28,7 @@
<ItemGroup> <ItemGroup>
<None Update="ReportOrders.rdlc"> <None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

View File

@ -21,21 +21,17 @@
<DataField>Id</DataField> <DataField>Id</DataField>
<rd:TypeName>System.Int32</rd:TypeName> <rd:TypeName>System.Int32</rd:TypeName>
</Field> </Field>
<Field Name="DateCreate"> <Field Name="Date">
<DataField>DateCreate</DataField> <DataField>Date</DataField>
<rd:TypeName>System.DateTime</rd:TypeName> <rd:TypeName>System.DateTime</rd:TypeName>
</Field> </Field>
<Field Name="PastryName"> <Field Name="Count">
<DataField>PastryName</DataField> <DataField>Count</DataField>
<rd:TypeName>System.String</rd:TypeName> <rd:TypeName>System.Int32</rd:TypeName>
</Field> </Field>
<Field Name="Sum"> <Field Name="Sum">
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>ConfectioneryDataModels.OrderStatus</rd:TypeName>
</Field> </Field>
</Fields> </Fields>
<rd:DataSetInfo> <rd:DataSetInfo>
@ -71,7 +67,7 @@
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName> <rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Top>1cm</Top> <Top>1cm</Top>
<Height>1cm</Height> <Height>1cm</Height>
<Width>21cm</Width> <Width>12.40104cm</Width>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@ -103,7 +99,7 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Height>1cm</Height> <Height>1cm</Height>
<Width>21cm</Width> <Width>12.40104cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
@ -119,58 +115,20 @@
<Tablix Name="Tablix1"> <Tablix Name="Tablix1">
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn> <TablixColumn>
<Width>3.21438cm</Width> <Width>3.21438cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>8.23317cm</Width> <Width>3.53188cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>3.02917cm</Width> <Width>4.35209cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.87042cm</Width>
</TablixColumn> </TablixColumn>
</TablixColumns> </TablixColumns>
<TablixRows> <TablixRows>
<TablixRow> <TablixRow>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<TablixCells> <TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Номер</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</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="Textbox1"> <Textbox Name="Textbox1">
@ -212,7 +170,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Изделие</Value> <Value>Количество заказов</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -235,38 +193,6 @@
</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 />
</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">
@ -306,44 +232,14 @@
<TablixCells> <TablixCells>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Id"> <Textbox Name="Date">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!Id.Value</Value> <Value>=Fields!Date.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Id</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="DateCreate">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!DateCreate.Value</Value>
<Style> <Style>
<Format>d</Format> <Format>d</Format>
</Style> </Style>
@ -352,7 +248,7 @@
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>DateCreate</rd:DefaultName> <rd:DefaultName>Date</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -368,21 +264,21 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="PastryName"> <Textbox Name="Count">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!PastryName.Value</Value> <Value>=Fields!Count.Value</Value>
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>PastryName</rd:DefaultName> <rd:DefaultName>Count</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -396,37 +292,6 @@
</Textbox> </Textbox>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="OrderStatus">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!OrderStatus.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>OrderStatus</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>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Sum"> <Textbox Name="Sum">
@ -466,8 +331,6 @@
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers> </TablixMembers>
</TablixColumnHierarchy> </TablixColumnHierarchy>
<TablixRowHierarchy> <TablixRowHierarchy>
@ -484,7 +347,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>19.84713cm</Width> <Width>11.09835cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>
@ -511,7 +374,7 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>4cm</Top> <Top>4cm</Top>
<Left>15.39958cm</Left> <Left>6.6508cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>3</ZIndex> <ZIndex>3</ZIndex>
@ -544,7 +407,7 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>4cm</Top> <Top>4cm</Top>
<Left>17.89958cm</Left> <Left>9.1508cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>4</ZIndex> <ZIndex>4</ZIndex>
@ -562,7 +425,7 @@
<Height>5.72875cm</Height> <Height>5.72875cm</Height>
<Style /> <Style />
</Body> </Body>
<Width>21cm</Width> <Width>12.40104cm</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>

View File

@ -10,9 +10,8 @@ namespace ConfectioneryContracts.ViewModels
public class ReportOrdersViewModel public class ReportOrdersViewModel
{ {
public int Id { get; set; } public int Id { get; set; }
public DateTime DateCreate { get; set; } public DateTime Date { get; set; }
public string PastryName { get; set; } = string.Empty; public int Count { get; set; }
public string OrderStatus { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
} }
} }