예제 #1
0
        private void grdCredits_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["movimiento"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["importe"],
                                                  TextFormatEnum.Currency);
        }
예제 #2
0
        private void grdLines_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["numero_linea"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["precio_pactado"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["costo_promedio"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["cantidad"],
                                                  TextFormatEnum.NaturalQuantity);
        }
예제 #3
0
        private void grdFacturasPendientes_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["fiscal"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_acumulado"],
                                                  TextFormatEnum.Currency);
        }
        private void grdAgentSegments_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            layout.Override.AllowUpdate = DefaultableBoolean.False;

            band.Columns["id"].Hidden      = true;
            band.Columns["esquema"].Hidden = true;
            band.Columns["utilidad_inicial"].Header.Caption = "Utilidad inicial";
            band.Columns["comision"].Header.Caption         = "Comisión";
            band.Columns["tipo"].Header.Caption             = "Tipo";

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad_inicial"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["comision"],
                                                  TextFormatEnum.Percentage);
        }
예제 #5
0
        private void grdPrincipal_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];
            int             index  = 0;

            foreach (UltraGridColumn column in band.Columns.Cast <UltraGridColumn>()
                     .Where(x => x.Index >= 4))
            {
                if (!int.TryParse(column.Header.Caption.Split(' ').First(), out index))
                {
                    continue;
                }

                column.Header.Caption = TimeUtil.MonthName((TimeUtil.MonthEnum)index);
            }

            foreach (UltraGridColumn column in band.Columns
                     .Cast <UltraGridColumn>().Where(x => x.Index >= 4))
            {
                WindowsFormsUtil.SetUltraColumnFormat(column, TextFormatEnum.Currency);
                column.Width = 100;
            }

            foreach (UltraGridRow row in this.frmHorizontalIntegration.grdPrincipal.Rows.Where(x => x.Cells != null))
            {
                foreach (UltraGridCell cell in row.Cells.Cast <UltraGridCell>().Where(x => x.Column.Index >= 4))
                {
                    if (Convert.ToDecimal(cell.Value) == 0M)
                    {
                        cell.Appearance.BackColor = Color.Yellow;
                    }
                }
            }

            band.Columns["CustomerId"].Header.Caption    = "Id Cliente";
            band.Columns["Agent"].Header.Caption         = "Agente";
            band.Columns["CustomerName"].Header.Caption  = "Nombre Cliente";
            band.Columns["ComercialName"].Header.Caption = "Nombre Comercial";

            band.SortedColumns.Add("Agent", false, true);
        }
        private void grdRelations_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            band.Override.AllowUpdate = DefaultableBoolean.False;

            layout.AutoFitStyle                 = AutoFitStyle.ExtendLastColumn;
            band.Override.MinRowHeight          = 3;
            band.Override.RowSizing             = RowSizing.AutoFixed;
            band.Override.RowSizingAutoMaxLines = 5;

            band.Columns["TenderLineId"].CellActivation = Activation.ActivateOnly;
            band.Columns["Description"].CellMultiLine   = DefaultableBoolean.True;
            band.Columns["Description"].VertScrollBar   = true;
            band.Columns["Concept"].CellMultiLine       = DefaultableBoolean.True;
            band.Columns["Concept"].VertScrollBar       = true;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["Quantity"],
                                                  TextFormatEnum.NaturalQuantity);
        }
