Esempio n. 1
0
        public void CRM_ReportQuery_GetExportData()
        {
            var data = query.GetWorkDoneItems();

            foreach (var d in data)
            {
                Console.WriteLine("{0} {1} {2}",
                                  d.Account.Name,
                                  d.Invoice.Name,
                                  d.WorkDoneItem.WorkDoneDate);
            }
        }
Esempio n. 2
0
        // GET: Reporting/Export
        public async Task <ActionResult> Export()
        {
            using (var context = await GetCrmContext())
            {
                var query = new ReportQuery(context);

                var viewModel = new ReportExportViewModel
                {
                    Title      = "Export",
                    Breadcrumb = new Breadcrumb(),
                    Items      = query.GetWorkDoneItems()
                };

                return(View(viewModel));
            }
        }
Esempio n. 3
0
        private static WorkDoneExport GetWorkDoneExport(ReportQuery query)
        {
            var workDoneItems = query.GetWorkDoneItems();

            var workDone = new WorkDoneExport();

            foreach (var w in workDoneItems)
            {
                workDone.Add(new WorkDoneItem
                {
                    AccountName      = w.Account.Name,
                    InvoiceName      = w.Invoice.Name,
                    InvoiceDate      = MonthStart(w.Invoice.InvoiceDate),
                    InvoiceMargin    = w.Invoice.Margin.GetValueOrDefault(),
                    InvoiceStatus    = w.Invoice.Status.GetValueOrDefault(),
                    WorkDoneDate     = MonthStart(w.WorkDoneItem.WorkDoneDate),
                    WorkDoneMargin   = w.WorkDoneItem.Margin.GetValueOrDefault(),
                    WorkDoneForecast = w.WorkDoneItem.Forecast.GetValueOrDefault()
                });
            }

            return(workDone);
        }