예제 #1
0
 /// <summary>
 /// 转换成枚举
 /// </summary>
 public static int ShippingStatusToValue(ShippingStatusEnum enumOption)
 {
     try{
         return((int)enumOption);
     }catch (Exception ex) {
         throw new ArgumentException("enumOption", ex);
     }
 }
        /// <summary>
        /// Get shipping status name
        /// </summary>
        /// <param name="ss">Shipping status</param>
        /// <returns>Shipping status name</returns>
        public static string GetShippingStatusName(this ShippingStatusEnum ss)
        {
            string name = IoC.Resolve <ILocalizationManager>().GetLocaleResourceString(
                string.Format("ShippingStatus.{0}", ss.ToString()),
                NopContext.Current.WorkingLanguage.LanguageId,
                true,
                CommonHelper.ConvertEnum(ss.ToString()));

            return(name);
        }
예제 #3
0
		/// <summary>
		/// Updates the order
		/// </summary>
		/// <param name="OrderID">he order identifier</param>
		/// <param name="OrderGUID">The order identifier</param>
		/// <param name="CustomerID">The customer identifier</param>
		/// <param name="CustomerLanguageID">The customer language identifier</param>
		/// <param name="CustomerTaxDisplayType">The customer tax display type</param>
		/// <param name="OrderSubtotalInclTax">The order subtotal (incl tax)</param>
		/// <param name="OrderSubtotalExclTax">The order subtotal (excl tax)</param>
		/// <param name="OrderShippingInclTax">The order shipping (incl tax)</param>
		/// <param name="OrderShippingExclTax">The order shipping (excl tax)</param>
		/// <param name="PaymentMethodAdditionalFeeInclTax">The payment method additional fee (incl tax)</param>
		/// <param name="PaymentMethodAdditionalFeeExclTax">The payment method additional fee (excl tax)</param>
		/// <param name="OrderTax">The order tax</param>
		/// <param name="OrderTotal">The order total</param>
		/// <param name="OrderDiscount">The order discount</param>
		/// <param name="OrderSubtotalInclTaxInCustomerCurrency">The order subtotal incl tax (customer currency)</param>
		/// <param name="OrderSubtotalExclTaxInCustomerCurrency">The order subtotal excl tax (customer currency)</param>
		/// <param name="OrderShippingInclTaxInCustomerCurrency">The order shipping incl tax (customer currency)</param>
		/// <param name="OrderShippingExclTaxInCustomerCurrency">The order shipping excl tax (customer currency)</param>
		/// <param name="PaymentMethodAdditionalFeeInclTaxInCustomerCurrency">The payment method additional fee incl tax (customer currency)</param>
		/// <param name="PaymentMethodAdditionalFeeExclTaxInCustomerCurrency">The payment method additional fee excl tax (customer currency)</param>
		/// <param name="OrderTaxInCustomerCurrency">The order tax (customer currency)</param>
		/// <param name="OrderTotalInCustomerCurrency">The order total (customer currency)</param>
		/// <param name="CustomerCurrencyCode">The customer currency code</param>
		/// <param name="OrderWeight">The order weight</param>
		/// <param name="AffiliateID">The affiliate identifier</param>
		/// <param name="OrderStatus">The order status</param>
		/// <param name="AllowStoringCreditCardNumber">The value indicating whether storing of credit card number is allowed</param>
		/// <param name="CardType">The card type</param>
		/// <param name="CardName">The card name</param>
		/// <param name="CardNumber">The card number</param>
		/// <param name="MaskedCreditCardNumber">The masked credit card number</param>
		/// <param name="CardCVV2">The card CVV2</param>
		/// <param name="CardExpirationMonth">The card expiration month</param>
		/// <param name="CardExpirationYear">The card expiration year</param>
		/// <param name="PaymentMethodID">The payment method identifier</param>
		/// <param name="PaymentMethodName">The payment method name</param>
		/// <param name="AuthorizationTransactionID">The authorization transaction ID</param>
		/// <param name="AuthorizationTransactionCode">The authorization transaction code</param>
		/// <param name="AuthorizationTransactionResult">The authorization transaction result</param>
		/// <param name="CaptureTransactionID">The capture transaction ID</param>
		/// <param name="CaptureTransactionResult">The capture transaction result</param>
		/// <param name="PurchaseOrderNumber">The purchase order number</param>
		/// <param name="PaymentStatus">The payment status</param>
		/// <param name="BillingFirstName">The billing first name</param>
		/// <param name="BillingLastName">The billing last name</param>
		/// <param name="BillingPhoneNumber">he billing phone number</param>
		/// <param name="BillingEmail">The billing email</param>
		/// <param name="BillingFaxNumber">The billing fax number</param>
		/// <param name="BillingCompany">The billing company</param>
		/// <param name="BillingAddress1">The billing address 1</param>
		/// <param name="BillingAddress2">The billing address 2</param>
		/// <param name="BillingCity">The billing city</param>
		/// <param name="BillingStateProvince">The billing state/province</param>
		/// <param name="BillingStateProvinceID">The billing state/province identifier</param>
		/// <param name="BillingZipPostalCode">The billing zip/postal code</param>
		/// <param name="BillingCountry">The billing country</param>
		/// <param name="BillingCountryID">The billing country identifier</param>
		/// <param name="ShippingStatus">The shipping status</param>
		/// <param name="ShippingFirstName">The shipping first name</param>
		/// <param name="ShippingLastName">The shipping last name</param>
		/// <param name="ShippingPhoneNumber">The shipping phone number</param>
		/// <param name="ShippingEmail">The shipping email</param>
		/// <param name="ShippingFaxNumber">The shipping fax number</param>
		/// <param name="ShippingCompany">The shipping  company</param>
		/// <param name="ShippingAddress1">The shipping address 1</param>
		/// <param name="ShippingAddress2">The shipping address 2</param>
		/// <param name="ShippingCity">The shipping city</param>
		/// <param name="ShippingStateProvince">The shipping state/province</param>
		/// <param name="ShippingStateProvinceID">The shipping state/province identifier</param>
		/// <param name="ShippingZipPostalCode">The shipping zip/postal code</param>
		/// <param name="ShippingCountry">The shipping country</param>
		/// <param name="ShippingCountryID">The shipping country identifier</param>
		/// <param name="ShippingMethod">The shipping method</param>
		/// <param name="ShippingRateComputationMethodID">The shipping rate computation method identifier</param>
		/// <param name="ShippedDate">The shipped date and time</param>
		/// <param name="Deleted">A value indicating whether the entity has been deleted</param>
		/// <param name="CreatedOn">The date and time of order creation</param>
		/// <returns>Order</returns>
		public static Order UpdateOrder(int OrderID, Guid OrderGUID, int CustomerID, int CustomerLanguageID,
			TaxDisplayTypeEnum CustomerTaxDisplayType, decimal OrderSubtotalInclTax, decimal OrderSubtotalExclTax,
			decimal OrderShippingInclTax, decimal OrderShippingExclTax,
			decimal PaymentMethodAdditionalFeeInclTax, decimal PaymentMethodAdditionalFeeExclTax,
			decimal OrderTax, decimal OrderTotal, decimal OrderDiscount,
			decimal OrderSubtotalInclTaxInCustomerCurrency, decimal OrderSubtotalExclTaxInCustomerCurrency,
			decimal OrderShippingInclTaxInCustomerCurrency, decimal OrderShippingExclTaxInCustomerCurrency,
			decimal PaymentMethodAdditionalFeeInclTaxInCustomerCurrency, decimal PaymentMethodAdditionalFeeExclTaxInCustomerCurrency,
			decimal OrderTaxInCustomerCurrency, decimal OrderTotalInCustomerCurrency,
			string CustomerCurrencyCode, decimal OrderWeight,
			int AffiliateID, OrderStatusEnum OrderStatus, bool AllowStoringCreditCardNumber,
			string CardType, string CardName, string CardNumber, string MaskedCreditCardNumber, string CardCVV2,
			string CardExpirationMonth, string CardExpirationYear, int PaymentMethodID,
			string PaymentMethodName, string AuthorizationTransactionID, string AuthorizationTransactionCode,
			string AuthorizationTransactionResult, string CaptureTransactionID, string CaptureTransactionResult,
			string PurchaseOrderNumber, PaymentStatusEnum PaymentStatus, string BillingFirstName, string BillingLastName,
			string BillingPhoneNumber, string BillingEmail, string BillingFaxNumber, string BillingCompany,
			string BillingAddress1, string BillingAddress2, string BillingCity, string BillingStateProvince,
			int BillingStateProvinceID, string BillingZipPostalCode, string BillingCountry,
			int BillingCountryID, ShippingStatusEnum ShippingStatus, string ShippingFirstName,
			string ShippingLastName, string ShippingPhoneNumber, string ShippingEmail,
			string ShippingFaxNumber, string ShippingCompany, string ShippingAddress1,
			string ShippingAddress2, string ShippingCity, string ShippingStateProvince,
			int ShippingStateProvinceID, string ShippingZipPostalCode,
			string ShippingCountry, int ShippingCountryID, string ShippingMethod, int ShippingRateComputationMethodID, DateTime? ShippedDate,
			bool Deleted, DateTime CreatedOn)
		{
			if (ShippedDate.HasValue)
				ShippedDate = DateTimeHelper.ConvertToUtcTime(ShippedDate.Value);
			CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn);

			DBOrder dbItem = DBProviderManager<DBOrderProvider>.Provider.UpdateOrder(OrderID, OrderGUID, CustomerID, CustomerLanguageID,
				(int)CustomerTaxDisplayType, OrderSubtotalInclTax, OrderSubtotalExclTax,
				OrderShippingInclTax, OrderShippingExclTax,
				PaymentMethodAdditionalFeeInclTax, PaymentMethodAdditionalFeeExclTax,
				OrderTax, OrderTotal, OrderDiscount,
				OrderSubtotalInclTaxInCustomerCurrency, OrderSubtotalExclTaxInCustomerCurrency,
				OrderShippingInclTaxInCustomerCurrency, OrderShippingExclTaxInCustomerCurrency,
				PaymentMethodAdditionalFeeInclTaxInCustomerCurrency, PaymentMethodAdditionalFeeExclTaxInCustomerCurrency,
				OrderTaxInCustomerCurrency, OrderTotalInCustomerCurrency, CustomerCurrencyCode, OrderWeight,
				AffiliateID, (int)OrderStatus, AllowStoringCreditCardNumber,
				CardType, CardName, CardNumber, MaskedCreditCardNumber, CardCVV2,
				CardExpirationMonth, CardExpirationYear, PaymentMethodID,
				PaymentMethodName, AuthorizationTransactionID, AuthorizationTransactionCode,
				AuthorizationTransactionResult, CaptureTransactionID, CaptureTransactionResult, PurchaseOrderNumber,
				(int)PaymentStatus, BillingFirstName, BillingLastName,
				BillingPhoneNumber, BillingEmail, BillingFaxNumber, BillingCompany,
				BillingAddress1, BillingAddress2, BillingCity, BillingStateProvince, BillingStateProvinceID,
				BillingZipPostalCode, BillingCountry, BillingCountryID, (int)ShippingStatus, ShippingFirstName, ShippingLastName,
				ShippingPhoneNumber, ShippingEmail,
				ShippingFaxNumber, ShippingCompany, ShippingAddress1,
				ShippingAddress2, ShippingCity, ShippingStateProvince, ShippingStateProvinceID, ShippingZipPostalCode,
				ShippingCountry, ShippingCountryID, ShippingMethod, ShippingRateComputationMethodID, ShippedDate,
				Deleted, CreatedOn);

			Order order = DBMapping(dbItem);
			return order;
		}
