示例#1
0
        private void bar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DateTime dateStart = ConvertUtil.ToDatetime(this.deStartTime.EditValue);
            DateTime dateEnd   = ConvertUtil.ToDatetime(this.deEndTime.EditValue);

            this.gridView1.Columns.Clear();
            this.gridControl1.RefreshDataSource();
            using (WaitDialogForm dialog = new WaitDialogForm())
            {
                switch (e.Item.Tag.ToString())
                {
                case "配货率":
                    this.bindingSource1.DataSource = ReportDal.GetDistribution(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 配货率",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "发货率":
                    this.bindingSource1.DataSource = ReportDal.GetDelivery(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 发货率",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "回款率":
                    this.bindingSource1.DataSource = ReportDal.GetReturnedMoney(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 回款率",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "销售单配货单量":
                    this.bindingSource1.DataSource = ReportDal.GetAllocationCargo(dateStart, dateEnd, 1);
                    this.groupControl1.Text        = string.Format("{0} - {1} 销售单 配货单量", dateStart, dateEnd);
                    break;

                case "调拨单配货单量":
                    this.bindingSource1.DataSource = ReportDal.GetAllocationCargo(dateStart, dateEnd, 2);
                    this.groupControl1.Text        = string.Format("{0} - {1} 调拨单 配货单量", dateStart, dateEnd);
                    break;

                case "配货件数":
                    this.bindingSource1.DataSource = ReportDal.GetPickedCount(dateStart, dateEnd);
                    this.groupControl1.Text        = string.Format("{0} - {1} 配货件数", dateStart, dateEnd);
                    break;

                case "配货金额":
                    this.bindingSource1.DataSource = ReportDal.GetPickedAmount(dateStart, dateEnd);
                    this.groupControl1.Text        = string.Format("{0} - {1} 配货金额", dateStart, dateEnd);
                    break;

                case "配货平均件数":
                    this.bindingSource1.DataSource = ReportDal.GetCountAvg(dateStart, dateEnd);
                    this.groupControl1.Text        = string.Format("{0} - {1} 配货平均件数", dateStart, dateEnd);
                    break;

                case "销售单验货单量":
                    this.bindingSource1.DataSource = ReportDal.GetExamineCargoCrop(dateStart, dateEnd, 1);
                    this.groupControl1.Text        = string.Format("{0} - {1} 销售单 验货单量",
                                                                   dateStart, dateEnd);
                    break;

                case "调拨单验货单量":
                    this.bindingSource1.DataSource = ReportDal.GetExamineCargoCrop(dateStart, dateEnd, 2);
                    this.groupControl1.Text        = string.Format("{0} - {1} 调拨单 验货单量",
                                                                   dateStart, dateEnd);
                    break;

                case "销售单装车单量":
                    this.bindingSource1.DataSource = ReportDal.GetTruckCropD(dateStart, dateEnd, 1);
                    this.groupControl1.Text        = string.Format("{0} - {1} 销售单 装车单量",
                                                                   dateStart, dateEnd);
                    break;

                case "调拨单装车单量":
                    this.bindingSource1.DataSource = ReportDal.GetTruckCropD(dateStart, dateEnd, 2);
                    this.groupControl1.Text        = string.Format("{0} - {1} 调拨单 装车单量",
                                                                   dateStart, dateEnd);
                    break;

                case "销售单装车金额":
                    this.bindingSource1.DataSource = ReportDal.GetTruckPriceD(dateStart, dateEnd, 1);
                    this.groupControl1.Text        = string.Format("{0} - {1} 销售单 装车金额",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "调拨单装车金额":
                    this.bindingSource1.DataSource = ReportDal.GetTruckPriceD(dateStart, dateEnd, 2);
                    this.groupControl1.Text        = string.Format("{0} - {1} 调拨单 装车金额",
                                                                   dateStart, dateEnd);
                    break;

                case "送货总金额":
                    this.bindingSource1.DataSource = ReportDal.GetDeliverGoodsPrice(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 送货总金额",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "配送完成单量":
                    this.bindingSource1.DataSource = ReportDal.GetTruckCrop(dateStart, dateEnd);
                    this.groupControl1.Text        = string.Format("{0} - {1} 配送完成单量",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "配送完成件数":
                    this.bindingSource1.DataSource = ReportDal.GetTruckCount(dateStart, dateEnd);
                    this.groupControl1.Text        = string.Format("{0} - {1} 配送完成件数",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "验收单量":
                    this.bindingSource1.DataSource = ReportDal.GetCheckCrop(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 验收单量",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "验收金额":
                    this.bindingSource1.DataSource = ReportDal.GetCheckPrice(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 验收金额",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "打印发货单量":
                    this.bindingSource1.DataSource = ReportDal.GetPrintDeliverGoodsCrop(dateStart.Date, dateEnd.Date);
                    this.groupControl1.Text        = string.Format("{0} - {1} 打印发货单量",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    break;

                case "收货单量与件数":
                    DataTable table = ReportDal.GetAsnBillCountAndTotalPiece(dateStart, dateEnd);
                    this.bindingSource1.DataSource = table;
                    this.groupControl1.Text        = string.Format("{0} - {1} 收货单量与件数",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    this.gridView1.Columns[0].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
                    this.gridView1.Columns[0].SummaryItem.DisplayFormat = "共计:{0:f0} 单";
                    this.gridView1.Columns[0].SummaryItem.FieldName     = "订单编号";
                    this.gridView1.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                    this.gridView1.Columns[1].SummaryItem.DisplayFormat = "共计: {0:f0} 件";
                    this.gridView1.Columns[1].SummaryItem.FieldName     = "总件数";
                    break;

                case "退货统计":
                    table = ReportDal.GetCrnReport(dateStart, dateEnd);
                    this.bindingSource1.DataSource = table;
                    this.groupControl1.Text        = string.Format("{0} - {1} 退货单统计",
                                                                   dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"));
                    this.gridView1.Columns[0].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
                    this.gridView1.Columns[0].SummaryItem.DisplayFormat = "共计:{0:f0} 单";
                    this.gridView1.Columns[0].SummaryItem.FieldName     = "订单编号";
                    this.gridView1.Columns[2].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                    this.gridView1.Columns[2].SummaryItem.DisplayFormat = "共计:{0:f0}";
                    this.gridView1.Columns[2].SummaryItem.FieldName     = "件数";
                    this.gridView1.Columns[3].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                    this.gridView1.Columns[3].SummaryItem.DisplayFormat = "共计:{0:f0}";
                    this.gridView1.Columns[3].SummaryItem.FieldName     = "上架数";
                    break;
                }
            }
        }