private void ObtnerRegistrosFiltrados() { List <OrdenDeVentaEncabezado> ordenesDeVenta = new List <OrdenDeVentaEncabezado>(); for (int i = 0; i < UiVisOrdenesVenta.VisibleRowCount; i++) { var rw = UiVisOrdenesVenta.GetRow(i); if (rw != null) { ordenesDeVenta.Add((OrdenDeVentaEncabezado)rw); } } GeneraPuntosDeOrdenesDeVenta(ordenesDeVenta); }
/// <summary> /// Evento de vista de control /// </summary> protected void UiVisOrdenesVenta_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e) { if (!ValidarConexionYUsuarioLogueado(sender)) { return; } OrdenDeVentaEncabezado ordenDeVentaEncabezado = new OrdenDeVentaEncabezado(); switch (e.Parameters.Split('-')[0]) { case "ObtenerOrdenesVenta": ordenDeVentaEncabezado.POSTED_DATETIME = DateTime.Parse(UiFechaInicio.Value.ToString()); ordenDeVentaEncabezado.CLOSED_ROUTE_DATETIME = DateTime.Parse(UiFechaFinal.Value.ToString()); ordenDeVentaEncabezado.LOGIN = Session["LOGIN"].ToString(); if (ordenDeVentaEncabezado.POSTED_DATETIME > ordenDeVentaEncabezado.CLOSED_ROUTE_DATETIME) { UiVisOrdenesVenta.JSProperties.Add("cpError", "La fecha inicio es mayor a la fecha final"); } else { UsuarioDesesaObtenerOrdenesDeVenta?.Invoke(sender, new OrdenVentaArgumento { Data = ordenDeVentaEncabezado }); } break; case "Anular": var ordenDeVentaAnular = UiVisOrdenesVenta.GetRowValues(int.Parse(e.Parameters.Split('-')[1]), "SALES_ORDER_ID;DOC_SERIE;DOC_NUM"); ordenDeVentaEncabezado.POSTED_DATETIME = DateTime.Parse(UiFechaInicio.Value.ToString()); ordenDeVentaEncabezado.CLOSED_ROUTE_DATETIME = DateTime.Parse(UiFechaFinal.Value.ToString()); ordenDeVentaEncabezado.LOGIN = Session["LOGIN"].ToString(); ordenDeVentaEncabezado.SALES_ORDER_ID = int.Parse(ordenDeVentaAnular.ToString().Split('|')[0]); ordenDeVentaEncabezado.DOC_SERIE = ordenDeVentaAnular.ToString().Split('|')[1]; ordenDeVentaEncabezado.DOC_NUM = int.Parse(ordenDeVentaAnular.ToString().Split('|')[2]); ordenDeVentaEncabezado.IS_VOID = "1"; UsuarioDeseaCancelarOrdenDeVenta?.Invoke(sender, new OrdenVentaArgumento { Data = ordenDeVentaEncabezado }); break; case "CambiarFechaDeEntrega": var ordenDeVentaVista = (OrdenDeVentaEncabezado)UiVisOrdenesVenta.GetRow(int.Parse(e.Parameters.Split('-')[1])); if (DateTime.Parse(UiFechaOrdenDeVenta.Value.ToString()).Date < DateTime.Today.Date) { UiVisOrdenesVenta.JSProperties.Add("cpErrorFecha", "La fecha tiene que ser mayor o igual a la fecha actual."); } else if (ordenDeVentaVista.DELIVERY_DATE != null && DateTime.Parse(UiFechaOrdenDeVenta.Value.ToString()).Date == DateTime.Today.Date && e.Parameters.Split('-')[2] == "0") { UiVisOrdenesVenta.JSProperties.Add("cpAdvertenciaFecha", "Selecciono la fecha hoy, no podra anular la orden de venta. Desea continuar?"); } else { ordenDeVentaEncabezado.POSTED_DATETIME = DateTime.Parse(UiFechaInicio.Value.ToString()); ordenDeVentaEncabezado.CLOSED_ROUTE_DATETIME = DateTime.Parse(UiFechaFinal.Value.ToString()); ordenDeVentaEncabezado.LOGIN = Session["LOGIN"].ToString(); ordenDeVentaEncabezado.SALES_ORDER_ID = ordenDeVentaVista.SALES_ORDER_ID; ordenDeVentaEncabezado.DOC_SERIE = ordenDeVentaVista.DOC_SERIE; ordenDeVentaEncabezado.DOC_NUM = ordenDeVentaVista.DOC_NUM; ordenDeVentaEncabezado.DELIVERY_DATE = DateTime.Parse(UiFechaOrdenDeVenta.Value.ToString()).Date; UsuarioDeseaCambiarFechaDeEntrega?.Invoke(sender, new OrdenVentaArgumento { Data = ordenDeVentaEncabezado }); UiVisOrdenesVenta.JSProperties.Add("cpCerrarPopupFecha", "Enabled"); } break; } }