예제 #4
0
		/// <summary>
		/// Search orders
		/// </summary>
		/// <param name="StartTime">Order start time; null to load all orders</param>
		/// <param name="EndTime">Order end time; null to load all orders</param>
		/// <param name="CustomerEmail">Customer email</param>
		/// <param name="OS">Order status; null to load all orders</param>
		/// <param name="PS">Order payment status; null to load all orders</param>
		/// <param name="SS">Order shippment status; null to load all orders</param>
		/// <returns>Order collection</returns>
		public static OrderCollection SearchOrders(DateTime? StartTime, DateTime? EndTime, string CustomerEmail, OrderStatusEnum? OS, PaymentStatusEnum? PS, ShippingStatusEnum? SS)
		{
			int? orderStatusID = null;
			if (OS.HasValue)
				orderStatusID = (int)OS.Value;

			int? paymentStatusID = null;
			if (PS.HasValue)
				paymentStatusID = (int)PS.Value;

			int? shippingStatusID = null;
			if (SS.HasValue)
				shippingStatusID = (int)SS.Value;

			DBOrderCollection dbCollection = DBProviderManager<DBOrderProvider>.Provider.SearchOrders(StartTime, EndTime, CustomerEmail, orderStatusID, paymentStatusID, shippingStatusID);
			OrderCollection orders = DBMapping(dbCollection);
			return orders;
		}
