public void buildFeeTargetReport()
        {
            Root = new RootElement ("Practice Fee Target Progress");
            Stripper.SetReportHeader (Root, "Practice Fee Target Progress", null, contentWidth);

            PracticeTotals totals = this.report.practiceTotals;

            var totSection = new Section ("");
            var tot1 = new BigFinanceElement ("Invoiced MTD Total:  ", totals.invoicedMTDTotal);

            totSection.Add (tot1);
            Root.Add (totSection);
            //Fee Target Progress: The Invoiced Debits MTD field display the invoiced YTD value
            if (totals.recordedMTD != null) {

                var mtdSection = new Section ("Recorded MTD");
                mtdSection.Add (getElement (totals.recordedMTD.achieved, "Achieved: "));
                mtdSection.Add (getElement (totals.recordedMTD.estimatedTarget, "Estimated Target: "));
                mtdSection.Add (getElement (totals.recordedMTD.invoicedDebits, "Invoiced: "));
                mtdSection.Add (getElement (totals.recordedMTD.unbilled, "Unbilled: "));
                mtdSection.Add (getElement (totals.recordedMTD.total, "Total: "));
                Root.Add (mtdSection);
            }
            if (totals.recordedYTD != null) {

                var mtdSection = new Section ("Recorded YTD");
                mtdSection.Add (getElement (totals.recordedYTD.achieved, "Achieved: "));
                mtdSection.Add (getElement (totals.recordedYTD.estimatedTarget, "Estimated Target: "));
                mtdSection.Add (getElement (totals.recordedYTD.invoiced, "Invoiced: "));
                mtdSection.Add (getElement (totals.recordedYTD.unbilled, "Unbilled: "));
                mtdSection.Add (getElement (totals.recordedYTD.total, "Total: "));
                Root.Add (mtdSection);
            }
            if (totals.matterActivity != null) {
                var matterActivitySection = new Section ("Matter Activity");
                var tot2 = new NumberElement (totals.matterActivity.active, "Active Matters: ");
                matterActivitySection.Add (tot2);
                var tot3 = new NumberElement (totals.matterActivity.deactivated, "Deactivated Matters: ");
                matterActivitySection.Add (tot3);
                var tot4 = new NumberElement (totals.matterActivity.newWork, "New Work: ");
                matterActivitySection.Add (tot4);
                var tot5 = new NumberElement (totals.matterActivity.noActivity, "No Activity: ");
                matterActivitySection.Add (tot5);
                var tot6 = new StringElement ("No Activity Duration:   " + totals.matterActivity.noActivityDuration);
                matterActivitySection.Add (tot6);
                Root.Add (matterActivitySection);
            }
            //
            if (totals.matterBalances != null) {
                var matterBalancesSection = new Section ("Matter Balances");
                matterBalancesSection.Add (getElement (totals.matterBalances.business, "Business: "));
                matterBalancesSection.Add (getElement (totals.matterBalances.unbilled, "Unbilled: "));
                matterBalancesSection.Add (getElement (totals.matterBalances.trust, "Trust Balance: "));
                matterBalancesSection.Add (getElement (totals.matterBalances.investment, "Investments: "));
                Root.Add (matterBalancesSection);
            }
        }
        public void BuildInterface()
        {
            if (Root == null) {
                Root = new RootElement ("Matter Details");
            }
            Root.Clear ();
            headerLabel = new UILabel (new RectangleF (10, 10, 300, 40)) {
                Font = UIFont.BoldSystemFontOfSize (20),
                BackgroundColor = ColorHelper.GetGPPurple (),
                TextAlignment = UITextAlignment.Center,
                TextColor = UIColor.White,
                Text = searchResult.matterName
            };
            var view = new UIViewBordered ();
            view.Frame = new RectangleF (10, 10, 300, 40);
            view.Add (headerLabel);
            var topSection = new Section (view);

            Root.Add (topSection);
            //
            var sec = new Section ("");
            //matterName = new TitleElement (searchResult.matterName);
            ownerName = new StringsElement ("Owner", searchResult.currentOwner);
            matterID = new NumberElement (
                Convert.ToInt16 (searchResult.matterID),
                "Matter ID"
            );
            if (searchResult.matterLegacyAccount == null || searchResult.matterLegacyAccount.Trim () == "") {
                //ignore
            } else {
                legacy = new StringsElement (
                    "Legacy Account",
                    searchResult.matterLegacyAccount
                );
            }
            clientName = new StringsElement ("Client", "" + searchResult.clientName);
            //
            var sec2 = new Section ("");
            if (matter == null) {
                busBal = new FinanceElement (S.GetText (S.BUSINESS_BALANCE) + ":", 0.00);
                currBal = new FinanceElement (S.GetText (S.CURRENT_BALANCE) + ":", 0.00);
                trustBal = new FinanceElement (S.GetText (S.TRUST_BALANCE) + ":", 0.00);
                reserveTrust = new FinanceElement (S.GetText (S.RESERVE_TRUST) + ":", 0.00);
                unbilled = new FinanceElement (S.GetText (S.UNBILLED_BALANCE) + ":", 0.00);
                pending = new FinanceElement (S.GetText (S.PENDING_DISBURSEMENTS) + ":", 0.00);
                investTrust = new FinanceElement (S.GetText (S.INVESTMENT_TRUST) + ":", 0.00);
            } else {
                busBal = new FinanceElement (S.GetText (S.BUSINESS_BALANCE) + ":", matter.businessBalance);
                currBal = new FinanceElement (S.GetText (S.CURRENT_BALANCE), matter.currentBalance);
                unbilled = new FinanceElement (S.GetText (S.UNBILLED_BALANCE) + ":", matter.unbilledBalance);
                trustBal = new FinanceElement (S.GetText (S.TRUST_BALANCE), matter.trustBalance);
                reserveTrust = new FinanceElement (S.GetText (S.RESERVE_TRUST), matter.reserveTrust);
                pending = new FinanceElement (
                    S.GetText (S.PENDING_DISBURSEMENTS) + ":",
                    matter.pendingDisbursementBalance
                );
                investTrust = new FinanceElement (
                    S.GetText (S.INVESTMENT_TRUST) + ":",
                    matter.investmentTrustBalance
                );

            }
            //
            //sec.Add (matterName);
            sec.Add (clientName);
            sec.Add (ownerName);
            sec.Add (matterID);
            Root.Add (sec);
            //
            sec2.Add (busBal);
            sec2.Add (trustBal);
            sec2.Add (investTrust);
            sec2.Add (currBal);
            sec2.Add (reserveTrust);
            sec2.Add (unbilled);
            sec2.Add (pending);
            if (legacy != null) {
                sec2.Add (legacy);
            }

            Root.Add (sec2);

            //
            var sec3 = new Section (searchResult.matterName);
            btnPostFee = new StyledStringElement ("Post Fee");
            btnPostUnbillable = new StyledStringElement ("Post Unbillable");
            btnPostNote = new StyledStringElement ("Post Note");
            btnBack = new StyledStringElement (S.GetText (S.MATTER_SEARCH));
            btnAssignTask = new StyledStringElement ("Assign Task");

            btnAssignTask.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new FeeEarnerListController (searchResult);
                    this.NavigationController.PushViewController (c, true);
                }

            };
            btnPostFee.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new PostFeeDialog (matter, false, this);
                    this.NavigationController.PushViewController (c, true);
                }

            };
            btnPostUnbillable.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new PostFeeDialog (matter, true, this);
                    this.NavigationController.PushViewController (c, true);
                }
            };
            btnPostNote.Tapped += delegate {
                if (isBusy) {
                    Busy ();
                } else {
                    matter.id = searchResult.matterID;
                    var c = new PostNoteDialog (matter, this);
                    this.NavigationController.PushViewController (c, true);
                }
            };
            btnBack.Tapped += delegate() {
                if (isBusy) {
                    Busy ();
                } else {
                    this.NavigationController.PopViewControllerAnimated (true);
                }

            };
            btnPostFee.Alignment = UITextAlignment.Center;
            btnPostUnbillable.Alignment = UITextAlignment.Center;
            btnPostNote.Alignment = UITextAlignment.Center;
            btnBack.Alignment = UITextAlignment.Center;
            btnAssignTask.Alignment = UITextAlignment.Center;
            //
            sec3.Add (btnPostFee);
            sec3.Add (btnPostUnbillable);
            sec3.Add (btnPostNote);
            sec3.Add (btnAssignTask);
            sec3.Add (btnBack);
            Root.Add (sec3);
        }