Esempio n. 1
0
        public ActionResult Index()
        {
            int pagina = 301; //ID EN BASE DE DATOS

            using (TAT001Entities db = new TAT001Entities())
            {
                string u = User.Identity.Name;
                //string u = "admin";
                var user = db.USUARIOs.Where(a => a.ID.Equals(u)).FirstOrDefault();
                ViewBag.permisos = db.PAGINAVs.Where(a => a.ID.Equals(user.ID)).ToList();
                ViewBag.carpetas = db.CARPETAVs.Where(a => a.USUARIO_ID.Equals(user.ID)).ToList();
                ViewBag.usuario  = user; ViewBag.returnUrl = Request.Url.PathAndQuery;;
                ViewBag.rol      = user.PUESTO.PUESTOTs.Where(a => a.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50;
                ViewBag.Title    = db.PAGINAs.Where(a => a.ID.Equals(pagina)).FirstOrDefault().PAGINATs.Where(b => b.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50;
                ViewBag.warnings = db.WARNINGVs.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList();
                ViewBag.textos   = db.TEXTOes.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList();

                try
                {
                    string p = Session["pais"].ToString();
                    ViewBag.pais = p + ".png";
                }
                catch
                {
                    //ViewBag.pais = "mx.png";
                    //return RedirectToAction("Pais", "Home");
                }
                Session["spras"] = user.SPRAS_ID;
            }
            Models.PresupuestoModels carga = new Models.PresupuestoModels();
            ViewBag.ultMod = carga.consultarUCarga();
            ViewBag.anio   = "20" + carga.consultaAnio();
            return(View(carga.consultSociedad("")));
        }
Esempio n. 2
0
        public ActionResult Index(string cpt, string excel, string select, string anioconsu, string periodoconsu, string cambio)
        {
            try
            {
                if (Session["sociedad"].ToString() != select)
                {
                    cambio       = null;
                    periodoconsu = null;
                    anioconsu    = null;
                }
                if (periodoconsu == "")
                {
                    periodoconsu = null;
                }
            }
            catch (Exception)
            {
            }
            Session["sociedad"]     = select;
            Session["cambio"]       = cambio;
            Session["periodoconsu"] = periodoconsu;
            Session["anioconsu"]    = anioconsu;
            int pagina = 301; //ID EN BASE DE DATOS

            using (TAT001Entities db = new TAT001Entities())
            {
                string u = User.Identity.Name;
                //string u = "admin";
                var user = db.USUARIOs.Where(a => a.ID.Equals(u)).FirstOrDefault();
                ViewBag.permisos = db.PAGINAVs.Where(a => a.ID.Equals(user.ID)).ToList();
                ViewBag.carpetas = db.CARPETAVs.Where(a => a.USUARIO_ID.Equals(user.ID)).ToList();
                ViewBag.usuario  = user; ViewBag.returnUrl = Request.Url.PathAndQuery;;
                ViewBag.rol      = user.PUESTO.PUESTOTs.Where(a => a.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50;
                ViewBag.Title    = db.PAGINAs.Where(a => a.ID.Equals(pagina)).FirstOrDefault().PAGINATs.Where(b => b.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50;
                ViewBag.warnings = db.WARNINGVs.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList();
                ViewBag.textos   = db.TEXTOes.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList();

                try
                {
                    string p = Session["pais"].ToString();
                    ViewBag.pais = p + ".png";
                }
                catch
                {
                    //ViewBag.pais = "mx.png";
                    //return RedirectToAction("Pais", "Home");
                }
                Session["spras"] = user.SPRAS_ID;
            }
            Models.PresupuestoModels carga = new Models.PresupuestoModels();
            DatosPresupuesto         presu = new DatosPresupuesto();

            ViewBag.ultMod = carga.consultarUCarga();
            ViewBag.anio   = "20" + carga.consultaAnio();
            ViewBag.chkcpt = cpt;
            presu          = carga.consultarDatos(select, anioconsu, periodoconsu, cambio, cpt, excel, Server.MapPath("~/pdfTemp/"));
            if (excel != null)
            {
                return(File(Server.MapPath("~/pdfTemp/Presupuesto.xlsx"), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Presupuesto.xlsx"));
            }
            else
            {
                return(View(presu));
            }
            ;
        }
Esempio n. 3
0
        // GET: Correos
        public ActionResult Index(decimal id, bool?mail)  //B20180803 MGC Correos
        {
            var dOCUMENTO = db.DOCUMENTOes.Where(x => x.NUM_DOC == id).FirstOrDefault();
            var flujo     = db.FLUJOes.Where(x => x.NUM_DOC == id).OrderByDescending(o => o.POS).Select(s => s.POS).ToList();

            ViewBag.Pos = flujo[0];
            ViewBag.url = "http://localhost:64497";
            ViewBag.url = "http://192.168.1.77";
            ViewBag.url = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "");
            //ViewBag.miles = dOCUMENTOes.PAI.MILES;//LEJGG 090718
            //ViewBag.dec = dOCUMENTOes.PAI.DECIMAL;//LEJGG 090718
            FormatosC fc = new FormatosC();

            ViewBag.monto = fc.toShow((decimal)dOCUMENTO.MONTO_DOC_MD, dOCUMENTO.PAI.DECIMAL) + " " + dOCUMENTO.MONEDA_ID;
            if (mail == null)
            {
                mail = true;
            }
            //B20180803 MGC Correos............
            string mailv = "";

            if (mail != null)
            {
                if (mail == true)
                {
                    mailv = "X";
                }
            }

            ViewBag.mail = mailv;
            //B20180803 MGC Correos............

            //B20180803 MGC Presupuesto............
            Models.PresupuestoModels carga = new Models.PresupuestoModels();
            ViewBag.ultMod = carga.consultarUCarga();

            dOCUMENTO.PAI = db.PAIS.Where(a => a.LAND.Equals(dOCUMENTO.PAIS_ID)).FirstOrDefault();
            if (dOCUMENTO.PAI != null)
            {
                ViewBag.miles = dOCUMENTO.PAI.MILES;   //LEJGG 090718
                ViewBag.dec   = dOCUMENTO.PAI.DECIMAL; //LEJGG 090718
            }

            CLIENTE_MOD cli = new CLIENTE_MOD();

            cli = SelectCliente(dOCUMENTO.PAYER_ID);

            ViewBag.kunnr = cli.KUNNR + "-" + cli.NAME1;
            ViewBag.vtweg = cli.VTWEG;

            Services.FormatosC format = new FormatosC();

            PRESUPUESTO_MOD presu = new PRESUPUESTO_MOD();

            presu = getPresupuesto(dOCUMENTO.PAYER_ID);

            decimal pcanal = 0;

            try
            {
                pcanal = Convert.ToDecimal(presu.P_CANAL) / 1;
            }
            catch (Exception)
            {
            }
            decimal pbanner = 0;

            try
            {
                pbanner = Convert.ToDecimal(presu.P_BANNER) / 1;
            }
            catch (Exception)
            {
            }
            decimal pcc = 0;

            try
            {
                pcc = Convert.ToDecimal(presu.PC_C) / 1 * -1;
            }
            catch (Exception)
            {
            }
            decimal pca = 0;

            try
            {
                pca = Convert.ToDecimal(presu.PC_A) / 1 * -1;
            }
            catch (Exception)
            {
            }
            decimal pcp = 0;

            try
            {
                pcp = Convert.ToDecimal(presu.PC_P) / 1 * -1;
            }
            catch (Exception)
            {
            }
            decimal pct = 0;

            try
            {
                pct = Convert.ToDecimal(presu.PC_T) / 1 * -1;
            }
            catch (Exception)
            {
            }
            decimal consu = 0;

            try
            {
                consu = Convert.ToDecimal(presu.CONSU) / 1;
            }
            catch (Exception)
            {
            }
            ViewBag.pcan  = format.toShowG(pcanal, dOCUMENTO.PAI.DECIMAL);
            ViewBag.pban  = format.toShowG(pbanner, dOCUMENTO.PAI.DECIMAL);
            ViewBag.pcc   = format.toShowG(pcc, dOCUMENTO.PAI.DECIMAL);
            ViewBag.pca   = format.toShowG(pca, dOCUMENTO.PAI.DECIMAL);
            ViewBag.pcp   = format.toShowG(pcp, dOCUMENTO.PAI.DECIMAL);
            ViewBag.pct   = format.toShowG(pct, dOCUMENTO.PAI.DECIMAL);
            ViewBag.consu = format.toShowG(consu, dOCUMENTO.PAI.DECIMAL);

            SOLICITUD_MOD sol = new SOLICITUD_MOD();

            if (dOCUMENTO.DOCUMENTO_REF == null)
            {
                sol = getSolicitud("0.00", dOCUMENTO.MONTO_DOC_MD + "", dOCUMENTO.PAI.DECIMAL);
            }
            else
            {
                sol = getSolicitud(dOCUMENTO.DOCUMENTO_REF + "", dOCUMENTO.MONTO_DOC_MD + "", dOCUMENTO.PAI.DECIMAL);
            }

            ViewBag.S_IMPA     = sol.S_IMPA;
            ViewBag.S_IMPB     = sol.S_IMPB;
            ViewBag.S_IMPC     = sol.S_IMPC;
            ViewBag.S_MONTOA   = sol.S_MONTOA;
            ViewBag.S_MONTOB   = sol.S_MONTOB;
            ViewBag.S_MONTOP   = sol.S_MONTOP;
            ViewBag.S_NUM      = sol.S_NUM;
            ViewBag.S_REMA     = sol.S_REMA;
            ViewBag.rema_color = "";
            if (format.toNum(sol.S_REMA, dOCUMENTO.PAI.MILES, dOCUMENTO.PAI.DECIMAL) < 0)
            {
                ViewBag.rema_color = "#F44336 !important";
            }

            ViewBag.S_RET   = sol.S_RET;
            ViewBag.S_TOTAL = sol.S_TOTAL;

            //B20180803 MGC Presupuesto............

            return(View(dOCUMENTO));
        }