Пример #1
0
        public List <Informe_Produccion_V2> EstadisticaProduccion_V2(string Maquina, DateTime fechainicio, DateTime fechatermino, int procedimiento)
        {
            Conexion con = new Conexion();
            List <Informe_Produccion_V2> lista = new List <Informe_Produccion_V2>();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[Produccion_EstadisticaProduccion_V2]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@MAQUINA", Maquina);
                cmd.Parameters.AddWithValue("@FECHAINICIO", fechainicio);
                cmd.Parameters.AddWithValue("@FECHATERMINO", fechatermino);
                cmd.Parameters.AddWithValue("@PROCEDIMIENTO", procedimiento);
                cmd.CommandTimeout = 3000000;
                SqlDataReader reader = cmd.ExecuteReader();
                string        ceros  = "00";
                while (reader.Read())
                {
                    Informe_Produccion_V2 p = new Informe_Produccion_V2();
                    p.Semana   = reader["semana"].ToString();
                    p.Maquina  = reader["Maquina"].ToString().Replace("C150", "").Replace("M2016", "WEB 2");
                    p.Giros    = Convert.ToInt32(reader["Giros"].ToString()).ToString("N0").Replace(",", ".");
                    p.Entradas = reader["Entradas"].ToString();

                    TimeSpan t1    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasTiraje"].ToString()));
                    int      Dias1 = t1.Days * 24;
                    p.HorasTiraje = (t1.Hours + Dias1).ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Minutes.ToString().Length) + t1.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Seconds.ToString().Length) + t1.Seconds.ToString();

                    TimeSpan t2    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasImproductivas"].ToString()));
                    int      Dias2 = t2.Days * 24;
                    p.HorasImproductivas = (t2.Hours + Dias2).ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Minutes.ToString().Length) + t2.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Seconds.ToString().Length) + t2.Seconds.ToString();

                    TimeSpan t3    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()));
                    int      Dias3 = t3.Days * 24;
                    p.HorasPreparacion = (t3.Hours + Dias3).ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Minutes.ToString().Length) + t3.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Seconds.ToString().Length) + t3.Seconds.ToString();

                    TimeSpan t4    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinTrabajo"].ToString()));
                    int      Dias4 = t4.Days * 24;
                    p.HorasSinTrabajo = (t4.Hours + Dias4).ToString() + ":" + ceros.Substring(0, ceros.Length - t4.Minutes.ToString().Length) + t4.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t4.Seconds.ToString().Length) + t4.Seconds.ToString();

                    TimeSpan t5    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinPersonal"].ToString()));
                    int      Dias5 = t5.Days * 24;
                    p.HorasSinPersonal = (t5.Hours + Dias5).ToString() + ":" + ceros.Substring(0, ceros.Length - t5.Minutes.ToString().Length) + t5.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t5.Seconds.ToString().Length) + t5.Seconds.ToString();

                    TimeSpan t6    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasMantencion"].ToString()));
                    int      Dias6 = t6.Days * 24;
                    p.HorasMantencion = (t6.Hours + Dias6).ToString() + ":" + ceros.Substring(0, ceros.Length - t6.Minutes.ToString().Length) + t6.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t6.Seconds.ToString().Length) + t6.Seconds.ToString();

                    TimeSpan t7    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPruebaImpresion"].ToString()));
                    int      Dias7 = t7.Days * 24;
                    p.HorasPruebaImpresion = (t7.Hours + Dias7).ToString() + ":" + ceros.Substring(0, ceros.Length - t7.Minutes.ToString().Length) + t7.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t7.Seconds.ToString().Length) + t7.Seconds.ToString();

                    p.GirosMalosPreparacion   = Convert.ToInt32(reader["GirosMalosPreparacion"].ToString()).ToString("N0").Replace(",", ".");
                    p.PliegosMalosPreparacion = Convert.ToInt32(reader["PliegosMalosPreparacion"].ToString()).ToString("N0").Replace(",", ".");
                    p.GirosMalosTiraje        = Convert.ToInt32(reader["GirosMalosTiraje"].ToString()).ToString("N0").Replace(",", ".");
                    p.PliegosMalosTiraje      = Convert.ToInt32(reader["PliegosMalosTiraje"].ToString()).ToString("N0").Replace(",", ".");
                    p.Buenos = Convert.ToInt32(reader["Buenos"].ToString()).ToString("N0").Replace(",", ".");
                    lista.Add(p);
                }
            }
            con.CerrarConexion();
            return(lista);
        }
        public List <Bobina_ConsumoLinea_V2> List_BobinasInformeMensual_V3(DateTime FechaInicio, DateTime FechaTermino)
        {
            List <Bobina_ConsumoLinea_V2> lista = new List <Bobina_ConsumoLinea_V2>();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();
            double     TotalBobinas = 0; double TotalConsumo = 0; double TotalEscarpe = 0; double BobinasConProyecto = 0; double KGConProyecto = 0; double DanoProveedor;
            double     DanoRollero = 0; double DanoAlmacen = 0;

            if (cmd != null)
            {
                try
                {
                    //cmd.CommandText = "Bobina_ConsumoLineaMetrics_Mensual_V2";
                    cmd.CommandText = "[Bobina_ConsumoLineaMetrics_Mensual_V3]";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                    cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Bobina_ConsumoLinea_V2 b = new Bobina_ConsumoLinea_V2();
                        b.Maquina                = reader["Maquina"].ToString();
                        TotalBobinas             = Convert.ToDouble(reader["TotalBobinas"].ToString());
                        TotalConsumo             = Convert.ToDouble(reader["Consumo"].ToString());
                        TotalEscarpe             = Convert.ToDouble(reader["Escalpe"].ToString());
                        BobinasConProyecto       = Convert.ToDouble(reader["BobinasConProyecto"].ToString());
                        KGConProyecto            = Convert.ToDouble(reader["KGBobinasConProyecto"].ToString());
                        DanoProveedor            = Convert.ToDouble(reader["DanoProveedor"].ToString());
                        DanoRollero              = Convert.ToDouble(reader["DanoRollero"].ToString());
                        DanoAlmacen              = Convert.ToDouble(reader["DanoAlmacen"].ToString());
                        b.TotalBobinasConsumidas = TotalBobinas;
                        b.TotalKGConsumido       = TotalConsumo;
                        b.TotalKGEscarpe         = TotalEscarpe;
                        if (TotalBobinas > 0)
                        {
                            b.PromedioEscarpe = (TotalEscarpe / TotalBobinas);
                        }
                        else
                        {
                            b.PromedioEscarpe = 0;
                        }
                        if (TotalConsumo > 0)
                        {
                            b.PorcentajeEscarpe = ((TotalEscarpe * 100) / TotalConsumo);
                        }
                        else
                        {
                            b.PorcentajeEscarpe = 0;
                        }
                        b.BobinasBuenas      = Convert.ToDouble(reader["BobinasBuenas"].ToString());
                        b.BobinasMalas       = Convert.ToDouble(reader["BobinasMalas"].ToString());
                        b.BobinasConProyecto = BobinasConProyecto;
                        b.KGConProyecto      = KGConProyecto;
                        b.BobinasSinProyecto = (TotalBobinas - BobinasConProyecto);
                        b.KGSinProyecto      = (TotalConsumo - KGConProyecto);
                        b.DanoAlmacen        = DanoAlmacen;
                        b.DanoRollero        = DanoRollero;
                        b.DanoProveedor      = DanoProveedor;
                        if (TotalEscarpe > 0)
                        {
                            b.PorcDanoAlmacen   = ((DanoAlmacen * 100) / TotalEscarpe);
                            b.PorcDanoRollero   = ((DanoRollero * 100) / TotalEscarpe);
                            b.PorcDanoProveedor = ((DanoProveedor * 100) / TotalEscarpe);
                        }
                        else
                        {
                            b.PorcDanoAlmacen = 0; b.PorcDanoRollero = 0; b.PorcDanoProveedor = 0;
                        }
                        lista.Add(b);
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(lista);
        }
        //informe estadistica encuadernacion
        public List <EstEncuadernacion> Produccion_EstadisticaEnc(string Maquina, DateTime Fechainicio, DateTime FechaTermino, int Procedimiento)
        {
            List <EstEncuadernacion> lista = new List <EstEncuadernacion>();
            Conexion   conexion            = new Conexion();
            SqlCommand cmd   = conexion.AbrirConexionIntranet();
            string     ceros = "00";

            if (cmd != null)
            {
                cmd.CommandText = "[Produccion_EstadisticaENC]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@FechaInicio", Fechainicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 9000000;
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    EstEncuadernacion p = new EstEncuadernacion();
                    p.Mes      = reader["Mes"].ToString();
                    p.Maquina  = reader["CodRecurso"].ToString();
                    p.OTS      = reader["OTS"].ToString();
                    p.Entradas = reader["Entradas"].ToString();
                    //p.HorasPreparacion = reader["HorasPreparacion"].ToString();
                    TimeSpan t0    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()));
                    int      Dias0 = t0.Days * 24;
                    p.HorasPreparacion = (t0.Hours + Dias0).ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Minutes.ToString().Length) + t0.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Seconds.ToString().Length) + t0.Seconds.ToString();
                    //p.HorasPreparacionPromedio = reader["PromedioPreparacion"].ToString();
                    TimeSpan t1    = TimeSpan.FromSeconds(Convert.ToDouble(reader["PromedioPreparacion"].ToString()));
                    int      Dias1 = t1.Days * 24;
                    p.HorasPreparacionPromedio = (t1.Hours + Dias1).ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Minutes.ToString().Length) + t1.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Seconds.ToString().Length) + t1.Seconds.ToString();

                    //p.HorasImproductivas = reader["HorasImproductivas"].ToString();
                    TimeSpan t2    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasImproductivas"].ToString()));
                    int      Dias2 = t2.Days * 24;
                    p.HorasImproductivas = (t2.Hours + Dias2).ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Minutes.ToString().Length) + t2.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Seconds.ToString().Length) + t2.Seconds.ToString();
                    //p.HorasSinTrabajo = reader["HorasSinTrabajo"].ToString();
                    TimeSpan t3    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinTrabajo"].ToString()));
                    int      Dias3 = t3.Days * 24;
                    p.HorasSinTrabajo = (t3.Hours + Dias3).ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Minutes.ToString().Length) + t3.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Seconds.ToString().Length) + t3.Seconds.ToString();
                    //p.HorasSinPersonal = reader["HorasSinPersonal"].ToString();
                    TimeSpan t4    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinPersonal"].ToString()));
                    int      Dias4 = t4.Days * 24;
                    p.HorasSinPersonal = (t4.Hours + Dias4).ToString() + ":" + ceros.Substring(0, ceros.Length - t4.Minutes.ToString().Length) + t4.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t4.Seconds.ToString().Length) + t4.Seconds.ToString();
                    //p.HorasMantencion = reader["HorasMantencion"].ToString();
                    TimeSpan t5    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasMantencion"].ToString()));
                    int      Dias5 = t5.Days * 24;
                    p.HorasMantencion = (t5.Hours + Dias5).ToString() + ":" + ceros.Substring(0, ceros.Length - t5.Minutes.ToString().Length) + t5.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t5.Seconds.ToString().Length) + t5.Seconds.ToString();
                    //p.EsperaMaterial = reader["HorasEsperaMaterial"].ToString();
                    TimeSpan t6    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasEsperaMaterial"].ToString()));
                    int      Dias6 = t6.Days * 24;
                    p.EsperaMaterial = (t6.Hours + Dias6).ToString() + ":" + ceros.Substring(0, ceros.Length - t6.Minutes.ToString().Length) + t6.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t6.Seconds.ToString().Length) + t6.Seconds.ToString();

                    double   HTir   = Convert.ToDouble(reader["HorasTiraje"].ToString());
                    double   HPrep  = Convert.ToDouble(reader["HorasPreparacion"].ToString());
                    double   HImp   = Convert.ToDouble(reader["HorasImproductivas"].ToString());
                    double   HST    = Convert.ToDouble(reader["HorasSinTrabajo"].ToString());
                    double   HSP    = Convert.ToDouble(reader["HorasSinPersonal"].ToString());
                    double   HMan   = Convert.ToDouble(reader["HorasMantencion"].ToString());
                    double   HEM    = Convert.ToDouble(reader["HorasEsperaMaterial"].ToString());
                    double   THoras = (HPrep + HImp + HST + HSP + HMan + HEM + HTir);
                    TimeSpan t7     = TimeSpan.FromSeconds(THoras);
                    int      Dias7  = t7.Days * 24;
                    p.TotalHoras = (t7.Hours + Dias7).ToString() + ":" + ceros.Substring(0, ceros.Length - t7.Minutes.ToString().Length) + t7.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t7.Seconds.ToString().Length) + t7.Seconds.ToString();

                    TimeSpan t8    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasTiraje"].ToString()));
                    int      Dias8 = t8.Days * 24;
                    p.HorasTiraje = (t8.Hours + Dias8).ToString() + ":" + ceros.Substring(0, ceros.Length - t8.Minutes.ToString().Length) + t8.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t8.Seconds.ToString().Length) + t8.Seconds.ToString();

                    p.PorcSinCarga       = (((HST + HSP) / THoras) * 100).ToString("N2") + "%";
                    p.PorcProduciendo    = (((HTir + HPrep) / THoras) * 100).ToString("N2") + "%";
                    p.PorcSinProducir    = (((HImp + HMan) / THoras) * 100).ToString("N2") + "%";
                    p.PorcEsperaMaterial = ((HEM / THoras) * 100).ToString("N2") + "%";

                    double TBuenos = Convert.ToDouble(reader["Buenos"].ToString());
                    p.Buenos         = Convert.ToInt32(TBuenos).ToString("N0").Replace(",", ".");
                    p.BuenosPromedio = Convert.ToInt32(reader["BuenosPromedio"].ToString()).ToString("N0").Replace(",", ".");

                    double MalosTiraje = Convert.ToDouble(reader["PliegosMalosTiraje"].ToString());
                    double MalosPrep   = Convert.ToDouble(reader["PliegosMalosPreparacion"].ToString());
                    p.PliegosMalosPreparacion = Convert.ToInt32(MalosPrep).ToString("N0").Replace(",", ".");
                    p.PliegosMalosTiraje      = Convert.ToInt32(MalosTiraje).ToString("N0").Replace(",", ".");

                    p.PorcBuenosMalos = ((MalosTiraje + MalosPrep) / (TBuenos)).ToString("N2") + "%";
                    p.Velocidad       = (TBuenos / (HTir / 3600)).ToString("N0").Replace(",", ".") + "/Hr";
                    p.RendPP          = (TBuenos / (((HTir / 3600) + (HPrep / 3600)))).ToString("N0").Replace(",", ".");
                    p.RendImp         = (TBuenos / (((HTir / 3600) + (HPrep / 3600) + (HImp / 3600)))).ToString("N0").Replace(",", ".");

                    lista.Add(p);
                }
            }
            conexion.CerrarConexion();

            return(lista);
        }
        public FichaMedica BuscarPacienteRut(string Rut, int Procedimiento)
        {
            FichaMedica fm  = new FichaMedica();
            Conexion    con = new Conexion();
            SqlCommand  cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "Salud_BuscarPaciente";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@rut", Rut);
                    cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);

                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        if (Procedimiento == 0)
                        {
                            string[] stg = reader["nombre"].ToString().Split(' ');
                            fm.Nombre          = stg[0];
                            fm.NombreSeg       = stg[1];
                            fm.ApellidoPaterno = reader["ape_paterno_trabaj"].ToString();
                            fm.ApellidoMaterno = reader["ape_materno_trabaj"].ToString();
                            fm.CentroCosto     = reader["centro_costo"].ToString();
                            fm.Cargo           = reader["Cargo"].ToString();
                            fm.Telefono        = reader["telefono"].ToString().Trim();
                            fm.Direccion       = reader["direccion"].ToString().Trim();
                            fm.Comuna          = reader["Comuna"].ToString().Trim();
                            fm.Jornada         = reader["jornada"].ToString().Trim();
                            switch (reader["cod_estado_civil"].ToString())
                            {
                            case "C": fm.EstadoCivil = "Casado(a)"; break;

                            case "S": fm.EstadoCivil = "Soltero(a)"; break;

                            case "V": fm.EstadoCivil = "Viudo(a)"; break;

                            default: fm.EstadoCivil = "Separado(a)"; break;
                            }
                            fm.FechaNacimiento = Convert.ToDateTime(reader["fec_nacimiento"].ToString());
                            fm.FechaIngreso    = Convert.ToDateTime(reader["fec_ini_contrato"].ToString());
                            fm.Sexo            = reader["sexo"].ToString();
                            fm.Correo          = reader["casilla_e_mail"].ToString();
                        }
                        else if (Procedimiento == 1)
                        {
                            fm.IDFichaMedica   = Convert.ToInt32(reader["Id_FichaMedica"].ToString());
                            fm.Nombre          = reader["Nombre_Primer"].ToString();
                            fm.ApellidoPaterno = reader["Apellido_Paterno"].ToString();
                            fm.ApellidoMaterno = reader["Apellido_Materno"].ToString();
                            fm.Sexo            = reader["Sexo"].ToString();
                            fm.FechaNacimiento = Convert.ToDateTime(reader["Fecha_Nacimiento"].ToString());
                            fm.EstadoCivil     = reader["Estado_Civil"].ToString();
                            fm.Telefono        = reader["Telefono"].ToString();
                            fm.Anexo           = reader["Anexo"].ToString();
                            fm.Correo          = reader["CorreoElectronico"].ToString();
                            fm.Direccion       = reader["Direccion"].ToString();
                            fm.Comuna          = reader["Comuna"].ToString();
                            fm.Transporte      = reader["TipoTransporte"].ToString();
                            fm.Accion          = reader["Empresa"].ToString();
                            fm.Cargo           = reader["Cargo_Actual"].ToString();
                            fm.Fiebre          = reader["Turno"].ToString();
                            fm.FechaIngreso    = Convert.ToDateTime(reader["Antig_Empresa"].ToString());
                            fm.Edad            = DateTime.Now.Year - Convert.ToDateTime(reader["Antig_cargo"].ToString()).Year;
                        }
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(fm);
        }
        public FichaMedica BuscarConsultaPaciente(string ID)
        {
            FichaMedica Paciente = new FichaMedica();
            Conexion    con      = new Conexion();
            SqlCommand  cmd      = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "salud_BuscarConsultaPaciente";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", ID);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Paciente.Accion = reader["Id_AntecedentesMedicos"].ToString();
                        Paciente.Fuma   = reader["Habito_Fumar"].ToString();
                        if (Paciente.Fuma != "No")
                        {
                            Paciente.FumaCant     = reader["FumaCant"].ToString();
                            Paciente.FumaDescript = reader["FumaDescript"].ToString();
                        }
                        Paciente.Bebe = reader["Habito_Bebe"].ToString();
                        if (Paciente.Bebe != "No")
                        {
                            Paciente.BebeCant     = reader["BebeCant"].ToString();
                            Paciente.BebeDescript = reader["BebeDescript"].ToString();
                        }
                        Paciente.Drogas = reader["Habito_Drogas"].ToString();
                        if (Paciente.Drogas != "No")
                        {
                            Paciente.DrogasCant         = reader["DrogasCant"].ToString();
                            Paciente.DrogasCantDescript = reader["DrogasCantdescript"].ToString();
                        }
                        Paciente.ActFCant = reader["Habito_Act_Fisica"].ToString();
                        if (Paciente.ActFCant != "No")
                        {
                            Paciente.ActFCant         = reader["ActFCant"].ToString();
                            Paciente.ActFCantDescript = reader["ActFcantDescript"].ToString();
                        }
                        Paciente.Medicamento_Alergia = reader["Med_alergia"].ToString();
                        Paciente.Alimento_Alergia    = reader["Alimentos_alergia"].ToString();
                        Paciente.Lentes         = reader["Lentes"].ToString();
                        Paciente.Audifonos      = reader["Audifonos"].ToString();
                        Paciente.Protesis       = reader["Protesis"].ToString();
                        Paciente.Plantillas     = reader["Plantillas_Ortopedica"].ToString();
                        Paciente.Medicamentos   = reader["Medicamentos"].ToString();
                        Paciente.TipoAccidente  = reader["TipoAccidente"].ToString();
                        Paciente.polvo          = reader["polvo"].ToString();
                        Paciente.impacto        = reader["impacto"].ToString();
                        Paciente.permanente     = reader["permanente"].ToString();
                        Paciente.solvente       = reader["solvente"].ToString();
                        Paciente.mmc            = reader["mmc"].ToString();
                        Paciente.sefp           = reader["sefp"].ToString();
                        Paciente.asmagenos      = reader["asmagenos"].ToString();
                        Paciente.calor          = reader["calor"].ToString();
                        Paciente.ionizante      = reader["ionizante"].ToString();
                        Paciente.metales        = reader["metales"].ToString();
                        Paciente.humo           = reader["humo"].ToString();
                        Paciente.electromag     = reader["electromag"].ToString();
                        Paciente.riesgos        = reader["riesgos"].ToString();
                        Paciente.Intervenciones = reader["Intervenciones_quirurgicas"].ToString();
                        Paciente.Enfermedad     = reader["Enfermedad_Importante"].ToString();
                        Paciente.Dermatitis     = reader["Dermatitis"].ToString();
                        Paciente.Varices        = reader["Varices"].ToString();
                        Paciente.Epilepsia      = reader["Epilepsia"].ToString();
                        Paciente.Sueño          = reader["Transtorno_Sueño"].ToString();
                        Paciente.Sangre         = reader["Alteraciones_Sangre"].ToString();
                        Paciente.Neumonia       = reader["Neumonia"].ToString();
                        Paciente.Bronquitis     = reader["Bronquitis_Cronica"].ToString();
                        Paciente.Ulceras        = reader["Ulceras_Gastricas"].ToString();
                        Paciente.TBC            = reader["TBC"].ToString();
                        Paciente.Hepatitis      = reader["Hepatitis"].ToString();
                        Paciente.Asma           = reader["Asma"].ToString();
                        Paciente.Diabetes       = reader["Diabetes_Mellitus"].ToString();
                        Paciente.Fiebre         = reader["Fiebre_Tofoidea"].ToString();
                        Paciente.Hipertension   = reader["Hipertension_Arterial"].ToString();
                        Paciente.Lumbalgias     = reader["Lumbalgias"].ToString();
                        Paciente.Tendinitis     = reader["Tendinitis"].ToString();
                        Paciente.Observacion    = reader["Observacion"].ToString();

                        Paciente.Nombre          = reader["Diagnostico_Tratamiento"].ToString();             //Diagnostico_Tratamiento
                        Paciente.Rut             = reader["Diagnostico_Recomendacion"].ToString();           //Diagnostico_Recomendacion
                        Paciente.FechaNacimiento = Convert.ToDateTime(reader["FechaMamografia"].ToString()); //FechaMamografia
                        Paciente.FechaIngreso    = Convert.ToDateTime(reader["FechaPap"].ToString());        //FechaPap
                        Paciente.NombreSeg       = reader["PresionArterial"].ToString();                     //PresionArterial
                        Paciente.ApellidoPaterno = reader["Laboratorio"].ToString();                         //Laboratorio
                        Paciente.ApellidoMaterno = reader["Examen_CabezaCuello"].ToString();                 //Examen_CabezaCuello
                        Paciente.Cargo           = reader["Examen_Torax"].ToString();                        //Examen_Torax
                        Paciente.CentroCosto     = reader["Examen_Abdomen"].ToString();                      //Examen_Abdomen
                        Paciente.Telefono        = reader["Examen_Urogenital"].ToString();                   //Examen_Urogenital
                        Paciente.Direccion       = reader["Examen_Extre_Sup"].ToString();                    //Examen_Extre_Sup
                        Paciente.Comuna          = reader["Examen_Extre_Inf"].ToString();                    //Examen_Extre_Inf
                        Paciente.Jornada         = reader["Examen_Columna"].ToString();                      //Examen_Columna
                        Paciente.EstadoCivil     = reader["Diagnostico_Comun"].ToString();                   //Diagnostico_Comun
                        Paciente.Sexo            = reader["Sexo"].ToString();
                        Paciente.Transporte      = reader["Diagnostico_Laboral"].ToString();                 //Diagnostico_Laboral
                        Paciente.Anexo           = reader["RxTorax"].ToString() + "*" + reader["RxOsea"].ToString() + "*" + reader["Rxcavidades"].ToString() + "*" + reader["TAC"].ToString() + "*" + reader["RNM"].ToString() + "*" + reader["EEG"].ToString() +
                                                   "*" + reader["ECG"].ToString() + "*" + reader["ECARDG"].ToString() + "*" + reader["EMG"].ToString() + "*" + reader["pulso"].ToString() + "*" + reader["peso"].ToString() + "*" + reader["Talla"].ToString();
                        Paciente.IDFichaMedica = Convert.ToInt32(reader["ID_Ficha"].ToString());
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(Paciente);
        }
        public List <StockxPeriodo> ListarStock(int Mes, int Año, string Informe)
        {
            List <StockxPeriodo> lista = new List <StockxPeriodo>();
            Conexion             con   = new Conexion();
            SqlCommand           cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "Adm_StockxPeriodo";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@Mes", Mes);
                    cmd.Parameters.AddWithValue("@Año", Año);
                    cmd.Parameters.AddWithValue("@Informe", Informe);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        StockxPeriodo stock = new StockxPeriodo();
                        stock.CodItem   = reader["CodItem"].ToString();
                        stock.Descricao = reader["Descricao"].ToString();
                        stock.Familia   = reader["Familia"].ToString();
                        if (Informe != "Insumos")
                        {
                            stock.SubFamilia = reader["Sub_Familia"].ToString();
                            stock.Altura     = reader["Altura"].ToString();
                            stock.Largura    = reader["Largura"].ToString();
                            stock.gramatura  = reader["gramatura"].ToString();
                        }
                        stock.CostoMedio   = reader["CostoMedio"].ToString();
                        stock.SaldoInicial = reader["SaldoInicial"].ToString();
                        stock.Compra       = reader["Compra"].ToString();
                        stock.PrecioCompra = reader["PrecioCompra"].ToString();
                        if (Informe != "Pliegos")
                        {
                            stock.SaldoTotalIngreso = reader["SaldoTotalIngreso"].ToString();
                        }
                        if (Informe != "Tintas")
                        {
                            stock.EgresoProceso      = reader["EgresoProceso"].ToString();
                            stock.ValorEgresoProceso = reader["ValorEgresoProceso"].ToString();
                        }
                        stock.ConsumoOT          = reader["ConsumoOT"].ToString();
                        stock.DevoluProceso      = reader["DevoluProceso"].ToString();
                        stock.SaldoFinal         = reader["SaldoFinal"].ToString();
                        stock.Inventarioinicial  = reader["Inventarioinicial"].ToString();
                        stock.ValorCompra        = reader["ValorCompra"].ToString();
                        stock.valorIngresoTotal  = reader["valorIngresoTotal"].ToString();
                        stock.ValorDevoluProceso = reader["ValorDevoluProceso"].ToString();
                        stock.ValorConsumoOT     = reader["ValorConsumoOT"].ToString();
                        stock.ValorFinalPesos    = reader["SaldoFinalPesos"].ToString();
                        if (Informe == "Bobinas")
                        {
                            stock.Egreso         = reader["Egreso"].ToString();
                            stock.Transformacion = reader["Transformacion"].ToString();
                            stock.Valor_Ajuste_Entrada_Egresos = reader["Valor_Ajuste_Entrada_Egresos"].ToString();
                            stock.Valor_Ajuste_Salida_Egresos  = reader["Valor_Ajuste_Salida_Egresos"].ToString();
                            stock.Valor_Financiero_Negativo    = reader["Ajuste_Financiero_Negativo"].ToString();
                            stock.Valor_financiero_Positivo    = reader["Ajuste_financiero_Positivo"].ToString();
                            stock.valorTransformacion          = reader["valorTransformacion"].ToString();
                        }
                        else if (Informe == "Pliegos")
                        {
                            stock.SaldoInicial_Kilos     = reader["SaldoInicial_Kilos"].ToString();
                            stock.Compra_En_Kilos        = reader["Compra_En_Kilos"].ToString();
                            stock.EgresoProceso_En_Kilos = reader["EgresoProceso_En_Kilos"].ToString();
                            stock.ConsumoOT_En_Kilos     = reader["ConsumoOT_En_Kilos"].ToString();
                            stock.DevoluProcesoKilos     = reader["DevoluProcesoKilos"].ToString();
                            stock.SaldoFinalKilos        = reader["SaldoFinalKilos"].ToString();
                        }
                        else if (Informe == "Insumos")
                        {
                            stock.Unidad = reader["UnidadeEst"].ToString();
                            stock.Mermas_Por_Conversion       = reader["Mermas_Por_Conversion"].ToString();
                            stock.Mermas_Por_Conversion_Pesos = reader["Mermas_Por_Conversion_Pesos"].ToString();
                        }

                        lista.Add(stock);
                    }
                }
                catch
                {
                }
            }
            return(lista);
        }
        //cargar datos Existencia
        public List <Inf_Enc> CargarExistencia(string OT, string NombreOT, string Cliente, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            List <Inf_Enc> lista = new List <Inf_Enc>();

            Conexion   conexion = new Conexion();
            SqlCommand cmd      = conexion.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[Desp_Existencia]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@NombreOT", NombreOT);
                cmd.Parameters.AddWithValue("@Cliente", Cliente);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 30000000;
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Inf_Enc pro = new Inf_Enc();
                    pro.OT       = reader["OT"].ToString();
                    pro.NombreOT = reader["NombreOT"].ToString();

                    int ti = Convert.ToInt32(reader["TirajeTotal"].ToString());
                    pro.Tiraje = ti.ToString("N0").Replace(",", ".");


                    int reci = Convert.ToInt32(reader["TotalRecepcionado"].ToString()) - Convert.ToInt32(reader["Devolucion4"].ToString());
                    pro.RecibidoQGChile = reci.ToString("N0").Replace(",", ".");



                    int desp = Convert.ToInt32(reader["TotalDespachado"].ToString());// - Convert.ToInt32(reader["Devolucion4"].ToString()
                    pro.DespachoEnc = desp.ToString("N0").Replace(",", ".");

                    int dev = Convert.ToInt32(reader["Devolucion"].ToString());
                    pro.id_ProductosTerminados = dev.ToString("N0").Replace(",", ".");

                    //neuvos
                    int mues = Convert.ToInt32(reader["Muestras"].ToString());
                    pro.Muestras = mues.ToString("N0").Replace(",", "."); //reader["Muestras"].ToString();

                    int sobr = Convert.ToInt32(reader["Sobrantes"].ToString());
                    pro.Sobrante = sobr.ToString("N0").Replace(",", "."); //reader["Sobrantes"].ToString();
                    //nuevos
                    int sald = reci - desp;                               //Convert.ToInt32(reader["Existencia"].ToString());
                    pro.Saldo = sald.ToString("N0").Replace(",", ".");



                    int restante = (ti - (desp - dev));

                    if (reader["Estado"].ToString() == "1")
                    {
                        if (restante <= 0)//(tirajeot - (despachado - devuelto)
                        {
                            pro.Terminacion = "<div style='Color:Red;'>Por Liquidar</div>";
                        }
                        else
                        {
                            pro.Terminacion = "<div style='Color:Blue;'>En Proceso</div>";
                        }
                    }
                    else
                    {
                        pro.Terminacion = "<div style='Color:Green;'>Liquidada</div>";
                    }

                    //if (ti <= desp)//Convert.ToInt32(reader["TirajeTotal"].ToString())-Convert.ToInt32(reader["TotalDespachado"].ToString())
                    //{
                    //    pro.Terminacion = "<div style='Color:Red;'>Por Liquidar</div>";

                    //}
                    //else
                    //{
                    //    pro.Terminacion = "<div style='Color:Blue;'>En Proceso</div>";
                    //}
                    lista.Add(pro);
                }
            }
            conexion.CerrarConexion();
            return(lista);
        }
