コード例 #1
0
        public void Detallenv(string CodProd, string DetProd, double nvCant, string CodUMed, double nvPrecio, string CodLista,
                              double nvSubTotal, double nvTotLinea, int NVNumero, double nvLinea, DateTime nvFecCompr)
        {
            double porcentajefinal = 0;
            double descuento       = 0;

            if (nvTotLinea != nvSubTotal)
            {
                porcentajefinal = 100 - ((nvTotLinea * 100) / nvSubTotal);
                descuento       = nvSubTotal - nvTotLinea;
            }

            #region "NVD"
            var NVD = new NotaDeVentaDetalleModels
            {
                CodProd                 = CodProd,
                NVNumero                = NVNumero,
                nvLinea                 = nvLinea,
                nvCorrela               = 0,
                nvFecCompr              = nvFecCompr,
                nvCant                  = nvCant,
                nvPrecio                = nvPrecio,
                nvEquiv                 = 1,
                nvSubTotal              = nvSubTotal,
                nvDPorcDesc01           = porcentajefinal,
                nvDDescto01             = descuento,
                nvDPorcDesc02           = 0,
                nvDDescto02             = 0,
                nvDPorcDesc03           = 0,
                nvDDescto03             = 0,
                nvDPorcDesc04           = 0,
                nvDDescto04             = 0,
                nvDPorcDesc05           = 0,
                nvDDescto05             = 0,
                nvTotDesc               = 0,
                nvTotLinea              = nvTotLinea,
                nvCantDesp              = 0,
                nvCantProd              = 0,
                nvCantFact              = 0,
                nvCantDevuelto          = 0,
                nvCantNC                = 0,
                nvCantBoleta            = 0,
                nvCantOC                = 0,
                DetProd                 = DetProd,
                CheckeoMovporAlarmaVtas = "N",
                KIT          = "",
                CodPromocion = 0,
                CodUMed      = CodUMed,
                CantUVta     = nvCant,
                Partida      = "",
                Pieza        = ""
            };
            #endregion

            List <NotaDeVentaDetalleModels> nv = NotaDeVentaDAO.DetalleNV(NVD);
        }
