Esempio n. 1
0
        /// <summary>
        /// 获取当前票据号
        /// </summary>
        /// <param name="invoiceType">票据类型</param>
        /// <param name="operatorid">操作员ID</param>
        /// <returns>string当前票据号</returns>
        public string GetCurInvoiceNO(InvoiceType invoiceType, int operatorid)
        {
            InvoiceManagement invoicemanagement = NewObject <InvoiceManagement>();
            string            pefChar           = string.Empty;
            string            curInvoiceNO      = invoicemanagement.GetInvoiceCurNo(invoiceType, operatorid, out pefChar);

            curInvoiceNO = pefChar + curInvoiceNO;
            return(curInvoiceNO);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取操作员当前可用发票张数和当前票据号
        /// </summary>
        ///  <param name="invoiceType">票据类型</param>
        /// <param name="operatorid">操作员Id</param>
        /// <param name="curInvoiceNO">当前票据号</param>
        /// <returns>int票据张数</returns>
        public int GetInvoiceInfo(InvoiceType invoiceType, int operatorid, out string curInvoiceNO)
        {
            InvoiceManagement invoicemanagement = NewObject <InvoiceManagement>();
            int    invoiceCount = invoicemanagement.GetInvoiceNumberOfCanUse(invoiceType, operatorid);
            string pefChar      = string.Empty;

            curInvoiceNO = invoicemanagement.GetInvoiceCurNo(invoiceType, operatorid, out pefChar);
            curInvoiceNO = pefChar + curInvoiceNO;
            return(invoiceCount);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取当前可用票据对象
        /// </summary>
        /// <param name="invoiceType">票据类型</param>
        /// <param name="operatorid">操作员ID</param>
        /// <returns>当前票据对象</returns>
        public Basic_Invoice GetCurInvoice(InvoiceType invoiceType, int operatorid)
        {
            InvoiceManagement invoicemanagement = NewObject <InvoiceManagement>();

            return(invoicemanagement.GetInvoiceCurNo(invoiceType, operatorid));
        }
Esempio n. 4
0
        /// <summary>
        /// 住院结算
        /// </summary>
        /// <param name="patEnterHDate">病人入院日期</param>
        /// <param name="costHead">结算头信息</param>
        /// <param name="costPayList">支付方式列表</param>
        /// <param name="resDiscountInfo">优惠信息数据</param>
        /// <param name="workID">机构ID</param>
        /// <returns>错误消息</returns>
        public string DischargeSettlement(DateTime patEnterHDate, IP_CostHead costHead, List <IP_CostPayment> costPayList, DiscountInfo resDiscountInfo, int workID)
        {
            // 检查最新费用是否发生过变化
            // 获取最新费用总额
            DataTable tempDt = NewDao <IIPManageDao>().GetPatDepositFee(costHead.PatListID);

            if (tempDt != null)
            {
                // 最新住院费用总额
                decimal tempDepositFee = Convert.ToDecimal(tempDt.Rows[0][0]);
                // 最新预交金总额
                decimal tempTotalFee = Convert.ToDecimal(tempDt.Rows[1][0]);
                if (costHead.TotalFee != tempTotalFee || costHead.DeptositFee != tempDepositFee)
                {
                    return("当前病人的费用数据已发生改变,请刷新费用列表后重新结算!");
                }
            }
            else
            {
                return("当前病人的费用已被结算!");
            }
            // 取得病人上一次结算时间
            DataTable costDateDt = NewDao <IIPManageDao>().GetPatLastCostDate(costHead.PatListID);

            // 如果病人存在结算记录,结算起始日期为上一次结算时间
            if (costDateDt != null && costDateDt.Rows.Count > 0)
            {
                costHead.CostBeginDate = Convert.ToDateTime(costDateDt.Rows[0][0]);
            }
            else
            {
                // 病人没有结算记录,结算起始时间为入院时间
                costHead.CostBeginDate = patEnterHDate;
            }

            costHead.CostEndDate = DateTime.Now;
            // 取得票据ID
            InvoiceManagement invoicemanagement = NewObject <InvoiceManagement>();
            Basic_Invoice     invoice           = invoicemanagement.GetInvoiceCurNo(InvoiceType.住院结算, costHead.CostEmpID);

            costHead.InvoiceID = invoice.ID; // 票据ID
            // 写入结算头表数据
            this.BindDb(costHead);
            costHead.save();

            string perfChar = string.Empty;

            // 使用票据号
            NewObject <InvoiceManagement>().GetInvoiceCurNOAndUse(InvoiceType.住院结算, costHead.CostEmpID, out perfChar);
            // 写入结算明细表数据
            bool result = NewDao <IIPManageDao>().SaveCostDetail(costHead.CostHeadID, costHead.InvoiceID, costHead.InvoiceNO, workID, costHead.PatListID);

            // 写入支付记录表数据
            if (costPayList.Count > 0)
            {
                foreach (IP_CostPayment costpay in costPayList)
                {
                    costpay.CostHeadID = costHead.CostHeadID;
                    // 取得支付方式名
                    Basic_Payment basePayment = NewObject <Basic_Payment>().getmodel(costpay.PaymentID) as Basic_Payment;
                    costpay.PayName = basePayment.PayName;
                    // 保存支付记录表数据
                    this.BindDb(costpay);
                    costpay.save();
                }
            }

            // 修改预交金表的结算ID
            NewDao <IIPManageDao>().CostDeposit(costHead.PatListID, costHead.CostHeadID, costHead.CostType, false);

            // 修改费用明细表数据的结算ID
            NewDao <IIPManageDao>().CostFeeItemRecord(costHead.PatListID, costHead.CostHeadID, costHead.CostType, false);

            // 出院结算和欠费结算的场合,修改病人状态
            if (costHead.CostType == 2 || costHead.CostType == 3)
            {
                NewDao <IIPManageDao>().UpdatePatStatus(costHead.PatListID, 4);
            }

            // 保存积分数据
            NewObject <MemberManagement>().SaveAddScoreList(costHead.MemberAccountID, costHead.TotalFee, 3, costHead.CostHeadID.ToString(), costHead.CostEmpID);
            // 写入优惠明细数据
            // 将结算主表ID写入优惠明细数据
            if (costHead.PromFee > 0)
            {
                // 生效优惠数据
                NewObject <PromotionManagement>().UpdateDiscountInfo(costHead.CostHeadID, resDiscountInfo.AccID);
            }

            return(string.Empty);
        }