Exemplo n.º 1
1
        public Boolean printReport(CrystalDecisions.CrystalReports.Engine.ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param1, String ParamName1, String param2, String ParamName2)
        {
            if (PrinterName=="none") return false;

            paramField.ParameterFieldName = ParamName1;
            discreteVal.Value = param1;
            paramField.CurrentValues.Add (discreteVal);
            paramFields.Add (paramField);
            crReport.DataDefinition.ParameterFields[0].CurrentValues.Add (discreteVal);

            paramField2.ParameterFieldName = ParamName2;
            discreteVal2.Value = param2;
            paramField2.CurrentValues.Add (discreteVal2);
            paramFields.Add (paramField2);
            crReport.DataDefinition.ParameterFields[1].CurrentValues.Add (discreteVal2);

            CrystalReportViewer1.ReportSource = crReport;
            CrystalReportViewer1.ParameterFieldInfo = paramFields;
            CrystalReportViewer1.RefreshReport();

            ParameterValues tmpParam = new ParameterValues();
            ParameterValues tmpParam2 = new ParameterValues();
            tmpParam.Add(discreteVal);
            tmpParam2.Add(discreteVal2);
            crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(tmpParam);
            crReport.DataDefinition.ParameterFields[1].ApplyCurrentValues(tmpParam2);
            crReport.PrintOptions.PrinterName = PrinterName;
            //			crReport.PrintToPrinter(1,false,1,1);
            crReport.PrintToPrinter(1,false,1,99);

            //Response.write (PrinterName);
            return true;
        }
