Example #1
0
        public void InicializarRegistroCaja()
        {
            string fechaInicio = DateTime.Today.ToString("dd-MM-yyyy") + " " + turnoxempleado.Turno.HoraInicio.Value.Hour.ToString() + ":" + turnoxempleado.Turno.HoraInicio.Value.Minute.ToString() + ":00";
            string fechaFIn = DateTime.Today.ToString("dd-MM-yyyy") + " " + turnoxempleado.Turno.HoraFin.Value.Hour.ToString() + ":" + turnoxempleado.Turno.HoraFin.Value.Minute.ToString() + ":00";
            float montoVendido = 0;
            float montoDevuelto = 0;

            IList<Documento> listaDocumentos = new DocumentoBL().findDocumentoActivosXTurno(caja, fechaInicio, fechaFIn,"Activo");
            foreach (Documento documento in listaDocumentos)
            {
                montoVendido += documento.Total;
            }
            IList<Documento> listaDocumentoInactivos = new DocumentoBL().findDocumentoActivosXTurno(caja, fechaInicio, fechaFIn, "Inactivo");
            foreach (Documento documento in listaDocumentoInactivos)
            {
               Iesi.Collections.Generic.ISet<NotaCredito> listaNotaCredito =  documento.DocumentoNotaCreditofk;
               foreach (NotaCredito notaCredito in listaNotaCredito)
               {
                   montoDevuelto += notaCredito.MontoDevolucion;
               }
            }
            registroCaja.MontoVentas = montoVendido;
            registroCaja.MontoDevoluciones = montoDevuelto;
        }
Example #2
0
        //,NotaCredito nota,IList<DocumentoLinea> docLineas)
        public NotaCreditoDatos exportarDocumento(String nroDoc)
        {
            string cliente, nroDocumento,tipoDocumento,mensaje;
            float descuentoUnit, precioVenta, totalLinea,total=0,igv=0,totalDescuentos=0,subtotal=0;

            NotaCreditoDatos dsNotaCredito = new NotaCreditoDatos();
            DocumentoNotaCredito documentoNotaCred = new DocumentoNotaCredito();

            Documento doc = new DocumentoBL().findByIdDocumento(nroDoc);

            if (doc.Cliente == null) { cliente = ""; nroDocumento = ""; }
            else { cliente = doc.Cliente.Nombre; nroDocumento =doc.Cliente.NroDocumento; }

            mensaje = "*Las devoluciones se realizaran dentro de los 7 días siguientes a la venta";

            if (doc.TipoDocumento == "Boleta") tipoDocumento = "BOLETA";
            else
                if (doc.TipoDocumento == "Factura") tipoDocumento = "FACTURA";
                else
                {
                    tipoDocumento = "NOTA DE CREDITO";
                    mensaje = "";
                }

            dsNotaCredito.NotaCredito.AddNotaCreditoRow(doc.NroDocumentoVenta.ToString(), cliente, ((DateTime)doc.FechaEmision).ToShortDateString(),nroDocumento.ToString(),doc.Total.ToString("0.00"), doc.Caja.Local.Telefono, doc.Caja.Local.Direccion, doc.Caja.Local.Nombre,tipoDocumento,"0","0",mensaje,doc.Subtotal.ToString("0.00"));

            foreach (DocumentoLinea linea in doc.DocumentoDocumentoLineafk)
            {

                if (linea.Pack == null)
                {
                    descuentoUnit = 0;

                    precioVenta = (float)linea.PrecioLinea / (float)linea.Cantidad;

                    if (linea.DescuentoXArticulo != null) //si es un articulo con descuento
                    {
                        descuentoUnit = linea.DescuentoXArticulo.PorcentajeDescuento * precioVenta / 100;
                    }

                    totalLinea = (float)(precioVenta * linea.Cantidad * linea.Impuesto - descuentoUnit * linea.Cantidad);//(float)((precioVenta - descuentoUnit) * linea.Impuesto * linea.Cantidad);//(float)(linea.PrecioLinea + linea.Impuesto - descuentoUnit*linea.Cantidad);

                    total = total + totalLinea;
                    subtotal = subtotal + linea.PrecioLinea;
                    if (linea.Impuesto!=0)  igv = (float)(igv + precioVenta * linea.Cantidad * (linea.Impuesto - 1));

                    totalDescuentos=(float)(totalDescuentos+descuentoUnit*linea.Cantidad);

                    dsNotaCredito.NotaCreditoLinea.AddNotaCreditoLineaRow(linea.Cantidad.ToString(), linea.ArticuloXLocal.Articulo.Titulo,((float)(precioVenta * linea.Cantidad)).ToString("0.00"), (NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0], (linea.ArticuloXLocal.Articulo.IndIGV == "S" ? 19 : 0).ToString(), descuentoUnit.ToString("0.00"), linea.ArticuloXLocal.Articulo.PrecioVenta.ToString("0.00"));
                }

                else
                {
                    dsNotaCredito.NotaCreditoLinea.AddNotaCreditoLineaRow(linea.Cantidad.ToString(), linea.Pack.Nombre, linea.PrecioLinea.ToString("0.00"), (NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0],"0.00","0.00", linea.Pack.PrecioPack.ToString());
                    total = total + linea.PrecioLinea;
                    subtotal = subtotal + linea.PrecioLinea;
                }
            }

                ((NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0]).TotalIGV = igv.ToString("0.00");
                ((NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0]).Subtotal= subtotal.ToString("0.00");
                ((NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0]).TotalDescuentos=((float)(-1)*(total-subtotal-igv)).ToString("0.00");

            return dsNotaCredito;
        }
