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 actualizaTotal( string monto) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE CAJA SET TOTAL_FACTURADO_CAJA = TOTAL_FACTURADO_CAJA - {0} WHERE ID_CAJA = {1};", monto, codigoCaja); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { //.Show("SE GENERO LA CUENTA CORRECTAMENTE"); var forma = new frm_creditoActualizado(); forma.ShowDialog(); cargaCreditos(); cargaFacturas(); cargaDatos(); } else { MessageBox.Show("IMPOSIBLE ACTUALIZAR MONTO DE CAJA!", "CAJA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); }
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) { var fomra = new frm_creditoActualizado(); fomra.ShowDialog(); adressUser.ingresaBitacora(idSucursal, usuario, "COMPRA CREDITO", 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(); }
private void nuevaCompra(string code, string sucursal, string proveedor) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("CALL NUEVA_COMPRA ({0},'{1}','{2}','{3}');", code, usuarioSucursal, sucursal, proveedor); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { codigo = textBox9.Text.Trim(); nombreSucursal = comboBox1.Text.Trim(); proveedor = comboBox2.Text; var forma = new frm_creditoActualizado(); forma.ShowDialog(); 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()); } conexion.Close(); }
private void eliminaCompra() { DialogResult result = MessageBox.Show("¿ESTA SEGURO QUE DESEA ELIMINAR LA COMPRA DE LA CUENTA POR PAGAR?", "BALANCE PROVEEDORES", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE CUENTA_POR_PAGAR SET ESTADO_CUENTA = FALSE WHERE ID_CUENTA_POR_PAGAR = '{0}';", dataGridView1.CurrentRow.Cells[6].Value.ToString()); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { var forma = new frm_creditoActualizado(); forma.ShowDialog(); cargaDatos(); } else { MessageBox.Show("IMPOSIBLE ELIMINAR FACTURA!", "GESTION COMPRAS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); } }
private void cierraCaja(string codigo, string descripcion) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE CAJA SET ESTADO_TUPLA = FALSE, OBSERVACIONES_CAJA = '{0}' WHERE ID_CAJA = {1};", descripcion, codigo); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { var forma = new frm_creditoActualizado(); forma.ShowDialog(); DialogResult = DialogResult.OK; } else { MessageBox.Show("IMPOSILBE CERRAR CAJA!", "GESTION CAJA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } 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(); }
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(); }
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { guardaMonedas(dataGridView1.Rows[i].Cells[0].Value.ToString(), dataGridView1.Rows[i].Cells[1].Value.ToString()); } var forma = new frm_creditoActualizado(); forma.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { if (tipoAbono) { if (textBox5.Text != "" && textBox5.Text != "0") { if (Convert.ToDouble(textBox5.Text) == totalFactura) { DialogResult result = MessageBox.Show("DESEA CANCELAR EL TOTAL DE LA FACTURA?", "VENTA AL CREDITO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == System.Windows.Forms.DialogResult.Yes) { ingresaPagos(); obtieneCodigo(); textBox3.Text = "PAGO EFECTUADO POR TOTAL FACTURA"; adressUser.ingresaBitacora(nombreSucursal, usuarioNombre, "ABONO - TOTAL FACTURA", codigoCliente); button1.Enabled = false; button3.Enabled = false; } } else if (Convert.ToDouble(textBox5.Text) > totalFactura) { MessageBox.Show("EL VALOR DEL ABONO DEBE SER MENOR O IGUAL AL TOTAL DE LA FACTURA", "VENTA CREDITO", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { abonaPagoCliente(); obtieneCodigo(); textBox3.Text = "PAGO PARCIAL EFECTUADO DE FACTURA"; adressUser.ingresaBitacora(nombreSucursal, usuarioNombre, "ABONO - PARCIAL", codigoCliente); button1.Enabled = false; button3.Enabled = false; } } else { MessageBox.Show("INGRESO ELTOTAL DEL ABONO", "NUEVA VENTA - CREDITO", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { if ((Convert.ToDouble(textBox5.Text) > totalFactura) || (Convert.ToDouble(textBox5.Text) < totalFactura)) { MessageBox.Show("EL VALOR DEL ABONO DEBE IGUAL AL TOTAL DE LA FACTURA", "VENTA CREDITO", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { obtieneCodigo(); textBox3.Text = "PAGO TOTAL POR EL VALOR DE LAS FACTURAS"; button1.Enabled = false; button3.Enabled = false; var forma = new frm_creditoActualizado(); forma.ShowDialog(); } } }
private void button1_Click(object sender, EventArgs e) { if (dataGridView1.RowCount > 0) { for (int i = 0; i < dataGridView1.RowCount - 1; i++) { if (enterData(dataGridView1.Rows[i].Cells[0].Value.ToString())) { ingresaCodigos(dataGridView1.Rows[i].Cells[1].Value.ToString()); } } var forma = new frm_creditoActualizado(); forma.ShowDialog(); } else { MessageBox.Show("INGRESE UN COIDGO ALTERNO!", "GESTION COMPRAS", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button2_Click(object sender, EventArgs e) { if (sucursalSeleccionada()) { if ((dataGridView1.RowCount > 0) && (dataGridView4.RowCount > 0)) { for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1.Rows[i].Cells[2].Value != null) { if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[2].Value.ToString())) { for (int j = 0; j < dataGridView4.RowCount; j++) { if (dataGridView4.Rows[j].Cells[0].Value != null) { if (Convert.ToBoolean(dataGridView4.Rows[j].Cells[0].Value.ToString())) { //MessageBox.Show(dataGridView1.Rows[i].Cells[1].Value.ToString() + " PRESENTACION -> " + dataGridView4.Rows[j].Cells[2].Value.ToString()); updateStock(codigoMercaderia, dataGridView4.Rows[j].Cells[1].Value.ToString(), dataGridView4.Rows[j].Cells[2].Value.ToString(), dataGridView4.Rows[j].Cells[3].Value.ToString(), dataGridView4.Rows[j].Cells[4].Value.ToString(), dataGridView4.Rows[j].Cells[5].Value.ToString(), dataGridView4.Rows[j].Cells[6].Value.ToString(), dataGridView4.Rows[j].Cells[7].Value.ToString(), dataGridView4.Rows[j].Cells[8].Value.ToString(), dataGridView4.Rows[j].Cells[9].Value.ToString(), dataGridView4.Rows[j].Cells[10].Value.ToString(), dataGridView4.Rows[j].Cells[11].Value.ToString(), dataGridView4.Rows[j].Cells[12].Value.ToString(), dataGridView4.Rows[j].Cells[13].Value.ToString(), dataGridView4.Rows[j].Cells[14].Value.ToString(), dataGridView4.Rows[i].Cells[15].Value.ToString(), dataGridView4.Rows[j].Cells[16].Value.ToString(), dataGridView1.Rows[i].Cells[0].Value.ToString()); } } } } } } var forma = new frm_creditoActualizado(); forma.ShowDialog(); button2.Enabled = false; } else { MessageBox.Show("DEBEN DE EXISTIR DATOS PARA APLICAR LOS PRECIOS!", "PRECIOS MERCADERIA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("NO HA SELECCIONADO NINGUNA SUCURSAL!", "PRECIOS MERCADERIA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button1_Click(object sender, EventArgs e) { if (buscaCodigo()) { if (state) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE MERCADERIA_PRESENTACIONES SET ID_STOCK = '{0}' WHERE ID_STOCK = '{1}';", textBox1.Text.Trim(), stock); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() >= 0) { var forma = new frm_creditoActualizado(); forma.ShowDialog(); DialogResult = DialogResult.OK; } else { MessageBox.Show("NO SE PUDO ACTUALIZAR EL SUBCODIGO!", "MANTENIMIENTO CODIGOS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); } else { codigoNuevo = textBox1.Text; DialogResult = DialogResult.OK; } } else { MessageBox.Show("EL CODIGO YA EXISTE", "MANTENIMIENTO CODIGOS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button1_Click(object sender, EventArgs e) { if (textBox9.Text != "" && textBox11.Text != "" && textBox12.Text != "" && comboBox1.Text != "") { if (nombreSucursal(textBox9.Text.Trim())) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("CALL NUEVA_SUCURSAL ('{0}','{1}','{2}','{3}');", comboBox1.Text, textBox9.Text.Trim(), textBox12.Text.Trim(), textBox11.Text.Trim()); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { //.Show("SE GENERO LA CUENTA CORRECTAMENTE"); var forma = new frm_creditoActualizado(); forma.ShowDialog(); DialogResult = DialogResult.OK; } else { MessageBox.Show("IMPOSIBLE CREAR NUEVA SUCURSAL!", "AJUSTES", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); } else { MessageBox.Show("NO SE PUEDE UTLIZAR EL MISMO NOMBRE PARA LAS SUCURSALES!", "NUEVA SUCURSAL", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("DEBE DE LLENAR TODOS LOS CAMPOS", "NUEVA SUCURSAL", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button2_Click(object sender, EventArgs e) { if (comboBox5.Text != "") { if (Convert.ToDouble(textBox1.Text.ToString()) > 0) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE CONFIGURACION_SISTEMA SET IMPRESORA = '{0}' , COPIAS = {1} , VISTA = {2} WHERE IDCONFIGURACION = 111 ;", comboBox5.Text.Trim(), textBox1.Text, checkBox1.Checked); OdbcCommand cmd = new OdbcCommand(sql, conexion); if ((cmd.ExecuteNonQuery() == 1) || (cmd.ExecuteNonQuery() == 0)) { var fomra = new frm_creditoActualizado(); fomra.ShowDialog(); } else { MessageBox.Show("IMPOSIBLE GUARDAR CONFIGURACION!", "CONIGURACION SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); } else { MessageBox.Show("EL NUMERO DE COPIAS DEBE SER MAYOR A UNO", "CONFIGURACION IMPRESION", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("SELECCIONE UNA IIMPRESORA PARA CONTINUAR", "CONFIGURACION IMPRESION", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void updateDisponible(string abono) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE CLIENTE SET CREDITO_DISPONIBLE = CREDITO_DISPONIBLE + {0} WHERE ID_CLIENTE = '{1}';", abono, codigoCliente); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { var forma = new frm_creditoActualizado(); forma.ShowDialog(); } else { MessageBox.Show("IMPOSILE ABONAR PAGO DE CLIETE!", "NUEVA VENTA - CREDITO", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); }
private void aperturaCaja() { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("INSERT INTO CAJA VALUES (NULL,{0},'{1}',NOW(),{2},NOW(),{2},'APERTURADA',TRUE,TRUE);", codigoSucursal, usuarioSistema, textBox2.Text); OdbcCommand cmd = new OdbcCommand(sql, conexion); if (cmd.ExecuteNonQuery() == 1) { var fomra = new frm_creditoActualizado(); fomra.ShowDialog(); } 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(); }
private void updateAbono(string abono) { OdbcConnection conexion = ASG_DB.connectionResult(); try { string sql = string.Format("UPDATE CUENTA_POR_PAGAR SET TOTAL_PAGADO = TOTAL_PAGADO - {0} 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 DESCONTAR DEL TOTAL DEL ABONO!", "COMPRA - CREDITO", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); }