/// <summary> /// Save /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { ProjectCostingSheetInformationTDS projectCostingSheetInformationChanges = (ProjectCostingSheetInformationTDS)Data.GetChanges(); if (projectCostingSheetInformationChanges.BasicInformation.Rows.Count > 0) { ProjectCostingSheetInformationBasicInformationGateway projectCostingSheetInformationBasicInformationGateway = new ProjectCostingSheetInformationBasicInformationGateway(projectCostingSheetInformationChanges); // Update costing sheet foreach (ProjectCostingSheetInformationTDS.BasicInformationRow basicInformationRow in (ProjectCostingSheetInformationTDS.BasicInformationDataTable)projectCostingSheetInformationChanges.BasicInformation) { // Unchanged values int costingSheetId = basicInformationRow.CostingSheetID; int projectId = basicInformationRow.ProjectID; DateTime startDate = basicInformationRow.StartDate; DateTime endDate = basicInformationRow.EndDate; // Original values string originalName = projectCostingSheetInformationBasicInformationGateway.GetNameOriginal(costingSheetId); decimal originalTotalLabourHoursCad = projectCostingSheetInformationBasicInformationGateway.GetTotalLabourHoursCadOriginal(costingSheetId); decimal originalTotalLabourHoursUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalLabourHoursUsdOriginal(costingSheetId); decimal originalTotalMaterialsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalMaterialsCadOriginal(costingSheetId); decimal originalTotalMaterialsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalMaterialsUsdOriginal(costingSheetId); decimal originalTotalUnitsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalUnitsCadOriginal(costingSheetId); decimal originalTotalUnitsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalUnitsUsdOriginal(costingSheetId); decimal originalTotalOtherCostsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalOtherCostsCadOriginal(costingSheetId); decimal originalTotalOtherCostsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalOtherCostsUsdOriginal(costingSheetId); decimal originalGrandTotalCad = projectCostingSheetInformationBasicInformationGateway.GetGrandTotalCadOriginal(costingSheetId); decimal originalGrandTotalUsd = projectCostingSheetInformationBasicInformationGateway.GetGrandTotalUsdOriginal(costingSheetId); string originalState = projectCostingSheetInformationBasicInformationGateway.GetStateOriginal(costingSheetId); bool originalDeleted = projectCostingSheetInformationBasicInformationGateway.GetDeletedOriginal(costingSheetId); decimal originalTotalSubcontractorsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalSubcontractorsCadOriginal(costingSheetId); decimal originalTotalSubcontractorsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalSubcontractorsUsdOriginal(costingSheetId); decimal originalGrandRevenue = projectCostingSheetInformationBasicInformationGateway.GetGrandRevenueOriginal(costingSheetId); decimal originalGrandProfit = projectCostingSheetInformationBasicInformationGateway.GetGrandProfitOriginal(costingSheetId); decimal originalGrandGrossMargin = projectCostingSheetInformationBasicInformationGateway.GetGrandGrossMarginOriginal(costingSheetId); // New variables string newName = projectCostingSheetInformationBasicInformationGateway.GetName(costingSheetId); decimal newTotalLabourHoursCad = projectCostingSheetInformationBasicInformationGateway.GetTotalLabourHoursCad(costingSheetId); decimal newTotalLabourHoursUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalLabourHoursUsd(costingSheetId); decimal newTotalMaterialsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalMaterialsCad(costingSheetId); decimal newTotalMaterialsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalMaterialsUsd(costingSheetId); decimal newTotalUnitsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalUnitsCad(costingSheetId); decimal newTotalUnitsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalUnitsUsd(costingSheetId); decimal newTotalOtherCostsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalOtherCostsCad(costingSheetId); decimal newTotalOtherCostsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalOtherCostsUsd(costingSheetId); decimal newGrandTotalCad = projectCostingSheetInformationBasicInformationGateway.GetGrandTotalCad(costingSheetId); decimal newGrandTotalUsd = projectCostingSheetInformationBasicInformationGateway.GetGrandTotalUsd(costingSheetId); string newState = projectCostingSheetInformationBasicInformationGateway.GetState(costingSheetId); bool newDeleted = projectCostingSheetInformationBasicInformationGateway.GetDeleted(costingSheetId); decimal newTotalSubcontractorsCad = projectCostingSheetInformationBasicInformationGateway.GetTotalSubcontractorsCad(costingSheetId); decimal newTotalSubcontractorsUsd = projectCostingSheetInformationBasicInformationGateway.GetTotalSubcontractorsUsd(costingSheetId); decimal newGrandRevenue = projectCostingSheetInformationBasicInformationGateway.GetGrandRevenue(costingSheetId); decimal newGrandProfit = projectCostingSheetInformationBasicInformationGateway.GetGrandProfit(costingSheetId); decimal newGrandGrossMargin = projectCostingSheetInformationBasicInformationGateway.GetGrandGrossMargin(costingSheetId); // ... Update UpdateCostingSheet(costingSheetId, projectId, originalName, startDate, endDate, originalTotalLabourHoursCad, originalTotalLabourHoursUsd, originalTotalMaterialsCad, originalTotalMaterialsUsd, originalTotalUnitsCad, originalTotalUnitsUsd, originalTotalOtherCostsCad, originalTotalOtherCostsUsd, originalGrandTotalCad, originalGrandTotalUsd, originalState, originalDeleted, companyId, originalTotalSubcontractorsCad, originalTotalSubcontractorsUsd, originalGrandRevenue, originalGrandProfit, originalGrandGrossMargin, projectId, newName, startDate, endDate, newTotalLabourHoursCad, newTotalLabourHoursUsd, newTotalMaterialsCad, newTotalMaterialsUsd, newTotalUnitsCad, newTotalUnitsUsd, newTotalOtherCostsCad, newTotalOtherCostsUsd, newGrandTotalCad, newGrandTotalUsd, newState, newDeleted, companyId, newTotalSubcontractorsCad, newTotalSubcontractorsUsd, newGrandRevenue, newGrandProfit, newGrandGrossMargin); } } }
private void Generate() { mReport1 master = (mReport1)this.Master; int companyId = Convert.ToInt32(Session["companyID"]); string type = Request.QueryString["type"].ToString(); int costingSheetId = 0; int projectId = 0; ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(); if (ddlCostingSheets.SelectedValue != "-1") { // Get Data costingSheetId = Convert.ToInt32(ddlCostingSheets.SelectedValue); projectCostingSheetInformationBasicInformation.LoadByCostingSheetIdForPreviewReport(costingSheetId, companyId); ProjectCostingSheetInformationBasicInformationGateway projectCostingSheetInformationBasicInformationGateway = new ProjectCostingSheetInformationBasicInformationGateway(projectCostingSheetInformationBasicInformation.Data); projectId = projectCostingSheetInformationBasicInformationGateway.GetProjectID(costingSheetId); // ... set properties to master page master.Data = projectCostingSheetInformationBasicInformation.Data; master.Table = projectCostingSheetInformationBasicInformation.TableName; master.Report = new ProjectCostingSheetsPreview(); // Get report if (projectCostingSheetInformationBasicInformation.Table.Rows.Count > 0) { ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadByCompaniesId(clientId, companyId); master.SetParameter("Client", companiesGateway.GetName(clientId)); string name = projectGateway.GetName(projectId); master.SetParameter("Project", name); int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); master.SetParameter("CostingSheet", projectCostingSheetInformationBasicInformationGateway.GetName(costingSheetId)); if (type == "resume") { ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsUnits"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsUnits2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors"]).SectionFormat.EnableSuppress = true; //((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors2"]).SectionFormat.EnableSuppress = true; } else { ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsUnits"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsUnits2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors"]).SectionFormat.EnableSuppress = false; //((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors2"]).SectionFormat.EnableSuppress = false; } if (projectGateway.GetCountryID(projectId) == 1)//Canada { // General ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text32"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text34"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text36"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text38"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["headerTotalSubcontractorsUsd"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalLabourHoursUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalUnitsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalMaterialsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalOtherCostsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["GrandTotalUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalSubcontractorsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["GrandTotalUsd2"].ObjectFormat.EnableSuppress = true; // Labour Hours ReportDocument rpLabourHoursDetails = master.Report.OpenSubreport("LabourHoursDetails"); ReportDocument rpLabourHoursResume = master.Report.OpenSubreport("LabourHoursResume"); ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["LHCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Units ReportDocument rpUnitsDetails = master.Report.OpenSubreport("UnitsDetails"); ReportDocument rpUnitsResume = master.Report.OpenSubreport("UnitsResume"); ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // ((Section)rpUnitsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Materials ReportDocument rpMaterialsDetails = master.Report.OpenSubreport("MaterialsDetails"); ReportDocument rpMaterialsResune = master.Report.OpenSubreport("MaterialsResume"); ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Subcontractors ReportDocument rpSubcontractorsDetails = master.Report.OpenSubreport("SubcontractorsDetails"); //ReportDocument rpSubcontractorsResune = master.Report.OpenSubreport("SubcontractorsResume"); ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; /// //((Section)rpSubcontractorsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; //((Section)rpSubcontractorsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; //((Section)rpSubcontractorsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Other Costs ReportDocument rpOtherCostsDetails = master.Report.OpenSubreport("OtherCostsDetails"); ReportDocument rpOtherCostsResume = master.Report.OpenSubreport("OtherCostsResume"); ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; } else//USA { // General ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text31"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text33"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text35"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text37"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["headerTotalSubcontractorsCad"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalLabourHoursCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalUnitsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalMaterialsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalOtherCostsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["GrandTotalCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalSubcontractorsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["GrandTotalCad2"].ObjectFormat.EnableSuppress = true; // Labour Hours ReportDocument rpLabourHoursDetails = master.Report.OpenSubreport("LabourHoursDetails"); ReportDocument rpLabourHoursResume = master.Report.OpenSubreport("LabourHoursResume"); ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text9"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["LHCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // Units ReportDocument rpUnitsDetails = master.Report.OpenSubreport("UnitsDetails"); ReportDocument rpUnitsResume = master.Report.OpenSubreport("UnitsResume"); ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // ((Section)rpUnitsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // Materials ReportDocument rpMaterialsDetails = master.Report.OpenSubreport("MaterialsDetails"); ReportDocument rpMaterialsResune = master.Report.OpenSubreport("MaterialsResume"); ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // Subcontractors ReportDocument rpSubcontractorsDetails = master.Report.OpenSubreport("SubcontractorsDetails"); ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; // Other Costs ReportDocument rpOtherCostsDetails = master.Report.OpenSubreport("OtherCostsDetails"); ReportDocument rpOtherCostsResume = master.Report.OpenSubreport("OtherCostsResume"); ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; } } } }
private void LoadBasicData() { int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); ProjectCostingSheetInformationBasicInformationGateway projectCostingSheetInformationBasicInformationGateway = new ProjectCostingSheetInformationBasicInformationGateway(projectCostingSheetInformationTDS); if (projectCostingSheetInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load costing sheet basic data tbxState.Text = projectCostingSheetInformationBasicInformationGateway.GetState(costingSheetId); tbxTeamMembersTotalCostCAD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalLabourHoursCad(costingSheetId),2).ToString(); tbxTeamMembersTotalCostUSD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalLabourHoursUsd(costingSheetId),2).ToString(); tbxUnitsTotalCostsCAD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalUnitsCad(costingSheetId),2).ToString(); tbxUnitsTotalCostsUSD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalUnitsUsd(costingSheetId),2).ToString(); tbxMaterialsTotalCostsCAD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalMaterialsCad(costingSheetId),2).ToString(); tbxMaterialsTotalCostsUSD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalMaterialsUsd(costingSheetId),2).ToString(); tbxOtherCostsTotalCostsCAD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalOtherCostsCad(costingSheetId),2).ToString(); tbxOtherCostsTotalCostsUSD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalOtherCostsUsd(costingSheetId),2).ToString(); tbxSubcontractorsTotalCostsCAD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalSubcontractorsCad(costingSheetId), 2).ToString(); tbxSubcontractorsTotalCostsUSD.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetTotalSubcontractorsUsd(costingSheetId), 2).ToString(); tbxTotalCostCad.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandTotalCad(costingSheetId),2).ToString(); tbxTotalCostUsd.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandTotalUsd(costingSheetId),2).ToString(); hdfCostingSheetName.Value = projectCostingSheetInformationBasicInformationGateway.GetName(costingSheetId); hdfFromDate.Value = projectCostingSheetInformationBasicInformationGateway.GetStartDate(costingSheetId).ToString(); hdfToDate.Value = projectCostingSheetInformationBasicInformationGateway.GetEndDate(costingSheetId).ToString(); GetOtherTotals(); // Validate grid columns int projectId = Int32.Parse(hdfProjectId.Value); ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); if (projectGateway.GetCountryID(projectId) == 1) //Canada { tbxGrandTotal.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandTotalCad(costingSheetId), 2).ToString(); } else { tbxGrandTotal.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandTotalUsd(costingSheetId), 2).ToString(); } tbxGrandRevenue.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandRevenue(costingSheetId), 2).ToString(); tbxRevenueTotal.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandRevenue(costingSheetId), 2).ToString(); tbxGrandProfit.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandProfit(costingSheetId), 2).ToString(); tbxGrandGrossMargin.Text = Math.Round(projectCostingSheetInformationBasicInformationGateway.GetGrandGrossMargin(costingSheetId), 2).ToString() + " %"; } }