コード例 #1
0
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            string OT = txtOT.Text;

            Controller_Consumo controlcons = new Controller_Consumo();

            if (OT.Trim() != "")
            {
                GridView gv = new GridView();
                gv.DataSource = controlCons.Listar(txtOT.Text);
                gv.DataBind();
                gv.HeaderStyle.BackColor = System.Drawing.Color.Blue;
                gv.HeaderStyle.ForeColor = System.Drawing.Color.White;


                gv.HeaderRow.Cells[1].Text  = "Cod Item";
                gv.HeaderRow.Cells[2].Text  = "Nombre Papel";
                gv.HeaderRow.Cells[3].Text  = "Gr.";
                gv.HeaderRow.Cells[6].Text  = "Consumo Pliego";
                gv.HeaderRow.Cells[7].Text  = "Consumo Bobina";
                gv.HeaderRow.Cells[8].Text  = "Certificación";
                gv.HeaderRow.Cells[9].Text  = "Costo Unitario";
                gv.HeaderRow.Cells[10].Text = "Costo Total";

                if (lblOT.Text != "")
                {
                    string NombreOT = "OT : " + txtOT.Text + " - " + lblOT.Text;
                    ExportToExcel("Consumo por OT " + DateTime.Now.ToString("dd-MM-yyyy HH:mm"), gv, NombreOT, Label2.Text + lblFeliqui.Text);
                }
            }
        }
コード例 #2
0
        public void CargarMaquinas()
        {
            Controller_Consumo controlconsumo = new Controller_Consumo();

            ddlMaquina.DataSource     = controlconsumo.ListarStockInsumoMaquina();
            ddlMaquina.DataTextField  = "Gramage";
            ddlMaquina.DataValueField = "CodItem";
            ddlMaquina.DataBind();
            ddlMaquina.Items.Insert(0, new ListItem("-- Seleccione --", "0"));
        }
コード例 #3
0
        public void CargarDatos()
        {
            Controller_Consumo controlConsumo = new Controller_Consumo();
            string             codigo         = txtCodItem.Text;
            string             Descripcion    = txtDescrip.Text;
            string             Grupo          = txtGrupo.Text;

            RadGridInsumo.DataSource = controlConsumo.ListarStockInsumo(codigo, Descripcion, Grupo);
            RadGridInsumo.DataBind();
        }
コード例 #4
0
        public void CargarDatos()
        {
            string Mes = ddlMes.SelectedValue.ToString();
            string Año = ddlAño.SelectedValue.ToString();

            Controller_Consumo controlcons = new Controller_Consumo();

            if (Mes != "Seleccione Mes")
            {
                List <Cabecera> lista1 = controlcons.ListarConsumoMes(Mes, Año, 1);
                List <Cabecera> lista2 = controlcons.ListarConsumoMes(Mes, Año, 2);
                RadGridInforme.DataSource = lista1.Where(o => o.Id_Funcionalidad != "");
                RadGridInforme.DataBind();
                RadGridOtros.DataSource = lista2.Where(o => o.Id_Funcionalidad != "");
                RadGridOtros.DataBind();
                foreach (Cabecera cab in lista1.Where(o => o.Id_Funcionalidad == ""))
                {
                    lblOperacion.Text   = cab.EmpId;
                    lblHoja.Text        = cab.LlgDocNumDoc;
                    lblPrecioHoja.Text  = cab.LlgDocGlosa;
                    lblBobina.Text      = cab.LlgDocFechaIng;
                    lblPrecioBob.Text   = cab.LlgDocNumInterno;
                    lblKgTotal.Text     = cab.IntPeriodo;
                    lblPrecioTotal.Text = cab.OpeCod;
                    lblFlPliego.Text    = cab.DivCodigo;
                }

                foreach (Cabecera cab in lista2.Where(o => o.Id_Funcionalidad == ""))
                {
                    lblOperacion2.Text   = cab.EmpId;
                    lblHoja2.Text        = cab.LlgDocNumDoc;
                    lblPrecioHoja2.Text  = cab.LlgDocGlosa;
                    lblBobina2.Text      = cab.LlgDocFechaIng;
                    lblPrecioBob2.Text   = cab.LlgDocNumInterno;
                    lblKgTotal2.Text     = cab.IntPeriodo;
                    lblPrecioTotal2.Text = cab.OpeCod;
                    lblFlPliego2.Text    = cab.DivCodigo;
                }
            }
            else
            {
                RadGridInforme.DataSource = "";
                RadGridInforme.DataBind();
                RadGridOtros.DataSource = "";
                RadGridOtros.DataBind();
            }
        }
