コード例 #1
0
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            var selectedServiceType = (ServiceType)serviceTypeComboBox.SelectedValue;

            var serviceItems = DBContext.ServiceItem
                               .Where(si =>
                                      si.ServiceItemGroup.ServiceType == selectedServiceType &&
                                      si.Active &&
                                      si.ServiceItemGroup.Active
                                      )
                               .Select(si =>
                                       new ServiceItemWithServiceItemGroupDTO()
            {
                Id                    = si.Id,
                Name                  = si.Name,
                Order                 = si.Order,
                HasRemarks            = si.HasRemarks,
                ServiceItemGroupId    = si.ServiceItemGroup.Id,
                ServiceItemGroupName  = si.ServiceItemGroup.Name,
                ServiceItemGroupOrder = si.ServiceItemGroup.Order
            }
                                       )
                               .ToList();

            var serviceFormReport = new List <CarServiceFormReportDTO>()
            {
                new CarServiceFormReportDTO()
                {
                    WorkOrderNumber             = WorkOrder.Number,
                    VehicleIdentificationNumber = WorkOrder.Vehicle.IdentificationNumber,
                    VehicleType               = WorkOrder.Vehicle.Type,
                    VehicleTypeCode           = WorkOrder.Vehicle.TypeCode,
                    VehicleMKBCode            = WorkOrder.Vehicle.MKBCode,
                    VehicleGKBCode            = WorkOrder.Vehicle.GKBCode,
                    VehicleRegistrationNumber = WorkOrder.Vehicle.RegistrationNumber,
                    VehicleMileage            = WorkOrder.Vehicle.Mileage.ToString(),
                    VehicleRegistrationDate   = WorkOrder.Vehicle.RegistrationDate,
                    VehicleModelYear          = WorkOrder.Vehicle.ModelYear.ToString(),
                    ServiceType               = WorkOrder.Service.ServiceType.Name
                }
            };

            var datasources = new List <ReportDataSource>()
            {
                new ReportDataSource("HeaderDataSet", serviceFormReport),
                new ReportDataSource("BodyDataSet", serviceItems)
            };

            var form = new ReportViewerForm();

            form.SetReport(
                "CarServiceForms.Reports.CarServiceFormReport.rdlc",
                datasources
                );
            form.ShowDialog();
        }
コード例 #2
0
        private void PrintService()
        {
            var selectedServiceTypeId = (long)serviceTypeComboBox.SelectedValue;

            var serviceItems = rightListView.Items.OfType <ListViewItem>()
                               .Select(si => si.Tag as ServiceItemWithServiceItemGroupDTO)
                               .ToList();

            var serviceFormReport = new List <CarServiceFormReportDTO>()
            {
                new CarServiceFormReportDTO()
                {
                    WorkOrderNumber             = WorkOrder.Number,
                    VehicleIdentificationNumber = WorkOrder.Vehicle.IdentificationNumber,
                    VehicleType               = WorkOrder.Vehicle.Type,
                    VehicleTypeCode           = WorkOrder.Vehicle.TypeCode,
                    VehicleMKBCode            = WorkOrder.Vehicle.MKBCode,
                    VehicleGKBCode            = WorkOrder.Vehicle.GKBCode,
                    VehicleRegistrationNumber = WorkOrder.Vehicle.RegistrationNumber,
                    VehicleMileage            = WorkOrder.Vehicle.Mileage.ToString(),
                    VehicleRegistrationDate   = WorkOrder.Vehicle.RegistrationDate,
                    VehicleModelYear          = WorkOrder.Vehicle.ModelYear.ToString(),
                    ServiceType               = WorkOrder.Service.ServiceType.Name
                }
            };

            var datasources = new List <ReportDataSource>()
            {
                new ReportDataSource("HeaderDataSet", serviceFormReport),
                new ReportDataSource("BodyDataSet", serviceItems)
            };

            var form = new ReportViewerForm();

            form.SetReport(
                "CarServiceForms.Reports.CarServiceFormReport.rdlc",
                datasources
                );
            form.ShowDialog();
        }