예제 #7
0
        protected override void OnInitializeLayout(InitializeLayoutEventArgs e)
        {
            base.OnInitializeLayout(e);

            e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;

            FormConfiguration formConfiguration = null;

            if (this.DataSource != null)
            {
                IList <string> lstCustomControlNames = new List <string>();
                this.GetCustomControlsNames(this.Parent, lstCustomControlNames);
                string parentFormName = lstCustomControlNames.Last();
                lstCustomControlNames.Remove(parentFormName);
                string schemeName = null;

                if (parentFormName != null && parentFormName.Contains("Form"))
                {
                    Form form = this.GetForm(this.Parent);
                    schemeName = form.GetType().Namespace.Split('.')[1];

                    if (typeof(IConfigurableForm).IsAssignableFrom(form.GetType()))
                    {
                        IConfigurableForm configurableForm = form as IConfigurableForm;

                        formConfiguration = configurableForm.FormConfiguration;
                    }
                    else
                    {
                        FormConfigurationParameters pmtFormConfiguration = new FormConfigurationParameters();
                        pmtFormConfiguration.FormName = parentFormName;
                        formConfiguration             = srvFormConfiguration.GetByParameters(pmtFormConfiguration);
                    }
                }
                else
                {
                    return;
                }

                if (formConfiguration == null)
                {
                    SchemeParameters pmtScheme = new SchemeParameters();
                    pmtScheme.Name = schemeName;

                    Scheme scheme = this.srvScheme.GetByParameters(pmtScheme);

                    formConfiguration          = new FormConfiguration();
                    formConfiguration.FormName = parentFormName;
                    formConfiguration.Scheme   = scheme;
                    srvFormConfiguration.SaveOrUpdate(formConfiguration);
                }

                string gridName = (lstCustomControlNames.Count == 0 ? "" :
                                   string.Join(".", lstCustomControlNames.Reverse().ToArray()) + ".") + this.Name;

                FormConfigurationGrid formGrid = formConfiguration.FormConfigurationGrids
                                                 .SingleOrDefault(x => x.GridName == gridName);

                if (formGrid == null)
                {
                    FormConfigurationGridParameters pmtFormConfigurationGrid = new FormConfigurationGridParameters();
                    pmtFormConfigurationGrid.GridName            = gridName;
                    pmtFormConfigurationGrid.FormConfigurationId = formConfiguration.FormConfigurationId;
                    formGrid = srvFormConfigurationGrid.GetByParameters(pmtFormConfigurationGrid);
                }

                if (formGrid == null)
                {
                    formGrid                     = new FormConfigurationGrid();
                    formGrid.GridName            = gridName;
                    formGrid.IgnoreConfiguration = false;
                    formGrid.FormConfiguration   = formConfiguration;
                    srvFormConfigurationGrid.SaveOrUpdate(formGrid);
                }

                if (formGrid.IgnoreConfiguration)
                {
                    return;
                }

                foreach (UltraGridBand band in this.DisplayLayout.Bands)
                {
                    foreach (UltraGridColumn column in band.Columns)
                    {
                        FormConfigurationGridColumn formGridColumn = null;

                        if (formGrid.FormConfigurationGridColumns != null)
                        {
                            formGridColumn = formGrid
                                             .FormConfigurationGridColumns.SingleOrDefault(x => x.ColumnName == column.Key &&
                                                                                           (x.BandKey == null || x.BandKey == band.Key));
                        }

                        if (formGridColumn == null)
                        {
                            formGridColumn = new FormConfigurationGridColumn();
                            formGrid.FormConfigurationGridColumns.Add(formGridColumn);
                            formGridColumn.ColumnName            = column.Key;
                            formGridColumn.ColumnEndUserName     = column.Key;
                            formGridColumn.FormConfigurationGrid = formGrid;
                            formGridColumn.Visible = false;
                            formGridColumn.BandKey = band.Key;
                            srvFormConfigurationGridColumn.SaveOrUpdate(formGridColumn);
                        }
                    }
                }

                IList <string> lstOrderedColumnNames = formGrid.FormConfigurationGridColumns
                                                       .OrderBy(x => x.FormConfigurationGridColumnId).Select(x => x.ColumnName).ToList();

                foreach (UltraGridBand band in this.DisplayLayout.Bands)
                {
                    int index = 0;
                    foreach (UltraGridColumn column in band.Columns.Cast <UltraGridColumn>()
                             .OrderBy(x => lstOrderedColumnNames.IndexOf(x.Key)))
                    {
                        FormConfigurationGridColumn gridColumnConfiguration = formGrid
                                                                              .FormConfigurationGridColumns.Single(x => x.ColumnName == column.Key &&
                                                                                                                   (x.BandKey == null || x.BandKey == band.Key));

                        column.Hidden                 = !gridColumnConfiguration.Visible && !formGrid.IgnoreConfiguration;
                        column.Header.Caption         = gridColumnConfiguration.ColumnEndUserName;
                        column.Header.VisiblePosition = index++;

                        if (gridColumnConfiguration.TextFormat != null)
                        {
                            WindowsFormsUtil.SetUltraColumnFormat(column, gridColumnConfiguration.TextFormat);
                        }
                        if (gridColumnConfiguration.Width.HasValue)
                        {
                            column.Width = gridColumnConfiguration.Width.Value;
                        }
                    }

                    //band.SummaryFooterCaption = "Sumatorias";
                }
            }
        }
예제 #8
0
        private void grdDetalleQuincena_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["fiscal"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura_original"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["importe"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["costo"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad_comisionable"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["margen_utilidad"],
                                                  TextFormatEnum.Percentage);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_acumulado"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_cuota"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_comision"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_comision_agente"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_pagado"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["porcentaje_comision"],
                                                  TextFormatEnum.Percentage);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["cuota"],
                                                  TextFormatEnum.Currency);

            Parallel.ForEach(this.grdDetalleQuincena.Rows, row =>
            {
                if (row.Cells["pendiente_pago"].Value.ToString() == "Si")
                {
                    row.CellAppearance.BackColor = Color.LightGreen;
                }

                decimal utilidad = Convert.ToDecimal(row.Cells["utilidad_comisionable"].Value);
                decimal utilidadComissionable = Convert.ToDecimal(row.Cells["utilidad_comisionable"].Value);

                if (utilidad - utilidadComissionable > 0.01M || utilidadComissionable <= 0)
                {
                    if (row.CellAppearance.BackColor == Color.LightGreen)
                    {
                        row.CellAppearance.BackColor = Color.YellowGreen;
                    }
                    else
                    {
                        row.CellAppearance.BackColor = Color.Yellow;
                    }
                }
            });
        }