コード例 #5
0
        public void CargarOTs(int procedimiento)
        {
            string OT        = txtNumeroOT.Text;
            string NombreOT  = txtNombreOT.Text;
            string Cliente   = txtCliente.Text;
            string FeInicio  = "";
            string FeTermino = "";

            if (txtFechaInicio.Text.Trim() != "" && txtFechaTermino.Text.Trim() != "")
            {
                string[] split = txtFechaInicio.Text.Split('/');
                FeInicio = split[2] + "-" + split[1] + "-" + split[0];
                string[] split2 = txtFechaTermino.Text.Split('/');
                FeTermino = split2[2] + "-" + split2[1] + "-" + split2[0] + " 23:59:59";
            }
            if (procedimiento == 1 && txtFechaInicio.Text.Trim() == "" && txtFechaTermino.Text.Trim() == "" && OT == "" && NombreOT == "" && Cliente == "")
            {
                procedimiento = 0;
            }
            Controller_Consumo controlconsum = new Controller_Consumo();

            RadGridLiq.DataSource = controlconsum.ListarLiquidarOTs(OT, NombreOT, Cliente, FeInicio, FeTermino, procedimiento);
            RadGridLiq.DataBind();
        }
コード例 #6
0
        public void CargarFacturacion(string OT)
        {
            Controller_Consumo controlCons = new Controller_Consumo();

            List <Consumo> lista = controlCons.Listar(OT);

            Consumo Papel = new Consumo();

            RadGridRF.DataSource = lista.Where(o => o.Tipo == "Bobina" || o.Tipo == "Pliego").ToList();
            RadGridRF.DataBind();
            string aaaa = "";

            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).Replace(",", "."))).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).Replace(",", "."))).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).Replace(",", "."))).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(OT);

            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;
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OrdenController    oc          = new OrdenController();
                List <Consumo>     lista       = new List <Consumo>();
                Controller_Consumo controlCons = new Controller_Consumo();
                string             Facturacion = "";
                int      Pag = 0;
                string[] OTs = Request.QueryString["id"].Split(',');

                for (int i = 0; i < OTs.Count(); i++)
                {
                    lista = new List <Consumo>();
                    lista = controlCons.Listar(OTs[i]);
                    string  ConsumoPapel    = "";
                    string  ConsumoPlancha  = "";
                    string  ConsumoOtros    = "";
                    string  ConsumoSerExt   = "";
                    int     contadorPapel   = 0;
                    int     contadorPlancha = 0;
                    int     contadorOtros   = 0;
                    int     contadorSerExt  = 0;
                    Consumo Papel           = new Consumo();
                    foreach (Consumo c in lista.Where(o => o.Tipo == "Bobina" || o.Tipo == "Pliego").ToList())
                    {
                        if (contadorPapel == 0)
                        {
                            ConsumoPapel = "<div style='width:1000px;' align='center'>Consumos de Papel</div><table id='tblPapel' runat='server' cellspacing='0' cellpadding='0' >" +
                                           "<thead><tr>" +
                                           "<td style='text-align:center;'>Lote</td>" +
                                           "<td style='text-align:center;'>Cod Item</td>" +
                                           "<td style='text-align:center;'>Nombre Papel</td>" +
                                           "<td style='text-align:center;'>Gr.</td>" +
                                           "<td style='text-align:center;'>Ancho</td>" +
                                           "<td style='text-align:center;'>Largo</td>" +
                                           "<td style='text-align:center;'>Cons. Pliego</td>" +
                                           "<td style='text-align:center;'>Cons. Bobina</td>" +
                                           "<td style='text-align:center;'>Certificación</td>" +
                                           "<td style='text-align:center;'>Costo Unitario</td>" +
                                           "<td style='text-align:center;'>Costo Total</td>" +
                                           "</tr></thead><tbody>";
                            contadorPapel++;
                        }
                        ConsumoPapel = ConsumoPapel + "<tr>" +
                                       "<td style='text-align:right;'>" + c.Lote + "</td>" +
                                       "<td style='text-align:right;'>" + c.CodItem + "</td>" +
                                       "<td style='text-align:center;'>" + c.NombrePapel + "</td>" +
                                       "<td style='text-align:right;'>" + c.Gramage + "</td>" +
                                       "<td style='text-align:right;'>" + c.Ancho + "</td>" +
                                       "<td style='text-align:right;'>" + c.Largo + "</td>" +
                                       "<td style='text-align:right;'>" + c.Cons_Pliego + "</td>" +
                                       "<td style='text-align:right;'>" + c.Cons_Bobina + "</td>" +
                                       "<td style='text-align:center;'>" + c.Certif + "</td>" +
                                       "<td style='text-align:right;'>" + c.CostUni + "</td>" +
                                       "<td style='text-align:right;'>" + c.Costtot + "</td>" +
                                       "</tr>";
                        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();
                        }
                        string algo = c.Costtot.Replace(".", string.Empty);
                        Papel.Costtot = (Convert.ToDouble(Papel.Costtot) + Convert.ToDouble(algo)).ToString();
                    }
                    foreach (Consumo c in lista.Where(o => o.Tipo == "Plancha"))
                    {
                        if (contadorPlancha == 0)
                        {
                            ConsumoPlancha = "<div style='width:1000px;' align='center'>Consumos de Planchas</div><table id='tblPapel' runat='server' cellspacing='0' cellpadding='0' >" +
                                             "<thead><tr>" +
                                             "<td style='text-align:center;'>Lote</td>" +
                                             "<td style='text-align:center;'>Cod Item</td>" +
                                             "<td style='text-align:center;'>Descripción</td>" +
                                             "<td style='text-align:center;'>Cantidad</td>" +
                                             "<td style='text-align:center;'>Costo Unitario</td>" +
                                             "<td style='text-align:center;'>Costo Total</td>" +
                                             "</tr></thead><tbody>";
                            contadorPlancha++;
                        }
                        ConsumoPlancha = ConsumoPlancha + "<tr>" +
                                         "<td style='text-align:right;'>" + c.Lote + "</td>" +
                                         "<td style='text-align:right;'>" + c.CodItem + "</td>" +
                                         "<td style='text-align:center;'>" + c.NombrePapel + "</td>" +
                                         "<td style='text-align:right;'>" + c.Cons_Plancha + "</td>" +
                                         "<td style='text-align:right;'>" + c.CostUni + "</td>" +
                                         "<td style='text-align:right;'>" + c.Costtot + "</td>" +
                                         "</tr>";
                        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();
                    }
                    foreach (Consumo c in lista.Where(o => o.Tipo == "Otro"))
                    {
                        if (contadorOtros == 0)
                        {
                            ConsumoOtros = "<div style='width:1000px;' align='center'>Otros Consumos</div><table id='tblPapel' runat='server' cellspacing='0' cellpadding='0'>" +
                                           "<thead><tr>" +
                                           "<td style='text-align:center;'>Lote</td>" +
                                           "<td style='text-align:center;'>Cod Item</td>" +
                                           "<td style='text-align:center;'>Nombre Material</td>" +
                                           "<td style='text-align:center;'>Cons. Otros</td>" +
                                           "<td style='text-align:center;'>Costo Unitario</td>" +
                                           "<td style='text-align:center;'>Costo Total</td>" +
                                           "</tr></thead><tbody>";
                            contadorOtros++;
                        }
                        ConsumoOtros = ConsumoOtros + "<tr>" +
                                       "<td style='text-align:right;'>" + c.Lote + "</td>" +
                                       "<td style='text-align:right;'>" + c.CodItem + "</td>" +
                                       "<td style='text-align:center;'>" + c.NombrePapel + "</td>" +
                                       "<td style='text-align:right;'>" + c.Cons_Otros + "</td>" +
                                       "<td style='text-align:right;'>" + c.CostUni + "</td>" +
                                       "<td style='text-align:right;'>" + c.Costtot + "</td>" +
                                       "</tr>";
                        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();
                    }
                    List <Consumo> lista2 = controlCons.ListarSerExterno(OTs[i]);
                    foreach (Consumo c in lista2)
                    {
                        if (contadorSerExt == 0)
                        {
                            ConsumoSerExt = "<div style='width:1000px;' align='center'>Servicios Externos</div><table id='tblPapel' runat='server' cellspacing='0' cellpadding='0' >" +
                                            "<thead><tr>" +
                                            "<td style='text-align:center;'>Descripción Proceso</td>" +
                                            "<td style='text-align:center;'>Componente</td>" +
                                            "<td style='text-align:center;'>Aplicación</td>" +
                                            "<td style='text-align:center;'>Formato (A x L)</td>" +
                                            "<td style='text-align:center;'>Cantidad</td>" +
                                            "<td style='text-align:center;'>Costo Unitario</td>" +
                                            "<td style='text-align:center;'>Costo Total</td>" +
                                            "</tr></thead><tbody>";
                            contadorSerExt++;
                        }
                        ConsumoSerExt = ConsumoSerExt + "<tr>" +
                                        "<td style='text-align:center;'>" + c.Lote + "</td>" +
                                        "<td style='text-align:center;'>" + c.Cons_Plancha + "</td>" +
                                        "<td style='text-align:center;'>" + c.CodItem + "</td>" +
                                        "<td style='text-align:right;'>" + c.NombrePapel + "</td>" +
                                        "<td style='text-align:right;'>" + c.Certif + "</td>" +
                                        "<td style='text-align:right;'>" + c.CostUni + "</td>" +
                                        "<td style='text-align:right;'>" + c.Costtot + "</td>" +
                                        "</tr>";
                        Papel.CostUni = (Convert.ToDouble(Papel.CostUni) + Convert.ToDouble(c.Costtot.Replace(".", string.Empty))).ToString();
                    }
                    if (contadorPapel > 0)
                    {
                        ConsumoPapel = ConsumoPapel + "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td style='text-align:center;'>Cons. Pliego</td>" +
                                       "<td style='text-align:center;'>Cons. Bobina </td><td style='text-align:center;'>Costo Total </td></tr><tr>" +
                                       "<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td style='text-align:center;'>Total</td>" +
                                       "<td style='text-align:right;'>" + Convert.ToInt32(Papel.Cons_Pliego).ToString("N0").Replace(",", ".") + " FL" + "</td>" +
                                       "<td style='text-align:right;'>" + Convert.ToInt32(Papel.Cons_Bobina).ToString("N0").Replace(",", ".") + " KG" + "</td>" +
                                       "<td style='text-align:right;'>" + Convert.ToDouble(Papel.Costtot).ToString("N2") + "</td>" +
                                       "</tr></tbody></table>";
                    }
                    if (contadorPlancha > 0)
                    {
                        ConsumoPlancha = ConsumoPlancha + "<tr><td></td><td></td><td></td><td></td>" +
                                         "<td style='text-align:center;'>Cantidad de Planchas </td><td style='text-align:center;'>Costo Total </td>" +
                                         "</tr><tr><td></td><td></td><td></td><td style='text-align:center;'>Total</td>" +
                                         "<td style='text-align:right;'>" + Convert.ToInt32(Papel.Cons_Plancha).ToString("N0") + " UN" + "</td><td style='text-align:right;'>" + Convert.ToDouble(Papel.Ancho).ToString("N2") + "</td>" +
                                         "</tr></tbody></table>";
                    }
                    if (contadorOtros > 0)
                    {
                        ConsumoOtros = ConsumoOtros + "<tr><td></td><td></td><td></td><td></td>" +
                                       "<td style='text-align:center;'>Cons. Otros</td><td style='text-align:center;'>Costo Total</td></tr><tr>" +
                                       "<td></td><td></td><td></td><td style='text-align:center;'>Total</td>" +
                                       "<td style='text-align:right;'>" + Convert.ToInt32(Papel.Cons_Otros).ToString("N0") + " UN" + "</td>" +
                                       "<td style='text-align:right;'>" + Convert.ToDouble(Papel.Certif).ToString("N2") + "</td>" +
                                       "</tr></tbody></table>";
                    }
                    if (contadorSerExt > 0)
                    {
                        ConsumoSerExt = ConsumoSerExt + "<tr><td style='text-align:center;'></td><td style='text-align:center;'></td>" +
                                        "<td style='text-align:center;'></td><td style='text-align:right;'></td><td style='text-align:right;'></td>" +
                                        "<td style='text-align:right;'></td><td style='text-align:right;'>Costo Total </td></tr>" +
                                        "<tr><td style='text-align:center;'></td><td style='text-align:center;'></td>" +
                                        "<td style='text-align:center;'></td><td style='text-align:right;'></td><td style='text-align:right;'></td>" +
                                        "<td style='text-align:right;'>Total</td><td style='text-align:right;'>" + Convert.ToDouble(Papel.CostUni).ToString("N2") + "</td></tr></tbody></table>";
                    }
                    if (Pag == 0 && OTs.Count() > 1)
                    {
                        Facturacion = Facturacion + "<div style='page-break-after:always;'><h1 style='text-align:center;'>" + OTs[i] + " -  " + oc.Seguimiento_BuscarNM(OTs[i]) + "</h1>" + ConsumoPapel + "<br/>" + ConsumoPlancha + "<br/>" + ConsumoSerExt + "<br/>" + ConsumoOtros + "</div>";
                        Pag++;
                    }
                    else if (Pag == 0 && OTs.Count() == 1)
                    {
                        Facturacion = Facturacion + "<div><h1 style='text-align:center;'>" + OTs[i] + " -  " + oc.Seguimiento_BuscarNM(OTs[i]) + "</h1>" + ConsumoPapel + "<br/>" + ConsumoPlancha + "<br/>" + ConsumoSerExt + "<br/>" + ConsumoOtros + "</div>";
                        Pag++;
                    }
                    else if (Pag == 1)
                    {
                        Facturacion = Facturacion + "<div><h1 style='text-align:center;'>" + OTs[i] + " -  " + oc.Seguimiento_BuscarNM(OTs[i]) + "</h1>" + ConsumoPapel + "<br/>" + ConsumoPlancha + "<br/>" + ConsumoSerExt + "<br/>" + ConsumoOtros + "</div>";
                        Pag++;
                    }
                    else
                    {
                        Facturacion = Facturacion + "<div style='page-break-before:always;'><h1 style='text-align:center;'>" + OTs[i] + " -  " + oc.Seguimiento_BuscarNM(OTs[i]) + "</h1>" + ConsumoPapel + "<br/>" + ConsumoPlancha + "<br/>" + ConsumoSerExt + "<br/>" + ConsumoOtros + "</div>";
                    }
                }
                lblImprimir.Text = Facturacion;
            }
        }