예제 #5
0
		/// <summary>
		/// Gets an order report
		/// </summary>
		/// <param name="OS">Order status; null to load all orders</param>
		/// <param name="PS">Order payment status; null to load all orders</param>
		/// <param name="SS">Order shippment status; null to load all orders</param>
		/// <returns>IDataReader</returns>
		public static IDataReader GetOrderReport(OrderStatusEnum? OS, PaymentStatusEnum? PS, ShippingStatusEnum? SS)
		{
			int? orderStatusID = null;
			if (OS.HasValue)
				orderStatusID = (int)OS.Value;

			int? paymentStatusID = null;
			if (PS.HasValue)
				paymentStatusID = (int)PS.Value;

			int? shippmentStatusID = null;
			if (SS.HasValue)
				shippmentStatusID = (int)SS.Value;

			return DBProviderManager<DBOrderProvider>.Provider.GetOrderReport(orderStatusID, paymentStatusID, shippmentStatusID);
		}
예제 #6
0
        /// <summary>
        /// Search orders
        /// </summary>
        /// <param name="startTime">Order start time; null to load all orders</param>
        /// <param name="endTime">Order end time; null to load all orders</param>
        /// <param name="customerEmail">Customer email</param>
        /// <param name="os">Order status; null to load all orders</param>
        /// <param name="ps">Order payment status; null to load all orders</param>
        /// <param name="ss">Order shippment status; null to load all orders</param>
        /// <param name="orderGuid">Search by order GUID (Global unique identifier) or part of GUID. Leave empty to load all orders.</param>
        /// <returns>Order collection</returns>
        public List<Order> SearchOrders(DateTime? startTime, DateTime? endTime,
            string customerEmail, OrderStatusEnum? os, PaymentStatusEnum? ps,
            ShippingStatusEnum? ss, string orderGuid)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            var query = from o in _context.Orders
                        join c in _context.Customers on o.CustomerId equals c.CustomerId
                        where (String.IsNullOrEmpty(customerEmail) || c.Email.Contains(customerEmail)) &&
                        (!startTime.HasValue || startTime.Value <= o.CreatedOn) &&
                        (!endTime.HasValue || endTime.Value >= o.CreatedOn) &&
                        (!orderStatusId.HasValue || orderStatusId == o.OrderStatusId) &&
                        (!paymentStatusId.HasValue || paymentStatusId.Value == o.PaymentStatusId) &&
                        (!shippingStatusId.HasValue || shippingStatusId.Value == o.ShippingStatusId) &&
                        !o.Deleted
                        orderby o.CreatedOn descending
                        select o;

            var orders = query.ToList();

            //filter by GUID. Filter in BLL because EF doesn't support casting of GUID to string
            if (!String.IsNullOrEmpty(orderGuid))
            {
                orders = orders.FindAll(o => o.OrderGuid.ToString().ToLowerInvariant().Contains(orderGuid.ToLowerInvariant()));
            }

            return orders;
        }
예제 #7
0
 /// <summary>
 /// Search orders
 /// </summary>
 /// <param name="startTime">Order start time; null to load all orders</param>
 /// <param name="endTime">Order end time; null to load all orders</param>
 /// <param name="customerEmail">Customer email</param>
 /// <param name="os">Order status; null to load all orders</param>
 /// <param name="ps">Order payment status; null to load all orders</param>
 /// <param name="ss">Order shippment status; null to load all orders</param>
 /// <returns>Order collection</returns>
 public List<Order> SearchOrders(DateTime? startTime, DateTime? endTime,
     string customerEmail, OrderStatusEnum? os, PaymentStatusEnum? ps, 
     ShippingStatusEnum? ss)
 {
     return SearchOrders(startTime, endTime,
      customerEmail, os, ps, ss, string.Empty);
 }
예제 #8
0
        /// <summary>
        /// Gets an order report
        /// </summary>
        /// <param name="os">Order status; null to load all orders</param>
        /// <param name="ps">Order payment status; null to load all orders</param>
        /// <param name="ss">Order shippment status; null to load all orders</param>
        /// <returns>IdataReader</returns>
        public OrderIncompleteReportLine GetOrderReport(OrderStatusEnum? os,
            PaymentStatusEnum? ps, ShippingStatusEnum? ss)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            var query = from o in _context.Orders
                        where (!o.Deleted) &&
                        (!orderStatusId.HasValue || orderStatusId.Value == 0 || o.OrderStatusId == orderStatusId.Value) &&
                        (!paymentStatusId.HasValue || paymentStatusId.Value == 0 || o.PaymentStatusId == paymentStatusId.Value) &&
                        (!shippingStatusId.HasValue || shippingStatusId.Value == 0 || o.ShippingStatusId == shippingStatusId.Value)
                        select o;

            var item = new OrderIncompleteReportLine();
            item.Total = Convert.ToDecimal(query.Sum(o => (decimal?)o.OrderTotal));
            item.Count = query.Count();
            return item;
        }