コード例 #2
0
        private MailMessage GetMailWithImg(int nvnumero, string vendCodi)
        {
            Control Acceso      = new Control();
            var     de          = "";
            var     clavecorreo = "";
            //Correo aprobador
            //var vendCodi = Session["VendCod"].ToString();
            IEnumerable <_NotaDeVentaDetalleModels> datosAprobador = Acceso.DatosCorreoAprobador(vendCodi);

            foreach (_NotaDeVentaDetalleModels ot in datosAprobador)
            {
                de          = ot.EmailVend;
                clavecorreo = ot.PassCorreo;
            }

            string from    = de;
            string subject = string.Format("Comercial Kuppel Spa - Aprobación de Cotización {0}", nvnumero);

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

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

            List <NotadeVentaCabeceraModels> NVsoft = NotaDeVentaDAO.BuscarNVNum(NVentaCabecera);

            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, vendedores, NVsoft));
            mail.From = new MailAddress(from);

            if (vendedores != null)
            {
                mail.To.Add(vendedores[0].EMail);
                mail.Subject = subject;
                return(mail);
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        public JsonResult AgregarNV(FormCollection frm, int NVNumero, DateTime nvFem, DateTime nvFeEnt, string CodAux, string VenCod,
                                    string CodLista, string nvObser, string CveCod, string NomCon, string CodiCC, double nvSubTotal, double nvMonto,
                                    double nvNetoAfecto, string Usuario, string UsuarioGeneraDocto, DateTime FechaHoraCreacion, double TotalBoleta,
                                    string id, string CodLugarDesp)
        {
            int numSoft = 0;

            try
            {
                #region "NVC"
                NotadeVentaCabeceraModels NVC = new NotadeVentaCabeceraModels
                {
                    NVNumero             = NVNumero,
                    nvFem                = nvFem,
                    nvEstado             = "A",
                    nvEstFact            = 0,
                    nvEstDesp            = 0,
                    nvEstRese            = 0,
                    nvEstConc            = 0,
                    nvFeEnt              = nvFeEnt,
                    CodAux               = CodAux,
                    VenCod               = VenCod,
                    CodMon               = "01",
                    CodLista             = CodLista,
                    nvObser              = nvObser,
                    CveCod               = CveCod,
                    NomCon               = NomCon,
                    CodiCC               = CodiCC,
                    nvSubTotal           = nvSubTotal,
                    nvPorcDesc01         = 0,
                    nvDescto01           = 0,
                    nvPorcDesc02         = 0,
                    nvDescto02           = 0,
                    nvPorcDesc03         = 0,
                    nvDescto03           = 0,
                    nvPorcDesc04         = 0,
                    nvDescto04           = 0,
                    nvPorcDesc05         = 0,
                    nvDescto05           = 0,
                    nvMonto              = nvMonto,
                    NumGuiaRes           = 0,
                    nvPorcFlete          = 0,
                    nvValflete           = 0,
                    nvPorcEmb            = 0,
                    nvEquiv              = 1,
                    nvNetoExento         = 0,
                    nvNetoAfecto         = nvNetoAfecto,
                    nvTotalDesc          = 0,
                    ConcAuto             = "N",
                    CheckeoPorAlarmaVtas = "N",
                    EnMantencion         = 0,
                    Usuario              = Usuario,
                    UsuarioGeneraDocto   = UsuarioGeneraDocto,
                    FechaHoraCreacion    = FechaHoraCreacion,
                    Sistema              = "NW",
                    ConcManual           = "N",
                    proceso              = "Notas de Venta",
                    TotalBoleta          = TotalBoleta,
                    NumReq               = 0,
                    CodVenWeb            = "5",
                    CodLugarDesp         = CodLugarDesp
                };
                #endregion

                List <ParametrosModels> para = ParametrosDAO.BuscarParametros();

                if (para[0].Aprobador == 1)
                {
                    NVC.EstadoNP = "P";
                }
                else
                {
                    NVC.EstadoNP = "A";
                }

                if (para[0].Aprobador == 1)
                {
                    List <NotadeVentaCabeceraModels> NVSoft = NotaDeVentaDAO.EditarNV(NVC);
                    ViewBag.NVnum = NVC.NVNumero;
                    numSoft       = NVC.NVNumero;
                }
                else
                {
                    List <NotadeVentaCabeceraModels> NVSoft = NotaDeVentaDAO.InsertarNvSoftland(NVC);
                    ViewBag.NVnum = NVSoft[0].NVNumero;
                    numSoft       = NVSoft[0].NVNumero;
                }


                //EMail
                //VerificationEmail(NVNumero);
                //return Json(NV);
            }
            catch (Exception ex)
            {
                Archivo.CrearArchivo(Server, "ERROR: " + ex.Message);
            }

            return(Json(new { ID = id, NVNUM = numSoft }));
        }
コード例 #4
0
        public ActionResult NotaDeVenta(string CodAux, string NomAux, string anterior)
        {
            NotadeVentaCabeceraModels NVC = new NotadeVentaCabeceraModels();

            ViewBag.CodAux   = CodAux;
            ViewBag.NomAux   = NomAux;
            ViewBag.Anterior = anterior;
            NVC.NVNumero     = 0;
            NVC.NumOC        = "";
            NVC.NumReq       = 0;

            ClientesModels cliente = new ClientesModels
            {
                CodAux = CodAux
            };

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

            ViewBag.CorreoCliente = clientes[0].EMail;

            //Se agrega la cabecera
            List <NotadeVentaCabeceraModels> lnvc = NotaDeVentaDAO.AgregarNV(NVC);


            ViewBag.numeronota = lnvc;

            CondicionVentasModels conven = new CondicionVentasModels();

            conven.CodAux = CodAux.ToString();

            //Se lista(n) la(s) condicion(es) de venta(s)
            List <CondicionVentasModels> lcondicion = CondicionesVentaDAO.listarConVen(conven);

            ViewBag.condicion = lcondicion;

            ClientesModels contacto = new ClientesModels();

            contacto.CodAux = CodAux.ToString();
            contacto.NomAux = Session["nombre"].ToString();

            //Se ubica la lista de contactos
            List <ClientesModels> contactos = ClientesDAO.BuscarContacto(contacto);

            if (contactos == null)
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 0;
            }
            else
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 1;
            }

            DireccionDespachoModels direc = new DireccionDespachoModels();

            direc.CodAxD = CodAux.ToString();

            //Se lista(n) la(s) dirección(es) de despacho
            List <DireccionDespachoModels> direciones = ClientesDAO.BuscarDirecDespach(direc);

            if (direciones == null)
            {
                ViewBag.vdirecc = 0;
            }
            else
            {
                ViewBag.vdirecc = 1;
            }

            ViewBag.direccion = direciones;
            ViewBag.codigo    = CodAux;
            ViewBag.nombre    = NomAux;

            if (anterior == "1")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "Misclientes";
            }
            else if (anterior == "2")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "";
            }
            else if (anterior == "3")
            {
                ViewBag.anterior = "Ruta";
                ViewBag.page     = "";
            }

            ListaDePrecioModels ListPrecio = new ListaDePrecioModels();

            ListPrecio.CodAux = CodAux.ToString();

            //Se listan los precios
            //List<ListaDePrecioModels> ListDePrecios = ListaDePrecioDAO.listarListaDePrecio(ListPrecio);

            //ViewBag.lista = ListDePrecios;

            //Se listan los centros de costos
            List <CentrodeCostoModels> lcc = CentroDeCostoDAO.listarCC();

            ViewBag.cc = lcc;

            //NumNV Softland
            //List<NotadeVentaCabeceraModels> NVSoft = NotaDeVentaDAO.BuscarNvNumSoft();
            //ViewBag.NVnum = NVSoft[0].NVNumero;

            return(View());
        }
