Exemple #1
0
    protected void linkselect_Init(object sender, EventArgs e)
    {
        ((ASPxHyperLink)sender).Text = "Ver Albarán";
        GridViewDataItemTemplateContainer c = ((ASPxHyperLink)sender).NamingContainer as GridViewDataItemTemplateContainer;
        int rowIndex = c.VisibleIndex;

        GridViewAlbaransver.FocusedRowIndex = rowIndex;
        var s = Convert.ToString(GridViewAlbaransver.GetRowValues(GridViewAlbaransver.FocusedRowIndex, "Fecha"));

        //s = "31/12/1900 0:00:00";
        if (string.IsNullOrEmpty(s))
        {
            return;
        }
        var date1 = Convert.ToDateTime(s);

        string year  = date1.Year.ToString();
        string month = date1.Month.ToString();
        string date  = date1.Day.ToString();

        var cliente = (Clientes)Session["User"];
        var val     = GridViewAlbaransver.GetRowValues(GridViewAlbaransver.FocusedRowIndex, "SerieAlbaran").ToString();

        if (AlbaranRepository.CheckAlbaranosverIdforImage(val, cliente.AutoCliente) > 0)
        {
            ((ASPxHyperLink)sender).ClientSideEvents.Click = "function(s,e){  window.open('../Imageviewer.aspx?id=" +
                                                             val + "&year=" + year +
                                                             "&month=" + month + "&date=" + date +
                                                             "','_blank');}";
        }
        else
        {
            ((ASPxHyperLink)sender).Text = "-";
        }
    }
Exemple #2
0
    protected void GridViewAlbaransver_CustomUnboundColumnData(object sender, ASPxGridViewColumnDataEventArgs e)
    {
        var Cliente = (Clientes)Session["User"];

        if (Cliente == null)
        {
            ASPxWebControl.RedirectOnCallback("/Account/login.aspx");
        }

        string CodigoCliente = Cliente.Código;
        int    AutoCliente   = Cliente.AutoCliente;
        int    AutoArticulo  = Convert.ToInt32(e.GetListSourceFieldValue("AutoArtículo"));
        string resp          = (string)CommonFunction.Calculoalbaran(Convert.ToString(GridViewAlbaransver.GetRowValues(e.ListSourceRowIndex, "SerieAlbaran")), 5);

        if (e.Column.FieldName == "Importe")
        {
            var val = CommonFunction.Field(resp, 1, "&");
            if (!string.IsNullOrEmpty(val))
            {
                e.Value = Convert.ToDouble(CommonFunction.Field(resp, 1, "&"));
            }
        }
        else if (e.Column.FieldName == "ImporteIgic")
        {
            var val = CommonFunction.Field(resp, 2, "&");
            if (!string.IsNullOrEmpty(val))
            {
                e.Value = Convert.ToDouble(CommonFunction.Field(resp, 2, "&"));
            }
        }
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            if (Page.IsCallback)
            {
                ASPxWebControl.RedirectOnCallback("/Account/login.aspx");
            }
            else
            {
                Response.Redirect("/Account/login.aspx");
            }
        }
        //       if (Request.Browser.IsMobileDevice)
        //       {
        //           if (Page.IsCallback)
        //           {
        //               ASPxWebControl.RedirectOnCallback("/mobile/Albaranes.aspx");
        //           }
        //           else
        //           {
        //               Response.Redirect("/mobile/Albaranes.aspx");
        //           }

        //       }
        DateTime?defecha = null;
        DateTime?afecha  = null;

        if (!Page.IsPostBack)
        {
            Session["buttonclick"] = "date";
            defecha = Convert.ToDateTime(fechahoy.ToString("01/MMM/yyy"));
            afecha  = Convert.ToDateTime(DateTime.DaysInMonth(fechahoy.Year, fechahoy.Month) + "/" + fechahoy.Month + "/" + fechahoy.Year);
        }

        if ((dtfromDate.Date != null || dttoDate.Date != null) && Convert.ToString(Session["buttonclick"]) == "date")
        {
            defecha = dtfromDate.Date;
            afecha  = dttoDate.Date;
        }

        var Cliente = (Clientes)Session["User"];

        searchalbaran.Text = string.IsNullOrWhiteSpace(Request.QueryString["albarane"]) ? searchalbaran.Text : Request.QueryString["albarane"];
        if (!string.IsNullOrEmpty(searchalbaran.Text))
        {
            GridViewAlbaransver.DataSource = AlbaranRepository.GetAllAlbaranosver(searchalbaran.Text, "", Cliente.AutoCliente, null, null);
        }
        else
        {
            GridViewAlbaransver.DataSource = AlbaranRepository.GetAllAlbaranosver(searchalbaran.Text, "", Cliente.AutoCliente, defecha, afecha);
        }
        GridViewAlbaransver.DataBind();

        string serieAlbaran = string.Empty;

        if (GridViewAlbaransver.GetSelectedFieldValues("SerieAlbaran").Count > 0)
        {
            serieAlbaran = Convert.ToString(GridViewAlbaransver.GetSelectedFieldValues("SerieAlbaran").Select(c => c).FirstOrDefault());
        }
        else
        {
            serieAlbaran = Convert.ToString(GridViewAlbaransver.GetRowValues(0, "SerieAlbaran"));
        }
        GridViewAlbaransverDetail.DataSource = AlbaranRepository.GetAlbaranosverDetail(serieAlbaran);
        GridViewAlbaransverDetail.DataBind();
    }