Esempio n. 1
0
 protected void ASPxGridViewUsers_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
 {
     if (e.Column.Caption == "Grupo")
     {
         e.Value = "Administrador";
     }
 }
Esempio n. 2
0
    protected void GridViewFacturasDetail_CustomUnboundColumnData(object sender, DevExpress.Web.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(GridViewFacturasDetail.GetRowValues(e.ListSourceRowIndex, "SerieAlbaran")), 5);

        if (e.Column.FieldName == "TotalNeto")
        {
            var val = CommonFunction.Field(resp, 1, "&");
            if (!string.IsNullOrEmpty(val))
            {
                e.Value = Convert.ToDouble(CommonFunction.Field(resp, 1, "&"));
            }
        }
        else if (e.Column.FieldName == "NetoIgic")
        {
            var val = CommonFunction.Field(resp, 2, "&");
            if (!string.IsNullOrEmpty(val))
            {
                e.Value = Convert.ToDouble(CommonFunction.Field(resp, 2, "&"));
            }
        }
    }
Esempio n. 3
0
 protected void grdProducts_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
 {
     if (e.Column.FieldName == "Total")
     {
         decimal price    = (decimal)e.GetListSourceFieldValue("UnitPrice");
         int     quantity = Convert.ToInt32(e.GetListSourceFieldValue("UnitsInStock"));
         e.Value = price * quantity;
     }
 }
Esempio n. 4
0
        protected void Grid_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
        {
            DateFieldParts dateFieldParts = DateFieldParts.GetDateFieldParts(e.Column.FieldName);

            if (dateFieldParts != null)
            {
                DateAmountMap dateAmountMap = JsonConvert.DeserializeObject <DateAmountMap>(Convert.ToString(e.GetListSourceFieldValue("AmountDateMap")));
                e.Value = dateAmountMap.GetDateAmount(dateFieldParts);
            }
        }
Esempio n. 5
0
 protected void EmployeesGrid_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
 {
     try
     {
         if (e.Column.FieldName == "Total")
         {
             if (e.IsGetData)
             {
                 int visibleIndex = EmployeesGrid.FindVisibleIndexByKeyValue(e.GetListSourceFieldValue("FISNO"));
                 e.Value = (visibleIndex != 0) ?
                           Convert.ToDecimal(EmployeesGrid.GetRowValues(visibleIndex, "BORC")) + Convert.ToDecimal(EmployeesGrid.GetRowValues(visibleIndex, "ALACAK")) + Convert.ToDecimal(EmployeesGrid.GetRowValues(visibleIndex - 1, "Total")) :
                           Convert.ToDecimal(EmployeesGrid.GetRowValues(visibleIndex, "BORC")) - Convert.ToDecimal(EmployeesGrid.GetRowValues(visibleIndex - 1, "Total"));
             }
         }
     }
     catch (Exception hata)
     {
         return;
     }
 }
Esempio n. 6
0
    protected void GridViewPresupuestoActual_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
    {
        var Cliente = (Clientes)Session["User"];

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

        //       if (Request.Browser.IsMobileDevice)
        //       {
        //           if (Page.IsCallback)
        //           {
        //               ASPxWebControl.RedirectOnCallback("/mobile/precios.aspx");
        //           }
        //           else
        //           {
        //              if (!string.IsNullOrEmpty(Request.QueryString["sp"]))
        //              {
        //                  Response.Redirect("/mobile/precios.aspx?sp=" + Request.QueryString["sp"]);
        //              }
        //              else
        //              {
        //                  Response.Redirect("/mobile/precios.aspx");
        //             }
        //          }

        //        }
        string CodigoCliente = Cliente.Código;
        int    AutoCliente   = Cliente.AutoCliente;
        int    AutoArticulo  = Convert.ToInt32(e.GetListSourceFieldValue("AutoArtículo"));


        double PrecioIgic     = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "PrecioIgic") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "PrecioIgic"));
        int    Cantidad       = Convert.ToInt32(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Cantidad"));
        double NetoIgic       = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "NetoIgic") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "NetoIgic"));
        var    PercenImpuesto = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "PercenImpuesto") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "PercenImpuesto"));
        var    Precio         = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Precio") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Precio"));
        var    Dto            = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Dto") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Dto"));

        if (e.Column.FieldName == "Importe") // Total PVP
        {
            // e.Value = Math.Round(PrecioIgic * Cantidad, 2); // old code
            e.Value = Math.Round(Precio * Cantidad * (1 + PercenImpuesto / 100), 2);
        }
        else if (e.Column.FieldName == "ImporteNeto") // Total Neto
        {
            // e.Value = Math.Round(NetoIgic * Cantidad, 2); //old code
            //e.Value = Math.Round(Precio * Cantidad * (1 + PercenImpuesto / 100) * (1 - Dto / 100), 2);
            double dtoval = 1;
            if (Dto > 0)
            {
                dtoval = (1 - Dto / 100);
            }

            e.Value = Math.Round(Precio * Cantidad * (1 + PercenImpuesto / 100) * dtoval, 2);
        }
        else if (e.Column.FieldName == "ImpNetoDtopp") // Total Neto-DtoPP
        {
            //var neto = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Neto") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Neto"));
            //double newimpor = neto * (1 - Cliente.Dtopp / 100);
            //e.Value = Math.Round(newimpor * (1 + PercenImpuesto / 100), 2);
            double dtoval = 1;
            if (Dto > 0)
            {
                dtoval = (1 - Dto / 100);
            }

            double dtoppval = 1;
            dtoppval = Cliente.Dtopp;

            var VarDtoPP = Math.Round(Cantidad * Precio * dtoval * dtoppval, 2);
            e.Value = Math.Round(Cantidad * Precio * dtoval * (1 + PercenImpuesto / 100), 2) - VarDtoPP;
        }
        else if (e.Column.FieldName == "beneficio")
        {
            var Importe      = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Importe") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "Importe"));
            var ImpNetoDtopp = Convert.ToDouble(GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "ImpNetoDtopp") == null ? 0 : GridViewPresupuestoActual.GetRowValues(e.ListSourceRowIndex, "ImpNetoDtopp"));
            //e.Value = Math.Round(Math.Round(PrecioIgic * Cantidad, 2) - Math.Round(NetoIgic * Cantidad, 2), 2);
            e.Value = Math.Round(Importe - ImpNetoDtopp, 2);
        }
    }
