示例#1
0
    protected void BtnDivTableDeliveryAnt_Click(object sender, EventArgs e)
    {
        int Page;

        if (int.TryParse(HdnDivTableDeliveryPage.Value, out Page))
        {
            if (Page > 1)
            {
                Page--;
            }
        }
        if (Page == 1)
        {
            BtnDivTableDeliveryAnt.Visible = false;
        }
        HdnDivTableDeliveryPage.Value = (Page).ToString();
        PedDet.Get getitems = new PedDet.Get(Pedido.ID, true);
        var        cmp      = getitems.Items.Sum(iterator => iterator.CMPUN * iterator.CANT);
        var        cpro     = getitems.Items.Sum(iterator => iterator.CPROCUN * iterator.CANT);
        var        cmer     = getitems.Items.Sum(iterator => iterator.CMERMAUN * iterator.CANT);

        double[] KG = new double[getitems.Items.Count];
        int      i  = 0;

        foreach (var item in getitems.Items)
        {
            KG[i] = item.KGITM;
            i++;
        }

        CostodelDia.Get get = new CostodelDia.Get(Pedido, Page, true);

        FillDeliveryTable(get.Lista);
    }
示例#2
0
    private void FillDetailTable()
    {
        HtmlGenericControl table = new HtmlGenericControl("table")
        {
            ID = "ItemsTable"
        };

        table.Attributes.Add("class", "table bg-opacity-white-65");
        /*crear encabezado*/
        HtmlGenericControl thead  = new HtmlGenericControl("thead");
        HtmlGenericControl strong = new HtmlGenericControl("strong");
        HtmlGenericControl trhead = new HtmlGenericControl("tr");
        HtmlGenericControl tbody  = new HtmlGenericControl("tbody");

        trhead.Attributes.Add("class", "bg-opacity-white-25");
        HtmlGenericControl th;

        /*item*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Ítem"
        };
        trhead.Controls.Add(th);

        /*REFERENCIA*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Referencia"
        };
        trhead.Controls.Add(th);



        /*COMPOSICION*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Composición"
        };
        trhead.Controls.Add(th);

        /*Ancho*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Ancho"
        };
        trhead.Controls.Add(th);

        /*Alto*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Alto"
        };
        trhead.Controls.Add(th);

        /*Cant*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Cantidad"
        };

        trhead.Controls.Add(th);

        /*Neto un*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Neto/Un"
        };
        th.Attributes.Add("style", "min-width:100px;");
        trhead.Controls.Add(th);

        /*Neto*/
        th = new HtmlGenericControl("th")
        {
            InnerHtml = "Neto"
        };
        th.Attributes.Add("style", "min-width:100px;");
        trhead.Controls.Add(th);

        thead.Controls.Add(trhead);
        /*agrega el thead*/
        table.Controls.Add(thead);



        DivListItems.Controls.Clear();
        PedDet.Get items;
        items = new PedDet.Get(ID, true);


        HtmlGenericControl tr;

        if (items.GotItems)
        {
            /*CheckDiccionario*/
            PedDet.CheckDiccionario checkDiccionario = new PedDet.CheckDiccionario(items.Items, Pedido, Cliente.Margen);

            if (checkDiccionario.HayCambios)
            {
                items = new PedDet.Get(ID, true);
                PedidoEcom.UpdateMontos montos = new PedidoEcom.UpdateMontos(Pedido, true, Cliente);
                FillInfoCabecera();
            }
            PnlItems.Visible    = true;
            PnlDelivery.Visible = true;
            foreach (PedDet item in items.Items)
            {
                tr = new HtmlGenericControl("tr");

                HtmlGenericControl td;
                /*Item*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.NODO.ToString()
                };
                td.Attributes.Add("class", "editar");
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                tr.Controls.Add(td);

                /*Ref*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.REFERENCIA
                };
                td.Attributes.Add("class", "editar");
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                tr.Controls.Add(td);



                /*Composicion*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.DESCRIPCION
                };
                td.Attributes.Add("class", "editar");
                tr.Controls.Add(td);

                /*Ancho*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.ANCHO.ToString()
                };
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                td.Attributes.Add("class", "editar");
                tr.Controls.Add(td);

                /*Alto*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.ALTO.ToString()
                };
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                td.Attributes.Add("class", "editar");
                tr.Controls.Add(td);

                /*Cant*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.CANT.ToString()
                };
                td.Attributes.Add("class", "editar");
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                tr.Controls.Add(td);

                /*Neto/un*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.NETOUN.ToString("C0", CultureInfo.CurrentCulture)
                };
                td.Attributes.Add("class", "editar");
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                tr.Controls.Add(td);


                /*Neto*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.NETOITM.ToString("C0", CultureInfo.CurrentCulture)
                };
                td.Attributes.Add("class", "editar");
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                tr.Controls.Add(td);


                /*IDPEDDET*/
                td = new HtmlGenericControl("td")
                {
                    InnerHtml = item.IDPEDDET
                };
                td.Attributes.Add("style", "display:none;");
                tr.Controls.Add(td);

                if (item.ISFROMFILE && !item.GOTFDICC)
                {
                    td = new HtmlGenericControl("td")
                    {
                        InnerHtml = item.TERMINOLOGIA
                    };
                    td.Attributes.Add("style", "display:none;");
                    tr.Controls.Add(td);

                    tr.Attributes.Add("class", "filas bg-opacity-red-25");
                    DisabledBtnTotermsandCond("El pedido no puede ser enviado, hay ítems en rojo");
                }
                else
                {
                    td = new HtmlGenericControl("td")
                    {
                        InnerHtml = ""
                    };
                    td.Attributes.Add("style", "display:none;");
                    tr.Controls.Add(td);

                    tr.Attributes.Add("class", "filas");
                }
                /*Trash*/
                HtmlGenericControl span = new HtmlGenericControl("span")
                {
                    InnerHtml = item.IDPEDDET
                };
                span.Attributes.Add("style", "display:none;");


                HtmlGenericControl trash;
                trash = new HtmlGenericControl("i");
                trash.Attributes.Add("class", "fas fa-trash-alt text-danger eliminar HighLight");
                trash.Controls.Add(span);
                td = new HtmlGenericControl("td");
                td.Attributes.Add("style", "vertical-align: middle; text-align:center;");
                td.Controls.Add(trash);
                tr.Controls.Add(td);



                if (item.NETOUN <= 0 || item.ALTO < 300 || item.ALTO < 300 || item.CANT < 1)
                {
                    DisabledBtnTotermsandCond("El pedido no puede ser enviado, hay items con valores que no corresponden");

                    tr.Attributes.Add("class", "filas bg-opacity-red-25");
                }



                /*agrega al tbody*/

                tbody.Controls.Add(tr);
            }

            table.Controls.Add(tbody);
            DivListItems.Controls.Add(table);
        }
        else
        {
            PnlItems.Visible      = false;
            PnlDelivery.Visible   = false;
            PnlTotalOrder.Visible = false;
        }
    }