// ----------------------------------------------------------------------------------------------------------------------
// Below section is used to standardize the formatting of the fields (ex: ".mgr" is used for all mgrs)
protected decimal RecordInches = .110M, RecordHeaderInches = .110M, GroupFooterExtraInches = .015M, EndNoteInches = .125M;
protected decimal[] GroupHeaderTotalInches = new[] { 0M, .32M, .22M, .19M, .19M, .19M };
protected decimal[] GroupFooterMarginInches = new[] { .6M, .4M, .4M, .1M, .03M, .03M };
protected override string SubTitle(DataTree root)
{
return "Group by " + (
root.Criteria.Group_for_All_by_Dlr == Group_for_All_by_Dlr.Dealership ? "Dealership" :
root.Criteria.Group_for_All_by_Dlr == Group_for_All_by_Dlr.DealershipCode1Newused ? "..." :
root.Criteria.Group_for_All_by_Dlr.ToString());
}
protected override void WriteHtml(DataTree root, TextWriter stream)
{
BeginHtml(root, stream,
GroupingCss(RecordInches, RecordHeaderInches, GroupFooterExtraInches) +
(SummaryOnly() ? ".group2-header {border-top: 0px solid #0000FF; height: .01in; width: .02in} .group2-footer {border-bottom: 0px solid #0000FF; border-top: 0px solid #0000FF; margin-bottom: .01in}" : "") +
".total-label {font: bold 8pt Arial; white-space: normal; width: 3.270in}" +
".count-box {border: 1px solid red; height: .250in; margin-right: .10in; width: .800in}" +
".veh-count {font: 8pt Arial; text-align: right; width: .800in}" +
".veh-count6 {font: 6pt Arial; text-align: right; width: .800in}" +
".record > div, div.full-tall > div, div.half-tall8 > div, div.third-tall8 > div, div.third-tall7 > div, div.third-tall6 > div, div.fourth-tall6 > div {display: inline-block; vertical-align: baseline}" +
".dollars {border-left: 1px dashed black}" +
".full-tall {font: 8pt Arial; height: .360in}" +
".half-tall8 {font: 8pt Arial; height: .180in}" +
".third-tall6 {font: 6pt Arial; height: .120in}" +
".third-tall7 {font: 7pt Arial; height: .120in}" +
".third-tall8 {font: 8pt Arial; height: .120in}" +
".fourth-tall6 {font: 6pt Arial; height: .090in}" +
".text-0200w {width: .200in}" +
".text-0300w {width: .300in}" +
".record-header .text-0300w {width: .300in}" +
".text-0325w-right {width: .325in; text-align: right}" +
".text-0350w {width: .350in}" +
".text-0400w {width: .400in}" +
".text-0450w {width: .450in}" +
".text-0500w {width: .500in}" +
".text-0550w {width: .550in}" +
".text-0600w {width: .600in}" +
".text-0650w {width: .650in}" +
".text-0700w {width: .700in}" +
".text-0800w {width: .800in}" +
".text-0800w-b {width: .800in; font-weight: bold}" +
".text-0900w {width: .900in}" +
".text-1000w {width: 1.000in}" +
".text-1200w {width: 1.200in}" +
".text-1400w {width: 1.400in}" +
".text-1600w {width: 1.600in}" +
".text-1800w {width: 1.800in}" +
".text-3000w {width: 3.000in}" +
".text-0800w-6pt {font: 6pt Arial; width: .800in}" +
".stat {font: 8pt Arial; width: .250in}" +
".record-header .stat {width: .250in}" +
// the following pairs of fields need to add up to equal the total widths between headers and the datafields
".date {width: .650in}" +
".record-header .date {width: .550in}" +
".deal-num {width: .450in}" +
".record-header .deal-num {width: .375in}" +
".rlw {width: .150in}" +
".record-header .rlw {width: .325in}" +
".stock-num {font-weight: bold; width: .750in}" +
// use the text formats below instead of: ".year-make-model {width: 1.072in}" +
".dealership {width: .600in}" +
".name-last {width: .770in}" +
".codes {width: .591in}" +
".code {width: .197in}" +
".sls-num {text-align: right; width: .300in}" +
".record-header .sls-num {width: .300in}" +
//".sls-name {width: 1.000in}" +
".slscmsn, .grosspyblsplit, .holdbacksplit, .packsplit {text-align: right; width: .500in}" +
".amt-0350w {text-align: right; width: .350in}" +
".amt-0400w {text-align: right; width: .400in}" +
".amt-0450w {text-align: right; width: .450in}" +
".amt-0500w {text-align: right; width: .500in}" +
".amt-0550w {text-align: right; width: .550in}" +
".amt-0600w {text-align: right; width: .600in}" +
".amt-0650w {text-align: right; width: .650in}" +
".amt-0700w {text-align: right; width: .700in}" +
".amt-0700w-b {text-align: right; width: .700in; font-weight: bold}" +
".amt-0700w-i {text-align: right; width: .700in; font: italic 8pt Arial}" +
//".amt-0494w {text-align: right; width: .494in}" +
//".amt-0572w, .vehprice, .vehcost {text-align: right; width: .572in}" +
".mgr {width: .700in}" +
".from-sales {text-align: center; white-space: pre; width: 3.7in}" + // was letter-spacing: 14px; but that didn't work in wkhtmltopdf
".end-note {font: 7pt Arial; height: .125in}",
MakeLeafHtml(null, null), RecordHeaderInches
);
Recurse(root,
(trunk, branch) => WriteToPage(root, stream, branch.Branches == null ?
MakeLeafHtml(null, branch.Leaf) :
Div("group" + branch.Level + "-header", "<span>" + HttpUtility.HtmlEncode(TrunkAndBranchName(branch)) + "</span>"),
branch.Branches == null ? RecordInches : GroupHeaderTotalInches[branch.Level]),
(trunk, branch) => WriteTotalsHtml(root, stream, branch)
);
WriteTotalsHtml(root, stream, root);
WriteToPage(root, stream,
TextDiv("end-note", "Note: the column labeled \"Stat\" should contain the following codes:") +
TextDiv("end-note", "\"S\"=Saved Deal; \"E\"=Spot Delivered; \"C\"=Closed in F+I, but not posted in Accounting; \"F\"=Finalized in Accounting"),
EndNoteInches * 3);
EndHtml(root, stream);
}
protected override bool SummaryOnly()
{
return Act.Report.SortBy_Sum_Date_Stk == null || Act.Report.SortBy_Sum_Date_Stk == SortBy_Sum_Date_Stk.SummaryOnly;
}
protected void WriteTotalsHtml(DataTree root, TextWriter stream, DataTree branch)
{
if (branch.Branches != null)
WriteToPage(root, stream, MakeLeafHtml(branch, branch.Totals), RecordInches + GroupFooterExtraInches + GroupFooterMarginInches[branch.Level]);
}
// ----------------------------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------
protected string LC(string s)
{
return (s ?? "").ToLower();
}
//
// --- 20150204: Change following to single line for summary Ranking reports
//
protected string MakeLeafHtml(DataTree tree, DataLeaf leaf)
{
// The following determines the Page Hdr, the Data, the Totals:
// used to render the page header (tree = null; leaf = null), a record (tree = null; leaf = the leaf),
// or totals (tree = the tree; leaf = tree.Totals)
var dollarDivs =
Div("dollars",
Div("half-tall8",
//TextDiv("text-3000w", leaf == null ? "..." : "") +
TextDiv("amt-0700w", leaf == null ? "#Sold" : Decimal2(leaf.SlsSplit)) +
TextDiv("amt-0700w", leaf == null ? "#New" : Decimal2(leaf.Ct_N_Split)) +
TextDiv("amt-0700w", leaf == null ? "#Used" : Decimal2(leaf.Ct_U_Split)) +
TextDiv("amt-0700w", leaf == null ? "#Records" : Decimal2(leaf.Count)) +
TextDiv("amt-0700w-b", leaf == null ? "Commission" : Decimal2(leaf.SlsCmsn)) +
TextDiv("amt-0700w", leaf == null ? "GrossPybl" : Dollars(leaf.GrossPyblSplit)) +
TextDiv("amt-0700w-i", leaf == null ? "EffCmsn%" : leaf.EffCmsn_GrossPyblSplit) +
TextDiv("amt-0700w", leaf == null ? "AvgGrossPybl" : Dollars(leaf.GrossPyblSplit, leaf.SlsSplit))
)
);
if (tree != null)
// This section is for TOTALS
return Div("record group" + tree.Level + "-footer",
Div("", TextDiv("total-label", tree.Level == 0 ? "Grand Totals:" : "Totals: " + TrunkAndBranchName(tree))) +
dollarDivs
);
//--------- Left-most set of fields to display on report
return Div(leaf != null ? "record" : "record record-header",
//20150212: added below to align the column headers with the columns:
Div("", TextDiv("total-label", "")) +
dollarDivs //+
);
}
// ----------------------------------------------------------------------------------------------------------------------
protected virtual bool IsRankingReport()
{
return false;
}
}