コード例 #8
0
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            string Mes = ddlMes.SelectedValue.ToString();
            string Año = ddlAño.SelectedValue.ToString();//"2014";

            Controller_Consumo controlcons = new Controller_Consumo();

            if (Mes != "Seleccionar")
            {
                List <Cabecera> lista1     = controlcons.ListarConsumoMes(Mes, Año, 1);
                List <Cabecera> lista2     = controlcons.ListarConsumoMes(Mes, Año, 2);
                List <Cabecera> listaFinal = lista1.Concat(lista2).ToList();

                GridView gv = new GridView();
                gv.DataSource = listaFinal;
                gv.DataBind();
                gv.HeaderStyle.BackColor = System.Drawing.Color.Blue;
                gv.HeaderStyle.ForeColor = System.Drawing.Color.White;


                gv.HeaderRow.Cells[0].Text     = "OT";
                gv.HeaderRow.Cells[1].Text     = "Nombre OT";
                gv.HeaderRow.Cells[2].Text     = "Fl Pliego";
                gv.HeaderRow.Cells[3].Text     = "Kg Hoja";
                gv.HeaderRow.Cells[4].Text     = "$ Hoja";
                gv.HeaderRow.Cells[5].Text     = "Kg Bobina";
                gv.HeaderRow.Cells[6].Text     = "$ Bobina";
                gv.HeaderRow.Cells[7].Text     = "Kg total";
                gv.HeaderRow.Cells[8].Text     = "$ Total";
                gv.HeaderRow.Cells[9].Visible  = false;
                gv.HeaderRow.Cells[10].Visible = false;
                gv.HeaderRow.Cells[11].Visible = false;
                gv.HeaderRow.Cells[12].Visible = false;
                gv.HeaderRow.Cells[13].Visible = false;
                gv.HeaderRow.Cells[14].Visible = false;
                gv.HeaderRow.Cells[15].Visible = false;
                gv.HeaderRow.Cells[16].Visible = false;
                gv.HeaderRow.Cells[17].Visible = false;
                gv.HeaderRow.Cells[18].Visible = false;
                gv.HeaderRow.Cells[19].Visible = false;
                gv.HeaderRow.Cells[20].Visible = false;
                gv.HeaderRow.Cells[21].Visible = false;
                gv.HeaderRow.Cells[22].Visible = false;
                gv.HeaderRow.Cells[23].Visible = false;
                gv.HeaderRow.Cells[24].Visible = false;
                gv.HeaderRow.Cells[25].Visible = false;
                gv.HeaderRow.Cells[26].Visible = false;
                gv.HeaderRow.Cells[27].Visible = false;
                gv.HeaderRow.Cells[28].Visible = false;
                gv.HeaderRow.Cells[29].Visible = false;
                gv.HeaderRow.Cells[30].Visible = false;
                gv.HeaderRow.Cells[31].Visible = false;
                gv.HeaderRow.Cells[32].Visible = false;
                gv.HeaderRow.Cells[33].Visible = false;
                gv.HeaderRow.Cells[34].Visible = false;
                gv.HeaderRow.Cells[35].Visible = false;
                gv.HeaderRow.Cells[36].Visible = false;
                gv.HeaderRow.Cells[37].Visible = false;

                for (int contador = 0; contador < gv.Rows.Count; contador++)
                {
                    GridViewRow row = gv.Rows[contador];
                    row.Cells[0].Text = row.Cells[1].Text;
                    if (row.Cells[2].Text != "Total Operacional" && row.Cells[2].Text != "Total Otros")
                    {
                        row.Cells[1].Text = row.Cells[2].Text;
                        row.Cells[2].Text = row.Cells[3].Text;
                        row.Cells[3].Text = row.Cells[10].Text;
                        row.Cells[4].Text = row.Cells[8].Text;
                        row.Cells[8].Text = row.Cells[7].Text;
                        row.Cells[7].Text = row.Cells[6].Text;
                        row.Cells[6].Text = row.Cells[9].Text;
                    }
                    else
                    {
                        row.Cells[1].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[2].Text + "</div>";
                        row.Cells[2].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[3].Text + "</div>";
                        row.Cells[3].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[10].Text + "</div>";
                        row.Cells[4].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[8].Text + "</div>";
                        row.Cells[5].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[5].Text + "</div>";
                        row.Cells[8].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[7].Text + "</div>";
                        row.Cells[7].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[6].Text + "</div>";
                        row.Cells[6].Text = "<div style='font-weight: bold;font-size:medium;'>" + row.Cells[9].Text + "</div>";
                    }

                    //row.Cells[8].Visible = false;
                    row.Cells[9].Visible  = false;
                    row.Cells[10].Visible = false;
                    row.Cells[11].Visible = false;
                    row.Cells[12].Visible = false;
                    row.Cells[13].Visible = false;
                    row.Cells[14].Visible = false;
                    row.Cells[15].Visible = false;
                    row.Cells[16].Visible = false;
                    row.Cells[17].Visible = false;
                    row.Cells[18].Visible = false;
                    row.Cells[19].Visible = false;
                    row.Cells[20].Visible = false;
                    row.Cells[21].Visible = false;
                    row.Cells[22].Visible = false;
                    row.Cells[23].Visible = false;
                    row.Cells[24].Visible = false;
                    row.Cells[25].Visible = false;
                    row.Cells[26].Visible = false;
                    row.Cells[27].Visible = false;
                    row.Cells[28].Visible = false;
                    row.Cells[29].Visible = false;
                    row.Cells[30].Visible = false;
                    row.Cells[31].Visible = false;
                    row.Cells[32].Visible = false;
                    row.Cells[33].Visible = false;
                    row.Cells[34].Visible = false;
                    row.Cells[35].Visible = false;
                    row.Cells[36].Visible = false;
                    row.Cells[37].Visible = false;
                }
                ExportToExcel("Consumo Mensual por OT " + DateTime.Now.ToString("dd-MM-yyyy HH:mm"), gv);
            }
        }
