private void SetLabelText(CostFeeStyle CostFee) { txtAmount.Text = CostFee.PayTotalFee.ToString(); lbFavorableSum.Text = CostFee.FavorableTotalFee.ToString(); lbPersonalSum.Text = CostFee.SelfTotalFee.ToString(); lbAccountSum.Text = CostFee.AccountTotalFee.ToString(); }
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); //设置现金金额 }
/// <summary> /// 第一步:创建支付方式对象 /// </summary> /// <param name="WorkID">医疗机构ID</param> /// <param name="flpPayCtrl">支付对象容器</param> /// <param name="iPatType">病人类型</param> /// <param name="iUseType">病人来源: 0-门诊 1-住院</param> /// <param name="totalFee">处方金额</param> /// <param name="zyDepositFee">住院预交金</param> /// <param name="_setFeeValue">回调返回金额</param> /// <returns>支付方式个数</returns> public static int InitUCPayModeControl(int WorkID, FlowLayoutPanel flpPayCtrl, int iPatType, int iUseType) { workID = WorkID; CostFee = new CostFeeStyle(); m_PayConfigs = new List <PayMethod_Config>(); m_UCPayModes = new List <UCPayMode2>(); //根据支付方式动态创建支付控件到 flpPayCtrl List <PayMethod_Config> rows = GetPatientPayMethodConfig(iPatType, (PAY_USERTYPE)iUseType); if (rows == null) { return(0); } flpPayCtrl.Controls.Clear(); flpPayCtrl.SuspendLayout(); int iTabStopIndex = 0; foreach (PayMethod_Config row in rows) { UCPayMode2 ucPayButton = new UCPayMode2(row); ucPayButton.TabIndex = iTabStopIndex++; ucPayButton.Margin = new Padding(0, 0, 0, 0); //ucPayButton.Dock = DockStyle.Top; ucPayButton.Width = flpPayCtrl.Width - 20; ucPayButton.btnPayClick += new btnPayClickEventHandler(ucPayButton_btnPayClick); ucPayButton.diPayMoneyTextChanged += new diPayMoneyTextChangedEventHandler(ucPayButton_diPayMoneyTextChanged); ucPayButton.threadPayFinshed += new threadPayFinshedEventHandler(ucPayButton_threadPayFinshed); flpPayCtrl.Controls.Add(ucPayButton); if (row.PayMethodID == -1) { ucPayButton.diPayMoney.MinValue = -1000000000; //找零可以为负数 } m_UCPayModes.Add(ucPayButton); //控件集合 PayMethod_Config config = row; config.Handle = ucPayButton.Handle; m_PayConfigs.Add(config); } flpPayCtrl.ResumeLayout(false); return(rows.Count); }
//支付方式金额变化 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); //设置现金金额 }