private void Frmimpventicket_Load(object sender, EventArgs e) { // ReportDocument reportprint = new ReportDocument(); //PrinterSettings ps = new PrinterSettings (); //ps.PrinterName = "Generic / Text Only (Copiar 2)"; //Boolean impresoravalida = ps.IsValid; //PageSettings pg = new PageSettings (); // ps.Copies = 1; // VentasTicket1.Load (Application.StartupPath.Replace("D:\\PROYECTO SOFTINTEGRAL\\Sistema de ventas (Ultimo)\\Sistema de ventas\\Capa_Presentacion\\Reportes","VentasTicket.rpt")); // reportprint.SetDataSource ( VentasTicket1); //reportprint.PrintToPrinter(ps, pg, false); try { // VentasTicket1.SetParameterValue("@idventa", codventa); if ("directo" == NegocioConfigEmpresa.confsistema("modoimpventa")) { // PrintDocument imprimirdirecto = new PrintDocument(); // VentasTicket1.PrintOptions.PrinterName = NegocioConfigEmpresa.impticket != "" ? NegocioConfigEmpresa.impticket : UtilityFrm.GetImpresoraDefecto(); //VentasTicket1.PrintToPrinter(1, false, 0, 0); this.Close(); } else if (NegocioConfigEmpresa.confsistema("modoimpventa") == "vista") { // crystalReportViewer1.ReportSource = VentasTicket1; } } catch (Exception ex) { UtilityFrm.mensajeError(ex.Message); } }
private void txtContraseña_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; NegocioUsuario objusuario = new NegocioUsuario(); FrmInicio objini = new FrmInicio(); try { if (e.KeyCode == Keys.Enter) { if (objusuario.login(txtUsuario.Text, txtContraseña.Text) == true) { // NegocioConfigEmpresa.inivarglobal (System.Environment.MachineName,txtUsuario.Text,"mañana",); // VERIFICA QUE EL EQUIPO ESTE DADO DE ALTA SI LO ESTA ACTUALIZA EL USUARIO SINO AGREGA EL EQUIPO string msg = NegocioConfigEmpresa.mostrarequipo(System.Environment.MachineName); NegocioConfigEmpresa.mostrar(); NegocioConfigEmpresa.nombreusuario = objusuario.Nombreusuario; NegocioConfigEmpresa.usuariosa = objusuario.Usuariosa; NegocioConfigEmpresa.ReglasUsuario = objusuario.Reglaprivilegio.ToString().Split(','); if (msg == "ok") { msg = NegocioConfigEmpresa.actualizarequipo(objusuario.Usuario, UtilityFrm.turnosegunhora(), objusuario.Idusuario, DateTime.Now, NegocioConfigEmpresa.idequipo); msg = NegocioConfigEmpresa.mostrarequipo(System.Environment.MachineName); if (msg == "ok") { this.Hide(); objini.Show(); } else { MessageBox.Show(msg); } } else { MessageBox.Show(msg); NegocioConfigEmpresa.confequipo(System.Environment.MachineName, txtUsuario.Text, UtilityFrm.turnosegunhora(), objusuario.Idusuario, 1, DateTime.Now, "", "", 1, 1, 1, ""); } } else { MessageBox.Show("El usuario o contraseña es incorrecta"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } btnIngresar.Focus(); } }
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 menureimpresion_Click(object sender, EventArgs e) { DataGridViewRow row = dataLista.CurrentRow; Reporteventa miformnotaventa = new Reporteventa(); //Reporteventa mireporteventa = new Reporteventa(); // Frmimpnotaventa mireporteventa = new Frmimpnotaventa(); // Frmimpventicket miformticket = new Frmimpventicket(); if (NegocioConfigEmpresa.confsistema("imprimirventa").ToString() == "True") { if (NegocioConfigEmpresa.confsistema("tipoimpresion").ToString() == "tipocarro") { //miformnotaventa.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa")); miformnotaventa.Idventa = Convert.ToInt32(row.Cells["codigo"].Value.ToString()); miformnotaventa.ShowDialog(); //mireporteventa.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa")); //mireporteventa.Codventa = Convert.ToInt32(row.Cells["codigo"].Value.ToString()); //mireporteventa.Show(); } else { // Ticketventa miticket = new Ticketventa(Convert.ToInt32(row.Cells["codigo"].Value.ToString())); //miticket.ShowDialog(); Ticketventa miticket = new Formreportes.Ticketventa(Convert.ToInt32(row.Cells["codigo"].Value.ToString())); if (NegocioConfigEmpresa.marcafiscal == "elec" && row.Cells["Letra"].Value.ToString() != "X") { miticket = new Formreportes.Ticketventa(Convert.ToInt32(row.Cells["codigo"].Value.ToString())); miticket.ShowDialog(); } else if (row.Cells["Letra"].Value.ToString() == "X") { TicketProforma miticketproforma = new Formreportes.TicketProforma(Convert.ToInt32(row.Cells["codigo"].Value.ToString())); miticketproforma.ShowDialog(); } // reportName is the Assembly Qualified Name of the report // miformticket.Tipoimp = Convert.ToString(NegocioConfigEmpresa.confsistema("modoimpventa")); // miformticket.Codventa = Convert.ToInt32(row.Cells["codigo"].Value.ToString()); // miformticket.Show(); } } }
private void menuconfventa_Click(object sender, EventArgs e) { string mensaje = ""; bool constock = false; try { Negociocaja objcaja = new Negociocaja(); DataGridViewRow row = dataLista.CurrentRow; if (Convert.ToBoolean(row.Cells["caja"].Value) == false) { if (objcaja.chequeocaja(this.Name, ref mensaje) == true) { Negociocaja.insertarmovcaja(4110107, Convert.ToSingle(row.Cells["Total"].Value.ToString()), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Venta nro : " + row.Cells["codigo"].Value.ToString(), Convert.ToInt64(row.Cells["codigo"].Value.ToString()), true); if (NegocioConfigEmpresa.confsistema("stock").ToString() == this.Name) { DataTable ventas = cargardetallestock(row.Cells["codigo"].Value.ToString()); mensaje = NegocioMovStock.insertar(0, DateTime.Today, "", row.Cells["codigo"].Value.ToString(), "VENTA", 0, "EMITIDO", "EGRESO", ventas); if (mensaje != "ok") { constock = false; UtilityFrm.mensajeError(mensaje); } else { constock = true; } } NegocioVenta.cambiarestadoventa(Convert.ToInt32(row.Cells["codigo"].Value.ToString()), true, constock); } else { UtilityFrm.mensajeError(mensaje); } } } catch (Exception i) { UtilityFrm.mensajeError(i.Message); } buscarPorFecha(); actualizarTotal(); }
private void mostrarDatos() { try { DataTable dt = NegocioConfigEmpresa.mostrar(); if (dt.Rows.Count == 1) { //si hay datos el boolean datos se pone a true datos = true; foreach (DataRow item in dt.Rows) { txtRazonSocial.Text = item["razon_social"].ToString(); txtCuit.Text = item["cuit"].ToString(); cbxCondicionFrenteIVA.Text = item["condicion_frente_iva"].ToString(); string imagen1 = item["logo"].ToString(); if (item["path_backup"].ToString() != null || item["path_backup"].ToString() != "") { txtRuta.Text = item["path_backup"].ToString(); sincronizarBackup(txtRuta.Text); } if (item["logo"].ToString() != "" && item["logo"].ToString() != "null") { byte[] imagen = (byte[])(item["logo"]); MemoryStream ms = new MemoryStream(imagen); pbxLogo.Image = Image.FromStream(ms); } } } else { UtilityFrm.mensajeError("No existen Datos de la Empresa Cargados"); this.activarControles(); } } catch (Exception ex) { UtilityFrm.mensajeError("Error: " + ex.Message + " " + ex.StackTrace); } }
private void Frmimpnotaventa_Load(object sender, EventArgs e) { try { VentasReducida1.SetParameterValue("@idventa", codventa); if ("directo" == NegocioConfigEmpresa.confsistema("modoimpventa").ToString()) { VentasReducida1.PrintOptions.PrinterName = NegocioConfigEmpresa.impticket != "" ? NegocioConfigEmpresa.impticket : UtilityFrm.GetImpresoraDefecto(); VentasReducida1.PrintToPrinter(1, false, 0, 0); this.Close(); } else if (NegocioConfigEmpresa.confsistema("modoimpventa") == "vista") { crystalReportViewer1.ReportSource = VentasReducida1; } } catch (Exception ex) { UtilityFrm.mensajeError(ex.Message); } }
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); } }
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); } }