예제 #9
0
        /// <summary>
        /// Gets all order product variants
        /// </summary>
        /// <param name="orderId">Order identifier; null to load all records</param>
        /// <param name="customerId">Customer identifier; null to load all records</param>
        /// <param name="startTime">Order start time; null to load all records</param>
        /// <param name="endTime">Order end time; null to load all records</param>
        /// <param name="os">Order status; null to load all records</param>
        /// <param name="ps">Order payment status; null to load all records</param>
        /// <param name="ss">Order shippment status; null to load all records</param>
        /// <param name="loadDownloableProductsOnly">Value indicating whether to load downloadable products only</param>
        /// <returns>Order collection</returns>
        public List<OrderProductVariant> GetAllOrderProductVariants(int? orderId,
            int? customerId, DateTime? startTime, DateTime? endTime,
            OrderStatusEnum? os, PaymentStatusEnum? ps, ShippingStatusEnum? ss,
            bool loadDownloableProductsOnly)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            var query = from opv in _context.OrderProductVariants
                        join o in _context.Orders on opv.OrderId equals o.OrderId
                        join pv in _context.ProductVariants on opv.ProductVariantId equals pv.ProductVariantId
                        where (!orderId.HasValue || orderId.Value == 0 || orderId == o.OrderId) &&
                        (!customerId.HasValue || customerId.Value == 0 || customerId == o.CustomerId) &&
                        (!startTime.HasValue || startTime.Value <= o.CreatedOn) &&
                        (!endTime.HasValue || endTime.Value >= o.CreatedOn) &&
                        (!orderStatusId.HasValue || orderStatusId == o.OrderStatusId) &&
                        (!paymentStatusId.HasValue || paymentStatusId.Value == o.PaymentStatusId) &&
                        (!shippingStatusId.HasValue || shippingStatusId.Value == o.ShippingStatusId) &&
                        (!loadDownloableProductsOnly || pv.IsDownload) &&
                        !o.Deleted
                        orderby o.CreatedOn descending, opv.OrderProductVariantId
                        select opv;

            var orderProductVariants = query.ToList();
            return orderProductVariants;
        }
예제 #10
0
 /// <summary>
 /// Gets all order product variants
 /// </summary>
 /// <param name="orderId">Order identifier; null to load all records</param>
 /// <param name="customerId">Customer identifier; null to load all records</param>
 /// <param name="startTime">Order start time; null to load all records</param>
 /// <param name="endTime">Order end time; null to load all records</param>
 /// <param name="os">Order status; null to load all records</param>
 /// <param name="ps">Order payment status; null to load all records</param>
 /// <param name="ss">Order shippment status; null to load all records</param>
 /// <returns>Order collection</returns>
 public List<OrderProductVariant> GetAllOrderProductVariants(int? orderId,
     int? customerId, DateTime? startTime, DateTime? endTime,
     OrderStatusEnum? os, PaymentStatusEnum? ps, ShippingStatusEnum? ss)
 {
     return GetAllOrderProductVariants(orderId, customerId, startTime,
         endTime, os, ps, ss, false);
 }
예제 #11
0
        /// <summary>
        /// Gets all gift cards
        /// </summary>
        /// <param name="orderId">Order identifier; null to load all records</param>
        /// <param name="customerId">Customer identifier; null to load all records</param>
        /// <param name="startTime">Order start time; null to load all records</param>
        /// <param name="endTime">Order end time; null to load all records</param>
        /// <param name="os">Order status; null to load all records</param>
        /// <param name="ps">Order payment status; null to load all records</param>
        /// <param name="ss">Order shippment status; null to load all records</param>
        /// <param name="isGiftCardActivated">Value indicating whether gift card is activated; null to load all records</param>
        /// <param name="giftCardCouponCode">Gift card coupon code; null or string.empty to load all records</param>
        /// <returns>Gift cards</returns>
        public List<GiftCard> GetAllGiftCards(int? orderId,
            int? customerId, DateTime? startTime, DateTime? endTime,
            OrderStatusEnum? os, PaymentStatusEnum? ps, ShippingStatusEnum? ss,
            bool? isGiftCardActivated, string giftCardCouponCode)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            if (giftCardCouponCode != null)
                giftCardCouponCode = giftCardCouponCode.Trim();

            giftCardCouponCode = CommonHelper.EnsureNotNull(giftCardCouponCode);

            var gcQuery = from gc in _context.GiftCards
                          join opv in _context.OrderProductVariants on gc.PurchasedOrderProductVariantId equals opv.OrderProductVariantId
                          join o in _context.Orders on opv.OrderId equals o.OrderId
                          where
                          (!orderId.HasValue || orderId.Value == 0 || o.OrderId == orderId.Value) &&
                          (!customerId.HasValue || customerId.Value == 0 || o.CustomerId == customerId.Value) &&
                          (!startTime.HasValue || startTime.Value <= gc.CreatedOn) &&
                          (!endTime.HasValue || endTime.Value >= gc.CreatedOn) &&
                          (!orderStatusId.HasValue || orderStatusId.Value == 0 || o.OrderStatusId == orderStatusId.Value) &&
                          (!paymentStatusId.HasValue || paymentStatusId.Value == 0 || o.PaymentStatusId == paymentStatusId.Value) &&
                          (!shippingStatusId.HasValue || shippingStatusId.Value == 0 || o.ShippingStatusId == shippingStatusId.Value) &&
                          (!isGiftCardActivated.HasValue || gc.IsGiftCardActivated == isGiftCardActivated.Value) &&
                          (string.IsNullOrEmpty(giftCardCouponCode) || gc.GiftCardCouponCode == giftCardCouponCode)
                          select gc.GiftCardId;

            var query = from gc in _context.GiftCards
                        where gcQuery.Contains(gc.GiftCardId)
                        orderby gc.CreatedOn descending, gc.GiftCardId
                        select gc;

            var giftCards = query.ToList();
            return giftCards;
        }
        /// <summary>
        /// Get best customers
        /// </summary>
        /// <param name="startTime">Order start time; null to load all</param>
        /// <param name="endTime">Order end time; null to load all</param>
        /// <param name="os">Order status; null to load all records</param>
        /// <param name="ps">Order payment status; null to load all records</param>
        /// <param name="ss">Order shippment status; null to load all records</param>
        /// <param name="orderBy">1 - order by order total, 2 - order by number of orders</param>
        /// <returns>Report</returns>
        public List<CustomerBestReportLine> GetBestCustomersReport(DateTime? startTime,
            DateTime? endTime, OrderStatusEnum? os, PaymentStatusEnum? ps,
            ShippingStatusEnum? ss, int orderBy)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            var report = _context.Sp_CustomerBestReport(startTime, endTime,
                orderStatusId, paymentStatusId, shippingStatusId, orderBy).ToList();

            return report;
        }
