private void cmdLogin_Click(object sender, EventArgs e) { frmStatus frmStatusMessage = new frmStatus(); try { frmStatusMessage.Show("Conectando y validando información on SERVER GACETAJURIDICA"); SqlConnection comercialConnection = new SqlConnection(Connectionstring); SqlDataAdapter LoginAdapter = new SqlDataAdapter( "SELECT SUPERVISORES, NOMBRE, CORREO, ID_VENDEDOR, NOMBRE_VENDEDOR1, clave, cod_empresa, TIPO_USUARIO FROM ACCESO_VENDEDORES where correo = '" + txtUser.Text + "@gacetajuridica.com.pe' and clave = '" + txtPass.Text + "'", comercialConnection); LoginAdapter.Fill(logindata); if (logindata.Rows.Count == 1) { ActualUser.tipo_usuario = logindata.Rows[0]["TIPO_USUARIO"].ToString(); if (ActualUser.tipo_usuario == "1") { ActualUser.usuario = logindata.Rows[0]["nombre_vendedor1"].ToString(); ActualUser.id_vendedor = ""; ActualUser.email = logindata.Rows[0]["correo"].ToString(); ActualUser.cod_empresa = logindata.Rows[0]["cod_empresa"].ToString(); ActualUser.Supervisor = logindata.Rows[0]["nombre_vendedor1"].ToString(); EjecutivoActual.id_vendedor = ""; EjecutivoActual.email = ""; EjecutivoActual.nombre = ""; } else { ActualUser.Supervisor = ""; ActualUser.usuario = logindata.Rows[0]["nombre_vendedor1"].ToString(); ActualUser.id_vendedor = logindata.Rows[0]["id_vendedor"].ToString(); ActualUser.email = logindata.Rows[0]["correo"].ToString(); ActualUser.cod_empresa = logindata.Rows[0]["cod_empresa"].ToString(); EjecutivoActual.id_vendedor = logindata.Rows[0]["id_vendedor"].ToString(); EjecutivoActual.email = logindata.Rows[0]["correo"].ToString(); EjecutivoActual.nombre = logindata.Rows[0]["nombre_vendedor1"].ToString(); } this.Hide(); Principal FormPrincipal = new Principal(); FormPrincipal.Show(); } else { MessageBox.Show("Datos incorrectos : Usuario o Clave no válidos"); } frmStatusMessage.Close(); } catch { frmStatusMessage.Close(); MessageBox.Show(Conection.error_coneccion); Application.Exit(); } }
private void cmdLogin_Click(object sender, EventArgs e) { frmStatus frmStatusMessage = new frmStatus(); try { frmStatusMessage.Show("Conectando y validando información on SERVER GACETAJURIDICA"); SqlConnection comercialConnection = new SqlConnection(Connectionstring); SqlDataAdapter LoginAdapter = new SqlDataAdapter( "SELECT SUPERVISORES, NOMBRE, CORREO, ID_VENDEDOR, NOMBRE_VENDEDOR1, clave, cod_empresa, TIPO_USUARIO FROM ACCESO_VENDEDORES where correo = '" + txtUser.Text + "@gacetajuridica.com.pe' and clave = '" + txtPass.Text + "'", comercialConnection); LoginAdapter.Fill(logindata); if (logindata.Rows.Count ==1) { ActualUser.tipo_usuario = logindata.Rows[0]["TIPO_USUARIO"].ToString(); if (ActualUser.tipo_usuario == "1") { ActualUser.usuario = logindata.Rows[0]["nombre_vendedor1"].ToString(); ActualUser.id_vendedor = ""; ActualUser.email = logindata.Rows[0]["correo"].ToString(); ActualUser.cod_empresa = logindata.Rows[0]["cod_empresa"].ToString(); ActualUser.Supervisor = logindata.Rows[0]["nombre_vendedor1"].ToString(); EjecutivoActual.id_vendedor = ""; EjecutivoActual.email = ""; EjecutivoActual.nombre = ""; } else { ActualUser.Supervisor = ""; ActualUser.usuario = logindata.Rows[0]["nombre_vendedor1"].ToString(); ActualUser.id_vendedor = logindata.Rows[0]["id_vendedor"].ToString(); ActualUser.email = logindata.Rows[0]["correo"].ToString(); ActualUser.cod_empresa = logindata.Rows[0]["cod_empresa"].ToString(); EjecutivoActual.id_vendedor = logindata.Rows[0]["id_vendedor"].ToString(); EjecutivoActual.email = logindata.Rows[0]["correo"].ToString(); EjecutivoActual.nombre = logindata.Rows[0]["nombre_vendedor1"].ToString(); } this.Hide(); Principal FormPrincipal = new Principal(); FormPrincipal.Show(); } else { MessageBox.Show("Datos incorrectos : Usuario o Clave no válidos"); } frmStatusMessage.Close(); } catch { frmStatusMessage.Close(); MessageBox.Show(Conection.error_coneccion); Application.Exit(); } }
private void BindDataGrid() { // Display a status message saying that we're attempting to connect. // This only needs to be done the very first time a connection is // attempted. After we've determined that MSDE or SQL Server is // installed, this message no longer needs to be displayed. frmStatus frmStatusMessage = new frmStatus(); frmStatusMessage.Show("Connecting to SQL Server of GACETA JURIDICA"); // Attempt to connect to the local SQL server instance, and a local // MSDE installation (with Northwind). bool IsConnecting = true; while (IsConnecting) { try { // The SqlConnection class allows you to communicate with SQL Server. // The constructor accepts a connection string an argument. This // connection string uses Integrated Security, which means that you // must have a login in SQL Server, or be part of the Administrators // group for this to work. SqlConnection comercialConnection = new SqlConnection(Conection.conectionstring); SqlDataAdapter ClientesAdapter = new SqlDataAdapter( "SELECT id_cliente, CLIENTE = RTRIM(LTRIM(nombre_razon_social))+' '+RTRIM(LTRIM(APELLIDO_P))+' '+RTRIM(LTRIM(APELLIDO_M)), Direccion, CONTACTO, EMAIL, TELEFONO_01, TELEFONO_02, MOVIL_01, DIRECCION_ENTREGA FROM clientes where id_vendedor = '" + EjecutivoActual.id_vendedor + "'", comercialConnection); ClientesAdapter.Fill(ClientesData, "clientes"); // Data has been successfully retrieved, so break out of the loop. IsConnecting = false; } catch { // Unable to connect to SQL Server or MSDE frmStatusMessage.Close(); MessageBox.Show("To run this Aplication, you must have conection to SERVER DATA; " + "For instructions, contact to Suport Tecnic from 'GACETA JURIDICA'."); Application.Exit(); } } frmStatusMessage.Close(); BindingSource1.DataSource = ClientesData.Tables["clientes"]; //dgvMaestro.DataSource = maestro.Buscar(); dgClientes.MultiSelect = false; dgClientes.DataSource = BindingSource1.DataSource; //dgClientes.DataSource = ClientesData.Tables["clientes"]; }
private void BindDataGrid() { // Display a status message saying that we're attempting to connect. // This only needs to be done the very first time a connection is // attempted. After we've determined that MSDE or SQL Server is // installed, this message no longer needs to be displayed. frmStatus frmStatusMessage = new frmStatus(); frmStatusMessage.Show("Connecting to SQL Server of GACETA JURIDICA"); // Attempt to connect to the local SQL server instance, and a local // MSDE installation (with Northwind). bool IsConnecting = true; while (IsConnecting) { try { // The SqlConnection class allows you to communicate with SQL Server. // The constructor accepts a connection string an argument. This // connection string uses Integrated Security, which means that you // must have a login in SQL Server, or be part of the Administrators // group for this to work. SqlConnection comercialConnection = new SqlConnection(Conection.conectionstring); SqlDataAdapter ClientesAdapter = new SqlDataAdapter( "SELECT id_cliente, CLIENTE = RTRIM(LTRIM(nombre_razon_social))+' '+RTRIM(LTRIM(APELLIDO_P))+' '+RTRIM(LTRIM(APELLIDO_M)), Direccion, CONTACTO, EMAIL, TELEFONO_01, TELEFONO_02, MOVIL_01, DIRECCION_ENTREGA FROM clientes where id_vendedor = '" + EjecutivoActual.id_vendedor + "'", comercialConnection); ClientesAdapter.Fill(ClientesData, "clientes"); // Data has been successfully retrieved, so break out of the loop. IsConnecting = false; } catch { // Unable to connect to SQL Server or MSDE frmStatusMessage.Close(); MessageBox.Show("To run this sample, you must have SQL " + "or MSDE with the Northwind database installed. For " + "instructions on installing MSDE, view the ReadMe file."); Application.Exit(); } } frmStatusMessage.Close(); dgClientes.DataSource = ClientesData.Tables["clientes"]; }
private void EstadosCuenta_Load(object sender, EventArgs e) { frmStatus frmStatusMessage = new frmStatus(); float fDebe = 0; float fPago = 0; float fDeuda = 0; txtDatos.Text = ClienteActual.Nombre_Suscripcion + (char)13 + ClienteActual.Nombre_cliente + (char)13+ClienteActual.Direccion_Cliente+(char)13+ClienteActual.Email_Cliente ; try { frmStatusMessage.Show("Conectando y validando información on SERVER GACETAJURIDICa"); SqlConnection comercialConnection = new SqlConnection(Conection.conectionstring); SqlDataAdapter LoginAdapter = new SqlDataAdapter("SELECT NRO_CONTRATO, VALOR_SUSCRIPCION, NRO_CUOTAS, VALOR_01, VALOR_02, VALOR_03, VALOR_04, VALOR_05, VALOR_06, " + " VALOR_07,VALOR_08,VALOR_09,VALOR_10,VALOR_11,VALOR_12,FECHA_01,FECHA_02,FECHA_03,FECHA_04,FECHA_05,FECHA_06,FECHA_07,FECHA_08,FECHA_09,FECHA_10," + " FECHA_11, FECHA_12 From VISTA_SUSCRIPCIONES_NROS_CONTRATOS WHERE ID_CLIENTE = '" + ClienteActual.Id_cliente.ToString() + "' and id_suscripcion = " + ClienteActual.Id_Suscripcion.ToString(), comercialConnection); LoginAdapter.Fill(SuscripData); if (SuscripData.Rows.Count == 1) { txtNroCuotas.Text = SuscripData.Rows[0]["NRO_CUOTAS"].ToString(); textBox1.Text = SuscripData.Rows[0]["NRO_CONTRATO"].ToString(); textBox2.Text = SuscripData.Rows[0]["VALOR_SUSCRIPCION"].ToString(); string fecha=""; float valor=0; for (int i = 1; i <= System.Convert.ToInt32(txtNroCuotas.Text); i++) { ActivaControl(i); switch (i) { case 1: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_01"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_01"].ToString()); break; case 2: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_02"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_02"].ToString()); break; case 3: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_03"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_03"].ToString()); break; case 4: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_04"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_04"].ToString()); break; case 5: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_05"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_05"].ToString()); break; case 6: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_06"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_06"].ToString()); break; case 7: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_07"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_07"].ToString()); break; case 8: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_08"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_08"].ToString()); break; case 9: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_09"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_09"].ToString()); break; case 10: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_10"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_10"].ToString()); break; case 11: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_11"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_11"].ToString()); break; case 12: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_12"].ToString()).ToString("dd-MMM-yy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_12"].ToString()); break; } fDeuda = fDeuda + valor; Muestra_valor(i, valor, fecha); } } else { MessageBox.Show("No existe bdatos de contartos para este Tipo de Suscripcion"); } // INCIO:::: VALIDANDO LOS PAGOS DE LOS COMPROBANTES try { SqlConnection xSqlConnection = new SqlConnection(Conection.conectionstring); // Open the connection // conn.Open(); SqlCommand xSqlCommand = new SqlCommand("dbo.paGetPagosPorCuotas", xSqlConnection); xSqlCommand.CommandType = CommandType.StoredProcedure; xSqlCommand.Parameters.Add("@IDSUSCRIPCION", SqlDbType.Int).Value = int.Parse( ClienteActual.Id_Suscripcion.ToString()); xSqlCommand.Parameters.Add("@ID_CLIENTE", SqlDbType.NVarChar).Value = ClienteActual.Id_cliente; xSqlCommand.Connection.Open(); SqlDataAdapter xSqlDataAdapter = new SqlDataAdapter(xSqlCommand); DataSet xDataSet = new DataSet(); string fecha_e; string fecha_p; xSqlDataAdapter.Fill(xDataSet, "Pagos"); for (int i = 0; i < xDataSet.Tables["Pagos"].Rows.Count; i++) { int nro_Cuota = int.Parse(xDataSet.Tables["Pagos"].Rows[i]["NRO_PERIODO"].ToString()); fecha_e = DateTime.Parse(xDataSet.Tables["Pagos"].Rows[i]["FECHA_EMISION"].ToString()).ToString("dd-MMM-yy"); fecha_p = DateTime.Parse(xDataSet.Tables["Pagos"].Rows[i]["FECHA_PAGO"].ToString()).ToString("dd-MMM-yy"); fPago = fPago + float.Parse(xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString()); switch (nro_Cuota) { case 1: txtDoc01.Visible = true; txtVal01.Visible = true; txtPago01.Visible = true; txtDoc01.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal01.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago01.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 2: txtDoc02.Visible = true; txtVal02.Visible = true; txtPago02.Visible = true; txtDoc02.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal02.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago02.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 3: txtDoc03.Visible = true; txtVal03.Visible = true; txtPago03.Visible = true; txtDoc03.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal03.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago03.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 4: txtDoc04.Visible = true; txtVal04.Visible = true; txtPago04.Visible = true; txtDoc04.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal04.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago04.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 5: txtDoc05.Visible = true; txtVal05.Visible = true; txtPago05.Visible = true; txtDoc05.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal05.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago05.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 6: txtDoc06.Visible = true; txtVal06.Visible = true; txtPago06.Visible = true; txtDoc06.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal06.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago06.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 7: txtDoc07.Visible = true; txtVal07.Visible = true; txtPago07.Visible = true; txtDoc07.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal07.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago07.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 8: txtDoc08.Visible = true; txtVal08.Visible = true; txtPago08.Visible = true; txtDoc08.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal08.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago08.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 9: txtDoc09.Visible = true; txtVal09.Visible = true; txtPago09.Visible = true; txtDoc09.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal09.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago09.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 10: txtDoc10.Visible = true; txtVal10.Visible = true; txtPago10.Visible = true; txtDoc10.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal10.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago10.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 11: txtDoc11.Visible = true; txtVal11.Visible = true; txtPago11.Visible = true; txtDoc11.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal11.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago11.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 12: txtDoc12.Visible = true; txtVal12.Visible = true; txtPago12.Visible = true; txtDoc12.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal12.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago12.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } // FIN:::: VALIDANDO LOS PAGOS DE LOS COMPROBANTES // INICIO DE MATERIAL ENTREGADO try { SqlConnection xSqlConnection = new SqlConnection(Conection.conectionstring); // Open the connection // conn.Open(); SqlCommand xSqlCommand = new SqlCommand("dbo.paEntregaMaterial", xSqlConnection); xSqlCommand.CommandType = CommandType.StoredProcedure; xSqlCommand.Parameters.Add("@ID_CLIENTE", SqlDbType.NVarChar).Value = ClienteActual.Id_cliente; xSqlCommand.Parameters.Add("@ID_SUSCRIPCION", SqlDbType.NVarChar).Value = ClienteActual.Id_Suscripcion; xSqlCommand.Connection.Open(); SqlDataAdapter xSqlDataAdapter = new SqlDataAdapter(xSqlCommand); DataSet xDataSet = new DataSet(); xSqlDataAdapter.Fill(xDataSet, "MaterialEntregado"); xSqlDataAdapter.Dispose(); dgMaterialEntergado.DataSource = xDataSet; dgMaterialEntergado.DataMember = "MaterialEntregado"; dgMaterialEntergado.Refresh(); FormatGridWithTableStyles(); dgMaterialEntergado.Columns[3].Visible = false; dgMaterialEntergado.Columns[5].Visible = false; dgMaterialEntergado.Columns[6].Visible = false; dgMaterialEntergado.Columns[7].Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } // FIN DE MATERIAL ENTREGADO frmStatusMessage.Close(); if (fDebe != 0) { textBox5.BackColor = Color.FromArgb(255,128,128); } else { textBox5.BackColor = Color.FromArgb(0,192,192); } fDebe = fDeuda - fPago; txtDeuda.Text = fDeuda.ToString(); txtPago.Text = fPago.ToString(); txtDebe.Text = fDebe.ToString(); } catch { frmStatusMessage.Close(); MessageBox.Show(Conection.error_coneccion); this.Hide(); } }
private void Opendata() { frmStatus frmStatusMessage = new frmStatus(); frmStatusMessage.Show("Rerecuperando Informacion del Servidor de GACETA JURIDICA"); try { SqlConnection xSqlConnection = new SqlConnection(Conection.conectionstring); int ancho = 8; // Open the connection // conn.Open(); SqlCommand xSqlCommand = new SqlCommand("dbo.paKardexVendedores", xSqlConnection); xSqlCommand.CommandType = CommandType.StoredProcedure; xSqlCommand.Parameters.Add("@strIdvendedor", SqlDbType.NVarChar).Value = EjecutivoActual.id_vendedor; xSqlCommand.Parameters.Add("@cod_empresa", SqlDbType.NVarChar).Value = ActualUser.cod_empresa; xSqlCommand.Parameters.Add("@Check", SqlDbType.NVarChar).Value = ActualUser.tipo_kardex; xSqlCommand.Connection.Open(); SqlDataAdapter xSqlDataAdapter = new SqlDataAdapter(xSqlCommand); DataSet xDataSet = new DataSet(); xSqlDataAdapter.Fill(xDataSet, "KardexVendedores"); xSqlDataAdapter.Dispose(); dgMaterialEntergado.DataSource = xDataSet; dgMaterialEntergado.DataMember = "KardexVendedores"; dgMaterialEntergado.Refresh(); FormatGridWithTableStyles(); dgMaterialEntergado.Columns[0].Visible = false; dgMaterialEntergado.Columns[14].Visible = false; dgMaterialEntergado.Columns[15].Visible = false; dgMaterialEntergado.Columns[13].Visible = false; DataGridViewColumn COL01 = new DataGridViewColumn(); COL01 = dgMaterialEntergado.Columns["T_STK"]; COL01.ReadOnly = true; COL01.Visible = true; COL01.HeaderText = "T_STK"; COL01.Width = ancho; COL01.DefaultCellStyle.BackColor = Color.YellowGreen; COL01.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL01.DefaultCellStyle.Format = "#,###"; DataGridViewColumn COL02 = new DataGridViewColumn(); COL02 = dgMaterialEntergado.Columns["T_MOV"]; COL02.ReadOnly = true; COL02.Visible = true; COL02.HeaderText = "T_MOV"; COL02.Width = ancho; COL02.DefaultCellStyle.BackColor = Color.YellowGreen; COL02.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL02.DefaultCellStyle.Format = "#,###"; DataGridViewColumn COL03 = new DataGridViewColumn(); COL03 = dgMaterialEntergado.Columns["SALDOS"]; COL03.ReadOnly = true; COL03.Visible = true; COL03.HeaderText = "SALDOS"; COL03.Width = ancho; COL03.DefaultCellStyle.BackColor = Color.CadetBlue; COL03.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL03.DefaultCellStyle.Format = "#,###"; DataGridViewColumn COL04 = new DataGridViewColumn(); COL04 = dgMaterialEntergado.Columns["STK_INI"]; COL04.Width = ancho; COL04.DefaultCellStyle.BackColor = Color.DarkGoldenrod; COL04.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL04.DefaultCellStyle.Format = "#,###"; DataGridViewColumn COL05 = new DataGridViewColumn(); COL05 = dgMaterialEntergado.Columns["O_S"]; COL05.Width = ancho; COL05.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL05.DefaultCellStyle.Format = "#,###"; COL05.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL06 = new DataGridViewColumn(); COL06 = dgMaterialEntergado.Columns["GUIAS"]; COL06.Width = ancho; COL06.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL06.DefaultCellStyle.Format = "#,###"; COL06.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL07 = new DataGridViewColumn(); COL07 = dgMaterialEntergado.Columns["F_CAN"]; COL07.Width = ancho; COL07.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL07.DefaultCellStyle.Format = "#,###"; COL07.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL08 = new DataGridViewColumn(); COL08 = dgMaterialEntergado.Columns["F_PEN"]; COL08.Width = ancho; COL08.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL08.DefaultCellStyle.Format = "#,###"; COL08.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL09 = new DataGridViewColumn(); COL09 = dgMaterialEntergado.Columns["F_CTA"]; COL09.Width = ancho; COL09.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL09.DefaultCellStyle.Format = "#,###"; COL09.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL010 = new DataGridViewColumn(); COL010 = dgMaterialEntergado.Columns["DEVOL"]; COL010.Width = ancho; COL010.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL010.DefaultCellStyle.Format = "#,###"; COL010.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL011 = new DataGridViewColumn(); COL011 = dgMaterialEntergado.Columns["E_SUS"]; COL011.Width = ancho; COL011.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL011.DefaultCellStyle.Format = "#,###"; COL011.DefaultCellStyle.BackColor = Color.DarkGoldenrod; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { frmStatusMessage.Close(); } }
private void Opendata() { frmStatus frmStatusMessage = new frmStatus(); frmStatusMessage.Show("Rerecuperando Informacion del Servidor de GACETA JURIDICA"); try { SqlConnection xSqlConnection = new SqlConnection(Conection.conectionstring); int ancho = 6; // Open the connection SqlCommand xSqlCommand = new SqlCommand("dbo.paKardexVendedoresDetalle2010", xSqlConnection); xSqlCommand.CommandType = CommandType.StoredProcedure; xSqlCommand.Parameters.Add("@strIdvendedor", SqlDbType.NVarChar).Value = EjecutivoActual.id_vendedor; xSqlCommand.Parameters.Add("@cod_empresa", SqlDbType.NVarChar).Value = ActualUser.cod_empresa; xSqlCommand.Parameters.Add("@id_producto ", SqlDbType.Int).Value = ClienteActual.ID_PRODUCTO; xSqlCommand.Connection.Open(); SqlDataAdapter xSqlDataAdapter = new SqlDataAdapter(xSqlCommand); DataSet xDataSet = new DataSet(); xSqlDataAdapter.Fill(xDataSet, "DetalleKardex"); xSqlDataAdapter.Dispose(); dgKardexDetalle.DataSource = xDataSet; dgKardexDetalle.DataMember = "DetalleKardex"; dgKardexDetalle.Refresh(); FormatGridWithTableStyles(); dgKardexDetalle.Columns[11].Visible = false; DataGridViewColumn COL04 = new DataGridViewColumn(); COL04 = dgKardexDetalle.Columns["FECHA_EMISION"]; COL04.Width = ancho; COL04.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL04.DefaultCellStyle.Format = "dd-MMM-yy"; DataGridViewColumn COL05 = new DataGridViewColumn(); COL05 = dgKardexDetalle.Columns["O_S"]; COL05.Width = ancho; COL05.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL05.DefaultCellStyle.Format = "#,###"; COL05.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL06 = new DataGridViewColumn(); COL06 = dgKardexDetalle.Columns["GUIAS"]; COL06.Width = ancho; COL06.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL06.DefaultCellStyle.Format = "#,###"; COL06.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL07 = new DataGridViewColumn(); COL07 = dgKardexDetalle.Columns["F_CAN"]; COL07.Width = ancho; COL07.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL07.DefaultCellStyle.Format = "#,###"; COL07.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL08 = new DataGridViewColumn(); COL08 = dgKardexDetalle.Columns["F_PEN"]; COL08.Width = ancho; COL08.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL08.DefaultCellStyle.Format = "#,###"; COL08.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL09 = new DataGridViewColumn(); COL09 = dgKardexDetalle.Columns["F_CTA"]; COL09.Width = ancho; COL09.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL09.DefaultCellStyle.Format = "#,###"; COL09.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL010 = new DataGridViewColumn(); COL010 = dgKardexDetalle.Columns["DEVOL"]; COL010.Width = ancho; COL010.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL010.DefaultCellStyle.Format = "#,###"; COL010.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL011 = new DataGridViewColumn(); COL011 = dgKardexDetalle.Columns["E_SUS"]; COL011.Width = ancho; COL011.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL011.DefaultCellStyle.Format = "#,###"; COL011.DefaultCellStyle.BackColor = Color.DarkGoldenrod; DataGridViewColumn COL12 = new DataGridViewColumn(); COL12 = dgKardexDetalle.Columns["T_STK"]; COL12.Width = 3; COL12.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; COL12.DefaultCellStyle.Format = "#,###"; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { frmStatusMessage.Close(); } }
private void EstadosCuenta_Load(object sender, EventArgs e) { frmStatus frmStatusMessage = new frmStatus(); float fDebe = 0; float fPago = 0; float fDeuda = 0; try { frmStatusMessage.Show("Conectando y validando información on SERVER GACETAJURIDICa"); SqlConnection comercialConnection = new SqlConnection(Conection.conectionstring); SqlDataAdapter LoginAdapter = new SqlDataAdapter("SELECT NRO_CONTRATO, VALOR_SUSCRIPCION, NRO_CUOTAS, VALOR_01, VALOR_02, VALOR_03, VALOR_04, VALOR_05, VALOR_06, " + " VALOR_07,VALOR_08,VALOR_09,VALOR_10,VALOR_11,VALOR_12,FECHA_01,FECHA_02,FECHA_03,FECHA_04,FECHA_05,FECHA_06,FECHA_07,FECHA_08,FECHA_09,FECHA_10," + " FECHA_11, FECHA_12 From VISTA_SUSCRIPCIONES_NROS_CONTRATOS WHERE ID_CLIENTE = '" + ClienteActual.Id_cliente.ToString() + "' and id_suscripcion = " + ClienteActual.Id_Suscripcion.ToString(), comercialConnection); LoginAdapter.Fill(SuscripData); if (SuscripData.Rows.Count == 1) { txtNroCuotas.Text = SuscripData.Rows[0]["NRO_CUOTAS"].ToString(); textBox1.Text = SuscripData.Rows[0]["NRO_CONTRATO"].ToString(); textBox2.Text = SuscripData.Rows[0]["VALOR_SUSCRIPCION"].ToString(); string fecha = ""; float valor = 0; for (int i = 1; i <= System.Convert.ToInt32(txtNroCuotas.Text); i++) { ActivaControl(i); switch (i) { case 1: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_01"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_01"].ToString()); break; case 2: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_02"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_02"].ToString()); break; case 3: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_03"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_03"].ToString()); break; case 4: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_04"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_04"].ToString()); break; case 5: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_05"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_05"].ToString()); break; case 6: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_06"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_06"].ToString()); break; case 7: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_07"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_07"].ToString()); break; case 8: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_08"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_08"].ToString()); break; case 9: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_09"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_09"].ToString()); break; case 10: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_10"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_10"].ToString()); break; case 11: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_11"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_11"].ToString()); break; case 12: fecha = DateTime.Parse(SuscripData.Rows[0]["FECHA_12"].ToString()).ToString("ddMMMyy"); valor = float.Parse(SuscripData.Rows[0]["VALOR_12"].ToString()); break; } fDeuda = fDeuda + valor; Muestra_valor(i, valor, fecha); } } else { MessageBox.Show("No existe bdatos de contartos para este Tipo de Suscripcion"); } // INCIO:::: VALIDANDO LOS PAGOS DE LOS COMPROBANTES try { SqlConnection xSqlConnection = new SqlConnection(Conection.conectionstring); // Open the connection // conn.Open(); SqlCommand xSqlCommand = new SqlCommand("dbo.paGetPagosPorCuotas", xSqlConnection); xSqlCommand.CommandType = CommandType.StoredProcedure; xSqlCommand.Parameters.Add("@IDSUSCRIPCION", SqlDbType.Int).Value = int.Parse(ClienteActual.Id_Suscripcion.ToString()); xSqlCommand.Parameters.Add("@ID_CLIENTE", SqlDbType.NVarChar).Value = ClienteActual.Id_cliente; xSqlCommand.Connection.Open(); SqlDataAdapter xSqlDataAdapter = new SqlDataAdapter(xSqlCommand); DataSet xDataSet = new DataSet(); string fecha_e; string fecha_p; xSqlDataAdapter.Fill(xDataSet, "Pagos"); for (int i = 0; i < xDataSet.Tables["Pagos"].Rows.Count; i++) { int nro_Cuota = int.Parse(xDataSet.Tables["Pagos"].Rows[i]["NRO_PERIODO"].ToString()); fecha_e = DateTime.Parse(xDataSet.Tables["Pagos"].Rows[i]["FECHA_EMISION"].ToString()).ToString("ddMMMyy"); fecha_p = DateTime.Parse(xDataSet.Tables["Pagos"].Rows[i]["FECHA_PAGO"].ToString()).ToString("ddMMMyy"); fPago = fPago + float.Parse(xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString()); switch (nro_Cuota) { case 1: txtDoc01.Visible = true; txtVal01.Visible = true; txtPago01.Visible = true; txtDoc01.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal01.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago01.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 2: txtDoc02.Visible = true; txtVal02.Visible = true; txtPago02.Visible = true; txtDoc02.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal02.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago02.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 3: txtDoc03.Visible = true; txtVal03.Visible = true; txtPago03.Visible = true; txtDoc03.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal03.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago03.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 4: txtDoc04.Visible = true; txtVal04.Visible = true; txtPago04.Visible = true; txtDoc04.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal04.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago04.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 5: txtDoc05.Visible = true; txtVal05.Visible = true; txtPago05.Visible = true; txtDoc05.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal05.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago05.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 6: txtDoc06.Visible = true; txtVal06.Visible = true; txtPago06.Visible = true; txtDoc06.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal06.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago06.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 7: txtDoc07.Visible = true; txtVal07.Visible = true; txtPago07.Visible = true; txtDoc07.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal07.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago07.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 8: txtDoc08.Visible = true; txtVal08.Visible = true; txtPago08.Visible = true; txtDoc08.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal08.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago08.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 9: txtDoc09.Visible = true; txtVal09.Visible = true; txtPago09.Visible = true; txtDoc09.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal09.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago09.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 10: txtDoc10.Visible = true; txtVal10.Visible = true; txtPago10.Visible = true; txtDoc10.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal10.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago10.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 11: txtDoc11.Visible = true; txtVal11.Visible = true; txtPago11.Visible = true; txtDoc11.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal11.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago11.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; case 12: txtDoc12.Visible = true; txtVal12.Visible = true; txtPago12.Visible = true; txtDoc12.Text = xDataSet.Tables["Pagos"].Rows[i]["CLAVE"].ToString(); txtVal12.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_NETO"].ToString() + " - " + fecha_e; txtPago12.Text = xDataSet.Tables["Pagos"].Rows[i]["TOTAL_PAGO"].ToString() + " - " + fecha_p; break; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } // FIN:::: VALIDANDO LOS PAGOS DE LOS COMPROBANTES frmStatusMessage.Close(); if (fDebe != 0) { textBox5.BackColor = Color.FromArgb(255, 128, 128); } else { textBox5.BackColor = Color.FromArgb(0, 192, 192); } fDebe = fDeuda - fPago; txtDeuda.Text = fDeuda.ToString(); txtPago.Text = fPago.ToString(); txtDebe.Text = fDebe.ToString(); } catch { frmStatusMessage.Close(); MessageBox.Show(Conection.error_coneccion); this.Hide(); } }