Exemplo n.º 1
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.º 2
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.º 3
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;
        }
        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.º 5
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.º 6
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;
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
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);

            }
        }
Exemplo n.º 9
0
        // ================================================================================================= ||
        // Esta linea de codigo representa el metodo imprimir() para imprimir la factura en la cual estemos
        // trabajando
        // ================================================================================================= ||

        private void imprimir()
        {
            try
            {
                ReportDocument crystalrpt = new ReportDocument();
                crystalrpt.Load("C:\\Users\\JOSE\\Documents\\Visual Studio 2013\\Projects\\Proyectos\\Lavanderia0.1\\Lavanderia0.1\\reporte1.rpt");

                ParameterFieldDefinition  definicion_parametro;
                ParameterFieldDefinitions definiciones_parametros;
                ParameterValues           valor         = new ParameterValues();
                ParameterDiscreteValue    discretevalor = new ParameterDiscreteValue();

                discretevalor.Value     = f.dameid1();
                definiciones_parametros = crystalrpt.DataDefinition.ParameterFields;
                definicion_parametro    = definiciones_parametros["param1"];
                valor = definicion_parametro.CurrentValues;

                valor.Clear();
                valor.Add(discretevalor);
                definicion_parametro.ApplyCurrentValues(valor);
                crystalrpt.PrintToPrinter(1, true, 0, 0);
            }
            catch (CrystalReportsException cr)
            {
                MessageBox.Show(cr.Message);
            }
            catch (Exception e) { MessageBox.Show(e.Message); }
        }
Exemplo n.º 10
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.º 11
0
        private void printBatchToolStripButton_Click(object sender, EventArgs e)
        {
            long           batchId = (long)this.aCHFileDataGridView.SelectedRows[0].Cells[0].Value;
            ReportDocument report  = new ReportDocument();

            report.Load(@"\\cfs-fileserv01\ACHReports\Abra Reports\Misc\ACH Batch Details.rpt");

            ParameterFieldDefinitions parameters = report.DataDefinition.ParameterFields;
            ParameterFieldDefinition  parameter  = parameters["BatchId"];


            ParameterDiscreteValue parameterValue = new ParameterDiscreteValue();

            parameterValue.Value = batchId;

            ParameterValues values = new ParameterValues();

            values = parameter.CurrentValues;
            values.Clear();
            values.Add(parameterValue);
            parameter.ApplyCurrentValues(values);



            if (this.printDialog.ShowDialog() == DialogResult.OK)
            {
                report.PrintOptions.PrinterName = this.printDialog.PrinterSettings.PrinterName;
                report.PrintToPrinter(1, false, 0, 0);
            }
        }