예제 #13
0
        /// <summary>
        /// Updates the order
        /// </summary>
        /// <param name="orderId">The order identifier</param>
        /// <param name="orderGuid">The order identifier</param>
        /// <param name="customerId">The customer identifier</param>
        /// <param name="customerLanguageId">The customer language identifier</param>
        /// <param name="customerTaxDisplayType">The customer tax display type</param>
        /// <param name="customerIP">The customer IP address</param>
        /// <param name="orderSubtotalInclTax">The order subtotal (incl tax)</param>
        /// <param name="orderSubtotalExclTax">The order subtotal (excl tax)</param>
        /// <param name="orderShippingInclTax">The order shipping (incl tax)</param>
        /// <param name="orderShippingExclTax">The order shipping (excl tax)</param>
        /// <param name="paymentMethodAdditionalFeeInclTax">The payment method additional fee (incl tax)</param>
        /// <param name="paymentMethodAdditionalFeeExclTax">The payment method additional fee (excl tax)</param>
        /// <param name="taxRates">The tax rates</param>
        /// <param name="orderTax">The order tax</param>
        /// <param name="orderTotal">The order total</param>
        /// <param name="refundedAmount">The refunded amount</param>
        /// <param name="orderDiscount">The order discount</param>
        /// <param name="orderSubtotalInclTaxInCustomerCurrency">The order subtotal incl tax (customer currency)</param>
        /// <param name="orderSubtotalExclTaxInCustomerCurrency">The order subtotal excl tax (customer currency)</param>
        /// <param name="orderShippingInclTaxInCustomerCurrency">The order shipping incl tax (customer currency)</param>
        /// <param name="orderShippingExclTaxInCustomerCurrency">The order shipping excl tax (customer currency)</param>
        /// <param name="paymentMethodAdditionalFeeInclTaxInCustomerCurrency">The payment method additional fee incl tax (customer currency)</param>
        /// <param name="paymentMethodAdditionalFeeExclTaxInCustomerCurrency">The payment method additional fee excl tax (customer currency)</param>
        /// <param name="taxRatesInCustomerCurrency">The tax rates (customer currency)</param>
        /// <param name="orderTaxInCustomerCurrency">The order tax (customer currency)</param>
        /// <param name="orderTotalInCustomerCurrency">The order total (customer currency)</param>
        /// <param name="orderDiscountInCustomerCurrency">The order discount (customer currency)</param>
        /// <param name="checkoutAttributeDescription">The checkout attribute description</param>
        /// <param name="checkoutAttributesXml">The checkout attributes in XML format</param>
        /// <param name="customerCurrencyCode">The customer currency code</param>
        /// <param name="orderWeight">The order weight</param>
        /// <param name="affiliateId">The affiliate identifier</param>
        /// <param name="orderStatus">The order status</param>
        /// <param name="allowStoringCreditCardNumber">The value indicating whether storing of credit card number is allowed</param>
        /// <param name="cardType">The card type</param>
        /// <param name="cardName">The card name</param>
        /// <param name="cardNumber">The card number</param>
        /// <param name="maskedCreditCardNumber">The masked credit card number</param>
        /// <param name="cardCvv2">The card CVV2</param>
        /// <param name="cardExpirationMonth">The card expiration month</param>
        /// <param name="cardExpirationYear">The card expiration year</param>
        /// <param name="paymentMethodId">The payment method identifier</param>
        /// <param name="paymentMethodName">The payment method name</param>
        /// <param name="authorizationTransactionId">The authorization transaction identifier</param>
        /// <param name="authorizationTransactionCode">The authorization transaction code</param>
        /// <param name="authorizationTransactionResult">The authorization transaction result</param>
        /// <param name="captureTransactionId">The capture transaction identifier</param>
        /// <param name="captureTransactionResult">The capture transaction result</param>
        /// <param name="subscriptionTransactionId">The subscription transaction identifier</param>
        /// <param name="purchaseOrderNumber">The purchase order number</param>
        /// <param name="paymentStatus">The payment status</param>
        /// <param name="paidDate">The paid date and time</param>
        /// <param name="billingFirstName">The billing first name</param>
        /// <param name="billingLastName">The billing last name</param>
        /// <param name="billingPhoneNumber">he billing phone number</param>
        /// <param name="billingEmail">The billing email</param>
        /// <param name="billingFaxNumber">The billing fax number</param>
        /// <param name="billingCompany">The billing company</param>
        /// <param name="billingAddress1">The billing address 1</param>
        /// <param name="billingAddress2">The billing address 2</param>
        /// <param name="billingCity">The billing city</param>
        /// <param name="billingStateProvince">The billing state/province</param>
        /// <param name="billingStateProvinceId">The billing state/province identifier</param>
        /// <param name="billingZipPostalCode">The billing zip/postal code</param>
        /// <param name="billingCountry">The billing country</param>
        /// <param name="billingCountryId">The billing country identifier</param>
        /// <param name="shippingStatus">The shipping status</param>
        /// <param name="shippingFirstName">The shipping first name</param>
        /// <param name="shippingLastName">The shipping last name</param>
        /// <param name="shippingPhoneNumber">The shipping phone number</param>
        /// <param name="shippingEmail">The shipping email</param>
        /// <param name="shippingFaxNumber">The shipping fax number</param>
        /// <param name="shippingCompany">The shipping  company</param>
        /// <param name="shippingAddress1">The shipping address 1</param>
        /// <param name="shippingAddress2">The shipping address 2</param>
        /// <param name="shippingCity">The shipping city</param>
        /// <param name="shippingStateProvince">The shipping state/province</param>
        /// <param name="shippingStateProvinceId">The shipping state/province identifier</param>
        /// <param name="shippingZipPostalCode">The shipping zip/postal code</param>
        /// <param name="shippingCountry">The shipping country</param>
        /// <param name="shippingCountryId">The shipping country identifier</param>
        /// <param name="shippingMethod">The shipping method</param>
        /// <param name="shippingRateComputationMethodId">The shipping rate computation method identifier</param>
        /// <param name="shippedDate">The shipped date and time</param>
        /// <param name="deliveryDate">The delivery date and time</param>
        /// <param name="trackingNumber">The tracking number of order</param>
        /// <param name="vatNumber">The VAT number (the European Union Value Added Tax)</param>
        /// <param name="deleted">A value indicating whether the entity has been deleted</param>
        /// <param name="createdOn">The date and time of order creation</param>
        /// <returns>Order</returns>
        public static Order UpdateOrder(int orderId,
            Guid orderGuid,
            int customerId,
            int customerLanguageId,
            TaxDisplayTypeEnum customerTaxDisplayType,
            string customerIP,
            decimal orderSubtotalInclTax,
            decimal orderSubtotalExclTax,
            decimal orderShippingInclTax,
            decimal orderShippingExclTax,
            decimal paymentMethodAdditionalFeeInclTax,
            decimal paymentMethodAdditionalFeeExclTax,
            string taxRates,
            decimal orderTax,
            decimal orderTotal,
            decimal refundedAmount,
            decimal orderDiscount,
            decimal orderSubtotalInclTaxInCustomerCurrency,
            decimal orderSubtotalExclTaxInCustomerCurrency,
            decimal orderShippingInclTaxInCustomerCurrency,
            decimal orderShippingExclTaxInCustomerCurrency,
            decimal paymentMethodAdditionalFeeInclTaxInCustomerCurrency,
            decimal paymentMethodAdditionalFeeExclTaxInCustomerCurrency,
            string taxRatesInCustomerCurrency,
            decimal orderTaxInCustomerCurrency,
            decimal orderTotalInCustomerCurrency,
            decimal orderDiscountInCustomerCurrency,
            string checkoutAttributeDescription,
            string checkoutAttributesXml,
            string customerCurrencyCode,
            decimal orderWeight,
            int affiliateId,
            OrderStatusEnum orderStatus,
            bool allowStoringCreditCardNumber,
            string cardType,
            string cardName,
            string cardNumber,
            string maskedCreditCardNumber,
            string cardCvv2,
            string cardExpirationMonth,
            string cardExpirationYear,
            int paymentMethodId,
            string paymentMethodName,
            string authorizationTransactionId,
            string authorizationTransactionCode,
            string authorizationTransactionResult,
            string captureTransactionId,
            string captureTransactionResult,
            string subscriptionTransactionId,
            string purchaseOrderNumber,
            PaymentStatusEnum paymentStatus,
            DateTime? paidDate,
            string billingFirstName,
            string billingLastName,
            string billingPhoneNumber,
            string billingEmail,
            string billingFaxNumber,
            string billingCompany,
            string billingAddress1,
            string billingAddress2,
            string billingCity,
            string billingStateProvince,
            int billingStateProvinceId,
            string billingZipPostalCode,
            string billingCountry,
            int billingCountryId,
            ShippingStatusEnum shippingStatus,
            string shippingFirstName,
            string shippingLastName,
            string shippingPhoneNumber,
            string shippingEmail,
            string shippingFaxNumber,
            string shippingCompany,
            string shippingAddress1,
            string shippingAddress2,
            string shippingCity,
            string shippingStateProvince,
            int shippingStateProvinceId,
            string shippingZipPostalCode,
            string shippingCountry,
            int shippingCountryId,
            string shippingMethod,
            int shippingRateComputationMethodId,
            DateTime? shippedDate,
            DateTime? deliveryDate,
            string trackingNumber,
            string vatNumber,
            bool deleted,
            DateTime createdOn)
        {
            if (trackingNumber == null)
                trackingNumber = string.Empty;

            taxRates = CommonHelper.EnsureMaximumLength(taxRates, 4000);
            taxRatesInCustomerCurrency = CommonHelper.EnsureMaximumLength(taxRatesInCustomerCurrency, 4000);
            customerIP = CommonHelper.EnsureMaximumLength(customerIP, 50);
            cardType = CommonHelper.EnsureMaximumLength(cardType, 100);
            cardName = CommonHelper.EnsureMaximumLength(cardName, 1000);
            cardNumber = CommonHelper.EnsureMaximumLength(cardNumber, 100);
            maskedCreditCardNumber = CommonHelper.EnsureMaximumLength(maskedCreditCardNumber, 100);
            cardCvv2 = CommonHelper.EnsureMaximumLength(cardCvv2, 100);
            cardExpirationMonth = CommonHelper.EnsureMaximumLength(cardExpirationMonth, 100);
            cardExpirationYear = CommonHelper.EnsureMaximumLength(cardExpirationYear, 100);
            paymentMethodName = CommonHelper.EnsureMaximumLength(paymentMethodName, 100);
            authorizationTransactionId = CommonHelper.EnsureMaximumLength(authorizationTransactionId, 4000);
            authorizationTransactionCode = CommonHelper.EnsureMaximumLength(authorizationTransactionCode, 4000);
            authorizationTransactionResult = CommonHelper.EnsureMaximumLength(authorizationTransactionResult, 4000);
            captureTransactionId = CommonHelper.EnsureMaximumLength(captureTransactionId, 4000);
            captureTransactionResult = CommonHelper.EnsureMaximumLength(captureTransactionResult, 4000);
            subscriptionTransactionId = CommonHelper.EnsureMaximumLength(subscriptionTransactionId, 4000);
            purchaseOrderNumber = CommonHelper.EnsureMaximumLength(purchaseOrderNumber, 100);
            billingFirstName = CommonHelper.EnsureMaximumLength(billingFirstName, 100);
            billingLastName = CommonHelper.EnsureMaximumLength(billingLastName, 100);
            billingPhoneNumber = CommonHelper.EnsureMaximumLength(billingPhoneNumber, 50);
            billingEmail = CommonHelper.EnsureMaximumLength(billingEmail, 255);
            billingFaxNumber = CommonHelper.EnsureMaximumLength(billingFaxNumber, 50);
            billingCompany = CommonHelper.EnsureMaximumLength(billingCompany, 100);
            billingAddress1 = CommonHelper.EnsureMaximumLength(billingAddress1, 100);
            billingAddress2 = CommonHelper.EnsureMaximumLength(billingAddress2, 100);
            billingCity = CommonHelper.EnsureMaximumLength(billingCity, 100);
            billingStateProvince = CommonHelper.EnsureMaximumLength(billingStateProvince, 100);
            billingZipPostalCode = CommonHelper.EnsureMaximumLength(billingZipPostalCode, 30);
            billingCountry = CommonHelper.EnsureMaximumLength(billingCountry, 100);
            shippingFirstName = CommonHelper.EnsureMaximumLength(shippingFirstName, 100);
            shippingLastName = CommonHelper.EnsureMaximumLength(shippingLastName, 100);
            shippingPhoneNumber = CommonHelper.EnsureMaximumLength(shippingPhoneNumber, 50);
            shippingEmail = CommonHelper.EnsureMaximumLength(shippingEmail, 255);
            shippingFaxNumber = CommonHelper.EnsureMaximumLength(shippingFaxNumber, 50);
            shippingCompany = CommonHelper.EnsureMaximumLength(shippingCompany, 100);
            shippingAddress1 = CommonHelper.EnsureMaximumLength(shippingAddress1, 100);
            shippingAddress2 = CommonHelper.EnsureMaximumLength(shippingAddress2, 100);
            shippingCity = CommonHelper.EnsureMaximumLength(shippingCity, 100);
            shippingStateProvince = CommonHelper.EnsureMaximumLength(shippingStateProvince, 100);
            shippingZipPostalCode = CommonHelper.EnsureMaximumLength(shippingZipPostalCode, 30);
            shippingCountry = CommonHelper.EnsureMaximumLength(shippingCountry, 100);
            shippingMethod = CommonHelper.EnsureMaximumLength(shippingMethod, 100);
            trackingNumber = CommonHelper.EnsureMaximumLength(trackingNumber, 100);
            vatNumber = CommonHelper.EnsureMaximumLength(vatNumber, 100);

            var order = GetOrderById(orderId);
            if (order == null)
                return null;

            var context = ObjectContextHelper.CurrentObjectContext;
            if (!context.IsAttached(order))
                context.Orders.Attach(order);

            order.OrderGuid = orderGuid;
            order.CustomerId = customerId;
            order.CustomerLanguageId = customerLanguageId;
            order.CustomerTaxDisplayTypeId = (int)customerTaxDisplayType;
            order.CustomerIP = customerIP;
            order.OrderSubtotalInclTax = orderSubtotalInclTax;
            order.OrderSubtotalExclTax = orderSubtotalExclTax;
            order.OrderShippingInclTax = orderShippingInclTax;
            order.OrderShippingExclTax = orderShippingExclTax;
            order.PaymentMethodAdditionalFeeInclTax = paymentMethodAdditionalFeeInclTax;
            order.PaymentMethodAdditionalFeeExclTax = paymentMethodAdditionalFeeExclTax;
            order.TaxRates = taxRates;
            order.OrderTax = orderTax;
            order.OrderTotal = orderTotal;
            order.RefundedAmount = refundedAmount;
            order.OrderDiscount = orderDiscount;
            order.OrderSubtotalInclTaxInCustomerCurrency = orderSubtotalInclTaxInCustomerCurrency;
            order.OrderSubtotalExclTaxInCustomerCurrency = orderSubtotalExclTaxInCustomerCurrency;
            order.OrderShippingInclTaxInCustomerCurrency = orderShippingInclTaxInCustomerCurrency;
            order.OrderShippingExclTaxInCustomerCurrency = orderShippingExclTaxInCustomerCurrency;
            order.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency = paymentMethodAdditionalFeeInclTaxInCustomerCurrency;
            order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency = paymentMethodAdditionalFeeExclTaxInCustomerCurrency;
            order.TaxRatesInCustomerCurrency = taxRatesInCustomerCurrency;
            order.OrderTaxInCustomerCurrency = orderTaxInCustomerCurrency;
            order.OrderTotalInCustomerCurrency = orderTotalInCustomerCurrency;
            order.OrderDiscountInCustomerCurrency = orderDiscountInCustomerCurrency;
            order.CheckoutAttributeDescription = checkoutAttributeDescription;
            order.CheckoutAttributesXml = checkoutAttributesXml;
            order.CustomerCurrencyCode = customerCurrencyCode;
            order.OrderWeight = orderWeight;
            order.AffiliateId = affiliateId;
            order.OrderStatusId = (int)orderStatus;
            order.AllowStoringCreditCardNumber = allowStoringCreditCardNumber;
            order.CardType = cardType;
            order.CardName = cardName;
            order.CardNumber = cardNumber;
            order.MaskedCreditCardNumber = maskedCreditCardNumber;
            order.CardCvv2 = cardCvv2;
            order.CardExpirationMonth = cardExpirationMonth;
            order.CardExpirationYear = cardExpirationYear;
            order.PaymentMethodId = paymentMethodId;
            order.PaymentMethodName = paymentMethodName;
            order.AuthorizationTransactionId = authorizationTransactionId;
            order.AuthorizationTransactionCode = authorizationTransactionCode;
            order.AuthorizationTransactionResult = authorizationTransactionResult;
            order.CaptureTransactionId = captureTransactionId;
            order.CaptureTransactionResult = captureTransactionResult;
            order.SubscriptionTransactionId = subscriptionTransactionId;
            order.PurchaseOrderNumber = purchaseOrderNumber;
            order.PaymentStatusId = (int)paymentStatus;
            order.PaidDate = paidDate;
            order.BillingFirstName = billingFirstName;
            order.BillingLastName = billingLastName;
            order.BillingPhoneNumber = billingPhoneNumber;
            order.BillingEmail = billingEmail;
            order.BillingFaxNumber = billingFaxNumber;
            order.BillingCompany = billingCompany;
            order.BillingAddress1 = billingAddress1;
            order.BillingAddress2 = billingAddress2;
            order.BillingCity = billingCity;
            order.BillingStateProvince = billingStateProvince;
            order.BillingStateProvinceId = billingStateProvinceId;
            order.BillingZipPostalCode = billingZipPostalCode;
            order.BillingCountry = billingCountry;
            order.BillingCountryId = billingCountryId;
            order.ShippingStatusId = (int)shippingStatus;
            order.ShippingFirstName = shippingFirstName;
            order.ShippingLastName = shippingLastName;
            order.ShippingPhoneNumber = shippingPhoneNumber;
            order.ShippingEmail = shippingEmail;
            order.ShippingFaxNumber = shippingFaxNumber;
            order.ShippingCompany = shippingCompany;
            order.ShippingAddress1 = shippingAddress1;
            order.ShippingAddress2 = shippingAddress2;
            order.ShippingCity = shippingCity;
            order.ShippingStateProvince = shippingStateProvince;
            order.ShippingStateProvinceId = shippingStateProvinceId;
            order.ShippingZipPostalCode = shippingZipPostalCode;
            order.ShippingCountry = shippingCountry;
            order.ShippingCountryId = shippingCountryId;
            order.ShippingMethod = shippingMethod;
            order.ShippingRateComputationMethodId = shippingRateComputationMethodId;
            order.ShippedDate = shippedDate;
            order.DeliveryDate = deliveryDate;
            order.TrackingNumber = trackingNumber;
            order.VatNumber = vatNumber;
            order.Deleted = deleted;
            order.CreatedOn = createdOn;
            context.SaveChanges();

            //quickbooks
            if (QBManager.QBIsEnabled)
            {
                QBManager.RequestSynchronization(order);
            }

            //raise event
            EventContext.Current.OnOrderUpdated(null,
                new OrderEventArgs() { Order = order });

            return order;
        }
