Пример #1
0
        public HistoryRefundAmount GetRefundCashAmtBySOSysNo(int soSysNo, RMARefundStatus Status)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("GetRefundCashAmtBySOSysNo");

            dc.SetParameterValue("@SOSysNo", soSysNo);
            dc.SetParameterValue("@Status", Status);
            HistoryRefundAmount result = dc.ExecuteEntity <HistoryRefundAmount>();

            return(result);
        }
Пример #2
0
        public HistoryRefundAmount GetRefundShipPriceBySOSysNoAndOtherStockID(int soSysNo, RMARefundStatus Status, string stockID)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("GetRefundShipPriceBySOSysNoAndOtherWareHouseNumber");

            dc.SetParameterValue("@SOSysNo", soSysNo);
            dc.SetParameterValue("@Status", Status);
            dc.SetParameterValue("@InvoiceLocation", stockID);

            HistoryRefundAmount result = dc.ExecuteEntity <HistoryRefundAmount>();

            return(result);
        }
Пример #3
0
        public HistoryRefundAmount GetRO_BalanceShipPriceAmtByOrgSOSysNoAndOtherStockID(int soSysNo, RefundBalanceStatus Status, int productSysNo, string stockID)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("GetRO_BalanceShipPriceAmtByOrgSOSysNoAndOtherWarehouseNumber");

            dc.SetParameterValue("@OrgSOSysNo", soSysNo);
            dc.SetParameterValue("@Status", Status);
            dc.SetParameterValue("@ProductSysNo", productSysNo);//"运费补偿及其他"
            dc.SetParameterValue("@InvoiceLocation", stockID);

            HistoryRefundAmount result = dc.ExecuteEntity <HistoryRefundAmount>();

            return(result);
        }
Пример #4
0
        /// <summary>
        /// 计算可退款金额(运费,现金,礼品卡,积分)
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="soBaseInfo"></param>
        /// <param name="availShipPrice">可退运费</param>
        /// <param name="cashRemoveGiftCard">可退现金</param>
        /// <param name="availGiftCard">可退礼品卡</param>
        /// <param name="availPointAmt">可退积分</param>
        /// <param name="totalRoBoBalanceAmt">历史退款总额</param>
        private void CalculateAvailRefundAmt(RefundBalanceInfo entity, SOBaseInfo soBaseInfo, out decimal availShipPrice,
                                             out decimal cashRemoveGiftCard, out decimal availGiftCard, out int availPointAmt, out decimal totalRoBoBalanceAmt)
        {
            string stockID = ExternalDomainBroker.GetSOItemList(soBaseInfo.SysNo.Value).FirstOrDefault().StockSysNo.Value.ToString();

            #region 历史退款

            //正常商品退款总额
            HistoryRefundAmount historyAmt          = refundProcessor.GetHistoryRefundAmt(entity.OriginalSOSysNo.Value, entity.ProductSysNo.Value, stockID);
            decimal             totalGiftAmtHistory = historyAmt.TotalGiftCardAmt;
            int totalPointAmtHistory = historyAmt.TotalPointAmt;
            totalRoBoBalanceAmt = historyAmt.TotalRoBalanceAmt;
            historyAmt          = refundProcessor.GetHistoryRefundAmt(entity.OriginalSOSysNo.Value, 0, stockID);
            decimal totalCashAmtHistory = historyAmt.TotalCashAmt;
            //运费补偿退款总额
            decimal totalShipPriceAmtHistory = historyAmt.TotalShipPriceAmt;

            #endregion 历史退款

            #region 计算可退现金/积分/礼品卡

            //运费总额(运费+保价费+附加费)
            decimal shipPrice = GetShipFee(soBaseInfo.SysNo.Value, stockID);
            //可退运费(运费总额-已退运费总额)
            availShipPrice = shipPrice - totalShipPriceAmtHistory;
            if (availShipPrice < 0)
            {
                availShipPrice = 0;
            }
            //可退现金
            cashRemoveGiftCard = soBaseInfo.CashPay + shipPrice + soBaseInfo.PromotionAmount.Value
                                 - soBaseInfo.GiftCardPay.Value - totalCashAmtHistory;

            if (soBaseInfo.GiftCardPay == 0 && availShipPrice > 0 && entity.ProductSysNo != 0)
            {
                cashRemoveGiftCard -= availShipPrice;
            }
            if (cashRemoveGiftCard < 0)
            {
                cashRemoveGiftCard = 0;
            }
            ///可退礼品卡金额
            availGiftCard = soBaseInfo.GiftCardPay.Value - totalGiftAmtHistory;

            if (soBaseInfo.GiftCardPay.Value > 0 && availShipPrice > 0 && entity.ProductSysNo != 0)
            {
                availGiftCard -= availShipPrice;
            }
            if (availGiftCard < 0)
            {
                availGiftCard = 0;
            }
            //可退积分
            availPointAmt = soBaseInfo.PointPay.Value - totalPointAmtHistory;
            if (availPointAmt < 0)
            {
                availPointAmt = 0;
            }

            #endregion 计算可退现金/积分/礼品卡
        }