public void InitFee(decimal TotalFee, decimal _zyDepositFee, List <UCPayMode2> m_UCPayModes) { PayTotalFee = TotalFee; SelfTotalFee = TotalFee; FavorableTotalFee = 0; AccountTotalFee = 0; PosFee = 0; CashFee = 0; payList = new List <PayModeFee>(); for (int i = 0; i < m_UCPayModes.Count; i++) { if (m_UCPayModes[i]._config.PayMethodID > 0) { PayModeFee pay = new PayModeFee(); pay.PayMethodID = m_UCPayModes[i]._config.PayMethodID; pay.TicketNo = ""; pay.InputFrom = Convert.ToInt32(m_UCPayModes[i]._config.InputFrom); pay.PayFee = m_UCPayModes[i].PayValue; //pay.PayStID = m_UCPayModes[i]._config.PayStID; pay.Agency = 0; payList.Add(pay); } } zyDepositFee = _zyDepositFee; zyRefundFee = 0; zyChargeFee = 0; decimal ret = zyDepositFee - PayTotalFee; if (ret >= 0)//应退 { zyRefundFee = ret; } else//补收 { zyChargeFee = -ret; } ChangeFee = ret;//找零 decimal _needPayFee; decimal _roundFee; CostFeeStyle.ChangeFeeRoun(ChangeFee, out _needPayFee, out _roundFee); ChangeFee = _needPayFee; RoundFee = _roundFee; //update zh 20160927 ChangeValue(m_UCPayModes); //重新计算 SetPayModeFee(1002, "", CashFee); //设置现金金额 }
//支付方式金额变化 public void ChangeValue(List <UCPayMode2> m_UCPayModes) { decimal _notChanageFee = 0;//除了找零 AccountTotalFee = 0; for (int i = 0; i < m_UCPayModes.Count; i++) { if (m_UCPayModes[i]._config.PayMethodID == 1005)//优惠 { FavorableTotalFee = m_UCPayModes[i].PayValue; } //记账 //if (m_UCPayModes[i]._config.PayMethodID > 0 && m_UCPayModes[i]._config.PayMethodID != 1002 && m_UCPayModes[i]._config.PayMethodID != 1005)//排除现金和优惠=记账 if (m_UCPayModes[i]._config.PayMethodID > 0 && m_UCPayModes[i]._config.IsAccountFee == 1)//只取记账的 { AccountTotalFee += m_UCPayModes[i].PayValue; } if (m_UCPayModes[i]._config.PayMethodID == 1002)//现金 { CashFee = m_UCPayModes[i].PayValue; } //如果有类型现金(如支付宝、刷卡等)可以根据银联刷卡等方式进行减掉,下面代码则是去掉POS部分 //POS if (m_UCPayModes[i]._config.PayMethodID == 1004) { PosFee = m_UCPayModes[i].PayValue; } if (m_UCPayModes[i]._config.PayMethodID != -1)//除了找零 { _notChanageFee += m_UCPayModes[i].PayValue; } } SelfTotalFee = PayTotalFee - AccountTotalFee - FavorableTotalFee; //这里把支付方式为POS的减掉,当作了现金所以补收金额没变 //AccountTotalFee里面包含了PosFee,因为Pos金额不能影响补收,所以要减去POS //decimal ret = zyDepositFee - PayTotalFee + AccountTotalFee - PosFee;//押金减去总金额 加上 记账 减去 pos decimal ret = zyDepositFee - PayTotalFee + AccountTotalFee + FavorableTotalFee;// zyRefundFee = 0; zyChargeFee = 0; if (ret >= 0)//应退 { zyRefundFee = ret; } else//补收 { zyChargeFee = -ret; } ChangeFee = _notChanageFee - (PayTotalFee) + zyDepositFee;//找零 decimal _needPayFee; decimal _roundFee; CostFeeStyle.ChangeFeeRoun(ChangeFee, out _needPayFee, out _roundFee); //计算凑整_roundFee=_needPayFee-fee ChangeFee = _needPayFee; //找零(凑整后) RoundFee = _roundFee; //凑整费 update zh 20160927 CashFee = CashFee - ChangeFee; //现金 SetPayModeFee(1002, "", CashFee); //设置现金金额 }