Exemple #1
0
        private void GetDishSaleDataComplete(object arg)
        {
            try
            {
                var result = (Tuple <string, DishSaleFullInfo>)arg;
                if (!string.IsNullOrEmpty(result.Item1))
                {
                    frmBase.Warning(result.Item1);
                    return;
                }

                _dishSaleFullInfo = result.Item2;
                UpdateDishIndex();
                DishSaleInfos.Clear();
                if (result.Item2 != null)
                {
                    result.Item2.DishSaleInfos.ForEach(DishSaleInfos.Add);
                }
            }
            catch (Exception ex)
            {
                AllLog.Instance.E(ex);
            }
            finally
            {
                TbTotalDish.Text   = string.Format("品项个数:{0}", DishSaleInfos.Count);
                TbTotalCount.Text  = string.Format("数量总计:{0}", DishSaleInfos.Sum(t => t.SalesCount));
                TbTotalAmount.Text = string.Format("金额合计:{0}", DishSaleInfos.Sum(t => t.SalesAmount));
            }
        }
        public static DishSaleFullInfo ToDishSaleFullInfo(GetDishSaleInfoResponse response)
        {
            var item = new DishSaleFullInfo();

            item.StartTime = DateTime.ParseExact(response.time.startTime, "yyyy-MM-dd HH:mm:ss", null);
            item.EndTime   = DateTime.ParseExact(response.time.endTime, "yyyy-MM-dd HH:mm:ss", null);
            if (response.data != null)
            {
                item.DishSaleInfos = response.data.Select(ToDishSaleInfo).ToList();
            }

            return(item);
        }
Exemple #3
0
        public static void PrintDishSaleDetail(DishSaleFullInfo fullInfo)
        {
            DataTable mainDb   = ToMainDb(fullInfo);
            DataTable detailDb = ToDetailDb(fullInfo.DishSaleInfos);
            DataSet   ds       = new DataSet();

            ds.Tables.Add(mainDb);
            ds.Tables.Add(detailDb);

            rptReport.Clear();
            string file = Application.StartupPath + @"\Reports\DishSaleDetail.frx";

            rptReport.Load(file);//加载报表模板文件
            InitializeReport(ds, ref rptReport, detailDb.TableName);
            PrintRpt(rptReport, 1);
        }
Exemple #4
0
        private static DataTable ToMainDb(DishSaleFullInfo fullInfo)
        {
            var        tb = new DataTable("tb_main");
            DataColumn dc = CreateDataColumn(typeof(DateTime), "起始时间", "StartTime", DateTime.MinValue);

            tb.Columns.Add(dc);
            dc = CreateDataColumn(typeof(DateTime), "结束时间", "EndTime", DateTime.MinValue);
            tb.Columns.Add(dc);
            dc = CreateDataColumn(typeof(DateTime), "当前时间", "CurrentTime", DateTime.MinValue);
            tb.Columns.Add(dc);
            dc = CreateDataColumn(typeof(string), "门店编号", "BranchId", "");
            tb.Columns.Add(dc);
            dc = CreateDataColumn(typeof(decimal), "合计金额", "TotalAmount", 0m);
            tb.Columns.Add(dc);

            AddObject2DataTable(tb, fullInfo);
            return(tb);
        }