/// <summary> /// Получение/формирование параметров отчёта, DataSource (список сущностей для таблицы), пути файла и заголовка /// </summary> /// <inheritdoc /> public void AdditionalInitializeComponent() { _reportFile = Common.GetReportFilePath(ReportFileName); // Путь к файлу отчёта // Запрос параметров отчёта в отдельном окне const bool isPeriod = false; const bool isMounthOrYeath = true; const bool isWarehouse = false; const bool isWorkGuild = false; const bool isDate = true; const bool isDatePeriod = false; const bool isMonthYear = false; const bool isProduct = true; const bool isCompany = false; const bool isTypeProduct = false; const bool isFormaPayment = false; const bool isAbroad = false; const string message = "Выберите период выборки и продукт"; var parametersWindow = new ReportParametersWindow(isPeriod, isMounthOrYeath, isWarehouse, isWorkGuild, isDate, isDatePeriod, isMonthYear, isProduct, isCompany, isTypeProduct, isFormaPayment, isAbroad, message) { Owner = Common.GetOwnerWindow() }; parametersWindow.ShowDialog(); if (!parametersWindow.DialogResult.HasValue || parametersWindow.DialogResult != true) { return; } // Получение введённых пользователем параметров var monthOrYear = parametersWindow.SelectedMonthOrYear(); var nullableLoadDateTime = parametersWindow.SelectedDateTime(); if (nullableLoadDateTime == null) { const string errorMessage = "Дата не указана"; const MessageBoxButton buttons = MessageBoxButton.OK; const MessageBoxImage messageType = MessageBoxImage.Error; MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType); return; } var loadDateTime = (DateTime)nullableLoadDateTime; var product = parametersWindow.SelectedProduct(); // Формирование одиночных строковых параметров отчёта _reportParameters = new[] { new ReportParameter("Date", loadDateTime.ToShortDateString()) }; try { var resultReportList = ShipmentByProductService.GetShipmentByProduct(monthOrYear, loadDateTime, product); const string dataSourceName = "ShipmentByProduct"; _reportDataSource = new ReportDataSource(dataSourceName, resultReportList); ReportViewer.Load += ReportViewer_Load; // Подписка на метод загрузки и отображения отчёта } catch (StorageException ex) { Common.ShowDetailExceptionMessage(ex); } }
/// <summary> /// Получение/формирование параметров отчёта, DataSource (список сущностей для таблицы), пути файла и заголовка /// </summary> /// <inheritdoc /> public void AdditionalInitializeComponent() { _reportFile = Common.GetReportFilePath(ReportFileName); // Путь к файлу отчёта // Запрос параметров отчёта в отдельном окне const bool isPeriod = false; const bool isMounthOrYeath = false; const bool isDate = false; const bool isDatePeriod = false; const bool isKoefT = false; const bool isKoefZ = false; const bool isWorkGuild = false; const bool isArea = false; const bool isWorkGuildSpecifiedOrAll = true; const bool isProduct = true; const bool isDetail = false; const bool isProductSpecifiedOrAll = false; const bool isAssemblyUnit = false; const bool isMonthYear = false; const bool isTimeFund = false; const bool isProcentageOfLossTime = false; const bool isProcentageOfPerformanceStandarts = false; const bool isAreaSpecifiedOrAll = false; const string message = "Укажите цех и изделие"; var parametersWindow = new ReportParametersWindow(isPeriod, isMounthOrYeath, isDate, isDatePeriod, isKoefT, isKoefZ, isWorkGuild, isArea, isWorkGuildSpecifiedOrAll, isProduct, isDetail, isProductSpecifiedOrAll, isAssemblyUnit, isMonthYear, isTimeFund, isProcentageOfLossTime, isProcentageOfPerformanceStandarts, isAreaSpecifiedOrAll, message) { Owner = Common.GetOwnerWindow() }; parametersWindow.ShowDialog(); if (!parametersWindow.DialogResult.HasValue || parametersWindow.DialogResult != true) { return; } // Получение введённых пользователем параметров var loadDateTime = DateTime.Today; var nullableProduct = parametersWindow.SelectedProduct(); if (nullableProduct == null) { const string errorMessage = "Не указан код изделия"; const MessageBoxButton buttons = MessageBoxButton.OK; const MessageBoxImage messageType = MessageBoxImage.Error; MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType); return; } var product = nullableProduct; var workGuild = parametersWindow.SelectedWorkGuildOrAll(); // Формирование одиночных строковых параметров отчёта _reportParameters = new[] { new ReportParameter("Date", loadDateTime.ToShortDateString()), new ReportParameter("WorkGuild", workGuild != null ? "цех " + workGuild.Id.ToString(CultureInfo.InvariantCulture) : "по всему заводу") }; try { var resultReportList = PrintingOfProsuctInContextOfDetalOperationsService.GetPrintingOfProsuctInContextOfDetalOperations(product.Id, workGuild); const string dataSourceName = "PrintingOfProductInContextOfDetalOperations"; _reportDataSource = new ReportDataSource(dataSourceName, resultReportList); ReportViewer.Load += ReportViewer_Load; // Подписка на метод загрузки и отображения отчёта } catch (StorageException ex) { Common.ShowDetailExceptionMessage(ex); } }
/// <summary> /// Получение/формирование параметров отчёта, DataSource (список сущностей для таблицы), пути файла и заголовка /// </summary> /// <inheritdoc /> public void AdditionalInitializeComponent() { _reportFile = Common.GetReportFilePath(ReportFileName); // Путь к файлу отчёта // Запрос параметров отчёта в отдельном окне const bool isPeriod = false; const bool isMounthOrYeath = false; const bool isDate = false; const bool isDatePeriod = false; const bool isKoefT = true; const bool isKoefZ = true; const bool isWorkGuild = false; const bool isArea = false; const bool isWorkGuildSpecifiedOrAll = false; const bool isProduct = true; const bool isDetail = false; const bool isProductSpecifiedOrAll = false; const bool isAssemblyUnit = false; const bool isMonthYear = false; const bool isTimeFund = false; const bool isProcentageOfLossTime = false; const bool isProcentageOfPerformanceStandarts = false; const bool isAreaSpecifiedOrAll = false; const string message = "Выберите изделие и введите коэффициенты"; var parametersWindow = new ReportParametersWindow(isPeriod, isMounthOrYeath, isDate, isDatePeriod, isKoefT, isKoefZ, isWorkGuild, isArea, isWorkGuildSpecifiedOrAll, isProduct, isDetail, isProductSpecifiedOrAll, isAssemblyUnit, isMonthYear, isTimeFund, isProcentageOfLossTime, isProcentageOfPerformanceStandarts, isAreaSpecifiedOrAll, message) { Owner = Common.GetOwnerWindow() }; parametersWindow.ShowDialog(); if (!parametersWindow.DialogResult.HasValue || parametersWindow.DialogResult != true) { return; } var loadDateTime = DateTime.Today; var nullableKoeft = parametersWindow.KoefTDecimalUpDown.Value; var nullableKoefz = parametersWindow.KoefZDecimalUpDown.Value; if (nullableKoeft == null || nullableKoefz == null) { const string errorMessage = "Не указаны коэффициенты"; const MessageBoxButton buttons = MessageBoxButton.OK; const MessageBoxImage messageType = MessageBoxImage.Error; MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType); return; } var koefT = nullableKoeft; var koefZ = nullableKoefz; var nullableProduct = parametersWindow.SelectedProduct(); if (nullableProduct == null) { const string errorMessage = "Не указано изделие"; const MessageBoxButton buttons = MessageBoxButton.OK; const MessageBoxImage messageType = MessageBoxImage.Error; MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType); return; } var product = nullableProduct; // Формирование одиночных строковых параметров отчёта _reportParameters = new[] { new ReportParameter("Date", loadDateTime.ToShortDateString()), new ReportParameter("Koeft", koefT.ToString()), new ReportParameter("Koefz", koefZ.ToString()), new ReportParameter("ProductId", product.Id.ToString(CultureInfo.InvariantCulture)) }; try { var resultReportList = SummeryOfProductInContextOfProfessionAndOfDischargeService.GetSummeryOfProductInContextOfProfessionAndOfDischarge(product.Id); const string dataSourceName = "SummeryOfProductInContextOfProfessionAndOfDischarge"; _reportDataSource = new ReportDataSource(dataSourceName, resultReportList); ReportViewer.Load += ReportViewer_Load; // Подписка на метод загрузки и отображения отчёта } catch (StorageException ex) { Common.ShowDetailExceptionMessage(ex); } }
/// <summary> /// Получение/формирование параметров отчёта, DataSource (список сущностей для таблицы), пути файла и заголовка /// </summary> /// <inheritdoc /> public void AdditionalInitializeComponent() { _reportFile = Common.GetReportFilePath(ReportFileName); // Путь к файлу отчёта // Запрос параметров отчёта в отдельном окне const bool isPeriod = false; const bool isMounthOrYeath = false; const bool isDate = false; const bool isDatePeriod = false; const bool isKoefT = true; const bool isKoefZ = true; const bool isWorkGuild = false; const bool isArea = false; const bool isWorkGuildSpecifiedOrAll = true; const bool isProduct = false; const bool isDetail = false; const bool isProductSpecifiedOrAll = false; const bool isAssemblyUnit = true; const bool isMonthYear = false; const bool isTimeFund = false; const bool isProcentageOfLossTime = false; const bool isProcentageOfPerformanceStandarts = false; const bool isAreaSpecifiedOrAll = false; const string message = "Укажите цех, сбор.ед. и коэффициенты"; var parametersWindow = new ReportParametersWindow(isPeriod, isMounthOrYeath, isDate, isDatePeriod, isKoefT, isKoefZ, isWorkGuild, isArea, isWorkGuildSpecifiedOrAll, isProduct, isDetail, isProductSpecifiedOrAll, isAssemblyUnit, isMonthYear, isTimeFund, isProcentageOfLossTime, isProcentageOfPerformanceStandarts, isAreaSpecifiedOrAll, message) { Owner = Common.GetOwnerWindow() }; parametersWindow.ShowDialog(); if (!parametersWindow.DialogResult.HasValue || parametersWindow.DialogResult != true) { return; } // Получение введённых пользователем параметров var nullableKoeft = parametersWindow.KoefTDecimalUpDown.Value; var nullableKoefz = parametersWindow.KoefZDecimalUpDown.Value; if (nullableKoeft == null || nullableKoefz == null) { const string errorMessage = "Не указаны коэффициенты"; const MessageBoxButton buttons = MessageBoxButton.OK; const MessageBoxImage messageType = MessageBoxImage.Error; MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType); return; } var koefT = (decimal)nullableKoeft; var koefZ = (decimal)nullableKoefz; var workGuild = parametersWindow.SelectedWorkGuildOrAll(); var product = parametersWindow.SelectedProduct(); if (product == null) { const string errorMessage = "Не указано изделие"; const MessageBoxButton buttons = MessageBoxButton.OK; const MessageBoxImage messageType = MessageBoxImage.Error; MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType); return; } // Формирование одиночных строковых параметров отчёта _reportParameters = new[] { new ReportParameter("Koef", koefZ.ToString(CultureInfo.InvariantCulture)), new ReportParameter("Koef_t", koefT.ToString(CultureInfo.InvariantCulture)), new ReportParameter("ProductName", product.Name), new ReportParameter("ProductMark", product.Mark), new ReportParameter("ProductCode", product.Id.ToString(CultureInfo.InvariantCulture)) }; try { var resultReportList = workGuild != null ? ComplexityAndSalaryOnUnitByWorkGuildsService.GetPrintingOfProsuctInContextOfDetails( product.Id, workGuild) : ComplexityAndSalaryOnUnitByWorkGuildsService.GetPrintingOfProsuctInContextOfDetailsAll( product.Id); //var resultReportList = ComplexityAndSalaryOnUnitByWorkGuildsService.GetPrintingOfProsuctInContextOfDetails( // product.Id, workGuild); Разбивает по цеху и участку если по всему заводу выбрано const string dataSourceName = "ComplexityAndSalaryOnUnitByWorkGuild"; _reportDataSource = new ReportDataSource(dataSourceName, resultReportList); ReportViewer.Load += ReportViewer_Load; // Подписка на метод загрузки и отображения отчёта } catch (StorageException ex) { Common.ShowDetailExceptionMessage(ex); } }