Пример #8
0
        public string ConsumoPapel(DateTime FI, DateTime FT)
        {
            #region Encabezado;
            string Encabezado = "<table id='tblRegistro' runat='server' cellspacing='0' cellpadding='0' style='border: 1px solid #CCC; margin: 0 auto; margin-top: 0px; margin-bottom: 15px; width:1528px;margin-left:3px;'>" +
                                "<tbody><tr style='height: 22px; background: #f3f4f9; font: 11px Arial, Helvetica, sans-serif; color: #003e7e; text-align: left;'>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:88px;'>OT</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:240px;'>Nombre OT</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Bobina</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>SKU</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:360px;'>Material</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Alto</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Ancho</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Gramaje</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:90px;'>Cantidad</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:40px;'>Unidad</td>" +
                                //"<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>Valor</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:250px;'>Operacion</td>" +
                                //"<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:cs enter;width:110px;'>Fecha</td>" +
                                "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Usuario</td>" +
                                "</tr>";
            string Contenido = ""; int Contador = 1; string Color = "";
            #endregion ;
            Conexion   conexion = new Conexion();
            SqlCommand cmd      = conexion.AbrirConexionIntranet();
            try
            {
                if (cmd != null)
                {
                    cmd.CommandText = "[Correo_Transacciones_Papel]";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FechaInicio", FI);
                    cmd.Parameters.AddWithValue("@FechaTermino", FT);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Color = ((Contador % 2) == 0 ? "#f3f4f9" : "#fff");

                        Contenido = Contenido + "<tr style='height: 22px; background: " + Color + "; font: 11px Arial, Helvetica, sans-serif; color: #333;  vertical-align: text-top;'>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:88px;'>" +
                                    reader["Numordem"].ToString().ToLower() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:82px;'>" +
                                    reader["Descricao"].ToString().ToLower() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                    reader["idBobina"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:60px;'>" +
                                    reader["ExtRef"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:360px;'>" +
                                    reader["Material"].ToString().ToLower() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>" +
                                    reader["Height"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:50px;'>" +
                                    reader["Width"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:50px;'>" +
                                    reader["Gramaje"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:90px;'>" +
                                    Convert.ToDouble(reader["Consumo"].ToString()).ToString("N2") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:40px;'>" +
                                    reader["UnidadeEst"].ToString() + "</td>" +
                                    //"<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:80px;'>" +
                                    //Convert.ToDouble(reader["valor"].ToString()).ToString("N2") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:250px;'>" +
                                    reader["Name"].ToString().ToLower() + "</td>" +
                                    //"<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:110px;'>" +
                                    //Convert.ToDateTime(reader["DtExecucao"].ToString()).ToString("dd/MM/yyyy HH:mm") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                    reader["InsUser"].ToString() + "</td>" +
                                    "</tr>";
                        Contador++;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            conexion.CerrarConexion();
            return(Encabezado + Contenido + "</tbody></table>");
        }
Пример #9
0
        public List <PartesMetrics> Lista_Resumen_PartesManualesDiario(string Maquina, DateTime fechainicio, DateTime fechatermino, int procedimiento)
        {
            Conexion             con   = new Conexion();
            List <PartesMetrics> lista = new List <PartesMetrics>();
            SqlCommand           cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[IngresoPartes_ResumenPartesDiario]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@MAQUINA", Maquina);
                cmd.Parameters.AddWithValue("@FECHAINICIO", fechainicio);
                cmd.Parameters.AddWithValue("@FECHATERMINO", fechatermino);
                cmd.Parameters.AddWithValue("@PROCEDIMIENTO", procedimiento);

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    PartesMetrics p = new PartesMetrics();
                    p.Semana  = Convert.ToDateTime(reader["Semana"].ToString()).ToString("dd/MM/yyyy");
                    p.Maquina = reader["Maquina"].ToString();

                    if (reader["Maquina"].ToString() == "C150")
                    {
                        p.GirosBuenosTiraje       = reader["Buenos"].ToString();
                        p.Buenos                  = BuenosFactor(Convert.ToDateTime(reader["Semana"].ToString()));
                        p.PliegosMalosPreparacion = MalosPreparacionFactor(Convert.ToDateTime(reader["Semana"].ToString()));
                        p.PliegosMalosTiraje      = MalosTirajeFactor(Convert.ToDateTime(reader["Semana"].ToString()));
                    }
                    else
                    {
                        p.Buenos                  = Convert.ToInt32(reader["Buenos"].ToString()).ToString();
                        p.GirosBuenosTiraje       = Convert.ToInt32(reader["Buenos"].ToString()).ToString();
                        p.PliegosMalosPreparacion = Convert.ToInt32(reader["PliegosMalosPreparacion"].ToString()).ToString();
                        p.PliegosMalosTiraje      = Convert.ToInt32(reader["PliegosMalosTiraje"].ToString()).ToString();
                    }
                    p.Entradas = reader["Entradas"].ToString();
                    TimeSpan time  = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasTiraje"].ToString()));
                    TimeSpan time2 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasImproductivas"].ToString()));
                    TimeSpan time3 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()));
                    TimeSpan time4 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinTrabajo"].ToString()));
                    TimeSpan time5 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinPersonal"].ToString()));
                    TimeSpan time6 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasMantencion"].ToString()));
                    #region Minutos
                    string minutos = "";
                    if (time.Minutes > 9)
                    {
                        minutos = time.Minutes.ToString();
                    }
                    else
                    {
                        minutos = "0" + time.Minutes;
                    }
                    string minutos2 = "";
                    if (time2.Minutes > 9)
                    {
                        minutos2 = time2.Minutes.ToString();
                    }
                    else
                    {
                        minutos2 = "0" + time2.Minutes;
                    }
                    string minutos3 = "";
                    if (time3.Minutes > 9)
                    {
                        minutos3 = time3.Minutes.ToString();
                    }
                    else
                    {
                        minutos3 = "0" + time3.Minutes;
                    }
                    string minutos4 = "";
                    if (time4.Minutes > 9)
                    {
                        minutos4 = time4.Minutes.ToString();
                    }
                    else
                    {
                        minutos4 = "0" + time4.Minutes;
                    }
                    string minutos5 = "";
                    if (time5.Minutes > 9)
                    {
                        minutos5 = time5.Minutes.ToString();
                    }
                    else
                    {
                        minutos5 = "0" + time5.Minutes;
                    }
                    string minutos6 = "";
                    if (time6.Minutes > 9)
                    {
                        minutos6 = time6.Minutes.ToString();
                    }
                    else
                    {
                        minutos6 = "0" + time6.Minutes;
                    }
                    #endregion
                    #region Tiempo
                    //
                    string segundos = "";
                    if (time.Seconds > 9)
                    {
                        segundos = time.Seconds.ToString();
                    }
                    else
                    {
                        segundos = "0" + time.Seconds;
                    }
                    string segundos2 = "";
                    if (time2.Seconds > 9)
                    {
                        segundos2 = time2.Seconds.ToString();
                    }
                    else
                    {
                        segundos2 = "0" + time2.Seconds;
                    }
                    string segundos3 = "";
                    if (time3.Seconds > 9)
                    {
                        segundos3 = time3.Seconds.ToString();
                    }
                    else
                    {
                        segundos3 = "0" + time3.Seconds;
                    }
                    string segundos4 = "";
                    if (time4.Seconds > 9)
                    {
                        segundos4 = time4.Seconds.ToString();
                    }
                    else
                    {
                        segundos4 = "0" + time4.Seconds;
                    }
                    string segundos5 = "";
                    if (time5.Seconds > 9)
                    {
                        segundos5 = time5.Seconds.ToString();
                    }
                    else
                    {
                        segundos5 = "0" + time5.Seconds;
                    }
                    string segundos6 = "";
                    if (time6.Seconds > 9)
                    {
                        segundos6 = time6.Seconds.ToString();
                    }
                    else
                    {
                        segundos6 = "0" + time6.Seconds;
                    }



                    if (time.Days > 0)
                    {
                        p.HorasTiraje = ((time.Days * 24) + time.Hours) + ":" + minutos + ":" + segundos;
                    }
                    else
                    {
                        p.HorasTiraje = time.Hours + ":" + minutos + ":" + segundos;
                    }


                    if (time2.Days > 0)
                    {
                        p.HorasImproductivas = ((time2.Days * 24) + time2.Hours) + ":" + minutos2 + ":" + segundos2;
                    }
                    else
                    {
                        p.HorasImproductivas = time2.Hours + ":" + minutos2 + ":" + segundos2;
                    }

                    if (time3.Days > 0)
                    {
                        p.HorasPreparacion = ((time3.Days * 24) + time3.Hours) + ":" + minutos3 + ":" + segundos3;
                    }
                    else
                    {
                        p.HorasPreparacion = time3.Hours + ":" + minutos3 + ":" + segundos3;
                    }

                    if (time4.Days > 0)
                    {
                        p.HorasSinTrabajo = ((time4.Days * 24) + time4.Hours) + ":" + minutos4 + ":" + segundos4;
                    }
                    else
                    {
                        p.HorasSinTrabajo = time4.Hours + ":" + minutos4 + ":" + segundos4;
                    }

                    if (time5.Days > 0)
                    {
                        p.HorasSinPersonal = ((time5.Days * 24) + time5.Hours) + ":" + minutos5 + ":" + segundos5;
                    }
                    else
                    {
                        p.HorasSinPersonal = time5.Hours + ":" + minutos5 + ":" + segundos5;
                    }


                    if (time6.Days > 0)
                    {
                        p.HorasMantencion = ((time6.Days * 24) + time6.Hours) + ":" + minutos6 + ":" + segundos6;
                    }
                    else
                    {
                        p.HorasMantencion = time6.Hours + ":" + minutos6 + ":" + segundos6;
                    }
                    #endregion

                    //p.PliegosMalosPreparacion = Convert.ToInt32(reader["PliegosMalosPreparacion"].ToString()).ToString();
                    //p.PliegosMalosTiraje = Convert.ToInt32(reader["PliegosMalosTiraje"].ToString()).ToString();

                    lista.Add(p);
                }
            }
            con.CerrarConexion();
            return(lista);
        }
Пример #10
0
        public string listarMensaje_referencia(string OT, string username, int procedimiento)
        {
            string     resultado     = "";
            Conexion   con           = new Conexion();
            SqlCommand cmd           = con.AbrirConexionIntranet();
            string     nombreCreador = "";
            string     fecha         = "";
            int        contador      = 0;

            if (cmd != null)
            {
                cmd.CommandText = "Mensajeria_ListarMensaje";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    contador++;
                    Mail m = new Mail();
                    m.IDMail = Convert.ToInt32(reader["IDMail"].ToString());
                    Boolean nuevo = MarcarNew(m.IDMail, username);
                    m.Asunto         = reader["Asunto"].ToString();
                    m.Fecha_Creacion = Convert.ToDateTime(reader["Fecha_Creacion"].ToString());
                    string   nombc = reader["creadoPor"].ToString();
                    string[] str   = nombc.Split(' ');
                    nombreCreador = str[0] + " " + str[2];

                    DateTime thedate = DateTime.Parse(reader["Fecha_Creacion"].ToString());
                    Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
                    fecha = string.Format("{0:f}", thedate);
                    try
                    {
                        m.Asunto = m.Asunto.Substring(0, 106) + "...";
                    }
                    catch
                    {
                    }
                    string newm = "";
                    if (nuevo)
                    {
                        newm = "<td><label style='margin-left:-15px;font-size: 14px;margin-top:-5px;'>" + contador.ToString() + "</label>&nbsp;&nbsp;<img src='../../Images/icononew.jpg' width='25px' height='25px' style='padding-top:-4px;border-radius: 45px 45px 45px 45px;' /></td>";
                    }
                    else
                    {
                        newm = "<td><label style='margin-left:-15px;font-size: 14px;margin-top:-5px;'>" + contador.ToString() + "</label>&nbsp;&nbsp;<img src='../../Images/iconopersona.png' width='25px' height='25px' style='padding-top:-4px;' /></td>";
                    }
                    List <Archivo> lista   = CargarClip(m.IDMail);
                    string         clip    = "";
                    string         visible = "hidden";
                    foreach (Archivo a in lista)
                    {
                        clip    = clip + "<p><div style='border-top: 1px solid #d0d0d0;width:40%;'></div><img src='../../Images/iconoDescarga.png' width='20px' height='20px' />  " + a.Nombre + " <a style='color:Blue; text-decoration: underline;' href='../../ModuloUsuario/View/Downloader.aspx?guid=" + a.Archivos + "'>Descargar</a></p>";
                        visible = "visible";
                    }
                    string colorFondoTitulo = "";
                    if (reader["tipoMensaje"].ToString() == "Requerir Información")
                    {
                        colorFondoTitulo = "background:#E4D10E;";
                    }
                    else
                    {
                        colorFondoTitulo = "background:#A3DA87;";
                    }
                    resultado = resultado + " <div class='mailRevisido' id='acco' style='padding-top:5px;' >" +

                                "<h3 style='width:1060px;height:35px;" + colorFondoTitulo + "' class='ui-helper-reset ui-state-default ui-corner-top ui-state-hover ui-accordion-icons ui-widget-content'>" +
                                "<table style='margin-left:20px;'>" +
                                "<tr><td>" +
                                "" + newm + "" +
                                "<td style='width: 760px;'>&nbsp;&nbsp;<label style='font-weight:bold;color:black;'>Asunto:</label><label style='font-weight:bold;color:blue;'>" + reader["NombreCat"].ToString() + " - " + reader["Asunto"].ToString() +
                                "</label><br />&nbsp;&nbsp;Creado por:<label style='font-weight:bold;'> " + nombreCreador + " - " + reader["CentroCosto"].ToString() + "</label>. &nbsp;&nbsp;&nbsp;&nbsp;" + fecha + " </td>" +
                                "<td><a title='Existen Documentos Adjuntos'>" +
                                "<img width='25px' height='25px' src='../../Images/PaperClip3_Black.png' style='visibility:" + visible + "'/></a></td>" +
                                "<td></td>" +
                                "</tr></table></h3>" +
                                "<div id='ui-accordion-acco-panel-0' class='ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom'  style='width:1060px;'>" +
                                "<p><label style='padding-left:5px;padding-right:5px;font-weight:bold;'>" + reader["Comentario"].ToString() + "</label></p>" +
                                "<p>" + clip + "</p>" +
                                "</div></div>";
                }
            }
            con.CerrarConexion();
            return(resultado);
        }
        public List <BodegaPliegos> OPSCreadas(string ot, string nombreot, string nombrepapel, string codigopapel, DateTime fechainicio, DateTime fechatermino, int estado, string usuario, int procedimiento)
        {
            List <BodegaPliegos> lista = new List <BodegaPliegos>();
            Conexion             con   = new Conexion();
            SqlCommand           cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "BodegaPliegos_OPSCreadas";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@NombreOT", nombreot);
                cmd.Parameters.AddWithValue("@NombrePapel", nombrepapel);
                cmd.Parameters.AddWithValue("@CodigoPapel", codigopapel);
                cmd.Parameters.AddWithValue("@FechaInicio", fechainicio);
                cmd.Parameters.AddWithValue("@FechaTermino", fechatermino);
                cmd.Parameters.AddWithValue("@Estado", estado);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                cmd.CommandTimeout = 99999999;
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    BodegaPliegos d = new BodegaPliegos();
                    d.FechaCreacion = Convert.ToDateTime(reader["FechaCreacion"].ToString()).ToString("dd/MM/yyyy");
                    d.OT            = reader["OT"].ToString();
                    d.NombreOT      = reader["NombreOT"].ToString().ToLower();
                    d.Componente    = reader["Componente"].ToString();
                    d.Papel         = reader["NombrePapel"].ToString();
                    //d.FormatoPapel = reader["FormatoPapel"].ToString();
                    d.Gramaje      = reader["Gramaje"].ToString();
                    d.Ancho        = reader["Ancho"].ToString();
                    d.Largo        = reader["Largo"].ToString();
                    d.SolicitadoFL = Convert.ToInt32(reader["ConsumoPL"].ToString()).ToString("N0").Replace(",", ".");
                    d.SolicitadoKG = Convert.ToInt32(reader["ConsumoKG"].ToString()).ToString("N0").Replace(",", ".");

                    d.Accion = "<a style='Color:Blue;text-decoration:none;cursor:pointer;' href='javascript:Solicitud(\"" + d.OT + "\",\"" + d.Componente + "\",\"" + reader["ConsumoPL"].ToString() + "\",\"" + reader["ConsumoKG"].ToString() + "\",\"" + usuario + "\");'>Procesar</a>";

                    d.Procesado = Convert.ToInt32(reader["AsignadoPL"].ToString()).ToString("N0").Replace(",", ".");
                    int soliFL = Convert.ToInt32(reader["ConsumoPL"].ToString());
                    int asigFL = Convert.ToInt32(reader["AsignadoPL"].ToString());
                    if (asigFL > 0)
                    {
                        if (soliFL > asigFL)
                        {
                            d.Estado = "<div style='color:DarkOrange;'>Parcialmente Atendida</div>";
                        }
                        else
                        {
                            d.Estado = "<div style='color:Green;'>Atendida</div>";
                        }
                    }
                    else
                    {
                        d.Estado = "<div style='color:red;'>Sin Atender</div>";
                    }

                    lista.Add(d);
                }
            }
            con.CerrarConexion();
            return(lista);
        }
Пример #12
0
        public string CargarRespuestaIntentoImprimir(int IdMail, int numero)
        {
            string     respuesta     = "";
            string     nombreCreador = "";
            string     fecha         = "";
            int        contadorResp  = 0;
            Conexion   con           = new Conexion();
            SqlCommand cmd           = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "ListarRespuesta";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IDMail", IdMail);
                SqlDataReader reader   = cmd.ExecuteReader();
                int           contador = 0;
                while (reader.Read())
                {
                    contadorResp++;
                    List <Archivo> list      = CargarRespAdjunta(Convert.ToInt32(reader["IDRespuesta"].ToString()));
                    string         sentencia = "";
                    string         nombc     = reader["creadoPor"].ToString();
                    string[]       str       = nombc.Split(' ');
                    nombreCreador = str[0] + " " + str[2];

                    DateTime fech = Convert.ToDateTime(reader["FechaCreacion"].ToString());
                    fecha = string.Format("{0:f}", fech);

                    foreach (Archivo ar in list)
                    {
                        sentencia = sentencia + "<p><div style='border-top: 1px solid #d0d0d0;width:50%;'>" + "<p><img src='../../Images/iconoDescarga.png' width='20px' height='20px' />  " + ar.Nombre + " <a style='color:Blue; text-decoration: underline;' href='../../ModuloUsuario/View/Downloader.aspx?guid=" + ar.Archivos + "'>Descargar</a></p>" + "</div></p>";
                    }

                    respuesta = respuesta +


                                "<div class='mailRevisido' style='width:400px;padding-left:50px;padding-top:5px;'>" +
                                "<h3 style='width:810px;' class='ui-helper-reset ui-state-default ui-corner-top ui-state-hover ui-accordion-icons ui-widget-content'>" +
                                " <table style='margin-left:20px;'>" +
                                "<tr>" +
                                "<td>" +
                                "<label style='margin-left:-15px;font-size: 16px;'>" + numero + "." + contadorResp + "</label>&nbsp;&nbsp;<img src='../../Images/iconopersona.png' width='25px' height='25px' style='padding-top:-4px;' /></td>" +
                                "<td style='width: 600px;'>&nbsp;&nbsp;<label style='font-weight:bold;color:blue;'>" + reader["Asunto"].ToString() + "</label><br />&nbsp;&nbsp;<label style='font-weight:bold;'>Creado por: " + nombreCreador + ".</label> &nbsp;&nbsp;&nbsp;&nbsp;" + fecha + " </td>" +
                                "<td></td>" +
                                "<td></td>" +

                                "</tr>" +
                                "</table>" +
                                "</h3>" +
                                "<div id='ui-accordion-acco-panel-0' class='ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom'  style='width:810px;'>" +

                                "<p><label style='padding-left:5px;padding-right:5px;'>" + reader["Comentario"].ToString() + "</label></p>" +

                                "<p>" + sentencia + "</p>" +

                                "</div>" +
                                " </div> ";


                    contador = contador++;
                }

                con.CerrarConexion();
            }
            return(respuesta);
        }
Пример #13
0
        public string listarMensajesintentoImprimir(string OT, string username, int procedimiento)
        {
            string     resultado     = "";
            Conexion   con           = new Conexion();
            SqlCommand cmd           = con.AbrirConexionIntranet();
            string     nombreCreador = "";
            string     fecha         = "";
            int        contador      = 0;

            if (cmd != null)
            {
                cmd.CommandText = "ListarMensajesOT";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    contador++;
                    Mail m = new Mail();
                    m.IDMail = Convert.ToInt32(reader["IDMail"].ToString());
                    Boolean nuevo = MarcarNew(m.IDMail, username);
                    MarcarLeido(m.IDMail, username);
                    m.Asunto         = reader["Asunto"].ToString();
                    m.Fecha_Creacion = Convert.ToDateTime(reader["Fecha_Creacion"].ToString());
                    string   nombc = reader["creadoPor"].ToString();
                    string[] str   = nombc.Split(' ');
                    nombreCreador = str[0] + " " + str[2];

                    //DateTime fech = Convert.ToDateTime(reader["Fecha_Creacion"].ToString());


                    DateTime thedate = DateTime.Parse(reader["Fecha_Creacion"].ToString());
                    Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
                    fecha = string.Format("{0:f}", thedate);
                    try
                    {
                        m.Asunto = m.Asunto.Substring(0, 106) + "...";
                    }
                    catch
                    {
                    }
                    string newm = "";
                    if (nuevo)
                    {
                        //  newm = "<td><label style=''>" + contador.ToString() + "</label>&nbsp;<img src='../../Images/icononew.jpg' width='25px' height='25px' style='padding-top:-4px;border-radius: 45px 45px 45px 45px;' /></td>";
                        newm = "<td><label style='margin-left:-15px;font-size: 16px;'>" + contador.ToString() + "</label>&nbsp;&nbsp;<img src='../../Images/iconopersona.png' width='25px' height='25px' style='padding-top:-4px;' /></td>";
                    }
                    else
                    {
                        newm = "<td><label style='margin-left:-15px;font-size: 16px;'>" + contador.ToString() + "</label>&nbsp;&nbsp;<img src='../../Images/iconopersona.png' width='25px' height='25px' style='padding-top:-4px;' /></td>";
                    }
                    List <Archivo> lista   = CargarClip(m.IDMail);
                    string         clip    = "";
                    string         visible = "hidden";
                    foreach (Archivo a in lista)
                    {
                        clip    = clip + "<p><div style='border-top: 1px solid #d0d0d0;width:40%;'></div><img src='../../Images/iconoDescarga.png' width='20px' height='20px' />  " + a.Nombre + " <a style='color:Blue; text-decoration: underline;' href='../../ModuloUsuario/View/Downloader.aspx?guid=" + a.Archivos + "'>Descargar</a></p>";
                        visible = "visible";
                    }
                    resultado = resultado + " <div class='mailRevisido' id='acco' style='padding-top:5px;' >" +

                                "<h3 style='width:861px;height:35px;' class='ui-helper-reset ui-state-default ui-corner-top ui-state-hover ui-accordion-icons ui-widget-content'>" +
                                "<table style='margin-left:20px;'>" +
                                "<tr>" +
                                "<td>" +
                                "" + newm + "" +
                                //"<img src='../../Images/iconopersona.png' width='25px' height='25px' style='padding-top:-4px;' /></td>" +

                                "<td style='width: 650px;'>&nbsp;&nbsp;<label style='font-weight:bold;color:blue;'>Asunto: " + reader["Asunto"].ToString() + "</label><br />&nbsp;&nbsp;Creado por:<label style='font-weight:bold;'> " + nombreCreador + "</label>. &nbsp;&nbsp;&nbsp;&nbsp;" + fecha + " </td>" +
                                "<td><a title='Existen Documentos Adjuntos'>" +
                                "<img width='25px' height='25px' src='../../Images/PaperClip3_Black.png' style='visibility:" + visible + "'/></a></td>" +
                                "<td></td>" +//<a onclick='javascript:newRespuesta(" + reader["IDMail"].ToString() + ")'><img src='../../Images/responder-icon.png' /> </a>
                                "</tr>" +
                                "</table>" +
                                "</h3>" +
                                "<div id='ui-accordion-acco-panel-0' class='ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom'  style='width:861px;'>" +
                                "<p><label style='padding-left:5px;padding-right:5px;'>" + reader["Comentario"].ToString() + "</label></p>" +
                                //"<p>Esta autorizado por cliente para reimprimir tapas de guia san pedro con nuevos archivos, mismo tiraje. Urgente, modificar OT. Servicio con cargo a cliente. asdasd asdasdasdasd asdasda asdas as </p>" +
                                "<p>" + clip + "</p>" +
                                "</div></div>" +
                                "" + CargarRespuestaIntentoImprimir(Convert.ToInt32(reader["IDMail"].ToString()), Convert.ToInt32(contador.ToString())) + "";

                    //"<div style='width:819px;'><p> Creado por : " + reader["Creado"].ToString() + "</p>" +
                    //"<p>" + reader["Comentario"].ToString() + "</p>" +
                    //"<p></p>" +
                    //"<p><div style='border-top: 1px solid #d0d0d0;width:40%;'>" + clip + "</div></p>" +
                    //"<div style='overflow:auto;width:800;height:200px;'>" + CargarRespuesta(Convert.ToInt32(reader["IDMail"].ToString())) + "</div></div>";
                }
                //resultado = resultado + "</div>";
                con.CerrarConexion();
            }
            return(resultado);
        }
        public List <FechasDistribucion> ListarDespachosaEntregar(string Ot, string NombreOT, string Cliente, string fechaInicio, string fechaFin)
        {
            List <FechasDistribucion> lista = new List <FechasDistribucion>();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "Desp_InfomeDespFuturo2";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OT", Ot);
                    cmd.Parameters.AddWithValue("@NombreOT", NombreOT);
                    cmd.Parameters.AddWithValue("@Cliente", Cliente);
                    cmd.Parameters.AddWithValue("@FechaInicio", fechaInicio);
                    cmd.Parameters.AddWithValue("@FechaTermino", fechaFin);
                    SqlDataReader read = cmd.ExecuteReader();

                    string OT            = "";
                    int    Solicitada    = 0;
                    int    CantidadTotal = 0;
                    while (read.Read())
                    {
                        FechasDistribucion des = new FechasDistribucion();
                        des.OT              = read["OT"].ToString();
                        des.NombreOT        = read["NombreOT"].ToString();
                        des.Cliente         = read["Cliente"].ToString();
                        des.Tiraje          = read["tirajeOT"].ToString();                                                          //tiraje
                        des.TotalDespachado = Convert.ToInt32(read["TotalDespachado"].ToString()).ToString("N0").Replace(",", "."); //total despachado

                        if (OT != des.OT)
                        {
                            OT            = des.OT;
                            CantidadTotal = Convert.ToInt32(read["TotalDespachado"].ToString());
                        }

                        Solicitada         = Convert.ToInt32(read["TirajeSolicitado"].ToString());
                        des.TirajeGenerado = Solicitada.ToString("N0").Replace(",", ".");
                        int result = CantidadTotal - Solicitada;
                        if (result >= 0)
                        {
                            des.tirajeAcumulado = Solicitada.ToString("N0").Replace(",", ".");
                            CantidadTotal       = result;
                            des.Despachado      = "<img src='../../Content/images/Barra%20Valoracion/bar90.gif' />100%";
                        }
                        if (result < 0)
                        {
                            des.tirajeAcumulado = CantidadTotal.ToString("N0").Replace(",", ".");
                            try
                            {
                                int porcentaje = ((CantidadTotal * 100) / Solicitada);
                                if (porcentaje < 10)
                                {
                                    des.Despachado = porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 10 && porcentaje < 20)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar00.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 20 && porcentaje < 30)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar10.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 30 && porcentaje < 40)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar20.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 40 && porcentaje < 50)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar30.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 50 && porcentaje < 60)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar40.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 60 && porcentaje < 70)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar50.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 70 && porcentaje < 80)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar60.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 80 && porcentaje < 90)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar70.gif' />" + porcentaje.ToString() + "%";
                                }
                                if (porcentaje >= 90 && porcentaje < 100)
                                {
                                    des.Despachado = "<img src='../../Content/images/Barra%20Valoracion/bar80.gif' />" + porcentaje.ToString() + "%";
                                }
                                CantidadTotal = 0;
                            }
                            catch
                            {
                                des.Despachado = "ERROR";
                            }
                        }

                        DateTime fi = Convert.ToDateTime(fechaInicio);
                        DateTime ft = Convert.ToDateTime(fechaFin);
                        DateTime fp = Convert.ToDateTime(read["FechaProduccion"].ToString());
                        des.FechaDes = fp.ToString("dd-MM-yyyy HH:mm:ss");
                        if (fi <= fp & ft >= fp)
                        {
                            lista.Add(des);
                        }
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(lista);
        }
        public List <InformeSemanal> ListaInformeDiarioEncuadernacion(string Area, string Maquina, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            List <InformeSemanal> lista = new List <InformeSemanal>();
            Conexion   conexion         = new Conexion();
            SqlCommand cmd = conexion.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Produccion_InformePorSemana";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Area", Area);
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 99999999;
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    InformeSemanal p = new InformeSemanal();
                    p.Dia     = Convert.ToDateTime(reader["Dia"].ToString()).ToString("dd/MM/yyyy");
                    p.Maquina = reader["CodRecurso"].ToString();
                    p.Noche   = Convert.ToInt32(reader["TurnoNoche"].ToString()).ToString("N0").Replace(",", ".");
                    double noche = Convert.ToDouble(reader["TurnoNoche"].ToString());
                    double total = Convert.ToDouble(reader["TotalDia"].ToString());
                    if (noche > 0)
                    {
                        p.PorcNoche = "<b>" + Convert.ToDouble((noche / total) * 100).ToString("N2") + " %" + "</b>";
                    }
                    else
                    {
                        p.PorcNoche = "<b>0,00 %</b>";
                    }
                    double mañana = Convert.ToDouble(reader["TurnoDia"].ToString());
                    p.Mañana = Convert.ToInt32(reader["TurnoDia"].ToString()).ToString("N0").Replace(",", ".");
                    if (mañana > 0)
                    {
                        p.PorcMañana = "<b>" + Convert.ToDouble((mañana / total) * 100).ToString("N2") + " %" + "</b>";
                    }
                    else
                    {
                        p.PorcMañana = "<b>0,00 %</b>";
                    }

                    double tarde = Convert.ToDouble(reader["TurnoTarde"].ToString());
                    p.Tarde = Convert.ToInt32(reader["TurnoTarde"].ToString()).ToString("N0").Replace(",", ".");
                    if (tarde > 0)
                    {
                        p.PorcTarde = "<b>" + Convert.ToDouble((tarde / total) * 100).ToString("N2") + " %" + "</b>";
                    }
                    else
                    {
                        p.PorcTarde = "<b>0,00 %</b>";
                    }
                    p.TotalProducido = "<b>" + Convert.ToInt32(reader["TotalDia"].ToString()).ToString("N0").Replace(",", ".") + "</b>";
                    //p.Corona = Convert.ToInt32(reader["Corona"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Nordbinder = Convert.ToInt32(reader["Nordbinder"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Muller1 = Convert.ToInt32(reader["Muller1"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Muller2 = Convert.ToInt32(reader["Muller2"].ToString()).ToString("N0").Replace(",", ".");
                    //p.MullerPrima = Convert.ToInt32(reader["MullerPrima"].ToString()).ToString("N0").Replace(",", ".");
                    //p.TotalProducido = Convert.ToInt32(reader["TotalDia"].ToString()).ToString("N0").Replace(",", ".");

                    //p.PorcCorona = (((Convert.ToDouble(reader["Corona"].ToString())) / Convert.ToDouble(reader["TotalCorona"].ToString())) * 100).ToString("N2").Replace("NaN", "0,00") + "%";
                    //p.PorcNordbinder = (((Convert.ToDouble(reader["Nordbinder"].ToString())) / Convert.ToDouble(reader["TotalNordbinder"].ToString())) * 100).ToString("N2").Replace("NaN", "0,00") + "%";
                    //p.PorcMuller1 = (((Convert.ToDouble(reader["Muller1"].ToString())) / Convert.ToDouble(reader["TotalMuller1"].ToString())) * 100).ToString("N2").Replace("NaN", "0,00") + "%";
                    //p.PorcMuller2 = (((Convert.ToDouble(reader["Muller2"].ToString())) / Convert.ToDouble(reader["TotalMuller2"].ToString())) * 100).ToString("N2").Replace("NaN", "0,00") + "%";
                    //p.PorcMullerPrima = (((Convert.ToDouble(reader["MullerPrima"].ToString())) / Convert.ToDouble(reader["TotalMullerPrima"].ToString())) * 100).ToString("N2").Replace("NaN", "0,00") + "%";

                    //p.PorcTotalProducido = (((Convert.ToDouble(reader["TotalDia"].ToString())) / Convert.ToDouble(reader["TotalDiaCompleto"].ToString())) * 100).ToString("N2").Replace("NaN", "0,00") + "%";

                    //TCorona = Convert.ToDouble(reader["TotalCorona"].ToString());
                    //TNordbinder = Convert.ToDouble(reader["TotalNordbinder"].ToString());
                    //TMuller1 = Convert.ToDouble(reader["TotalMuller1"].ToString());
                    //TMuller2 = Convert.ToDouble(reader["TotalMuller2"].ToString());
                    //TPrima = Convert.ToDouble(reader["TotalMullerPrima"].ToString());
                    //TProducido = Convert.ToDouble(reader["TotalDiaCompleto"].ToString());
                    lista.Add(p);
                }
                //if (reader.Read() == false)
                //{
                //    InformeSemanal p = new InformeSemanal();
                //    p.Dia = "<b>TOTALES:</b>";
                //    p.Corona = "<b>" + Convert.ToInt32(TCorona).ToString("N0").Replace(",", ".") + "</b>";
                //    p.Nordbinder = "<b>" + Convert.ToInt32(TNordbinder).ToString("N0").Replace(",", ".") + "</b>";
                //    p.Muller1 = "<b>" + Convert.ToInt32(TMuller1).ToString("N0").Replace(",", ".") + "</b>";
                //    p.Muller2 = "<b>" + Convert.ToInt32(TMuller2).ToString("N0").Replace(",", ".") + "</b>";
                //    p.MullerPrima = "<b>" + Convert.ToInt32(TPrima).ToString("N0").Replace(",", ".") + "</b>";
                //    p.TotalProducido = "<b>" + Convert.ToInt32(TProducido).ToString("N0").Replace(",", ".") + "</b>";

                //    if (Convert.ToInt32(TCorona) == 0)
                //    {
                //        p.PorcCorona = "<b>0,00%</b>";
                //    }
                //    else
                //    {
                //        p.PorcCorona = "<b>100%</b>";
                //    }
                //    if (Convert.ToInt32(TNordbinder) == 0)
                //    {
                //        p.PorcNordbinder = "<b>0,00%</b>";
                //    }
                //    else
                //    {
                //        p.PorcNordbinder = "<b>100%</b>";
                //    }
                //    if (Convert.ToInt32(TMuller1) == 0)
                //    {
                //        p.PorcMuller1 = "<b>0,00%</b>";
                //    }
                //    else
                //    {
                //        p.PorcMuller1 = "<b>100%</b>";
                //    }
                //    if (Convert.ToInt32(TMuller2) == 0)
                //    {
                //        p.PorcMuller2 = "<b>0,00%</b>";
                //    }
                //    else
                //    {
                //        p.PorcMuller2 = "<b>100%</b>";
                //    }
                //    if (Convert.ToInt32(TPrima) == 0)
                //    {
                //        p.PorcMullerPrima = "<b>0,00%</b>";
                //    }
                //    else
                //    {
                //        p.PorcMullerPrima = "<b>100%</b>";
                //    }
                //    if (Convert.ToInt32(TProducido) == 0)
                //    {
                //        p.PorcTotalProducido = "<b>0,00%</b>";
                //    }
                //    else
                //    {
                //        p.PorcTotalProducido = "<b>100%</b>";
                //    }
                //    lista.Add(p);
                //}
            }
            conexion.CerrarConexion();

            return(lista);
        }
Пример #16
0
        public string ResultadoFiltro(string OT, string Pliego, string Maquina, int Procedimiento)
        {
            string result = ""; string Encabezado = "<table id='tblRegistro' runat='server' cellspacing='0' cellpadding='0' style='border: 1px solid #CCC; margin: 0 auto; margin-top: 0px; margin-bottom: 15px; width:1070px;margin-left:3px;'>" +

                                                    "<tbody><tr style='height: 22px; background: #f3f4f9; font: 11px Arial, Helvetica, sans-serif; color: #003e7e; text-align: left;'>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>OT</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:220px;'>Nombre OT</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:280px;'>Pliego</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Tiraje</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Buenos</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:70px;'>Maquina</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:130px;'>Fecha Inicio</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:70px;'>Etiquetas Creadas</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Cantidad Etiquetas</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:70px;'>Accion</td>" +
                                                    "</tr>";
            Conexion   conexion = new Conexion();
            SqlCommand cmd      = conexion.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[Metrics_Etiquetas_Listado]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@Pliego", Pliego);
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 9000000;
                try
                {
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        result = result + "<tr style='height: 22px; background: #fff; font: 11px Arial, Helvetica, sans-serif; color: #333;  vertical-align: text-top;'>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>" +
                                 reader["numordem"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:230px;'>" +
                                 reader["descricao"].ToString().ToLower() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:300px;'>" +
                                 reader["processo"].ToString().ToLower() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:70px;'>" +
                                 reader["qtdplanejado"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:70px;'>" +
                                 reader["bons"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                 reader["maquina"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:130px;'>" +
                                 Convert.ToDateTime(reader["DtHoraInicio"].ToString()).ToString("dd/MM/yyyy HH:mm") + " </td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:70px;'>" +
                                 reader["PalletCreados"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:60px;'>" +
                                 reader["CantidadCreada"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:70px;'>" +
                                 "<a style = 'Color:Blue;text-decoration:none;cursor:pointer;' href = 'javascript:Mostrar(\"" + reader["objid"].ToString() + "\",\"" + reader["numordem"].ToString() + "\",\"" + reader["descricao"].ToString() + "\",\"" + reader["processo"].ToString() + "\",\"" + reader["CantidadCreada"].ToString() + "\",\"" + reader["qtdplanejado"].ToString() + "\")' >Seleccionar</a>" + "</td>" +



                                 "</tr>";
                    }
                }
                catch (Exception ex)
                {
                }
            }
            conexion.CerrarConexion();
            return(Encabezado + result + "</tbody></table>");
        }
        public List <Factura> listarInfExterno(Factura fact)
        {
            List <Factura> lista = new List <Factura>();
            Conexion       con   = new Conexion();
            SqlCommand     cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "ServicioExterno_ListinformeExterno";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", fact.OT);
                cmd.Parameters.AddWithValue("@NombreOT", fact.NombreOT);
                cmd.Parameters.AddWithValue("@Proveedor", fact.Nombre);
                cmd.Parameters.AddWithValue("@FechaInicio", fact.Ciudad);
                cmd.Parameters.AddWithValue("@FechaTermino", fact.Comuna);
                if (fact.NFactura != 0)
                {
                    cmd.Parameters.AddWithValue("@Nrofactura", fact.NFactura);
                }
                if (fact.Ciudad != "" && fact.Comuna != "" && fact.Ciudad != null && fact.Comuna != null)
                {
                    if (fact.OT == "")
                    {
                        cmd.Parameters.AddWithValue("@procedimiento", 2);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@procedimiento", 4);
                    }
                }
                else if (fact.Ciudad == "" || fact.Comuna == "" || fact.Ciudad == null || fact.Comuna == null)
                {
                    if (fact.OT == "")
                    {
                        cmd.Parameters.AddWithValue("@procedimiento", 1);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@procedimiento", 3);
                    }
                }

                SqlDataReader reader   = cmd.ExecuteReader();
                int           contador = 0;
                while (reader.Read())
                {
                    Factura  f     = new Factura();
                    DateTime fecha = Convert.ToDateTime(reader["FechaFactura"].ToString());
                    f.Ciudad   = fecha.ToString("dd-MM-yyyy");
                    f.OT       = reader["OT"].ToString();
                    f.NombreOT = reader["NombreOT"].ToString();
                    f.Nombre   = reader["Nombre"].ToString();
                    f.NFactura = Convert.ToInt32(reader["NroFactura"].ToString());
                    int valorNeto = Convert.ToInt32(reader["ValorNeto"].ToString());   //valor neto
                    f.Sucursal = valorNeto.ToString("N0").Replace(",", ".");
                    int valoriva = Convert.ToInt32(reader["ValorIVA"].ToString());     //valor iva
                    f.Rut = valoriva.ToString("N0").Replace(",", ".");
                    int Costofinal = Convert.ToInt32(reader["CostoTotal"].ToString()); //costo final
                    f.Tipo    = Costofinal.ToString("N0").Replace(",", ".");
                    f.Proceso = "<a>Ver Más</a>";
                    contador  = contador + 1;
                    f.M2      = contador.ToString("N0").Replace(",", ".");
                    lista.Add(f);
                }
                con.CerrarConexion();
            }
            return(lista);
        }
Пример #18
0
        public string HistorialEtiquetas(string OT, string Pliego)
        {
            string result = ""; string Encabezado = "<table id='tblRegistro' runat='server' cellspacing='0' cellpadding='0' style='border: 1px solid #CCC; margin: 0 auto; margin-top: 0px; margin-bottom: 15px; width:850px;margin-left:3px;'>" +

                                                    "<tbody><tr style='height: 22px; background: #f3f4f9; font: 11px Arial, Helvetica, sans-serif; color: #003e7e; text-align: left;'>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Nro Pallet</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Cantidad</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Peso</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Pallet</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:170px;'>Fecha Creacion</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Estado</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:100px;'>Usuario</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:220px;'>Local</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Ubicacion</td>" +
                                                    "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>Accion</td>" +
                                                    "</tr>";
            Conexion   conexion = new Conexion();
            SqlCommand cmd      = conexion.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "[Metrics_Etiquetas_Listado]";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OT", OT);
                    cmd.Parameters.AddWithValue("@Pliego", Pliego);
                    cmd.Parameters.AddWithValue("@Maquina", "");
                    cmd.Parameters.AddWithValue("@Procedimiento", 1);

                    SqlDataReader reader = cmd.ExecuteReader();
                    cmd.CommandTimeout = 9000000;

                    while (reader.Read())
                    {
                        result = result + "<tr style='height: 22px; background: #fff; font: 11px Arial, Helvetica, sans-serif; color: #333;  vertical-align: text-top;'>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>" +
                                 reader["idPalletLabel"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:50px;'>" +
                                 reader["Quantity"].ToString().ToLower() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:50px;'>" +
                                 reader["QuantityKG"].ToString().ToLower() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:right;width:50px;'>" +
                                 reader["Pallet"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:170px;'>" +
                                 Convert.ToDateTime(reader["FechaCreacion"].ToString()).ToString("dd/MM/yyyy HH:mm") + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                 reader["Estado"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:100px;'>" +
                                 reader["InsUser"].ToString() + " </td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:220px;'>" +
                                 reader["Local"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:50px;'>" +
                                 reader["Ubicacion"].ToString() + "</td>" +
                                 "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:50px;'>" +
                                 "<a style = 'Color:Blue;text-decoration:none;cursor:pointer;' href = 'javascript:HistorialEtiquetas(\"" + reader["idPalletLabel"].ToString() + "\")' >Reimprimir</a>" + "</td>" +



                                 "</tr>";
                    }
                }
                catch (Exception ex)
                {
                }
            }
            conexion.CerrarConexion();
            return(Encabezado + result + "</tbody></table>");
        }
Пример #19
0
        public List <EstadoOT_Mejora> ListarEstadoOT(string ot, string nombreot, string cliente, DateTime fechai, DateTime fechat, string estado, int procedimiento)
        {
            List <EstadoOT_Mejora> lista = new List <EstadoOT_Mejora>();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Desp_EstadoOT";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@NombreOT", nombreot);
                cmd.Parameters.AddWithValue("@Cliente", cliente);
                cmd.Parameters.AddWithValue("@FechaInicio", fechai);
                cmd.Parameters.AddWithValue("@FechaTermino", fechat);
                cmd.Parameters.AddWithValue("@Estado", estado);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                cmd.CommandTimeout = 99999999;
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    EstadoOT_Mejora d = new EstadoOT_Mejora();
                    d.OT       = reader["OT"].ToString();
                    d.NombreOT = reader["NombreOT"].ToString().ToLower();

                    int tiraje       = Convert.ToInt32(reader["Tiraje"].ToString());
                    int despachado   = Convert.ToInt32(reader["TotalDespachado"].ToString());
                    int devueltoInt  = Convert.ToInt32(reader["DevolucionInterna"].ToString());
                    int devueltoCli  = Convert.ToInt32(reader["DevolucionCliente"].ToString());
                    int devueltoGen  = Convert.ToInt32(reader["DevolucionGeneral"].ToString());
                    int recepcionado = Convert.ToInt32(reader["Recepcionado"].ToString());
                    int EgresoSob    = Convert.ToInt32(reader["EgresoSobrantes"].ToString());
                    int EgresoEsp    = Convert.ToInt32(reader["EgresoEspeciales"].ToString());

                    d.Tiraje            = tiraje.ToString("N0").Replace(",", ".");
                    d.Despachado        = (despachado - devueltoCli - devueltoGen).ToString("N0").Replace(",", ".");
                    d.Recepcionado      = (recepcionado - devueltoInt - devueltoGen).ToString("N0").Replace(",", ".");
                    d.DevolucionCliente = (devueltoCli + devueltoGen + devueltoInt).ToString("N0").Replace(",", ".");
                    d.Especiales        = Convert.ToInt32(reader["Especiales"].ToString()).ToString("N0").Replace(",", ".");

                    int existencia = (tiraje - (recepcionado - devueltoInt - devueltoGen - EgresoSob));
                    d.Saldo = existencia.ToString("N0").Replace(",", ".");
                    int exists = ((recepcionado - devueltoInt - devueltoGen) - (despachado - devueltoCli - devueltoGen));
                    d.Existencia = exists.ToString("N0").Replace(",", ".");


                    if (exists < 0)
                    {
                        d.Existencia = "<div style='color:Red;'>" + (exists).ToString("N0").Replace(",", ".") + "</div>";
                    }
                    else
                    {
                        d.Existencia = (exists).ToString("N0").Replace(",", ".");
                    }



                    int DespOT = tiraje - despachado;

                    if (reader["FechaMinima"].ToString() == "1/1/1900 12:00:00 AM")
                    {
                        d.FechaMinima = "<div align='center'>-</div>";
                    }
                    else
                    {
                        d.FechaMinima = Convert.ToDateTime(reader["FechaMinima"].ToString()).ToString("dd/MM/yyyy HH:mm");
                    }
                    if (reader["FechaMaxima"].ToString() == "1/1/1900 12:00:00 AM")
                    {
                        d.FechaMaxima = "<div align='center'>-</div>";
                    }
                    else
                    {
                        d.FechaMaxima = Convert.ToDateTime(reader["FechaMaxima"].ToString()).ToString("dd/MM/yyyy HH:mm");
                    }



                    if (existencia > 0)
                    {
                        d.Saldo = "<div style='color:Red;'>" + (existencia * -1).ToString("N0").Replace(",", ".") + "</div>";
                    }
                    else
                    {
                        d.Saldo = (existencia * -1).ToString("N0").Replace(",", ".");
                    }
                    if (reader["Estado"].ToString() == "A")
                    {
                        if (DespOT <= 0)
                        {
                            d.Estado = "<div style='Color:Red;'><a style='Color:Red;text-decoration:none;' href='LiquidarOT.aspx?id=8&Cat=6&va=" + d.OT + "'>Por Liquidar</a></div>";
                        }
                        else
                        {
                            d.Estado = "<div style='Color:Blue;'><a style='Color:Blue;text-decoration:none;' href='LiquidarOT.aspx?id=8&Cat=6&va=" + d.OT + "'>En Proceso</a></div>";
                        }
                    }
                    else
                    {
                        d.Estado = "<div style='Color:Green;'><a style='Color:Green;text-decoration:none;' href='LiquidarOT.aspx?id=8&Cat=6&va=" + d.OT + "'>Liquidada</a></div>";
                    }

                    lista.Add(d);
                }
            }
            con.CerrarConexion();
            return(lista);
        }
Пример #20
0
        public string Carga_PapelesOT(string OT, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            string Titulo = "<table id='tblRegistro' runat='server' cellspacing='0' cellpadding='0' style='border: 1px solid #CCC; margin: 0 auto; margin-top: 0px; margin-bottom: 15px; width:880px;margin-left:15px;'>" +
                            "<tbody><tr style='height: 22px; background: #f3f4f9; font: 11px Arial, Helvetica, sans-serif; color: #003e7e; text-align: left;'>" +
                            "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:170px;'>Nombre Componente</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:250px;'>Papel</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>Ancho (Bobina)</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Largo</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>Grs</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:100px;'>Formato Immpresión</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>Consumo KGs</td>" +
                            "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>Consumo PLs</td>" +
                            "</tr>";
            string     RackLibre = "";
            string     OTa       = "";
            Conexion   con       = new Conexion();
            SqlCommand cmd       = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[Administracion_PapelesOT]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();

                string v1 = "";
                string v2 = "";
                while (reader.Read())
                {
                    string a = reader["OT"].ToString();
                    if (OTa != reader["OT"].ToString())
                    {
                        if (RackLibre != "")
                        {
                            RackLibre = RackLibre + "</tbody></table>";
                        }

                        try
                        {
                            string[] str = reader["FormatoPapel"].ToString().Split('x');
                            v1 = str[0];
                            v2 = str[1];
                        }
                        catch
                        {
                            v1 = reader["FormatoPapel"].ToString();
                            v2 = "";
                        }
                        string Estado = "";
                        if (reader["EstadoOT"].ToString() == "E")
                        {
                            Estado = "<label style='color:Green'>Liquidada</label>";
                        }
                        else
                        {
                            Estado = "<label style='color:Blue'>En Proceso</label>";
                        }


                        string vv = reader["ConsumoKG"].ToString();
                        string v  = reader["ConsumoPL"].ToString();
                        RackLibre = RackLibre + "<div style='width:900px;margin-left:15px;'>OT:&nbsp" + reader["OT"].ToString() + "&nbsp;&nbsp;-&nbsp;&nbsp;" + reader["NombreOT"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Estado: " + Estado + "</div>" + Titulo +
                                    "<tr style='height: 22px; background: #fff; font: 11px Arial, Helvetica, sans-serif; color: #333;  vertical-align: text-top;'>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:170px;'>" +
                                    reader["Description"].ToString().Replace("IMP", "").Replace("PLANA", "").Replace("ROTATIVA", "") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:250px;'>" +
                                    reader["NombrePapel"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                    v1 + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                    v2 + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                    reader["Gramaje"].ToString() + "</td>" +

                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:100px;'>" +
                                    reader["Ancho"].ToString() + "x" + reader["Alto"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                    Convert.ToInt32(reader["ConsumoKG"].ToString()).ToString("N0").Replace(",", ".") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                    Convert.ToInt32(reader["ConsumoPL"].ToString()).ToString("N0").Replace(",", ".") + "</td>" +
                                    "</tr>";
                    }
                    else
                    {
                        try
                        {
                            string[] str = reader["FormatoPapel"].ToString().Split('x');
                            v1 = str[0];
                            v2 = str[1];
                        }
                        catch
                        {
                            v1 = reader["FormatoPapel"].ToString();
                            v2 = "";
                        }
                        RackLibre = RackLibre +
                                    "<tr style='height: 22px; background: #fff; font: 11px Arial, Helvetica, sans-serif; color: #333;  vertical-align: text-top;'>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:170px;'>" +
                                    reader["Description"].ToString().Replace("IMP", "").Replace("PLANA", "").Replace("ROTATIVA", "") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:left;width:250px;'>" +
                                    reader["NombrePapel"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                    v1 + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                    v2 + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:60px;'>" +
                                    reader["Gramaje"].ToString() + "</td>" +

                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:100px;'>" +
                                    reader["Ancho"].ToString() + "x" + reader["Alto"].ToString() + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                    Convert.ToInt32(reader["ConsumoKG"].ToString()).ToString("N0").Replace(",", ".") + "</td>" +
                                    "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;width:80px;'>" +
                                    Convert.ToInt32(reader["ConsumoPL"].ToString()).ToString("N0").Replace(",", ".") + "</td>" +
                                    "</tr>";
                    }
                    OTa = reader["OT"].ToString();
                }
                RackLibre = RackLibre + "</tbody></table>";
            }
            con.CerrarConexion();
            return(RackLibre);
        }
        public List <BodegaPliegos> CargaSolicitud(string ot, string nombreot, string papel, string codigoPapel, string Folio, int estado, DateTime fechainicio, DateTime fechatermino, int procedimiento)
        {
            List <BodegaPliegos> lista = new List <BodegaPliegos>();
            Conexion             con   = new Conexion();
            SqlCommand           cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[BodegaPliegos_Cortadora]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@NombreOT", nombreot);
                cmd.Parameters.AddWithValue("@Papel", papel);
                cmd.Parameters.AddWithValue("@CodigoPapel", codigoPapel);
                cmd.Parameters.AddWithValue("@Folio", Folio);
                cmd.Parameters.AddWithValue("@Estado", estado);
                cmd.Parameters.AddWithValue("@FechaInicio", fechainicio);
                cmd.Parameters.AddWithValue("@FechaTermino", fechatermino);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();
                if (procedimiento == 0 || procedimiento == 2 || procedimiento == 3 || procedimiento == 4)
                {
                    while (reader.Read())
                    {
                        BodegaPliegos d = new BodegaPliegos();
                        d.Folio          = reader["CodigoID"].ToString();
                        d.FechaCreacion  = Convert.ToDateTime(reader["FechaAsignacion"].ToString()).ToString("dd/MM/yyyy");
                        d.CodigoProducto = reader["Codigo"].ToString();
                        d.OT             = reader["OT"].ToString();
                        //d.NombreOT = reader["NombreOT"].ToString();
                        d.Componente = reader["Componente"].ToString();
                        d.Papel      = reader["Papel"].ToString().ToLower();
                        d.Gramaje    = Convert.ToInt32(reader["Gramaje"].ToString()).ToString();
                        d.Ancho      = Convert.ToInt32(reader["Ancho"].ToString()).ToString();
                        d.Largo      = Convert.ToInt32(reader["Largo"].ToString()).ToString();
                        d.StockFL    = Convert.ToInt32(reader["Asignado"].ToString()).ToString("N0").Replace(",", ".");
                        d.Estado     = "<div style='color:red;'>Sin Atender</div>";
                        if (d.OT.Trim().ToLower().Contains("stock"))
                        {
                            d.Accion = "<a style='Color:Red;text-decoration:none;cursor:pointer;'>Ubicar</a>";
                        }
                        else
                        {
                            d.Accion = "<a style='Color:Blue;text-decoration:none;cursor:pointer;' href='javascript:Atender(\"" + d.Folio + "\");'>Atender</a>";
                        }
                        lista.Add(d);
                    }
                }
                else if (procedimiento == 1)
                {
                    while (reader.Read())
                    {
                        BodegaPliegos d = new BodegaPliegos();
                        d.ID             = reader["id_Asignacion"].ToString();
                        d.NroPallet      = reader["NroPallet"].ToString();
                        d.Ubicacion      = reader["Sector"].ToString() + " - " + reader["Ubicacion"].ToString();
                        d.CodigoProducto = reader["Codigo"].ToString();
                        d.Componente     = reader["Componente"].ToString();
                        d.Marca          = "-";
                        d.Papel          = reader["Papel"].ToString();
                        d.Gramaje        = reader["Gramaje"].ToString();
                        d.Ancho          = reader["FCAncho"].ToString();
                        d.Largo          = reader["FCLargo"].ToString();
                        d.StockFL        = reader["CantidadAsignada"].ToString();

                        if (reader["Estado"].ToString() == "1")
                        {
                            d.Estado = "<div style='Color:red;'>Sin Atender</div>";
                        }
                        else if (reader["Estado"].ToString() == "2")
                        {
                            d.Estado = "<div style='Color:Green;'>Atendido</div>";
                        }
                        else
                        {
                            d.Estado = "Error";
                        }
                        lista.Add(d);
                    }
                }
            }
            con.CerrarConexion();
            return(lista);
        }
        public List <ScoreCard> Lista_Detalle(string Ot, string Pliego, string Area, string Maquina, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            List <ScoreCard> lista = new List <ScoreCard>();

            Conexion   conexion = new Conexion();
            SqlCommand cmd      = conexion.AbrirConexionIntranet();
            string     ceros    = "00";

            if (cmd != null)
            {
                cmd.CommandText = "Produccion_InformeScoreCard";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", Ot);
                cmd.Parameters.AddWithValue("@Pliego", Pliego);
                cmd.Parameters.AddWithValue("@Area", Area);
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 99999999;
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    ScoreCard p = new ScoreCard();
                    p.Maquina  = reader["Maquina"].ToString();
                    p.OT       = reader["NumOrdem"].ToString();
                    p.NombreOT = reader["descricao"].ToString().ToLower();
                    p.Pliego   = reader["Pliego"].ToString();
                    p.Cliente  = reader["Cliente"].ToString().ToLower();
                    //p.Entradas = reader["Entradas"].ToString();
                    p.Planificado = Convert.ToInt32(reader["QtdPlanejado"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Entradas = CargaEntradas(p.OT, reader["processo"].ToString(), reader["CodRecurso"].ToString(), FechaInicio, FechaTermino, 1); //Convert.ToInt32(reader["Entradas"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Giros = "";// Convert.ToInt32(reader["Giros"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Buenos = Convert.ToInt32(reader["Buenos"].ToString()).ToString("N0").Replace(",", ".");
                    //p.HorasPreparacion = reader["HorasPreparacion"].ToString();

                    TimeSpan t1    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()));
                    int      Dias1 = t1.Days * 24;
                    p.HorasPreparacion = (t1.Hours + Dias1).ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Minutes.ToString().Length) + t1.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Seconds.ToString().Length) + t1.Seconds.ToString();
                    //p.HorasTiraje = reader["HorasTiraje"].ToString();
                    TimeSpan t2    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasTiraje"].ToString()));
                    int      Dias2 = t2.Days * 24;
                    p.HorasTiraje = (t2.Hours + Dias2).ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Minutes.ToString().Length) + t2.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Seconds.ToString().Length) + t2.Seconds.ToString();
                    //p.HorasImproductivas = reader["HorasImproductivas"].ToString();
                    TimeSpan t3    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasImproductivas"].ToString()));
                    int      Dias3 = t3.Days * 24;
                    p.HorasImproductivas = (t3.Hours + Dias3).ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Minutes.ToString().Length) + t3.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Seconds.ToString().Length) + t3.Seconds.ToString();
                    //p.HorasSinTrabajo = reader["HorasSinTrabajo"].ToString();
                    //TimeSpan t4 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinTrabajo"].ToString()));
                    //int Dias4 = t4.Days * 24;
                    //p.HorasSinTrabajo = (t4.Hours + Dias4).ToString() + ":" + ceros.Substring(0, ceros.Length - t4.Minutes.ToString().Length) + t4.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t4.Seconds.ToString().Length) + t4.Seconds.ToString();
                    ////p.HorasSinPersonal = reader["HorasSinPersonal"].ToString();
                    //TimeSpan t5 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasSinPersonal"].ToString()));
                    //int Dias5 = t5.Days * 24;
                    //p.HorasSinPersonal = (t5.Hours + Dias5).ToString() + ":" + ceros.Substring(0, ceros.Length - t5.Minutes.ToString().Length) + t5.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t5.Seconds.ToString().Length) + t5.Seconds.ToString();
                    ////p.HorasMantencion = reader["HorasMantencion"].ToString();
                    //TimeSpan t6 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasMantencion"].ToString()));
                    //int Dias6 = t6.Days * 24;
                    //p.HorasMantencion = (t6.Hours + Dias6).ToString() + ":" + ceros.Substring(0, ceros.Length - t6.Minutes.ToString().Length) + t6.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t6.Seconds.ToString().Length) + t6.Seconds.ToString();
                    //p.Planchas = Convert.ToInt32(reader["Planchas"].ToString()).ToString("N0").Replace(",", ".");
                    //p.Preparaciones = Convert.ToInt32(reader["Entradas"].ToString()).ToString("N0").Replace(",", ".");

                    TimeSpan t7    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()) + Convert.ToDouble(reader["HorasTiraje"].ToString()) + Convert.ToDouble(reader["HorasImproductivas"].ToString()));
                    int      Dias7 = t7.Days * 24;
                    p.HorasDirectas = (t7.Hours + Dias7).ToString() + ":" + ceros.Substring(0, ceros.Length - t7.Minutes.ToString().Length) + t7.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t7.Seconds.ToString().Length) + t7.Seconds.ToString();

                    //TimeSpan t8 = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasDisponibles"].ToString())+1);
                    //int Dias8 = t8.Days * 24;
                    //p.HorasDisponibles = (t8.Hours + Dias8).ToString() + ":" + ceros.Substring(0, ceros.Length - t8.Minutes.ToString().Length) + t8.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t8.Seconds.ToString().Length) + t8.Seconds.ToString();
                    //p.Escarpe = reader["Escarpe"].ToString();
                    //p.Cono = reader["PesoCono"].ToString();
                    //p.ConsumoPapel = reader["Consumo"].ToString();

                    p.Giros = Convert.ToInt32(reader["Giros"].ToString()).ToString("N0").Replace(",", ".");

                    if (reader["CodRecurso"].ToString().ToLower() == "mr408")
                    {
                        p.Buenos = Convert.ToInt32(reader["Buenos"].ToString()).ToString("N0").Replace(",", ".");

                        p.MermaArranque = Convert.ToInt32(reader["PliegosMalosPreparacion"].ToString()).ToString("N0").Replace(",", ".");
                        p.MermaTiraje   = Convert.ToInt32(reader["PliegosMalosTiraje"].ToString()).ToString("N0").Replace(",", ".");
                    }
                    else if (reader["CodRecurso"].ToString().ToLower() == "c150")
                    {
                        p.Buenos        = (Convert.ToInt32(reader["Giros"].ToString()) * 2).ToString("N0").Replace(",", ".");
                        p.MermaArranque = (Convert.ToInt32(reader["GirosMalosPreparacion"].ToString()) * 2).ToString("N0").Replace(",", ".");
                        p.MermaTiraje   = (Convert.ToInt32(reader["GirosMalosTiraje"].ToString()) * 2).ToString("N0").Replace(",", ".");
                    }
                    else
                    {
                        p.Buenos        = Convert.ToInt32(reader["Giros"].ToString()).ToString("N0").Replace(",", ".");
                        p.MermaArranque = Convert.ToInt32(reader["GirosMalosPreparacion"].ToString()).ToString("N0").Replace(",", ".");
                        p.MermaTiraje   = Convert.ToInt32(reader["GirosMalosTiraje"].ToString()).ToString("N0").Replace(",", ".");
                    }



                    if (reader["HorasTiraje"].ToString() == "0")
                    {
                        p.VPromedio = "0/Hr";
                    }
                    else
                    {
                        double valor = Convert.ToDouble(Convert.ToDouble(reader["HorasTiraje"].ToString()) / 3600);
                        p.VPromedio = Convert.ToInt32(((Convert.ToDouble(reader["Giros"].ToString())) / valor)).ToString("N0").Replace(",", ".") + "/Hr";
                    }

                    double horasimp = Convert.ToDouble(reader["HorasImproductivas"].ToString()) / 3600;
                    double horastir = Convert.ToDouble(reader["HorasTiraje"].ToString()) / 3600;

                    double result = ((horastir / (horastir + horasimp)) * 100);

                    p.Uptime = result.ToString("0.00").Replace("NaN", "0") + "%";

                    p.Colores = CargaPlanchas(reader["numordem"].ToString(), reader["processo"].ToString(), "", DateTime.Now, DateTime.Now, -1);

                    p.CodRecurso = reader["CodRecurso"].ToString();

                    try
                    {
                        if (p.Colores == "")
                        {
                            p.Planchas = "";
                        }
                        else
                        {
                            string[] str = p.Colores.Split('x');
                            p.Planchas = (Convert.ToInt32(str[0]) + Convert.ToInt32(str[1])).ToString();
                        }
                    }
                    catch
                    {
                        p.Planchas = "";
                    }
                    lista.Add(p);
                }
            }
            conexion.CerrarConexion();

            return(lista);
        }
        public int GuardarAntecedentesMedicos(FichaMedica fmPaciente)
        {
            int        respuesta = 0;
            Conexion   con       = new Conexion();
            SqlCommand cmd       = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "Salud_AntecedentesMedicos_Insertar";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID_Ficha", fmPaciente.IDFichaMedica);
                    cmd.Parameters.AddWithValue("@Fuma", fmPaciente.Fuma);
                    cmd.Parameters.AddWithValue("@Bebe", fmPaciente.Bebe);
                    cmd.Parameters.AddWithValue("@Droga", fmPaciente.Drogas);
                    cmd.Parameters.AddWithValue("@Fisica", fmPaciente.ActividadFisica);
                    cmd.Parameters.AddWithValue("@Medicamento_Alergia", fmPaciente.Medicamento_Alergia);
                    cmd.Parameters.AddWithValue("@Alimento_Alergia", fmPaciente.Alimento_Alergia);
                    cmd.Parameters.AddWithValue("@Lentes", fmPaciente.Lentes);
                    cmd.Parameters.AddWithValue("@Audifonos", fmPaciente.Audifonos);
                    cmd.Parameters.AddWithValue("@Protesis", fmPaciente.Protesis);
                    cmd.Parameters.AddWithValue("@Plantillas", fmPaciente.Plantillas);
                    cmd.Parameters.AddWithValue("@Medicamentos", fmPaciente.Medicamentos);
                    cmd.Parameters.AddWithValue("@Intervenciones", fmPaciente.Intervenciones);
                    cmd.Parameters.AddWithValue("@enfermedad", fmPaciente.Enfermedad);
                    cmd.Parameters.AddWithValue("@Dermatitis", fmPaciente.Dermatitis);
                    cmd.Parameters.AddWithValue("@Varices", fmPaciente.Varices);
                    cmd.Parameters.AddWithValue("@Epilepsia", fmPaciente.Epilepsia);
                    cmd.Parameters.AddWithValue("@Sueño", fmPaciente.Sueño);
                    cmd.Parameters.AddWithValue("@Sangre", fmPaciente.Sangre);
                    cmd.Parameters.AddWithValue("@Neumonia", fmPaciente.Neumonia);
                    cmd.Parameters.AddWithValue("@Bronquitis", fmPaciente.Bronquitis);
                    cmd.Parameters.AddWithValue("@Ulceras", fmPaciente.Ulceras);
                    cmd.Parameters.AddWithValue("@TBC", fmPaciente.TBC);
                    cmd.Parameters.AddWithValue("@Hepatitis", fmPaciente.Hepatitis);
                    cmd.Parameters.AddWithValue("@Asma", fmPaciente.Asma);
                    cmd.Parameters.AddWithValue("@Diabetes", fmPaciente.Diabetes);
                    cmd.Parameters.AddWithValue("@Fiebre", fmPaciente.Fiebre);
                    cmd.Parameters.AddWithValue("@Hipertension", fmPaciente.Hipertension);
                    cmd.Parameters.AddWithValue("@Lumbalgias", fmPaciente.Lumbalgias);
                    cmd.Parameters.AddWithValue("@Tendinitis", fmPaciente.Tendinitis);
                    cmd.Parameters.AddWithValue("@Observacion", fmPaciente.Accion);
                    cmd.Parameters.AddWithValue("@Usuario", fmPaciente.Nombre);
                    cmd.Parameters.AddWithValue("@FumaCant", fmPaciente.FumaCant);
                    cmd.Parameters.AddWithValue("@FumaDescript", fmPaciente.FumaDescript);
                    cmd.Parameters.AddWithValue("@BebeCant", fmPaciente.BebeCant);
                    cmd.Parameters.AddWithValue("@BebeDescript", fmPaciente.BebeDescript);
                    cmd.Parameters.AddWithValue("@DrogasCant", fmPaciente.DrogasCant);
                    cmd.Parameters.AddWithValue("@DrogasCantDescript", fmPaciente.DrogasCantDescript);
                    cmd.Parameters.AddWithValue("@ActFCant", fmPaciente.ActFCant);
                    cmd.Parameters.AddWithValue("@ActFCantDescript", fmPaciente.ActFCantDescript);
                    cmd.Parameters.AddWithValue("@TipoAccidente", fmPaciente.TipoAccidente);
                    cmd.Parameters.AddWithValue("@polvo", fmPaciente.polvo);
                    cmd.Parameters.AddWithValue("@impacto", fmPaciente.impacto);
                    cmd.Parameters.AddWithValue("@permanente", fmPaciente.permanente);
                    cmd.Parameters.AddWithValue("@solvente", fmPaciente.solvente);
                    cmd.Parameters.AddWithValue("@mmc", fmPaciente.mmc);
                    cmd.Parameters.AddWithValue("@sefp", fmPaciente.sefp);
                    cmd.Parameters.AddWithValue("@asmagenos", fmPaciente.asmagenos);
                    cmd.Parameters.AddWithValue("@calor", fmPaciente.calor);
                    cmd.Parameters.AddWithValue("@ionizante", fmPaciente.ionizante);
                    cmd.Parameters.AddWithValue("@metales", fmPaciente.metales);
                    cmd.Parameters.AddWithValue("@humo", fmPaciente.humo);
                    cmd.Parameters.AddWithValue("@electromag", fmPaciente.electromag);
                    cmd.Parameters.AddWithValue("@riesgos", fmPaciente.riesgos);
                    cmd.Parameters.AddWithValue("@Eco", fmPaciente.Eco);
                    cmd.Parameters.AddWithValue("@EcoFecha", fmPaciente.EcoFecha);
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        respuesta = Convert.ToInt32(reader["Respuesta"].ToString());
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(respuesta);
        }
Пример #24
0
        public List <Devoluciones> CargaInformeDevoluciones(string ot, string NombreOT, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            List <Devoluciones> lista = new List <Devoluciones>();
            Conexion            con   = new Conexion();
            SqlCommand          cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Desp_Dev_InformeDevolucion";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@NombreOT", NombreOT);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Devoluciones des = new Devoluciones();

                    des.Folio           = reader["Folio"].ToString();
                    des.OT              = reader["OT"].ToString().ToUpper();
                    des.Producto        = reader["Producto"].ToString();
                    des.Cliente         = reader["Cliente"].ToString().ToLower();
                    des.TirajeOT        = Convert.ToInt32(reader["TirajeOT"].ToString()).ToString("N0").Replace(",", ".");
                    des.CausaDevolucion = reader["CausaDevolucion"].ToString();
                    des.Total_Dev       = Convert.ToInt32(reader["Total_Dev"].ToString()).ToString("N0").Replace(",", ".");
                    des.CreadaPor       = reader["CreadaPor"].ToString();
                    des.FechaCreacion   = Convert.ToDateTime(reader["FechaCreacion"].ToString()).ToString("dd/MM/yyyy HH:mm");

                    if (reader["Estado"].ToString() == "1")
                    {
                        des.guia = "<div style='Color:Red'>Creada</div>";
                    }
                    else if (reader["Estado"].ToString() == "2")
                    {
                        des.guia = "<div style='Color:Orange'>Generada</div>";
                    }
                    else if (reader["Estado"].ToString() == "4")
                    {
                        des.guia = "<div style='Color:Green'>Recepcionada</div>";
                    }
                    else
                    {
                        des.guia = "<div>Anulada</div>";
                    }



                    if (reader["TipoDevolucion"].ToString() == "Devolucion Interna")
                    {
                        des.id_TipoDev  = "Devolucion Interna";
                        des.Observacion = "<a style='Color:Blue;text-decoration:none;' href='javascript:openGame(\"" + des.Folio + "\",\"" + des.OT + "\")'>ver Más</a>";
                    }
                    else
                    {
                        des.id_TipoDev  = "Devolucion Cliente";
                        des.Observacion = "<a style='Color:Blue;text-decoration:none;' href='javascript:openGames(\"" + des.Folio + "\",\"" + des.OT + "\")'>ver Más</a>";
                    }


                    lista.Add(des);
                }
            }
            con.CerrarConexion();
            return(lista);
        }
        public List <Bobina_ConsumoLinea> List_BobinasInformeMensual(string FechaInicio, string FechaTermino)
        {
            List <Bobina_ConsumoLinea> lista      = new List <Bobina_ConsumoLinea>();
            List <Bobina_ConsumoLinea> queryTotal = new List <Bobina_ConsumoLinea>();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "Bobina_ConsumoLineaMetrics_Mensual";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                    cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Bobina_ConsumoLinea bobina = new Bobina_ConsumoLinea();
                        bobina.Codigo_Bobina   = reader["IdVolume"].ToString();
                        bobina.Maquina         = reader["Maquina"].ToString();
                        bobina.PesoInicial     = Convert.ToDouble(reader["AvailableBeforeQtd"].ToString()).ToString();
                        bobina.Saldo           = Convert.ToDouble(reader["AvailableAfterQtd"].ToString()).ToString();
                        bobina.TipoPerdida     = reader["TipoPerdida"].ToString();
                        bobina.Cantidad        = Convert.ToDouble(reader["Cantidad"].ToString()).ToString();
                        bobina.OrigenPerdida   = reader["ORIGEN"].ToString();
                        bobina.MotivoPerdida   = reader["MOTIVO"].ToString();
                        bobina.TipoTransaccion = reader["TipoTrans"].ToString();
                        bobina.OT = reader["NumOrdem"].ToString();
                        queryTotal.Add(bobina);
                    }
                    if (queryTotal.Count > 0)
                    {
                        foreach (string maquina in queryTotal.Select(o => o.Maquina).Distinct())
                        {
                            foreach (string CodigoBobina in queryTotal.Where(o => o.Maquina == maquina).Select(o => o.Codigo_Bobina).Distinct())
                            {
                                int PesoInicial            = 0;
                                int PesoPerdidas           = 0;
                                int Escarpe                = 0;
                                int Consumo                = 0;
                                Bobina_ConsumoLinea bobina = new Bobina_ConsumoLinea();

                                foreach (Bobina_ConsumoLinea bob in queryTotal.Where(o => o.Maquina == maquina).Where(o => o.Codigo_Bobina == CodigoBobina))
                                {
                                    bobina.Codigo_Bobina = bob.Codigo_Bobina;
                                    bobina.Maquina       = bob.Maquina;
                                    bobina.Gramaje       = bob.Gramaje;
                                    bobina.Ancho         = bob.Ancho;
                                    bobina.TipoPapel     = bob.TipoPapel;
                                    bobina.OT            = bob.OT;
                                    if (PesoInicial == 0)
                                    {
                                        PesoInicial        = Convert.ToInt32(bob.PesoInicial);
                                        bobina.PesoInicial = PesoInicial.ToString();
                                    }
                                    if (bob.TipoPerdida != "")
                                    {
                                        PesoPerdidas += Convert.ToInt32(bob.Cantidad);
                                        if (bob.TipoPerdida == "ESCALPE")
                                        {
                                            Escarpe += Convert.ToInt32(bob.Cantidad);
                                        }
                                    }
                                    else
                                    {
                                        if (bob.TipoTransaccion == "DEVOLUCIÓN DE BOBINAS (VOL)")
                                        {
                                            Consumo -= Convert.ToInt32(bob.Cantidad);
                                        }
                                        else
                                        {
                                            Consumo += Convert.ToInt32(bob.Cantidad);
                                        }
                                    }
                                    if (bob.OrigenPerdida != "")
                                    {
                                        bobina.OrigenPerdida = bob.OrigenPerdida;
                                        bobina.MotivoPerdida = bob.MotivoPerdida;
                                    }
                                    bobina.Escarpe            = Escarpe.ToString();
                                    bobina.ConsumoBobina      = (Consumo + PesoPerdidas).ToString();
                                    bobina.PorcentajePerdidas = Convert.ToDouble(Convert.ToDouble(Escarpe * 100) / PesoInicial).ToString("N2") + " %";
                                }
                                lista.Add(bobina);
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(lista);
        }
        public List <InformeSemanal> ListaInformeMaquina(string Area, string Maquina, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            List <InformeSemanal> lista = new List <InformeSemanal>();
            Conexion   conexion         = new Conexion();
            SqlCommand cmd       = conexion.AbrirConexionIntranet();
            string     ceros     = "00";
            int        Entr      = 0;
            double     HorasPrep = 0;
            double     promPrep  = 0;
            double     HorasTir  = 0;
            double     horasImp  = 0;
            int        Bons      = 0;
            double     produ     = 0;
            int        Velocidad = 0;
            int        count     = 0;

            if (cmd != null)
            {
                cmd.CommandText = "Produccion_InformePorSemana";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Area", Area);
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 99999999;
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    InformeSemanal p = new InformeSemanal();
                    p.Semana  = reader["Semana"].ToString();
                    p.Maquina = reader["Maquina"].ToString();
                    int Buenos = Convert.ToInt32(reader["Buenos"].ToString());
                    Bons      += Buenos;
                    p.Buenos   = Buenos.ToString("N0").Replace(",", ".");
                    p.Entradas = reader["Entradas"].ToString();
                    Entr      += Convert.ToInt32(reader["Entradas"].ToString());
                    TimeSpan t0    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasTiraje"].ToString()));
                    int      Dias0 = t0.Days * 24;
                    p.HorasTiraje = (t0.Hours + Dias0).ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Minutes.ToString().Length) + t0.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Seconds.ToString().Length) + t0.Seconds.ToString();
                    HorasTir     += Convert.ToDouble(reader["HorasTiraje"].ToString());

                    TimeSpan t1    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()));
                    int      Dias1 = t1.Days * 24;
                    p.HorasPreparacion = (t1.Hours + Dias1).ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Minutes.ToString().Length) + t1.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Seconds.ToString().Length) + t1.Seconds.ToString();
                    HorasPrep         += Convert.ToDouble(reader["HorasPreparacion"].ToString());

                    TimeSpan t2    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasImproductivas"].ToString()));
                    int      Dias2 = t2.Days * 24;
                    p.HorasImproductivas = (t2.Hours + Dias2).ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Minutes.ToString().Length) + t2.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Seconds.ToString().Length) + t2.Seconds.ToString();
                    horasImp            += Convert.ToDouble(reader["HorasImproductivas"].ToString());

                    TimeSpan t3    = TimeSpan.FromSeconds(Convert.ToDouble(reader["PromedioPreparacion"].ToString()));
                    int      Dias3 = t3.Days * 24;
                    p.PromedioPreparacion = (t3.Hours + Dias3).ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Minutes.ToString().Length) + t3.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Seconds.ToString().Length) + t3.Seconds.ToString();
                    promPrep += Convert.ToDouble(reader["PromedioPreparacion"].ToString());

                    double Buenos2      = Convert.ToDouble(reader["Buenos"].ToString());
                    double TotalBuenos2 = Convert.ToDouble(reader["TotalBuenos"].ToString());
                    p.Productividad = ((Buenos2 / TotalBuenos2) * 100).ToString("N1") + "%";

                    produ += ((Buenos2 / TotalBuenos2) * 100);

                    int HorasProduccion = (Convert.ToInt32(reader["HorasTiraje"].ToString()) / 3600);
                    if (HorasProduccion > 0)
                    {
                        p.Velocidad = (Buenos / HorasProduccion).ToString("N0").Replace(",", ".");
                        Velocidad  += (Buenos / HorasProduccion);
                    }
                    else
                    {
                        p.Velocidad = "0";
                    }

                    count++;
                    lista.Add(p);
                }
                if (reader.Read() == false)
                {
                    InformeSemanal p = new InformeSemanal();
                    p.Semana   = "";
                    p.Maquina  = "<b>TOTALES:</b>";
                    p.Buenos   = "<b>" + Bons.ToString("N0").Replace(",", ".") + "</b>";
                    p.Entradas = "<b>" + Entr.ToString() + "</b>";
                    TimeSpan t0    = TimeSpan.FromSeconds(HorasTir);
                    int      Dias0 = t0.Days * 24;
                    p.HorasTiraje = "<b>" + (t0.Hours + Dias0).ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Minutes.ToString().Length) + t0.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Seconds.ToString().Length) + t0.Seconds.ToString() + "</b>";

                    TimeSpan t1    = TimeSpan.FromSeconds(HorasPrep);
                    int      Dias1 = t1.Days * 24;
                    p.HorasPreparacion = "<b>" + (t1.Hours + Dias1).ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Minutes.ToString().Length) + t1.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Seconds.ToString().Length) + t1.Seconds.ToString() + "</b>";

                    TimeSpan t2    = TimeSpan.FromSeconds(horasImp);
                    int      Dias2 = t2.Days * 24;
                    p.HorasImproductivas = "<b>" + (t2.Hours + Dias2).ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Minutes.ToString().Length) + t2.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t2.Seconds.ToString().Length) + t2.Seconds.ToString() + "</b>";

                    TimeSpan t3    = TimeSpan.FromSeconds(promPrep / count);
                    int      Dias3 = t3.Days * 24;
                    p.PromedioPreparacion = "<b>" + (t3.Hours + Dias3).ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Minutes.ToString().Length) + t3.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t3.Seconds.ToString().Length) + t3.Seconds.ToString() + "</b>";

                    p.Productividad = "<b>" + produ.ToString() + "%</b>";
                    p.Velocidad     = "<b>" + (((Convert.ToDouble(Bons)) / (HorasTir / 3600))).ToString("N0").Replace(",", ".") + "</b>";
                    lista.Add(p);
                }
            }
            conexion.CerrarConexion();

            return(lista);
        }
        public List <EstProduccion> Produccion_InformeProduccion(string OT, string NombreOT, string Area, string Maquina, string Operador, DateTime Fechainicio, DateTime FechaTermino, int Procedimiento)
        {
            List <EstProduccion> lista    = new List <EstProduccion>();
            Conexion             conexion = new Conexion();
            SqlCommand           cmd      = conexion.AbrirConexionIntranet();
            string ceros = "00";

            if (cmd != null)
            {
                cmd.CommandText = "[Produccion_InformeProduccion_V2]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@NombreOT", NombreOT);
                cmd.Parameters.AddWithValue("@Area", Area);
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@Operador", Operador);
                cmd.Parameters.AddWithValue("@FechaInicio", Fechainicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 9000000;
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    EstProduccion p = new EstProduccion();
                    p.Maquina  = reader["Maquina"].ToString().Replace("Rapida 106", "").Replace("C150", "").Replace("C-18", "").ToLower();
                    p.OT       = reader["OT"].ToString();
                    p.NombreOT = reader["NombreOT"].ToString().ToLower();
                    p.Pliego   = Regex.Replace(reader["Pliego"].ToString(), @"[^0-9]", string.Empty);
                    double Plani = Convert.ToDouble(reader["Planificado"].ToString());
                    p.Planificado = Convert.ToInt32(reader["Planificado"].ToString()).ToString("N0").Replace(",", ".");
                    double Buenos = Convert.ToDouble(reader["Buenos"].ToString());
                    p.Producido = Convert.ToInt32(reader["Buenos"].ToString()).ToString("N0").Replace(",", ".");

                    TimeSpan t0    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasTiraje"].ToString()));
                    int      Dias0 = t0.Days * 24;
                    p.HorasTiraje = (t0.Hours + Dias0).ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Minutes.ToString().Length) + t0.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t0.Seconds.ToString().Length) + t0.Seconds.ToString();

                    TimeSpan t1    = TimeSpan.FromSeconds(Convert.ToDouble(reader["HorasPreparacion"].ToString()));
                    int      Dias1 = t1.Days * 24;
                    p.HorasPreparacion = (t1.Hours + Dias1).ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Minutes.ToString().Length) + t1.Minutes.ToString() + ":" + ceros.Substring(0, ceros.Length - t1.Seconds.ToString().Length) + t1.Seconds.ToString();

                    p.MermaTiraje = Convert.ToInt32(reader["MermaTiraje"].ToString()).ToString("N0").Replace(",", ".");

                    p.MermaPreparacion = Convert.ToInt32(reader["MermaPreparacion"].ToString()).ToString("N0").Replace(",", ".");

                    p.FechaInicio = Convert.ToDateTime(reader["FechaInicio"].ToString()).ToString("dd/MM/yyyy HH:mm");
                    if (Convert.ToDateTime(reader["FechaTermino"].ToString()).ToString("dd/MM/yyyy HH:mm") == "30/12/1899 00:00")
                    {
                        p.FechaTermino = "En Proceso";
                    }
                    else
                    {
                        p.FechaTermino = Convert.ToDateTime(reader["FechaTermino"].ToString()).ToString("dd/MM/yyyy HH:mm");
                    }
                    double horastir = Convert.ToDouble(reader["HorasTiraje"].ToString()) / 3600;
                    if (Buenos > 0)
                    {
                        p.Velocidad = Convert.ToInt32(Buenos / horastir).ToString("N0").Replace(",", ".") + "/Hr";
                    }
                    else
                    {
                        p.Velocidad = "0/Hr";
                    }

                    double HorasImp = Convert.ToDouble(reader["HorasImproductivas"].ToString()) / 3600;
                    if (horastir > 0)
                    {
                        p.Uptime = ((horastir / (horastir + HorasImp)) * 100).ToString("N2") + "%";
                    }
                    else
                    {
                        p.Uptime = "0,00%";
                    }
                    if (p.Maquina.ToLower().Contains("kba"))
                    {
                        p.VerMas = "";
                    }
                    else
                    {
                        p.VerMas = "<a style='Color:Blue;text-decoration:none;' href='javascript:openDetalle(\"" + reader["OT"].ToString() + "\",\"" + reader["Processo"].ToString() + "\",\"" + reader["NombreOT"].ToString() + "\",\"" + p.Pliego + "\")'>Ver Más</a>";
                    }
                    if (Procedimiento == 3)
                    {
                        p.Operador = reader["Operador"].ToString();
                    }
                    else
                    {
                        p.Operador = "";
                    }
                    p.CodRecurso = reader["CodRecurso"].ToString();
                    lista.Add(p);
                }
            }
            conexion.CerrarConexion();

            return(lista);
        }
        public List <InformeSemanal> ListaInformeMaquinaPorTurno(string Area, string Maquina, DateTime FechaInicio, DateTime FechaTermino, int Procedimiento)
        {
            List <InformeSemanal> lista = new List <InformeSemanal>();
            Conexion   conexion         = new Conexion();
            SqlCommand cmd     = conexion.AbrirConexionIntranet();
            string     ceros   = "00";
            int        Tnoche  = 0;
            int        TMañana = 0;
            int        TTarde  = 0;
            double     Total   = 0;

            if (cmd != null)
            {
                cmd.CommandText = "Produccion_InformePorSemana";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Area", Area);
                cmd.Parameters.AddWithValue("@Maquina", Maquina);
                cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                cmd.CommandTimeout = 99999999;
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    InformeSemanal p = new InformeSemanal();
                    p.Semana  = reader["Semana"].ToString();
                    p.Maquina = reader["Maquina"].ToString();
                    int Noc = Convert.ToInt32(reader["Noche"].ToString());
                    Tnoche += Noc;
                    int Man = Convert.ToInt32(reader["Mañana"].ToString());
                    TMañana += Man;
                    int Tar = Convert.ToInt32(reader["Tarde"].ToString());
                    TTarde += Tar;
                    double TotalTurnos = Convert.ToDouble(reader["TotalTurnos"].ToString());
                    p.Noche      = Noc.ToString("N0").Replace(",", ".");
                    p.Mañana     = Man.ToString("N0").Replace(",", ".");
                    p.Tarde      = Tar.ToString("N0").Replace(",", ".");
                    p.PorcNoche  = ((Convert.ToDouble(Noc) / TotalTurnos) * 100).ToString("N2") + "%";
                    p.PorcMañana = ((Convert.ToDouble(Man) / TotalTurnos) * 100).ToString("N2") + "%";
                    p.PorcTarde  = ((Convert.ToDouble(Tar) / TotalTurnos) * 100).ToString("N2") + "%";
                    p.Generales  = Convert.ToInt32(reader["TotalTurnos"].ToString()).ToString("N0").Replace(",", ".");
                    Total        = Convert.ToDouble(reader["TotalBuenos"].ToString());
                    lista.Add(p);
                }
                if (reader.Read() == false)
                {
                    InformeSemanal p = new InformeSemanal();
                    p.Semana     = "";
                    p.Maquina    = "<b>TOTALES:</b>";
                    p.Noche      = "<b>" + Tnoche.ToString("N0").Replace(",", ".") + "</b>";
                    p.Mañana     = "<b>" + TMañana.ToString("N0").Replace(",", ".") + "</b>";
                    p.Tarde      = "<b>" + TTarde.ToString("N0").Replace(",", ".") + "</b>";
                    p.PorcNoche  = "<b>" + ((Convert.ToDouble(Tnoche) / Total) * 100).ToString("N2") + "%</b>";
                    p.PorcMañana = "<b>" + ((Convert.ToDouble(TMañana) / Total) * 100).ToString("N2") + "%</b>";
                    p.PorcTarde  = "<b>" + ((Convert.ToDouble(TTarde) / Total) * 100).ToString("N2") + "%</b>";
                    p.Generales  = "<b>" + Convert.ToInt32(Total).ToString("N0").Replace(",", ".") + "</b>";
                    lista.Add(p);
                }
            }
            conexion.CerrarConexion();

            return(lista);
        }
Пример #29
0
        public List <Consumo> ListarReal(string OT)
        {
            List <Consumo> lista = new List <Consumo>();
            Conexion       con   = new Conexion();
            SqlCommand     cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Adm_List_ConsReal";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@NumOrdem", OT);
                SqlDataReader reader   = cmd.ExecuteReader();
                int           TotalBob = 0;
                int           TotalPlg = 0;
                double        TotalCst = 0;
                while (reader.Read())
                {
                    Consumo cons = new Consumo();
                    cons.Lote        = reader["Lote"].ToString();
                    cons.CodItem     = "";//reader["CodItem"].ToString();
                    cons.NombrePapel = reader["Material"].ToString();
                    cons.Gramage     = reader["Gramage"].ToString();
                    cons.Ancho       = reader["Ancho"].ToString();
                    cons.Largo       = reader["Largo"].ToString();
                    cons.Certif      = "";//reader["Certificacion"].ToString() + " " + reader["Perc_Certificacion"].ToString() + " %";
                    //cons.Costtot = Convert.ToDouble(reader["valor"].ToString());
                    double unitario = Convert.ToDouble(reader["valorunitario"].ToString());
                    cons.CostUni = unitario.ToString("N2").Replace('.', ',');
                    double   Total = Convert.ToDouble(reader["valor"].ToString());
                    string[] str   = Total.ToString("N2").Split('.');
                    cons.Costtot = str[0].ToString().Replace(',', '.') + "," + str[1];
                    TotalCst     = TotalCst + Convert.ToDouble(reader["valor"].ToString());

                    if (reader["Tipo"].ToString() == "Bobina")
                    {
                        cons.Cons_Bobina = Convert.ToInt32(Convert.ToDouble(reader["Cantidad"])).ToString("N0").Replace(",", ".") + " " + reader["Unidad"].ToString();
                        cons.Cons_Pliego = "0 FL";
                        TotalBob         = TotalBob + Convert.ToInt32(reader["Cantidad"]);
                    }
                    else
                    {
                        cons.Cons_Pliego = Convert.ToInt32(reader["Cantidad"]).ToString("N0").Replace(",", ".") + " " + reader["Unidad"].ToString();
                        cons.Cons_Bobina = "0 KG";
                        TotalPlg         = TotalPlg + Convert.ToInt32(reader["Cantidad"]);
                    }

                    lista.Add(cons);
                }
                if (lista.Count > 0)
                {
                    if (!reader.Read())
                    {
                        Consumo cons = new Consumo();
                        cons.Largo       = "TOTAL";
                        cons.Cons_Pliego = TotalPlg.ToString("N0").Replace(',', '.') + " FL";
                        cons.Cons_Bobina = TotalBob.ToString("N0").Replace(',', '.') + " KG";
                        string[] str = TotalCst.ToString("N2").Split('.');
                        cons.Costtot = str[0].ToString().Replace(',', '.') + "," + str[1];
                        lista.Add(cons);
                    }
                }
                con.CerrarConexion();
            }
            return(lista);
        }
Пример #30
0
        public string Carga_MisProyectos(string Usuario, string NombreProyecto, string OT, int Procedimiento)
        {
            string RackLibre = "<table id='tblRegistro' runat='server' cellspacing='0' cellpadding='0' style='border: 1px solid #CCC; margin: 0 auto; margin-top: 0px; margin-bottom: 15px; width:650px;margin-left:15px;'>" +
                               "<tbody><tr style='height: 22px; background: #f3f4f9; font: 11px Arial, Helvetica, sans-serif; color: #003e7e; text-align: left;'>" +
                               "<td style='font-weight: bold; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;'>Nombre Proyecto</td>" +
                               "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;'>Fecha Creación</td>" +
                               "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;'>Estado</td>" +
                               "<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;'></td>" +
                               //"<td style='font-weight: normal; padding: 4px 0 0 5px; border-right: 1px solid #ccc;text-align:center;'>Activar/Desactivar Proyecto</td>" +
                               "</tr>";
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[Proyectos_NuevoProyecto]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Usuario", Usuario);
                cmd.Parameters.AddWithValue("@NombreProyecto", NombreProyecto);
                cmd.Parameters.AddWithValue("@OT", OT);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);

                SqlDataReader reader = cmd.ExecuteReader();


                while (reader.Read())
                {
                    string nombre = reader["NombreProyecto"].ToString();

                    DateTime fechacreacion = Convert.ToDateTime(reader["FechaCreacion"].ToString());
                    string   FechaC        = fechacreacion.ToString("dd/MM/yyyy HH:ss:mm");
                    string   Estado        = "";
                    string   Actividad     = "";
                    if (reader["Estado"].ToString() == "1")
                    {
                        Estado = "<div style='Color:Green;'>ACTIVO</div>";
                        //Actividad = "<div style='Color:Blue;'><a href='#' style='text-Decorate:none'>Activar</a></div>";
                    }
                    else
                    {
                        Estado = "<div style='Color:Red;'>INACTIVO</div>";
                        // Actividad = "<div style='Color:Black;'><a href='#' style='text-Decorate:none'>Desctivar</a></div>";
                    }

                    RackLibre = RackLibre +
                                "  <tr style='height: 22px; background: #fff; font: 11px Arial, Helvetica, sans-serif; color: #333;  vertical-align: text-top;'>" +
                                "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;'>" +
                                "<asp:Label ID='lblDespachado' runat='server'>" + nombre.ToUpper() + "</asp:Label> &nbsp; &nbsp; &nbsp; &nbsp;</td>" +
                                "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;'>" +
                                "  <asp:Label ID='lblPrimerDesp' runat='server'>" + FechaC + "</asp:Label></td>" +
                                "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;'>" +
                                "<asp:Label ID='lblUltDesp' runat='server'>" + Estado + "</asp:Label></td>" +
                                "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;'>" +
                                "<asp:Label ID='lblDevolucion' runat='server'><a href='MisProyectos.aspx?u=" + Usuario + "&n=" + nombre + "'>Ver Más</a></asp:Label> &nbsp; &nbsp; &nbsp; &nbsp; </td>" +

                                // "<td style='font-weight: normal; padding: 4px 0 5px 5px; border-right: 1px solid #ccc;text-align:center;'>" +
                                //"<asp:Label ID='lblUltDesp' runat='server'>" + Actividad + "</asp:Label></td>" +
                                "</tr>";
                }
                RackLibre = RackLibre + "</tbody></table>";
            }
            con.CerrarConexion();
            return(RackLibre);
        }