private void btnQuery_Click(object sender, EventArgs e)
        {
            DifferentMonth.DifferentMonthDataTable dmdt = null;
            ControlBindDataSource cbds = new ControlBindDataSource();

            //判断月份是否合理
            if (dtpStartMonth.Value >= dtpEndMonth.Value)
            {
                MessageBox.Show("开始月份不许大于或等于结束月份!", "软件提示");
                return;
            }
            string strWhere = " Where 1 = 1 ";

            dmdt = this.GetDifferentMonthInfo(strWhere) as DifferentMonth.DifferentMonthDataTable;
            ReportDocument rd = cbds.CrystalReports(@"\UI\ChartAnalyse\CryReprot\CryDifferentMonthSaleAnalyse.rpt", dmdt);

            crvCollect.ReportSource = rd;
            TextObject txtNumValue = rd.ReportDefinition.ReportObjects["txtNumValue"] as TextObject;

            if (rbQuantity.Checked)
            {
                txtNumValue.Text = "销售数量(套)";
            }
            else
            {
                txtNumValue.Text = "销售金额(元)";
            }
            TextObject toDateRange = rd.ReportDefinition.ReportObjects["itoDateRange"] as TextObject;

            toDateRange.Text = "( " + dtpStartMonth.Value.Year.ToString() + "-" + dtpStartMonth.Value.Month.ToString() + " 至 "
                               + dtpEndMonth.Value.Year.ToString() + "-" + dtpEndMonth.Value.Month.ToString() + " )";
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            AllKinds.AllKindsDataTable akdt = null;
            ControlBindDataSource      cbds = new ControlBindDataSource();

            //判断日期是否合理
            if (dtpStartDate.Value.Date > dtpEndDate.Value.Date)
            {
                MessageBox.Show("开始日期不许大于结束日期!", "软件提示");
                return;
            }
            string strWhere = " Where 1 = 1 ";

            akdt = this.GetAllKindsInfo(strWhere) as AllKinds.AllKindsDataTable;
            ReportDocument rd = cbds.CrystalReports(@"\UI\ChartAnalyse\CryReprot\CryAllkindsSometimeSaleAnalyse.rpt", akdt);

            crvCollect.ReportSource = rd;
            TextObject txtNumValue = rd.ReportDefinition.ReportObjects["txtNumValue"] as TextObject;

            if (rbQuantity.Checked)
            {
                txtNumValue.Text = "销售数量(套)";
            }
            else
            {
                txtNumValue.Text = "销售金额(元)";
            }
            TextObject toDateRange = rd.ReportDefinition.ReportObjects["itoDateRange"] as TextObject;

            toDateRange.Text = "( " + dtpStartDate.Value.Year.ToString() + "-" + dtpStartDate.Value.Month.ToString() + "-" + dtpStartDate.Value.Day.ToString() + " 至 "
                               + dtpEndDate.Value.Year.ToString() + "-" + dtpEndDate.Value.Month.ToString() + "-" + dtpEndDate.Value.Day.ToString() + " )";
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strWhere = String.Empty;

            OperationCollect.OperationCollectDataTable dtCollect = null;
            ControlBindDataSource cbds = new ControlBindDataSource();

            //判断日期是否合理
            if (dtpStartDate.Value.Date > dtpEndDate.Value.Date)
            {
                MessageBox.Show("开始日期不许大于结束日期!", "软件提示");
                return;
            }
            //判断是否选择用户类型
            if (!chbAgent.Checked && !chbNoAgent.Checked)
            {
                MessageBox.Show("请选择一种用户类型!", "软件提示");
                return;
            }
            //只选择代理
            if (chbAgent.Checked && !chbNoAgent.Checked)
            {
                strWhere = " Where Customer.CustomerType = '1' ";
            }
            //只选择普通
            if (!chbAgent.Checked && chbNoAgent.Checked)
            {
                strWhere = " Where (Customer.CustomerType = '2' or Customer.CustomerType = '3') ";
            }
            //同时选中代理和普通
            if (chbAgent.Checked && chbNoAgent.Checked)
            {
                strWhere = " Where (Customer.CustomerType = '1' or Customer.CustomerType = '2' or Customer.CustomerType = '3') ";
            }
            dtCollect = this.GetCollectInfo(strWhere) as OperationCollect.OperationCollectDataTable;
            ReportDocument rd = cbds.CrystalReports(@"\UI\DataReport\CryReprot\CryOperationCollect.rpt", dtCollect);

            crvCollect.ReportSource = rd;
            TextObject toDateRange = rd.ReportDefinition.ReportObjects["itoDateRange"] as TextObject;
            TextObject toPrintDate = rd.ReportDefinition.ReportObjects["itoPrintDate"] as TextObject;
            TextObject toTile      = rd.ReportDefinition.ReportObjects["itoTitle"] as TextObject;

            toDateRange.Text = "( " + dtpStartDate.Value.Year.ToString() + "-" + dtpStartDate.Value.Month.ToString() + "-" + dtpStartDate.Value.Day.ToString() + " 至 "
                               + dtpEndDate.Value.Year.ToString() + "-" + dtpEndDate.Value.Month.ToString() + "-" + dtpEndDate.Value.Day.ToString() + " )";
            toPrintDate.Text = GlobalProperty.DBTime.Date.ToString("yyy-MM-dd");
            foreach (Control con in gbCollectType.Controls)
            {
                if (con.GetType() == typeof(RadioButton))
                {
                    if (((RadioButton)con).Checked)
                    {
                        toTile.Text = "编程词典" + ((RadioButton)con).Text + "表";
                    }
                }
            }
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strCondition        = null;
            string strWhere            = null;
            string strReportFileName   = null;
            string strTableName        = null;
            ControlBindDataSource cbds = new ControlBindDataSource();

            //判断日期是否合理
            if (dtpStartDate.Value.Date > dtpEndDate.Value.Date)
            {
                MessageBox.Show("开始日期不许大于结束日期!", "软件提示");
                return;
            }
            //判断是否选择用户类型
            if (!chbAgent.Checked && !chbNoAgent.Checked)
            {
                MessageBox.Show("请选择一种用户类型!", "软件提示");
                return;
            }
            //只选择代理
            if (chbAgent.Checked && !chbNoAgent.Checked)
            {
                strWhere = " Where Customer.CustomerType = '1' ";
            }
            //只选择普通
            if (!chbAgent.Checked && chbNoAgent.Checked)
            {
                strWhere = " Where (Customer.CustomerType = '2' or Customer.CustomerType = '3') ";
            }
            //同时选中代理和普通
            if (chbAgent.Checked && chbNoAgent.Checked)
            {
                strWhere = " Where (Customer.CustomerType = '1' or Customer.CustomerType = '2' or Customer.CustomerType = '3') ";
            }
            //销售
            if (rbSale.Checked)
            {
                strCondition = "Select SaleOrderBill.* From SaleOrderBill,Customer " + strWhere + " and SaleOrderBill.CustomerId = Customer.CustomerId and SaleOrderBill.SaleBillNo in (Select SaleTradeBill.SaleBillNo From SaleTradeBill) ";
                if (dtpStartDate.Checked)
                {
                    strCondition += " and SaleOrderBill.BillDate >= '" + dtpStartDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
                if (dtpStartDate.Checked)
                {
                    strCondition += " and SaleOrderBill.BillDate <= '" + dtpEndDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
                strReportFileName = "CrySaleList.rpt";
                strTableName      = "SaleOrderBill";
            }
            //退货
            if (rbUntread.Checked)
            {
                strCondition = "Select UntreadBaseBill.* From UntreadBaseBill,Customer " + strWhere + " and UntreadBaseBill.CustomerId = Customer.CustomerId ";
                if (dtpStartDate.Checked)
                {
                    strCondition += " and UntreadBaseBill.UntreadBillDate >= '" + dtpStartDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
                if (dtpStartDate.Checked)
                {
                    strCondition += " and UntreadBaseBill.UntreadBillDate <= '" + dtpEndDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
                strReportFileName = "CryUntreadList.rpt";
                strTableName      = "UntreadBaseBill";
            }
            //调货
            if (rbBarter.Checked)
            {
                strCondition = "Select BarterBaseBill.* From BarterBaseBill,Customer " + strWhere + " and BarterBaseBill.CustomerId = Customer.CustomerId ";
                if (dtpStartDate.Checked)
                {
                    strCondition += " and BarterBaseBill.BarterBillDate >= '" + dtpStartDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
                if (dtpStartDate.Checked)
                {
                    strCondition += " and BarterBaseBill.BarterBillDate <= '" + dtpEndDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
                strReportFileName = "CryBarterList.rpt";
                strTableName      = "BarterBaseBill";
            }


            ReportDocument rd = cbds.CrystalReports(@"\UI\DataReport\CryReprot\" + strReportFileName, strCondition, strTableName);

            crvList.ReportSource = rd;  //显示数据
            TextObject toDateRange = rd.ReportDefinition.ReportObjects["itoDateRange"] as TextObject;
            TextObject toPrintDate = rd.ReportDefinition.ReportObjects["itoPrintDate"] as TextObject;

            toDateRange.Text = "( " + dtpStartDate.Value.Year.ToString() + "-" + dtpStartDate.Value.Month.ToString() + "-" + dtpStartDate.Value.Day.ToString() + " 至 "
                               + dtpEndDate.Value.Year.ToString() + "-" + dtpEndDate.Value.Month.ToString() + "-" + dtpEndDate.Value.Day.ToString() + " )";
            toPrintDate.Text = GlobalProperty.DBTime.Date.ToString("yyy-MM-dd");
        }