コード例 #1
0
        private void btnSelect_Click_1(object sender, EventArgs e)
        {
            string strCondition = null;

            strCondition = " SELECT 1 排序, * FROM BTSKBM WHERE fdate='" + this.dateTimePicker1.Value.ToShortDateString() +
                           "' AND 收银员 LIKE '%" + this.textBox1.Text.Trim() + "%' ";
            strCondition += " UNION ALL ";
            strCondition += " SELECT 2 排序, fdate, NULL 收银员, '合计' 市场,NULL K3代码,NULL 客户名称,SUM(ISNULL(前日累欠,0))前日累欠, ";
            strCondition += " SUM(ISNULL(礼券,0))礼券 ,SUM(ISNULL(现金收款,0))现金收款,SUM(ISNULL(银行存款,0))银行存款, ";
            strCondition += " SUM(ISNULL([余额(不含当天销售)],0)) [余额(不含当天销售)],SUM(ISNULL(差额,0))差额,  ";
            strCondition += " SUM(ISNULL(头数1,0))头数1,SUM(ISNULL(重量1,0))重量1,SUM(ISNULL(金额1,0))金额1, ";
            strCondition += " SUM(ISNULL(头数2,0))头数2,SUM(ISNULL(重量2,0))重量2,SUM(ISNULL(金额2,0))金额2, ";
            strCondition += " SUM(ISNULL(头数3,0))头数3,SUM(ISNULL(重量3,0))重量3,SUM(ISNULL(金额3,0))金额3, ";
            strCondition += " SUM(ISNULL(头数4,0))头数4,SUM(ISNULL(重量4,0))重量4,SUM(ISNULL(金额4,0))金额4, ";
            strCondition += " SUM(ISNULL(头数5,0))头数5,SUM(ISNULL(重量5,0))重量5,SUM(ISNULL(金额5,0))金额5, ";
            strCondition += " SUM(ISNULL(折让金额,0))折让金额,SUM(ISNULL(当日应付,0))当日应付,SUM(ISNULL(次日实收现金,0))次日实收现金,SUM(ISNULL(累计余额,0))累计余额, ";
            strCondition += " NULL 欠款确认签名,NULL 内码,NULL 标记,NULL 账套 ";
            strCondition += " FROM BTSKBM WHERE fdate='" + this.dateTimePicker1.Value.ToShortDateString() + "' ";
            strCondition += " AND 收银员 LIKE '%" + this.textBox1.Text.Trim() + "%' ";
            strCondition += " AND 标记='明细'  GROUP BY fdate";
            strCondition += " ORDER BY 排序,K3代码,市场,标记";


            dt = db.GetDataTable(strCondition, "exceltab");



            if (this.radioButton1.Checked == true)
            {
                crystalReportViewer1.ReportSource = commUse.CrystalReports("btpfsk.rpt", strCondition, "BTSKBM");
            }
            if (this.radioButton2.Checked == true)
            {
                crystalReportViewer1.ReportSource = commUse.CrystalReports("Btsk_d_new.rpt", strCondition, "BTSKBM");
            }
        }