Exemplo n.º 2
0
        public void reportes(string fecha1, string fecha2)
        {
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(metodos.ruta + "CrystalReportNominaSubdpto.rpt");


            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = cbNominas.Text;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions[fecha1];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterDiscreteValue.Value = cbSubdpto.Text;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions[fecha2];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Update();
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 3
0
        public void reportes(string fecha1, string fecha2)
        {
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(conexiones.ruta + "CrystalReportRegalia.rpt");


            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = dtpInicio.Value.ToShortDateString();
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions[fecha1];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterDiscreteValue.Value = dtpFinal.Value.ToShortDateString();
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions[fecha2];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Update();
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 4
0
        protected void ReportDocument_Load(object sender, EventArgs e)
        {
            sdate  = Session["sdate"].ToString();
            edate  = Session["edate"].ToString();
            gender = Session["gender"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;

            adapter = new SqlDataAdapter("select memberid, surname, firstname, Othername, mobile, regdate, gender from members where gender like '" + gender + "%' and regdate between '" + sdate + "' and '" + edate + "'", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "members");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);

            ReportDocument.ReportSource = rpt;
        }
Exemplo n.º 5
0
        protected void BankTransactionsReport_Load(object sender, EventArgs e)
        {
            sdate    = Session["sdate"].ToString();
            edate    = Session["edate"].ToString();
            currency = Session["currency"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();
            ParameterDiscreteValue paycur     = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;
            paycur.Value    = currency;

            adapter = new SqlDataAdapter("select transdate,transname,transtype,transmode,currency,amount,transbank,transaccount from banktransactions where currency = '" + currency + "' and transdate between '" + sdate + "' and '" + edate + "' order by transdate", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "banktransactions");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);
            parameters.Add(paycur);
            rpt.DataDefinition.ParameterFields["paycurrency"].ApplyCurrentValues(parameters);

            BankTransactionsReport.ReportSource = rpt;
        }
Exemplo n.º 6
0
        /// <summary>
        /// A report can contains more than One parameters, hence
        /// we loop through all parameters that user has input and match
        /// it with parameter definition of Crystal Reports file.
        /// </summary>
        public ParameterValues GetParameterValues(ParameterFieldDefinition ParameterDef)
        {
            ParameterValues paramValues = new ParameterValues();

            //ParameterValue paramValue;

            for (int j = 0; j < _userParams.Count; j++)
            {
                if (ParameterDef.Name == _userParams[j].ParameterName)
                {
                    if (ParameterDef.EnableAllowMultipleValue && _userParams[j].ParameterValue.IndexOf("|") != -1)
                    {
                        // multiple value parameter
                        List <string> values = new List <string>();
                        values = Helper.SplitIntoSingleValue(_userParams[j].ParameterValue); //split multiple value into single value regardless discrete or range

                        for (int k = 0; k < values.Count; k++)
                        {
                            ParameterValue paramValue = GetSingleParamValue(ParameterDef.DiscreteOrRangeKind, values[k], ParameterDef.Name);
                            paramValues.Add(paramValue);
                            _logger.Write(string.Format("Multiple Value Parameter - Prompt = {0} - {1} = {2}", ParameterDef.PromptText, ParameterDef.Name, _userParams[j].ParameterValue));
                        }
                    }
                    else
                    {
                        // simple single value parameter
                        ParameterValue paramValue = GetSingleParamValue(ParameterDef.DiscreteOrRangeKind, _userParams[j].ParameterValue, ParameterDef.Name);
                        paramValues.Add(paramValue);
                        _logger.Write(string.Format("Single Value Parameter - Prompt = {0} - {1} = {2}", ParameterDef.PromptText, _userParams[j].ParameterName, _userParams[j].ParameterValue));
                    }
                }
            }

            return(paramValues);
        }
Exemplo n.º 7
0
        private void Parametros(string parametro1, string parametro2)
        {
            ReportDocument crystalrpt = new ReportDocument();

            crystalrpt.Load(@"B:\Desarrollo\C#\GIT\INVAZD\Inventario_Avanzado\CrystalReport1.rpt");

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();


            // ----------Parametro Detalles----------
            crParameterDiscreteValue.Value = parametro1;
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["detalles"];
            crParameterValues.Add(crParameterDiscreteValue);
            //crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            // ----------Parametro cantidad----------
            crParameterDiscreteValue.Value = parametro2;
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["cantidad"];
            crParameterValues.Add(crParameterDiscreteValue);
            //crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterValues.Clear();

            crystalReportViewer1.ReportSource = crystalrpt;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 8
0
        protected void MemberReport_Load(object sender, EventArgs e)
        {
            sdate      = Session["sdate"].ToString();
            edate      = Session["edate"].ToString();
            occupation = Session["occupation"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;

            adapter = new SqlDataAdapter("select occupation, memberid, surname, Othername, telephone, regdate from members where occupation like '" + occupation + "%' and regdate between '" + sdate + "' and '" + edate + "' and active = 1", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "members");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);

            MemberReport.ReportSource = rpt;
        }
Exemplo n.º 9
0
        protected void VisitorPaymentReport_Load(object sender, EventArgs e)
        {
            sdate     = Session["sdate"].ToString();
            edate     = Session["edate"].ToString();
            visitorid = Session["rptVisitorID"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;

            adapter = new SqlDataAdapter("select * from vwVisitorProjectPayments where visitorid = '" + visitorid + "' and paydate between '" + sdate + "' and '" + edate + "' order by paydate", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "vwVisitorProjectPayments");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);

            VisitorPaymentReport.ReportSource = rpt;
        }
Exemplo n.º 10
0
        protected void loadReport(string cachedReports)
        {
            rptMonthlyBankPayment rpt = new rptMonthlyBankPayment();
            //int rptCacheTimeout = Convert.ToInt32(ConfigurationManager.AppSettings.Get("rptCacheTimeout").ToString());
            string                 connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection          connection       = new SqlConnection(connectionString);
            SqlDataAdapter         adapter          = new SqlDataAdapter();
            DataSet                ds         = new DataSet();
            string                 startdate  = Request.QueryString["st"].ToString();
            string                 enddate    = Request.QueryString["ed"].ToString();
            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue sdate      = new ParameterDiscreteValue();
            ParameterDiscreteValue edate      = new ParameterDiscreteValue();

            sdate.Value = startdate;
            edate.Value = enddate;
            adapter     = new SqlDataAdapter("select * from vwMonthlyBankPayment where (Adate between @startdate and @enddate)", connection);
            adapter.SelectCommand.Parameters.Add("@startdate", SqlDbType.DateTime).Value = startdate;
            adapter.SelectCommand.Parameters.Add("@enddate", SqlDbType.DateTime).Value   = enddate;
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "vwMonthlyBankPayment");
            rpt.SetDataSource(ds);
            parameters.Add(sdate);
            rpt.DataDefinition.ParameterFields["Startdate"].ApplyCurrentValues(parameters);
            parameters.Add(edate);
            rpt.DataDefinition.ParameterFields["Enddate"].ApplyCurrentValues(parameters);
            adapter.Dispose();
            connection.Dispose();
            //Cache.Insert(cachedReports, rpt, null, DateTime.MaxValue, TimeSpan.FromMinutes(rptCacheTimeout));
            Session[cachedReports] = rpt;
            MonthlyBankPaymentReport.ReportSource = rpt;
        }
Exemplo n.º 11
0
        protected void FinancialReport_Load(object sender, EventArgs e)
        {
            yyyymm   = Session["yyyymm"].ToString();
            currency = Session["currency"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue payyyyymm  = new ParameterDiscreteValue();
            ParameterDiscreteValue paycur     = new ParameterDiscreteValue();

            payyyyymm.Value = yyyymm;
            paycur.Value    = currency;

            adapter = new SqlDataAdapter("select * from MonthlyStatement where currency = '" + currency + "' and payyyyymm like '" + yyyymm + "%' order by payyyyymm", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "MonthlyStatement");
            rpt.SetDataSource(ds);

            parameters.Add(payyyyymm);
            rpt.DataDefinition.ParameterFields["payyyyymm"].ApplyCurrentValues(parameters);
            parameters.Add(paycur);
            rpt.DataDefinition.ParameterFields["paycurrency"].ApplyCurrentValues(parameters);

            FinancialReport.ReportSource = rpt;
        }
Exemplo n.º 12
0
        protected void HonorariumStatement_Load(object sender, EventArgs e)
        {
            sdate    = Session["sdate"].ToString();
            edate    = Session["edate"].ToString();
            currency = Session["currency"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();
            ParameterDiscreteValue paycur     = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;
            paycur.Value    = currency;

            adapter = new SqlDataAdapter("select paydate,payname,description,paytype,paymode,currency,amount from payments where description like '%Honorarium%' and currency = '" + currency + "' and paydate between '" + sdate + "' and '" + edate + "' order by paydate", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "payments");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);
            parameters.Add(paycur);
            rpt.DataDefinition.ParameterFields["paycurrency"].ApplyCurrentValues(parameters);

            HonorariumStatementReport.ReportSource = rpt;
        }
Exemplo n.º 13
0
        protected void VisitorsByGenderReport_Load(object sender, EventArgs e)
        {
            sdate = Request.QueryString["sdate"].ToString();
            edate = Request.QueryString["edate"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;

            adapter = new SqlDataAdapter("select gender, visitorid, surname, Othername, telephone, visitdate from visitors where visitdate between @startdate and @enddate", connection);
            adapter.SelectCommand.Parameters.Add("@startdate", SqlDbType.DateTime).Value = sdate;
            adapter.SelectCommand.Parameters.Add("@enddate", SqlDbType.DateTime).Value   = edate;
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "visitors");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);

            VisitorsByGenderReport.ReportSource = rpt;
        }
        private static void AddParameter(ref ParameterValues pValues, DiscreteOrRangeKind DoR, string inputString, string pName)
        {
            ParameterValue paraValue;

            if (DoR == DiscreteOrRangeKind.DiscreteValue || (DoR == DiscreteOrRangeKind.DiscreteAndRangeValue && inputString.IndexOf("(") == -1))
            {
                paraValue = new ParameterDiscreteValue();
                ((ParameterDiscreteValue)paraValue).Value = inputString;
                Console.WriteLine("Discrete Parameter : {0} = {1}", pName, ((ParameterDiscreteValue)paraValue).Value);

                if (enableLog)
                {
                    WriteLog("Discrete Parameter : " + pName + " = " + ((ParameterDiscreteValue)paraValue).Value);
                }

                pValues.Add(paraValue);
                paraValue = null;
            }
            else if (DoR == DiscreteOrRangeKind.RangeValue || (DoR == DiscreteOrRangeKind.DiscreteAndRangeValue && inputString.IndexOf("(") != -1))
            {
                paraValue = new ParameterRangeValue();
                ((ParameterRangeValue)paraValue).StartValue = GetStartValue(inputString);
                ((ParameterRangeValue)paraValue).EndValue   = GetEndValue(inputString);
                Console.WriteLine("Range Parameter : {0} = {1} to {2} ", pName, ((ParameterRangeValue)paraValue).StartValue, ((ParameterRangeValue)paraValue).EndValue);

                if (enableLog)
                {
                    WriteLog("Range Parameter : " + pName + " = " + ((ParameterRangeValue)paraValue).StartValue + " to " + ((ParameterRangeValue)paraValue).EndValue);
                }

                pValues.Add(paraValue);
                paraValue = null;
            }
        }
Exemplo n.º 15
0
        protected void SalesReportDocument_Load(object sender, EventArgs e)
        {
            sdate   = Session["sdate"].ToString();
            edate   = Session["edate"].ToString();
            product = Session["rptProduct"].ToString();

            ParameterValues        parameters = new ParameterValues();
            ParameterDiscreteValue startdate  = new ParameterDiscreteValue();
            ParameterDiscreteValue enddate    = new ParameterDiscreteValue();

            startdate.Value = sdate;
            enddate.Value   = edate;

            adapter = new SqlDataAdapter("select * from vwProductsSold where productid like '%" + product + "%' and salesdate between '" + sdate + "' and '" + edate + "' order by salesdate", connection);
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            adapter.Fill(ds, "vwProductsSold");
            rpt.SetDataSource(ds);

            parameters.Add(startdate);
            rpt.DataDefinition.ParameterFields["sDate"].ApplyCurrentValues(parameters);
            parameters.Add(enddate);
            rpt.DataDefinition.ParameterFields["eDate"].ApplyCurrentValues(parameters);

            SalesReportDocument.ReportSource = rpt;
        }
Exemplo n.º 16
0
        private void frmRMovimientoAlmacen_Load(object sender, EventArgs e)
        {
            try
            {
                string fechaInicio = frmMostrarMovimientoAlmacen.f1.dtpFechaInicio.Value.ToString("yyyy-MM-dd");
                string fechaFin    = frmMostrarMovimientoAlmacen.f1.dtpFechaFin.Value.ToString("yyyy-MM-dd");

                ReportDocument repdoc = new ReportDocument();
                //repdoc.Load(@"C:\Users\vioma\OneDrive\Documentos\Visual Studio 2017\Projects\SisVentas_ResAlm\CapaPresentacion\Reportes/RMovAlmacen.rpt");
                repdoc.Load(@"D:\Reportes\RMovAlmacen.rpt");
                ParameterFieldDefinitions pfds;
                ParameterFieldDefinition  pfd;

                ParameterValues        pvs = new ParameterValues();
                ParameterDiscreteValue pdv = new ParameterDiscreteValue();

                pdv.Value = Convert.ToDateTime(fechaInicio + " 00:00:00");
                pfds      = repdoc.DataDefinition.ParameterFields;
                pfd       = pfds["@fechaInicio"];
                pvs.Add(pdv);
                pfd.ApplyCurrentValues(pvs);


                pdv.Value = Convert.ToDateTime(fechaFin + " 23:59:59");
                pfds      = repdoc.DataDefinition.ParameterFields;
                pfd       = pfds["@fechaFin"];
                pvs.Add(pdv);
                pfd.ApplyCurrentValues(pvs);

                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
                ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
                Tables          CrTables;

                /*
                 * crConnectionInfo.ServerName = @"EQUIPO\SQLEXPRESS";
                 * crConnectionInfo.DatabaseName = "db_restauranteAlmacen";
                 * crConnectionInfo.UserID = "martin";
                 * crConnectionInfo.Password = "******";*/
                crConnectionInfo.ServerName   = @"EQUIPO\SQLEXPRESS";
                crConnectionInfo.DatabaseName = "SISVENTAS_CA";
                crConnectionInfo.UserID       = "admin";
                crConnectionInfo.Password     = "******";
                CrTables = repdoc.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }

                cvMovAlmacen.ReportSource = repdoc;
                cvMovAlmacen.Refresh();
            }

            catch (Exception ex)
            {
                MessageBox.Show("ERROR" + ex);
            }
        }
Exemplo n.º 17
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            
            ReportDocument report = new ReportDocument();

            report.Load(this.filePath);
            report.SetDatabaseLogon(userName, password, server, db);

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            //order no
            crParameterDiscreteValue.Value = txtFilter.Text;
            crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["orderNo"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            //start date
            crParameterDiscreteValue.Value = dtpStartDate.Value;
            crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["startDate"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            //end date
            crParameterDiscreteValue.Value = dtpEndDate.Value;
            crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["endDate"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);


            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            crConnectionInfo.ServerName = server;
            crConnectionInfo.DatabaseName = db;
            crConnectionInfo.UserID = userName;
            crConnectionInfo.Password = password;

            TableLogOnInfo logOnInfo = new TableLogOnInfo();
            logOnInfo.ConnectionInfo = crConnectionInfo;
            
            TableLogOnInfos logOnInfos = new TableLogOnInfos();
            logOnInfos.Add(logOnInfo);
            crystalReportViewer.LogOnInfo = logOnInfos;
            crystalReportViewer.ReportSource = report;
            crystalReportViewer.Refresh();
        }
Exemplo n.º 18
0
        private void frmRVentaCaja_Load(object sender, EventArgs e)
        {
            try
            {
                string fechaInicio = frmMostrarVentas.f1.dtpFechaInicio.Value.ToString("yyyy-MM-dd");
                string fechaFin    = frmMostrarVentas.f1.dtpFechaFin.Value.ToString("yyyy-MM-dd");
                // int idTrabajador = Convert.ToInt32(frmMostrarVentas.f1.lblBarra.Text);

                ReportDocument repdoc = new ReportDocument();
                repdoc.Load(@"C:\Users\vioma\OneDrive\Documentos\Visual Studio 2017\Projects\SISTEMAUCHPA_Barra1\CapaPresentacion\Reportes/RVentaCaja.rpt");
                // repdoc.Load(@"E:\Reportes\RVentasTrabajador.rpt");

                ParameterFieldDefinitions pfds;
                ParameterFieldDefinition  pfd;

                ParameterValues        pvs = new ParameterValues();
                ParameterDiscreteValue pdv = new ParameterDiscreteValue();

                pdv.Value = Convert.ToDateTime(fechaInicio + " 00:00:00");
                pfds      = repdoc.DataDefinition.ParameterFields;
                pfd       = pfds["@fechaInicio"];
                pvs.Add(pdv);
                pfd.ApplyCurrentValues(pvs);


                pdv.Value = Convert.ToDateTime(fechaFin + " 23:59:59");
                pfds      = repdoc.DataDefinition.ParameterFields;
                pfd       = pfds["@fechaFin"];
                pvs.Add(pdv);
                pfd.ApplyCurrentValues(pvs);

                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
                ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
                Tables          CrTables;

                crConnectionInfo.ServerName   = @"UCHPABAR\SQLUCHPA";
                crConnectionInfo.DatabaseName = "db_SISTEMAUCHPA";
                crConnectionInfo.UserID       = "sa";
                crConnectionInfo.Password     = "******";

                CrTables = repdoc.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }


                cvVentas.ReportSource = repdoc;
                cvVentas.Refresh();
            }

            catch (Exception ex)
            {
                MessageBox.Show("ERROR" + ex);
            }
        }
Exemplo n.º 19
0
 private void MicroRed(ReportClass rpt, string pidtmicrored)
 {
     crParameterDiscreteValue.Value = pidtmicrored;
     crParameterFieldDefinitions    = rpt.DataDefinition.ParameterFields;
     crParameterFieldDefinition     = crParameterFieldDefinitions["pidtmicrored"];
     crParameterValues.Add(crParameterDiscreteValue);
     crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
 }
Exemplo n.º 20
0
        public void GenerarVentasTodo()
        {
            //Llamas el reporte
            ReportDocument crystalrpt = new ReportDocument();

            crystalrpt.Load(@"C:\Users\Frank Crow-Belloso\Source\CapaDatos4\CapaPresentacion2\Modulo_Empleados\INTERFAZ_PRINCIPAL\VentasTodo.rpt");

            //declaras los metodos
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValue         = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

            //parametro Fecha Inicial
            crParameterDiscreteValue.Value = dtp_inicial.Value;
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["FechaInicial"];
            crParameterValue = crParameterFieldDefinition.CurrentValues;

            crParameterValue.Clear();
            crParameterValue.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValue);

            //parametro Fecha Final
            crParameterDiscreteValue.Value = dtp_final.Value;
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["FechaFinal"];
            crParameterValue = crParameterFieldDefinition.CurrentValues;

            crParameterValue.Clear();
            crParameterValue.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValue);

            //Parametro Nombre Producto
            crParameterDiscreteValue.Value = cb_producto.Text;
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["NombreProducto"];
            crParameterValue = crParameterFieldDefinition.CurrentValues;

            crParameterValue.Clear();
            crParameterValue.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValue);

            //Parametro Id Empleado
            crParameterDiscreteValue.Value = Convert.ToInt32(cb_empleado.Text.Substring(0, cb_empleado.Text.IndexOf(" -")));//Envio el IdVenta
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["IdEmpleado"];
            crParameterValue = crParameterFieldDefinition.CurrentValues;

            crParameterValue.Clear();
            crParameterValue.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValue);

            //Ejecuta el reporte
            crystalReportViewer1.ReportSource = crystalrpt;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 21
