public void mostrarRanking5Producto()
        {
            try
            {
                DataTable dt = NegocioVenta.MostrarRanking5Productos();
                if (dt.Rows.Count > 0)
                {
                    chartRankingVentas.Series["Ventas"].Points.Clear();

                    foreach (DataRow row in dt.Rows)
                    {
                        chartRankingVentas.Series["Ventas"].Points.AddXY(row["nombre"], row["cantidad"]);
                    }


                    //ejemplo: chartRankingVentas.Series["Ventas"].Points.AddXY("Producto2", 50);
                    //chartRankingVentas.Series["Ventas"].Points.AddXY("Producto3", 20);
                    //chartRankingVentas.Series["Ventas"].Points.AddXY("Producto4", 70);
                    //chartRankingVentas.Series["Ventas"].Points.AddXY("Producto5", 1000);
                    chartRankingVentas.Visible = true;
                }
                else
                {
                    UtilityFrm.mensajeError("No existen ventas en este momento");
                    chartRankingVentas.Visible = true;
                }
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("Error: " + ex.Message);
            }
        }
        /*Metodos propios*/
        public void buscarPorFecha()
        {
            dataLista.Rows.Clear();
            try
            {
                DataTable dt = NegocioVenta.BuscarFechas(dtpFechaIni.Value.ToString("dd/MM/yyyy") + " 00:00:00", dtpFechaFin.Value.ToString("dd/MM/yyyy") + " 23:59:59", ChkFactura.Checked == true ? 'P' : 'F', Chkcaja.Checked == true ? false : true, rdBPresupuesto.Checked == true ? "PRESUPUESTO" : "NOTA DE VENTA");
                foreach (DataRow venta in dt.Rows)
                {
                    string estado = venta["estado"].ToString();

                    if (estado.Equals("F"))
                    {
                        estado = "FACTURADO";
                    }
                    else if (estado.Equals("P"))
                    {
                        estado = "PENDIENTE";
                    }
                    else if (estado.Equals("N"))
                    {
                        estado = "NOTA DE CREDITO";
                    }
                    else
                    {
                        estado = "PRESUPUESTADO";
                    }
                    dataLista.Rows.Add(venta["idventa"], venta["razon_social"], venta["fecha"], venta["tipo_comprobante"], venta["total"], estado, venta ["caja"], venta ["idcliente"], venta ["cuit"], venta["Nrocomprobante"], venta["factura"], venta["Neto21"], venta["Totaliva21"], venta["Total_Neto105"], venta["Totaliva105"], venta["CAE"], venta["CAE_Fechavencimiento"]);
                }
            }

            catch (Exception ex)
            {
                UtilityFrm.mensajeError("Error Con Base de Datos :" + ex.Message);
            }
        }
        private void CRVVenta_Load(object sender, EventArgs e)
        {
            try
            {
                //SqlDataAdapter adaptador = new SqlDataAdapter() ;

                //dt = new DataTable();

                //dt.Columns.Add("nombre", typeof(String));
                //dt.Columns.Add("cantidad", typeof(Int32));
                //dt.Columns.Add("precio", typeof(decimal));

                //dt.Columns.Add("idventa", typeof(Int32));
                //dt.Columns.Add("idcliente", typeof(Int32));
                //dt.Columns.Add("tipo_comprobante", typeof(String));
                //dt.Columns.Add("serie", typeof(Int32));
                //dt.Columns.Add("correlativo", typeof(Int32));
                //dt.TableName = "venta";


                //   dt.Rows.Add( 12,1,"ticket",1234,23);
                //devuelve la ultima venta realizada
                dt = NegocioVenta.NotaDeVenta();
                // String hola=dt.Columns[1].ToString();

                NotaDeVenta1.SetDataSource(dt);
                NotaDeVenta1.SetParameterValue("total", totalAPagar);
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("error " + ex.Message);
            }
        }