Exemplo n.º 12
0
        public void reportes(string fecha1, string fecha2)
        {
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(metodos.ruta + "CrystalReportNominaDpto.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 = cbDpto.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.º 13
0
        void Ticket(string parametro)
        {
            CapaPresentacion.Venta_Ticket VT = new CapaPresentacion.Venta_Ticket();
            //Llamas el reporte
            ReportDocument crystalrpt = new ReportDocument();

            crystalrpt.Load(@"C:\Users\Frank Crow-Belloso\Source\CapaDatos4\CapaPresentacion\Ticket.rpt");

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

            //parametro 1
            crParameterDiscreteValue.Value = parametro;//Envio el IdVenta
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["IdVenta"];
            crParameterValue = crParameterFieldDefinition.CurrentValues;

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

            //Ejecuta el reporte
            VT.crystalReportViewer1.ReportSource = crystalrpt;
            VT.crystalReportViewer1.Refresh();
            VT.ShowDialog();
        }
Exemplo n.º 14
0
        private void InHoaDon_Load(object sender, EventArgs e)
        {
            ReportDocument crypt = new ReportDocument();

            crypt.Load("F:/Documents/GitHub/QuanLyCafe/QuanLyCafe/CrystalReport1.rpt");
            ParameterFieldDefinitions pfds;
            ParameterFieldDefinition  pfd;
            ParameterValues           pv  = new ParameterValues();
            ParameterDiscreteValue    pdv = new ParameterDiscreteValue();

            pdv.Value = mabill;
            pfds      = crypt.DataDefinition.ParameterFields;
            pfd       = pfds["MaBill"];
            pv        = pfd.CurrentValues;
            pv.Clear();
            pv.Add(pdv);
            pfd.ApplyCurrentValues(pv);
            ParameterValues        pv1  = new ParameterValues();
            ParameterDiscreteValue pdv1 = new ParameterDiscreteValue();

            pdv1.Value = Giamgia;
            pfds       = crypt.DataDefinition.ParameterFields;
            pfd        = pfds["GiamGia"];
            pv1        = pfd.CurrentValues;
            pv1.Clear();
            pv1.Add(pdv1);
            pfd.ApplyCurrentValues(pv1);
            crystalReportViewer1.ReportSource = crypt;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 15
0
        private void previewBatchToolStripButton1_Click(object sender, EventArgs e)
        {
            ReportDocument report = new ReportDocument();

            report.Load(@"\\cfs-fileserv01\ACHReports\ACH Batch Details.rpt");

            ParameterFieldDefinitions parameters = report.DataDefinition.ParameterFields;
            ParameterFieldDefinition  parameter  = parameters["BatchId"];


            ParameterDiscreteValue parameterValue = new ParameterDiscreteValue();

            parameterValue.Value = this._batchId;

            ParameterValues values = new ParameterValues();

            values = parameter.CurrentValues;
            values.Clear();
            values.Add(parameterValue);
            parameter.ApplyCurrentValues(values);


            Reports.PreviewReport preview = new Cfs.Custom.Software.Reports.PreviewReport();
            preview.Report    = report;
            preview.MdiParent = this.ParentForm;
            preview.Show();
        }
Exemplo n.º 16
0
        private void printReportToolStripButton_Click(object sender, EventArgs e)
        {
            ReportDocument report = new ReportDocument();

            report.Load(@"\\cfs-intranet\Abra Reports\Misc\ACH Batch Details.rpt");

            ParameterFieldDefinitions parameters = report.DataDefinition.ParameterFields;
            ParameterFieldDefinition  parameter  = parameters["BatchId"];


            ParameterDiscreteValue parameterValue = new ParameterDiscreteValue();

            parameterValue.Value = this._batchId;

            ParameterValues values = new ParameterValues();

            values = parameter.CurrentValues;
            values.Clear();
            values.Add(parameterValue);
            parameter.ApplyCurrentValues(values);



            if (this.printDialog.ShowDialog() == DialogResult.OK)
            {
                report.PrintOptions.PrinterName = this.printDialog.PrinterSettings.PrinterName;
                report.PrintToPrinter(1, false, 0, 0);
            }
        }
Exemplo n.º 17
0
        private void CRviewer_Load(object sender, EventArgs e)
        {
            try
            {
                String PsngrId = PID;



                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load("C:\\Users\\HOME\\Desktop\\Running\\Railway_Reservation_System\\RailForms\\CRticket.rpt");

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


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

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


                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 18
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;
        }
        private void comboUsername_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load("C:\\Users\\HOME\\Desktop\\Running\\Railway_Reservation_System\\RailForms\\ByUserReservation.rpt");

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

                crParameterDiscreteValue.Value = comboUsername.Text;
                crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition     = crParameterFieldDefinitions["UserName"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
        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.º 21
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            CapaPresentacion.Venta_Ticket VT = new CapaPresentacion.Venta_Ticket();
            //Llamas el reporte
            ReportDocument crystalrpt = new ReportDocument();

            crystalrpt.Load(@"C:\Users\pclr\Desktop\CapaPresentacion\CapaPresentacion\Ticket.rpt");

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

            //parametro 1
            crParameterDiscreteValue.Value = "111";//Envio el IdVenta
            crParameterFieldDefinitions    = crystalrpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["IdVenta"];
            crParameterValue = crParameterFieldDefinition.CurrentValues;

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

            //Ejecuta el reporte
            VT.crystalReportViewer1.ReportSource = crystalrpt;
            VT.crystalReportViewer1.Refresh();
            VT.ShowDialog();
        }
Exemplo n.º 22
0
        public static bool export_pdf(string pdf_path, string db_name, string crystal_path, string docentry)
        {
            try
            {
                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load(crystal_path);

                new TableLogOnInfos();
                TableLogOnInfo crtableLogoninfo;
                var            crConnectionInfo = new ConnectionInfo();

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

                crParameterDiscreteValue.Value = Convert.ToString(docentry);
                crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition     = crParameterFieldDefinitions["@DOCENTRY"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                crConnectionInfo.ServerName   = "SYSPEXSAP04";
                crConnectionInfo.DatabaseName = db_name;
                crConnectionInfo.UserID       = "sa";
                crConnectionInfo.Password     = "******";

                var crTables = cryRpt.Database.Tables;
                foreach (Table crTable in crTables)
                {
                    crtableLogoninfo = crTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    crTable.ApplyLogOnInfo(crtableLogoninfo);
                }



                ExportOptions CrExportOptions;
                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                PdfRtfWordFormatOptions    CrFormatTypeOptions          = new PdfRtfWordFormatOptions();

                CrDiskFileDestinationOptions.DiskFileName = pdf_path;
                CrExportOptions = cryRpt.ExportOptions;
                {
                    CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    CrExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    CrExportOptions.DestinationOptions    = CrDiskFileDestinationOptions;
                    CrExportOptions.FormatOptions         = CrFormatTypeOptions;
                }
                cryRpt.Export();
                return(true);
            }
            catch (CrystalReportsException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 23
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.º 24
0
        private void rpt_customers_details_Load(object sender, EventArgs e)
        {
            try
            {
                String         RES_NO = REPORT.RESERVATION_NO;
                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load(Application.StartupPath + "\\reports\\RECEIPT.rpt");
                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition  crParameterFieldDefinition;
                ParameterValues           crParameterValues        = new ParameterValues();
                ParameterDiscreteValue    crParameterDiscreteValue = new ParameterDiscreteValue();

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

                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
            catch (Exception EX)
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
        }
Exemplo n.º 25
0
        private void previewBatchToolStripButton_Click(object sender, EventArgs e)
        {
            long batchId = (long)this.aCHFileDataGridView.SelectedRows[0].Cells[0].Value;

            ReportDocument report = new ReportDocument();

            report.Load(@"\\cfs-intranet\Abra Reports\Misc\ACH Batch Details.rpt");

            ParameterFieldDefinitions parameters = report.DataDefinition.ParameterFields;
            ParameterFieldDefinition  parameter  = parameters["BatchId"];


            ParameterDiscreteValue parameterValue = new ParameterDiscreteValue();

            parameterValue.Value = batchId;

            ParameterValues values = new ParameterValues();

            values = parameter.CurrentValues;
            values.Clear();
            values.Add(parameterValue);
            parameter.ApplyCurrentValues(values);


            Reports.PreviewReport preview = new Cfs.Custom.Software.Reports.PreviewReport();
            preview.Report    = report;
            preview.MdiParent = this.ParentForm;
            preview.Show();
        }
Exemplo n.º 26
0
        public void receipt()
        {
            try
            {
                cryRpt.Load(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, System.AppDomain.CurrentDomain.RelativeSearchPath ?? "rptReciept.rpt"));

                // cryRpt.Load("C:\\Users\\YouJezzy\\Documents\\Visual Studio 2015\\Projects\\LuckInventorySystem_v2\\LuckInventorySystem_v2\\rptReciept.rpt");

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

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

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

                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 27
0
        public void GetToday(string date, string file)
        {
            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 = date;
            crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition     = crParameterFieldDefinitions["dateparam"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

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

            productViewer.ReportSource = cryRpt;
            productViewer.RefreshReport();
        }
Exemplo n.º 28
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.º 29
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text != "")
            {
                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load("C:\\Users\\Udara Indrajith\\Documents\\2nd year\\2nd semester\\ITP\\Project\\backup\\7\\WindowsFormsApplication2\\WindowsFormsApplication2\\2.Invoice.rpt");

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

                crParameterDiscreteValue.Value = comboBox1.Text;
                crParameterFieldDefinitions    = cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition     = crParameterFieldDefinitions["OrderID"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
            else
            {
                MessageBox.Show("Please Enter value");
            }

            label1.Visible    = false;
            comboBox1.Visible = false;
            button1.Visible   = false;
        }
 private void button1_Click(object sender, EventArgs e)
 {
     valor.Clear();
     dis.Value = Convert.ToInt32(comboBox1.SelectedValue);
     valor.Add(dis);
     info.DataDefinition.ParameterFields["idcentro"].ApplyCurrentValues(valor);
     crystalReportViewer1.ReportSource = info;
 }
Exemplo n.º 31
0
        public void GetMonthly(string file)
        {
            int            year   = Convert.ToInt32(cboYear.Text.Trim());
            string         month  = cboMonth.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     = "******";

            productViewer.ReportSource = cryRpt;
            productViewer.RefreshReport();
            filter  = "";
            filter2 = "";
            panel2.Hide();
            productFilter.Enabled      = true;
            serviceFilter.Enabled      = true;
            bunifuThinButton21.Enabled = true;
            bunifuThinButton22.Enabled = true;
        }
Exemplo n.º 32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User_Id"] == null)
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (Request.QueryString.Count <= 0)
            {
                Response.Redirect("PopupPTD.aspx");
            }

            ReportDocument rd = new ReportDocument();

            rd.Load(Server.MapPath("~/Reports/crptPTD.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);
            }

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

            pdv.Value = Request.QueryString["EMPNO"];
            pdfs      = rd.DataDefinition.ParameterFields;
            pdf       = pdfs["EmployeeID"];
            pvs       = pdf.CurrentValues;
            pvs.Add(pdv);
            pdf.ApplyCurrentValues(pvs);
            //

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

            pdv.Value = Request.QueryString["YEAR"];
            pdfs      = rd.DataDefinition.ParameterFields;
            pdf       = pdfs["Year"];
            pvs       = pdf.CurrentValues;
            pvs.Add(pdv);
            pdf.ApplyCurrentValues(pvs);
            //

            CrystalReportViewer1.ReportSource = rd;
        }
Exemplo n.º 33
0
        private void button51_Click(object sender, EventArgs e)
        {
            getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
            if (myCash1.listInvoiceItem.Rows.Count == 0)
            {
                myCash1.invoiceTotal.Rows[0][15] = "V";

                getGui.CloseTable(StaticClass.storeId, invoiceNum);
            }
            else
            {
                myCash1.invoiceTotal.Rows[0][57] = Convert.ToInt32(myCash1.invoiceTotal.Rows[0][57]) + 1;
                foreach (DataRow c in myCash1.listInvoiceItem.Rows)
                {
                    getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString());
                }
            }
            UpdateInvoiceTotals();

            if (myCash1.listInvoiceItem.Rows.Count != 0)
            {
                CrystalReport5            xxx = new CrystalReport5();
                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 = StaticClass.storeId;
                crParameterFieldDefinitions    = xxx.DataDefinition.ParameterFields;
                crParameterFieldDefinition     = crParameterFieldDefinitions["@Store_ID"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                crParameterDiscreteValue1.Value = invoiceNum;
                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);
            }
            this.Dispose();
            formLayout.FrmLayout_Load(null, null);
        }
Exemplo n.º 34
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.º 35
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);
      }
        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.º 38
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();
        }
        private void btSendQuote_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlDataReader rdr = null;
                string email = "";
                string contact = "";
                string qry = "select c.email, c.contact from customer c where c.ID = '" + cbCustomer.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 = "Quote.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);
                cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "quotations//quote-" + orderid + ".pdf");

                Outlook.Application outlookApp = new Outlook.Application();
                Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                string directory = Directory.GetCurrentDirectory();
                orderid = tbOrderId.Text;
                directory = directory + "\\quotations\\quote-" + orderid + ".pdf";
                mailItem.Attachments.Add(directory);
                mailItem.Subject = "Pinnacle Glass Doors - Quote# " + 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" + "Here is the quote you requested. Please let me know if you would like to proceed with the order" +
                    "\n\nThank You,\n\n" + Globals.USER_NAME;
                mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
                mailItem.Display(true);

                //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 btSendConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlDataReader rdr = null;
                string email = "";
                string contact = "";
                string qry = "select co.contact_email, co.contact_name from customer c inner join contact co on co.owner_id = c.id where c.id = '" +
                    cbCustomer.Text + "' and co.contact_name = '" + cbContact.Text + "';";
                rdr = MysqlInterface.DoQuery(qry);
                while (rdr.Read())
                {
                    if (!rdr.IsDBNull(0)) email = rdr.GetString(0);
                    if (!rdr.IsDBNull(1)) contact = rdr.GetString(1);
                }

                string orderid = tbOrderId.Text;
                ReportDocument cryRpt = new ReportDocument();
                string dir = System.IO.Directory.GetCurrentDirectory();
                dir = "Confirmation.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);
                cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "confirmations//confirmation-" + orderid + ".pdf");

                Outlook.Application outlookApp = new Outlook.Application();
                Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                string directory = Directory.GetCurrentDirectory();
                orderid = tbOrderId.Text;
                string po = tbCustPO.Text;
                directory = directory + "\\confirmations\\confirmation-" + orderid + ".pdf";
                mailItem.Attachments.Add(directory);
                mailItem.Subject = "Pinnacle Glass Doors - Confirmation# " + orderid + " - PO# " + po;
                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" + "Attached is a confirmation of your purchase order " + po + "." +
                    "\n\nThank You,\n\n" + Globals.USER_NAME;
                mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
                try
                { mailItem.Display(true); }
                catch
                    (Exception) { }

                //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);
            }
        }
Exemplo n.º 42
0
        private void button51_Click(object sender, EventArgs e)
        {
            getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
            if (myCash1.listInvoiceItem.Rows.Count == 0)
            {
                myCash1.invoiceTotal.Rows[0][15] = "V";

                getGui.CloseTable(StaticClass.storeId, invoiceNum);
            }
            else
            {
                myCash1.invoiceTotal.Rows[0][57] = Convert.ToInt32(myCash1.invoiceTotal.Rows[0][57]) + 1;
                foreach (DataRow c in myCash1.listInvoiceItem.Rows)
                {
                    getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString());
                }
            }
            UpdateInvoiceTotals();

            if (myCash1.listInvoiceItem.Rows.Count != 0)
            {
                CrystalReport5 xxx = new CrystalReport5();
                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 = StaticClass.storeId;
                crParameterFieldDefinitions = xxx.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                crParameterDiscreteValue1.Value = invoiceNum;
                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);
            }
            this.Dispose();
            formLayout.FrmLayout_Load(null, null);
        }
