private void handleLoadedTemplates(TECTemplates templates) { if (ReplaceScope) { bid.Templates.Unionize(templates.Templates); } else { bid.Templates.Fill(templates.Templates); } if (ReplaceCatalogs) { bid.Catalogs.Unionize(templates.Catalogs); } else { bid.Catalogs.Fill(templates.Catalogs); } if (databaseManager == null && bid.Templates.Parameters.Count > 0) { bid.Parameters = new TECParameters(bid.Templates.Parameters.First()); } ModelLinkingHelper.LinkBidToCatalogs(bid); estimate = new TECEstimator(bid, watcher); EditorVM = new EstimateEditorVM(bid, watcher, estimate); CurrentVM = EditorVM; ViewEnabled = true; }
private static string createPlotImage(TECEstimator estimate) { string path = Path.GetTempFileName(); var pngExporter = new PngExporter { Width = 600, Height = 400, Background = OxyColors.White }; PlotModel plotModel = new PlotModel { Title = "Cost Distribution" }; OxyPlot.Series.PieSeries pieSeries = new OxyPlot.Series.PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; pieSeries.Slices.Add(new PieSlice("Material Cost", estimate.TECMaterialCost) { IsExploded = false }); pieSeries.Slices.Add(new PieSlice("Labor Cost", estimate.TECLaborCost) { IsExploded = false }); pieSeries.Slices.Add(new PieSlice("Sub. Labor Cost", estimate.SubcontractorLaborCost) { IsExploded = false }); pieSeries.Slices.Add(new PieSlice("Sub. Material Cost", estimate.ElectricalMaterialCost) { IsExploded = false }); plotModel.Series.Add(pieSeries); pngExporter.ExportToFile(plotModel, path); return(path); }
public void SaveAs_Bid_Estimate() { TECBid saveBid = ModelCreation.TestBid(rand); var watcher = new ChangeWatcher(saveBid); TECEstimator estimate = new TECEstimator(saveBid, watcher); var expectedTotalCost = estimate.TotalCost; double delta = 0.0001; Dictionary <Guid, INotifyCostChanged> saveCostDictionary = new Dictionary <Guid, INotifyCostChanged>(); addToCost(saveCostDictionary, saveBid, saveBid); //Act path = Path.GetTempFileName(); DatabaseManager <TECBid> manager = new DatabaseManager <TECBid>(path); manager.New(saveBid); TECBid loadedBid = manager.Load() as TECBid; var loadedWatcher = new ChangeWatcher(loadedBid); TECEstimator loadedEstimate = new TECEstimator(loadedBid, loadedWatcher); Dictionary <Guid, INotifyCostChanged> loadCostDictionary = new Dictionary <Guid, INotifyCostChanged>(); addToCost(loadCostDictionary, loadedBid, loadedBid); compareCosts(saveCostDictionary, loadCostDictionary); compareEstimators(estimate, loadedEstimate); Assert.AreEqual(expectedTotalCost, loadedEstimate.TotalCost, delta); }
protected override void handleLoaded(TECBid loadedBid) { if (loadedBid != null) { bid = loadedBid; watcher = new ChangeWatcher(bid); doStack = new DoStacker(watcher); deltaStack = new DeltaStacker(watcher, bid); if (databaseManager == null && currentTemplatesPath != "") { DatabaseManager <TECTemplates> templatesDatabaseManager = new DatabaseManager <TECTemplates>(currentTemplatesPath); templatesDatabaseManager.LoadComplete += handleLoadedTemplates; ViewEnabled = false; templatesDatabaseManager.AsyncLoad(); } else { estimate = new TECEstimator(bid, watcher); EditorVM = new EstimateEditorVM(bid, watcher, estimate); CurrentVM = EditorVM; ViewEnabled = true; } } else { this.splashVM.LoadingText = ""; ViewEnabled = true; } }
private void compareEstimators(TECEstimator expected, TECEstimator actual) { Assert.AreEqual(expected.TotalPointNumber, actual.TotalPointNumber); Assert.AreEqual(expected.TECCost, actual.TECCost, DELTA); Assert.AreEqual(expected.TECLaborHours, actual.TECLaborHours, DELTA); Assert.AreEqual(expected.SubcontractorCost, actual.SubcontractorCost, DELTA); Assert.AreEqual(expected.SubcontractorLaborHours, actual.SubcontractorLaborHours, DELTA); }
public LaborVM(TECBid bid, TECEstimator estimate) { Bid = bid; Estimate = estimate; DesiredConfidence = bid.Parameters.DesiredConfidence; SetParametersCommand = new RelayCommand <TECParameters>(SetParametersExecute); SetDesiredConfidenceCommand = new RelayCommand(SetConfidenceExecute, CanSetConfidence); }
public SystemSummaryItem(TECTypical typical, TECParameters parameters, double duration = 0.0) { this.Typical = typical; Estimate = new TECEstimator(Typical, parameters, new TECExtraLabor(Guid.NewGuid()), duration, new ChangeWatcher(Typical)); UnitPrice = Estimate.TotalPrice / Typical.Instances.Count; Estimate.PropertyChanged += (x, y) => { UnitPrice = Estimate.TotalPrice / Typical.Instances.Count; }; }
private static Paragraph saleSummary(TECEstimator estimate) { Paragraph par = new Paragraph(); Text saleText = new Text(String.Format("Sale Price: {0:C}", estimate.TotalPrice)); Text marginText = new Text(String.Format("Margin: %{0:F2}", estimate.Margin)); par.Append(new Break()); par.Append(new Run(saleText)); par.Append(new Break()); par.Append(new Run(marginText)); return(par); }
public void IdenticalSeedBidTest() { Random rand1 = new Random(0); Random rand2 = new Random(0); TECBid bid1 = ModelCreation.TestBid(rand1); TECBid bid2 = ModelCreation.TestBid(rand2); TECEstimator estimator1 = new TECEstimator(bid1, new ChangeWatcher(bid1)); TECEstimator estimator2 = new TECEstimator(bid2, new ChangeWatcher(bid2)); Assert.AreEqual(estimator1.TotalCost, estimator2.TotalCost); }
private static void createLaborSummarySection(IXLWorksheet worksheet, TECEstimator estimate, int startRow, int startColumn) { int x = startRow; int y = startColumn; int yPrime = y + 1; worksheet.Cell(x, y).Value = "Labor Summary"; worksheet.Cell(x, y).Style.Font.SetBold(); worksheet.Cell(x, y).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; x++; worksheet.Cell(x, y).Value = "Project Management (Hours)"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.PMLaborHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Engineering (Hours)"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.ENGLaborHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Software (Hours)"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.SoftLaborHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Commissioning (Hours)"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.CommLaborHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Graphics (Hours)"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.GraphLaborHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Field (Hours)"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.TECFieldHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Total Hours"; worksheet.Cell(x, y).Style.Font.SetBold(); worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.TECLaborHours); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; worksheet.Cell(x, yPrime).Style.Font.SetBold(); }
public void TotalMatches() { var bid = new TECBid(); var parameters = ModelCreation.TestParameters(rand, bid); var catalogs = ModelCreation.TestCatalogs(rand); bid.Parameters = parameters; bid.Catalogs = catalogs; ChangeWatcher watcher = new ChangeWatcher(bid); SystemSummaryVM summaryVM = new SystemSummaryVM(bid, watcher); List <Tuple <TECEstimator, TECTypical> > estimates = new List <Tuple <TECEstimator, TECTypical> >(); int x = 6; for (int i = 0; i < x; i++) { TECTypical typical1 = createTypical(bid); TECEstimator estimate1 = new TECEstimator(typical1, bid.Parameters, new TECExtraLabor(Guid.NewGuid()), bid.Duration, new ChangeWatcher(typical1)); estimates.Add(new Tuple <TECEstimator, TECTypical>(estimate1, typical1)); } double previous = estimates[0].Item1.TotalPrice; foreach (var thing in estimates) { Assert.AreEqual(thing.Item1.TotalPrice, previous); previous = thing.Item1.TotalPrice; } int y = 0; foreach (var item in estimates) { foreach (SystemSummaryItem system in summaryVM.Systems) { Assert.AreEqual(item.Item1.TotalPrice, system.Estimate.TotalPrice); if (system.Typical == item.Item2) { Assert.AreEqual(system.Estimate.TotalPrice, item.Item1.TotalPrice); y++; break; } } } }
internal static void GenerateTurnoverExport(string path, TECBid bid, TECEstimator estimate, bool openOnComplete = true) { XLWorkbook workbook = new XLWorkbook(); createSummarySheet(workbook, bid, estimate); MaterialSummaryExport.AddControllersSheet(workbook, bid, estimate, "Controller Hardware"); MaterialSummaryExport.AddPanelsSheet(workbook, bid, "Panel Hardware"); MaterialSummaryExport.AddDevicesSheet(workbook, bid); MaterialSummaryExport.AddValvesSheet(workbook, bid); MaterialSummaryExport.AddElectricalMaterialSheet(workbook, bid); MaterialSummaryExport.AddMiscCostsSheet(workbook, bid); workbook.SaveAs(path); if (openOnComplete) { System.Diagnostics.Process.Start(path); } }
private static void createSummarySheet(XLWorkbook workbook, TECBid bid, TECEstimator estimate) { IXLWorksheet worksheet = workbook.Worksheets.Add("Summary"); createProjectInfoSection(worksheet, bid, 1); createCostSummarySection(worksheet, estimate, 7); createLaborSummarySection(worksheet, estimate, 20, 1); createSalesSummarySection(worksheet, estimate, 20, 4); var image = worksheet.AddPicture(createPlotImage(estimate)); image.MoveTo(worksheet.Cell(28, 1).Address); //image.Scale(.7); worksheet.Columns().AdjustToContents(); worksheet.PageSetup.PageOrientation = XLPageOrientation.Portrait; worksheet.PageSetup.FitToPages(1, 1); }
private static Paragraph costSummary(TECEstimator estimate) { Paragraph par = new Paragraph(); Text materialText = new Text(String.Format("Material Cost: {0:C}", estimate.TECMaterialCost)); Text subLaborText = new Text(String.Format("Subcontractor Labor Hours: {0}", estimate.SubcontractorLaborHours)); Text subLaborCostText = new Text(String.Format("Subcontractor Labor Cost: {0:C}", estimate.SubcontractorLaborCost)); Text subMaterialText = new Text(String.Format("Subcontractor Material: {0:C}", estimate.ElectricalMaterialCost)); par.Append(new Break()); par.Append(new Run(materialText)); par.Append(new Break()); par.Append(new Run(subLaborText)); par.Append(new Break()); par.Append(new Run(subLaborCostText)); par.Append(new Break()); par.Append(new Run(subMaterialText)); return(par); }
public EstimateEditorVM(TECBid bid, ChangeWatcher watcher, TECEstimator estimate) { this.bid = bid; this.watcher = watcher; ScopeEditorVM = new ScopeEditorVM(bid, watcher); LaborVM = new LaborVM(bid, estimate); ReviewVM = new ReviewVM(bid, estimate); ProposalVM = new ProposalVM(bid); ItemizedSummaryVM = new ItemizedSummaryVM(bid, watcher); MaterialSummaryVM = new MaterialSummaryVM(bid, watcher); RiserVM = new RiserVM(bid, watcher); ScheduleVM = new ScheduleVM(bid, watcher); BidPropertiesVM = new BidPropertiesVM(bid); InternalNotesVM = new InternalNotesVM(bid); QuotesVM = new QuotesVM(bid, watcher); RefreshMaterialSummaryCommand = new RelayCommand(executeMaterialRefersh); }
private static Paragraph laborSummary(TECEstimator estimate) { Paragraph par = new Paragraph(); Text pmLaborText = new Text(String.Format("Project Management Labor: {0:F} hours", estimate.PMLaborHours)); Text engLaborText = new Text(String.Format("Engineering Labor: {0:F} hours", estimate.ENGLaborHours)); Text softLaborText = new Text(String.Format("Software Labor: {0:F} hours", estimate.SoftLaborHours)); Text commLaborText = new Text(String.Format("Commissioning Labor: {0:F} hours", estimate.CommLaborHours)); Text graphLaborText = new Text(String.Format("Graphics Labor: {0:F} hours", estimate.GraphLaborHours)); par.Append(new Run(pmLaborText)); par.Append(new Break()); par.Append(new Run(engLaborText)); par.Append(new Break()); par.Append(new Run(softLaborText)); par.Append(new Break()); par.Append(new Run(commLaborText)); par.Append(new Break()); par.Append(new Run(graphLaborText)); return(par); }
private static void createSalesSummarySection(IXLWorksheet worksheet, TECEstimator estimate, int startRow, int startColumn) { int x = startRow; int y = startColumn; int yPrime = y + 1; worksheet.Cell(x, y).Value = "Sale Summary"; worksheet.Cell(x, y).Style.Font.SetBold(); worksheet.Cell(x, y).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; x++; worksheet.Cell(x, y).Value = "Price"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", estimate.TotalPrice); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; x++; worksheet.Cell(x, y).Value = "Margin"; worksheet.Cell(x, yPrime).Value = String.Format("{0}", (estimate.Margin / 100)); worksheet.Cell(x, yPrime).Style.NumberFormat.Format = "0.00%"; worksheet.Cell(x, yPrime).DataType = XLDataType.Number; }
internal static void GenerateSummaryExport(string path, TECBid bid, TECEstimator estimate, bool openOnComplete = true) { using (WordprocessingDocument package = WordprocessingDocument.Create(path, DocumentFormat.OpenXml.WordprocessingDocumentType.Document)) { package.AddMainDocumentPart(); Document document = new Document(); Body body = new Body(); document.Append(body); package.MainDocumentPart.Document = document; body.Append(introParagraph(bid)); body.Append(laborSummary(estimate)); body.Append(costSummary(estimate)); body.Append(saleSummary(estimate)); package.MainDocumentPart.Document.Save(); } if (openOnComplete) { System.Diagnostics.Process.Start(path); } }
public ScopeSummaryItem(TECScope scope, TECParameters parameters, double duration = 0.0) { this.Scope = scope; watcher = new ChangeWatcher(scope); Estimate = new TECEstimator(scope, parameters, new TECExtraLabor(Guid.NewGuid()), duration, watcher); }
internal static void GenerateReport(string path, TECBid bid, bool openOnComplete = true) { XLWorkbook workbook = new XLWorkbook(); IXLWorksheet worksheet = workbook.Worksheets.Add("Summary"); worksheet.Cell(1, 2).Value = "Quantity"; worksheet.Cell(1, 2).Style.Border.BottomBorder = XLBorderStyleValues.Thick; worksheet.Cell(1, 3).Value = "Price"; worksheet.Cell(1, 3).Style.Border.BottomBorder = XLBorderStyleValues.Thick; worksheet.Cell(1, 4).Value = "Unit Price"; worksheet.Cell(1, 4).Style.Border.BottomBorder = XLBorderStyleValues.Thick; worksheet.Cell(2, 1).Value = "Systems"; worksheet.Cell(2, 1).Style.Border.BottomBorder = XLBorderStyleValues.Thin; int x = 3; for (int i = 0; i < bid.Systems.Count; i++, x++) { TECTypical typical = bid.Systems[i]; TECEstimator systemEstimate = new TECEstimator(typical, bid.Parameters, bid.ExtraLabor, bid.Duration, new ChangeWatcher(typical)); worksheet.Cell(x, 1).Value = typical.Name; worksheet.Cell(x, 2).Value = typical.Instances.Count; worksheet.Cell(x, 3).Value = systemEstimate.TotalPrice; worksheet.Cell(x, 3).Style.NumberFormat.Format = "$ #,##0.00"; worksheet.Cell(x, 4).Value = typical.Instances.Count > 0 ? systemEstimate.TotalPrice / typical.Instances.Count : 0; worksheet.Cell(x, 4).Style.NumberFormat.Format = "$ #,##0.00"; } x++; worksheet.Cell(x, 1).Value = "BMS Network"; worksheet.Cell(x, 1).Style.Border.BottomBorder = XLBorderStyleValues.Thin; x++; for (int i = 0; i < bid.Controllers.Count; i++, x++) { TECController controller = bid.Controllers[i]; TECEstimator systemEstimate = new TECEstimator(controller, bid.Parameters, bid.ExtraLabor, bid.Duration, new ChangeWatcher(controller)); worksheet.Cell(x, 1).Value = controller.Name; worksheet.Cell(x, 2).Value = "1"; worksheet.Cell(x, 3).Value = systemEstimate.TotalPrice; worksheet.Cell(x, 3).Style.NumberFormat.Format = "$ #,##0.00"; } for (int i = 0; i < bid.Panels.Count; i++, x++) { TECPanel typical = bid.Panels[i]; TECEstimator systemEstimate = new TECEstimator(typical, bid.Parameters, bid.ExtraLabor, bid.Duration, new ChangeWatcher(typical)); worksheet.Cell(x, 1).Value = typical.Name; worksheet.Cell(x, 2).Value = "1"; worksheet.Cell(x, 3).Value = systemEstimate.TotalPrice; worksheet.Cell(x, 3).Style.NumberFormat.Format = "$ #,##0.00"; } x++; worksheet.Cell(x, 1).Value = "Miscellaneous"; worksheet.Cell(x, 1).Style.Border.BottomBorder = XLBorderStyleValues.Thin; x++; for (int i = 0; i < bid.MiscCosts.Count; i++, x++) { TECMisc typical = bid.MiscCosts[i]; TECEstimator systemEstimate = new TECEstimator(typical, bid.Parameters, bid.ExtraLabor, bid.Duration, new ChangeWatcher(typical)); worksheet.Cell(x, 1).Value = typical.Name; worksheet.Cell(x, 2).Value = typical.Quantity; worksheet.Cell(x, 3).Value = systemEstimate.TotalPrice; worksheet.Cell(x, 3).Style.NumberFormat.Format = "$ #,##0.00"; } TECEstimator extraLaborEstimate = new TECEstimator(bid.ExtraLabor, bid.Parameters, bid.ExtraLabor, bid.Duration, new ChangeWatcher(bid.ExtraLabor)); worksheet.Cell(x, 1).Value = "Other Labor"; worksheet.Cell(x, 2).Value = "1"; worksheet.Cell(x, 3).Value = extraLaborEstimate.TotalPrice; worksheet.Cell(x, 3).Style.NumberFormat.Format = "$ #,##0.00"; x += 2; worksheet.Cell(x, 2).Value = "Total: "; worksheet.Cell(x, 2).Style.Border.BottomBorder = XLBorderStyleValues.Thick; worksheet.Cell(x, 3).FormulaA1 = "=SUM(C3:C" + (x - 1) + ")"; worksheet.Cell(x, 3).Style.NumberFormat.Format = "$ #,##0.00"; worksheet.Columns().AdjustToContents(); workbook.SaveAs(path); if (openOnComplete) { System.Diagnostics.Process.Start(path); } }
private void setupExtraLaborEstimate(TECBid bid) { ExtraLaborEstimate = new TECEstimator(new TECPoint(), bid.Parameters, bid.ExtraLabor, bid.Duration, new ChangeWatcher(bid.ExtraLabor)); }
public static void GenerateSummary(string path, TECBid bid, TECEstimator estimate, bool openOnComplete = true) { Turnover.GenerateSummaryExport(path, bid, estimate, openOnComplete); }
public static void GenerateProposal(string path, TECBid bid, TECEstimator estimate, bool openOnComplete = true) { ScopeWordDocumentBuilder.CreateScopeWordDocument(bid, estimate, path, openOnComplete); }
public ReviewVM(TECBid bid, TECEstimator estimate) { Bid = bid; Estimate = estimate; Estimate.PropertyChanged += estimatePropertyChanged; }
private static void createCostSummarySection(IXLWorksheet worksheet, TECEstimator estimate, int startRow) { int x = startRow; worksheet.Cell(x, 1).Value = "Costs Summary"; worksheet.Cell(x, 1).Style.Font.SetBold(); worksheet.Cell(x, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; x++; worksheet.Cell(x, 1).Value = "TEC"; worksheet.Cell(x, 1).Style.Font.SetBold(); x++; worksheet.Cell(x, 1).Value = "Material Cost"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.TECMaterialCost); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; worksheet.Cell(x, 1).Value = "Tax"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.Tax); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; worksheet.Cell(x, 1).Value = "Shipping"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.TECShipping); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; worksheet.Cell(x, 1).Value = "Warranty"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.TECWarranty); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; worksheet.Cell(x, 1).Value = "Labor"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.TECLaborCost); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; worksheet.Cell(x, 1).Value = "Escalation"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.Escalation); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; worksheet.Cell(x, 1).Value = "Total Cost"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.TECCost); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x += 2; worksheet.Cell(x, 1).Value = "Subtotal"; worksheet.Cell(x, 2).Value = String.Format("{0}", estimate.TECSubtotal); worksheet.Cell(x, 2).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 2).DataType = XLDataType.Number; x++; x = startRow + 1; worksheet.Cell(x, 4).Value = "Subcontractor"; worksheet.Cell(x, 4).Style.Font.SetBold(); x++; worksheet.Cell(x, 4).Value = "Material Cost"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.ElectricalMaterialCost); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; x++; worksheet.Cell(x, 4).Value = "Shipping"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.ElectricalShipping); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; x++; worksheet.Cell(x, 4).Value = "Warranty"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.ElectricalWarranty); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; x++; worksheet.Cell(x, 4).Value = "Labor"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.SubcontractorLaborCost); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; x++; worksheet.Cell(x, 4).Value = "Total Cost"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.SubcontractorCost); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; x += 2; worksheet.Cell(x, 4).Value = "Escalation"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.ElectricalEscalation); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; x++; worksheet.Cell(x, 4).Value = "Subtotal"; worksheet.Cell(x, 5).Value = String.Format("{0}", estimate.SubcontractorSubtotal); worksheet.Cell(x, 5).Style.NumberFormat.Format = accountingFormat; worksheet.Cell(x, 5).DataType = XLDataType.Number; }
internal static void AddControllersSheet(XLWorkbook workbook, TECBid bid, TECEstimator estimate, string sheetName = "Controllers") { List <TECController> controllers = getAllControllers(bid); List <TECProvidedController> providedControllers = new List <TECProvidedController>(); foreach (TECController controller in controllers) { if (controller is TECProvidedController provided) { providedControllers.Add(provided); } } List <TECIOModule> modules = getAllIOModules(bid); List <HardwareSummaryItem> controllerItems = consolidateHardware(providedControllers.Select(provided => provided.Type)); List <CostSummaryItem> costItems = consolidateCostInControllers(controllers); List <HardwareSummaryItem> modulesItems = consolidateHardware(modules); IXLWorksheet worksheet = workbook.Worksheets.Add(sheetName); int row = 1; row = worksheet.insertTitleRow(sheetName, row); row++; row = worksheet.insertHardwareHeaders(row); foreach (HardwareSummaryItem item in controllerItems) { row = worksheet.insertHardwareItem(item, row); } row++; row = worksheet.insertTitleRow("IO Modules", row); row++; row = worksheet.insertHardwareHeaders(row); foreach (HardwareSummaryItem item in modulesItems) { row = worksheet.insertHardwareItem(item, row); } row++; row = worksheet.insertTitleRow("Associated Costs", row); row++; row = worksheet.insertCostHeaders(row); foreach (CostSummaryItem item in costItems) { row = worksheet.insertCostItem(item, row); } row++; row = worksheet.insertCostHeaders(row); TECAssociatedCost softwareCost = new TECAssociatedCost(CostType.TEC); softwareCost.Name = "Software Point License"; softwareCost.Cost = estimate.TECSoftwareCost; CostSummaryItem softwareSummary = new CostSummaryItem(softwareCost); row = worksheet.insertCostItem(softwareSummary, row); row++; worksheet.formatFinal(); }