Beispiel #4
0
        private void Buscar()
        {
            DateTime desde = new DateTime(dtpDesde.Value.Year, dtpDesde.Value.Month, dtpDesde.Value.Day, 00, 00, 00);
            DateTime hasta = new DateTime(dtpHasta.Value.Year, dtpHasta.Value.Month, dtpHasta.Value.Day, 23, 59, 59);

            /*dgvListado.DataSource = NegocioVenta.Buscar(dtpDesde.Value, dtpHasta.Value);*/ //(dtpDesde.Value.ToString("dd/MM/yyyy"), dtpHasta.Value.ToString("dd/MM/yyyy"));
            dgvListado.DataSource = NegocioVenta.Buscar(desde, hasta);
        }
        public void listar()
        {
            NegocioVenta auxNegocioVenta = new NegocioVenta();

            this.dgListar.DataSource = auxNegocioVenta.listarFilas();
            //tabla de la que recoge los datos
            this.dgListar.DataMember = "venta";
            this.txtTotal.Text       = auxNegocioVenta.totalVentas();
        }
Beispiel #6
0
        private void btnComprar_Click(object sender, EventArgs e)
        {
            bool exito = false;

            if (this.txtCliente.Text == String.Empty)
            {
                MessageBox.Show("Falta el cliente");
                return;
            }
            else if (this.txtCodProducto.Text == String.Empty)
            {
                MessageBox.Show("Falta ingresar un producto");
                return;
            }
            else if (this.txtCantidad.Text == String.Empty)
            {
                MessageBox.Show("Indica la cantidad a comprar");
                return;
            }
            else
            {
                try
                {
                    Producto auxProductoVENTA = new Producto
                    {
                        Codigo = this.txtCodProducto.Text,
                        Stock  = int.Parse(this.txtStock.Text) - int.Parse(this.txtCantidad.Text)
                    };
                    Venta auxVenta = new Venta
                    {
                        Cliente      = this.txtCliente.Text,
                        Cod_producto = this.txtCodProducto.Text,
                        Cantidad     = int.Parse(this.txtCantidad.Text),
                        Neto         = int.Parse(this.txtTotalNeto.Text)
                    };
                    NegocioVenta auxNegocioVenta = new NegocioVenta();

                    auxNegocio.RestaStock(auxProductoVENTA);
                    auxNegocioVenta.Insert(auxVenta);

                    exito = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error" + ex, "Error");
                }
                if (exito)
                {
                    MessageBox.Show("Producto vendido");
                    cleanPantalla();
                }
            }
        }
Beispiel #7
0
 private void CalcularVentas()
 {
     try
     {
         DataTable dtTotalVentas = new DataTable("TotalVentas");
         dtTotalVentas = NegocioVenta.CalcularVentas(FechaHoraApertura, FechaHoraCierre);
         DataRow row = dtTotalVentas.Rows[0];
         MontoFinalSistema         = Convert.ToDecimal(row[0]);
         txtMontoFinalSistema.Text = MontoFinalSistema.ToString("$#0.#0", CultureInfo.InvariantCulture);
     }
     catch { }
 }
Beispiel #8
0
        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);
            }
        }