Exemplo n.º 43
0
        public void ImprimirRelPed()
        {
            try
            {
                //Instancio o FormConsulta
                FrmConPDV x = (FrmConPDV)_pdv;

                if (x.rdbped.Checked)
                {
                    //Instancio o Relatorio
                    RptConPDV objRptConPDV = new RptConPDV();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localizo o datatable criado no dataset
                    dtAdapter.Fill(oDataset, "RelPedido");

                    objRptConPDV.SetDataSource(oDataset);

                    //Passo parametro para relatorio no caso somente o de pedido tem parametro
                    ParameterFieldDefinitions crParameterFieldDefinitions;
                    ParameterFieldDefinition crParameterFieldDefinition;
                    ParameterValues crParameterValues = new ParameterValues();
                    ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

                    crParameterDiscreteValue.Value = "PDV";
                    crParameterFieldDefinitions = objRptConPDV.DataDefinition.ParameterFields;
                    crParameterFieldDefinition = crParameterFieldDefinitions["Tipo"];
                    crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConPDV;
                }
                else
                {
                    //Instancio o Relatorio
                    RptConPDV objRptConPDV = new RptConPDV();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelPedido");

                    objRptConPDV.SetDataSource(oDataset);

                    //Passo parametro para relatorio no caso somente o de pedido tem parametro
                    ParameterFieldDefinitions crParameterFieldDefinitions;
                    ParameterFieldDefinition crParameterFieldDefinition;
                    ParameterValues crParameterValues = new ParameterValues();
                    ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

                    crParameterDiscreteValue.Value = "prd";
                    crParameterFieldDefinitions = objRptConPDV.DataDefinition.ParameterFields;
                    crParameterFieldDefinition = crParameterFieldDefinitions["Tipo"];
                    crParameterValues = crParameterFieldDefinition.CurrentValues;

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

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConPDV;
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        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 Form2_Load(object sender, EventArgs e)
        {
            crystalReportViewer1.Top = 0;
            try
            {
                ReportDocument cryRpt = new ReportDocument();
                string dir = System.IO.Directory.GetCurrentDirectory(); dir = "Default_WorkOrder.rpt";
                cryRpt.Load(dir);

                /*ConnectionInfo crConnectionInfo = new ConnectionInfo();
                crConnectionInfo.ServerName = MysqlInterface.host;
                crConnectionInfo.DatabaseName = MysqlInterface.dbase;
                crConnectionInfo.UserID = MysqlInterface.user;
                crConnectionInfo.Password = MysqlInterface.password;
                crConnectionInfo.AllowCustomConnection = true;
                Tables crTables;

                crTables = cryRpt.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
                {
                    TableLogOnInfo myTableLogonInfo = crTable.LogOnInfo;
                    myTableLogonInfo.ConnectionInfo.DatabaseName = MysqlInterface.dbase;
                    myTableLogonInfo.ConnectionInfo.UserID = MysqlInterface.user;
                    myTableLogonInfo.ConnectionInfo.Password = MysqlInterface.password;
                    myTableLogonInfo.ConnectionInfo.ServerName = MysqlInterface.host;
                    crTable.ApplyLogOnInfo(myTableLogonInfo);
                }
                */
                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.Refresh();

            }
            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);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 46
0
        private void button54_Click(object sender, EventArgs e)
        {
            
            if(myCash1.listInvoiceItem.Rows.Count != 0)
            {
                FrmPay frmPay = new FrmPay();
                frmPay.textBox1.Text = frmPay.textBox2.Text = String.Format("{0:0,0}", Convert.ToDecimal(myCash1.label_Total.Text));
                if(frmPay.ShowDialog() == DialogResult.OK)
                {
                    myCash1.invoiceTotal.Rows[0]["Amt_Tendered"] = frmPay.tienTra;
                    myCash1.invoiceTotal.Rows[0]["Amt_Change"] = frmPay.tienThoi;
                    myCash1.invoiceTotal.Rows[0]["Status"] = "C";
                    myCash1.invoiceTotal.Rows[0]["Payment_Method"] = frmPay.hinhThucTra;
                    if(frmPay.hinhThucTra == "CA")
                    {
                        myCash1.invoiceTotal.Rows[0]["CA_Amount"] = Convert.ToDecimal(myCash1.label_Total.Text);

                    }
                    else if (frmPay.hinhThucTra == "CC")
                    {
                        myCash1.invoiceTotal.Rows[0]["CC_Amount"] = Convert.ToDecimal(myCash1.label_Total.Text);
                    }
                    else if (frmPay.hinhThucTra == "DC")
                    {
                        myCash1.invoiceTotal.Rows[0]["DC_Amount"] = Convert.ToDecimal(myCash1.label_Total.Text);
                    }

                    myCash1.invoiceTotal.Rows[0]["Cashier_ID"] = StaticClass.cashierId;
                    getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
                    if (myCash1.listInvoiceItem.Rows.Count == 0)
                    {
                        myCash1.invoiceTotal.Rows[0][15] = "V";
                        getGui.CloseTable(StaticClass.storeId, invoiceNum);
                    }
                    else
                    {
                        foreach (DataRow c in myCash1.listInvoiceItem.Rows)
                        {
                            getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString(), c[5].ToString(), c[19].ToString());
                        }
                    }
                    UpdateInvoiceTotals();
                    getGui.DeleteInvoiceOnhold(StaticClass.storeId,invoiceNum);
                    SendToKitchen();
                    this.Dispose();
                    formLayout.FrmLayout_Load(null, null);

                    formLogin.RequestMess("UpdateForm");
                     Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, "Hóa đơn");
                     if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
                     {
                         Re_ThanhToan xxx = new Re_ThanhToan();

                         xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
                         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 = StaticClass.storeId;
                         crParameterFieldDefinitions = xxx.DataDefinition.ParameterFields;
                         crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
                         crParameterValues = crParameterFieldDefinition.CurrentValues;

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

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

                         crParameterValues1.Clear();
                         crParameterValues1.Add(crParameterDiscreteValue1);
                         xxx.PrintOptions.PrinterName = printer.Details;
                         crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);
                         xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
                         xxx.PrintToPrinter(1, false, 0, 0);
                     }

                    
                }
            }
            else
            {
                Alert.Show("Hóa đơn chưa có hàng",Color.Red);
            }
        }
