示例#1
0
        private void PopulateGrid()
        {
            _dsFormatos = CuentaFormatoChequeDAC.GetData(IdCuentaBanco, -1);

            _dtFormatos = _dsFormatos.Tables[0];
            this.gridControl1.DataSource = null;
            this.gridControl1.DataSource = _dtFormatos;
        }
示例#2
0
        private void btnImprimir_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            String path = "";

            if (_currentRow["Asiento"].ToString() != "")
            {
                //Obtener el listado de formatos
                DataSet dsFormatos = CuentaFormatoChequeDAC.GetData(Convert.ToInt32(_currentRow["IDCuentaBanco"]), -1);
                if (dsFormatos.Tables.Count > 0)
                {
                    if (dsFormatos.Tables[0].Rows.Count > 0)
                    {
                        DataTable tmpTable = new DataTable();
                        DataView  dv       = new DataView(dsFormatos.Tables[0]);
                        dv.RowFilter = "Activo=1";
                        tmpTable     = dv.ToTable();
                        if (tmpTable.Rows.Count == 1)
                        {
                            //cargar el formato por defecto
                            path = Path.Combine(Directory.GetCurrentDirectory(), "FormatosCheques", string.Format("Formato-{0}.repx", tmpTable.Rows[0]["IDFormato"].ToString())).ToString();
                            DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile(path, true);


                            SqlDataSource sqlDataSource = report.DataSource as SqlDataSource;

                            SqlDataSource ds = report.DataSource as SqlDataSource;
                            ds.ConnectionName = "sqlDataSource1";
                            String sNameConexion = (Security.Esquema.Compania == "CEDETSA") ? "StringConCedetsa" : "StringConDasa";
                            System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings[sNameConexion].ConnectionString);
                            ds.ConnectionParameters = new DevExpress.DataAccess.ConnectionParameters.MsSqlConnectionParameters(builder.DataSource, builder.InitialCatalog, builder.UserID, builder.Password, MsSqlAuthorizationType.SqlServer);

                            // Obtain a parameter, and set its value.
                            report.Parameters["Numero"].Value        = Convert.ToInt32(_currentRow["Numero"]);
                            report.Parameters["IDCuentaBanco"].Value = Convert.ToInt32(_currentRow["IDCuentaBanco"]);
                            report.Parameters["IDTipo"].Value        = Convert.ToInt32(_currentRow["IDTipo"]);
                            report.Parameters["IDSubTipo"].Value     = Convert.ToInt32(_currentRow["IDSubTipo"]);

                            // Show the report's print preview.
                            DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(report);
                            tool.ShowPreview();
                            SetChequeImpreso();
                        }
                        else
                        {
                            //Seleccionar de la lista de formatos
                            frmSeleccionFormatoCheque ofrmListarFormatos = new frmSeleccionFormatoCheque(tmpTable);
                            ofrmListarFormatos.FormClosed += ofrmListarFormatos_FormClosed;
                            ofrmListarFormatos.ShowDialog();
                        }
                    }
                }
            }
        }