예제 #1
0
        private void PrintBing()
        {
            string strsql = "SELECT material_stock.Material_id,";

            strsql += "material_stock.Material_inside_name,";
            strsql += "material_stock.Material_stock,";
            strsql += "material.Material_class";
            strsql += " FROM material_stock, material WHERE material_stock.Matid = material.Matid ORDER BY material.Material_class ASC,material_stock.Material_inside_name ASC ";

            ds_mat_stockReport ds   = new ds_mat_stockReport();
            MySqlConnection    conn = new MySqlConnection(connectstr.CONNECTSTR);

            conn.Open();
            try
            {
                MySqlCommand    cmd = new MySqlCommand(strsql, conn);
                MySqlDataReader dr  = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                ds.Tables["tb_mat_stockReport"].Load(dr);

                ReportDataSource rds = new ReportDataSource();
                mat_stockReportview.LocalReport.ReportEmbeddedResource = "MTsystem_win.printForm.mat_stockReportview.rdlc";
                rds.Name  = "ds_mat_stockReport";
                rds.Value = ds.Tables["tb_mat_stockReport"];

                mat_stockReportview.LocalReport.DataSources.Add(rds);

                this.mat_stockReportview.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
                this.mat_stockReportview.ZoomMode    = ZoomMode.PageWidth;
                this.mat_stockReportview.ZoomPercent = 100;
                this.mat_stockReportview.RefreshReport();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("错误代码:" + ex.Number + " 错误信息:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        /// <summary>
        /// 材料进仓日报表
        /// </summary>
        private void matInputReport()
        {
            string strsql;

            if (txt_Queryid.Text.Trim().Length != 0)
            {
                strsql  = "SELECT material_input.Material_id,";
                strsql += "material_input.Material_inside_name,material_input.Material_jlsl,";
                strsql += "material_input.Material_unit,material_input.Jlzl,material_input.Input_date,";
                strsql += "material.Material_class FROM material_input,material";
                strsql += " WHERE material_input.Material_id = '" + txt_Queryid.Text.Trim() + "'";
                strsql += " AND material_input.Input_date >= '" + dtp_Querydate.Value.ToShortDateString().Trim() + "'";
                strsql += " AND material_input.Input_date <= '" + dtp_QuerydateEnd.Value.ToShortDateString().Trim() + "'";
                strsql += " AND material_input.Matid = material.Matid";
                strsql += " ORDER BY material_input.Input_date ASC";
                #region
                ds_mat_stockReport ds   = new ds_mat_stockReport();
                MySqlConnection    conn = new MySqlConnection(connectstr.CONNECTSTR);
                conn.Open();
                try
                {
                    MySqlCommand    cmd = new MySqlCommand(strsql, conn);
                    MySqlDataReader dr  = null;
                    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    ds.Tables["tb_mat_inputReport"].Load(dr);

                    ReportDataSource rds = new ReportDataSource();
                    mat_dayReportview.LocalReport.ReportEmbeddedResource = "MTsystem_win.printForm.mat_dayinReportview.rdlc";
                    rds.Name  = "ds_mat_stockReport";
                    rds.Value = ds.Tables["tb_mat_inputReport"];

                    mat_dayReportview.LocalReport.DataSources.Add(rds);

                    this.mat_dayReportview.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
                    this.mat_dayReportview.ZoomMode    = ZoomMode.PageWidth;
                    this.mat_dayReportview.ZoomPercent = 100;
                    this.mat_dayReportview.RefreshReport();
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show("错误代码:" + ex.Number + " 错误信息:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                #endregion
            }
            else
            {
                if (cb_date.Checked)
                {
                    strsql  = "SELECT material_input.Material_id,";
                    strsql += "material_input.Material_inside_name,material_input.Material_jlsl,";
                    strsql += "material_input.Material_unit,material_input.Jlzl,material_input.Input_date,";
                    strsql += "material.Material_class FROM material_input,material";
                    strsql += " WHERE material_input.Input_date >= '" + dtp_Querydate.Value.ToShortDateString().Trim() + "'";
                    strsql += " AND material_input.Input_date <= '" + dtp_QuerydateEnd.Value.ToShortDateString().Trim() + "'";
                    strsql += " AND material_input.Matid = material.Matid";
                    strsql += " ORDER BY material_input.Input_date ASC";
                }
                else
                {
                    strsql  = "SELECT material_input.Material_id,";
                    strsql += "material_input.Material_inside_name,material_input.Material_jlsl,";
                    strsql += "material_input.Material_unit,material_input.Jlzl,material_input.Input_date,";
                    strsql += "material.Material_class FROM material_input,material";
                    strsql += " WHERE material_input.Input_date >= '" + dtp_Querydate.Value.ToShortDateString().Trim() + "'";
                    strsql += " AND material_input.Input_date <= '" + dtp_QuerydateEnd.Value.ToShortDateString().Trim() + "'";
                    strsql += " AND material_input.Matid = material.Matid";
                    strsql += " ORDER BY material.Material_class ASC";
                }
                #region
                ds_mat_stockReport ds   = new ds_mat_stockReport();
                MySqlConnection    conn = new MySqlConnection(connectstr.CONNECTSTR);
                conn.Open();
                try
                {
                    MySqlCommand    cmd = new MySqlCommand(strsql, conn);
                    MySqlDataReader dr  = null;
                    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    ds.Tables["tb_mat_inputReport"].Load(dr);

                    ReportDataSource rds = new ReportDataSource();
                    mat_dayReportview.LocalReport.ReportEmbeddedResource = "MTsystem_win.printForm.mat_dayinReportview.rdlc";
                    rds.Name  = "ds_mat_stockReport";
                    rds.Value = ds.Tables["tb_mat_inputReport"];

                    mat_dayReportview.LocalReport.DataSources.Add(rds);

                    this.mat_dayReportview.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
                    this.mat_dayReportview.ZoomMode    = ZoomMode.PageWidth;
                    this.mat_dayReportview.ZoomPercent = 100;
                    this.mat_dayReportview.RefreshReport();
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show("错误代码:" + ex.Number + " 错误信息:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                #endregion
            }
        }