Completely removed all the old database interaction code, save the database converter form. Updated the formatting in the weekly and taxable areas on the modify record form. Re-enabled holiday checking on the main form.
This commit is contained in:
@@ -40,25 +40,25 @@ namespace AdvertsingProfitControl
|
||||
|
||||
public void BuildFormFrontCompressedLayout(int dateId, double departmentSales, double salesProducedByAdItems, double remainingSales, double totalProfitReturnFromAdItems, double totalProfitReturnFromRemainingSales, double totalProfitReturn, string comments)
|
||||
{
|
||||
var databaseTracker = new DatabaseTracker();
|
||||
var databaseReader = new DatabaseReader();
|
||||
//var databaseTracker = new DatabaseTracker();
|
||||
//var databaseReader = new DatabaseReader();
|
||||
var stringWriter = new StringWriter();
|
||||
var writer = new HtmlTextWriter(stringWriter);
|
||||
var table = databaseReader.ReturnApcTableForReport(dateId, databaseTracker.DatabaseConnectionString);
|
||||
var dateString = databaseReader.RetrieveDateStringById(dateId, databaseTracker.DatabaseConnectionString);
|
||||
var spam = dateString.Split(' ');
|
||||
dateString = spam[0];
|
||||
//var table = databaseReader.ReturnApcTableForReport(dateId, databaseTracker.DatabaseConnectionString);
|
||||
//var dateString = databaseReader.RetrieveDateStringById(dateId, databaseTracker.DatabaseConnectionString);
|
||||
//var spam = dateString.Split(' ');
|
||||
//dateString = spam[0];
|
||||
//Begin evaluating the size of the table.
|
||||
var isCompressedFormat = false;
|
||||
var willGenerateCommentRow = false;
|
||||
if ((table.Rows.Count + 1) == 15)
|
||||
{
|
||||
willGenerateCommentRow = true;
|
||||
}
|
||||
else if ((table.Rows.Count + 1) < 15)
|
||||
{
|
||||
isCompressedFormat = true;
|
||||
}
|
||||
//if ((table.Rows.Count + 1) == 15)
|
||||
//{
|
||||
// willGenerateCommentRow = true;
|
||||
//}
|
||||
//else if ((table.Rows.Count + 1) < 15)
|
||||
//{
|
||||
// isCompressedFormat = true;
|
||||
//}
|
||||
writer.Write("<!DOCTYPE html>\n");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Html);
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Head);
|
||||
@@ -85,7 +85,7 @@ namespace AdvertsingProfitControl
|
||||
writer.RenderEndTag();//td
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:33%; padding: 0px 0px 0px 0px; margin:0px; border:none; vertical-align:bottom");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<p><span style=\"margin-left:102px\">Week Ending: <u>" + dateString + "</u></span><br><span style=\"margin-left:86px\">Department: <u>Produce</u></span></p>");
|
||||
writer.Write("<p><span style=\"margin-left:102px\">Week Ending: <u> + dateString + </u></span><br><span style=\"margin-left:86px\">Department: <u>Produce</u></span></p>");
|
||||
writer.RenderEndTag();//td
|
||||
writer.RenderEndTag();//tr
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin:0px; padding:0px");
|
||||
@@ -183,281 +183,281 @@ namespace AdvertsingProfitControl
|
||||
double actualTotalProfitReturn = 0;
|
||||
var adSpecialOffset = 0;
|
||||
//Profit Analysis values.
|
||||
for (var rowIndex = 0; rowIndex < (table.Rows.Count < 19 ? 19 : table.Rows.Count); rowIndex++) //The comparison in the for loop is index based, so no need to add one to the row count.
|
||||
{
|
||||
var isProfitAnalysisCell = false;
|
||||
//IF the row index goes beyond the number of rows that are in the table, then start padding with blank cells to fit the Profit Analysis cells.
|
||||
if (rowIndex < table.Rows.Count)
|
||||
{
|
||||
var row = table.Rows[rowIndex];
|
||||
var rowAttribute = 0;
|
||||
var groupId = 0;
|
||||
if (int.TryParse(row.ItemArray[17].ToString(), out rowAttribute))
|
||||
{
|
||||
if (rowAttribute != 0)
|
||||
{
|
||||
if (rowAttribute == 1)
|
||||
{
|
||||
isRowMember = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isRowMember = true;
|
||||
}
|
||||
isRenderingGroup = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isRenderingGroup = false;
|
||||
isRowMember = false;
|
||||
}
|
||||
}
|
||||
if (adSpecialRowIndex == -1 && int.TryParse(row.ItemArray[18].ToString(), out groupId))
|
||||
{
|
||||
if (groupId != 0)
|
||||
{
|
||||
adSpecialRowIndex = rowIndex;
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<center>" +
|
||||
databaseReader.ReturnGroupNameFromGroupId(groupId.ToString(),
|
||||
databaseTracker.DatabaseConnectionString) + "</center>");
|
||||
writer.RenderEndTag(); //td
|
||||
writer.RenderEndTag(); //tr
|
||||
BuildProfitAnalysisCell(ref writer, rowIndex, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn);
|
||||
adSpecialOffset++;
|
||||
}
|
||||
}
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
for (var i = 0; i < row.ItemArray.Length; i++)
|
||||
{
|
||||
if (i >= 17) continue;
|
||||
if (i == 0)
|
||||
{
|
||||
writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none");
|
||||
}
|
||||
else if (i > 0 && i < 7)
|
||||
{
|
||||
//background-color:#e9e9e9
|
||||
writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#e9e9e9");
|
||||
}
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
decimal number;
|
||||
if (decimal.TryParse(row.ItemArray[i].ToString(), out number))
|
||||
{
|
||||
//Check for the inventory columns and the sold columns.
|
||||
if (!isRowMember)
|
||||
{
|
||||
if (i == 1 || i > 6 && i < 12)
|
||||
{
|
||||
writer.Write(number == 0 ? "0" : row.ItemArray[i].ToString());
|
||||
}
|
||||
if (i > 1 && i < 7 || i > 11)
|
||||
{
|
||||
writer.Write(number == 0 ? "0.00" : $"{number:N}");
|
||||
}
|
||||
}
|
||||
//for (var rowIndex = 0; rowIndex < (table.Rows.Count < 19 ? 19 : table.Rows.Count); rowIndex++) //The comparison in the for loop is index based, so no need to add one to the row count.
|
||||
//{
|
||||
// var isProfitAnalysisCell = false;
|
||||
// //IF the row index goes beyond the number of rows that are in the table, then start padding with blank cells to fit the Profit Analysis cells.
|
||||
// if (rowIndex < table.Rows.Count)
|
||||
// {
|
||||
// var row = table.Rows[rowIndex];
|
||||
// var rowAttribute = 0;
|
||||
// var groupId = 0;
|
||||
// if (int.TryParse(row.ItemArray[17].ToString(), out rowAttribute))
|
||||
// {
|
||||
// if (rowAttribute != 0)
|
||||
// {
|
||||
// if (rowAttribute == 1)
|
||||
// {
|
||||
// isRowMember = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// isRowMember = true;
|
||||
// }
|
||||
// isRenderingGroup = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// isRenderingGroup = false;
|
||||
// isRowMember = false;
|
||||
// }
|
||||
// }
|
||||
// if (adSpecialRowIndex == -1 && int.TryParse(row.ItemArray[18].ToString(), out groupId))
|
||||
// {
|
||||
// if (groupId != 0)
|
||||
// {
|
||||
// adSpecialRowIndex = rowIndex;
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("<center>" +
|
||||
// databaseReader.ReturnGroupNameFromGroupId(groupId.ToString(),
|
||||
// databaseTracker.DatabaseConnectionString) + "</center>");
|
||||
// writer.RenderEndTag(); //td
|
||||
// writer.RenderEndTag(); //tr
|
||||
// BuildProfitAnalysisCell(ref writer, rowIndex, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn);
|
||||
// adSpecialOffset++;
|
||||
// }
|
||||
// }
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
// for (var i = 0; i < row.ItemArray.Length; i++)
|
||||
// {
|
||||
// if (i >= 17) continue;
|
||||
// if (i == 0)
|
||||
// {
|
||||
// writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none");
|
||||
// }
|
||||
// else if (i > 0 && i < 7)
|
||||
// {
|
||||
// //background-color:#e9e9e9
|
||||
// writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#e9e9e9");
|
||||
// }
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// decimal number;
|
||||
// if (decimal.TryParse(row.ItemArray[i].ToString(), out number))
|
||||
// {
|
||||
// //Check for the inventory columns and the sold columns.
|
||||
// if (!isRowMember)
|
||||
// {
|
||||
// if (i == 1 || i > 6 && i < 12)
|
||||
// {
|
||||
// writer.Write(number == 0 ? "0" : row.ItemArray[i].ToString());
|
||||
// }
|
||||
// if (i > 1 && i < 7 || i > 11)
|
||||
// {
|
||||
// writer.Write(number == 0 ? "0.00" : $"{number:N}");
|
||||
// }
|
||||
// }
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 3:
|
||||
projectionProfitReturn += double.Parse(row.ItemArray[3].ToString());
|
||||
break;
|
||||
case 6:
|
||||
projectionTotalProfitReturn += double.Parse(row.ItemArray[6].ToString());
|
||||
break;
|
||||
case 13:
|
||||
actualProfitReturn += double.Parse(row.ItemArray[13].ToString());
|
||||
break;
|
||||
case 16:
|
||||
actualTotalProfitReturn += double.Parse(row.ItemArray[16].ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(row.ItemArray[i]);
|
||||
}
|
||||
writer.RenderEndTag(); //td
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Padding
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
//Generate padding rows to fit the Profit Analysis cells properly onto the sheet.
|
||||
//Check to see if the row index is equal to the number of rows in the table.
|
||||
if (rowIndex == table.Rows.Count)
|
||||
{
|
||||
//IF so, then that means the current row index represents the index of the Totals row. So build the totals row with the added values from above.
|
||||
//Begin rendering the totals row.
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; border-left:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; text-align:right");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("Total");
|
||||
writer.RenderEndTag(); //td
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(A) " + $"{projectionProfitReturn:C}");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(B) " + $"{projectionTotalProfitReturn:C}");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:right");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("Total");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(A) " + $"{actualProfitReturn:C}");
|
||||
writer.RenderEndTag();
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(B) " + $"{actualTotalProfitReturn:C}");
|
||||
writer.RenderEndTag();//td
|
||||
//END rending the totals row.
|
||||
BuildProfitAnalysisCell(ref writer, rowIndex + adSpecialOffset, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn);
|
||||
}
|
||||
else if (rowIndex == (table.Rows.Count + 1))
|
||||
//Check to see if the current index is equal to the row after the totals row and, if so, create the comments row.
|
||||
{
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write(
|
||||
"<b>Comments:</b> " + comments);
|
||||
writer.RenderEndTag(); //td
|
||||
BuildProfitAnalysisCell(ref writer, rowIndex + adSpecialOffset, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cellCount = 0;
|
||||
while (cellCount < 17)
|
||||
{
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.RenderEndTag();//td
|
||||
cellCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// switch (i)
|
||||
// {
|
||||
// case 3:
|
||||
// projectionProfitReturn += double.Parse(row.ItemArray[3].ToString());
|
||||
// break;
|
||||
// case 6:
|
||||
// projectionTotalProfitReturn += double.Parse(row.ItemArray[6].ToString());
|
||||
// break;
|
||||
// case 13:
|
||||
// actualProfitReturn += double.Parse(row.ItemArray[13].ToString());
|
||||
// break;
|
||||
// case 16:
|
||||
// actualTotalProfitReturn += double.Parse(row.ItemArray[16].ToString());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// writer.Write(row.ItemArray[i]);
|
||||
// }
|
||||
// writer.RenderEndTag(); //td
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //Padding
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
// //Generate padding rows to fit the Profit Analysis cells properly onto the sheet.
|
||||
// //Check to see if the row index is equal to the number of rows in the table.
|
||||
// if (rowIndex == table.Rows.Count)
|
||||
// {
|
||||
// //IF so, then that means the current row index represents the index of the Totals row. So build the totals row with the added values from above.
|
||||
// //Begin rendering the totals row.
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; border-left:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; text-align:right");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("Total");
|
||||
// writer.RenderEndTag(); //td
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(A) " + $"{projectionProfitReturn:C}");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(B) " + $"{projectionTotalProfitReturn:C}");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:right");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("Total");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(A) " + $"{actualProfitReturn:C}");
|
||||
// writer.RenderEndTag();
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(B) " + $"{actualTotalProfitReturn:C}");
|
||||
// writer.RenderEndTag();//td
|
||||
// //END rending the totals row.
|
||||
// BuildProfitAnalysisCell(ref writer, rowIndex + adSpecialOffset, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn);
|
||||
// }
|
||||
// else if (rowIndex == (table.Rows.Count + 1))
|
||||
// //Check to see if the current index is equal to the row after the totals row and, if so, create the comments row.
|
||||
// {
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write(
|
||||
// "<b>Comments:</b> " + comments);
|
||||
// writer.RenderEndTag(); //td
|
||||
// BuildProfitAnalysisCell(ref writer, rowIndex + adSpecialOffset, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var cellCount = 0;
|
||||
// while (cellCount < 17)
|
||||
// {
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.RenderEndTag();//td
|
||||
// cellCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//Check for every 3rd row to append a Profit Analysis cell onto.
|
||||
switch (rowIndex + adSpecialOffset)
|
||||
{
|
||||
case 0:
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<center style=\"margin-top:1px\">Sales Produced By<br>Ad Items (A)</center><p><span style=\"font-size:9px; vertical-align:bottom\">2</span><span style=\"margin-left:60px\">" + $"{salesProducedByAdItems:C}" + "</span></p>");
|
||||
writer.RenderEndTag();
|
||||
break;
|
||||
case 3:
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<center style=\"margin-top:1px\">Remaining<br>Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">3</span><span style=\"margin-left:60px\">" + $"{remainingSales:C}" + " </span></p>");
|
||||
writer.RenderEndTag();
|
||||
break;
|
||||
case 6:
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<center style=\"margin-top:1px;\">Total $ Profit Return<br>From Ad Items (B)</center><p><span style=\"font-size:9px; vertical-align:bottom\">4</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromAdItems:C}" + " </span></p>");
|
||||
writer.RenderEndTag();
|
||||
break;
|
||||
case 9:
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<center style=\"margin-top:2px\">Total $ Profit Return<br>From Remaining Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">5</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromRemainingSales:C}" + "</span></p>");
|
||||
writer.RenderEndTag();
|
||||
break;
|
||||
case 12:
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("<center style=\"margin-top:1px\">Total $ Profit<br>Return</center><p><span style=\"font-size:9px; vertical-align:bottom\">6</span><span style=\"margin-left:60px\">" + $"{totalProfitReturn:C}" + "</span></p>");
|
||||
writer.RenderEndTag();
|
||||
break;
|
||||
case 15:
|
||||
//IF either the compressed format or the generate comment row flags are set, then ignore this case. Only tables with 19 or more rows can generate a full comments cell due to the amount of text it can contain.
|
||||
if (isCompressedFormat || willGenerateCommentRow) break;
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "4");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("Comments: " + comments);
|
||||
writer.RenderEndTag();
|
||||
break;
|
||||
}
|
||||
// switch (rowIndex + adSpecialOffset)
|
||||
// {
|
||||
// case 0:
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("<center style=\"margin-top:1px\">Sales Produced By<br>Ad Items (A)</center><p><span style=\"font-size:9px; vertical-align:bottom\">2</span><span style=\"margin-left:60px\">" + $"{salesProducedByAdItems:C}" + "</span></p>");
|
||||
// writer.RenderEndTag();
|
||||
// break;
|
||||
// case 3:
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("<center style=\"margin-top:1px\">Remaining<br>Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">3</span><span style=\"margin-left:60px\">" + $"{remainingSales:C}" + " </span></p>");
|
||||
// writer.RenderEndTag();
|
||||
// break;
|
||||
// case 6:
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("<center style=\"margin-top:1px;\">Total $ Profit Return<br>From Ad Items (B)</center><p><span style=\"font-size:9px; vertical-align:bottom\">4</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromAdItems:C}" + " </span></p>");
|
||||
// writer.RenderEndTag();
|
||||
// break;
|
||||
// case 9:
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("<center style=\"margin-top:2px\">Total $ Profit Return<br>From Remaining Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">5</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromRemainingSales:C}" + "</span></p>");
|
||||
// writer.RenderEndTag();
|
||||
// break;
|
||||
// case 12:
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("<center style=\"margin-top:1px\">Total $ Profit<br>Return</center><p><span style=\"font-size:9px; vertical-align:bottom\">6</span><span style=\"margin-left:60px\">" + $"{totalProfitReturn:C}" + "</span></p>");
|
||||
// writer.RenderEndTag();
|
||||
// break;
|
||||
// case 15:
|
||||
// //IF either the compressed format or the generate comment row flags are set, then ignore this case. Only tables with 19 or more rows can generate a full comments cell due to the amount of text it can contain.
|
||||
// if (isCompressedFormat || willGenerateCommentRow) break;
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "4");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("Comments: " + comments);
|
||||
// writer.RenderEndTag();
|
||||
// break;
|
||||
// }
|
||||
|
||||
writer.RenderEndTag();//tr
|
||||
}//end for loop
|
||||
// writer.RenderEndTag();//tr
|
||||
//}//end for loop
|
||||
|
||||
if (!willGenerateCommentRow && !isCompressedFormat)
|
||||
{
|
||||
//Begin rendering the totals row.
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; border-left:none");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; text-align:right");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("Total");
|
||||
writer.RenderEndTag(); //td
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(A) " + $"{projectionProfitReturn:C}");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(B) " + $"{projectionTotalProfitReturn:C}");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; text-align:right");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("Total");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(A) " + $"{actualProfitReturn:C}");
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.RenderEndTag();
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
writer.Write("(B) " + $"{actualTotalProfitReturn:C}");
|
||||
writer.RenderEndTag();//td
|
||||
writer.RenderEndTag(); //tr
|
||||
}
|
||||
writer.RenderEndTag();//table
|
||||
writer.RenderEndTag();//body
|
||||
writer.RenderEndTag();//HTML
|
||||
//if (!willGenerateCommentRow && !isCompressedFormat)
|
||||
//{
|
||||
// //Begin rendering the totals row.
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Tr);
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; border-left:none");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; text-align:right");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("Total");
|
||||
// writer.RenderEndTag(); //td
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(A) " + $"{projectionProfitReturn:C}");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(B) " + $"{projectionTotalProfitReturn:C}");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; text-align:right");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("Total");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(A) " + $"{actualProfitReturn:C}");
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.RenderEndTag();
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px");
|
||||
// writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
|
||||
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
|
||||
// writer.Write("(B) " + $"{actualTotalProfitReturn:C}");
|
||||
// writer.RenderEndTag();//td
|
||||
// writer.RenderEndTag(); //tr
|
||||
//}
|
||||
//writer.RenderEndTag();//table
|
||||
//writer.RenderEndTag();//body
|
||||
//writer.RenderEndTag();//HTML
|
||||
|
||||
using (var streamWriter = new StreamWriter(Application.StartupPath + "\\FrontPage.html"))
|
||||
{
|
||||
streamWriter.WriteLine(stringWriter.ToString());
|
||||
}
|
||||
RenderHtmlToImage();
|
||||
//using (var streamWriter = new StreamWriter(Application.StartupPath + "\\FrontPage.html"))
|
||||
//{
|
||||
// streamWriter.WriteLine(stringWriter.ToString());
|
||||
//}
|
||||
//RenderHtmlToImage();
|
||||
}
|
||||
|
||||
private void BuildProfitAnalysisCell(ref HtmlTextWriter writer, int rowIndex, out bool isProfitAnalysisCell, double salesProducedByAdItems, double remainingSales, double totalProfitReturnFromAdItems, double totalProfitReturnFromRemainingSales, double totalProfitReturn)
|
||||
|
||||
Reference in New Issue
Block a user