コード例 #5
0
        public ActionResult NotaDeVenta(string CodAux, string NomAux, string anterior)
        {
            if (Session["VenCod"] == null)
            {
                return(RedirectToAction("SesionExpirada", "Error"));
            }
            var id_    = Session["ID"].ToString();
            var VenCod = Session["VenCod"].ToString();
            var id     = id_;

            NotadeVentaCabeceraModels NVC = new NotadeVentaCabeceraModels();

            ViewBag.CodAux   = CodAux;
            ViewBag.NomAux   = NomAux;
            ViewBag.Anterior = anterior;
            NVC.NVNumero     = 0;
            NVC.NumOC        = "";
            NVC.NumReq       = 0;

            ClientesModels cliente = new ClientesModels
            {
                CodAux = CodAux
            };

            List <ClientesModels> contactoCorreos = ClientesDAO.GetContacto(cliente);
            List <ClientesModels> clientes        = ClientesDAO.GetClientes(cliente);
            List <ClientesModels> Contacto        = ClientesDAO.GetInfoContacto(cliente);

            if (Contacto == null || Contacto.Count < 0)
            {
                TempData["Mensaje"] = "CLIENTE NO TIENE CONTACTO<br>";
                return(RedirectToAction("MisClientes", "Ventas", new { cod = VenCod, ID = id }));
            }
            for (int i = 0; i < Contacto.Count; i++)
            {
                if (Contacto[i].EMail == "" || Contacto[i].EMail == null)
                {
                    TempData["Mensaje"] = "CLIENTE SELECCIONADO NO CUENTA CON CORREO EN CONTACTOS. " + Contacto[i].NomCon + "<br>";
                    return(RedirectToAction("MisClientes", "Ventas", new { cod = VenCod, ID = id }));
                }
                else
                {
                    ViewBag.CorreoCliente = Contacto[i].EMail;
                }
            }


            //Se agrega la cabecera
            List <NotadeVentaCabeceraModels> lnvc = NotaDeVentaDAO.AgregarNV(NVC);


            ViewBag.numeronota = lnvc;

            CondicionVentasModels conven = new CondicionVentasModels();

            conven.CodAux = CodAux.ToString();

            //Se lista(n) la(s) condicion(es) de venta(s)
            List <CondicionVentasModels> lcondicion = CondicionesVentaDAO.listarConVen(conven);

            ViewBag.condicion = lcondicion;

            ClientesModels contacto = new ClientesModels();

            contacto.CodAux = CodAux.ToString();
            contacto.NomAux = Session["nombre"].ToString();

            //Se ubica la lista de contactos
            List <ClientesModels> contactos = ClientesDAO.BuscarContacto(contacto);

            if (contactos == null)
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 0;
            }
            else
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 1;
            }

            DireccionDespachoModels direc = new DireccionDespachoModels();

            direc.CodAxD = CodAux.ToString();

            //Se lista(n) la(s) dirección(es) de despacho
            List <DireccionDespachoModels> direciones = ClientesDAO.BuscarDirecDespach(direc);

            if (direciones == null)
            {
                ViewBag.vdirecc = 0;
            }
            else
            {
                ViewBag.vdirecc = 1;
            }

            ViewBag.direccion = direciones;
            ViewBag.codigo    = CodAux;
            ViewBag.nombre    = NomAux;

            if (anterior == "1")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "Misclientes";
            }
            else if (anterior == "2")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "";
            }
            else if (anterior == "3")
            {
                ViewBag.anterior = "Ruta";
                ViewBag.page     = "";
            }

            ListaDePrecioModels ListPrecio = new ListaDePrecioModels();

            ListPrecio.CodAux = CodAux.ToString();

            //Se listan los precios
            List <ListaDePrecioModels> ListDePrecios = ListaDePrecioDAO.listarListaDePrecio(ListPrecio);

            ViewBag.lista = ListDePrecios;

            //Se listan los centros de costos
            List <CentrodeCostoModels> lcc = CentroDeCostoDAO.listarCC();

            ViewBag.cc = lcc;

            return(View());
        }
