private void FrmFeeModel_Load(object sender, EventArgs e) { _currentModel = new HIS.ZYNurse_BLL.FeeModelProcess(); OP_Account op_account = new OP_Account(); dtItem = op_account.getItems(); dtItem.TableName = "Itemslist"; dgvFeeModel.SetSelectionCardDataSource(dtItem, item_name.Index); dtAllItems = dtItem.Clone(); for (int i = 0; i < dtItem.Rows.Count; i++) { dtAllItems.Rows.Add(dtItem.Rows[i].ItemArray); } Op_BaseData basedata = new Op_BaseData(); DataTable yf = basedata.GetYfName(); if (yf == null || yf.Rows.Count == 1) { this.cbYf.Text = "全部药房"; this.cbYf.Visible = false; this.lbyf.Visible = false; } else { this.cbYf.Visible = true; this.lbyf.Visible = true; this.cbYf.DisplayMember = "Name"; this.cbYf.ValueMember = "Value"; cbYf.DataSource = basedata.Get_dept_yfName(Convert.ToInt32(_currentDept.DeptID)); this.cbYf.SelectedIndex = 0; } }
/// <summary> /// 缴款单打印 /// </summary> /// <param name="curAccount">当前缴款对象</param> /// <param name="dtInvoiceData">票据信息</param> /// <param name="dtItemData">项目信息</param> /// <param name="dtPayMentData">支付信息</param> private void Print(OP_Account curAccount, DataTable dtInvoiceData, DataTable dtItemData, DataTable dtPayMentData) { Dictionary <string, object> myDictionary = new Dictionary <string, object>(); myDictionary.Add("Title", LoginUserInfo.WorkName + "门诊缴款单"); myDictionary.Add("ReceivBillNO", curAccount.ReceivBillNO); myDictionary.Add("DateScope", curAccount.LastDate.ToString("yyyy-MM-dd HH:mm:ss") + "至" + curAccount.AccountDate.ToString("yyyy-MM-dd HH:mm:ss")); string invoiceScope = string.Empty; for (int i = 0; i < dtInvoiceData.Rows.Count; i++) { invoiceScope += dtInvoiceData.Rows[i]["InvoiceNOs"] + " "; } myDictionary.Add("InvoiceScope", invoiceScope); myDictionary.Add("AccountOperator", LoginUserInfo.EmpName); myDictionary.Add("RoundingFee", curAccount.RoundingFee); myDictionary.Add("TotalFee", curAccount.TotalFee); myDictionary.Add("ShouldAccountFee", curAccount.CashFee); myDictionary.Add("DxFee", CmycurD(curAccount.CashFee)); for (int i = 0; i < dtItemData.Rows.Count - 1; i++) { myDictionary.Add(dtItemData.Rows[i]["fpItemName"].ToString(), dtItemData.Rows[i]["ItemFee"]); } for (int i = 0; i < dtPayMentData.Rows.Count - 1; i++) { myDictionary.Add(dtPayMentData.Rows[i]["paymentname"].ToString(), dtPayMentData.Rows[i]["paymentmoney"]); } EfwControls.CustomControl.ReportTool.GetReport(LoginUserInfo.WorkId, 2001, 0, myDictionary, null).Print(false); }
public void AccountInit(string frmname) { if (frmname == "FrmAccount") { Action <ClientRequestData> requestAction = ((ClientRequestData request) => { request.AddData(LoginUserInfo.EmpId); request.AddData(ifrmAccount.bdate); request.AddData(ifrmAccount.edate); }); ServiceResponseData retdata = InvokeWcfService("OPProject.Service", "AccountController", "AccountInit", requestAction); DataTable dtCashier = retdata.GetData <DataTable>(0); List <OP_Account> notAccountList = retdata.GetData <List <OP_Account> >(1); //未缴款列表 List <OP_Account> historyAccountList = retdata.GetData <List <OP_Account> >(2); //历史缴款列表 ifrmAccount.loadCashier(dtCashier); ifrmAccount.GetQueryEmpID = LoginUserInfo.EmpId; ifrmAccount.BindTree(notAccountList, historyAccountList);//缴款列表绑定 } else { Action <ClientRequestData> requestAction = ((ClientRequestData request) => { request.AddData(ifrmAccount.QueryAccountId); }); ServiceResponseData retdata = InvokeWcfService("OPProject.Service", "AccountController", "QueryAccountInit", requestAction); OP_Account curAccount = retdata.GetData <OP_Account>(0); ifrmAccount.CurAccount = curAccount; string totalFeeDx = CmycurD(ifrmAccount.CurAccount.TotalFee); ifrmAccount.SetAccountDxTotalFee(totalFeeDx); GetAccountData(); } }
public ServiceResponseData QueryAccountInit() { int accountid = requestData.GetData <int>(0); OP_Account opAccount = NewObject <OP_Account>().getmodel(accountid) as OP_Account; responseData.AddData(opAccount); return(responseData); }
public ServiceResponseData SubmitAccount() { try { OP_Account curAccount = requestData.GetData <OP_Account>(0);//结账ID OP_Account newAccount = NewObject <AccountProcess>().SubmitAccount(curAccount); responseData.AddData(newAccount); return(responseData); } catch (Exception err) { throw new Exception(err.Message); } }
/// <summary> /// 每笔记录汇总插入结账表 /// </summary> /// <param name="costHead">结算对象</param> /// <param name="curAccountId">当前缴款ID</param> /// <param name="invoiceCount">收费票据张数</param> /// <param name="refundInvoiceCount">退费票据张数</param> public void AddAccoutFee(OP_CostHead costHead, int curAccountId, int invoiceCount, int refundInvoiceCount) { OP_Account opaccount = NewObject <OP_Account>().getmodel(curAccountId) as OP_Account; opaccount.TotalFee += costHead.TotalFee; opaccount.CashFee += costHead.CashFee; opaccount.PosFee += costHead.PosFee; opaccount.PromFee += costHead.PromFee; opaccount.RoundingFee += costHead.RoundingFee; opaccount.InvoiceCount += invoiceCount; opaccount.RefundInvoiceCount += refundInvoiceCount; this.BindDb(opaccount); opaccount.save(); }
public ServiceResponseData GetAccountDataME() { try { int accountId = requestData.GetData <int>(0); //结账ID int accountFlag = requestData.GetData <int>(1); //结账标志 DataTable dtAccountME = NewObject <AccountProcess>().GetAccountDataME(accountId); //票据信息 responseData.AddData(dtAccountME); OP_Account curAccount = NewObject <OP_Account>().getmodel(accountId) as OP_Account; responseData.AddData(curAccount); return(responseData); } catch (Exception err) { throw new Exception(err.Message); } }
/// <summary> /// 缴款树点击事件 /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> private void TreeAccount_NodeClick(object sender, TreeNodeMouseEventArgs e) { InvokeController("ChangeValue", frmName); if (!e.Node.HasChildNodes && e.Node.Tag != null) { OP_Account curAccount = (OP_Account)e.Node.Tag; if (curAccount.AccountFlag == 0) { btnAccount.Enabled = true; btnPrint.Enabled = false; } else { btnAccount.Enabled = false; btnPrint.Enabled = true; } //tabControl1.SelectedTabIndex = curAccount.AccountType; CurAccount = curAccount; InvokeController("GetAccountData"); } }
/// <summary> /// 获取帐户id /// </summary> /// <param name="empid">人员id</param> /// <param name="accountType">帐户类型</param> /// <returns>帐户id</returns> public int GetAccountId(int empid, int accountType) { int accountid = 0; List <OP_Account> account = NewObject <OP_Account>().getlist <OP_Account>(" AccountType=1 AND AccountEmpID=" + empid + " and accountFlag=0"); if (account != null && account.Count > 0) { accountid = account[0].AccountID; } else { OP_Account newaccount = new OP_Account(); newaccount.AccountEmpID = empid; newaccount.AccountFlag = 0; newaccount.TotalFee = 0; newaccount.CashFee = 0; newaccount.PosFee = 0; newaccount.PromFee = 0; newaccount.InvoiceCount = 0; newaccount.RefundInvoiceCount = 0; newaccount.RoundingFee = 0; newaccount.AccountType = 1; List <OP_Account> accountList = NewObject <OP_Account>().getlist <OP_Account>(" AccountType=1 AND AccountEmpID=" + empid + " and accountFlag=1"); if (accountList == null || accountList.Count == 0) { newaccount.LastDate = DateTime.Now; } else { accountList = accountList.OrderByDescending(p => p.AccountID).ToList(); //获取上次缴款日期 newaccount.LastDate = accountList[0].AccountDate; } this.BindDb(newaccount); newaccount.save(); accountid = newaccount.AccountID; } return(accountid); }
public ServiceResponseData GetAccountData() { try { int accountId = requestData.GetData <int>(0); //结账ID int accountFlag = requestData.GetData <int>(1); //结账标志 DataTable dtAccountInvoice = NewObject <AccountProcess>().GetAccountInvoiceData(accountId); //票据信息 DataTable dtpayMentInfo = NewObject <AccountProcess>().GetAccountPatmentInfo(accountId, accountFlag); //支付方式信息 DataTable dtItemData = NewObject <AccountProcess>().GetAccountItemData(accountId); //项目明细信息 responseData.AddData(dtAccountInvoice); responseData.AddData(dtpayMentInfo); responseData.AddData(dtItemData); decimal regFee = 0; decimal balanceFee = 0; DataTable dtRegBalance = NewObject <AccountProcess>().GetRegBalanceFee(accountId); for (int i = 0; i < dtRegBalance.Rows.Count; i++) { if (Convert.ToInt32(dtRegBalance.Rows[i]["regFlag"]) == 0) { balanceFee = Convert.ToDecimal(dtRegBalance.Rows[i]["totalFee"]); } else { regFee = Convert.ToDecimal(dtRegBalance.Rows[i]["totalFee"]); } } responseData.AddData(regFee); responseData.AddData(balanceFee); OP_Account curAccount = NewObject <OP_Account>().getmodel(accountId) as OP_Account; responseData.AddData(curAccount); return(responseData); } catch (Exception err) { throw new Exception(err.Message); } }
/// <summary> /// 缴款列表绑定 /// </summary> /// <param name="notAccountList">未缴款列表</param> /// <param name="historyAccountList">已经缴款列表</param> public void BindTree(List <OP_Account> notAccountList, List <OP_Account> historyAccountList) { btnAccount.Enabled = false; btnPrint.Enabled = false; TreeAccount.Nodes.Clear(); #region 未交款 Node notAccountPnode = new Node(); notAccountPnode.Text = "未缴款"; notAccountPnode.Name = "未缴款"; notAccountPnode.Tag = null; List <OP_Account> opAccountNo = notAccountList.Where((x, i) => notAccountList.FindIndex(z => z.AccountEmpID == x.AccountEmpID) == i).ToList(); foreach (OP_Account notAccount in opAccountNo) { Node node = new Node(); node.Text = notAccount.AccountEmpName; node.ImageKey = "Parent"; node.DataKey = notAccount.AccountEmpID; //node.Name = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); node.Tag = null; notAccountPnode.Nodes.Add(node); List <OP_Account> opAccountNoDetail = notAccountList.Where(p => p.AccountEmpID == notAccount.AccountEmpID).ToList(); foreach (OP_Account op in opAccountNoDetail) { Node sNode = new Node(); sNode.Text = op.AccountType == 0?"挂号收费":"会员充值"; sNode.ImageKey = "Child"; sNode.DataKey = op.AccountEmpID + "|" + op.AccountType; sNode.Tag = op; node.Nodes.Add(sNode); } } TreeAccount.Nodes.Add(notAccountPnode); notAccountPnode.ExpandAll(); #endregion #region 已交款 Node historyAccountPnode = new Node(); historyAccountPnode.Text = "已缴款"; historyAccountPnode.Name = "已缴款"; historyAccountPnode.Tag = null; List <OP_Account> opAccountYes = historyAccountList.Where((x, i) => historyAccountList.FindIndex(z => z.AccountEmpID == x.AccountEmpID) == i).ToList(); foreach (OP_Account hasAccount in opAccountYes) { Node node = new Node(); node.Text = hasAccount.AccountEmpName; node.ImageKey = "Parent"; node.DataKey = hasAccount.AccountEmpID; List <OP_Account> opAccountYesType = historyAccountList.Where((x, i) => historyAccountList.FindIndex(z => z.AccountEmpID == x.AccountEmpID && z.AccountType == x.AccountType) == i).ToList(); foreach (OP_Account hasAccountTy in opAccountYesType) { Node sNode = new Node(); sNode.Text = hasAccountTy.AccountType == 0 ? "挂号收费" : "会员充值"; sNode.Tag = null; sNode.ImageKey = "Parent"; sNode.DataKey = hasAccountTy.AccountEmpID + "|" + hasAccountTy.AccountType; List <OP_Account> opAccountYesDetail = historyAccountList.Where(p => p.AccountEmpID == hasAccountTy.AccountEmpID && p.AccountType == hasAccountTy.AccountType).ToList(); foreach (OP_Account op in opAccountYesDetail) { Node cNode = new Node(); cNode.Text = op.AccountDate.ToString("yyyy-MM-dd HH:mm:ss"); cNode.Tag = op; cNode.ImageKey = "Child"; cNode.DataKey = op.AccountEmpID + "|" + op.AccountType; sNode.Nodes.Add(cNode); } node.Nodes.Add(sNode); } historyAccountPnode.Nodes.Add(node); } //foreach (OP_Account account in historyAccountList) //{ // Node node = new Node(); // node.Text = account.AccountDate.ToString("yyyy-MM-dd HH:mm:ss"); // node.Name = account.AccountDate.ToString("yyyy-MM-dd HH:mm:ss"); // node.Tag = account; // historyAccountPnode.Nodes.Add(node); //} TreeAccount.Nodes.Add(historyAccountPnode); #endregion //默认选择次序 未交款->已交款->赋空 if (notAccountList.Count > 0) { CurAccount = notAccountList[0] as OP_Account; //窗体变换,个人缴款和门诊缴款查询 InvokeController("ChangeValue", frmName); //获取结账各项数据 InvokeController("GetAccountData"); TreeAccount.SelectedNode = TreeAccount.Nodes[0].Nodes[0].Nodes[0]; btnAccount.Enabled = true; btnPrint.Enabled = false; } else if (historyAccountList.Count > 0) { CurAccount = historyAccountList[0] as OP_Account; //窗体变换,个人缴款和门诊缴款查询 InvokeController("ChangeValue", frmName); //获取结账各项数据 InvokeController("GetAccountData"); TreeAccount.SelectedNode = TreeAccount.Nodes[1].Nodes[0].Nodes[0]; historyAccountPnode.ExpandAll(); btnAccount.Enabled = false; btnPrint.Enabled = true; } else { CurAccount = new OP_Account(); BindAccountData(new DataTable(), new DataTable(), new DataTable()); btnAccount.Enabled = false; btnPrint.Enabled = false; tabControl1.SelectedTabIndex = 0; } }
/// <summary> /// 提交结账 /// </summary> /// <param name="account">缴款对象</param> /// <returns>返回缴款对象</returns> public OP_Account SubmitAccount(OP_Account account) { OP_Account curAccount = NewObject <OP_Account>().getmodel(account.AccountID) as OP_Account; if (curAccount.AccountFlag != 0) { throw new Exception("已经结账不允许再交结账,请刷新界面数据"); } //挂号收费交款 if (account.AccountType == 0) { if (curAccount.TotalFee != account.TotalFee || curAccount.CashFee != account.CashFee) { throw new Exception("结账数据发生变化,请刷新界面数据"); } DataTable dtPayMent = NewDao <IOPManageDao>().GetAccountPayMent(curAccount.AccountID); for (int i = 0; i < dtPayMent.Rows.Count; i++) { if (Convert.ToDecimal(dtPayMent.Rows[i]["paymentcount"]) == 0) { continue; } OP_AccountPatMentInfo accountPayment = new OP_AccountPatMentInfo(); accountPayment.AccountID = curAccount.AccountID; accountPayment.PayMentCode = dtPayMent.Rows[i]["paymentcode"].ToString(); accountPayment.PayMentCount = Convert.ToInt32(dtPayMent.Rows[i]["paymentcount"]); accountPayment.PayMentID = Convert.ToInt32(dtPayMent.Rows[i]["paymentid"]); accountPayment.PayMentMoney = Convert.ToDecimal(dtPayMent.Rows[i]["paymentmoney"]); accountPayment.PayMentName = dtPayMent.Rows[i]["paymentname"].ToString(); this.BindDb(accountPayment); accountPayment.save(); } } else { //会员充值交款 DataTable dt = GetAccountDataME(account.AccountID); if (dt == null || dt.Rows.Count <= 0) { throw new Exception("结账数据发生变化,请刷新界面数据"); } decimal totalFee = Convert.ToDecimal(dt.Compute("sum(Money)", string.Empty)); if (account.TotalFee != totalFee) { throw new Exception("结账数据发生变化,请刷新界面数据"); } bool bResult = NewDao <IOPManageDao>().UpdateAccountME(account.AccountID); if (!bResult) { throw new Exception("更新明细表失败!请重新操作!"); } int cashCount = dt.Select(" PayType = '现金'").Length; int posCount = dt.Select(" PayType = 'POS'").Length; if (cashCount > 0) { decimal cashFee = Convert.ToDecimal(dt.Compute("sum(Money)", " PayType = '现金'")); OP_AccountPatMentInfo accountPayment = new OP_AccountPatMentInfo(); accountPayment.AccountID = curAccount.AccountID; accountPayment.PayMentCode = "01"; accountPayment.PayMentCount = cashCount; accountPayment.PayMentID = 1002; accountPayment.PayMentMoney = cashFee; accountPayment.PayMentName = "现金支付"; this.BindDb(accountPayment); accountPayment.save(); } if (posCount > 0) { decimal posFee = Convert.ToDecimal(dt.Compute("sum(Money)", " PayType = 'POS'")); OP_AccountPatMentInfo accountPayment = new OP_AccountPatMentInfo(); accountPayment.AccountID = curAccount.AccountID; accountPayment.PayMentCode = "02"; accountPayment.PayMentCount = posCount; accountPayment.PayMentID = 1004; accountPayment.PayMentMoney = posFee; accountPayment.PayMentName = "POS支付"; this.BindDb(accountPayment); accountPayment.save(); } curAccount.TotalFee = account.TotalFee; curAccount.CashFee = account.CashFee; curAccount.PosFee = account.PosFee; } int jkdh = NewDao <IOPManageDao>().GetMaxJkdh(); curAccount.AccountFlag = 1; curAccount.AccountDate = DateTime.Now; curAccount.ReceivBillNO = jkdh + 1; this.BindDb(curAccount); curAccount.save(); return(curAccount); }