0
 protected override void Context()
 {
     base.Context();
     sut.Add(1, 0.1);
     sut.Add(2, 0.2);
     _valuesToMerge = new ParameterValues("PATH1");
     _valuesToMerge.Add(3, 0.3);
     _valuesToMerge.Add(4, 0.4);
     _valuesToMerge.Add(5, 0.5);
 }
        private void Bank_Account_Printcs_Load(object sender, EventArgs e)
        {
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(Application.StartupPath + @"\Bank Account Report.rpt");

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();



            crParameterDiscreteValue.Value = Day;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@Day"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);



            crParameterDiscreteValue.Value = Day2;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@Day2"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);



            crParameterDiscreteValue.Value = BankID;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@BankID"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);



            crParameterDiscreteValue.Value = BankName;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["name"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);


            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 23
0
        public void GetInventoryMonthly(string file)
        {
            int            year   = Convert.ToInt32(comboBox2.Text.Trim());
            string         month  = comboBox3.Text.Trim();
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(file);

            ConnectionInfo crConnectionInfo = new ConnectionInfo();

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = year;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["yearparam"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterDiscreteValue.Value = month;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["monthparam"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crConnectionInfo.ServerName   = "localhost";
            crConnectionInfo.DatabaseName = "slimmersdb";
            crConnectionInfo.UserID       = "root";
            crConnectionInfo.Password     = "******";

            inventoryView.ReportSource = cryRpt;
            inventoryView.RefreshReport();
            inventfilter  = "";
            inventfilter2 = "";
            panel7.Hide();
            btnSales.Enabled           = true;
            btnInventory.Enabled       = true;
            btnPatients.Enabled        = true;
            btnReceipts.Enabled        = true;
            btnAppointments.Enabled    = true;
            btnInventoryList.Enabled   = true;
            btnPullOut.Enabled         = true;
            btnRestock.Enabled         = true;
            Pulloutfilter.Enabled      = true;
            Restockfilter.Enabled      = true;
            inventoryFilter.Enabled    = true;
            bunifuFlatButton19.Enabled = true;
            bunifuFlatButton18.Enabled = true;
        }
Exemplo n.º 24
0
        private void Product_Account_Print_Load(object sender, EventArgs e)
        {
            string path      = Application.StartupPath;
            string directory = Path.GetDirectoryName(path);      //without file name
            string oneUp     = Path.GetDirectoryName(directory); // Temp folder


            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(Application.StartupPath + @"\Product Account Report.rpt");


            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();



            crParameterDiscreteValue.Value = Day;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@Day"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);



            crParameterDiscreteValue.Value = Day2;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@Day2"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);



            crParameterDiscreteValue.Value = product_ID;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@product_ID"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);



            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 25
0
        public void GetWeeklyAppoint(string file)
        {
            int            year   = Convert.ToInt32(comboBox7.Text.Trim());
            string         month  = comboBox8.Text.Trim();
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(file);

            ConnectionInfo crConnectionInfo = new ConnectionInfo();

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = year;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["yearparam"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterDiscreteValue.Value = month;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["monthparam"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crConnectionInfo.ServerName   = "localhost";
            crConnectionInfo.DatabaseName = "slimmersdb";
            crConnectionInfo.UserID       = "root";
            crConnectionInfo.Password     = "******";

            appointmentViewer.ReportSource = cryRpt;
            appointmentViewer.RefreshReport();

            appointfilter             = "";
            btnAppointments.Enabled   = true;
            btnInventory.Enabled      = true;
            btnPatients.Enabled       = true;
            btnReceipts.Enabled       = true;
            btnSales.Enabled          = true;
            appointmentFilter.Enabled = true;
            panel14.Visible           = false;
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            string cachedReports = "rptMonthlyInvoice_ByCompany";

            //int rptCacheTimeout = Convert.ToInt32(ConfigurationManager.AppSettings.Get("rptCacheTimeout").ToString());

            if (Session[cachedReports] == null)
            {
                ReportDocument         rd = new rptMonthlyInvoice();
                string                 connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                SqlConnection          connection       = new SqlConnection(connectionString);
                SqlDataAdapter         adapter          = new SqlDataAdapter();
                DataSet                ds         = new DataSet();
                string                 startdate  = Request.QueryString["st"].ToString();
                string                 enddate    = Request.QueryString["ed"].ToString();
                string                 companies  = Request.QueryString["comps"].ToString();
                ParameterValues        parameters = new ParameterValues();
                ParameterDiscreteValue sdate      = new ParameterDiscreteValue();
                ParameterDiscreteValue edate      = new ParameterDiscreteValue();
                sdate.Value = startdate;
                edate.Value = enddate;
                adapter     = new SqlDataAdapter("spGetMonthlyInvoiceByCompany", connection);
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                adapter.SelectCommand.Parameters.Add("@companies", SqlDbType.VarChar).Value  = companies;
                adapter.SelectCommand.Parameters.Add("@startdate", SqlDbType.DateTime).Value = startdate;
                adapter.SelectCommand.Parameters.Add("@enddate", SqlDbType.DateTime).Value   = enddate;
                if (connection.State == ConnectionState.Closed)
                {
                    connection.Open();
                }
                adapter.Fill(ds, "vwMonthlyInvoice");
                //rd.Load(Server.MapPath("rptDailyInvoice.rpt"));
                rd.SetDataSource(ds);
                parameters.Add(sdate);
                rd.DataDefinition.ParameterFields["Startdate"].ApplyCurrentValues(parameters);
                parameters.Add(edate);
                rd.DataDefinition.ParameterFields["Enddate"].ApplyCurrentValues(parameters);
                adapter.Dispose();
                connection.Dispose();
                //Cache.Insert(cachedReports, rd, null, DateTime.MaxValue, TimeSpan.FromMinutes(rptCacheTimeout));
                Session[cachedReports] = rd;
                MonthlyInvoiceReport_ByCompany.ReportSource = rd;
            }
            else
            {
                MonthlyInvoiceReport_ByCompany.ReportSource = Session[cachedReports];
            }
        }
Exemplo n.º 27
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ReportDocument crystalrpt = new ReportDocument();
                crystalrpt.Load(@"C:\Users\Lahkrome\Desktop\Beta Sinergia\alfa2_Sinergia\CrystalReport.rpt");
                //crystalReportViewer1.ReportSource = crystalrpt;
                //crystalReportViewer1.Refresh();
                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition crParameterFieldDefinition;
                ParameterValues crParameterValues = new ParameterValues();
                ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

                crParameterDiscreteValue.Value = textBox1.Text;
                crParameterFieldDefinitions = crystalrpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions["ProductName"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
                crystalReportViewer1.ReportSource = crystalrpt;
                crystalReportViewer1.Refresh();
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error"+ex);

            }
        }
        private void FrmVisualizadorContrato_Load(object sender, EventArgs e)
        {
            //ReportDocument report = new ReportDocument();
            //report.Load("C:\\Users\\João\\Documents\\Video Aulas\\Canal Professor Drausion\\1° Temporada\\KISNER_EVENTOS\\Apresentacao\\Relatorios\\Contrato\\RelContrato.rpt");
            //string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
            //report.Load("\\Relatorios\\Contrato\\RelContrato.rpt");
            Relatorios.Contrato.RelContrato report = new Relatorios.Contrato.RelContrato();

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = codEvento;
            crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["ParCodEvento"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            //trabalhando com os brinquedos escolhidos pelo usuário! Usando DataSet
            /*Relatorios.Contrato.DsEventoBrinquedo eb = new Relatorios.Contrato.DsEventoBrinquedo();
            DataTable brinquedos = eb.Tables.Add("DtBrinquedo");

            brinquedos.Columns.Add("codBrinquedo", Type.GetType("System.Int32"));
            brinquedos.Columns.Add("nome", Type.GetType("System.String"));

            BrinquedoColecao bc = new BrinquedoColecao();
            */

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crystalReportViewer1.ReportSource = report;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 29
0
        private void GroupReport_Load(object sender, EventArgs e)
        {
            repDoc = new ReportDocument();
            ParameterFields rptParams;
            ParameterValues paramValues;
            ParameterDiscreteValue paramDiscreteValue;
            ParameterField paramField;

            try
            {
                repDoc.Load("../../Reports/Group.rpt");
                //repDoc.Load("C:\\Users\\keith.sullivan\\Documents\\CIS\\CISApp\\CISApp\\Reports\\Group.rpt");
                rptParams = repDoc.ParameterFields;
                paramValues = new ParameterValues();
                paramDiscreteValue = new ParameterDiscreteValue();
                paramDiscreteValue.Value = groupId;
                paramValues.Add(paramDiscreteValue);
                paramField = rptParams["studentgroup"];
                paramField.CurrentValues = paramValues;
                crystalReportViewer1.ReportSource = repDoc;
                crystalReportViewer1.Refresh();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine("Could not connect to report");
            }
        }
Exemplo n.º 30
0
        public void ShowReport(string reportFileName, string reportTitle, string MaPN)
        {
            CRPPhieunhap rpt = new CRPPhieunhap();

            #region
            rpt.Load(string.Format("{0}\\Reports\\{1}", Application.StartupPath, reportFileName));
            TableLogOnInfo tli = new TableLogOnInfo();
            tli.ConnectionInfo.ServerName         = "WINDOWS-S8RLUFM\\SQLEXPRESS";
            tli.ConnectionInfo.DatabaseName       = "BibyShop";
            tli.ConnectionInfo.IntegratedSecurity = true;
            foreach (Table t in rpt.Database.Tables)
            {
                t.ApplyLogOnInfo(tli);
            }
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues        = new ParameterValues();
            ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = MaPN;
            crParameterFieldDefinitions    = rpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["@MaPN"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
            #endregion
            if (!string.IsNullOrEmpty(reportTitle))
            {
                rpt.SummaryInfo.ReportTitle = reportTitle;
            }

            CRVPhieunhap.ReportSource = rpt;
        }
Exemplo n.º 31
0
        private void updateMoleculeOntogeny(IndividualMolecule molecule, Ontogeny ontogeny, Population population, IReadOnlyList <double> allAges, IReadOnlyList <double> allGAs)
        {
            var ontogenyFactorPath   = _entityPathResolver.PathFor(molecule.OntogenyFactorParameter);
            var ontogenyFactorGIPath = _entityPathResolver.PathFor(molecule.OntogenyFactorGIParameter);

            molecule.Ontogeny = ontogeny;

            clearOntogenyFor(ontogenyFactorPath, ontogenyFactorGIPath, population);

            if (ontogeny.IsUndefined())
            {
                return;
            }

            var ontogenyFactors   = new ParameterValues(ontogenyFactorPath);
            var ontogenyFactorsGI = new ParameterValues(ontogenyFactorGIPath);

            for (int i = 0; i < population.NumberOfItems; i++)
            {
                var age = allAges[i];
                var ga  = allGAs[i];
                ontogenyFactors.Add(_ontogenyRepository.OntogenyFactorFor(ontogeny, CoreConstants.Groups.ONTOGENY_LIVER, age, ga, population.RandomGenerator));
                ontogenyFactorsGI.Add(_ontogenyRepository.OntogenyFactorFor(ontogeny, CoreConstants.Groups.ONTOGENY_DUODENUM, age, ga, population.RandomGenerator));
            }

            population.IndividualPropertiesCache.Add(ontogenyFactors);
            population.IndividualPropertiesCache.Add(ontogenyFactorsGI);
        }
Exemplo n.º 32
0
        private void button1_Click(object sender, EventArgs e)
        {
            var report = new rptTestimonial();

            ParameterValues pvValues = new ParameterValues();

            ParameterDiscreteValue pdvDiscreteValue = new ParameterDiscreteValue();

            pdvDiscreteValue.Value = textBox1.Text;

            pvValues.Add(pdvDiscreteValue);

            ParameterFieldDefinitions pfdDefinitions = report.DataDefinition.ParameterFields;

            ParameterFieldDefinition prdDefinition = pfdDefinitions["textThing"];

            prdDefinition.ApplyCurrentValues(pvValues);
            /*var data =
                Database.Row("learner_details a, enrollments b, enrollmentscourses c, courses d",
                             "a.Division = '" + clsGlobal.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
                             number.Selection +
                             "' AND b.LearnerKey = a.LearnerKey AND c.idEnrollments = b.idEnrollments AND" +
                             " d.idCourses = c.idCourses");*/
            report.DataDefinition.FormulaFields["mainText"].Text = "\"" + textBox1.Text + "\"";
            report.DataDefinition.FormulaFields["principle"].Text = "\"" + GlobalProperties.DivisionPrinciple + "\"";
            report.DataDefinition.FormulaFields["name"].Text = "\"" +  learner["Surname"] + ", " + learner["name"]+ "\"";
            report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number + "\"";
            //report.DataDefinition.FormulaFields["respParty"].Text = "\"" + clsGlobal.loggedOnUser + "\"";
            //report.DataDefinition.FormulaFields["course"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";

            //logs.WriteXml(@"C:\tmpXml.xml");
            var frmReport = new frmReport(report) { Text = "Testimonial" };
            frmReport.ShowDialog();
        }
        /// <summary>
        /// thực hiện khởi tạo vớibáo cáo MAHDN
        /// </summary>
        /// <param name="MAHDN"></param>
        public fReport(string MAHDN, string MANCC)
        {
            InitializeComponent();
            CrystalReportHoaDonNhap cr = new CrystalReportHoaDonNhap();

            cr.SetDataSource(CTHDNdao.Instance.getListCTHDNbyMAHD(MAHDN));

            ParameterFieldDefinitions crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;
            ParameterFieldDefinition  crParameterFieldDefinition  = crParameterFieldDefinitions["MANCC"];

            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = MANCC;

            ParameterValues crParameterValues = new ParameterValues();

            //reset lại value
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Add(crParameterDiscreteValue);

            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);


            crystalReportViewerBills.ReportSource = cr;
            crystalReportViewerBills.Refresh();
        }
Exemplo n.º 34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ReportDocument rd = new ReportDocument();

            rd.Load(Server.MapPath("~/Reports/crptDepartment.rpt"));

            ParameterFieldDefinition  pdf;
            ParameterFieldDefinitions pdfs;
            ParameterValues           pvs = new ParameterValues();
            ParameterDiscreteValue    pdv = new ParameterDiscreteValue();

            if (Session["User_Id"].ToString() != (100).ToString())
            {
                pdv.Value = Convert.ToInt16(Session["User_Id"]);
                pdfs      = rd.DataDefinition.ParameterFields;
                pdf       = pdfs["FacultyID"];
                pvs       = pdf.CurrentValues;

                pvs.Clear();
                pvs.Add(pdv);
                pdf.ApplyCurrentValues(pvs);
            }

            CrystalReportViewer1.ReportSource = rd;
        }
Exemplo n.º 35
0
        private void SetParameterFieldInfo(String fieldName, String fieldValue, String fieldName1, String FieldValue1)
        {
            ParameterDiscreteValue parameterDiscreteValue  = new ParameterDiscreteValue();
            ParameterDiscreteValue parameterDiscreteValue1 = new ParameterDiscreteValue();

            parameterDiscreteValue.Value  = fieldValue;
            parameterDiscreteValue1.Value = FieldValue1;
            ParameterValues currentParameterValues  = new ParameterValues();
            ParameterValues currentParameterValues1 = new ParameterValues();

            currentParameterValues.Add(parameterDiscreteValue);
            currentParameterValues1.Add(parameterDiscreteValue1);
            ParameterField parameterField  = new ParameterField();
            ParameterField parameterField1 = new ParameterField();

            parameterField.Name           = fieldName;
            parameterField.CurrentValues  = currentParameterValues;
            parameterField1.Name          = fieldName1;
            parameterField1.CurrentValues = currentParameterValues1;
            ParameterFields parameterFields = new ParameterFields();

            parameterFields.Add(parameterField);
            parameterFields.Add(parameterField1);
            crystalReportViewer1.ParameterFieldInfo = parameterFields;
        }
Exemplo n.º 36
0
        private void button1_Click(object sender, EventArgs e)
        {
            //esto va en el boton generar

            string fechainicial           = txtFecha1.Value.Year + "/" + txtFecha1.Value.Month + "/" + txtFecha1.Value.Day;
            string fechafinal             = txtFecha2.Value.Year + "/" + txtFecha2.Value.Month + "/" + txtFecha2.Value.Day;
            ReporteConsultaGeneral report = new ReporteConsultaGeneral();

            report.SetDatabaseLogon("root", "123456", "localhost", "sistemav");

            ParameterValues valor1 = new ParameterValues();
            ParameterValues valor2 = new ParameterValues();



            ParameterDiscreteValue fechai = new ParameterDiscreteValue();
            ParameterDiscreteValue fechaf = new ParameterDiscreteValue();

            fechai.Value = fechainicial;
            fechaf.Value = fechafinal;

            valor1.Add(fechai);
            valor2.Add(fechaf);

            report.DataDefinition.ParameterFields["fechaInicial"].ApplyCurrentValues(valor1);
            report.DataDefinition.ParameterFields["fechaFinal"].ApplyCurrentValues(valor2);
            this.crystalReportViewer1.ReportSource = report;
        }
Exemplo n.º 37
0
 private void SetCurrentValuesForParameterField(ParameterFields parameterFields, ArrayList arrayList)
 {
     ParameterValues currentParameterValues = new ParameterValues();
     foreach (object submittedValue in arrayList)
     {
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = submittedValue.ToString();
         currentParameterValues.Add(parameterDiscreteValue);
     }
     ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME];
     parameterField.CurrentValues = currentParameterValues;
 }
Exemplo n.º 38
0
        public void Read(string srr)
        {
            this.reportQuary = dateTimePicker1.Text + "  to  " + dateTimePicker2.Text;
            string query = "";

            query = "Select * From TbDailyIncome Where IncomeDate BETWEEN  '" + dateTimePicker1.Value.Date + "' AND  '" + dateTimePicker2.Value.Date + "' AND Debit = @Debit Order By IncomeDate";

            if (query != "")
            {

                SqlConnection conn = new SqlConnection(this.connectionString);
                SqlCommand comm = new SqlCommand(query, conn);

                comm.Parameters.Add("@Debit", SqlDbType.VarChar, 50);
                comm.Parameters["@Debit"].Value = comboBox1.Text;

                SqlDataAdapter adap = new SqlDataAdapter();
                DataSets.DebitVoucherDataSet dataset = new DataSets.DebitVoucherDataSet();
               DebitVoucherByDebitACCrystalReport crp = new DebitVoucherByDebitACCrystalReport();

                try
                {
                    conn.Open();
                    adap.SelectCommand = comm;
                    adap.Fill(dataset, "DataTable1");

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Close();
                }
                crp.SetDataSource(dataset);

                ParameterValues v = new ParameterValues();
                ParameterDiscreteValue dv = new ParameterDiscreteValue();

                dv = new ParameterDiscreteValue();
                dv.Value = this.reportQuary;
                v.Add(dv);
                crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);

                crystalReportViewer2.ReportSource = crp;
            }
        }
Exemplo n.º 39
0
      private void load_pass(CrystalReportPass crystal, string val)
      {
         ParameterFieldDefinitions crParameterFieldDefinitions;
         ParameterFieldDefinition crParameterFieldDefinition;
         ParameterValues crParameterValues = new ParameterValues();
         ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

         crParameterDiscreteValue.Value = val;
         crParameterFieldDefinitions = crystal.DataDefinition.ParameterFields;
         crParameterFieldDefinition = crParameterFieldDefinitions["idresep"];
         crParameterValues = crParameterFieldDefinition.CurrentValues;

         crParameterValues.Clear();
         crParameterValues.Add(crParameterDiscreteValue);
         crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
      }
Exemplo n.º 40
0
      private void load_pass(transaksiugd crystal, string val)
      {
         ParameterFieldDefinitions crParameterFieldDefinitions;
         ParameterFieldDefinition crParameterFieldDefinition;
         ParameterValues crParameterValues = new ParameterValues();
         ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

         crParameterDiscreteValue.Value = val;
         crParameterFieldDefinitions = crystal.DataDefinition.ParameterFields;
         crParameterFieldDefinition = crParameterFieldDefinitions["pasien"];
         crParameterValues = crParameterFieldDefinition.CurrentValues;

         crParameterValues.Clear();
         crParameterValues.Add(crParameterDiscreteValue);
         crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
      }
Exemplo n.º 41
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SessionBox.CheckUserSession())
            {
                Response.Redirect("~/Admin/Login.aspx");
            }
            else
            {
                //load crystal report
                ReportDocument Report = new ReportDocument();
                Report.Load(Server.MapPath("Sales_Return.rpt "));
                //this.CrystalReportSource1.Report.FileName = Server.MapPath("Sales_order.rpt");

                TableLogOnInfo logOnInfo = new TableLogOnInfo();
                logOnInfo.ConnectionInfo.ServerName = "USER-3924AC2E56";
                logOnInfo.ConnectionInfo.DatabaseName = "MyData";
                logOnInfo.ConnectionInfo.UserID = "sa";
                logOnInfo.ConnectionInfo.Password = "******";
                //对报表中的每个表进行循环 
                for (int i = 0; i < Report.Database.Tables.Count; i++)
                {
                    Report.Database.Tables[i].ApplyLogOnInfo(logOnInfo);
                }

                //load param
                //CrystalDecisions.Web.Parameter param = new CrystalDecisions.Web.Parameter();
                //param.Name = "OrderID";
                //param.DefaultValue = Request.QueryString["TextBoxId"].ToString().Trim();

                //add param
                //this.CrystalReportSource1.Report.Parameters.Add(param);
                ParameterValues ParamValues = new ParameterValues();
                ParameterDiscreteValue ParamValue = new ParameterDiscreteValue();
                ParamValue.Value = Request.QueryString["TextBoxId"].ToString().Trim();
                ParamValues.Add(ParamValue);
                Report.DataDefinition.ParameterFields[0].ApplyCurrentValues(ParamValues);

                //bind
                this.CrystalReportViewer1.ReportSource = Report;
                //this.CrystalReportViewer1.ReportSourceID = this.CrystalReportSource1.ID;
                //關閉左邊
                this.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
                //強制安裝ActiveX
                CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
                this.CrystalReportViewer1.DataBind();
            }
        }
        public void AddParameter(string i_paramName, string i_paramValue, ParameterFields o_paramFields)
        {
            ParameterField paramField = new ParameterField();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
            ParameterValues paramValues = new ParameterValues();

            // Set the name of the parameter to modify.
            paramField.ParameterFieldName = i_paramName;

            // Set a value to the parameter.
            paramDiscreteValue.Value = i_paramValue;
            paramValues.Add(paramDiscreteValue);
            paramField.CurrentValues = paramValues;

            // Add the parameter to the ParameterFields collection.
            o_paramFields.Add(paramField);
            //      Return paramFields
        }
Exemplo n.º 43
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.reportQuary = dateTimePicker1.Text + "  to  " + dateTimePicker2.Text;
            string query = "";

            query = "Select * From tblBankStatement Where TransDate BETWEEN  '" + dateTimePicker1.Value.Date + "' AND  '" + dateTimePicker2.Value.Date + "' Order By AutoId";
            if (query != "")
            {

                SqlConnection conn = new SqlConnection(this.connectionString);
                SqlCommand comm = new SqlCommand(query, conn);

                SqlDataAdapter adap = new SqlDataAdapter();
                DataSets.BankDataSet dataset = new DataSets.BankDataSet();
                BankStatementCrystalReport crp = new BankStatementCrystalReport();

                try
                {
                    conn.Open();
                    adap.SelectCommand = comm;
                    adap.Fill(dataset, "DataTable1");
                    crp.SetDataSource(dataset);
                    ParameterValues v = new ParameterValues();
                    ParameterDiscreteValue dv = new ParameterDiscreteValue();

                    dv = new ParameterDiscreteValue();
                    dv.Value = this.reportQuary;
                    v.Add(dv);
                    crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);

                    crystalReportViewer2.ReportSource = crp;

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Close();
                }

            }
        }