예제 #14
0
        /// <summary>
        /// Gets an order report
        /// </summary>
        /// <param name="os">Order status; null to load all orders</param>
        /// <param name="ps">Order payment status; null to load all orders</param>
        /// <param name="ss">Order shippment status; null to load all orders</param>
        /// <returns>IdataReader</returns>
        public static OrderIncompleteReportLine GetOrderReport(OrderStatusEnum? os, 
            PaymentStatusEnum? ps, ShippingStatusEnum? ss)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippmentStatusId = null;
            if (ss.HasValue)
                shippmentStatusId = (int)ss.Value;

            var context = ObjectContextHelper.CurrentObjectContext;
            var item = context.Sp_OrderIncompleteReport(orderStatusId, paymentStatusId, shippmentStatusId);
            return item;
        }
예제 #15
0
        /// <summary>
        /// Gets all gift cards
        /// </summary>
        /// <param name="orderId">Order identifier; null to load all records</param>
        /// <param name="customerId">Customer identifier; null to load all records</param>
        /// <param name="startTime">Order start time; null to load all records</param>
        /// <param name="endTime">Order end time; null to load all records</param>
        /// <param name="os">Order status; null to load all records</param>
        /// <param name="ps">Order payment status; null to load all records</param>
        /// <param name="ss">Order shippment status; null to load all records</param>
        /// <param name="isGiftCardActivated">Value indicating whether gift card is activated; null to load all records</param>
        /// <param name="giftCardCouponCode">Gift card coupon code; null or string.empty to load all records</param>
        /// <returns>Gift cards</returns>
        public static List<GiftCard> GetAllGiftCards(int? orderId,
            int? customerId, DateTime? startTime, DateTime? endTime,
            OrderStatusEnum? os, PaymentStatusEnum? ps, ShippingStatusEnum? ss,
            bool? isGiftCardActivated, string giftCardCouponCode)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            if (giftCardCouponCode != null)
                giftCardCouponCode = giftCardCouponCode.Trim();

            var context = ObjectContextHelper.CurrentObjectContext;
            var giftCards = context.Sp_GiftCardLoadAll(orderId,
                customerId, startTime, endTime, orderStatusId, paymentStatusId, shippingStatusId,
                isGiftCardActivated, giftCardCouponCode);
            return giftCards;
        }
        /// <summary>
        /// Gets an order report
        /// </summary>
        /// <param name="os">Order status; null to load all orders</param>
        /// <param name="ps">Order payment status; null to load all orders</param>
        /// <param name="ss">Order shippment status; null to load all orders</param>
        /// <returns>IdataReader</returns>
        public OrderIncompleteReportLine GetVendorOrderReport(OrderStatusEnum? os,
            PaymentStatusEnum? ps, ShippingStatusEnum? ss)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;

            //TODO: This needs to be repaired.  I do not totally understand link,
            //      hence the duplicate queries to achieve roughly the same results.

            var query = from opv in _context.OrderProductVariants
                        join o in _context.Orders on opv.OrderId equals o.OrderId
                        join pv in _context.ProductVariants on opv.ProductVariantId equals pv.ProductVariantId
                        where (!o.Deleted) &&
                        (!orderStatusId.HasValue || orderStatusId.Value == 0 || o.OrderStatusId == orderStatusId.Value) &&
                        (!paymentStatusId.HasValue || paymentStatusId.Value == 0 || o.PaymentStatusId == paymentStatusId.Value) &&
                        (!shippingStatusId.HasValue || shippingStatusId.Value == 0 || o.ShippingStatusId == shippingStatusId.Value) &&
                        (pv.VendorId == NopContext.Current.User.Vendor.CustomerId)

                        select o;

            var sideQuery = (from opv in _context.OrderProductVariants
                            join o in _context.Orders on opv.OrderId equals o.OrderId
                            join pv in _context.ProductVariants on opv.ProductVariantId equals pv.ProductVariantId
                            where (!o.Deleted) &&
                            (!orderStatusId.HasValue || orderStatusId.Value == 0 || o.OrderStatusId == orderStatusId.Value) &&
                            (!paymentStatusId.HasValue || paymentStatusId.Value == 0 || o.PaymentStatusId == paymentStatusId.Value) &&
                            (!shippingStatusId.HasValue || shippingStatusId.Value == 0 || o.ShippingStatusId == shippingStatusId.Value) &&
                            (pv.VendorId == NopContext.Current.User.Vendor.CustomerId)

                            select new { o.OrderTotal, o.OrderId }).Distinct();

            var item = new OrderIncompleteReportLine();
            item.Total = Convert.ToDecimal(sideQuery.Sum(o => (decimal?)o.OrderTotal));
            item.Count = sideQuery.Count();
            return item;
        }