コード例 #1
0
        public ActionResult ViewByReference(string reference)
        {
            var timesheet = timesheetService.GetTimesheetByReference(reference);

            if (timesheet == null)
            {
                return(HttpNotFound());
            }

            return(View(timesheet.ID));
        }
コード例 #2
0
        public ActionResult StatementDetails(int id)
        {
            var statement     = statementService.GetCarerStatement(id);
            var timesheetRefs = statement.Payments.Select(x => x.OriginatingReference).Distinct().ToList();

            var model = new List <TimesheetWeek>();

            timesheetRefs.ForEach(timesheetRef => {
                var timesheet = timesheetService.GetTimesheetByReference(timesheetRef);
                if (timesheet != null)
                {
                    model.Add(timesheet);
                }
            });

            var headerInfo = new Dictionary <string, string>
            {
                { "Invoice Date", statement.CreatedDate.ToString("g") },
                { "Reference", statement.Reference },
                { "Batch", String.Format("<a href='{0}'>{1}</a>", Url.Action("BatchDetails", "CarerStatement", new { ID = statement.BatchID }), statement.Batch.Reference) },
                { "Invoice Total", statement.Payments.Sum(x => x.Total).ToMoney() },
            };

            if (statement.Status != CarerStatementStatus.Created)
            {
                headerInfo.Add("Outstanding", statement.Payments.Sum(x => x.AmountOutstanding).ToMoney());
            }
            ;

            if (statement.DocumentID.HasValue)
            {
                headerInfo.Add("Invoice", String.Format("<a href='{0}'><i class='fa fa-download fa-lg'></i>&nbsp;{1}</a>", Url.Action("DownloadDocument", "Document", new { Id = statement.DocumentID }), statement.Document.ReferenceNo));
            }
            ;

            if (statement.EmailID.HasValue)
            {
                headerInfo.Add("Email", String.Format("<a href='{0}'><i class='fa fa-envelope-o fa-lg'></i>&nbsp;{1}</a>", Url.Action("View", "Email", new { Id = statement.EmailID }), statement.EmailMessage.Subject));
            }
            ;

            ViewBag.Status     = statement.Status.GetDescription();
            ViewBag.Carer      = statement.Carer;
            ViewBag.HeaderInfo = headerInfo;

            return(View(model));
        }