private void ArmarDetalle(List <VSeleccion_01_Lista> lresult) { if (lresult.Count() > 0) { Dgv_Seleccion.DataSource = lresult; Dgv_Seleccion.RetrieveStructure(); Dgv_Seleccion.AlternatingColors = true; Dgv_Seleccion.RootTable.Columns["id"].Visible = false; Dgv_Seleccion.RootTable.Columns["IdSeleccion"].Visible = false; Dgv_Seleccion.RootTable.Columns["IdProducto"].Visible = false; Dgv_Seleccion.RootTable.Columns["Estado"].Visible = false; Dgv_Seleccion.RootTable.Columns["Producto"].Caption = "PRODUCTO"; Dgv_Seleccion.RootTable.Columns["Producto"].Width = 150; Dgv_Seleccion.RootTable.Columns["Producto"].HeaderAlignment = Janus.Windows.GridEX.TextAlignment.Center; Dgv_Seleccion.RootTable.Columns["Producto"].CellStyle.FontSize = 9; Dgv_Seleccion.RootTable.Columns["Producto"].CellStyle.TextAlignment = Janus.Windows.GridEX.TextAlignment.Near; Dgv_Seleccion.RootTable.Columns["Producto"].Visible = true; Dgv_Seleccion.RootTable.Columns["Cantidad"].Key = "Cantidad"; Dgv_Seleccion.RootTable.Columns["Cantidad"].Caption = "CANT."; Dgv_Seleccion.RootTable.Columns["Cantidad"].FormatString = "0"; Dgv_Seleccion.RootTable.Columns["Cantidad"].Width = 75; Dgv_Seleccion.RootTable.Columns["Cantidad"].HeaderAlignment = Janus.Windows.GridEX.TextAlignment.Center; Dgv_Seleccion.RootTable.Columns["Cantidad"].CellStyle.FontSize = 9; Dgv_Seleccion.RootTable.Columns["Cantidad"].CellStyle.TextAlignment = Janus.Windows.GridEX.TextAlignment.Far; Dgv_Seleccion.RootTable.Columns["Cantidad"].Visible = true; Dgv_Seleccion.RootTable.Columns["Precio"].Caption = "PRECIO"; Dgv_Seleccion.RootTable.Columns["Precio"].FormatString = "0.00"; Dgv_Seleccion.RootTable.Columns["Precio"].Width = 75; Dgv_Seleccion.RootTable.Columns["Precio"].HeaderAlignment = Janus.Windows.GridEX.TextAlignment.Center; Dgv_Seleccion.RootTable.Columns["Precio"].CellStyle.FontSize = 9; Dgv_Seleccion.RootTable.Columns["Precio"].CellStyle.TextAlignment = Janus.Windows.GridEX.TextAlignment.Far; Dgv_Seleccion.RootTable.Columns["Precio"].Visible = true; Dgv_Seleccion.RootTable.Columns["Total"].Caption = "TOTAL"; Dgv_Seleccion.RootTable.Columns["Total"].FormatString = "0.00"; Dgv_Seleccion.RootTable.Columns["Total"].Width = 90; Dgv_Seleccion.RootTable.Columns["Total"].HeaderAlignment = Janus.Windows.GridEX.TextAlignment.Center; Dgv_Seleccion.RootTable.Columns["Total"].CellStyle.FontSize = 9; Dgv_Seleccion.RootTable.Columns["Total"].CellStyle.TextAlignment = Janus.Windows.GridEX.TextAlignment.Far; Dgv_Seleccion.RootTable.Columns["Total"].Visible = true; //Dgv_Buscardor.FilterRowButtonStyle = FilterRowButtonStyle.ConditionOperatorDropDown; Dgv_Seleccion.GroupByBoxVisible = false; Dgv_Seleccion.VisualStyle = VisualStyle.Office2007; } }
private void MP_ObtenerCalculo() { try { decimal Precio = 0; if (Tb_IdCompraIngreso.Text != "") { var lresult = new ServiceDesktop.ServiceDesktopClient().CmmpraIngreso_01ListarXId(Convert.ToInt32(Tb_IdCompraIngreso.Text)).ToList(); Precio = lresult.Select(c => c.PrecioCost).Sum() / lresult.Where(c => c.PrecioCost > 0).Select(d => d.PrecioCost).Count(); } Tb_Recep_TCantidad.Value = Convert.ToDouble(Dgv_Detalle.GetTotal(Dgv_Detalle.RootTable.Columns["TotalCant"], AggregateFunction.Sum)); Tb_Recep_TPrecio.Value = Convert.ToDouble(Precio); Tb_Recep_Total.Value = Tb_Recep_TCantidad.Value * Tb_Recep_TPrecio.Value; Tb_TCantidad.Value = Convert.ToDouble(Dgv_Seleccion.GetTotal(Dgv_Seleccion.RootTable.Columns["Cantidad"], AggregateFunction.Sum)); Tb_TPrecio.Value = Convert.ToDouble(Precio); //Tb_Selecc_TPrecio.Value = Convert.ToDouble(Dgv_Seleccion.GetTotal(Dgv_Seleccion.RootTable.Columns["Precio"], AggregateFunction.Sum)) / Dgv_Seleccion.RowCount; Tb_Total.Value = Tb_TCantidad.Value * Tb_TPrecio.Value; } catch (Exception ex) { MP_MostrarMensajeError(ex.Message); } }