Esempio n. 7
0
    protected void GridViewArtículo_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
    {
        var Cliente = (Clientes)Session["User"];

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

        //      if (Request.Browser.IsMobileDevice)
        //      {
        //          if (Page.IsCallback)
        //          {
        //              ASPxWebControl.RedirectOnCallback("/mobile/precios.aspx");
        //          }
        //          else
        //          {
        //              if (!string.IsNullOrEmpty(Request.QueryString["sp"]))
        //              {
        //                  Response.Redirect("/mobile/precios.aspx?sp=" + Request.QueryString["sp"]);
        //              }
        //              else
        //              {
        //                  Response.Redirect("/mobile/precios.aspx");
        //              }
        //          }

        //       }
        string CodigoCliente = Cliente.Código;
        int    AutoCliente   = Cliente.AutoCliente;
        int    AutoArticulo  = Convert.ToInt32(e.GetListSourceFieldValue("AutoArtículo"));


        // For Precio //

        string stTarifa = CommonFunction.tlookup("Tarifa", "CLIENTES", "Código ='" + CodigoCliente + "'");
        int    Tarifa   = 0;

        if (!string.IsNullOrEmpty(stTarifa))
        {
            Tarifa = Convert.ToInt32(stTarifa);
        }
        var PrecioFijo = CommonFunction.Nzn(CommonFunction.tlookup("Precio Fijo", "TARIFAS_DET", "[Auto Artículo] =" + AutoArticulo + " and [Auto Cliente] =" + AutoCliente + ""));

        if (PrecioFijo == 0)
        {
            PrecioFijo = CommonFunction.Nzn(CommonFunction.tlookup("Precio Fijo", "TARIFAS_DET", "[Auto Artículo] =" + AutoArticulo + " and Tarifa =" + Tarifa + ""));
        }

        // For DTO //
        int    Clase = Convert.ToInt32(e.GetListSourceFieldValue("ClasedeArtículo"));
        double dtomax;
        var    dtofijo = CommonFunction.Nzn(CommonFunction.tlookup("% Dto Fijo", "TARIFAS_DET", "[Auto Cliente] =" + AutoCliente + " and [Clase Artículo] =" + Clase + ""));
        var    calcdto = dtofijo;

        dtomax = CommonFunction.Nzn(CommonFunction.tlookup("% Dto Máximo", "TARIFAS_DET", "[Auto Cliente] =" + AutoCliente + " and [Auto Artículo] =" + AutoArticulo + ""));
        if (dtomax == -1)
        {
            calcdto = -1;
        }
        else
        {
            dtofijo = 0;
        }
        if (Convert.ToBoolean(CommonFunction.tlookup("Precio Neto", "ARTICULOS", "[Auto Artículo] ='" + AutoArticulo + "'")))
        {
            calcdto = -1;
        }
        else
        {
            dtofijo = 0;
        }

        if (calcdto == -1)
        {
            calcdto = 0;
        }

        var    PrecioNeto = CommonFunction.Redondear(PrecioFijo - (PrecioFijo * calcdto / 100), 2);
        double Impuesto   = Convert.ToDouble(GridViewArtículo.GetRowValues(e.ListSourceRowIndex, "PercenImpuesto"));

        if (e.Column.FieldName == "Precio")
        {
            e.Value = PrecioFijo;
        }
        else if (e.Column.FieldName == "Dto")
        {
            e.Value = calcdto;
        }
        else if (e.Column.FieldName == "Neto")
        {
            e.Value = PrecioNeto;
        }
        else if (e.Column.FieldName == "PrecioIgic")
        {
            var calcprecioigic = CommonFunction.Redondear(PrecioFijo + (PrecioFijo * Impuesto / 100), 2);
            e.Value = calcprecioigic;
        }
        else if (e.Column.FieldName == "NetoIgic")
        {
            var calcnetoigic = CommonFunction.Redondear(PrecioNeto + (PrecioNeto * Impuesto / 100), 2);
            e.Value = calcnetoigic;
        }
    }
        protected void GridControlAppointments_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
        {
            if (e.Column.Name != "gridColumnStatus")
            {
                return;
            }

            if (e.IsGetData)
            {
                object status = e.GetListSourceFieldValue("AgendaStatus");
                if (status != null)
                {
                    AppointmentStatus aptStatus = status as AppointmentStatus;
                    e.Value = aptStatus.Color;
                }
            }
        }