Ejemplo n.º 1
0
        public frmDocumentoNotaCredito(DataSet dsNotaCredito)
        {
            InitializeComponent();

            DocumentoNotaCredito docNota = new DocumentoNotaCredito();
            docNota.SetDataSource(dsNotaCredito);

            crvNotaCredito.ReportSource = docNota;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     DocumentoNotaCredito rpt = new DocumentoNotaCredito();
     rpt.Site = this.Site;
     return rpt;
 }