示例#1
0
        public DailySummary PrepareDailySummary()
        {
            using (var ctx = new MNIBDBDataContext())
            {
                var ds  = new DailySummary();
                var res = ctx.ExportReportLines.Where(x => x.ExportDate == this.ExportDate)
                          .OrderBy(x => x.CustomerInfo)
                          .ThenBy(y => y.TransactionNumber)
                          .ThenBy(z => z.Harvester)
                          .ThenBy(z => z.ProductDescription)
                          .Select(w => new DailySummary.ReportLine()
                {
                    TransactionType   = w.SourceTransaction,
                    Customer          = w.CustomerInfo,
                    TransactionNumber = w.TransactionNumber,
                    Harvester         = w.Harvester,
                    Product           = w.ProductDescription,
                    Weight            = w.Weight,
                    BarCode           = w.ExportNumber
                }).ToList();
                ds.Summary = new ObservableCollection <DailySummary.SummaryLine>(
                    ctx.ExportReportLines.GroupBy(x => x.ReceiptNumber.Substring(0, x.ReceiptNumber.LastIndexOf("-")))
                    .Select(x => new DailySummary.SummaryLine()
                {
                    LotNumber = x.Key, TotalWeight = x.Sum(y => y.Weight)
                })
                    );

                ds.Lines       = new ObservableCollection <DailySummary.ReportLine>(res);
                ds.TotalWeight = res.Sum(x => x.Weight);
                ds.TotalBoxes  = res.Count;
                ds.ReportDate  = ExportDate;
                return(ds);
            }
        }
示例#2
0
        private void ViewTransSummary(object sender, RoutedEventArgs e)
        {
            ReportViewer.Visibility = Visibility.Visible;
            DailySummary res = null;

            res = im.PrepareTransactionSummary();

            DailyReportGD.DataContext = res;
        }
示例#3
0
        private async void ViewSummary(object sender, RoutedEventArgs e)
        {
            ReportViewer.Visibility = Visibility.Visible;
            DailySummary res = null;
            await Task.Run(() =>
            {
                res = im.PrepareDailySummary();
            }).ConfigureAwait(false);

            await Dispatcher.BeginInvoke(new Action(() =>
            {
                DailyReportGD.DataContext = res;
            }));
        }