Exemplo n.º 1
0
        public ucToolEmpSum()
        {
            InitializeComponent();

            luProject.Properties.DataSource   = Project.AccessibleList().Select(p => new { Project = p.Name, Code = p.Code, MatchId = p.MatchId, DisplayName = p.DisplayName });
            luLemNumber.Properties.DataSource = LemHeader.GetAllLemNumber().Select(x => new { LemNum = x });

            Func <string, string, int, GridColumn> CreateColumn = new Func <string, string, int, GridColumn>((field, caption, visibleIndex) =>
            {
                GridColumn column   = gvSummary.Columns.AddVisible(field, caption);
                column.VisibleIndex = visibleIndex;
                return(column);
            });

            int visionIndex = 0;

            new List <string> {
                ColName.EmpNum, ColName.EmployeeName, ColName.WorkClass, ColName.Project
            }.ForEach(
                x => gvSummary.Columns[x].VisibleIndex = visionIndex++
                );

            foreach (var timecode in TimeCode.SubList(EnumValueType.Hours))
            {
                tableLabour.Columns.Add(ColName.BillRateI(timecode), Type.GetType("System.Decimal"));
                var rateCol = CreateColumn(ColName.BillRateI(timecode), $"{timecode.Desc} Bill Rate", visionIndex++);
                rateCol.DisplayFormat.FormatType   = FormatType.Numeric;
                rateCol.DisplayFormat.FormatString = "c2";
                rateCol.OptionsColumn.AllowEdit    = false;

                tableLabour.Columns.Add(ColName.EnterValueI(timecode), Type.GetType("System.Decimal"));
                var hourCol = CreateColumn(ColName.EnterValueI(timecode), $"{timecode.Desc} Hours", visionIndex++);
                hourCol.DisplayFormat.FormatType   = FormatType.Numeric;
                hourCol.DisplayFormat.FormatString = "n2";
                hourCol.OptionsColumn.AllowEdit    = false;
                hourCol.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
                    new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, hourCol.FieldName, "{0:n2}")
                });
            }

            foreach (var timecode in TimeCode.SubList(TimeCode.EnumValueType.Dollars))
            {
                tableLabour.Columns.Add(ColName.EnterValueI(timecode), Type.GetType("System.Decimal"));
                var amountCol = CreateColumn(ColName.EnterValueI(timecode), timecode.Desc, visionIndex++);
                amountCol.DisplayFormat.FormatType   = FormatType.Numeric;
                amountCol.DisplayFormat.FormatString = "c2";
                amountCol.OptionsColumn.AllowEdit    = false;
                amountCol.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
                    new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, amountCol.FieldName, "{0:c2}")
                });
            }

            gvSummary.Columns[ColName.TotalHours].VisibleIndex = visionIndex++;
            gvSummary.Columns[ColName.BillAmount].VisibleIndex = visionIndex++;
            gvSummary.BestFitColumns(true);
        }