Exemplo n.º 44
0
        public void Read()
        {
            this.reportQuary = fromdateTimePicker.Text + "  to  " + todateTimePicker2.Text;
            string query = "";

            query = "Select * From TbAccountStatement Where CreateDate BETWEEN  '" + fromdateTimePicker.Value.Date + "' AND  '" + todateTimePicker2.Value.Date + "' Order By AutoId";
            if (query != "")
            {

                SqlConnection conn = new SqlConnection(this.connectionString);
                SqlCommand comm = new SqlCommand(query, conn);

                SqlDataAdapter adap = new SqlDataAdapter();
                AccountStatementDataSet dataset = new AccountStatementDataSet();
                AccountStatementCrystalReport crp = new AccountStatementCrystalReport();

                try
                {
                    conn.Open();
                    adap.SelectCommand = comm;
                    adap.Fill(dataset, "DataTable1");
                    crp.SetDataSource(dataset);
                    ParameterValues v = new ParameterValues();
                    ParameterDiscreteValue dv = new ParameterDiscreteValue();

                    dv = new ParameterDiscreteValue();
                    dv.Value = this.reportQuary;
                    v.Add(dv);
                    crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);

                    crystalReportViewer1.ReportSource = crp;

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 45
0
        private ParameterFields AddParameter(string paramName, string paramValue, ParameterFields paramFields)
        {
            ParameterField paramField = new ParameterField();
            ParameterDiscreteValue paramDiscreteValue = new
            ParameterDiscreteValue();
            ParameterValues paramValues = new ParameterValues();

            // 设置要修改的参数的名称。
            paramField.ParameterFieldName = paramName;

            // 为该参数设置一个值。
            paramDiscreteValue.Value = paramValue;
            paramValues.Add(paramDiscreteValue);
            paramField.CurrentValues = paramValues;

            // 将该参数添加到 ParameterFields 集合中。
            paramFields.Add(paramField);
            return paramFields;
        }
        private void fmProjectCosting_Load(object sender, EventArgs e)
        {
            crystalReportViewer1.Top = 0;
            try
            {
                ReportDocument cryRpt = new ReportDocument();
                string dir = System.IO.Directory.GetCurrentDirectory();
                dir = "Default_ProjectCost.rpt";
                cryRpt.Load(dir);
                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition crParameterFieldDefinition;
                ParameterValues crParameterValues = new ParameterValues();
                ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

                crParameterDiscreteValue.Value = orderid;
                crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions["orderid"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                crystalReportViewer1.ReportSource = cryRpt;
                //crystalReportViewer1.RefreshReport();

            }
            catch (LogOnException)
            {
                MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
            }
            catch (DataSourceException)
            {
                MessageBox.Show("An error has occurred while connecting to the database.");
            }
            catch (EngineException ex)
            {
                MessageBox.Show (ex.Message);
            }
        }
        private void setReport(string[] discretes, string[] values, ReportDocument reportSource)
        {
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            for (int i = 0; i < discretes.Length; i++)
            {
                crParameterDiscreteValue.Value = values[i];
                crParameterFieldDefinitions = reportSource.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions[discretes[i]];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
            }

            crystalReportViewer1.ReportSource = reportSource;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 48
0
        private void button1_Click(object sender, EventArgs e)
        {
            CrystalReport5 xxx = new CrystalReport5();
            xxx.DataSourceConnections[0].SetConnection("THANH\\SQLEXPRESS","Po",true);
            MessageBox.Show(xxx.DataSourceConnections[0].DatabaseName);
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();

            ParameterFieldDefinitions crParameterFieldDefinitions1;
            ParameterFieldDefinition crParameterFieldDefinition1;
            ParameterValues crParameterValues1 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
            ParameterDiscreteValue crParameterDiscreteValue1 = new ParameterDiscreteValue();


            crParameterDiscreteValue.Value = "1001";
            crParameterFieldDefinitions = xxx.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterDiscreteValue1.Value = textBox1.Text;
            crParameterFieldDefinitions1 = xxx.DataDefinition.ParameterFields;
            crParameterFieldDefinition1 = crParameterFieldDefinitions1["@Invoice_Number"];
            crParameterValues1 = crParameterFieldDefinition1.CurrentValues;

            crParameterValues1.Clear();
            crParameterValues1.Add(crParameterDiscreteValue1);
            crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);


            xxx.PrintToPrinter(1, true, 1, 1);
            crystalReportViewer1.ReportSource = xxx;
        }
        private void setReport(string[] discretes, string[] values, ReportDocument reportSource)
        {
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
            reportSource.SetDatabaseLogon(dbo.getDatabaseInformationLogon()[2], dbo.getDatabaseInformationLogon()[3], dbo.getDatabaseInformationLogon()[0], dbo.getDatabaseInformationLogon()[1]);

            for (int i = 0; i < discretes.Length; i++)
            {
                crParameterDiscreteValue.Value = values[i];
                crParameterFieldDefinitions = reportSource.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions[discretes[i]];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
            }

            crv.ReportSource = reportSource;
            crv.Refresh();
        }
Exemplo n.º 50
0
        public Boolean printReport(CrystalDecisions.CrystalReports.Engine.ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param, String ParamName)
        {
            bool success=false;
            if (PrinterName!="none")
            {
                try
                {
                    paramField.ParameterFieldName = ParamName;
                    discreteVal.Value = param;
                    paramField.CurrentValues.Add (discreteVal);
                    paramFields.Add (paramField);

                    crReport.DataDefinition.ParameterFields[0].CurrentValues.Add (discreteVal);
                    CrystalReportViewer1.ReportSource = crReport;
                    CrystalReportViewer1.ParameterFieldInfo = paramFields;
                    CrystalReportViewer1.RefreshReport();

                    ParameterValues tmpParam = new ParameterValues();
                    tmpParam.Add(discreteVal);
                    crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(tmpParam);
                    crReport.PrintOptions.PrinterName = PrinterName;
                    //crReport.PrintToPrinter(1,false,1,1);
                    crReport.PrintToPrinter(1,false,1,99);
                    success=true;
                }
                catch{}
            }
            return success;
        }
Exemplo n.º 51
0
        private void SetParameters(ReportDocument Report)
        {
            int iCtr = 0;
            string stModule = "";
            Reports.Receipt clsReceipt = new Reports.Receipt();
            //			Reports.ReceiptDetails clsReceiptDetails;

            Reports.ReceiptDetails[] ReportHeader = new Reports.ReceiptDetails[6];

            // print report footer
            for (iCtr = 1; iCtr <= 5; iCtr++)
            {
                stModule = "ReportHeader" + iCtr;
                ReportHeader[iCtr] = clsReceipt.Details(stModule);
            }

            Reports.ReceiptDetails[] ReportFooter = new Reports.ReceiptDetails[6];
            // print report footer
            for (iCtr = 1; iCtr <= 5; iCtr++)
            {
                stModule = "ReportFooter" + iCtr;
                ReportFooter[iCtr] = clsReceipt.Details(stModule);
            }

            clsReceipt.CommitAndDispose();

            ParameterFieldDefinition paramField;
            ParameterValues currentValues;
            ParameterDiscreteValue discreteParam;

            paramField = Report.DataDefinition.ParameterFields["CompanyCode"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = CompanyDetails.CompanyCode;
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader1"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[1]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader2"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[2]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader3"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[3]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader4"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[4]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["CONFIG_ENABLEEVAT"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = mclsTerminalDetails.EnableEVAT;
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportFooter1"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[1]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportFooter2"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[2]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportFooter3"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[3]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

        }
        public void Read(string srr)
        {
            //SqlConnection conn = new SqlConnection(this.connectionString);
            //SqlCommand comm = new SqlCommand("dbo.UspCreditVoucherExpenseWiseReport", conn);
            //comm.CommandType = CommandType.StoredProcedure;

            //comm.Parameters.Add("@Expense", SqlDbType.VarChar, 50);
            //comm.Parameters["@Expense"].Value = comboBox1.Text;

            //SqlDataAdapter adap = new SqlDataAdapter();
            //DataSets.CreditVoucher dataset = new DataSets.CreditVoucher();
            //Reports.CreditVoucherByExpenserystalReport crp = new Reports.CreditVoucherByExpenserystalReport();

            //try
            //{
            //    conn.Open();
            //    adap.SelectCommand = comm;
            //    adap.Fill(dataset, "DataTable1");
            //    crp.SetDataSource(dataset);
            //    crystalReportViewer1.ReportSource = crp;
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message.ToString());
            //}
            //finally
            //{
            //    conn.Close();
            //}

            this.reportQuary = dateTimePicker1.Text + "  to  " + dateTimePicker2.Text;
            string query = "";

            query = "Select * From TbDailyExpense Where ExpenseDate BETWEEN  '" + dateTimePicker1.Value.Date + "' AND  '" + dateTimePicker2.Value.Date + "' AND Expense = @Expense Order By ExpenseDate";
            if (query != "")
            {

                SqlConnection conn = new SqlConnection(this.connectionString);
                SqlCommand comm = new SqlCommand(query, conn);

                comm.Parameters.Add("@Expense", SqlDbType.VarChar, 50);
                comm.Parameters["@Expense"].Value = comboBox1.Text;

                SqlDataAdapter adap = new SqlDataAdapter();
                DataSets.CreditVoucher dataset = new DataSets.CreditVoucher();
                CreditVoucherByExpenserystalReport crp = new CreditVoucherByExpenserystalReport();

                try
                {
                    conn.Open();
                    adap.SelectCommand = comm;
                    adap.Fill(dataset, "DataTable1");

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Close();
                }
                crp.SetDataSource(dataset);

                ParameterValues v = new ParameterValues();
                ParameterDiscreteValue dv = new ParameterDiscreteValue();

                dv = new ParameterDiscreteValue();
                dv.Value = this.reportQuary;
                v.Add(dv);
                crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);

                crystalReportViewer2.ReportSource = crp;
            }
        }
Exemplo n.º 53
0
		private void SetParameters (ReportDocument Report)
		{
			ParameterFieldDefinition paramField;
			ParameterValues currentValues;
			ParameterDiscreteValue discreteParam;

			paramField = Report.DataDefinition.ParameterFields["CompanyName"];
			discreteParam = new ParameterDiscreteValue();
			discreteParam.Value = CompanyDetails.CompanyName;
			currentValues = new ParameterValues();
			currentValues.Add(discreteParam);
			paramField.ApplyCurrentValues(currentValues);

			paramField = Report.DataDefinition.ParameterFields["PrintedBy"];
			discreteParam = new ParameterDiscreteValue();
			discreteParam.Value = Session["Name"].ToString();
			currentValues = new ParameterValues();
			currentValues.Add(discreteParam);
			paramField.ApplyCurrentValues(currentValues);
		}
Exemplo n.º 54
0
        public void ViewEmpInsurance(int departmentID)
        {
            //ReportDocument rptDoc = new ReportDocument();
            ReportDocument rptDoc = null;
            PleaseWait.ShowProcess();
            ParameterValues pvUserName = new ParameterValues();
            ParameterDiscreteValue pdvUserName = new ParameterDiscreteValue();
            ParameterValues pvDepartmentID = new ParameterValues();
            ParameterDiscreteValue pdvDepartmentID = new ParameterDiscreteValue();

            pdvDepartmentID.Value = departmentID;

            pdvUserName.Value = WorkingContext.Username;
            pvUserName.Add(pdvUserName);

            try
            {
                // Load the report
                //rptDoc.Load(@"Reports/BHXH/InsuranceSDH02.rpt");
                rptDoc = new Reports.BHXH.InsuranceSDH02();
                pvDepartmentID.Add(pdvDepartmentID);
                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                reportName = "InsuranceSDH02";

            }
            catch (LoadSaveReportException Exp)
            {
                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                MessageBox.Show(str, str1);
            }
            catch (Exception Exp)
            {
                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                MessageBox.Show(Exp.Message, str2);
            }

            if (rptDoc != null)
            {
                SetDBLogonForReport(rptDoc);
            }
            PleaseWait.CloseProcess();
            frmReportPreview frm = new frmReportPreview();
            frm.SetReportDocument = rptDoc;
            frm.Show();
        }
Exemplo n.º 55
0
        private ReportDocument SetReport_JP()
        {
            //ReportDocument rptDoc = new ReportDocument();
            ReportDocument rptDoc = null;

            ParameterValues pvFromDate = new ParameterValues();
            ParameterValues pvToDate = new ParameterValues();
            ParameterValues pvMonth = new ParameterValues();
            ParameterValues pvYear = new ParameterValues();
            ParameterValues pvUserName = new ParameterValues();
            ParameterValues pvPicURL = new ParameterValues();
            ParameterDiscreteValue pdvFromDate = new ParameterDiscreteValue();
            ParameterDiscreteValue pdvToDate = new ParameterDiscreteValue();
            ParameterDiscreteValue pdvMonth = new ParameterDiscreteValue();
            ParameterDiscreteValue pdvYear = new ParameterDiscreteValue();
            ParameterDiscreteValue pdvUserName = new ParameterDiscreteValue();
            ParameterDiscreteValue pdvPicURL = new ParameterDiscreteValue();
            ParameterValues pvDepartmentID = new ParameterValues();
            ParameterDiscreteValue pdvDepartmentID = new ParameterDiscreteValue();
            if (optGlobal.Checked)
            {
                pdvDepartmentID.Value = 1;//mac dinh ban dau chon ca cong ty
            }
            else
            {
                pdvDepartmentID.Value = cboDepartment.SelectedValue;
            }
            pdvUserName.Value = WorkingContext.Username;
            pvUserName.Add(pdvUserName);
            switch (lstGroupReport.SelectedIndex)
            {

                #region  báo cáo nhân sự
                case 0:
                    switch (lstDetailReport.SelectedIndex)
                    {
                        case 0:// Báo cáo danh sách nhân viên
                            //rptDoc = new Reports_JP.EmployeeDepartment();
                            //rptDoc.Load(@"Reports_JP\EmployeeDepartment.rpt");
                            rptDoc = new Reports_JP.EmployeeDepartment();
                            reportName = "EmployeeDepartment";

                            break;
                        case 1:// Thông tin chi tiết nhân viên
                            dtpFromDate.Enabled = false;
                            dtpToDate.Enabled = false;
                            //rptDoc.Load(@"Reports_JP\AllEmployeeInfo.rpt");
                            rptDoc = new Reports_JP.AllEmployeeInfo();
                            //							pdvUserName.Value = WorkingContext.Username;
                            //							pvUserName.Add(pdvUserName);
                            pdvPicURL.Value = WorkingContext.Setting.PicturePath;
                            pvPicURL.Add(pdvPicURL);
                            //MessageBox.Show(pdvPicURL.Value.ToString());
                            pvDepartmentID.Add(pdvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["PicURL"].ApplyCurrentValues(pvPicURL);
                            rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                            reportName = "AllEmployeeInfo";

                            break;

                        case 2:// Danh sách nhân viên nghỉ
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\RestEmployee.rpt");
                                rptDoc = new Reports_JP.RestEmployee();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                //								pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                pvToDate.Add(pdvToDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@dtpFrom"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@dtpTo"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "RestEmployee";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }

                            //							MessageBox.Show("OK");

                            break;
                        case 3:// Bảng theo dõi cơm trưa
                            try
                            {
                                rptDoc = new Reports_JP.LunchSheet();

                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;

                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);

                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "LunchSheet";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 4:// Danh sách làm thêm giờ
                            try
                            {
                                rptDoc = new Reports_JP.RegOverTime();

                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pvFromDate.Add(pdvFromDate);
                                pvDepartmentID.Add(pdvDepartmentID);

                                rptDoc.DataDefinition.ParameterFields["@WorkingDay"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "RegOverTime";
                                reportDate = dtpFromDate.Value;
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //
                            break;

                        case 5://Danh sách nhân viên đi công tác

                            try
                            {
                                rptDoc = new Reports_JP.LeaveSchedule();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                pvToDate.Add(pdvToDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@dtpFrom"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@dtpEnd"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "LeaveSchedule";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 6:// Theo dõi thay đổi phòng ban
                            //rptDoc.Load(@"Reports_JP\DepartmentHistory.rpt");
                            rptDoc = new Reports_JP.DepartmentHistory();
                            pvDepartmentID.Add(pdvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                            reportName = "DepartmentHistory";

                            break;
                        case 7:// Theo dõi thay đổi chức vụ
                            rptDoc = new Reports_JP.PositionHistory();
                            pvDepartmentID.Add(pdvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                            reportName = "PositionHistory";

                            break;
                        case 8:// Theo dõi diễn biến lương nhân viên;
                            rptDoc = new Reports_JP.SalaryHistory();
                            pvDepartmentID.Add(pdvDepartmentID);
                            rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                            //							pvUserName.Add(pdvUserName);
                            rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                            reportName = "SalaryHistory";

                            break;
                        case 9://Thanh toán tiền phép theo phòng ban
                            try
                            {
                                rptDoc = new Reports_JP.RestSheet();
                                pvDepartmentID.Add(pdvDepartmentID);
                                pdvYear.Value = dtpFromDate.Value.Year;
                                pvYear.Add(pdvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "RestSheet";
                                reportDate = dtpFromDate.Value;
                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 10:// Danh sách suất ăn làm thêm
                            try
                            {
                                //rptDoc.Load(@"Reports_JP\LunchOverTime.rpt");
                                rptDoc = new Reports_JP.LunchOverTime();
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pvFromDate.Add(pdvFromDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                //								pdvUserName.Value = WorkingContext.Username;
                                //								pvUserName.Add(pdvUserName);
                                rptDoc.DataDefinition.ParameterFields["@WorkingDay"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);

                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "LunchOverTime";
                                reportDate = dtpFromDate.Value;
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //
                            break;
                        case 11:// Danh sách suất ăn làm thêm theo thang
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP/LunchOverTimeInMonth.rpt");
                                rptDoc = new Reports_JP.LunchOverTimeInMonth();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "LunchOverTimeInMonth";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;

                        case 12:// Danh sách nhân viên được thưởng
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports\PunishEmployee.rpt");
                                rptDoc = new Reports.AverageEmployee();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                //pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                //								pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                //pvToDate.Add(pdvToDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@dtpFromDate"].ApplyCurrentValues(pvFromDate);
                                //rptDoc.DataDefinition.ParameterFields["@dtpToDate"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "AverageEmployee";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //	MessageBox.Show("OK");

                            break;
                    }
                    break;
                #endregion
                #region báo cáo chấm công
                case 1:
                    switch (lstDetailReport.SelectedIndex)
                    {
                        case 0:// Báo cáo chấm công chi tiết ngày
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\DetailAttendance.rpt");
                                rptDoc = new Reports_JP.DetailAttendance();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                pvToDate.Add(pdvToDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@FromDate"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@ToDate"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "DetailAttendance";
                                reportDate = dtpFromDate.Value;
                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 1:// báo cáo chấm công tháng
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\TimeSheet.rpt");
                                rptDoc = new Reports_JP.TimeSheet();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                //								pdvUserName.Value = WorkingContext.Username;
                                //								pvUserName.Add(pdvUserName);
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "TimeSheet";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 2:// Danh sách nhân viên không quẹt thẻ
                            try
                            {
                                //rptDoc.Load(@"Reports_JP\InvalidStrike.rpt");
                                rptDoc = new Reports_JP.InvalidStrike();
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pvFromDate.Add(pdvFromDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@WorkingDay"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "InvalidStrike";
                                reportDate = dtpFromDate.Value;
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //
                            break;
                        case 3:// Tổng hợp nhân viên trong ngày
                            try
                            {
                                //rptDoc.Load(@"Reports_JP\EmployeeSummary.rpt");
                                rptDoc = new Reports_JP.EmployeeSummary();
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pvFromDate.Add(pdvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                rptDoc.DataDefinition.ParameterFields["@Date"].ApplyCurrentValues(pvFromDate);
                                reportName = "EmployeeSummary";
                                reportDate = dtpFromDate.Value;
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //
                            break;
                        case 4:// báo cáo tổng hợp dữ liệu của một nhân viên trong tháng
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\EmployeeSummaryInMonth.rpt");
                                rptDoc = new Reports_JP.EmployeeSummaryInMonth();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                //								pdvUserName.Value = WorkingContext.Username;
                                //								pvUserName.Add(pdvUserName);
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "EmployeeSummaryInMonth";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 5:// báo cáo tổng hợp dữ liệu của nhân viên trong một năm
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\EmployeeSummaryInYear.rpt");
                                rptDoc = new Reports_JP.EmployeeSummaryInYear();
                                // Set the discreet value to the customers name.
                                pdvYear.Value = dtpFromDate.Value.Year;
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "EmployeeSummaryInYear";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 6:// báo cáo chi tiết của từng nhân viên trong tháng
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\AttendanceRecord.rpt");
                                rptDoc = new Reports_JP.AttendanceRecord();
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value;
                                pvFromDate.Add(pdvFromDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "AttendanceRecord";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;

                        case 7:// Danh sách nhân viên không quẹt thẻ
                            try
                            {
                                //rptDoc.Load(@"Reports\InvalidStrike.rpt");
                                rptDoc = new Reports.InvalidStrikeYesterday();
                                //rptDoc = new Reports.InvalidStrikeYesterday();
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pvFromDate.Add(pdvFromDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@WorkingDay"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "InvalidStrikeYesterday";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //
                            break;

                        case 8://Bảng thanh toán lương tổng hợp theo phòng ban
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports\SalarySummary.rpt");
                                rptDoc = new Reports.TimeSheetSummary();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "Bao cao cham cong theo phong ban";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //
                            break;
                    }
                    break;
                #endregion
                #region báo cáo lương
                case 2:
                    switch (lstDetailReport.SelectedIndex)
                    {
                        case 0://Bảng thanh toán lương tổng hợp
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\SalarySheet.rpt");
                                rptDoc = new Reports_JP.SalarySheet();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "SalarySheet";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 1://Bảng thanh toán lương chi tiết nhân viên
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\DetailSalary.rpt");
                                rptDoc = new Reports_JP.DetailSalary();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                //							pdvUserName.Value = WorkingContext.Username;
                                //							pvUserName.Add(pdvUserName);
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "DetailSalary";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 2://Bảng tóm tắt lương nhân viên=> in lên phong bì
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\BriefSalary.rpt");
                                rptDoc = new Reports_JP.BriefSalary();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "BriefSalary";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 3://Bảng thanh toán lương tổng hợp theo phòng ban
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\SalarySummary.rpt");
                                rptDoc = new Reports_JP.SalarySummary();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "SalarySummary";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                        case 4://Bảng lương chi tiết từng nhân viên
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\SalaryPerEmployee.rpt");
                                rptDoc = new Reports_JP.SalaryPerEmployee();
                                // Set the discreet value to the customers name.
                                pdvMonth.Value = dtpFromDate.Value.Month;
                                pdvYear.Value = dtpFromDate.Value.Year;
                                //							pdvUserName.Value = WorkingContext.Username;
                                //							pvUserName.Add(pdvUserName);
                                // Add it to the parameter collection.
                                pvMonth.Add(pdvMonth);
                                pvYear.Add(pdvYear);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvMonth);
                                rptDoc.DataDefinition.ParameterFields["@Year"].ApplyCurrentValues(pvYear);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "SalaryPerEmployee";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            break;
                    }
                    break;
                #endregion
                #region báo cáo thưởng phạt
                case 3:
                    switch (lstDetailReport.SelectedIndex)
                    {
                        case 0:// Danh sách nhân viên được thưởng
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\PunishEmployee.rpt");
                                rptDoc = new Reports_JP.PunishEmployee();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                //								pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                pvToDate.Add(pdvToDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@dtpFromDate"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@dtpToDate"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "PunishEmployee";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //	MessageBox.Show("OK");

                            break;
                    }
                    break;
                #endregion
                #region Bảo hiểm Xã hội
                case 4:
                    switch (lstDetailReport.SelectedIndex)
                    {
                        case 0:// Danh sách nhân viên đóng BHXH theo tháng
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\SocialInsurance.rpt");
                                rptDoc = new Reports_JP.SocialInsurance();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                //							pdvFromDate.Value = dtpFromDate.Value.ToShortDateString();
                                //							pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                //							// Add it to the parameter collection.
                                //							pvFromDate.Add(pdvFromDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                //							rptDoc.DataDefinition.ParameterFields["@dtpFromDate"].ApplyCurrentValues(pvFromDate);
                                //							rptDoc.DataDefinition.ParameterFields["@dtpToDate"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                reportName = "SocialInsurance";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //	MessageBox.Show("OK");

                            break;
                        case 1:// Danh sách nhân viên điều chỉnh BHXH
                            try
                            {
                                // Load the report
                                //rptDoc.Load(@"Reports_JP\SocialInsuranceAdjust.rpt");
                                rptDoc = new Reports_JP.SocialInsuranceAdjust();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value;
                                //							pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                //								pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                //							pvToDate.Add(pdvToDate);
                                //							pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Month"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                //							rptDoc.DataDefinition.ParameterFields["@dtpToDate"].ApplyCurrentValues(pvToDate);
                                //							rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                optLocal.Enabled = false;
                                reportName = "SocialInsuranceAdjust";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //	MessageBox.Show("OK");

                            break;

                        case 2:// Danh sách lao động và quỹ tiền lương trích nộp BHXH
                            try
                            {
                                optLocal.Enabled = false;
                                // Load the report
                                //rptDoc.Load(@"Reports\BHXH\InsuranceC45.rpt");
                                rptDoc = new Reports.BHXH.InsuranceC45();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value;
                                //							pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                //								pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                //							pvToDate.Add(pdvToDate);
                                //							pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Date"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                //							rptDoc.DataDefinition.ParameterFields["@dtpToDate"].ApplyCurrentValues(pvToDate);
                                //							rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "InsuranceC45";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //	MessageBox.Show("OK");

                            break;

                        case 3:// Xác nhận người lao động nghỉ việc trông con ốm
                            try
                            {
                                optLocal.Enabled = true;
                                // Load the report
                                //rptDoc.Load(@"Reports\BHXH\RestLookChildEmployee.rpt");
                                rptDoc = new Reports.BHXH.RestLookChildEmployee();
                                // Set the connection information for all the tables used in the report
                                // Set the discreet value to the customers name.
                                pdvFromDate.Value = dtpFromDate.Value;
                                //							pdvToDate.Value = dtpToDate.Value.ToShortDateString();
                                //pdvDepartmentID.Value = cboDepartment.SelectedValue;
                                // Add it to the parameter collection.
                                pvFromDate.Add(pdvFromDate);
                                //							pvToDate.Add(pdvToDate);
                                pvDepartmentID.Add(pdvDepartmentID);
                                // Apply the current parameter values.
                                rptDoc.DataDefinition.ParameterFields["@Date"].ApplyCurrentValues(pvFromDate);
                                rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName);
                                //							rptDoc.DataDefinition.ParameterFields["@dtpToDate"].ApplyCurrentValues(pvToDate);
                                rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID);
                                reportName = "RestLookChildEmployee";
                                reportDate = dtpFromDate.Value;

                            }
                            catch (LoadSaveReportException Exp)
                            {
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1");
                                string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2");
                                //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo.");
                                MessageBox.Show(str, str1);
                            }
                            catch (Exception Exp)
                            {
                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3");

                                //MessageBox.Show(Exp.Message, "Có lỗi xảy ra");
                                MessageBox.Show(Exp.Message, str2);
                            }
                            //	MessageBox.Show("OK");

                            break;
                    }
                    break;
                #endregion
            }
            if (rptDoc != null)
            {
                SetDBLogonForReport(rptDoc);
            }
            return rptDoc;
        }
Exemplo n.º 56
0
		private void SetParameters (ReportDocument Report)
		{
			ParameterFieldDefinition paramField;
			ParameterValues currentValues;
			ParameterDiscreteValue discreteParam;

			paramField = Report.DataDefinition.ParameterFields["CompanyName"];
			discreteParam = new ParameterDiscreteValue();
			discreteParam.Value = CompanyDetails.CompanyName;
			currentValues = new ParameterValues();
			currentValues.Add(discreteParam);
			paramField.ApplyCurrentValues(currentValues);

			paramField = Report.DataDefinition.ParameterFields["PrintedBy"];
			discreteParam = new ParameterDiscreteValue();
			discreteParam.Value = Session["Name"].ToString();
			currentValues = new ParameterValues();
			currentValues.Add(discreteParam);
			paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["GroupToDisplay"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = cboGroup.SelectedItem.Value.ToString();
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["IncludeBalance"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = chkBalance.Checked;
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["IncludeInActive"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = cnkInActive.Checked;
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);
		}
        private void SendPO()
        {
            try
            {
                MySqlDataReader rdr = null;
                string email = "";
                string contact = "";
                string qry = "select c.email, c.contact from vendor c where c.ID = '" + cbVendor.Text + "';";
                rdr = MysqlInterface.DoQuery(qry);
                while (rdr.Read())
                {
                    email = rdr.GetString(0);
                    contact = rdr.GetString(1);
                }

                string orderid = tbOrderId.Text;
                ReportDocument cryRpt = new ReportDocument();
                string dir = System.IO.Directory.GetCurrentDirectory();
                dir = "PurchaseOrder.rpt";
                cryRpt.Load(dir);
                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition crParameterFieldDefinition;
                ParameterValues crParameterValues = new ParameterValues();
                ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

                crParameterDiscreteValue.Value = orderid;
                crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions["order_id"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
                cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "pos//po-" + orderid + ".pdf");

                Outlook.Application outlookApp = new Outlook.Application();
                Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                string directory = System.IO.Directory.GetCurrentDirectory();
                orderid = tbOrderId.Text;
                directory = directory + "\\pos\\po-" + orderid + ".pdf";
                mailItem.Attachments.Add(directory);
                mailItem.Subject = "Pinnacle Glass Doors - Purchase Order# " + orderid;
                mailItem.To = email;

                string name = contact;
                if (contact != "")
                {
                    int pos = name.IndexOf(' ');
                    if (pos != -1)
                        name = name.Substring(0, pos);
                }
                mailItem.Body = "Hi " + name + ",\n\n" + "Please see the attached purchase order. Please confirm pricing and ship date." +
                    "\n\nThank You,\n\n" + Globals.USER_NAME;
                mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
                mailItem.Display(true);

            }
            catch (LogOnException)
            {
                MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
            }
            catch (DataSourceException)
            {
                MessageBox.Show("An error has occurred while connecting to the database.");
            }
            catch (EngineException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnInPhieu_Click_1(object sender, EventArgs e)
        {
            expandableSplitter1.Expanded = true;
            btnInPhieu.Visible = false;
            btnTroLai.Visible = true;

            PhieuThu rp = new PhieuThu();
            ParameterValues a = new ParameterValues();
            ParameterDiscreteValue b = new ParameterDiscreteValue();
            b.Value = txtHoBenhNhan.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["HoBenhNhan"].ApplyCurrentValues(a);

            b.Value = txtTenBenhNhan.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["TenBenhNhan"].ApplyCurrentValues(a);

            b.Value = dtPicker_NgaySinh.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["NgaySinh"].ApplyCurrentValues(a);

            b.Value = txtNgheNghiep.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["NgheNghiep"].ApplyCurrentValues(a);

            b.Value = txtDiaChi.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["DiaChi"].ApplyCurrentValues(a);

            b.Value = txtTenDichVu.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["TenDichVu"].ApplyCurrentValues(a);

            b.Value = txtDonGia.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["DonGia"].ApplyCurrentValues(a);

            b.Value = txtMaPhieuThu.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["MaPhieuThu"].ApplyCurrentValues(a);

            b.Value = txtHoNhanVien.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["HoNhanVien"].ApplyCurrentValues(a);

            b.Value = txtTenNhanVien.Text;
            a.Add(b);
            rp.DataDefinition.ParameterFields["TenNhanVien"].ApplyCurrentValues(a);

            string tongtien = txtDonGia.Text.ToString();
            long tien = long.Parse(tongtien);
            So_chu(tien);

            b.Value = So_chu(tien).ToString();
            a.Add(b);
            rp.DataDefinition.ParameterFields["TongTien"].ApplyCurrentValues(a);

            crystalReportViewer1.ReportSource = rp;
        }
Exemplo n.º 59
0
        public void SetParameter(string parameterName, params object[] parameters)
        {
            ParameterValues currentParameterValues = new ParameterValues();

            for (int i = 0; i < parameters.Length; i++)
            {
                ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
                parameterDiscreteValue.Value = parameters[i].ToString();
                currentParameterValues.Add(parameterDiscreteValue);
            }

            ParameterFieldDefinitions parameterFieldDefinitions = _report.DataDefinition.ParameterFields;
            ParameterFieldDefinition parameterFieldDefinition = parameterFieldDefinitions[parameterName];
            parameterFieldDefinition.ApplyCurrentValues(currentParameterValues);
        }
        protected void SetReportParameters(string name, string value, CrystalReportViewer_VagasAgendadasBasico relatorio)
        {
            ParameterValues parameterValue = new ParameterValues();
            ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
            CultureInfo Iformat = CultureInfo.CurrentCulture;

            for (int i = 0; i < relatorio.DataDefinition.ParameterFields.Count; i++)
            {
                if (relatorio.DataDefinition.ParameterFields[i].Name == name)
                {
                    switch (relatorio.DataDefinition.ParameterFields[i].ValueType)
                    {

                        case FieldValueType.NumberField:

                            parameterDiscreteValue.Value = Convert.ToInt32(value);
                            parameterValue.Add(parameterDiscreteValue);
                            relatorio.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterValue);
                            break;
                        case FieldValueType.CurrencyField:

                            parameterDiscreteValue.Value = Convert.ToDouble(value);
                            parameterValue.Add(parameterDiscreteValue);
                            relatorio.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterValue);
                            break;
                        case FieldValueType.DateField:

                            parameterDiscreteValue.Value = Convert.ToDateTime(value, Iformat);
                            parameterValue.Add(parameterDiscreteValue);
                            relatorio.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterValue);
                            break;
                        case FieldValueType.DateTimeField:

                            parameterDiscreteValue.Value = Convert.ToDateTime(value, Iformat);
                            parameterValue.Add(parameterDiscreteValue);
                            relatorio.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterValue);
                            break;
                        case FieldValueType.BooleanField:

                            parameterDiscreteValue.Value = Convert.ToBoolean(value);
                            parameterValue.Add(parameterDiscreteValue);
                            relatorio.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterValue);
                            break;
                        case FieldValueType.StringField:
                            parameterDiscreteValue.Value = Convert.ToString(value);
                            parameterValue.Add(parameterDiscreteValue);
                            relatorio.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterValue);
                            break;
                    }
                }
            }
        }