Beispiel #9
0
        public DataTable detalleventa(string responsableiva)
        {
            string    precioneto  = "";
            decimal   var         = 0;
            DataTable datacliente = new DataTable();



            DataTable dt = new DataTable();

            dt.Columns.Add("Codigo", typeof(string));
            dt.Columns.Add("Precio", typeof(decimal));
            dt.Columns.Add("Cantidad", typeof(decimal));
            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));
            NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;



            DataTable ventas = NegocioVenta.MostrarDetalle(txtCodigo.Text);

            foreach (DataRow venta in ventas.Rows)
            {
                if (responsableiva != "EX")
                {
                    var = Decimal.Round(Convert.ToDecimal(venta["precio"]) / Convert.ToDecimal(1.21), 4);
                }
                else
                {
                    var = Decimal.Round(Convert.ToDecimal(venta["precio"]));
                }

                //Math.Round(decValue, 2, MidpointRounding.AwayFromZero)
                // var = Math.Round(var, 2, MidpointRounding.AwayFromZero);

                precioneto = var.ToString("0.0000", 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["Precio"].Value, fila.Cells["Cantidad"].Value, fila.Cells["Descuento"].Value, fila.Cells["Importe"].Value, fila.Cells["Producto"].Value, precioneto);


                //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                dt.Rows.Add(venta["idarticulo"], venta["precio"], venta["cantidad"], venta["descuento"], venta["importe"], venta["articulo"], precioneto, venta["Pesable"]);
                //
            }
            return(dt);
        }
        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();
        }
        public void imprimir()
        {
            DataTable midatatable = new DataTable();
            REPORT_TICKET_PROFORMA miticket;

            try
            {
                switch (NegocioConfigEmpresa.formatoimpproforma)
                {
                case "TICKET80":
                {
                    midatatable         = NegocioVenta.Reporteventa(idventa);
                    miticket            = new Reportes.REPORT_TICKET_PROFORMA();
                    miticket.DataSource = midatatable;

                    miticket.table1.DataSource = midatatable;
                    reportViewer1.Report       = miticket;

                    reportViewer1.RefreshReport();
                    break;
                }

                case "A4":
                {
                    break;
                }

                case "TICKET56":
                {
                    break;
                }

                default:
                    break;
                }



                // reportViewer1.PrintReport();

                // miticket
            }
            catch (Exception)
            {
                throw;
            }
        }
        private DataTable cargardetallestock(string codigoventa)
        {
            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));



            DataTable ventas = NegocioVenta.MostrarDetalle(codigoventa);

            foreach (DataRow venta in ventas.Rows)
            {
                //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                dt.Rows.Add(venta["idarticulo"], venta["precio"], venta["importe"], venta["cantidad"]);
                //
            }
            return(dt);
        }
        private void dataLista_MouseClick(object sender, MouseEventArgs e)
        {
            DataGridViewRow row = dataLista.CurrentRow;

            if (e.Button == MouseButtons.Right)
            {
                if (Convert.ToBoolean(row.Cells["caja"].Value) == false && Convert.ToString(row.Cells["Tipo_comprobante"].Value) != "PRESUPUESTO")
                {
                    menuconfventa.Visible = true;
                }
                else
                {
                    menuconfventa.Visible = false;
                }

                contextMenuStrip1.Show(dataLista, new Point(e.X, e.Y));
            }

            if (e.Button == MouseButtons.Left)
            {
                DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
            }
        }
