Ejemplo n.º 1
0
        public DatosPresupuesto consultarDatos(string[] sociedad, string anio, string periodo, string cambio, string cpt, string excel, string ruta, string usuario)
        {
            DatosPresupuesto sociedades = new DatosPresupuesto();
            string           anioc      = "";// periodoc = "";
            string           chkcpt     = "";

            for (int i = 0; i < sociedad.Length; i++)
            {
                consultSociedad(ref sociedades, sociedad[i], usuario);
                if (String.IsNullOrEmpty(anio) == false)
                {
                    anioc = anio.Substring(2, 2);
                }
                //if (String.IsNullOrEmpty(periodo) == false)
                //{
                //    periodoc = periodo;
                //}
                if (String.IsNullOrEmpty(cpt) == false)
                {
                    chkcpt = "X";
                }
                if (String.IsNullOrEmpty(cambio) == false && sociedades.cambio.Count > 0)
                {
                    string[] moneda = cambio.Split('-');
                    sociedades.presupuesto.AddRange(db.CSP_CONSULTARPRESUPUESTO(sociedad[i], anioc, anio, periodo, periodo, sociedades.cambio[0].FCURR, moneda[1], chkcpt).ToList());
                }
                else
                {
                    sociedades.presupuesto.AddRange(db.CSP_CONSULTARPRESUPUESTO(sociedad[i], anioc, anio, periodo, periodo, "", "", chkcpt).ToList());
                }
            }
            if (excel != null)
            {
                string[] moneda = new string[1];
                if (String.IsNullOrEmpty(cambio) == false)
                {
                    moneda = cambio.Split('-');
                }
                else if (sociedades.cambio.Count > 0)
                {
                    moneda[0] = sociedades.cambio[0].FCURR;
                }
                generarRepPresuExcel(sociedades.presupuesto, sociedad, moneda[0], consultarUCarga(), ruta, cpt);
            }
            return(sociedades);
        }