private void BtnGuardar_Click(object sender, EventArgs e) { try { if (controlarguardado() == true) { DataTable dt = new DataTable(); dt.Columns.Add("Codigo", typeof(string)); dt.Columns.Add("Cantidadtotal", typeof(decimal)); dt.Columns.Add("Detalle", typeof(string)); dt.Columns.Add("Cantidadparcial", typeof(string)); foreach (DataGridViewRow fila in DGDetalleitems.Rows) { dt.Rows.Add(fila.Cells["CCodigo"].Value, fila.Cells["CCantidad"].Value, fila.Cells["CDetalle"].Value, 0); } NegocioRetirodeMercaderia.insertar(DateTime.Now, idcliente, NegocioConfigEmpresa.idusuario, CbTipopedido.Text, "PENDIENTE", "", dt, idclientebeneficiaria, Convert.ToInt32(CbTipopedido.SelectedValue)); UtilityFrm.mensajeConfirm("Se guardo correctamente"); limpiarformulario(); } else { UtilityFrm.mensajeError("Tiene algunos campos en blanco, no puede continuar"); } } catch (Exception err) { UtilityFrm.mensajeError(err.Message); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { if (txtUtilidad.Text == "0" || txtUtilidad.Text.Length == 0) { //en el caso de que la utilidad sea 0 y esté activado modificar por utilidad UtilityFrm.mensajeError("No se a podido guardar,verifique el campo utilidad si no se encuentra vacio o con valor 0"); } else { //this.dgvProductosSeleccionados.Columns["precioCompra"].DefaultCellStyle.Format = String.Format("###,##0.00"); DataTable tablaArticulos = GrillaADataTable(dgvProductosSeleccionados); string respuesta = NegocioArticulo.editarPrecioMasivo(tablaArticulos); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se ha modificado Correctamente"); this.Close(); } else { UtilityFrm.mensajeError("Ocurrió un error :" + respuesta); } } } catch (Exception ex) { UtilityFrm.mensajeError("No se a podido guardar :" + ex.Message); } }
//guarda el precio actualizado public void guardarPrecio() { try { decimal precioVenta = Convert.ToDecimal(txtPrecioVenta.Text); decimal precioCompra = Convert.ToDecimal(txtPrecioCompra.Text); if (precioVenta > 0 && idArticulo != 0 && precioCompra > 0) { this.precioVenta = precioVenta; this.utilidad = Convert.ToInt32(txtUtilidad.Text); NegocioArticulo.editarPrecio(this.idArticulo, precioVenta, precioCompra, this.utilidad); this.Close(); UtilityFrm.mensajeConfirm("La edición se realizó Correctamente"); } else { UtilityFrm.mensajeError("No se a podido guardar "); } } catch (Exception ex) { UtilityFrm.mensajeError("No se a podido guardar :" + ex.Message); } }
private void btnAplicar_Click(object sender, EventArgs e) { try { if (DGVenta.Rows.Count != 0) { foreach (DataGridViewRow row in DGVenta.Rows) { row.Cells[6].Value = UtilityFrm.formateodecimal(UtilityFrm.calcularventa(Convert.ToDecimal(row.Cells[3].Value), Convert.ToDecimal(row.Cells[4].Value), Convert.ToDecimal(row.Cells[5].Value), Convert.ToDecimal(row.Cells[6].Value)), 2); } if (UtilityFrm.mensajeopcionsiono("Desea aplicar los cambios?") == true) { DataTable tablaArticulos = GrillaADataTable(DGVenta); string respuesta = NegocioArticulo.editarPrecioMasivo(tablaArticulos); UtilityFrm.mensajeConfirm("La actualizacion se realizo con exito"); DGVenta.Rows.Clear(); } } } catch (Exception s) { UtilityFrm.mensajeError(s.Message); } }
private void btnEliminar_Click(object sender, EventArgs e) { string respuesta = ""; try { //si la respuesta es si elimina la fila actual if (MessageBox.Show("Seguro que desea Eliminar?", "Eliminar" , MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.Yes) { /*eliminar varias categoria*/ if (chkEliminar.Checked == true) { foreach (DataGridViewRow row in dataLista.Rows) { //Si la fila esta marcada lo elimina if (Convert.ToBoolean(row.Cells[0].Value)) { //le paso el idcategoria para poder eliminarlo respuesta = NegocioProveedor.eliminar(Convert.ToInt32(row.Cells[1].Value)); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm(row.Cells[2].Value.ToString() + " Se Eliminó Correctamente"); } else { UtilityFrm.mensajeError("Error: " + respuesta); } } } } else { /*eliminar una sola categoria*/ respuesta = NegocioProveedor.eliminar(Convert.ToInt32(this.dataLista.CurrentRow.Cells[1].Value)); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm(dataLista.CurrentRow.Cells[2].Value.ToString() + " se eliminó correctamente"); } else { UtilityFrm.mensajeError("Error: " + respuesta); } } mostrar(); } //desabilito el checkbox y el boton eliminar chkEliminar.Checked = false; btnEliminar.Enabled = false; } catch (Exception ex) { UtilityFrm.mensajeError("Error: " + respuesta + ", " + ex.Message); } }
private void button1_Click(object sender, EventArgs e) { string correlativa = "0"; string serie = "0"; string comprobante = ""; string ingresouegreso = ""; string respuesta = ""; if (ChRegistrar.Checked == true && proveedor != string.Empty) { correlativa = txtCorrelativa.Text == string.Empty ? txtCorrelativa.Text = "0" : txtCorrelativa.Text; serie = txtSerie.Text == string.Empty ? txtSerie.Text = "0" : txtSerie.Text; comprobante = cbTipoComprobante.Text; } else if (ChRegistrar.Checked == false) { proveedor = "0"; } DataTable dt = new DataTable(); dt.Columns.Add("Codigo", typeof(string)); dt.Columns.Add("Precio", typeof(decimal)); dt.Columns.Add("PrecioVenta", typeof(decimal)); dt.Columns.Add("Cantidad", typeof(string)); dt.Columns.Add("StockActual", typeof(string)); ingresouegreso = rdbIngreso.Checked == true ? "INGRESO" : "EGRESO"; foreach (DataGridViewRow row in dataListaMov.Rows) { dt.Rows.Add(row.Cells[0].Value, row.Cells[2].Value, row.Cells[3].Value, row.Cells[4].Value, row.Cells[5].Value); } if (dataListaMov.RowCount != 0) { respuesta = NegocioMovStock.insertar(Convert.ToInt32(proveedor), DateTime.Today, serie, correlativa, comprobante, 0, "EMITIDO", ingresouegreso, dt); } if (respuesta.Equals("ok")) { limpiartodo(); UtilityFrm.mensajeConfirm("Se Agrego Correctamente"); dataListaMov.Rows.Clear(); //this.mostrar(); } else { UtilityFrm.mensajeError("No se ha podido Agregar: " + respuesta); } }
public void impresioncomprobante(string tipocomprobante) { string msg = "ok"; Negociocomprobantes objcomprobante = new Negociocomprobantes(); char estadofactura = 'P'; DataTable datacliente = new DataTable(); datacliente = NegocioCliente.buscarCodigoCliente(idcliente); string nrocomprobante = "0"; DataRow row = datacliente.Rows[0]; DataTable dt = detalleventa(row["responsabilidadiva"].ToString()); if (NegocioConfigEmpresa.confsistema("facturar").ToString() == "True" && txtTipoComprobante.Text == "NOTA DE VENTA") { //&& tipo_comprobante == "NOTA DE VENTA" msg = objcomprobante.factura(NegocioConfigEmpresa.marcafiscal, dt, Convert.ToDouble(txtTotal.Text), NegocioConfigEmpresa.modelofiscal, NegocioConfigEmpresa.puertofiscal, 1, row["razon_social"].ToString(), row["razon_social"].ToString() == "CONSUMIDOR FINAL" ? "99999999999" : row["cuit"].ToString(), row["direccion"].ToString(), "B", row["responsabilidadiva"].ToString(), tipocomprobante); if (msg.Substring(0, 2) != "ok") { UtilityFrm.mensajeError(msg); UtilityFrm.mensajeConfirm("Se guardara la venta como pendiente de factura la puede encontrar en lista de ventas"); estadofactura = 'P'; } else { nrocomprobante = msg.Substring(2, 8); if (tipocomprobante == "FACTURA") { estadofactura = 'F'; } else { estadofactura = 'N'; } } this.Close(); } else if (txtTipoComprobante.Text == "PRESUPUESTO") { estadofactura = 'P'; } string mensaje = NegocioVenta.cambiarestadoventa(Convert.ToInt32(txtCodigo.Text), estadofactura, nrocomprobante); if (mensaje.Equals("ok")) { UtilityFrm.mensajeConfirm("La facturación se realizó Correctamente"); } else { UtilityFrm.mensajeError(mensaje); } }
private void BtnAsentarpago_Click(object sender, EventArgs e) { string respuesta = ""; decimal saldo = 0; int codrecibo = 0; string mensaje = ""; midata = new DataTable(); Negociocaja objcaja = new Negociocaja(); midata.Columns.Add("Idventa", typeof(int)); midata.Columns.Add("saldo", typeof(decimal)); midata.Columns.Add("pagado", typeof(decimal)); midata.Columns.Add("total", typeof(decimal)); midata.Columns.Add("estado", typeof(string)); midata.Columns.Add("grabar", typeof(string)); if (traerpagototal(false) != 0) { Frmasentarpago objpago = new Frmasentarpago(traerpagototal(true)); objpago.Midatatable = midata; objpago.ShowDialog(); if (objpago.Confirmarpago == true) { cargardatatable(objpago.Importe); //objpago.importe en ves de pagototal respuesta = NegocioCliente.agregaromodificarrecibo(midata, objpago.Importe, idcliente, NegocioConfigEmpresa.idusuario, ref codrecibo); } if (respuesta == "ok") { if (objcaja.chequeocaja("FrmClientes", ref mensaje) == true) { respuesta = Negociocaja.insertarmovcaja(1310101, Convert.ToSingle(objpago.Importe), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Recibo nro : " + codrecibo.ToString(), codrecibo, true); if (respuesta == "ok") { NegocioCliente.modificarestadocajarecibo(codrecibo); } } FrmReporteRecibo formrecibo = new Formreportes.FrmReporteRecibo(codrecibo); formrecibo.ShowDialog(); UtilityFrm.mensajeConfirm("El pago se guardo con exito"); buscarctacte(Convert.ToInt32(txtCodigo.Text == string.Empty ? "0" : txtCodigo.Text)); } } else { UtilityFrm.mensajeError("No hay saldo"); } }
private void button1_Click(object sender, EventArgs e) { FolderBrowserDialog browser = new FolderBrowserDialog(); Negociocomprobantes objcomprobante = new Negociocomprobantes(); DateTime desde1 = new DateTime(); DateTime hasta1 = new DateTime(); string desde = ""; string hasta = ""; browser.RootFolder = Environment.SpecialFolder.MyComputer; string tempPath = ""; if (RbtnFecha.Checked == true) { desde1 = dtpFechaDesde.Value; hasta1 = dtbFechaHasta.Value; desde = desde1.ToString("ddMMyy"); hasta = hasta1.ToString("ddMMyy"); } else { desde = TxtDesde.Text; hasta = TxtHasta.Text; if (TxtDesde.Text == "" || TxtHasta.Text == "") { UtilityFrm.mensajeError("Tiene algunos casilleros en blanco no puede continuar"); return; } } if (browser.ShowDialog() == DialogResult.OK) { string msg = ""; tempPath = browser.SelectedPath; msg = objcomprobante.Descargarperiodo(NegocioConfigEmpresa.marcafiscal, tempPath, desde, hasta); if (msg != "ok") { UtilityFrm.mensajeError(msg); } else { UtilityFrm.mensajeConfirm("Se a descargado correctamente"); } //} } }
private void buscarequipo(string equiposerie) { DataTable mitabla = new DataTable(); mitabla = Negocioserviciotecnico.buscarequipo(equiposerie, 0, 0, 0); if (mitabla.Rows.Count == 0) { UtilityFrm.mensajeConfirm("El equipo no se encuentra dado de alta"); } else { foreach (DataRow row in mitabla.Rows) { CBEquipo.Text = Convert.ToString(row["equipo"]); CBMar.Text = Convert.ToString(row["marca"]); CBMod.Text = Convert.ToString(row["modelo"]); } } }
private void guardar() { string varestado = "PENDIENTE"; string mensaje = ""; DataTable dt = new DataTable(); dt.Columns.Add("Codigo", typeof(string)); dt.Columns.Add("Cantidadtotal", typeof(decimal)); dt.Columns.Add("Detalle", typeof(string)); dt.Columns.Add("Cantidadparcial", typeof(string)); dt.Columns.Add("cantidadactual", typeof(string)); if (recorreritemsparacambioestado() == true) { varestado = "FINALIZADO"; } mensaje = validacionformulario(); //primero agrego el remito y despues modifico if (mensaje == "ok") { foreach (DataGridViewRow fila in GDDetalleretiro.Rows) { dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["cantotal"].Value, fila.Cells["Detalle"].Value, fila.Cells["canparcial"].Value, fila.Cells["canactual"].Value); } string nroremito = ""; mensaje = NegocioRetirodeMercaderia.modificarcantidad(Convert.ToInt32(LblNorden.Text), varestado, dt, Convert.ToInt32(LblCodcliente.Text), LblTipo.Text, ref nroremito, idempresa); if (mensaje == "ok") { FrmTicketRemito objremito = new Formreportes.FrmTicketRemito(nroremito); objremito.ShowDialog(); UtilityFrm.mensajeConfirm("Se genero el remito con exito"); limpiarformulario(); } else { UtilityFrm.mensajeError(mensaje); } } else { UtilityFrm.mensajeError(mensaje); } }
private void BuscarNombrePesable() { try { dataLista.Rows.Clear(); DataTable data = NegocioArticulo.mostrarPesableXbusqueda(txtBuscar.Text, "nombre"); foreach (DataRow producto in data.Rows) { UtilityFrm.mensajeConfirm("hola"); // dataLista.Rows.Add(producto["idarticulo"], producto["codigo"], producto["nombre"]); // dataLista.Rows.Add(producto["idarticulo"], producto["codigo"], producto["nombre"], producto["precio"], producto["categoria"]); } } catch (Exception ex) { UtilityFrm.mensajeError("error: " + ex.Message); } }
private void btnGuardarTarjeta_Click(object sender, EventArgs e) { try { if (txtNombTarjeta.Text != string.Empty && cbxTipoTarjeta.SelectedItem.ToString() != string.Empty) { //forma de pago 4 tarjeta de credito - 8 tarjeta de debito int codFormaPago = cbxTipoTarjeta.SelectedItem.ToString() != "Credito"? 4 :8; string respuesta = NegocioTarjeta.insertar(txtNombTarjeta.Text, codFormaPago); if (respuesta == "ok") { UtilityFrm.mensajeConfirm("La tarjeta ha sido agregada correctamente"); } else { UtilityFrm.mensajeConfirm("Ha ocurrido un error cuando intentó agregar tarjeta"); } } } catch (Exception ex) { UtilityFrm.mensajeError("Error: " + ex.Message); } }
private void btnSincronizar_Click(object sender, EventArgs e) { if (txtRuta.Text.Length > 0 && txtRuta.Text != "") { try { string respuesta = NegocioBackup.backupBaseDeDatos(txtRuta.Text); if (respuesta == "ok") { UtilityFrm.mensajeConfirm("El backup se realizó correctamente"); sincronizarBackup(txtRuta.Text + "\\backup.bak"); } else { UtilityFrm.mensajeError("Error :" + respuesta); } } catch (Exception ex) { UtilityFrm.mensajeError("Error: " + ex.Message + " " + ex.StackTrace); } } }
private void btnGuardar_Click(object sender, EventArgs e) { NegocioUsuario objusuario = new NegocioUsuario(); if (ABM == "AGREGAR") { if (MessageBox.Show("Desea Guardar?", "Guardar" , MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.Yes) { if (UtilityFrm.validarnull(txtProducto, txtNombre, txtContraseña, txtConfirmar) == true) { if (txtContraseña.Text == txtConfirmar.Text) { objusuario.agregarusuario(txtProducto.Text, txtNombre.Text, txtContraseña.Text, UtilityFrm.turnosegunhora(), true, checkBox1.Checked, 0); } else { UtilityFrm.mensajeError("La clave no coincide con la confirmación"); } } else { UtilityFrm.mensajeError("Algunos valores estan en blanco"); } UtilityFrm.mensajeConfirm("Se agrego el usuario correctamente"); UtilityFrm.limpiarTextbox(txtProducto, txtNombre, txtContraseña, txtConfirmar); activar(true, false); } } if (ABM == "ACTUALIZAR") { objusuario.actualizarusuario(txtProducto.Text, txtNombre.Text, txtConfirmar.Text, UtilityFrm.turnosegunhora(), true, checkBox1.Checked, this.idusuario); activar(true, false); } }
private void btnVerificar_Click(object sender, EventArgs e) { int digControl = 0; string codigoBarra = string.Empty; if (txtCodigoBarra.Text.Count() == 0 || txtCodigoBarra.Text.Count() < 13) { UtilityFrm.mensajeError("No existe ningún codigo de barra con 13 dígitos"); errorIcono.SetError(txtCodigoBarra, "Ingrese un codigo de barra de 13 dígitos"); } else if (txtCodigoBarra.Text.Count() == 13) { digControl = NegocioArticulo.calcDigControl(txtCodigoBarra.Text.Trim()); //comparo el digito de control con la funcion calcDigControl, con el dig 13 ingresado por el usuario if (digControl == int.Parse(txtCodigoBarra.Text[12].ToString())) { UtilityFrm.mensajeConfirm("Se cambió Codigo de Barra correctamente"); this.Close(); } else { if (MessageBox.Show("No es correcto el codigo de barra, Desea arreglarlo?", "Codigo de barra" , MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { codigoBarra = txtCodigoBarra.Text; codigoBarra = codigoBarra.Remove(12) + digControl; txtCodigoBarra.Text = codigoBarra; this.CodigoDeBarra = codigoBarra; UtilityFrm.mensajeConfirm("Se cambió Codigo de Barra correctamente el codigo nuevo es: " + codigoBarra); this.Close(); this.IsCerro = false; } } } }
public void guardarventa() { int nroterminal = 0; int codtarjeta = 0; string cupon = ""; string lote = ""; decimal importe = 0; int cuota = 0; int codformapago = 1; string msg = "ok"; string precioneto = ""; string cantidad = ""; decimal var = 0; Char estadofactura = 'P'; //P : pendiente de factura F : facturado string nrocomprobante = ""; totales(); NegocioVenta objventa = new NegocioVenta(); DataTable dt = new DataTable(); dt.Columns.Add("Codigo", typeof(string)); dt.Columns.Add("Precio", typeof(decimal)); dt.Columns.Add("Cantidad", typeof(string)); dt.Columns.Add("Descuento", typeof(decimal)); dt.Columns.Add("Importe", typeof(decimal)); dt.Columns.Add("Producto", typeof(string)); dt.Columns.Add("Precioneto", typeof(string)); dt.Columns.Add("Pesable", typeof(int)); DataTable DTOrdenpedido = new DataTable(); DTOrdenpedido.Columns.Add("Codigo", typeof(string)); DTOrdenpedido.Columns.Add("cantidadparcial", typeof(string)); DTOrdenpedido.Columns.Add("cantidadtotal", typeof(string)); DTOrdenpedido.Columns.Add("detalle", typeof(string)); decimal IVA = 21; if (formapago == "tarjeta") { codtarjeta = this.codtarjeta; cupon = txtCupon.Text == "" ? "0":txtCupon.Text; lote = txtLote.Text == "" ? "0" : txtLote.Text; cuota = Convert.ToInt32(lblCuota.Text); importe = Convert.ToDecimal(lblImportecuota.Text); codformapago = 2; } if (formapago == "ctacte") { codformapago = 3; } /*IMPORTANTE HACER NOTA DE VENTA PARA IMPRIMIR*/ //if (MessageBox.Show("Desea Imprimir Venta?", "Imprimir" // , MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.Yes) //{ // FrmImpVenta venta = new FrmImpVenta(totalAPagar); // venta.Show(); //} //else { // this.Close(); //} try { //LISTA DE PRODUCTOS SE LE ASIGNA EN EL MOMENTO QUE SE MUESTRA EL FORMULARIO // NumberFormatInfo asociado con la cultura en-US. NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat; foreach (DataGridViewRow fila in listadoDeProducto.Rows) { if (responsableiva != "EX") { var = Decimal.Round(Convert.ToDecimal(fila.Cells["CPrecio"].Value) / Convert.ToDecimal(1.21), 2); } else { var = Decimal.Round(Convert.ToDecimal(fila.Cells["CPrecio"].Value), 2); } //Math.Round(decValue, 2, MidpointRounding.AwayFromZero) // var = Math.Round(var, 2, MidpointRounding.AwayFromZero); precioneto = var.ToString("0.0000", nfi); //var = Convert.ToDecimal(fila.Cells["Cantidad"].Value); //cantidad = var.ToString("0.00", nfi); //recorro la lista pasado por paramentro y asigno al datatable para generar la transaccion //dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["Precio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value); dt.Rows.Add(fila.Cells["Codigo"].Value, fila.Cells["CPrecio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value, fila.Cells["Producto"].Value, precioneto, fila.Cells["Dpesable"].Value); DTOrdenpedido.Rows.Add(fila.Cells["Codigo"].Value, "0", fila.Cells["Cantidad"].Value, fila.Cells["Producto"].Value); } try { if (NegocioConfigEmpresa.confsistema("facturar").ToString() == "True" && tipo_comprobante == "NOTA DE VENTA" && tipofactura != "X") { if (NegocioConfigEmpresa.marcafiscal != "") { msg = objcomprobante.factura(NegocioConfigEmpresa.marcafiscal, dt, Convert.ToDouble(txtTotalAPagar.Text), NegocioConfigEmpresa.modelofiscal, NegocioConfigEmpresa.puertofiscal, 1, razonsocial, razonsocial == "CONSUMIDOR FINAL" ? "99999999999" : cuit, domicilio, tipofactura, responsableiva, tipofactura, tipofactura, Convert.ToDouble(neto), Convert.ToDouble(iva), Convert.ToDouble(this.neto105), Convert.ToDouble(this.iva105)); } else { UtilityFrm.mensajeError("La marca de la fiscal no se encuentra definido, la factura quedara pendiente"); } if (msg.Substring(0, 2) != "ok") { UtilityFrm.mensajeError(msg); UtilityFrm.mensajeConfirm("Se guardara la venta como pendiente de factura la puede encontrar en lista de ventas"); estadofactura = 'P'; } else { estadofactura = 'F'; //corregir para que no genere errores int nrocaracteres = Convert.ToInt32(msg.Length.ToString()); nrocomprobante = msg.Substring(2, nrocaracteres - 2); } } else { estadofactura = 'P'; } } catch (Exception e) { UtilityFrm.mensajeError(e.Message); } string Rta = objventa.Insertar(this.idCliente, DateTime.Now, Tipo_comprobante, objcomprobante.Puntoventa.PadLeft(5, '0'), msg.Substring(0, 2) == "ok" ? nrocomprobante.PadLeft(8, '0') : "0", IVA, this.concaja, this.constock, NegocioConfigEmpresa.usuarioconectado, dt, Convert.ToDecimal(txtBonificacion.Text == "" ? txtBonificacion.Text = "0" : txtBonificacion.Text), Convert.ToDecimal(txtTotalAPagar.Text), Convert.ToDecimal(lblsubtotal.Text), estadofactura, NegocioConfigEmpresa.confsistema("stock").ToString() == this.Name && pendientedestock == false ? true : false, nroterminal, codtarjeta, cupon, lote, importe, cuota, codformapago, neto, iva, objcomprobante.Cae, objcomprobante.Fechavto, objcomprobante.Numerotipofactura.PadLeft(3, '0'), objcomprobante.Puntoventa.PadLeft(5, '0'), this.iva105, this.neto105); int objnum = objventa.Idventa; if (Rta == "OK" || Rta == "ok") { if (pendientedestock == true) { NegocioRetirodeMercaderia.insertar(DateTime.Now, this.idCliente, NegocioConfigEmpresa.idusuario, "VENTA", "PENDIENTE", "", DTOrdenpedido, this.idCliente, 1, objnum); } if (this.concaja == true) { Rta = Negociocaja.insertarmovcaja(4110107, Convert.ToSingle(txtTotalAPagar.Text), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Venta nro : " + objventa.Idventa.ToString(), objventa.Idventa, true); } else { Rta = "ok"; } if (Rta == "ok") { trans = Rta; Reporteventa mireporteventa = new Reporteventa(); // Frmimpnotaventa miformnotaventa = new Frmimpnotaventa(); // Frmimpventicket miformticket = new Frmimpventicket(); if (NegocioConfigEmpresa.confsistema("imprimirventa").ToString() == "True") { if (NegocioConfigEmpresa.confsistema("tipoimpresion").ToString() == "tipocarro") { //con crystal report // miformnotaventa.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa")); // miformnotaventa.Codventa = objventa.Idventa; // miformnotaventa.Show(); // con reportviewer mireporteventa.Idventa = objventa.Idventa; mireporteventa.ShowDialog(); } else { if (NegocioConfigEmpresa.marcafiscal == "elec" && tipofactura != "X") { Ticketventa miticket = new Formreportes.Ticketventa(objventa.Idventa); miticket.ShowDialog(); } else if (tipofactura == "X") { TicketProforma miticketproforma = new Formreportes.TicketProforma(objventa.Idventa); miticketproforma.ShowDialog(); } //miformticket.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa")); //miformticket.Codventa = objventa.Idventa; //miformticket.Show(); } } if (facturar == true) { // NegocioFHasar objhasar = new NegocioFHasar(); //objhasar.Comprobantefiscal(1, 1, "CONSUMIDOR FINAL", "9999999", 1, "", dt,Convert.ToDouble (lblPrecioTotal.Text )); } // crystalReportViewer1.ReportSource = ventasTicket1; this.Close(); } else { UtilityFrm.mensajeError("Error en la base de Datos 1"); } } else { UtilityFrm.mensajeError("Error en la base de Datos 2"); } } catch (Exception ex) { UtilityFrm.mensajeError(ex.Message); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string respuesta = ""; //si el string es nulo o vacio if (String.IsNullOrEmpty(txtRazonSocial.Text)) { UtilityFrm.mensajeError("El Campo Nombre está incompleto"); errorIcono.SetError(txtRazonSocial, "Ingrese un nombre o Razon Social"); } else { if (isNuevo == true) { if (txtTelefono.Text.Length == 0) { txtTelefono.Text = "0"; } if (txtCuit.Text.Length == 0) { txtCuit.Text = "0"; } if (txtDocumento.Text.Length == 0) { txtDocumento.Text = "0"; } respuesta = NegocioProveedor.insertar(txtRazonSocial.Text.Trim(), txtDireccion.Text.Trim(), Convert.ToInt64(txtCuit.Text.Trim()), Convert.ToInt64(txtTelefono.Text.Trim()), Convert.ToInt64(txtDocumento.Text.Trim()), txtEmail.Text.Trim(), Convert.ToInt32(Cbprovincia.SelectedValue), Convert.ToInt32(CBlocalidad.SelectedValue)); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se Agregó Correctamente"); this.mostrar(); isEditar = false; isNuevo = false; //habilito el codigo para poder editar btnCancelar.Enabled = false; btnGuardar.Enabled = false; btnNuevo.Enabled = true; errorIcono.Clear(); this.txtCodigo.Enabled = false; this.txtCuit.Enabled = false; this.txtDireccion.Enabled = false; this.txtDocumento.Enabled = false; this.txtEmail.Enabled = false; this.txtRazonSocial.Enabled = false; this.txtTelefono.Enabled = false; UtilityFrm.limpiarTextbox(txtDireccion, txtRazonSocial, txtNombre, txtCodigo, txtCuit, txtDocumento); UtilityFrm.limpiarTextbox(txtTelefono, txtEmail); this.btnNuevo.Focus(); } else { UtilityFrm.mensajeError("No se ha podido guardar: " + respuesta); } } //si se va a editar else if (isEditar == true) { respuesta = NegocioProveedor.editar(Convert.ToInt32(txtCodigo.Text.Trim()), txtRazonSocial.Text.Trim(), txtDireccion.Text.Trim(), Convert.ToInt64(txtCuit.Text.Trim()), Convert.ToInt64(txtTelefono.Text.Trim()), Convert.ToInt64(txtDocumento.Text.Trim()), txtEmail.Text.Trim(), Convert.ToInt32(Cbprovincia.SelectedValue), Convert.ToInt32(CBlocalidad.SelectedValue)); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se Editó Correctamente"); this.mostrar(); isEditar = false; isNuevo = false; //habilito el codigo para poder editar btnCancelar.Enabled = false; btnGuardar.Enabled = false; btnNuevo.Enabled = true; errorIcono.Clear(); this.txtCodigo.Enabled = false; this.txtCuit.Enabled = false; this.txtDireccion.Enabled = false; this.txtDocumento.Enabled = false; this.txtEmail.Enabled = false; this.txtRazonSocial.Enabled = false; this.txtTelefono.Enabled = false; UtilityFrm.limpiarTextbox(txtDireccion, txtRazonSocial, txtNombre, txtCodigo, txtCuit, txtDocumento); UtilityFrm.limpiarTextbox(txtTelefono, txtEmail); this.btnNuevo.Focus(); } else { UtilityFrm.mensajeError("No se ha podido guardar: " + respuesta); } } else { UtilityFrm.mensajeError("No se ha podido guardar: " + respuesta); } } } catch (Exception ex) { UtilityFrm.mensajeError("error : ingrese solo numeros" + ex.Message + " ;" + ex.StackTrace); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { desactivarControles(); btnEditar.Enabled = true; btnGuardar.Enabled = false; btnCancelar.Enabled = false; MemoryStream ms = new MemoryStream(); long cuit = txtCuit.Text == string.Empty ? 0 : Convert.ToInt64(txtCuit.Text); string respuesta; if (datos == true) { if (pbxLogo.Image != null) { pbxLogo.Image.Save(ms, ImageFormat.Jpeg); respuesta = NegocioConfigEmpresa.modificar(txtRazonSocial.Text, cbxCondicionFrenteIVA.SelectedItem.ToString(), cuit, ms.GetBuffer()); } else { respuesta = NegocioConfigEmpresa.modificar(txtRazonSocial.Text, "", cuit, null); } if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se Agregó Correctamente"); datos = true; } else { UtilityFrm.mensajeError(respuesta); } } else { if (pbxLogo.Image != null) { pbxLogo.Image.Save(ms, ImageFormat.Jpeg); respuesta = NegocioConfigEmpresa.agregar(txtRazonSocial.Text, cbxCondicionFrenteIVA.SelectedItem.ToString(), cuit, ms.GetBuffer()); } else { respuesta = NegocioConfigEmpresa.agregar(txtRazonSocial.Text, "", cuit, null); } if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se Agregó Correctamente"); datos = true; } else { UtilityFrm.mensajeError(respuesta); } } } catch (Exception ex) { UtilityFrm.mensajeError("Error:" + ex.Message); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string respuesta = ""; //si el string es nulo o vacio if (String.IsNullOrEmpty(txtRazonSocial.Text)) { UtilityFrm.mensajeError("El Campo Nombre está incompleto"); errorIcono.SetError(txtRazonSocial, "Ingrese un nombre"); } else { if (isNuevo == true) { //variables locales para almacenar los datos vacios int telefono = 0; int cuit = 0; int documento = 0; if (txtTelefono.Text == string.Empty) { txtTelefono.Text = telefono.ToString(); } if (txtCuit.Text == string.Empty) { txtCuit.Text = cuit.ToString(); } if (txtDocumento.Text == string.Empty) { txtDocumento.Text = documento.ToString(); } respuesta = NegocioCliente.insertar(txtRazonSocial.Text.Trim(), txtDireccion.Text.Trim(), Convert.ToInt64(txtCuit.Text.Trim()), dtimeFechaNacimiento.Value, Convert.ToInt64(txtTelefono.Text.Trim()), Convert.ToInt64(txtDocumento.Text.Trim()), txtEmail.Text.Trim(), cbrespiva.SelectedValue.ToString(), Convert.ToInt32(Cbprovincia.SelectedValue), Convert.ToInt32(CBlocalidad.SelectedValue)); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se Agregó Correctamente"); this.mostrar(); } else { UtilityFrm.mensajeError("No se ha podido guardar: " + respuesta); } } //si se va a editar else if (isEditar == true) { //respuesta = NegocioArticulo.editar(Convert.ToInt32(txtCodigo.Text.Trim()), Convert.ToString(txtNombreConfig.Text.Trim()), txtCodigoBarra.Text.Trim(), Convert.ToString(txtDescripcion.Text.Trim()), Convert.ToInt32(cbxCategoria.SelectedValue)); respuesta = NegocioCliente.editar(Convert.ToInt32(txtCodigo.Text.Trim()), txtRazonSocial.Text.Trim(), txtDireccion.Text.Trim(), Convert.ToInt64(txtCuit.Text.Trim()), dtimeFechaNacimiento.Value, Convert.ToInt64(txtTelefono.Text.Trim()), Convert.ToInt64(txtDocumento.Text.Trim()), txtEmail.Text.Trim(), cbrespiva.SelectedValue.ToString(), Convert.ToInt32(Cbprovincia.SelectedValue), Convert.ToInt32(CBlocalidad.SelectedValue)); if (respuesta.Equals("ok")) { UtilityFrm.mensajeConfirm("Se Editó Correctamente"); this.mostrar(); } else { UtilityFrm.mensajeError("No se ha podido guardar: " + respuesta); } } else { UtilityFrm.mensajeError("No se ha podido guardar: " + respuesta); } //habilito el codigo para poder editar habilitarbotones(true, false, false, false); UtilityFrm.limpiarTextbox(txtCodigo, txtEmail, txtNombre, txtRazonSocial, txtTelefono); limpiarformularioctacte(); this.btnNuevo.Focus(); } } catch (Exception ex) { UtilityFrm.mensajeError("error: " + ex.Message + " ;" + ex.StackTrace); } isEditar = false; isNuevo = false; }