fix pdf и формы
This commit is contained in:
parent
450a1d6313
commit
fbb8838012
@ -31,10 +31,6 @@
|
|||||||
this.panel = new System.Windows.Forms.Panel();
|
this.panel = new System.Windows.Forms.Panel();
|
||||||
this.buttonToPdf = new System.Windows.Forms.Button();
|
this.buttonToPdf = new System.Windows.Forms.Button();
|
||||||
this.buttonMake = new System.Windows.Forms.Button();
|
this.buttonMake = new System.Windows.Forms.Button();
|
||||||
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.labelTo = new System.Windows.Forms.Label();
|
|
||||||
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.labelFrom = new System.Windows.Forms.Label();
|
|
||||||
this.panel.SuspendLayout();
|
this.panel.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -42,24 +38,20 @@
|
|||||||
//
|
//
|
||||||
this.panel.Controls.Add(this.buttonToPdf);
|
this.panel.Controls.Add(this.buttonToPdf);
|
||||||
this.panel.Controls.Add(this.buttonMake);
|
this.panel.Controls.Add(this.buttonMake);
|
||||||
this.panel.Controls.Add(this.dateTimePickerTo);
|
|
||||||
this.panel.Controls.Add(this.labelTo);
|
|
||||||
this.panel.Controls.Add(this.dateTimePickerFrom);
|
|
||||||
this.panel.Controls.Add(this.labelFrom);
|
|
||||||
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.panel.Location = new System.Drawing.Point(0, 0);
|
this.panel.Location = new System.Drawing.Point(0, 0);
|
||||||
this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
this.panel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||||
this.panel.Name = "panel";
|
this.panel.Name = "panel";
|
||||||
this.panel.Size = new System.Drawing.Size(1031, 40);
|
this.panel.Size = new System.Drawing.Size(1178, 53);
|
||||||
this.panel.TabIndex = 0;
|
this.panel.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// buttonToPdf
|
// buttonToPdf
|
||||||
//
|
//
|
||||||
this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonToPdf.Location = new System.Drawing.Point(878, 8);
|
this.buttonToPdf.Location = new System.Drawing.Point(1003, 11);
|
||||||
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||||
this.buttonToPdf.Name = "buttonToPdf";
|
this.buttonToPdf.Name = "buttonToPdf";
|
||||||
this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
|
this.buttonToPdf.Size = new System.Drawing.Size(159, 36);
|
||||||
this.buttonToPdf.TabIndex = 5;
|
this.buttonToPdf.TabIndex = 5;
|
||||||
this.buttonToPdf.Text = "В Pdf";
|
this.buttonToPdf.Text = "В Pdf";
|
||||||
this.buttonToPdf.UseVisualStyleBackColor = true;
|
this.buttonToPdf.UseVisualStyleBackColor = true;
|
||||||
@ -67,63 +59,26 @@
|
|||||||
//
|
//
|
||||||
// buttonMake
|
// buttonMake
|
||||||
//
|
//
|
||||||
this.buttonMake.Location = new System.Drawing.Point(476, 8);
|
this.buttonMake.Location = new System.Drawing.Point(544, 11);
|
||||||
this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
this.buttonMake.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||||
this.buttonMake.Name = "buttonMake";
|
this.buttonMake.Name = "buttonMake";
|
||||||
this.buttonMake.Size = new System.Drawing.Size(139, 27);
|
this.buttonMake.Size = new System.Drawing.Size(159, 36);
|
||||||
this.buttonMake.TabIndex = 4;
|
this.buttonMake.TabIndex = 4;
|
||||||
this.buttonMake.Text = "Сформировать";
|
this.buttonMake.Text = "Сформировать";
|
||||||
this.buttonMake.UseVisualStyleBackColor = true;
|
this.buttonMake.UseVisualStyleBackColor = true;
|
||||||
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
||||||
//
|
//
|
||||||
// dateTimePickerTo
|
// FormReportGroupOrders
|
||||||
//
|
//
|
||||||
this.dateTimePickerTo.Location = new System.Drawing.Point(237, 7);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
|
||||||
this.dateTimePickerTo.Size = new System.Drawing.Size(163, 23);
|
|
||||||
this.dateTimePickerTo.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// labelTo
|
|
||||||
//
|
|
||||||
this.labelTo.AutoSize = true;
|
|
||||||
this.labelTo.Location = new System.Drawing.Point(208, 10);
|
|
||||||
this.labelTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.labelTo.Name = "labelTo";
|
|
||||||
this.labelTo.Size = new System.Drawing.Size(21, 15);
|
|
||||||
this.labelTo.TabIndex = 2;
|
|
||||||
this.labelTo.Text = "по";
|
|
||||||
//
|
|
||||||
// dateTimePickerFrom
|
|
||||||
//
|
|
||||||
this.dateTimePickerFrom.Location = new System.Drawing.Point(37, 7);
|
|
||||||
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
|
||||||
this.dateTimePickerFrom.Size = new System.Drawing.Size(163, 23);
|
|
||||||
this.dateTimePickerFrom.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelFrom
|
|
||||||
//
|
|
||||||
this.labelFrom.AutoSize = true;
|
|
||||||
this.labelFrom.Location = new System.Drawing.Point(14, 10);
|
|
||||||
this.labelFrom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.labelFrom.Name = "labelFrom";
|
|
||||||
this.labelFrom.Size = new System.Drawing.Size(15, 15);
|
|
||||||
this.labelFrom.TabIndex = 0;
|
|
||||||
this.labelFrom.Text = "С";
|
|
||||||
//
|
|
||||||
// FormReportOrders
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1031, 647);
|
this.ClientSize = new System.Drawing.Size(1178, 863);
|
||||||
this.Controls.Add(this.panel);
|
this.Controls.Add(this.panel);
|
||||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||||
this.Name = "FormReportOrders";
|
this.Name = "FormReportGroupOrders";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Заказы";
|
this.Text = "Заказы";
|
||||||
this.panel.ResumeLayout(false);
|
this.panel.ResumeLayout(false);
|
||||||
this.panel.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -133,9 +88,5 @@
|
|||||||
private System.Windows.Forms.Panel panel;
|
private System.Windows.Forms.Panel panel;
|
||||||
private System.Windows.Forms.Button buttonToPdf;
|
private System.Windows.Forms.Button buttonToPdf;
|
||||||
private System.Windows.Forms.Button buttonMake;
|
private System.Windows.Forms.Button buttonMake;
|
||||||
private System.Windows.Forms.DateTimePicker dateTimePickerTo;
|
|
||||||
private System.Windows.Forms.Label labelTo;
|
|
||||||
private System.Windows.Forms.DateTimePicker dateTimePickerFrom;
|
|
||||||
private System.Windows.Forms.Label labelFrom;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,27 +30,14 @@ namespace PrecastConcretePlant
|
|||||||
|
|
||||||
private void ButtonMake_Click(object sender, EventArgs e)
|
private void ButtonMake_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dataSource = _logic.GetGroupOrders(new ReportBindingModel
|
var dataSource = _logic.GetGroupOrders();
|
||||||
{
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
|
||||||
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
reportViewer.RefreshReport();
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
_logger.LogInformation("Загрузка списка заказов на весь период по датам");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -61,23 +48,16 @@ namespace PrecastConcretePlant
|
|||||||
|
|
||||||
private void ButtonToPdf_Click(object sender, EventArgs e)
|
private void ButtonToPdf_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
_logic.SaveGroupOrdersToPdfFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = dialog.FileName,
|
FileName = dialog.FileName
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
});
|
||||||
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
_logger.LogInformation("Сохранение списка заказов на весь период по датам");
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<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
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<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
|
|
||||||
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
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
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
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
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
|
|
||||||
: 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
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
463
PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc
Normal file
463
PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc
Normal file
@ -0,0 +1,463 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||||
|
<AutoRefresh>0</AutoRefresh>
|
||||||
|
<DataSources>
|
||||||
|
<DataSource Name="ConfectioneryContractsViewModels">
|
||||||
|
<ConnectionProperties>
|
||||||
|
<DataProvider>System.Data.DataSet</DataProvider>
|
||||||
|
<ConnectString>/* Local Connection */</ConnectString>
|
||||||
|
</ConnectionProperties>
|
||||||
|
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||||
|
</DataSource>
|
||||||
|
</DataSources>
|
||||||
|
<DataSets>
|
||||||
|
<DataSet Name="DataSetOrders">
|
||||||
|
<Query>
|
||||||
|
<DataSourceName>ConfectioneryContractsViewModels</DataSourceName>
|
||||||
|
<CommandText>/* Local Query */</CommandText>
|
||||||
|
</Query>
|
||||||
|
<Fields>
|
||||||
|
<Field Name="Id">
|
||||||
|
<DataField>Id</DataField>
|
||||||
|
<rd:TypeName>System.Int32</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Date">
|
||||||
|
<DataField>Date</DataField>
|
||||||
|
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Count">
|
||||||
|
<DataField>Count</DataField>
|
||||||
|
<rd:TypeName>System.Int32</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Sum">
|
||||||
|
<DataField>Sum</DataField>
|
||||||
|
<rd:TypeName>System.Double</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
</Fields>
|
||||||
|
<rd:DataSetInfo>
|
||||||
|
<rd:DataSetName>ConfectioneryContracts.ViewModels</rd:DataSetName>
|
||||||
|
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
||||||
|
<rd:ObjectDataSourceType>ConfectioneryContracts.ViewModels.ReportOrdersViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||||
|
</rd:DataSetInfo>
|
||||||
|
</DataSet>
|
||||||
|
</DataSets>
|
||||||
|
<ReportSections>
|
||||||
|
<ReportSection>
|
||||||
|
<Body>
|
||||||
|
<ReportItems>
|
||||||
|
<Textbox Name="ReportParameterPeriod">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
||||||
|
<Style>
|
||||||
|
<FontSize>14pt</FontSize>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
||||||
|
<Top>1cm</Top>
|
||||||
|
<Height>1cm</Height>
|
||||||
|
<Width>12.40104cm</Width>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="TextboxTitle">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Заказы</Value>
|
||||||
|
<Style>
|
||||||
|
<FontSize>16pt</FontSize>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Height>1cm</Height>
|
||||||
|
<Width>12.40104cm</Width>
|
||||||
|
<ZIndex>1</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Tablix Name="Tablix1">
|
||||||
|
<TablixBody>
|
||||||
|
<TablixColumns>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.21438cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.53188cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>4.35209cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
</TablixColumns>
|
||||||
|
<TablixRows>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox1">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Дата создания</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox1</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="Textbox3">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Количество заказов</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox3</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">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Сумма</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox7</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>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Date">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Date.Value</Value>
|
||||||
|
<Style>
|
||||||
|
<Format>d</Format>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Date</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="Count">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Count.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Count</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">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Sum.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Sum</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>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
</TablixRows>
|
||||||
|
</TablixBody>
|
||||||
|
<TablixColumnHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixColumnHierarchy>
|
||||||
|
<TablixRowHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember>
|
||||||
|
<KeepWithGroup>After</KeepWithGroup>
|
||||||
|
</TablixMember>
|
||||||
|
<TablixMember>
|
||||||
|
<Group Name="Подробности" />
|
||||||
|
</TablixMember>
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixRowHierarchy>
|
||||||
|
<DataSetName>DataSetOrders</DataSetName>
|
||||||
|
<Top>2.48391cm</Top>
|
||||||
|
<Left>0.55245cm</Left>
|
||||||
|
<Height>1.2cm</Height>
|
||||||
|
<Width>11.09835cm</Width>
|
||||||
|
<ZIndex>2</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>Double</Style>
|
||||||
|
</Border>
|
||||||
|
</Style>
|
||||||
|
</Tablix>
|
||||||
|
<Textbox Name="TextboxTotalSum">
|
||||||
|
<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>
|
||||||
|
<Top>4cm</Top>
|
||||||
|
<Left>6.6508cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>3</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="SumTotal">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Right</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Top>4cm</Top>
|
||||||
|
<Left>9.1508cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>4</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</ReportItems>
|
||||||
|
<Height>5.72875cm</Height>
|
||||||
|
<Style />
|
||||||
|
</Body>
|
||||||
|
<Width>12.40104cm</Width>
|
||||||
|
<Page>
|
||||||
|
<PageHeight>29.7cm</PageHeight>
|
||||||
|
<PageWidth>21cm</PageWidth>
|
||||||
|
<LeftMargin>2cm</LeftMargin>
|
||||||
|
<RightMargin>2cm</RightMargin>
|
||||||
|
<TopMargin>2cm</TopMargin>
|
||||||
|
<BottomMargin>2cm</BottomMargin>
|
||||||
|
<ColumnSpacing>0.13cm</ColumnSpacing>
|
||||||
|
<Style />
|
||||||
|
</Page>
|
||||||
|
</ReportSection>
|
||||||
|
</ReportSections>
|
||||||
|
<ReportParameters>
|
||||||
|
<ReportParameter Name="ReportParameterPeriod">
|
||||||
|
<DataType>String</DataType>
|
||||||
|
<Nullable>true</Nullable>
|
||||||
|
<Prompt>ReportParameter1</Prompt>
|
||||||
|
</ReportParameter>
|
||||||
|
</ReportParameters>
|
||||||
|
<ReportParametersLayout>
|
||||||
|
<GridLayoutDefinition>
|
||||||
|
<NumberOfColumns>4</NumberOfColumns>
|
||||||
|
<NumberOfRows>2</NumberOfRows>
|
||||||
|
<CellDefinitions>
|
||||||
|
<CellDefinition>
|
||||||
|
<ColumnIndex>0</ColumnIndex>
|
||||||
|
<RowIndex>0</RowIndex>
|
||||||
|
<ParameterName>ReportParameterPeriod</ParameterName>
|
||||||
|
</CellDefinition>
|
||||||
|
</CellDefinitions>
|
||||||
|
</GridLayoutDefinition>
|
||||||
|
</ReportParametersLayout>
|
||||||
|
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||||
|
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
|
||||||
|
</Report>
|
@ -98,7 +98,7 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToPdf.CreateDocOrders(new PdfInfoOrders
|
_saveToPdf.CreateReportDateDoc(new PdfInfoOrders
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список заказов",
|
Title = "Список заказов",
|
||||||
@ -138,11 +138,9 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
public List<ReportGroupOrdersViewModel> GetGroupOrders(ReportBindingModel model)
|
public List<ReportGroupOrdersViewModel> GetGroupOrders()
|
||||||
{
|
{
|
||||||
return _orderStorage.GetFullList()
|
return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportGroupOrdersViewModel
|
||||||
.GroupBy(x => x.DateCreate.Date)
|
|
||||||
.Select(x => new ReportGroupOrdersViewModel
|
|
||||||
{
|
{
|
||||||
Date = x.Key,
|
Date = x.Key,
|
||||||
Count = x.Count(),
|
Count = x.Count(),
|
||||||
@ -163,13 +161,11 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
public void SaveGroupOrdersToPdfFile(ReportBindingModel model)
|
public void SaveGroupOrdersToPdfFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToPdf.CreateDoc(new PdfInfo
|
_saveToPdf.CreateReportDateDoc(new PdfInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список сгруппированных заказов по датам",
|
Title = "Заказы по датам",
|
||||||
DateFrom = model.DateFrom!.Value,
|
DateOrders = GetGroupOrders()
|
||||||
DateTo = model.DateTo!.Value,
|
|
||||||
Orders = GetGroupOrders(model)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,40 +21,6 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateTable(new List<string> { "3cm", "4cm", "5cm" });
|
|
||||||
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "Дата", "Количество", "Сумма" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var order in info.Orders)
|
|
||||||
{
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { order.Date.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
||||||
});
|
|
||||||
}
|
|
||||||
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
|
|
||||||
|
|
||||||
SavePdf(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateDocOrders(PdfInfoOrders info)
|
|
||||||
{
|
|
||||||
CreatePdf(info);
|
|
||||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
|
||||||
|
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
@ -78,14 +44,70 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
SavePdf(info);
|
SavePdf(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CreateReportDateDoc(PdfInfo info)
|
||||||
|
{
|
||||||
|
CreatePdf(info);
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = info.Title,
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateTable(new List<string> { "3cm", "3cm", "7cm" });
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Дата", "Количество", "Сумма" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var order in info.DateOrders)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { order.Date.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
}
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"Итого: {info.DateOrders.Sum(x => x.Sum)}\t",
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
SavePdf(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создание doc-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
protected abstract void CreatePdf(PdfInfo info);
|
protected abstract void CreatePdf(PdfInfo info);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создание параграфа с текстом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="style"></param>
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создание таблицы
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="style"></param>
|
||||||
protected abstract void CreateTable(List<string> columns);
|
protected abstract void CreateTable(List<string> columns);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создание и заполнение строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rowParameters"></param>
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
protected abstract void SavePdf(PdfInfo info);
|
protected abstract void SavePdf(PdfInfo info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
|||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public DateTime DateFrom { get; set; }
|
public DateTime DateFrom { get; set; }
|
||||||
public DateTime DateTo { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
public List<ReportGroupOrdersViewModel> Orders { get; set; } = new();
|
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
||||||
|
public List<ReportGroupOrdersViewModel> DateOrders { get; set; } = new();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,6 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
|||||||
Title = orders.Title
|
Title = orders.Title
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
public List<ReportGroupOrdersViewModel> DateOrders { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,12 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
public class SaveToPdf : AbstractSaveToPdf
|
public class SaveToPdf : AbstractSaveToPdf
|
||||||
{
|
{
|
||||||
private Document? _document;
|
private Document? _document;
|
||||||
|
|
||||||
private Section? _section;
|
private Section? _section;
|
||||||
|
|
||||||
private Table? _table;
|
private Table? _table;
|
||||||
private static ParagraphAlignment
|
|
||||||
GetParagraphAlignment(PdfParagraphAlignmentType type)
|
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||||
{
|
{
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
@ -29,21 +31,29 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
_ => ParagraphAlignment.Justify,
|
_ => ParagraphAlignment.Justify,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// Создание стилей для документа
|
/// Создание стилей для документа
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="document"></param>
|
||||||
private static void DefineStyles(Document document)
|
private static void DefineStyles(Document document)
|
||||||
{
|
{
|
||||||
var style = document.Styles["Normal"];
|
var style = document.Styles["Normal"];
|
||||||
style.Font.Name = "Times New Roman";
|
style.Font.Name = "Times New Roman";
|
||||||
style.Font.Size = 14;
|
style.Font.Size = 14;
|
||||||
|
|
||||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||||
style.Font.Bold = true;
|
style.Font.Bold = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreatePdf(PdfInfo info)
|
protected override void CreatePdf(PdfInfo info)
|
||||||
{
|
{
|
||||||
_document = new Document();
|
_document = new Document();
|
||||||
DefineStyles(_document);
|
DefineStyles(_document);
|
||||||
|
|
||||||
_section = _document.AddSection();
|
_section = _document.AddSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
||||||
{
|
{
|
||||||
if (_section == null)
|
if (_section == null)
|
||||||
@ -55,6 +65,7 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||||
paragraph.Style = pdfParagraph.Style;
|
paragraph.Style = pdfParagraph.Style;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateTable(List<string> columns)
|
protected override void CreateTable(List<string> columns)
|
||||||
{
|
{
|
||||||
if (_document == null)
|
if (_document == null)
|
||||||
@ -62,11 +73,13 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_table = _document.LastSection.AddTable();
|
_table = _document.LastSection.AddTable();
|
||||||
|
|
||||||
foreach (var elem in columns)
|
foreach (var elem in columns)
|
||||||
{
|
{
|
||||||
_table.AddColumn(elem);
|
_table.AddColumn(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateRow(PdfRowParameters rowParameters)
|
protected override void CreateRow(PdfRowParameters rowParameters)
|
||||||
{
|
{
|
||||||
if (_table == null)
|
if (_table == null)
|
||||||
@ -77,19 +90,24 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||||
{
|
{
|
||||||
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(rowParameters.Style))
|
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||||
{
|
{
|
||||||
row.Cells[i].Style = rowParameters.Style;
|
row.Cells[i].Style = rowParameters.Style;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit borderWidth = 0.5;
|
Unit borderWidth = 0.5;
|
||||||
|
|
||||||
row.Cells[i].Borders.Left.Width = borderWidth;
|
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||||
row.Cells[i].Borders.Right.Width = borderWidth;
|
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||||
row.Cells[i].Borders.Top.Width = borderWidth;
|
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||||
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||||
|
|
||||||
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SavePdf(PdfInfo info)
|
protected override void SavePdf(PdfInfo info)
|
||||||
{
|
{
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
|
@ -13,7 +13,7 @@ namespace PrecastConcretePlantContracts.BusinessLogicsContracts
|
|||||||
List<ReportShopReinforcedViewModel> GetShopReinforcedies();
|
List<ReportShopReinforcedViewModel> GetShopReinforcedies();
|
||||||
List<ReportReinforcedComponentViewModel> GetReinforcedComponents();
|
List<ReportReinforcedComponentViewModel> GetReinforcedComponents();
|
||||||
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||||
List<ReportGroupOrdersViewModel> GetGroupOrders(ReportBindingModel model);
|
List<ReportGroupOrdersViewModel> GetGroupOrders();
|
||||||
void SaveReinforcedsToWordFile(ReportBindingModel model);
|
void SaveReinforcedsToWordFile(ReportBindingModel model);
|
||||||
void SaveReinforcedComponentToExcelFile(ReportBindingModel model);
|
void SaveReinforcedComponentToExcelFile(ReportBindingModel model);
|
||||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||||
|
@ -8,7 +8,6 @@ namespace PrecastConcretePlantContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportGroupOrdersViewModel
|
public class ReportGroupOrdersViewModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user