Example #3
0
        //,NotaCredito nota,IList<DocumentoLinea> docLineas)
        public NotaCreditoDatos exportarDocumento(String nroDoc)
        {
            string cliente, nroDocumento,tipoDocumento,mensaje;
            float descuentoUnit, precioVenta, totalLinea,total=0;

            NotaCreditoDatos dsNotaCredito = new NotaCreditoDatos();
            DocumentoNotaCredito documentoNotaCred = new DocumentoNotaCredito();

            Documento doc = new DocumentoBL().findByIdDocumento(nroDoc);

            if (doc.Cliente == null) { cliente = ""; nroDocumento = ""; }
            else { cliente = doc.Cliente.Nombre; nroDocumento =doc.Cliente.NroDocumento; }

            mensaje = "*Si desea realizar una devolucion de alguno de los productos, ésta se deberá realizar dentro de los 7 días hábiles despues de la compra";

            if (doc.TipoDocumento == "Boleta") tipoDocumento = "BOLETA";
            else
                if (doc.TipoDocumento == "Factura") tipoDocumento = "FACTURA";
                else
                {
                    tipoDocumento = "NOTA DE CREDITO";
                    mensaje = "";
                }

            dsNotaCredito.NotaCredito.AddNotaCreditoRow(doc.NroDocumentoVenta.ToString(), cliente, ((DateTime)doc.FechaEmision).ToShortDateString(), nroDocumento.ToString(), doc.Total.ToString("0.00"), doc.Caja.Local.Telefono, doc.Caja.Local.Direccion, doc.Caja.Local.Nombre,tipoDocumento,mensaje);

            foreach (DocumentoLinea linea in doc.DocumentoDocumentoLineafk)
            {

                if (linea.Pack == null)
                {

                    descuentoUnit = 0;
                    precioVenta = (float)linea.PrecioLinea / (float)linea.Cantidad;

                    if (linea.DescuentoXArticulo != null) //si es un articulo con descuento
                    {
                        descuentoUnit = linea.DescuentoXArticulo.PorcentajeDescuento * precioVenta / 100;
                    }

                    totalLinea = (float)((precioVenta - descuentoUnit) * linea.Impuesto * linea.Cantidad);

                    total = total + totalLinea;

                    dsNotaCredito.NotaCreditoLinea.AddNotaCreditoLineaRow(linea.Cantidad.ToString(), linea.ArticuloXLocal.Articulo.Titulo, totalLinea.ToString("0.00"), (NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0], (linea.ArticuloXLocal.Articulo.IndIGV == "S" ? 19 : 0).ToString(), descuentoUnit.ToString("0.00"), linea.ArticuloXLocal.Articulo.PrecioVenta.ToString("0.00"));

                }

                else
                {
                    dsNotaCredito.NotaCreditoLinea.AddNotaCreditoLineaRow(linea.Cantidad.ToString(), linea.Pack.Nombre, linea.PrecioLinea.ToString("0.00"), (NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0], 0 + "", 0 + "", linea.Pack.PrecioPack.ToString());

                    total = total + linea.PrecioLinea;
                }
            }

            if (doc.TipoDocumento == "NotaCredito")
            {

                ((NotaCreditoDatos.NotaCreditoRow)dsNotaCredito.NotaCredito.Rows[0]).SaldoFavor = total.ToString("0.00");
            }

            return dsNotaCredito;
        }
Example #4
0
        private void txtNumeroMedio_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (cboMedioPago.SelectedItem == "Nota de Credito")
                {
                    Documento doc = new DocumentoBL().findByIdDocumento(txtNumeroMedio.Text.ToString().Trim());

                    if (doc != null)
                    {
                        if (doc.TipoDocumento == "NotaCredito")
                        {
                            txtMonto.Text = doc.Total.ToString();
                        }
                        else
                        {
                            txtMonto.Text = "";
                            Utils.Utils.Error(null, "El numero de documento no pertenece a una nota de credito");

                        }

                    }
                    else
                    {
                        txtMonto.Text = "";
                        Utils.Utils.Error(null, "La nota de credito no existe");
                    }
                }

            }
        }