コード例 #6
0
        public JsonResult AgregarNV(FormCollection frm, int NVNumero, DateTime nvFem, DateTime nvFeEnt, string CodAux, string VenCod,
                                    string CodLista, string nvObser, string CveCod, string NomCon, string CodiCC, double nvSubTotal, double nvMonto,
                                    double nvNetoAfecto, string Usuario, string UsuarioGeneraDocto, DateTime FechaHoraCreacion, double TotalBoleta,
                                    string id, string CodLugarDesp)
        {
            #region "NVC"
            try
            {
                NotadeVentaCabeceraModels NVC = new NotadeVentaCabeceraModels
                {
                    NVNumero             = NVNumero,
                    nvFem                = nvFem,
                    nvEstado             = "P",
                    nvEstFact            = 0,
                    nvEstDesp            = 0,
                    nvEstRese            = 0,
                    nvEstConc            = 0,
                    nvFeEnt              = nvFeEnt,
                    CodAux               = CodAux,
                    VenCod               = VenCod,
                    CodMon               = "01",
                    CodLista             = CodLista,
                    nvObser              = nvObser,
                    CveCod               = CveCod,
                    NomCon               = NomCon,
                    CodiCC               = CodiCC,
                    nvSubTotal           = nvSubTotal,
                    nvPorcDesc01         = 0,
                    nvDescto01           = 0,
                    nvPorcDesc02         = 0,
                    nvDescto02           = 0,
                    nvPorcDesc03         = 0,
                    nvDescto03           = 0,
                    nvPorcDesc04         = 0,
                    nvDescto04           = 0,
                    nvPorcDesc05         = 0,
                    nvDescto05           = 0,
                    nvMonto              = nvMonto,
                    NumGuiaRes           = 0,
                    nvPorcFlete          = 0,
                    nvValflete           = 0,
                    nvPorcEmb            = 0,
                    nvEquiv              = 1,
                    nvNetoExento         = 0,
                    nvNetoAfecto         = nvNetoAfecto,
                    nvTotalDesc          = 0,
                    ConcAuto             = "N",
                    CheckeoPorAlarmaVtas = "N",
                    EnMantencion         = 0,
                    Usuario              = Usuario,
                    UsuarioGeneraDocto   = UsuarioGeneraDocto,
                    FechaHoraCreacion    = FechaHoraCreacion,
                    Sistema              = "NW",
                    ConcManual           = "N",
                    proceso              = "Notas de Venta",
                    TotalBoleta          = TotalBoleta,
                    NumReq               = 0,
                    CodVenWeb            = "5",
                    CodLugarDesp         = CodLugarDesp
                };
                #endregion

                List <ParametrosModels> para = ParametrosDAO.BuscarParametros();

                if (para[0].Aprobador == 1)
                {
                    NVC.EstadoNP = "P";
                }
                else
                {
                    NVC.EstadoNP = "P";
                }

                if (para[0].Aprobador == 1)
                {
                    List <NotadeVentaCabeceraModels> NV = NotaDeVentaDAO.EditarNV(NVC);
                }
                else
                {
                }
                //EMail
                VerificationEmail(NVNumero, NomCon);
                return(Json(new { ID = id }));
            }
            catch (Exception ex)
            {
                throw(ex);
            }
            //return RedirectToAction("Misclientes", "Ventas", new { ID = id });
        }
コード例 #7
0
        private MailMessage GetMailWithImg(int nvnumero, string NomCon)
        {
            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("Comercial Kuppel Spa - Cotización {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,
                NomCon = NomCon
            };

            List <ClientesModels> contacto = ClientesDAO.GetContacto(cliente);

            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 (contacto[0].EMail == null || contacto[0].EMail.Trim() == "")
                {
                    mail.To.Add(clientes[0].EMail);
                }
                else
                {
                    mail.To.Add(contacto[0].EMail);
                }
                mail.Subject = subject;
                return(mail);
            }
            else
            {
                return(null);
            }
        }