Beispiel #14
0
        public void mostrar()
        {
            try
            {
                dataLista.Rows.Clear();
                DataTable ventas = NegocioVenta.MostrarDetalle(txtCodigo.Text);
                foreach (DataRow venta in ventas.Rows)
                {
                    //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                    //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                    dataLista.Rows.Add(venta["idarticulo"], venta["articulo"], venta["precio"], venta["descuento"], venta["cantidad"], venta["importe"]);
                    //
                }

                //this.dataLista.Columns["precio"].DefaultCellStyle.Format = "c3";
                //this.dataLista.Columns["precio"].ValueType = Type.GetType("System.Decimal");
                //this.dataLista.Columns["precio"].DefaultCellStyle.Format = String.Format("###,##0.00");
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("error con la Base de datos: " + ex.Message);
            }
            //datasource el origen de los datos,muestra las categorias en la grilla
        }
        public void mostrar()
        {
            try
            {
                dataLista.Rows.Clear();
                DataTable ventas = NegocioVenta.Mostrar();
                foreach (DataRow venta in ventas.Rows)
                {
                    string estado = venta["estado"].ToString();

                    if (estado.Equals("F"))
                    {
                        estado = "FACTURADO";
                    }
                    else if (estado.Equals("P"))
                    {
                        estado = "PENDIENTE";
                    }


                    //string tipo_comprobante = venta["tipo_comprobante"].ToString();
                    //tipo_comprobante = tipo_comprobante == "V" ? "VENTA" : "";
                    dataLista.Rows.Add(venta["idventa"], venta["razon_social"], venta["fecha"], venta["tipo_comprobante"], venta["total"], estado, venta["Factura"]);
                    //
                }

                //this.dataLista.Columns["precio"].DefaultCellStyle.Format = "c3";
                //this.dataLista.Columns["precio"].ValueType = Type.GetType("System.Decimal");
                //this.dataLista.Columns["precio"].DefaultCellStyle.Format = String.Format("###,##0.00");
            }
            catch (Exception ex)
            {
                UtilityFrm.mensajeError("error con la Base de datos: " + ex.Message);
            }
            //datasource el origen de los datos,muestra las categorias en la grilla
        }
        private void dataLista_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
            {
                DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
            }

            if (e.KeyCode == Keys.Enter)
            {
                if (dataLista.Rows.Count > 0)
                {
                    DateTime date = Convert.ToDateTime(this.dataLista.CurrentRow.Cells["fecha"].Value);

                    FrmDetalleVentas venta = new FrmDetalleVentas(Convert.ToString(this.dataLista.CurrentRow.Cells["codigo"].Value),
                                                                  Convert.ToString(this.dataLista.CurrentRow.Cells["razon_social"].Value),
                                                                  date.ToShortDateString(),
                                                                  Convert.ToString(this.dataLista.CurrentRow.Cells["tipo_comprobante"].Value),
                                                                  Convert.ToString(this.dataLista.CurrentRow.Cells["estado"].Value),
                                                                  Convert.ToString(Decimal.Round(Convert.ToDecimal(this.dataLista.CurrentRow.Cells["total"].Value), 2))
                                                                  , Convert.ToString(this.dataLista.CurrentRow.Cells["idcliente"].Value), Convert.ToString(this.dataLista.CurrentRow.Cells["cuit"].Value));
                    venta.ShowDialog();
                }
            }
        }
Beispiel #17
0
 private void Mostrar()
 {
     dgvListado.DataSource = NegocioVenta.Mostrar();
 }
 private void dataLista_SelectionChanged(object sender, EventArgs e)
 {
     DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
 }
 private void dataLista_RowLeave(object sender, DataGridViewCellEventArgs e)
 {
     DTDetalleventa.DataSource = NegocioVenta.MostrarDetalle(dataLista.CurrentRow.Cells["Codigo"].Value.ToString());
 }
Beispiel #20
0
        public void imprimir()
        {
            DataTable        midatatable = new DataTable();
            REPORT_TICKET    miticket;
            REPORT_TICKETX58 miticket1;
            REPORT_VENTA_A4  miticket2;

            midatatable = NegocioVenta.Reporteventa(idventa);

            if (midatatable.Rows.Count != 0)
            {
                DataRow row = midatatable.Rows[0];
                //valorcodigobarra = UtilityFrm.calculoDigitoVerificador("012","34","5","678","90");
                valorcodigobarra = UtilityFrm.calculoDigitoVerificador(row["cuit"].ToString(), row["tipofactura"].ToString(), row["puntoventa"].ToString(), row["CAE"].ToString(), row["CAE_fechavencimiento"].ToString());
            }


            try
            {
                switch (NegocioConfigEmpresa.formatoimpfactelectronica)
                {
                case "TICKET80":
                {
                    miticket            = new Reportes.REPORT_TICKET();
                    miticket.DataSource = midatatable;

                    miticket.table1.DataSource = midatatable;
                    reportViewer1.Report       = miticket;
                    miticket.barcode1.Value    = valorcodigobarra;
                    reportViewer1.RefreshReport();
                    break;
                }

                case "TICKET56":
                {
                    miticket1                   = new REPORT_TICKETX58();
                    miticket1.DataSource        = midatatable;
                    reportViewer1.Report        = miticket1;
                    miticket1.table1.DataSource = midatatable;
                    miticket1.barcode1.Value    = valorcodigobarra;
                    reportViewer1.RefreshReport();
                    break;
                }

                case "A4":
                {
                    miticket2                   = new REPORT_VENTA_A4();
                    miticket2.DataSource        = midatatable;
                    reportViewer1.Report        = miticket2;
                    miticket2.table1.DataSource = midatatable;
                    miticket2.barcode1.Value    = valorcodigobarra;
                    reportViewer1.RefreshReport();
                    break;
                }

                default:
                    break;
                }



                // reportViewer1.PrintReport();

                // miticket
            }
            catch (Exception)
            {
                throw;
            }
        }
        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);
            }
        }
