예제 #1
0
        private void cargaCompras()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                dataGridView1.Rows.Clear();
                string         sql    = string.Format("SELECT * FROM VISTA_CONTROL_COMPRA WHERE ID_COMPRA = {0};", compraActual);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(3)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(5)));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(3)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(5)));
                        //styleDV(this.dataGridView1);
                    }
                }
                else
                {
                    MessageBox.Show("NO EXISTEN COMPRAS!", "GESTION MERCADERIA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    DialogResult = DialogResult.Cancel;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "GESTION MERCADERIA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
        private void cancelaCuenta(string abono)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                //MessageBox.Show("" + totalFactura);
                string      sql = string.Format("UPDATE CUENTA_POR_PAGAR SET TOTAL_PAGADO = TOTAL_PAGADO + {0}, ESTADO_TUPLA = FALSE WHERE ID_CUENTA_POR_PAGAR = '{1}';", abono, numeroCuenta);
                OdbcCommand cmd = new OdbcCommand(sql, conexion);
                if (cmd.ExecuteNonQuery() == 1)
                {
                    var forma = new frm_creditoActualizado();
                    forma.ShowDialog();
                }
                else
                {
                    MessageBox.Show("IMPOSILE ABONAR PAGO DE PROVEEDOR!", "COMPRAS - CREDITO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #3
0
        private void cargaDatosCompletados()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                dataGridView1.Rows.Clear();
                string         sql    = string.Format("SELECT * FROM VISTA_PAGARF;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(4)), reader.GetString(5), reader.GetString(6), reader.GetString(7));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(4)), reader.GetString(5), reader.GetString(6), reader.GetString(7));
                    }
                    setDescripcion(6);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
        private void cargaDetalle(string codigo)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                dataGridView1.Rows.Clear();
                string         sql    = string.Format("SELECT * FROM VISTA_DETALLE_TRASLADO WHERE ID_TRASLADO = {0};", codigo);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #5
0
        private void cargaDatos()
        {
            dataGridView1.Rows.Clear();
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM VISTA_FACTURAS WHERE NOMBRE_SUCURSAL  = '{0}' AND ESTADO_TUPLA = TRUE ORDER BY FECHA_EMISION_FACTURA DESC;", comboBox1.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2) + " " + reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(10)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(11)));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2) + " " + reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(10)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(11)));
                        //styleDV(this.dataGridView1);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "GESTION CLIENTES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #6
0
        private void cargaTipos()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT TIPO_SUCURSAL FROM TIPO_SUCURSAL;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    comboBox1.Items.Add(reader.GetString(0));
                    while (reader.Read())
                    {
                        comboBox1.Items.Add(reader.GetString(0));
                    }
                }
                else
                {
                    MessageBox.Show("NO EXISTEN TIPOS DE CLIENTES ALMACENADOS!", "GESTION SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "GESTION SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #7
0
        private void getData(string codigo)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM VISTA_FACTURAS WHERE ID_FACTURA = '{0}';", codigo);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    textBox10.Text = reader.GetString(0);
                    textBox3.Text  = reader.GetString(1);
                    textBox9.Text  = reader.GetString(2);
                    textBox12.Text = reader.GetString(3);
                    comboBox3.Text = reader.GetString(8);
                    textBox2.Text  = reader.GetString(13);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         try
         {
             string      sql = string.Format("UPDATE USUARIO SET PASSWORD_USUARIO = '{0}' WHERE ID_USUARIO = '{1}';", textBox1.Text.Trim(), usuario);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             if (cmd.ExecuteNonQuery() == 1)
             {
                 var forma = new frm_creditoActualizado();
                 forma.ShowDialog();
                 button1.Visible  = false;
                 textBox1.Visible = false;
                 label4.Visible   = false;
                 button8.Enabled  = false;
                 DialogResult     = DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("NO SE PUDO GENERAR NUEVA ORDEN DE COMPRA!", "GESTION COMPRAS", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
        private void button8_Click(object sender, EventArgs e)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT PASSWORD_USUARIO FROM USUARIO WHERE ID_USUARIO = '{0}' AND PASSWORD_USUARIO = '{1}';", usuario, textBox3.Text.Trim());
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    button1.Visible  = true;
                    textBox1.Visible = true;
                    label4.Visible   = true;
                    textBox1.Focus();
                }
                else
                {
                    MessageBox.Show("LA CONTRASEÑA INGRESADA NO COINCIDE", "GESTION USUARIOS", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #10
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox10.Text != "" & textBox13.Text != "" & textBox12.Text != "" & textBox11.Text != "" & textBox9.Text != "" & textBox7.Text != "" & textBox9.Text != "")
     {
         try
         {
             OdbcConnection conexion = ASG_DB.connectionResult();
             string         sql      = sql = string.Format("CALL UPDATE_PROVEEDOR('{0}','{1}','{2}','{3}','{4}','{5}');", textBox9.Text.Trim(), textBox7.Text.Trim(), textBox10.Text.Trim(), textBox11.Text.Trim(), textBox13.Text.Trim(), textBox12.Text.Trim());
             OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
             if (cmd.ExecuteNonQuery() == 1)
             {
                 adressUser.ingresaBitacora(idSucursal, usuario, "EDICION PROVEEDOR", textBox7.Text.Trim());
                 conexion.Close();
                 datoGuardado();
             }
             else
             {
                 MessageBox.Show("NO SE GUARDARON LOS DATOS!", "GESTION PROVEEDORES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 conexion.Close();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
     else
     {
         MessageBox.Show("DEBE LLENAR TODOS LOS DATOS!", "GESTION PROVEEDORES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #11
0
        private void ingresaDevolucion(string factura, string tipo)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string      sql = string.Format("INSERT INTO DEVOLUCION VALUES (NULL,'{0}', '{1}',NOW(),TRUE);", tipo, factura);
                OdbcCommand cmd = new OdbcCommand(sql, conexion);
                if (cmd.ExecuteNonQuery() == 1)
                {
                    var fomra = new frm_creditoActualizado();
                    fomra.ShowDialog();
                    adressUser.ingresaBitacora(idSucursal, usuario, "DEVOLUCION FACTURA", codigoFactura);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("IMPOSIBLE GUARDAR DEVOLUCION!", "ANULACION FACTURA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #12
0
 private void textBox2_TextChanged(object sender, EventArgs e)
 {
     if (textBox2.Text != "")
     {
         try
         {
             OdbcConnection conexion = ASG_DB.connectionResult();
             string         sql      = string.Format("SELECT ID_PROVEEDOR FROM PROVEEDOR WHERE ID_PROVEEDOR = '{0}' AND ESTADO_TUPLA = TRUE;", textBox2.Text);
             OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
             OdbcDataReader reader   = cmd.ExecuteReader();
             if (reader.Read())
             {
                 pictureBox1.Image = ASG.Properties.Resources.delete__2_;
             }
             else
             {
                 pictureBox1.Visible = true;
                 pictureBox1.Image   = ASG.Properties.Resources.checked2;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
     else
     {
         pictureBox1.Visible = false;
     }
 }
예제 #13
0
 private void getTotal()
 {
     if (compraActual != "")
     {
         try
         {
             OdbcConnection conexion = ASG_DB.connectionResult();
             string         sql      = sql = string.Format("SELECT SUBTOTAL FROM CONTROL_COMPRA WHERE ID_COMPRA = {0};", compraActual);
             OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
             OdbcDataReader reader   = cmd.ExecuteReader();
             if (reader.Read())
             {
                 total = 0;
                 total = reader.GetDouble(0);
                 while (reader.Read())
                 {
                     total += reader.GetDouble(0);
                 }
                 label5.Text = string.Format("Q.{0:###,###,###,##0.00##}", total);
             }
         }
         catch
         (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
예제 #14
0
        private void guardaCompra()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string      sql = string.Format("CALL CIERRA_COMPRA ({0},{1},{2},{3});", compraActual, total, descuento, totalFinal);
                OdbcCommand cmd = new OdbcCommand(sql, conexion);
                if (cmd.ExecuteNonQuery() == 1)
                {
                    adressUser.ingresaBitacora(idSucursal, usuario, "COMPRA GENERADA", compraActual);
                    timerActions();
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("NO SE PUDO GUARDAR NUEVA ORDEN DE COMPRA!", "GESTION COMPRAS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #15
0
        private void cargaDatos()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM VISTA_ABONOS WHERE ID_CUENTA_POR_COBRAR = {0};", numeroCuenta);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Clear();
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(3)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(5)));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(3)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(5)));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #16
0
        private void eliminaFactura()
        {
            DialogResult result = MessageBox.Show("¿ESTA SEGURO QUE DESEA ELIMINAR LA FACTURA DE LA CUENTA POR COBRAR?", "BALANCE CLIENTES", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                OdbcConnection conexion = ASG_DB.connectionResult();
                try
                {
                    string      sql = string.Format("UPDATE CUENTA_POR_COBRAR_CLIENTE SET ESTADO_CUENTA = FALSE WHERE ID_CUENTA_POR_COBRAR = {0};", dataGridView1.CurrentRow.Cells[6].Value.ToString());
                    OdbcCommand cmd = new OdbcCommand(sql, conexion);
                    if (cmd.ExecuteNonQuery() == 1)
                    {
                        double cast = (Convert.ToDouble(dataGridView1.CurrentRow.Cells[4].Value.ToString()) - Convert.ToDouble(dataGridView1.CurrentRow.Cells[5].Value.ToString()));
                        updateAbono(cast, dataGridView1.CurrentRow.Cells[6].Value.ToString());
                        cargaDatos();
                    }
                    else
                    {
                        MessageBox.Show("IMPOSIBLE ELIMINAR FACTURA!", "GESTION COMPRAS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                conexion.Close();
            }
        }
예제 #17
0
        private void cargaSucursales()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM  VISTA_SUCURSALES;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Clear();
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(2), reader.GetString(1), reader.GetString(3), reader.GetString(4));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(2), reader.GetString(1), reader.GetString(3), reader.GetString(4));
                    }
                }
                else
                {
                    MessageBox.Show("NO EXISTEN SUCURSALES!", "SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #18
0
        private void cargaDatosCancelados()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM VISTA_CUENTA_CLIENTEF WHERE ID_CLIENTE = '{0}' ORDER BY FECHA_EMISION_FACTURA DESC;", codigoCliente);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    label2.Text  = codigoCliente;
                    label6.Text  = nombreCliente;
                    label11.Text = reader.GetString(0);
                    label13.Text = reader.GetString(1);
                    dataGridView1.Rows.Add(reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(6)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(6)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8));
                    }
                    totalDeuda();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #19
0
        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                dataGridView1.Rows.Clear();
                string         sql    = string.Format("SELECT * FROM VISTA_FACTURAS WHERE NOMBRE_SUCURSAL  = '{0}' AND ESTADO_TUPLA = {1} AND FECHA_EMISION_FACTURA LIKE '%{2}%' ORDER BY FECHA_EMISION_FACTURA DESC;", comboBox1.Text, comboBox5.SelectedIndex, dateTimePicker1.Value.ToString("yyyy-MM-dd"));
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2) + " " + reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(10)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(11)), reader.GetString(13), reader.GetString(14));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2) + " " + reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(10)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(11)), reader.GetString(13), reader.GetString(14));
                        //styleDV(this.dataGridView1);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "GESTION CLIENTES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #20
0
        private void setSucursal(string sucursal)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT NOMBRE_SUCURSAL FROM  SUCURSAL WHERE ID_SUCURSAL = {0};", sucursal);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    label5.Text = reader.GetString(0);

                    lastLoggin();
                    adressUser.ingresaBitacora(sucursal, userName, "INICIO DE SESION", "PASSWORD_USER");
                }
                else
                {
                    MessageBox.Show("NO EXISTEN SUCURSALES!", "SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #21
0
        private void cargaUsuarios()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT NOMBRE_USUARIO FROM USUARIO WHERE ESTADO_TUPLA = TRUE;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    //comboBox5.Items.Add(reader.GetString(0));
                    comboBox3.Items.Add(reader.GetString(0));
                    while (reader.Read())
                    {
                        //comboBox5.Items.Add(reader.GetString(0));
                        comboBox3.Items.Add(reader.GetString(0));
                    }
                    //comboBox5.SelectedIndex = 0;
                }
                else
                {
                    comboBox3.Items.Add("NO EXISTEN VENDEDORES");
                    comboBox3.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "GESTION MERCADERIA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #22
0
        private void cargaFacturasCredito()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            dataGridView1.Rows.Clear();
            try
            {
                string         sql    = string.Format("SELECT * FROM VISTA_FACTURAS_CLIENTE WHERE  ID_CLIENTE = '{0}' AND TIPO_FACTURA = '{1}' ORDER BY FECHA_EMISION_FACTURA DESC LIMIT 25;", codigoCliente, "CREDITO");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("Q{0:###,###,###,##0.00##}", reader.GetDouble(4)));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("Q{0:###,###,###,##0.00##}", reader.GetDouble(4)));
                    }
                }
                else
                {
                    dataGridView1.Rows.Add(" ", "NO EXISTEN DATOS");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #23
0
        private void cargaDatos()
        {
            dataGridView1.Rows.Clear();
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM VISTA_CLIENTES;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1) + " " + reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(6)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8), reader.GetString(9));
                    while (reader.Read())
                    {
                        dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1) + " " + reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(6)), string.Format("Q.{0:###,###,###,##0.00##}", reader.GetDouble(7)), reader.GetString(8), reader.GetString(9));
                        styleDV(this.dataGridView1);
                    }
                }
                else
                {
                    MessageBox.Show("NO EXISTEN CLIENTES!", "GESTION CLIENTES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    textBox1.Text = "";
                    textBox1.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "GESTION CLIENTES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #24
0
 private void button8_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         try
         {
             string         sql    = string.Format("SELECT EMAIL, NOMBRE_USUARIO, PASSWORD_USUARIO FROM USUARIO WHERE ID_USUARIO = '{0}';", textBox3.Text.Trim());
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 temp          = reader.GetString(0);
                 nombreUsuario = reader.GetString(1);
                 pass          = reader.GetString(2);
                 textBox1.Text = temp;
                 textBox2.Focus();
             }
             else
             {
                 MessageBox.Show("USUARIO NO EXISTE!", "RECUPERACION DE CUENTA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         } catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
 }
예제 #25
0
        private void guardaCuenta()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string      codigoCuenta = getCode();
                string      sql          = string.Format("INSERT INTO CUENTA_POR_PAGAR VALUES ('{0}',(SELECT ID_PROVEEDOR FROM PROVEEDOR WHERE NOMBRE_PROVEEDOR = '{1}' AND ESTADO_TUPLA = 1 LIMIT 1),{2},'{3}',0,'{4}',{5},{6},{7},TRUE,TRUE);", codigoCuenta, comboBox5.Text, compraActual, textBox2.Text.Trim(), dateTimePicker1.Value.ToString("yyyy-MM-dd"), total, descuento, totalFinal);
                OdbcCommand cmd          = new OdbcCommand(sql, conexion);
                if (cmd.ExecuteNonQuery() == 1)
                {
                    //.Show("SE GENERO LA CUENTA CORRECTAMENTE");
                    guardaCompra();
                }
                else
                {
                    MessageBox.Show("NO SE PUDO GENERAR NUEVA ORDEN DE COMPRA!", "GESTION COMPRAS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
예제 #26
0
        private void cargaMonedas()
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string         sql    = string.Format("SELECT * FROM  TIPO_CAMBIO;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    if (reader.GetString(0) == "MXN")
                    {
                        label30.Text       = label30.Text + " | Cambio Actual - Q." + "" + reader.GetDouble(1);
                        checkBox12.Checked = reader.GetBoolean(2);
                    }
                    else if (reader.GetString(0) == "QUETZALES")
                    {
                        label29.Text       = label29.Text + " | Cambio Actual - Q." + "" + reader.GetDouble(1);
                        checkBox10.Checked = reader.GetBoolean(2);
                    }
                    else if (reader.GetString(0) == "DOLARES")
                    {
                        label28.Text       = label28.Text + " | Cambio Actual - Q." + "" + reader.GetDouble(1);
                        checkBox11.Checked = reader.GetBoolean(2);
                    }
                    while (reader.Read())
                    {
                        if (reader.GetString(0) == "MXN")
                        {
                            label30.Text       = label30.Text + " | Cambio Actual - Q." + "" + reader.GetDouble(1);
                            checkBox12.Checked = reader.GetBoolean(2);
                        }
                        else if (reader.GetString(0) == "QUETZALES")
                        {
                            label29.Text       = label29.Text + " | Cambio Actual - Q." + "" + reader.GetDouble(1);
                            checkBox10.Checked = reader.GetBoolean(2);
                        }
                        else if (reader.GetString(0) == "DOLARES")
                        {
                            label28.Text       = label28.Text + " | Cambio Actual - Q." + "" + reader.GetDouble(1);
                            checkBox11.Checked = reader.GetBoolean(2);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("NO EXISTEN SUCURSALES!", "SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("FALLO LA CONEXION CON LA BASE DE DATOS!" + "\n" + ex.ToString(), "SUCURSALES", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            conexion.Close();
        }
예제 #27
0
        private void button16_Click(object sender, EventArgs e)
        {
            OdbcConnection   conexion = ASG_DB.connectionResult();
            frm_reporteVenta frm      = new frm_reporteVenta();
            CrystalReport22  cr       = new CrystalReport22();

            frm.crystalReportViewer1.ReportSource = cr;
            frm.crystalReportViewer1.RefreshReport();
            frm.ShowDialog();
        }
 private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
 {
     if (estado)
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         try
         {
             dataGridView1.Rows.Clear();
             string         sql    = string.Format("SELECT * FROM  VISTA_CUENTA_PAGAR WHERE ID_PROVEEDOR = '{0}' AND FECHA_COMPRA LIKE '%{1}%' ORDER BY FECHA_COMPRA DESC;", codigoProveedor, dateTimePicker1.Value.ToString("yyyy-MM-dd"));
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(5)), reader.GetString(6));
                 while (reader.Read())
                 {
                     dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(5)), reader.GetString(6));
                 }
                 totalDeuda();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         try
         {
             dataGridView1.Rows.Clear();
             string         sql    = string.Format("SELECT * FROM  VISTA_CUENTA_PAGARF WHERE ID_PROVEEDOR = '{0}' AND FECHA_COMPRA LIKE '%{1}%' ORDER BY FECHA_COMPRA DESC;", codigoProveedor, dateTimePicker1.Value.ToString("yyyy-MM-dd"));
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(5)), reader.GetString(6));
                 while (reader.Read())
                 {
                     dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(4)), string.Format("{0:###,###,###,##0.00##}", reader.GetDouble(5)), reader.GetString(6));
                 }
                 totalDeuda();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
 }
 private void presentacionesIngreso(string mercaderia, string stock, string descipcion, string cantidadP, string total, string cantM, string p1, string p2, string p3, string p4, string p5, string p6, string u1, string u2, string u3, string u4, string u5, string sucursal)
 {
     try
     {
         OdbcConnection conexion = ASG_DB.connectionResult();
         string         sql      = sql = string.Format("SELECT ID_STOCK FROM MERCADERIA_PRESENTACIONES WHERE ID_STOCK = '{0}' AND ID_SUCURSAL = (SELECT ID_SUCURSAL FROM SUCURSAL WHERE NOMBRE_SUCURSAL = '{1}' LIMIT 1);", stock, sucursal);
         OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
         OdbcDataReader reader   = cmd.ExecuteReader();
         if (reader.Read())
         {
             conexion.Close();
             conexion = ASG_DB.connectionResult();
             sql      = sql = string.Format("CALL UPDATE_STOCK ('{0}','{1}','{2}',{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},'{17}');", stock, mercaderia, descipcion, cantidadP, total, cantM, p1, p2, p3, p4, p5, p6, u1, u2, u3, u4, u5, sucursal);
             cmd      = new OdbcCommand(sql, conexion);
             if (cmd.ExecuteNonQuery() == 1)
             {
                 //MessageBox.Show("SE ACTUALIZA TIPO VENTA");
                 conexion.Close();
             }
             else
             {
                 // MessageBox.Show("fallo update stock");
             }
         }
         else
         {
             conexion.Close();
             conexion = ASG_DB.connectionResult();
             sql      = sql = string.Format("CALL INGRESA_STOCK_TRASLADO ('{0}','{1}','{2}','{3}',{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17});", stock, mercaderia, sucursal, descipcion, cantidadP, total, cantM, p1, p2, p3, p4, p5, p6, u1, u2, u3, u4, u5);
             cmd      = new OdbcCommand(sql, conexion);
             if (cmd.ExecuteNonQuery() == 1)
             {
                 //  MessageBox.Show("SE CREA TIPO VENTA TIPO VENTA");
                 conexion.Close();
             }
             else
             {
                 // MessageBox.Show("fallo primer ingeso");
             }
         }
     }
     catch
     (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #30
0
        private void ingresaCodigos(string codigoAlterno)
        {
            OdbcConnection conexion = ASG_DB.connectionResult();

            try
            {
                string      sql = string.Format("CALL INSERT_ALTER_CODES ('{0}','{1}');", codigoMercaderia, codigoAlterno);
                OdbcCommand cmd = new OdbcCommand(sql, conexion);
                if (cmd.ExecuteNonQuery() == 1)
                {
                }
            }
            catch (Exception)
            {
            }
            conexion.Close();
        }