コード例 #1
0
        private void btn_exit_Click(object sender, EventArgs e)
        {
            if (typeReport == "SalesPeriodic")
            {
                rpt.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Reports\\RPTSalesPeriodic.rpt");

                try
                {
                    info.DatabaseName       = Properties.Settings.Default._databaseName;
                    info.ServerName         = Properties.Settings.Default._databaseServer;
                    info.UserID             = Properties.Settings.Default._databaseUser;
                    info.Password           = Properties.Settings.Default._databasePassword;
                    info.IntegratedSecurity = false;


                    //IFormatProvider culture = new CultureInfo("en-US", true);
                    //DateTime dateVal = DateTime.ParseExact(countriesname, "yyyy-MM-dd", culture);
                    //string datefrom = Convert.ToString(dateVal);


                    //DateTime dateValto = DateTime.ParseExact(dt_dateto.Value, "yyyy-MM-dd", culture);
                    //string dateto = Convert.ToString(dateValto);



                    ParameterField         paramdatefrom  = new ParameterField();
                    ParameterDiscreteValue ParamDateStart = new ParameterDiscreteValue();
                    ParamDateStart.Value = dt_datefrom.Value.Date;
                    paramdatefrom.Name   = "@startdate";
                    paramdatefrom.CurrentValues.Add(ParamDateStart);

                    ParameterField         paramendDate = new ParameterField();
                    ParameterDiscreteValue ParamDateEnd = new ParameterDiscreteValue();
                    ParamDateEnd.Value = dt_enddate.Value.Date;
                    paramendDate.Name  = "@enddate";
                    paramendDate.CurrentValues.Add(ParamDateEnd);
                    parameter.Add(paramendDate);



                    parameter.Add(paramdatefrom);



                    crystalReportViewer1.ParameterFieldInfo = parameter;
                    Util.AssignConnectionInfo(rpt, info, crystalReportViewer1);
                    crystalReportViewer1.ReportSource = rpt;
                }
                catch (Exception z)
                {
                    MessageBox.Show("Info", z.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            rpt.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Reports\\RPT_LossProfit.rpt");

            try
            {
                info.DatabaseName       = Properties.Settings.Default._databaseName;
                info.ServerName         = Properties.Settings.Default._databaseServer;
                info.UserID             = Properties.Settings.Default._databaseUser;
                info.Password           = Properties.Settings.Default._databasePassword;
                info.IntegratedSecurity = false;


                //IFormatProvider culture = new CultureInfo("en-US", true);
                //DateTime dateVal = DateTime.ParseExact(countriesname, "yyyy-MM-dd", culture);
                //string datefrom = Convert.ToString(dateVal);


                //DateTime dateValto = DateTime.ParseExact(dt_dateto.Value, "yyyy-MM-dd", culture);
                //string dateto = Convert.ToString(dateValto);



                ParameterField         paramMonth      = new ParameterField();
                ParameterDiscreteValue paramMonthindex = new ParameterDiscreteValue();
                paramMonthindex.Value = cb_month.selectedIndex + 1;
                paramMonth.Name       = "@month";
                paramMonth.CurrentValues.Add(paramMonthindex);

                ParameterField         paramYear      = new ParameterField();
                ParameterDiscreteValue paramYearIndex = new ParameterDiscreteValue();
                paramYearIndex.Value = int.Parse(txt_year.Text);
                paramYear.Name       = "@year";
                paramYear.CurrentValues.Add(paramYearIndex);
                parameter.Add(paramYear);



                parameter.Add(paramMonth);



                lossprofitviewer.ParameterFieldInfo = parameter;
                Util.AssignConnectionInfo(rpt, info, lossprofitviewer);
                lossprofitviewer.ReportSource = rpt;
            }
            catch (Exception z)
            {
                MessageBox.Show("Info", z.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void InvoiceViewer_Load(object sender, EventArgs e)
        {
            rpt.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Sales\\rEPORTiNVOICE.rpt");

            try
            {
                info.DatabaseName       = Properties.Settings.Default._databaseName;
                info.ServerName         = Properties.Settings.Default._databaseServer;
                info.UserID             = Properties.Settings.Default._databaseUser;
                info.Password           = Properties.Settings.Default._databasePassword;
                info.IntegratedSecurity = false;


                //IFormatProvider culture = new CultureInfo("en-US", true);
                //DateTime dateVal = DateTime.ParseExact(countriesname, "yyyy-MM-dd", culture);
                //string datefrom = Convert.ToString(dateVal);


                //DateTime dateValto = DateTime.ParseExact(dt_dateto.Value, "yyyy-MM-dd", culture);
                //string dateto = Convert.ToString(dateValto);



                ParameterField         paramSales   = new ParameterField();
                ParameterDiscreteValue paramsalesNo = new ParameterDiscreteValue();
                paramsalesNo.Value = sales;
                paramSales.Name    = "@salesNo";
                paramSales.CurrentValues.Add(paramsalesNo);



                parameter.Add(paramSales);



                invoiceReportViewer.ParameterFieldInfo = parameter;
                Util.AssignConnectionInfo(rpt, info, invoiceReportViewer);
                invoiceReportViewer.ReportSource = rpt;
            }
            catch (Exception z)
            {
                MessageBox.Show("Info", z.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }