Finished initial build of the back page generator. Unable to properly merge the two tables with Pechkin so far.

This commit is contained in:
2017-05-06 01:08:38 -05:00
parent 218d5be4d6
commit 15abab5f50
12 changed files with 958 additions and 645 deletions
+143
View File
@@ -0,0 +1,143 @@
namespace AdvertsingProfitControl
{
partial class AboutBox1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.okButton = new System.Windows.Forms.Button();
this.databaseVersionLabel = new System.Windows.Forms.Label();
this.labelProductVerion = new System.Windows.Forms.Label();
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.reportGeneratingVersionLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel.SuspendLayout();
this.SuspendLayout();
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.okButton.Location = new System.Drawing.Point(620, 442);
this.okButton.Margin = new System.Windows.Forms.Padding(6);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(138, 40);
this.okButton.TabIndex = 24;
this.okButton.Text = "&OK";
//
// databaseVersionLabel
//
this.databaseVersionLabel.BackColor = System.Drawing.Color.Transparent;
this.databaseVersionLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.databaseVersionLabel.Location = new System.Drawing.Point(11, 48);
this.databaseVersionLabel.Margin = new System.Windows.Forms.Padding(11, 0, 6, 0);
this.databaseVersionLabel.MaximumSize = new System.Drawing.Size(0, 31);
this.databaseVersionLabel.Name = "databaseVersionLabel";
this.databaseVersionLabel.Size = new System.Drawing.Size(747, 31);
this.databaseVersionLabel.TabIndex = 0;
this.databaseVersionLabel.Text = "Database Version:";
this.databaseVersionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelProductVerion
//
this.labelProductVerion.BackColor = System.Drawing.Color.Transparent;
this.labelProductVerion.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelProductVerion.Location = new System.Drawing.Point(11, 0);
this.labelProductVerion.Margin = new System.Windows.Forms.Padding(11, 0, 6, 0);
this.labelProductVerion.MaximumSize = new System.Drawing.Size(0, 31);
this.labelProductVerion.Name = "labelProductVerion";
this.labelProductVerion.Size = new System.Drawing.Size(747, 31);
this.labelProductVerion.TabIndex = 19;
this.labelProductVerion.Text = "Advertising Prodift Control Version:";
this.labelProductVerion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tableLayoutPanel
//
this.tableLayoutPanel.BackColor = System.Drawing.Color.Transparent;
this.tableLayoutPanel.ColumnCount = 1;
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel.Controls.Add(this.labelProductVerion, 0, 0);
this.tableLayoutPanel.Controls.Add(this.databaseVersionLabel, 0, 1);
this.tableLayoutPanel.Controls.Add(this.okButton, 0, 6);
this.tableLayoutPanel.Controls.Add(this.reportGeneratingVersionLabel, 0, 5);
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel.Location = new System.Drawing.Point(17, 17);
this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(6);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 7;
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel.Size = new System.Drawing.Size(764, 488);
this.tableLayoutPanel.TabIndex = 0;
//
// reportGeneratingVersionLabel
//
this.reportGeneratingVersionLabel.AutoSize = true;
this.reportGeneratingVersionLabel.Location = new System.Drawing.Point(3, 387);
this.reportGeneratingVersionLabel.Name = "reportGeneratingVersionLabel";
this.reportGeneratingVersionLabel.Size = new System.Drawing.Size(314, 25);
this.reportGeneratingVersionLabel.TabIndex = 25;
this.reportGeneratingVersionLabel.Text = "Report Generating Engine Version:";
//
// AboutBox1
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::AdvertsingProfitControl.Properties.Resources.Large_Allens_Icon_Template___Copy;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.ClientSize = new System.Drawing.Size(798, 522);
this.Controls.Add(this.tableLayoutPanel);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox1";
this.Padding = new System.Windows.Forms.Padding(17, 17, 17, 17);
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About Products";
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label databaseVersionLabel;
private System.Windows.Forms.Label labelProductVerion;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.Label reportGeneratingVersionLabel;
}
}
+19
View File
@@ -0,0 +1,19 @@
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
internal partial class AboutBox1 : Form
{
public AboutBox1()
{
InitializeComponent();
labelProductVerion.Text = $@"Advertising Profit Control Version: {Assembly.GetEntryAssembly().GetName().Version}";
var db = new AdvertisingProfitControlModel();
var version = db.Versions.SingleOrDefault(x => x.Id == 1);
databaseVersionLabel.Text = version == null ? @"Database Version: N/A" : $@"Database Version: {version.VersionNumber}";
reportGeneratingVersionLabel.Text = @"Report Generating Engine Version: 0.5.0.0 Alpha";
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -114,6 +114,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AboutBox1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutBox1.Designer.cs">
<DependentUpon>AboutBox1.cs</DependentUpon>
</Compile>
<Compile Include="ActualSale.cs" />
<Compile Include="AdItem.cs" />
<Compile Include="AdSpecial.cs" />
@@ -174,6 +180,12 @@
</Compile>
<Compile Include="Note.cs" />
<Compile Include="Projection.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ReportGenerator.cs" />
<Compile Include="Supplier.cs" />
<Compile Include="Taxable.cs" />
<Compile Include="TextFormat.cs" />
@@ -204,6 +216,9 @@
<Compile Include="Version.cs" />
<Compile Include="WeekEndingDate.cs" />
<Compile Include="WeeklySale.cs" />
<EmbeddedResource Include="AboutBox1.resx">
<DependentUpon>AboutBox1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DebugDatabaseConverter.resx">
<DependentUpon>DebugDatabaseConverter.cs</DependentUpon>
</EmbeddedResource>
@@ -239,14 +254,9 @@
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="AdvertsingProfitControl_TemporaryKey.pfx" />
<None Include="App.config" />
<None Include="app.manifest" />
@@ -292,6 +302,7 @@
<Content Include="mingwm10.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Resources\Large Allens Icon Template - Copy.png" />
<Content Include="ssleay32.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -300,6 +311,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -265,8 +265,8 @@
// helpMainMenu
//
this.helpMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showHideConsoleHelpMainMenu,
this.dbVersionHelpMainMenu,
this.showHideConsoleHelpMainMenu,
this.examineLogsToolStripMenuItem});
this.helpMainMenu.Name = "helpMainMenu";
this.helpMainMenu.Size = new System.Drawing.Size(68, 34);
@@ -284,8 +284,7 @@
this.dbVersionHelpMainMenu.Name = "dbVersionHelpMainMenu";
this.dbVersionHelpMainMenu.Size = new System.Drawing.Size(288, 34);
this.dbVersionHelpMainMenu.Text = "&Verison Information";
this.dbVersionHelpMainMenu.Visible = false;
this.dbVersionHelpMainMenu.Click += new System.EventHandler(this.DisplayDatabaseVersionNumber);
this.dbVersionHelpMainMenu.Click += new System.EventHandler(this.DisplayProductVersionNumbers);
//
// examineLogsToolStripMenuItem
//
+7 -20
View File
@@ -125,7 +125,7 @@ namespace AdvertsingProfitControl
grossProfitLessCostOfSales.Text = @"Less Cost of Sales: " + _totalInvoicePurchases.ToString("C");
var dollarGrossProfit = _departmentSales - _totalInvoicePurchases;
grossProfitDollarGrossProfitLabel.Text = @"Dollar Gross Profit: " + dollarGrossProfit.ToString("C");
var grossProfitPercent = dollarGrossProfit/_departmentSales;
var grossProfitPercent = dollarGrossProfit / _departmentSales;
perfectGrossProfitLabel.Text = @"Percent Gross Profit: " + grossProfitPercent.ToString("P");
}
@@ -266,18 +266,10 @@ namespace AdvertsingProfitControl
}
}
private void DisplayDatabaseVersionNumber(object sender, EventArgs e)
private void DisplayProductVersionNumbers(object sender, EventArgs e)
{
var db = new AdvertisingProfitControlModel();
var version = db.Versions.FirstOrDefault(x => x.Id == 1);
if (version == null)
{
MessageBox.Show(@"Failed to retrieve the version number of the SQL database", @"Database Version Number",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
MessageBox.Show(@"The current database's version is " + version.VersionNumber + @".", @"Database Version Number", MessageBoxButtons.OK, MessageBoxIcon.Information);
var form = new AboutBox1();
form.ShowDialog();
}
private void ViewLogFiles(object sender, EventArgs e)
@@ -377,8 +369,6 @@ namespace AdvertsingProfitControl
//var dialog = new FolderBrowserDialog();
//dialog.ShowDialog();
//var path = dialog.SelectedPath;
var gen = new FrontPageGenerator();
gen.BuildFormFrontCompressedLayout(_currentActiveDate);
//var pdf = gen.RenderHtmlCodeToImage(path + "\\FrontPage.html", path + "\\Image.pdf");
//var doc = new PrintDocument();
//doc.PrintPage += RenderPage;
@@ -394,8 +384,6 @@ namespace AdvertsingProfitControl
dialog.ShowDialog();
var path = dialog.SelectedPath;
var gen = new FrontPageGenerator();
var pdf = gen.RenderHtmlCodeToImage(path + "\\FrontPage.html", path + "\\Image.pdf");
e.Graphics.DrawString(pdf.ToString(), DefaultFont, new SolidBrush(Color.Black), 1000, 1000);
e.Graphics.PageUnit = GraphicsUnit.Inch;
}
@@ -1151,10 +1139,9 @@ namespace AdvertsingProfitControl
private void testToolStripMenuItem_Click(object sender, EventArgs e)
{
var page = new FrontPageGenerator();
page.RenderHtmlCodeToImage("C:\\Users\\Crypto\\Desktop\\TestPage.html",
"C:\\Users\\Crypto\\Desktop\\FrontTest.pdf");
var page = new ReportGenerator();
page.GeneratePdfReport(_currentActiveDate);
page.RenderHtmlCodeToImage("C:\\Users\\Crypto\\Desktop\\Full.html", "C:\\Users\\Crypto\\Desktop\\Full.pdf");
}
}
}
+8 -64
View File
@@ -4,7 +4,6 @@ using System.Windows.Forms;
using System.IO;
using System.Web.UI;
using System.Linq;
using System.Web.UI.WebControls;
using Pechkin;
namespace AdvertsingProfitControl
@@ -13,61 +12,8 @@ namespace AdvertsingProfitControl
{
FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
public void RenderHtmlToImage()
public void BuildReportFrontPage(DateTime date, ref HtmlTextWriter writer)
{
var htmlCode = File.ReadAllLines(Application.StartupPath + "\\FrontPage.html");
var code = "";
foreach (var line in htmlCode)
{
code = code + "\r\n" + line;
}
try
{
//var imageFromHtml = HtmlRender.RenderToImage(code);
//imageFromHtml.RotateFlip(RotateFlipType.Rotate90FlipNone);
//imageFromHtml.Save(Application.StartupPath + "\\FrontPage.png", ImageFormat.Png);
//imageFromHtml.Dispose();
}
catch (Exception e)
{
_console.WriteToLog(FrmLogConsole.Level.Critical,
"Failed to generate an updated image for the front page of Advertising Profit Control.");
_console.WriteToLog(FrmLogConsole.Level.Debug, e.Message);
_console.WriteToLog(FrmLogConsole.Level.Info,
"This is most likely a screw you from the GDI+ subsystem of Windows.");
}
}
public byte[] RenderHtmlCodeToImage(string path, string targetPath)
{
var htmlCode = File.ReadAllLines(path);
var code = htmlCode.Aggregate("", (current, line) => current + "\r\n" + line);
try
{
var config = new Pechkin.GlobalConfig().SetPaperSize(PaperKind.A4).SetPaperOrientation(true);
byte[] pdfBuf = new SimplePechkin(config).Convert(code);
using (var fs = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
{
fs.Write(pdfBuf, 0, pdfBuf.Length);
}
return pdfBuf;
}
catch (Exception e)
{
_console.WriteToLog(FrmLogConsole.Level.Critical,
"Failed to generate an updated image for the back page of Advertising Profit Control.");
_console.WriteToLog(FrmLogConsole.Level.Debug, e.Message);
_console.WriteToLog(FrmLogConsole.Level.Info, "This is most likely a screw you from the GDI+ subsystem of Windows.");
}
return new byte[1];
}
public void BuildFormFrontCompressedLayout(DateTime date)
{
var stringWriter = new StringWriter();
var writer = new HtmlTextWriter(stringWriter);
var db = new AdvertisingProfitControlModel();
var dateRecord = db.WeekEndingDates.SingleOrDefault(x => x.EndingDate == date);
if (dateRecord == null)
@@ -85,7 +31,7 @@ namespace AdvertsingProfitControl
writer.RenderEndTag();// end style
writer.RenderEndTag(); // end Head
writer.RenderBeginTag(HtmlTextWriterTag.Body);
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-collapse: collapse; width:100%; height:100%"); //style for the table
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-collapse: collapse; width:100%"); //style for the table
writer.RenderBeginTag(HtmlTextWriterTag.Table);
//Begin rendering the top rows, the form name, store, department and date fields.
writer.RenderBeginTag(HtmlTextWriterTag.Tr);//begin first row
@@ -345,14 +291,6 @@ namespace AdvertsingProfitControl
writer.RenderEndTag();//end totals row
//end totals row
writer.RenderEndTag();//table
writer.RenderEndTag();//body
writer.RenderEndTag();//HTML
using (var streamWriter = new StreamWriter("C:\\Users\\Crypto\\Desktop\\TestPage.html"))
{
streamWriter.WriteLine(stringWriter.ToString());
}
RenderHtmlToImage();
}
private void RenderCostsAnalysisCell(CostAnalysisCells cell, ref HtmlTextWriter writer, decimal? value, string rowSpan)
@@ -478,10 +416,16 @@ namespace AdvertsingProfitControl
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none; border-right:double");
break;
case 6:
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:double; background-color:#e9e9e9");
break;
case 16:
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:double");
break;
}
if (cellCount > 0 && cellCount < 6)
{
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9");
}
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("<br>");
writer.RenderEndTag();
+10
View File
@@ -59,5 +59,15 @@ namespace AdvertsingProfitControl.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Large_Allens_Icon_Template___Copy {
get {
object obj = ResourceManager.GetObject("Large Allens Icon Template - Copy", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: 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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Large Allens Icon Template - Copy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Large Allens Icon Template - Copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
@@ -0,0 +1,50 @@
using System;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Web.UI;
using Pechkin;
namespace AdvertsingProfitControl
{
internal class ReportGenerator
{
public readonly string Version = "1.0.0.0";
public void GeneratePdfReport(DateTime date)
{
var stringWriter = new StringWriter();
var writer = new HtmlTextWriter(stringWriter);
var front = new FrontPageGenerator();
var back = new BackPageGenerator();
front.BuildReportFrontPage(date, ref writer);
back.BuildReportBackPage(date, ref writer);
using (var streamWriter = new StreamWriter("C:\\Users\\Crypto\\Desktop\\Full.html"))
{
streamWriter.WriteLine(stringWriter.ToString());
}
}
public void RenderHtmlCodeToImage(string path, string targetPath)
{
var htmlCode = File.ReadAllLines(path);
var code = htmlCode.Aggregate("", (current, line) => current + "\r\n" + line);
try
{
var pechkin = new SimplePechkin(new GlobalConfig().SetMargins(50,0,0,0).SetPaperSize(PaperKind.A4).SetPaperOrientation(true).SetCopyCount(1));
var pdf = pechkin.Convert(new ObjectConfig().SetZoomFactor(1.25), code);
//var config = new GlobalConfig().SetPaperSize(PaperKind.A4).SetPaperOrientation(true);
//var pdfBuf = new SimplePechkin(config).Convert(code);
using (var fs = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
{
fs.Write(pdf, 0, pdf.Length);
}
}
finally
{
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB