Пример #1
0
        public Estado_OT BuscarOTLiquidar(string ot, int procedimiento)
        {
            Conexion   con = new Conexion();
            Estado_OT  des = new Estado_OT();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Desp_LiquidarOT";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@Estado", 1);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    //des.OT = reader["QG_RMS_JOB_NBR"].ToString();
                    des.NombreOT    = reader["NM"].ToString();
                    des.TirajeTotal = reader["PRN_ORD_QTY"].ToString();
                    des.Estado      = reader["JOB_STS"].ToString();
                    des.FechaMaxima = reader["FECHA_LIQUIDACION"].ToString();
                    des.Cliente     = reader["CUST_NM"].ToString();

                    //datos adicionales
                    des.Devolucion      = reader["Devolucion"].ToString();
                    des.OT              = reader["FechaMinima"].ToString();
                    des.Saldo           = reader["FechaMaxima"].ToString();
                    des.TotalDespachado = reader["TotalDespachado"].ToString();
                }
            }
            con.CerrarConexion();
            return(des);
        }
        public static string[] BuscarOT(string OT)
        {
            Controller_EstadoOT c = new Controller_EstadoOT();
            Estado_OT           b = c.BuscarOT(OT, 0);

            return(new[] { b.NombreOT, b.Cliente });
        }
        public static string CargaMotivo(string Area)
        {
            int tipo = 0;

            if (Area == "CSR")
            {
                tipo = 4;
            }
            else if (Area == "Vendedores")
            {
                tipo = 5;
            }
            Controller_EstadoOT c      = new Controller_EstadoOT();
            List <Estado_OT>    lista  = c.ListarArea("", tipo);
            List <Estado_OT>    lista2 = new List <Estado_OT>();

            int       contador = 1;
            Estado_OT insert1  = new Estado_OT();

            insert1.Cliente = "Seleccionar";
            lista2.Insert(0, insert1);
            foreach (Estado_OT ps in lista)
            {
                Estado_OT objst = new Estado_OT();
                objst.Cliente = ps.Cliente;
                lista2.Insert(contador, objst);
                contador++;
            }

            JavaScriptSerializer jscript = new JavaScriptSerializer();

            return(jscript.Serialize(lista2));
        }
Пример #4
0
        public List <Estado_OT> ListarArea(string ot, int procedimiento)
        {
            List <Estado_OT> lista = new List <Estado_OT>();
            Conexion         con   = new Conexion();
            SqlCommand       cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Desp_Egresos";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Estado_OT des = new Estado_OT();
                    if (procedimiento == 2 || procedimiento == 4 || procedimiento == 5 || procedimiento == 6 || procedimiento == 7 || procedimiento == 8 || procedimiento == 9 || procedimiento == 10 || procedimiento == 11)
                    {
                        des.Cliente = reader["Usuario"].ToString().ToLower();
                    }
                    else if (procedimiento == 3)
                    {
                        string[] a = reader["Usuario"].ToString().ToLower().Split(' ');
                        try
                        {
                            if (a.Count() == 3)
                            {
                                des.Cliente = a[0] + " " + a[1];
                            }
                            else
                            {
                                des.Cliente = a[0] + " " + a[2];
                            }
                        }
                        catch
                        {
                            des.Cliente = reader["Usuario"].ToString().ToLower();
                        }
                    }
                    lista.Add(des);
                }
            }
            con.CerrarConexion();
            return(lista);
        }
Пример #5
0
        public Estado_OT BuscarOT(string ot, int procedimiento)
        {
            Estado_OT  des = new Estado_OT();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Desp_Egresos";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OT", ot);
                cmd.Parameters.AddWithValue("@Procedimiento", procedimiento);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    des.NombreOT = reader["NombreOT"].ToString();
                    des.Cliente  = reader["Cliente"].ToString();
                }
            }
            con.CerrarConexion();
            return(des);
        }
        public static string CargaMotivos(string Area)
        {
            Controller_EstadoOT c      = new Controller_EstadoOT();
            List <Estado_OT>    lista  = c.ListarArea(Area, 6);
            List <Estado_OT>    lista2 = new List <Estado_OT>();

            int       contador = 1;
            Estado_OT insert1  = new Estado_OT();

            insert1.Cliente = "Seleccionar";
            lista2.Insert(0, insert1);
            foreach (Estado_OT ps in lista)
            {
                Estado_OT objst = new Estado_OT();
                objst.Cliente = ps.Cliente;
                lista2.Insert(contador, objst);
                contador++;
            }

            JavaScriptSerializer jscript = new JavaScriptSerializer();

            return(jscript.Serialize(lista2));
        }
Пример #7
0
        protected void btnFiltro_Click(object sender, EventArgs e)
        {
            Controller_EstadoOT controlstatus = new Controller_EstadoOT();
            Estado_OT           status        = controlstatus.BuscarOTLiquidar(txtOT.Text, 1);

            lblOT.Text = status.NombreOT;
            if (status.FechaMaxima != "")
            {
                lblFeliqui.Text    = Convert.ToDateTime(status.FechaMaxima).ToString("dd-MM-yyyy");
                lblFeliqui.Visible = true;
                Label2.Visible     = true;
            }
            lblOT.Visible  = true;
            Label1.Visible = true;
            List <Consumo> lista = controlCons.Listar(txtOT.Text);

            Consumo Papel = new Consumo();

            RadGridRF.DataSource = lista.Where(o => o.Tipo == "Bobina" || o.Tipo == "Pliego").ToList();
            RadGridRF.DataBind();
            foreach (Consumo c in lista.Where(o => o.Tipo == "Bobina" || o.Tipo == "Pliego"))
            {
                if (c.Tipo == "Bobina")
                {
                    Papel.Cons_Bobina = (Convert.ToInt32(c.Cons_Bobina.Substring(0, c.Cons_Bobina.Length - 2).Replace(".", string.Empty)) + Convert.ToInt32(Papel.Cons_Bobina)).ToString();
                }
                else
                {
                    Papel.Cons_Pliego = (Convert.ToInt32(c.Cons_Pliego.Substring(0, c.Cons_Pliego.Length - 2).Replace(".", string.Empty)) + Convert.ToInt32(Papel.Cons_Pliego)).ToString();
                }
                Papel.Costtot = (Convert.ToDouble(Papel.Costtot) + Convert.ToDouble(c.Costtot.Replace(",", string.Empty))).ToString();
            }
            lblPliego.Text = Convert.ToInt32(Papel.Cons_Pliego).ToString("N0").Replace(",", ".") + " FL";
            lblBobina.Text = Convert.ToInt32(Papel.Cons_Bobina).ToString("N0").Replace(",", ".") + " KG";
            lblTotal.Text  = Convert.ToDouble(Papel.Costtot).ToString("N2");

            if (lista.Where(o => o.Tipo == "Plancha").ToList().Count > 0)
            {
                RadGridPlanchas.DataSource = lista.Where(o => o.Tipo == "Plancha").ToList();
                RadGridPlanchas.DataBind();
                RadGridPlanchadiv.Visible = true;
                RadGridPlanchaTit.Visible = true;
                tablaPlancha.Visible      = true;
                foreach (Consumo c in lista.Where(o => o.Tipo == "Plancha"))
                {
                    Papel.Cons_Plancha = (Convert.ToInt32(c.Cons_Plancha.Substring(0, c.Cons_Plancha.Length - 2).Replace(",", string.Empty)) + Convert.ToInt32(Papel.Cons_Plancha)).ToString();

                    Papel.Ancho = (Convert.ToDouble(Papel.Ancho) + Convert.ToDouble(c.Costtot.Replace(",", string.Empty))).ToString();
                }

                lblPlancha.Text  = Convert.ToInt32(Papel.Cons_Plancha).ToString("N0") + " UN";
                lblTotalplc.Text = Convert.ToDouble(Papel.Ancho).ToString("N2");
            }
            else
            {
                RadGridPlanchadiv.Visible = false;
                RadGridPlanchaTit.Visible = false;
                tablaPlancha.Visible      = false;
            }
            if (lista.Where(o => o.Tipo == "Otro").ToList().Count > 0)
            {
                RadGridOtros.DataSource = lista.Where(o => o.Tipo == "Otro").ToList();
                RadGridOtros.DataBind();
                RadGridOtrosdiv.Visible = true;
                RadGridOtrosTit.Visible = true;
                TableOtros.Visible      = true;
                foreach (Consumo c in lista.Where(o => o.Tipo == "Otro"))
                {
                    Papel.Cons_Otros = (Convert.ToInt32(c.Cons_Otros.Substring(0, c.Cons_Otros.Length - 2).Replace(".", string.Empty)) + Convert.ToInt32(Papel.Cons_Otros)).ToString();

                    Papel.Certif = (Convert.ToDouble(Papel.Certif) + Convert.ToDouble(c.Costtot.Replace(",", string.Empty))).ToString();
                }

                lblOtros.Text      = Convert.ToInt32(Papel.Cons_Otros).ToString("N0") + " UN";
                lblTotalOtros.Text = Convert.ToDouble(Papel.Certif).ToString("N2");
            }
            else
            {
                RadGridOtrosdiv.Visible = false;
                RadGridOtrosTit.Visible = false;
                TableOtros.Visible      = false;
            }
            List <Consumo> lista2 = controlCons.ListarSerExterno(txtOT.Text);

            if (lista2.Count > 0)
            {
                DivTitServExt.Visible        = true;
                DivSerExterno.Visible        = true;
                TablaSerExter.Visible        = true;
                RadGridSerExterno.DataSource = lista2;
                RadGridSerExterno.DataBind();
                foreach (Consumo c in lista2)
                {
                    Papel.CostUni = (Convert.ToDouble(Papel.CostUni) + Convert.ToDouble(c.Costtot.Replace(",", string.Empty))).ToString();
                    //aaaa = aaaa + "+" + Convert.ToDouble(c.Costtot.Replace(".", string.Empty).Replace(",", ".")).ToString();
                }
                lblTotalSerExt.Text = Convert.ToDouble(Papel.CostUni).ToString("N2");
                //string b = aaaa;
            }
            else
            {
                DivTitServExt.Visible = false;
                DivSerExterno.Visible = false;
                TablaSerExter.Visible = false;
            }
        }
        public static string CargaArea(string Area)
        {
            int tipo = 0;

            if (Area == "CSR")
            {
                tipo = 2;
            }
            else if (Area == "Vendedores")
            {
                tipo = 3;
            }
            else if (Area == "Bodega de Rezago")
            {
                tipo = 4;
            }
            else if (Area == "Facturacion")
            {
                tipo = 5;
            }
            else if (Area == "Biblioteca")
            {
                tipo = 7;
            }
            else if (Area == "Despacho")
            {
                tipo = 8;
            }
            else if (Area == "Bodega Materias Primas")
            {
                tipo = 9;
            }
            else if (Area == "Encuadernacion")
            {
                tipo = 10;
            }
            else if (Area == "Control de Calidad")
            {
                tipo = 11;
            }
            Controller_EstadoOT c      = new Controller_EstadoOT();
            List <Estado_OT>    lista  = c.ListarArea("", tipo);
            List <Estado_OT>    lista2 = new List <Estado_OT>();

            int       contador = 1;
            Estado_OT insert1  = new Estado_OT();

            insert1.Cliente = "Seleccionar";
            lista2.Insert(0, insert1);
            foreach (Estado_OT ps in lista)
            {
                Estado_OT objst = new Estado_OT();
                objst.Cliente = ps.Cliente;
                lista2.Insert(contador, objst);
                contador++;
            }

            JavaScriptSerializer jscript = new JavaScriptSerializer();

            return(jscript.Serialize(lista2));
        }
Пример #9
0
        public void CargaRegistros()
        {
            tblRegistro.Visible = true;

            Estado_OT et = eo.BuscarOTLiquidar(txtOT.Text, 1);

            btnFiltro.Enabled = false;
            txtOT.Enabled     = false;
            //txtOT.Text = et.OT.ToUpper();
            lblNombreOT.Text = et.NombreOT;
            lblCliente.Text  = et.Cliente;
            int ti = Convert.ToInt32(et.TirajeTotal);

            lblTiraje.Text = ti.ToString("N0").Replace(",", ".");

            if (et.Estado == "1")
            {
                lblEstadoActual.ForeColor = Color.Blue;
                lblEstadoActual.Text      = "En Proceso.";
            }
            else if (et.Estado == "A")
            {
                lblEstadoActual.ForeColor = Color.Blue;
                lblEstadoActual.Text      = "En Proceso.";
            }
            else if (et.Estado == "E")
            {
                lblEstadoActual.ForeColor = Color.Red;
                lblEstadoActual.Text      = "Liquidada.";
            }
            else
            {
                lblEstadoActual.ForeColor = Color.Red;
                lblEstadoActual.Text      = "Liquidada.";
            }



            if (et.FechaMaxima != "")
            {
                DateTime fc = Convert.ToDateTime(et.FechaMaxima);
                lblFechaLiquidacion.Text = fc.ToString("dd/MM/yyyy HH:mm:ss");
            }
            else
            {
                lblFechaLiquidacion.Text = "Sin Fecha de Liquidacion";
            }

            //datos adicionales
            int      devolucion = Convert.ToInt32(et.Devolucion);
            DateTime fmin       = Convert.ToDateTime(et.OT);
            DateTime fmax       = Convert.ToDateTime(et.Saldo);
            int      totalDesp  = Convert.ToInt32(et.TotalDespachado);

            lblDespachado.Text = totalDesp.ToString("N0").Replace(",", ".");
            lblPrimerDesp.Text = fmin.ToString("dd/MM/yyyy HH:mm:ss");
            lblUltDesp.Text    = fmax.ToString("dd/MM/yyyy HH:mm:ss");
            lblDevolucion.Text = devolucion.ToString("N0").Replace(",", ".");

            int saldo = (ti - (totalDesp - devolucion));

            if (saldo <= 0)
            {
                lblFaltante.Text = "0";
            }
            else
            {
                lblFaltante.Text = saldo.ToString("N0").Replace(",", ".");
            }
        }