コード例 #9
0
        protected void btnFiltro_Click1(object sender, EventArgs e)
        {
            Controller_Consumo cc = new Controller_Consumo();

            try
            {
                if (txtOT.Text != "")
                {
                    if (txtOT.Text == "108")
                    {
                        if (txtFechaInicio.Text != "" && txtFechaTermino.Text != "")
                        {
                            string[] str  = txtFechaInicio.Text.Split('/');
                            DateTime fi   = Convert.ToDateTime(str[2] + "-" + str[1] + "-" + str[0] + " 00:00:00");
                            string[] str2 = txtFechaTermino.Text.Split('/');
                            DateTime ft   = Convert.ToDateTime(str2[2] + "-" + str2[1] + "-" + str2[0] + " 23:59:59");
                            Label11.Text = cc.CargaConsumoMetrics(txtOT.Text, fi, ft, 5);
                        }
                        else
                        {
                            string popupScript = "<script language='JavaScript'> alert('¡ La OT 108 debe tener Fecha de inicio y termino!'); </script>";
                            Page.RegisterStartupScript("PopupScript", popupScript);
                        }
                    }
                    else
                    {
                        Label11.Text = cc.CargaConsumoMetrics(txtOT.Text, DateTime.Now, DateTime.Now, 3);
                    }
                }
                else if (txtFechaInicio.Text != "" && txtFechaTermino.Text != "")
                {
                    if (rdDesperdicio.Checked)//chkDesperdicio
                    {
                        string[] str  = txtFechaInicio.Text.Split('/');
                        DateTime fi   = Convert.ToDateTime(str[2] + "-" + str[1] + "-" + str[0] + " 00:00:00");
                        string[] str2 = txtFechaTermino.Text.Split('/');
                        DateTime ft   = Convert.ToDateTime(str2[2] + "-" + str2[1] + "-" + str2[0] + " 23:59:59");

                        string ot = cc.CargaOTS("", fi, ft, 1);

                        Label11.Text = cc.CargaConsumoMetrics(ot, DateTime.Now, DateTime.Now, 4);
                    }

                    else if (rdDiferenciasDesperdicio.Checked)
                    {
                        string[] str  = txtFechaInicio.Text.Split('/');
                        DateTime fi   = Convert.ToDateTime(str[2] + "-" + str[1] + "-" + str[0] + " 00:00:00");
                        string[] str2 = txtFechaTermino.Text.Split('/');
                        DateTime ft   = Convert.ToDateTime(str2[2] + "-" + str2[1] + "-" + str2[0] + " 23:59:59");

                        string ot = cc.CargaOTS("", fi, ft, 1);

                        Label11.Text = cc.CargaConsumoMetrics(ot, DateTime.Now, DateTime.Now, 6);
                    }
                    else if (rdDiferenciasTeorico.Checked)
                    {
                        string[] str  = txtFechaInicio.Text.Split('/');
                        DateTime fi   = Convert.ToDateTime(str[2] + "-" + str[1] + "-" + str[0] + " 00:00:00");
                        string[] str2 = txtFechaTermino.Text.Split('/');
                        DateTime ft   = Convert.ToDateTime(str2[2] + "-" + str2[1] + "-" + str2[0] + " 23:59:59");

                        string ot = cc.CargaOTS("", fi, ft, 1);

                        Label11.Text = cc.CargaConsumoTeoricoVsMetrics2(ot, DateTime.Now, DateTime.Now, 7);
                    }
                    else
                    {
                        string[] str  = txtFechaInicio.Text.Split('/');
                        DateTime fi   = Convert.ToDateTime(str[2] + "-" + str[1] + "-" + str[0] + " 00:00:00");
                        string[] str2 = txtFechaTermino.Text.Split('/');
                        DateTime ft   = Convert.ToDateTime(str2[2] + "-" + str2[1] + "-" + str2[0] + " 23:59:59");

                        string ot = cc.CargaOTS("", fi, ft, 1);

                        Label11.Text = cc.CargaConsumoMetrics(ot, fi, ft, 0);
                    }
                }
                else
                {
                    string ot = cc.CargaOTS("", DateTime.Now, DateTime.Now, 2);

                    Label11.Text = cc.CargaConsumoMetrics(ot, DateTime.Now, DateTime.Now, 0);
                }
            }
            catch
            {
                Label11.Text = "<div align='center'>¡No se han Encontrado Registros!</div>";
            }
        }