Beispiel #22
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int          idVenta;
            string       Respuesta = "";
            DialogResult Opcion;

            try
            {
                //SELECCION DE VARIOS REGISTROS
                if (chkEliminarVarios.Checked)
                {
                    Opcion = MessageBox.Show(
                        "¿Realmente desea eliminar las ventas seleccionadas?. Tenga en cuenta que al eliminar estas ventas el stock actual de los artículos relacionados se restablecerá.",
                        "Eliminando registro. ¡Advertencia!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        foreach (DataGridViewRow row in dgvListado.Rows)
                        {
                            if (Convert.ToBoolean(row.Cells[0].Value))
                            {
                                idVenta    = Convert.ToInt32(row.Cells[1].Value);
                                dtDetalles = NegocioVenta.Mostrar(idVenta);
                                Respuesta  = NegocioVenta.Eliminar(idVenta, dtDetalles);
                                //foreach (DataRow det in dtDetalles.Rows)
                                //{
                                //    Respuesta = NegocioVenta.Eliminar(idVenta, dtDetalles);
                                //}
                            }
                        }
                        if (Respuesta.Equals("OK"))
                        {
                            NotificacionOk("Los registros se eliminaron correctamente.", "Eliminando");
                        }
                        else
                        {
                            NotificacionError("Los registros no se eliminaron.", "Error");
                        }
                        Mostrar();
                    }
                }
                else
                {
                    //SELECCION DE UN REGISTRO
                    Opcion = MessageBox.Show(
                        "¿Realmente desea eliminar la venta seleccionada?. Tenga en cuenta que al eliminar esta venta el stock actual de los artículos relacionados se restablecerá.",
                        "Eliminando registro. ¡Advertencia!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        idVenta    = Convert.ToInt32(dgvListado.CurrentRow.Cells[1].Value);
                        dtDetalles = NegocioVenta.Mostrar(idVenta);
                        Respuesta  = NegocioVenta.Eliminar(idVenta, dtDetalles);
                        //foreach (DataRow det in dtDetalles.Rows)
                        //{
                        //    Respuesta = NegocioVenta.Eliminar(idVenta, dtDetalles);
                        //}
                        if (Respuesta.Equals("OK"))
                        {
                            NotificacionOk("El registro se eliminó correctamente", "Eliminando");
                        }
                        else
                        {
                            NotificacionError("El registro no se eliminó", "Error");
                            MessageBox.Show(Respuesta);
                        }
                        Mostrar();
                    }
                }
                chkEliminarVarios.Checked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #23
0
        public void ServiceActulizarVent(Venta producto)
        {
            NegocioVenta auxn = new NegocioVenta();

            auxn.actualizarVent(producto);
        }
Beispiel #24
0
        public DataSet ServiceGetConsultaVenta()
        {
            NegocioVenta auxn = new NegocioVenta();

            return(auxn.consulta());
        }
Beispiel #25
0
        public void Serviceinsertarproducto(Venta producto)
        {
            NegocioVenta auxn = new NegocioVenta();

            auxn.insertarVenta(producto);
        }
Beispiel #26
0
        public int ServiceGetVentasSinCliente()
        {
            NegocioVenta auxn = new NegocioVenta();

            return(auxn.GetVentasSinCliente());
        }
Beispiel #27
0
        public int ServiceGetSumaTotaldeVentas()
        {
            NegocioVenta auxn = new NegocioVenta();

            return(auxn.GetSumaTotaldeVentas());
        }