コード例 #3
0
        private void PrintInvoice()
        {
            var workOrder = DBContext.WorkOrder.Find(WorkOrder.Id);
            var invoice   = new InvoiceReportDTO()
            {
                InvoiceNumber   = workOrder.Invoice.Number,
                InvoiceCreated  = workOrder.Invoice.Created,
                InvoiceDeadline = workOrder.Invoice.Deadline,

                InvoiceCompanyName        = SettingsHelper.GetConfigValue <string>(SettingsFields.COMPANY_NAME),
                InvoiceCompanyAddress1    = SettingsHelper.GetConfigValue <string>(SettingsFields.COMPANY_ADDRESS_1),
                InvoiceCompanyAddress2    = SettingsHelper.GetConfigValue <string>(SettingsFields.COMPANY_ADDRESS_2),
                InvoiceCompanyBankAccount = SettingsHelper.GetConfigValue <string>(SettingsFields.COMPANY_BANK_ACCOUNT),
                InvoiceCompanyDirector    = SettingsHelper.GetConfigValue <string>(SettingsFields.COMPANY_DIRECTOR),

                WorkOrderNumber   = workOrder.Number,
                WorkOrderCreated  = workOrder.Created,
                WorkOrderDeadline = workOrder.Deadline,
                WorkOrderFinished = workOrder.Finished,

                CustomerFirstName = workOrder.Vehicle.Customer.FirstName,
                CustomerLastName  = workOrder.Vehicle.Customer.LastName,
                CustomerStreet    = workOrder.Vehicle.Customer.Street,
                CustomerPost      = workOrder.Vehicle.Customer.Post,

                VehicleRegistrationNumber   = workOrder.Vehicle.RegistrationNumber,
                VehicleEngine               = workOrder.Vehicle.Engine,
                VehicleGKBCode              = workOrder.Vehicle.GKBCode,
                VehicleIdentificationNumber = workOrder.Vehicle.IdentificationNumber,
                VehicleMileage              = workOrder.Vehicle.Mileage,
                VehicleMKBCode              = workOrder.Vehicle.MKBCode,
                VehicleModelYear            = workOrder.Vehicle.ModelYear,
                VehicleRegistrationDate     = workOrder.Vehicle.RegistrationDate,
                VehicleTransmission         = workOrder.Vehicle.Transmission,
                VehicleType     = workOrder.Vehicle.Type,
                VehicleTypeCode = workOrder.Vehicle.TypeCode
            };

            var invoiceItems = new List <InvoiceItemReportDTO>();

            foreach (var invoiceItem in InvoiceItems)
            {
                invoiceItems.Add(new InvoiceItemReportDTO()
                {
                    InvoiceItemDescription   = invoiceItem.Description,
                    InvoiceItemQuantity      = invoiceItem.Quantity,
                    InvoiceItemPrice         = invoiceItem.Price,
                    InvoiceItemSalePrice     = invoiceItem.SalePrice,
                    InvoiceItemDiscount      = invoiceItem.Discount,
                    InvoiceItemTaxPercentage = invoiceItem.TaxPercentage,
                    InvoiceItemTaxBase       = invoiceItem.TaxBase,
                    InvoiceItemFinalPrice    = invoiceItem.FinalPrice
                });
            }

            var datasources = new List <ReportDataSource>()
            {
                new ReportDataSource("InvoiceDataSet", new List <InvoiceReportDTO>()
                {
                    invoice
                }),
                new ReportDataSource("InvoiceItemsDataSet", invoiceItems)
            };

            var form = new ReportViewerForm();

            form.SetReport(
                "CarServiceForms.Reports.InvoiceReport.rdlc",
                datasources
                );
            form.ShowDialog();
        }