コード例 #10
0
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            Validacion.Visible = false;
            if (ddlMaquina.SelectedItem.ToString() != "-- Seleccione --")
            {
                string[] stk   = lblStock.Text.ToString().Replace(",", string.Empty).Split(' ');
                double   Stock = Convert.ToDouble(stk[0]);
                if (txtCantidad.Text.ToString() != "")
                {
                    double Solicitado = Convert.ToDouble(txtCantidad.Text.ToString());
                    if (Stock >= Solicitado)
                    {
                        if ((lblNombreOT.Text != "") || (txtOT.Text != ""))
                        {
                            Consumo consumo = new Consumo();
                            consumo.CodItem     = lblCodigo.Text;
                            consumo.NombrePapel = lblDescripcion.Text;
                            string[] stock = lblStock.Text.ToString().Replace(",", string.Empty).Split(' ');
                            consumo.Lote         = stock[0];
                            consumo.Costtot      = txtOT.Text;
                            consumo.Tipo         = lblNombreOT.Text;
                            consumo.Cons_Pliego  = txtCantidad.Text;
                            consumo.Cons_Otros   = ddlMaquina.SelectedItem.ToString();
                            consumo.Cons_Plancha = Session["Usuario"].ToString();

                            Controller_Consumo controlconsumo = new Controller_Consumo();
                            if (controlconsumo.AgregarSolicStock(consumo))
                            {
                                string popupScript4 = "<script language='JavaScript'>opener.location.reload();window.close();</script>";
                                Page.RegisterStartupScript("PopupScript", popupScript4);
                            }
                            else
                            {
                                Validacion.Visible = true;
                                Image1.ImageUrl    = "../../Images/cross.png";
                                Label1.Text        = "Error al Ingresar";
                                Label1.ForeColor   = Color.White;
                                Validacion.Attributes.Add("style", "background-color:red");
                                Label1.Text = "Error al Ingresar";
                            }
                        }
                        else
                        {
                            Validacion.Visible = true;
                            Image1.ImageUrl    = "../../Images/cross.png";
                            Label1.Text        = "Error al Ingresar";
                            Label1.ForeColor   = Color.White;
                            Validacion.Attributes.Add("style", "background-color:red");
                            Label1.Text = "Debe seleccionar una OT";
                        }
                    }

                    else
                    {
                        Validacion.Visible = true;
                        Image1.ImageUrl    = "../../Images/cross.png";
                        Label1.Text        = "Error al Ingresar";
                        Label1.ForeColor   = Color.White;
                        Validacion.Attributes.Add("style", "background-color:red");
                        Label1.Text = "El Stock no es suficiente para la Solicitud";
                    }
                }
                else
                {
                    Validacion.Visible = true;
                    Image1.ImageUrl    = "../../Images/cross.png";
                    Label1.Text        = "Error al Ingresar";
                    Label1.ForeColor   = Color.White;
                    Validacion.Attributes.Add("style", "background-color:red");
                    Label1.Text = "Debe indicar Cantidad de la Solicitud";
                }
            }
            else
            {
                Validacion.Visible = true;
                Image1.ImageUrl    = "../../Images/cross.png";
                Label1.Text        = "Error al Ingresar";
                Label1.ForeColor   = Color.White;
                Validacion.Attributes.Add("style", "background-color:red");
                Label1.Text = "Debe seleccionar una Maquina";
            }
        }