Пример #1
0
 private void ViewQuotation_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var qt = new QuotationReport(viewModel);
         qt.Owner = MainWindow.mainWindow;
         qt.ShowDialog();
     }
     catch { }
 }
        /// <summary>
        /// Construye el reporte con los objetos proporcionados
        /// </summary>
        /// <param name="header">Encabezado del reporte</param>
        /// <param name="entitle">Datos personales del cliente</param>
        /// <param name="items">Detalle la cotización</param>
        /// <returns>Objeto con el reporte de cotización</returns>
        private QuotationReport BuildReport(Header header, Entitle entitle, List <ItemsQuotation> items)
        {
            QuotationReport report = new QuotationReport();

            report.Subreports[1].SetDataSource(BuildHeader(header));
            report.Subreports[0].SetDataSource(BuildEntitle(entitle));
            report.Subreports[2].SetDataSource(items);

            return(report);
        }
Пример #3
0
        public async Task <List <QuotationReport> > GetQuotationReport(QuotationReportParams queryParams)
        {
            var vendorRepository = this.UnitOfWork.GetRepository <Vendor>();
            var availableVendors = await vendorRepository.GetQueryable()
                                   .Include(v => v.Zones)
                                   .Where(v => !v.IsStopped && v.Zones != null && v.Zones.Any())
                                   .ToListAsync();

            var vendorHasQuotations =
                availableVendors.Where(v =>
                                       v.VendorQuotations != null && v.VendorQuotations.Any() &&
                                       v.Zones.Any(z => z.Countries.Contains(queryParams.DestinationCountry))).ToList();

            var increasePercent = await this.GetIncreasePercent(queryParams);

            var result = new List <QuotationReport>();

            foreach (var vendor in vendorHasQuotations)
            {
                var report = new QuotationReport
                {
                    VendorName        = vendor.Name,
                    OtherFeeInUsd     = vendor.OtherFeeInUsd,
                    FuelChargePercent = vendor.FuelChargePercent,
                };

                var reportDetail   = new List <QuotationReportDetail>();
                var zonesByCountry = vendor.Zones.Where(z => z.Countries.Contains(queryParams.DestinationCountry))
                                     .ToList();
                foreach (var zone in zonesByCountry)
                {
                    var zoneSplit = this.SplitZoneName(zone.Name);

                    var countingParams = new PurchasePriceCountingParams
                    {
                        Vat                = queryParams.Vat,
                        UsdExchangeRate    = queryParams.UsdExchangeRate,
                        WeightInKg         = queryParams.WeightInKg,
                        DestinationCountry = queryParams.DestinationCountry,
                        FuelChargePercent  = vendor.FuelChargePercent ?? 0,
                        OtherFeeInUsd      = vendor.OtherFeeInUsd ?? 0
                    };
                    var price = this.billService.CountVendorNetPriceInUsd(vendor, countingParams, zone,
                                                                          increasePercent);
                    if (price.PurchasePriceInUsd > 0)
                    {
                        reportDetail.Add(new QuotationReportDetail
                        {
                            Service                    = zoneSplit.serviceName,
                            Zone                       = zoneSplit.zoneName,
                            PurchasePriceInUsd         = price.PurchasePriceInUsd,
                            PurchasePriceInVnd         = price.PurchasePriceInVnd,
                            PurchasePriceAfterVatInUsd = price.PurchasePriceAfterVatInUsd,
                            PurchasePriceAfterVatInVnd = price.PurchasePriceAfterVatInVnd,
                            QuotationPriceInUsd        = price.QuotationPriceInUsd,
                            VendorNetPriceInUsd        = price.VendorNetPriceInUsd
                        });
                    }
                }

                if (reportDetail.Any())
                {
                    report.Quotation.AddRange(reportDetail.OrderBy(rd => rd.PurchasePriceAfterVatInVnd));
                }

                if (report.Quotation.Any())
                {
                    result.Add(report);
                }
            }

            return(result.OrderBy(r => r.Quotation, new QuotationReportComparer()).ToList());
        }
Пример #4
0
 public List <QuotationReport> GetQuotationReport(QuotationReport quotationReport)
 {
     return(_reportRepository.GetQuotationReport(quotationReport));
 }