Exemplo n.º 2
0
        public ucFieldPO()
        {
            InitializeComponent();

            btnSubmit.Enabled = false;

            _fileMgr                     = new ucFileManager(MobileCommon.HMCon, GuiCommon.HMDevXManager, DocumentViewerMode.All, false, "F", true);
            _fileMgr.Dock                = DockStyle.Fill;
            _fileMgr.Parent              = dpAttachment;
            _fileMgr.AttachmentsRemoved += AttachmentsRemoved;
            _fileMgr.AttachmentsAdded   += AttachmentsAdded;
            _fileMgr.AttachmentsEdited  += AttachmentsEdited;
            _fileMgr.Enabled             = false;

            luColSupplier.DataSource     = Supplier.ListForCompany().Select(s => new { SupplierCode = s.SupplierCode, SupplierName = s.SupplierName });
            luColSupplierName.DataSource = Supplier.ListForCompany().Select(s => new { SupplierCode = s.SupplierCode, SupplierName = s.SupplierName });

            luColProjectCode.DataSource = Project.AccessibleList().Select(p => new { MatchId = p.MatchId, Code = p.Code, Project = p.Name }).ToList();
            luColProjectName.DataSource = Project.AccessibleList().Select(p => new { MatchId = p.MatchId, Code = p.Code, Project = p.Name }).ToList();

            var level1CodeList = LevelOneCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel1All.DataSource = level1CodeList.OrderBy(x => x.MatchId);

            var level2CodeList = LevelTwoCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel2All.DataSource = level2CodeList.OrderBy(x => x.MatchId);

            var level3CodeList = LevelThreeCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel3All.DataSource = level3CodeList.OrderBy(x => x.MatchId);

            var level4CodeList = LevelFourCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel4All.DataSource = level4CodeList.OrderBy(x => x.MatchId);

            luDetailComponent.DataSource = Enum.GetValues(typeof(EnumComponentType)).Cast <EnumComponentType>().Select(x => new { Type = Enum.GetName(typeof(EnumComponentType), x), Enum = (char)x });

            int maxLevel  = Company.GetCurrCompany().MaxLevelCode;
            var SetColumn = new Action <GridColumn, int, string>((col, level, caption) =>
            {
                col.Visible = maxLevel >= level;
                col.OptionsColumn.ShowInCustomizationForm = maxLevel >= level;
                col.Caption = caption;
            });

            SetColumn(colDetailLevel4Code, 4, Company.GetCurrCompany().Level4CodeDesc);
            SetColumn(colDetailLevel3Code, 3, Company.GetCurrCompany().Level3CodeDesc);
            SetColumn(colDetailLevel2Code, 2, Company.GetCurrCompany().Level2CodeDesc);
            SetColumn(colDetailLevel1Code, 1, Company.GetCurrCompany().Level1CodeDesc);
        }
Exemplo n.º 3
0
        public ucLemHeader()
        {
            InitializeComponent();

            luProject.Properties.DataSource = Project.AccessibleList().Select(p => new { Project = p.Name, Code = p.Code, MatchId = p.MatchId, DisplayName = p.DisplayName });
            luStatus.Properties.DataSource  = GetEnums <EnumLogStatus>().Select(x => new { Status = GetEnumName(x) });

            luColProjectCode.DataSource  = Project.AccessibleList().Select(p => new { MatchId = p.MatchId, Code = p.Code, Project = p.Name }).ToList();
            luColProjectName.DataSource  = Project.AccessibleList().Select(p => new { MatchId = p.MatchId, Code = p.Code, Project = p.Name }).ToList();
            luColLogAllStatus.DataSource = GetEnums <EnumLogStatus>().Select(x => new { Status = GetEnumName(x), Enum = (char)x });
            luColLogStatus.DataSource    = new EnumLogStatus[] { EnumLogStatus.Pending, EnumLogStatus.Approved }.Select(x => new { Status = GetEnumName(x), Enum = (char)x });

            _fileMgr                     = new ucFileManager(HMCon, HMDevXManager, DocumentViewerMode.All, false, "F", true);
            _fileMgr.Dock                = DockStyle.Fill;
            _fileMgr.Parent              = dpAttachment;
            _fileMgr.AttachmentsRemoved += AttachmentsRemoved;
            _fileMgr.AttachmentsAdded   += AttachmentsAdded;
            _fileMgr.AttachmentsEdited  += AttachmentsEdited;
            _fileMgr.Enabled             = false;

            ClearAll();
        }
Exemplo n.º 4
0
 public void Init()
 {
     luProject.Properties.DataSource   = Project.AccessibleList().Select(p => new { Project = p.Name, Code = p.Code, MatchId = p.MatchId, DisplayName = p.DisplayName });
     luLogStatus.Properties.DataSource = Enum.GetValues(typeof(EnumLogStatus)).Cast <EnumLogStatus>().Select(status => new { Status = Enum.GetName(typeof(EnumLogStatus), status) });
 }