コード例 #2
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strCondition = null;

            if (dtpStartDate.Value.Date > dtpEndDate.Value.Date)
            {
                MessageBox.Show("开始日期不许大于结束日期", "软件提示");
                return;
            }

            strCondition = "Select * From SEOutStore Where IsFlag = '1' ";

            //起始日期
            if (dtpStartDate.ShowCheckBox)
            {
                if (dtpStartDate.Checked)
                {
                    strCondition += " and SEOutDate >= '" + dtpStartDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
            }

            //截止日期
            if (dtpEndDate.ShowCheckBox)
            {
                if (dtpEndDate.Checked)
                {
                    strCondition += " and SEOutDate <= '" + dtpEndDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
            }

            //客户
            if (cbxCustomerCode.SelectedValue != null)
            {
                strCondition += " and CustomerCode = '" + cbxCustomerCode.SelectedValue + "' ";
            }

            //产品
            if (cbxInvenCode.SelectedValue != null)
            {
                strCondition += " and InvenCode = '" + cbxInvenCode.SelectedValue + "' ";
            }

            crySelCollectReport.ReportSource = commUse.CrystalReports("CrySelCollectReport.rpt", strCondition,
                                                                      "SEOutStore");
        }
コード例 #3
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strCondition = null;

            if (dtpStartDate.Value.Date > dtpEndDate.Value.Date)
            {
                MessageBox.Show("开始日期不许大于结束日期", "软件提示");
                return;
            }

            strCondition = "Select * From PUInStore Where IsFlag = '1' ";

            //起始日期
            if (dtpStartDate.ShowCheckBox == true)
            {
                if (dtpStartDate.Checked == true)
                {
                    strCondition += " and PUInDate >= '" + dtpStartDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
            }

            //截止日期
            if (dtpEndDate.ShowCheckBox == true)
            {
                if (dtpEndDate.Checked == true)
                {
                    strCondition += " and PUInDate <= '" + dtpEndDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
            }

            //供应商
            if (cbxSupplierCode.SelectedValue != null)
            {
                strCondition += " and SupplierCode = '" + cbxSupplierCode.SelectedValue.ToString() + "' ";
            }

            //原材料
            if (cbxInvenCode.SelectedValue != null)
            {
                strCondition += " and InvenCode = '" + cbxInvenCode.SelectedValue.ToString() + "' ";
            }

            cryPurReport.ReportSource = commUse.CrystalReports("CryPurReport.rpt", strCondition, "PUInStore");
        }
コード例 #4
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strCondition = null;

            strCondition = "( {STStock.Quantity} < {BSInven.SmallStockNum} or {STStock.Quantity} > {BSInven.BigStockNum} )";

            //存货
            if (cbxStoreCode.SelectedValue != null)
            {
                strCondition += " and {STStock.StoreCode} = '" + cbxStoreCode.SelectedValue.ToString() + "' ";
            }

            //仓库
            if (cbxInvenCode.SelectedValue != null)
            {
                strCondition += " and {STStock.InvenCode} = '" + cbxInvenCode.SelectedValue.ToString() + "' ";
            }

            cryStockWarnReport.ReportSource = commUse.CrystalReports("CryStockWarnReport.rpt", strCondition);
        }
コード例 #5
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            string strCondition = null;//声明表示SQL语句的字符串

            if (dtpStartDate.Value.Date > dtpEndDate.Value.Date)
            {
                MessageBox.Show("开始日期不许大于结束日期", "软件提示");
                return;
            }
            //查询已审核的销售出库单
            strCondition = "Select * From SEOutStore Where SEOutStore.IsFlag = '1' ";

            //起始日期
            if (dtpStartDate.ShowCheckBox == true) //在日期控件中显示复选框
            {
                if (dtpStartDate.Checked == true)  //选中日期控件中的复选框
                {
                    //单据日期大于或等于开始日期
                    strCondition += " and  SEOutStore.SEOutDate >= '" + dtpStartDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
            }
            //截止日期
            if (dtpEndDate.ShowCheckBox == true) //在日期控件中显示复选框
            {
                if (dtpEndDate.Checked == true)  //选中日期控件中的复选框
                {
                    //单据日期小于或等于结束日期
                    strCondition += " and SEOutStore.SEOutDate <= '" + dtpEndDate.Value.ToString("yyyy-MM-dd") + "' ";
                }
            }
            if (cbxInvenCode.SelectedValue != null)
            {
                //指定产品
                strCondition += " and SEOutStore.InvenCode  = '" + cbxInvenCode.SelectedValue.ToString() + "' ";
            }
            //将统计得到的报表绑定到CrystalReportViewer控件
            crySelProfitCollectReport.ReportSource = commUse.CrystalReports("CrystalSelProfitCollectReport.rpt", strCondition, "SEOutStore");
        }
コード例 #6
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Trim().ToString() == "" && this.textBox2.Text.Trim().ToString() == "")
            {
                MessageBox.Show("必须输入客户代码 或客户名称");
                return;
            }

            //string sqlstr = " SELECT DISTINCT K3代码 FROM BTSKBM WHERE   标记='明细' and  fdate BETWEEN '" + this.dateTimePicker1.Value.ToShortDateString() +
            // "' AND '" + this.dateTimePicker2.Value.ToShortDateString() + "'  AND K3代码+客户名称 LIKE  '%" + this.textBox1.Text.Trim() + "%'";

            //DataSet ds = db.GetDataSet(sqlstr,"tab");
            // if (ds.Tables[0].Rows.Count!=1)
            // {
            //     MessageBox.Show("查询出的客户不是唯一或不存在!");
            //     return;
            // }
            string strCondition = null;

            if (rg1.Checked == true)
            {
                strCondition = " SELECT * FROM BTSKBM WHERE  标记='汇总' and  fdate BETWEEN '" + this.dateTimePicker1.Value.ToShortDateString() +
                               "' AND '" + this.dateTimePicker2.Value.ToShortDateString() + "' ";
                if (textBox1.Text.Trim().Length > 0)
                {
                    strCondition += " and K3代码='" + textBox1.Text.Trim() + "'";
                }
                if (textBox2.Text.Trim().Length > 0)
                {
                    strCondition += " and 客户名称='" + textBox2.Text.Trim() + "'";
                }
                strCondition += " ORDER BY fdate ";


                dt = db.GetDataTable(strCondition, "exceltab");

                crystalReportViewer1.ReportSource = commUse.CrystalReports("Btsk_d_dz.rpt", strCondition, "exceltab");
            }
            else if (rg2.Checked == true)
            {
//              strCondition = " SELECT * FROM BTSKBM WHERE  标记='明细' and  fdate BETWEEN '" + this.dateTimePicker1.Value.ToShortDateString() +
//"' AND '" + this.dateTimePicker2.Value.ToShortDateString() + "'  AND K3代码+客户名称 LIKE  '%" + this.textBox1.Text.Trim() + "%' ORDER BY fdate";

                strCondition = " SELECT * FROM BTSKBM WHERE  标记='明细' and  fdate BETWEEN '" + this.dateTimePicker1.Value.ToShortDateString() +
                               "' AND '" + this.dateTimePicker2.Value.ToShortDateString() + "' ";
                if (textBox1.Text.Trim().Length > 0)
                {
                    strCondition += " and K3代码='" + textBox1.Text.Trim() + "'";
                }
                if (textBox2.Text.Trim().Length > 0)
                {
                    strCondition += " and 客户名称='" + textBox2.Text.Trim() + "'";
                }

                strCondition += " ORDER BY fdate ";


                dt = db.GetDataTable(strCondition, "exceltab");

                crystalReportViewer1.ReportSource = commUse.CrystalReports("Btsk_d_dz.rpt", strCondition, "exceltab");
            }
        }