Ejemplo n.º 1
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Nombre,Descripcion,Estado,FechaRegistro")] ProductosModels productosmodels, HttpPostedFileBase upload)
        {
            productosmodels.FechaRegistro = DateTime.Now;
            if (ModelState.IsValid)
            {
                if (upload != null && upload.ContentLength > 0)
                {
                    var avatar = new File
                    {
                        FileName    = System.IO.Path.GetFileName(upload.FileName),
                        FileType    = FileType.Avatar,
                        ContentType = upload.ContentType
                    };
                    using (var reader = new System.IO.BinaryReader(upload.InputStream))
                    {
                        avatar.Content = reader.ReadBytes(upload.ContentLength);
                    }
                    productosmodels.Files = new List <File> {
                        avatar
                    };
                }
                db.ProductosModels.Add(productosmodels);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(productosmodels));
        }
Ejemplo n.º 2
0
        public ActionResult Create(ProductosModels producto)
        {
            string Iduser  = null;
            string Empresa = null;

            try
            {
                string userId = System.Web.HttpContext.Current.User.Identity.Name;
                if (userId != "")
                {
                    UTNIMASEntities db = new UTNIMASEntities();
                    // TODO: Add insert logic here

                    string query = "INSERT INTO PRODUCTS(NOMBRE_PRODUCTO,ID_PRECIO,DESCRIP_PRODUCTO,FOTO_PRODUCTO,EMPRESA_ID)" +
                                   "VALUES('" + producto.NOMBRE_PRODUCTO + "', '" + producto.ID_PRECIO + "', '" + producto.DESCRIP_PRODUCTO + "','"
                                   + producto.FOTO_PRODUCTO + "', '" + producto.EMPRESA_ID + "')";
                    db.Database.ExecuteSqlCommand(query);
                }

                string Mensaje = "Registro de Producto Completo";
                return(Json(new { Success = true, Mensaje }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                string Mensaje = "Error";
                return(Json(new { Success = false, Mensaje }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 3
0
        //[NonAction]
        //public void VerificationEmail(int nvnumero)
        //{
        //    Control Acceso = new Control();
        //    var de = "";
        //    var clavecorreo = "";
        //    IEnumerable<_NotaDeVentaDetalleModels> datosUser = Acceso.DatosCorreoVend(nvnumero);
        //    foreach (_NotaDeVentaDetalleModels ot in datosUser)
        //    {
        //        de = ot.EmailVend;
        //        clavecorreo = ot.PassCorreo;
        //    }


        //    string to = System.Configuration.ConfigurationManager.AppSettings.Get("Para");
        //    string from = de;
        //    string displayName = System.Configuration.ConfigurationManager.AppSettings.Get("Remitente");
        //    string password = clavecorreo;
        //    string host = System.Configuration.ConfigurationManager.AppSettings.Get("Host");
        //    int port = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings.Get("Port"));
        //    bool enableSs1 = Boolean.Parse(System.Configuration.ConfigurationManager.AppSettings.Get("EnableSsl"));
        //    bool useDefaultCredentials = Boolean.Parse(System.Configuration.ConfigurationManager.AppSettings.Get("UseDefaultCredentials"));


        //    var fromEmail = new MailAddress(from, displayName);
        //    var toEmail = new MailAddress(to);

        //    var smtp = new SmtpClient
        //    {
        //        Host = host,
        //        Port = port,
        //        EnableSsl = enableSs1,
        //        DeliveryMethod = SmtpDeliveryMethod.Network,
        //        UseDefaultCredentials = useDefaultCredentials,
        //        Credentials = new NetworkCredential(fromEmail.Address, password)
        //    };


        //    MailMessage mailWithImg = GetMailWithImg(nvnumero);
        //    if (mailWithImg != null)
        //    {
        //        smtp.Send(mailWithImg);
        //        //smtp.SendAsync(mailWithImg, mailWithImg);
        //    }
        //}

        //private MailMessage GetMailWithImg(int nvnumero)
        //{
        //    Control Acceso = new Control();
        //    var de = "";
        //    var clavecorreo = "";
        //    IEnumerable<_NotaDeVentaDetalleModels> datosUser = Acceso.DatosCorreoVend(nvnumero);
        //    foreach (_NotaDeVentaDetalleModels ot in datosUser)
        //    {
        //        de = ot.EmailVend;
        //        clavecorreo = ot.PassCorreo;
        //    }
        //    string from = de;
        //    string subject = string.Format("Nota de Venta {0}", nvnumero);

        //    NotadeVentaCabeceraModels NVentaCabecera = new NotadeVentaCabeceraModels
        //    {
        //        NVNumero = nvnumero
        //    };
        //    List<NotadeVentaCabeceraModels> NVentaCabeceras = NotaDeVentaDAO.BuscarNVPorNumero(NVentaCabecera);

        //    List<NotaDeVentaDetalleModels> NVentaDetalles = NotaDeVentaDAO.BuscarNVDETALLEPorNumero(NVentaCabecera);

        //    ClientesModels cliente = new ClientesModels
        //    {
        //        CodAux = NVentaCabeceras[0].CodAux
        //    };

        //    List<ClientesModels> clientes = ClientesDAO.GetClientes(cliente);

        //    ClientesModels Vendedor = new ClientesModels
        //    {
        //        VenCod = NVentaCabeceras[0].VenCod
        //    };

        //    List<ClientesModels> vendedores = VendedoresSoftlandDAO.GetVendedores(Vendedor);

        //    MailMessage mail = new MailMessage
        //    {
        //        IsBodyHtml = true
        //    };

        //    mail.AlternateViews.Add(GetEmbeddedImage(NVentaCabeceras, NVentaDetalles, clientes));
        //    mail.From = new MailAddress(from);

        //    if (clientes != null)
        //    {
        //        mail.To.Add(vendedores[0].EMail);
        //        if (clientes[0].EMail == "" || clientes[0].EMail == null)
        //        {
        //            return null;
        //        }
        //        else
        //        {
        //            mail.To.Add(clientes[0].EMail);
        //        }
        //        mail.Subject = subject;
        //        return mail;
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}

        private AlternateView GetEmbeddedImage(List <NotadeVentaCabeceraModels> NVentaCabeceras,
                                               List <NotaDeVentaDetalleModels> NVentaDetalles, List <ClientesModels> Clientes)
        {
            char[] blanco = { ' ' };

            string htmlBody = String.Format(
                "<html><body>" +
                "<img src='~/Image/logo.jpg' />" +
                "<H1> Nota de Venta </H1>" +
                @"<H4> Nº de Nota de Venta: " + NVentaCabeceras[0].NVNumero + @" </H4>" +
                @"<H4> Fecha Pedido: " + NVentaCabeceras[0].nvFem.ToShortDateString() + @" </H4>" +
                @"<H4> Cliente: " + NVentaCabeceras[0].NomAux + @" </H4>" +
                @"<H4> Dirección: " + Clientes[0].DirAux + @" </H4>" +
                @"<H4> Fecha Entrega: " + NVentaCabeceras[0].nvFeEnt.ToShortDateString() + @" </H4>" +
                @"<H4> Observaciones: " + NVentaCabeceras[0].nvObser + @" </H4>" +
                @"<H4> Vendedor: " + Session["VenDes"].ToString() + @" </H4>" +
                @"<table border = ""1"" >" +
                @"<tr>" +
                @"<td>ID</td>" +
                @"<th nowrap=""nowrap"">Codigo Producto</th>" +
                //@"<th>Imagen</th>" +
                @"<th>Descripcion</th>" +
                @"<th>Cantidad</th>" +
                @"<th>Precio</th>" +
                @"<th>Sub-Total</th>" +
                @"<th>Iva    </th>" +
                @"<th>Total   </th>" +
                @"</tr>");

            ProductosModels       producto  = new ProductosModels();
            List <LinkedResource> resources = new List <LinkedResource>();

            foreach (NotaDeVentaDetalleModels nvd in NVentaDetalles)
            {
                double precioConIVa = Math.Round(nvd.nvSubTotal * 1.19);
                double Iva          = (precioConIVa - nvd.nvSubTotal);
                producto.CodProd = nvd.CodProd;
                htmlBody        += @"<tr>" +
                                   @"<td>" + nvd.nvLinea + @"</td>" +
                                   @"<td>" + nvd.CodProd + @"</td>" +
                                   @"<td>" + nvd.DesProd + @"</td>" +
                                   @"<td>" + nvd.nvCant + @"</td>" +
                                   @"<td>" + nvd.nvPrecio + @"</td>" +
                                   @"<td>" + nvd.nvSubTotal + @"</td>" +
                                   @"<td>" + Iva + @"</td>" +
                                   @"<td>" + precioConIVa + @"</td>" +
                                   @"</tr>";
            }
            htmlBody += @"<tr><th colspan =" + 7 + @">Total</th><td>" + NVentaCabeceras[0].TotalBoleta + @"</td></tr>";
            htmlBody += @"</body></html>";

            AlternateView alternateView = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);

            foreach (LinkedResource r in resources)
            {
                alternateView.LinkedResources.Add(r);
            }
            return(alternateView);
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ProductosModels productosmodels = await db.ProductosModels.FindAsync(id);

            db.ProductosModels.Remove(productosmodels);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
        public JsonResult QuickProductSearch(string CodRapido, string CodLista)
        {
            ProductosModels prod = new ProductosModels();

            prod.CodRapido = CodRapido;
            prod.CodLista  = CodLista;

            List <ProductosModels> pro = ProductosDAO.BuscarProductoRapido(prod);

            return(Json(pro));
        }
        public async Task <ActionResult> GetProductsMenu(String Clase)
        {
            ProductosModels Productos = await db.ProductosModels.FirstOrDefaultAsync(p => (p.CVE_CLASE_VAR.Equals(Clase)));

            if (Productos == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View(Productos));
        }
Ejemplo n.º 7
0
        public JsonResult ProductSearch(string CodProd, string CodLista)
        {
            ProductosModels prod = new ProductosModels();

            prod.CodProd  = CodProd;
            prod.DesProd  = CodProd;
            prod.CodLista = CodLista;

            List <ProductosModels> pro = ProductosDAO.BuscarProducto(prod);

            return(Json(pro));
        }
Ejemplo n.º 8
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Nombre,Descripcion,Estado,FechaRegistro")] ProductosModels productosmodels)
        {
            if (ModelState.IsValid)
            {
                productosmodels.FechaRegistro   = DateTime.Now;
                db.Entry(productosmodels).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(productosmodels));
        }
Ejemplo n.º 9
0
        public List <ProductosModels> BuscarProductos(int id, string Descripcion, string Pais, int idRamos)
        {
            try
            {
                string documento = "C:/Users/Marcs/source/repos/WcfExamen/WcfExamen/Documentos/Productos_LATAM.xml";

                if (!File.Exists(documento))
                {
                    return(null);
                }

                XElement xElement = XElement.Load(documento);
                List <ProductosModels> lsProductos = new List <ProductosModels>();

                ProductosModels newProducto = new ProductosModels();

                var consulta =
                    (from oRamos in xElement.Elements("Ramo")
                     where oRamos.Attribute("id").Value.ToString() == idRamos.ToString()
                     select oRamos).ToList();

                foreach (var father in consulta)
                {
                    var consultaProductos =
                        (from oProductos in father.Elements("Productos")
                         where (Convert.ToInt32(oProductos.Attribute("id").Value) == id ||
                                oProductos.Attribute("Descripcion").Value.Equals(Descripcion)) &&
                         oProductos.Attribute("Pais").Value.Equals(Pais)
                         select oProductos).ToList();

                    foreach (var ChildrenProdutos in consultaProductos)
                    {
                        newProducto = new ProductosModels()
                        {
                            Descripcion = ChildrenProdutos.Attribute("Descripcion").Value,
                            id          = Convert.ToInt32(ChildrenProdutos.Attribute("id").Value),
                            idRamo      = Convert.ToInt32(idRamos)
                        };

                        lsProductos.Add(newProducto);
                    }
                }

                return(lsProductos);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 10
0
        // GET: Productos/Details/5
        public async Task <ActionResult> Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductosModels productosModel = await db.ProductosModels.FindAsync(id);

            if (productosModel == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(productosModel));
        }
Ejemplo n.º 11
0
        // GET: /Productos/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductosModels productosmodels = await db.ProductosModels.FindAsync(id);

            if (productosmodels == null)
            {
                return(HttpNotFound());
            }
            return(View(productosmodels));
        }
Ejemplo n.º 12
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductosModels productosmodels = db.ProductosModels.Include(p => p.Files).SingleOrDefault(p => p.Id == id);

            //ProductosModels productosmodels = await db.ProductosModels.FindAsync(id);
            if (productosmodels == null)
            {
                return(HttpNotFound());
            }
            return(View(productosmodels));
        }
Ejemplo n.º 13
0
        // GET: Productos
        public ActionResult Productos()
        {
            try
            {
                List <ProductosModels> lst = new List <ProductosModels>();
                Models.ConexionBD      con = new Models.ConexionBD(); //Crea la instancia de la conexion
                con.ConexDB();                                        //Conecta la BD
                con.abrir();                                          //Abre la BD
                SqlCommand    cmd2     = new SqlCommand("SELECT * FROM dbo.PRODUCTS", con.ConexDB());
                SqlDataReader myReader = cmd2.ExecuteReader();
                while (myReader.Read())
                {
                    ProductosModels p = new ProductosModels
                    {
                        PRODUCTOS_ID     = 1,
                        NOMBRE_PRODUCTO  = myReader["NOMBRE_PRODUCTO"].ToString(),
                        ID_PRECIO        = 1,
                        DESCRIP_PRODUCTO = myReader["DESCRIP_PRODUCTO"].ToString(),
                        FOTO_PRODUCTO    = myReader["FOTO_PRODUCTO"].ToString(),
                        EMPRESA_ID       = myReader["EMPRESA_ID"].ToString()
                    };
                    lst.Add(p);
                }

                return(View(lst));
            }
            catch (Exception ex)
            {
                string Mensaje = "Error con la Solicitud";
                return(Json(new { Success = false, Mensaje }, JsonRequestBehavior.AllowGet));
            }
            //List<ProductosModels> lst;
            //using (UTNIMASEntities db = new UTNIMASEntities())
            //{
            //    lst = (from d in db.PRODUCTS
            //           join c in db.EMPRESAS on d.EMPRESA_ID equals c.EMPRESA_ID
            //           where d.EMPRESA_ID == c.EMPRESA_ID
            //           select new ProductosModels
            //           {
            //               PRODUCTOS_ID = d.PRODUCTO_ID,
            //               NOMBRE_PRODUCTO = d.NOMBRE_PRODUCTO,
            //               ID_PRECIO = d.ID_PRECIO,
            //               DESCRIP_PRODUCTO = d.DESCRIP_PRODUCTO,
            //               FOTO_PRODUCTO = d.FOTO_PRODUCTO.ToString(),  //Puede que en el modelo este mal inicializada porque en la base de datos es un tipo "image"
            //               EMPRESA_ID = c.NOMBRE_EMPRESA
            //           }).ToList();
            //return View(lst);
        }
Ejemplo n.º 14
0
 public ActionResult Create(ProductosModels producto)
 {
     try
     {
         ADMIN_PORTAL.Models.UTNIMASEntities db = new ADMIN_PORTAL.Models.UTNIMASEntities();
         // TODO: Add insert logic here
         string query = "INSERT INTO EMPRESAS(NOMBRE_PRODUCTO,ID_PRECIO,DESCRIP_PRODUCTO,FOTO_PRODUCTO,EMPRESA_ID)" +
                        "VALUES('" + producto.NOMBRE_PRODUCTO + "', '" + producto.ID_PRECIO + "', '" + producto.DESCRIP_PRODUCTO + "', 1, '" + producto.FOTO_PRODUCTO + "', '" + producto.EMPRESA_ID + "')";
         db.Database.ExecuteSqlCommand(query);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
Ejemplo n.º 15
0
        public JsonResult Buscar(ProductosModels productosModels)
        {
            try
            {
                string Pais = Session["Pais"].ToString();

                ProductosDao productosDao = new ProductosDao();
                var          Producto     = (productosDao.Buscar(productosModels.id, productosModels.Descripcion, Pais, productosModels.idRamo));

                return(Json(Producto, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 16
0
 public static List <ProductosModels> BuscarProductoRapido(ProductosModels producto)
 {
     try
     {
         using (DataContext dc = new DataContext(catalogo, "FR_BuscarProductoRapido", CommandType.StoredProcedure))
         {
             dc.parameters.AddWithValue("CodRapido", producto.CodRapido);
             dc.parameters.AddWithValue("CodLista", producto.CodLista);
             return(dc.executeQuery <ProductosModels>());
         }
     }
     catch (Exception ex)
     {
         string error = ex.ToString();
         return(null);
     }
 }
Ejemplo n.º 17
0
        public ActionResult GetOnlyProducto()
        {
            try
            {
                List <ProductosModels> lst = new List <ProductosModels>();
                Models.ConexionBD      con = new Models.ConexionBD(); //Crea la instancia de la conexion
                con.ConexDB();                                        //Conecta la BD
                con.abrir();                                          //Abre la BD
                SqlCommand    cmd2     = new SqlCommand("SELECT * FROM dbo.PRODUCTS", con.ConexDB());
                SqlDataReader myReader = cmd2.ExecuteReader();
                while (myReader.Read())
                {
                    ProductosModels p = new ProductosModels
                    {
                        PRODUCTOS_ID     = 1,
                        NOMBRE_PRODUCTO  = myReader["NOMBRE_PRODUCTO"].ToString(),
                        ID_PRECIO        = 1,
                        DESCRIP_PRODUCTO = myReader["DESCRIP_PRODUCTO"].ToString(),
                        FOTO_PRODUCTO    = myReader["FOTO_PRODUCTO"].ToString(),
                        EMPRESA_ID       = myReader["EMPRESA_ID"].ToString()
                    };
                    lst.Add(p);
                }

                if (lst.Count > 0)
                {
                    return(Json(new { Success = true, data = "true", status = 200 }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { Success = true, data = "false", status = 200 }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 18
0
        /*
         * public void SendEmail(string pvarPara, string pvarsAsunto, string pvarsMensaje, string pvarFrom, bool pvarisHtml = false)
         * {
         *
         *  try
         *  {
         *
         *      bool wvarEnvia = false;
         *      MailMessage myMail = new MailMessage();
         *
         *      myMail.From = new MailAddress("*****@*****.**");
         *
         *
         *      if (pvarPara.Trim() != "")
         *      {
         *          pvarPara = pvarPara + ",";
         *
         *          string[] wvarPP = pvarPara.Split(Convert.ToChar(","));
         *
         *          foreach (string wvarPara in wvarPP)
         *          {
         *              if (wvarPara != "")
         *              {
         *                  myMail.To.Add(wvarPara);
         *                  wvarEnvia = true;
         *              }
         *          }
         *      }
         *
         *      myMail.Subject = pvarsAsunto;
         *      myMail.SubjectEncoding = System.Text.Encoding.UTF8;
         *
         *      myMail.Body = pvarsMensaje;
         *      myMail.BodyEncoding = System.Text.Encoding.UTF8;
         *      myMail.IsBodyHtml = pvarisHtml;
         *
         *      SmtpClient mySmtpClient = new SmtpClient();
         *      mySmtpClient.Host = "mail.disofi.cl";
         *      mySmtpClient.Port = 25;
         *      mySmtpClient.EnableSsl = true;
         *
         *
         *      mySmtpClient.UseDefaultCredentials = false;
         *      NetworkCredential MyCredentials = new NetworkCredential("*****@*****.**", "D1s0f12019");
         *      mySmtpClient.Credentials = MyCredentials;
         *
         *      if (wvarEnvia == true)
         *      {
         *          mySmtpClient.Send(myMail);
         *
         *          //ReleaseObject(mySmtpClient);
         *          //ReleaseObject(myMail);
         *      }
         *
         *  }
         *
         *  catch (SmtpException ex)
         *  {
         *      //WriteLog("SmtpException has occured: " + ex.Message);
         *  }
         *
         * }
         */



        private AlternateView GetEmbeddedImage(List <NotadeVentaCabeceraModels> NVentaCabeceras,
                                               List <NotaDeVentaDetalleModels> NVentaDetalles, List <ClientesModels> Clientes)
        {
            //var connectionString = "";
            //byte[] arrImage = ms.GetBuffer();

            /*
             * using (SqlConnection cn = new SqlConnection(connectionString = "Data Source=SRV-DISOFI; Initial Catalog=DSKUPPEL; User ID=sa; Password=Softland2018; MultipleActiveResultSets=True; TrustServerCertificate =True"))
             * {
             *  cn.Open();
             *  SqlCommand cmd = new SqlCommand("select Imagen from DS_Imagenes", cn);
             *  byte[] datosImagen = (byte[])cmd.ExecuteScalar();
             *  MemoryStream ms = new MemoryStream(datosImagen);
             *  System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
             *  //arrImage = img;
             *
             * }
             */
            char[] blanco = { ' ' };

            string htmlBody = String.Format(
                "<html><body>" +
                //Cabecera

                /*"<table width ='400' cellspacing ='1' cellpadding ='3' border ='0' bgcolor ='#000000' align ='center'>" +
                 * "<tr>" +
                 * "<td width ='120' align ='left' bgcolor ='#ffffff'>" +
                 * "<div class='custom - banner'>" +
                 *
                 * "</div>" +
                 * "</td>" +
                 * "</tr>" +
                 * "</table>" +*/
                //
                "<img src='~/Image/logo.png' />" +
                "<H1> COTIZACIÓN </H1>" +
                @"<H4> Nº de Cotización: " + NVentaCabeceras[0].NVNumero + @" </H4>" +
                @"<H4> Fecha Pedido: " + NVentaCabeceras[0].nvFem.ToShortDateString() + @" </H4>" +
                @"<H4> Cliente: " + NVentaCabeceras[0].NomAux + @" </H4>" +
                @"<H4> Dirección: " + Clientes[0].DirAux + @" </H4>" +
                @"<H4> Fecha Entrega: " + NVentaCabeceras[0].nvFeEnt.ToShortDateString() + @" </H4>" +
                @"<H4> Observaciones: " + NVentaCabeceras[0].nvObser + @" </H4>" +
                @"<H4> Vendedor: " + Session["VenDes"].ToString() + @" </H4>" +
                @"<table border = ""1"" >" +
                @"<tr>" +
                @"<td>ID</td>" +
                @"<th nowrap=""nowrap"">Código Producto</th>" +
                //@"<th>Imagen</th>" +
                @"<th>Descripción</th>" +
                @"<th>Cantidad</th>" +
                @"<th>Precio</th>" +
                @"<th>Sub-Total</th>" +
                @"<th>Iva    </th>" +
                @"<th>Total   </th>" +
                @"</tr>");

            ProductosModels       producto  = new ProductosModels();
            List <LinkedResource> resources = new List <LinkedResource>();
            double Iva      = 0;
            double subtotal = 0;
            double ivaux    = 0;

            foreach (NotaDeVentaDetalleModels nvd in NVentaDetalles)
            {
                double precioConIVa = Math.Round(nvd.nvSubTotal * 1.19);
                subtotal         = subtotal + nvd.nvSubTotal;
                Iva              = (precioConIVa - nvd.nvSubTotal);
                ivaux            = ivaux + Iva;
                producto.CodProd = nvd.CodProd;
                htmlBody        += @"<tr>" +
                                   @"<td>" + nvd.nvLinea + @"</td>" +
                                   @"<td>" + nvd.CodProd + @"</td>" +
                                   @"<td>" + nvd.DesProd + @"</td>" +
                                   @"<td style='text-align: right;'>" + nvd.nvCant + @"</td>" +
                                   @"<td style='text-align: right;'>" + nvd.nvPrecio.ToString("N0") + @"</td>" +
                                   @"<td style='text-align: right;'>" + nvd.nvSubTotal.ToString("N0") + @"</td>" +
                                   @"<td style='text-align: right;'>" + Iva.ToString("N0") + @"</td>" +
                                   @"<td style='text-align: right;'>" + precioConIVa.ToString("N0") + @"</td>" +
                                   @"</tr>";
            }
            htmlBody += @"<tr><th style='text-align: right;' colspan =" + 7 + @">Sub Total</th><td style='text-align: right;'>" + "$ " + subtotal.ToString("N0") + @"</td></tr>" +
                        @"<tr><th style='text-align: right;' colspan =" + 7 + @">Total Iva</th><td style='text-align: right;'>" + "$ " + ivaux.ToString("N0") + @"</td></tr>" +
                        @"<tr><th style='text-align: right;' colspan =" + 7 + @">Total</th><td style='text-align: right;'>" + "$ " + NVentaCabeceras[0].TotalBoleta.ToString("N0") + @"</td></tr>";
            htmlBody += @" </body></html>";

            AlternateView alternateView = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);

            foreach (LinkedResource r in resources)
            {
                alternateView.LinkedResources.Add(r);
            }
            return(alternateView);
        }