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); } }
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 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); } }
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); } }