Exemplo n.º 47
0
        private void button51_Click(object sender, EventArgs e)
        {
            getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
            if (myCash1.listInvoiceItem.Rows.Count == 0)
            {
                myCash1.invoiceTotal.Rows[0][15] = "V";
                
                getGui.CloseTable(StaticClass.storeId, invoiceNum);
            }
            else
            {
                myCash1.invoiceTotal.Rows[0][57] = Convert.ToInt32(myCash1.invoiceTotal.Rows[0][57]) + 1;
                foreach (DataRow c in myCash1.listInvoiceItem.Rows)
                {
                    getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString(), c[5].ToString(), c[19].ToString());
                }
            }
            UpdateInvoiceTotals();
            SendToKitchen();
            if (myCash1.listInvoiceItem.Rows.Count != 0)
            {
                Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, "Hóa đơn");
                if(!(printer == null || printer.Details == "NONE" || printer.Disable == true))
                {
                    CrystalReport5 xxx = new CrystalReport5();

                    xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
                    ParameterFieldDefinitions crParameterFieldDefinitions;
                    ParameterValues crParameterValues = new ParameterValues();

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


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

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

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

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

                    xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
                    xxx.PrintOptions.PrinterName = printer.Details;
                    xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
                    xxx.PrintToPrinter(1, false, 0, 0);
                }
            }
            this.Dispose();
            formLayout.FrmLayout_Load(null, null); 
        }