//中途结算标记

        //protected bool MidBalanceFlag;
        ///// <summary>
        ///// 中途结算标记

        ///// </summary>
        //public bool IsMidwayBalance
        //{
        //    get
        //    {
        //        return MidBalanceFlag;
        //    }
        //    set
        //    {
        //        MidBalanceFlag = value;
        //    }
        //}



        /// <summary>
        /// 打印控件赋值
        /// </summary>
        /// <param name="Pinfo"></param>
        /// <param name="Pinfo"></param>
        /// <param name="al">balancelist数据</param>
        /// <param name="IsPreview">是否打印其余可显示部分</param>
        /// <returns></returns>
        protected int SetPrintValue(
            Neusoft.HISFC.Models.RADT.PatientInfo patientInfo,
            Neusoft.HISFC.Models.Fee.Inpatient.Balance balanceHead,
            ArrayList alBalanceList,
            bool IsPreview)
        {
            this.Controls.Clear();
            //如果费用明细为空,则返回
            if (alBalanceList.Count <= 0)
            {
                return(-1);
            }

            #region 克隆一个费用明细信息列表,因为后面操作需要对列表元素有删除操作.
            ArrayList alBalanceListClone = new ArrayList();
            foreach (Neusoft.HISFC.Models.Fee.Inpatient.BalanceList det in alBalanceList)
            {
                alBalanceListClone.Add(det.Clone());
            }
            #endregion

            Control c;

            if (this.InvoiceType == "ZY01")
            {
                c = new ucDianLiZY01();

                this.Controls.Add(c);
                this.Size = c.Size;
                this.InitReceipt();
                SetZY01PrintValue(patientInfo,
                                  balanceHead,
                                  alBalanceListClone,
                                  IsPreview);
            }
            else if (this.InvoiceType == "ZY02")
            {
                c = new ucDianLiZY02();
                this.Controls.Add(c);
                this.Size = c.Size;
                this.InitReceipt();
                SetZY02PrintValue(patientInfo,
                                  balanceHead,
                                  alBalanceListClone,
                                  IsPreview);
            }
            else if (this.InvoiceType == "ZY03")
            {
                c = new ucDianLiZY01();
                this.Controls.Add(c);
                this.Size = c.Size;
                this.InitReceipt();
                SetZY03PrintValue(patientInfo,
                                  balanceHead,
                                  alBalanceListClone,
                                  IsPreview);
            }
            //控制根据打印和预览显示选项
            if (IsPreview)
            {
                SetToPreviewMode();
            }
            else
            {
                SetToPrintMode();
            }
            return(0);
        }
        /// <summary>
        /// 打印控件赋值
        /// </summary>
        /// <param name="Pinfo"></param>
        /// <param name="Pinfo"></param>
        /// <param name="al">balancelist数据</param>
        /// <param name="IsPreview">是否打印其余可显示部分</param>
        /// <returns></returns>
        protected int SetZY02PrintValue(
            Neusoft.HISFC.Models.RADT.PatientInfo patientInfo,
            Neusoft.HISFC.Models.Fee.Inpatient.Balance balanceHead,
            ArrayList alBalanceList,
            bool IsPreview)
        {
            #region 设置自费发票打印内容
            ucDianLiZY02 ucReceipt = (ucDianLiZY02)this.Controls[0];

            #region 医疗机构
            ucReceipt.lblYiLiaoJiGou.Text = "辽宁电力中心医院";
            #endregion

            //基本信息
            //病案号
            ucReceipt.lblCaseNO.Text = patientInfo.PID.CaseNO;
            //结算日期
            ucReceipt.lblOperDate.Text = balanceHead.BalanceOper.OperTime.ToShortDateString();
            //姓名
            ucReceipt.lblName.Text = patientInfo.Name;

            //住院日期
            ucReceipt.lblInTime.Text  = patientInfo.PVisit.InTime.ToShortDateString();
            ucReceipt.lblOutTime.Text = patientInfo.PVisit.OutTime.ToShortDateString();
            ucReceipt.lblInDay.Text   = new TimeSpan(patientInfo.PVisit.OutTime.Ticks - patientInfo.PVisit.InTime.Ticks).Days.ToString();
            ////科室
            //ucReceipt.lblDeptName.Text = patientInfo.PVisit.PatientLocation.Dept.Name;

            //结算员
            ucReceipt.lblOperName.Text = balanceHead.BalanceOper.ID;

            ////操作员
            //ucReceipt.lblBalanceName.Text = balanceHead.Oper.ID;

            #region 医保信息
            decimal GeRenCost      = decimal.Zero;
            decimal TongChouCost   = decimal.Zero;
            decimal XianJinCost    = decimal.Zero;
            decimal GongWuYuanCost = decimal.Zero;
            decimal DaECost        = decimal.Zero;
            //个人账户支付
            GeRenCost = patientInfo.SIMainInfo.PayCost;
            if (GeRenCost > 0)
            {
                ucReceipt.lblGeRenCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(GeRenCost, 2);
            }
            //统筹基金支付
            TongChouCost = patientInfo.SIMainInfo.PubCost - patientInfo.SIMainInfo.OverCost - patientInfo.SIMainInfo.OfficalCost;
            if (TongChouCost > 0)
            {
                ucReceipt.lblTongChouCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(TongChouCost, 2);
            }
            //现金支付
            XianJinCost = patientInfo.SIMainInfo.OwnCost;
            if (XianJinCost > 0)
            {
                ucReceipt.lblXianJinCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(XianJinCost, 2);
            }
            //公务员补助
            //GongWuYuanCost = patientInfo.SIMainInfo.OfficalCost;
            //if (GongWuYuanCost > 0)
            //{
            //    ucReceipt.lblGongWuYuanCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(GongWuYuanCost, 2);
            //}
            //大额补助
            DaECost = patientInfo.SIMainInfo.OverCost;
            if (DaECost > 0)
            {
                ucReceipt.lblDaECost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(DaECost, 2);
            }
            #endregion
            //票面信息
            decimal[] FeeInfo =
                //---------------------1-----------2------------3------------4-------------5-----------------
                new decimal[23] {
                decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero,
                decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero,
                decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero,
                decimal.Zero, decimal.Zero, decimal.Zero,
                decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero, decimal.Zero
            };


            for (int i = 0; i < alBalanceList.Count; i++)
            {
                Neusoft.HISFC.Models.Fee.Inpatient.BalanceList detail = new Neusoft.HISFC.Models.Fee.Inpatient.BalanceList();
                detail = (Neusoft.HISFC.Models.Fee.Inpatient.BalanceList)alBalanceList[i];
                if (detail.FeeCodeStat.SortID <= FeeInfo.Length)
                {
                    FeeInfo[detail.FeeCodeStat.SortID - 1] += detail.BalanceBase.FT.TotCost;
                }
            }
            int FeeInfoIndex = 0;
            foreach (decimal d in FeeInfo)
            {
                Label l = Function.GetFeeNameLable("lblFeeInfo" + FeeInfoIndex.ToString(), ucReceipt);
                if (l != null)
                {
                    if (FeeInfo[FeeInfoIndex] > 0)
                    {
                        l.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(FeeInfo[FeeInfoIndex], 2);
                    }
                }
                FeeInfoIndex++;
            }
            //预收
            ucReceipt.lblPriPrepay.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(balanceHead.FT.PrepayCost, 2);
            //补收
            ucReceipt.lblPriSupply.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(balanceHead.FT.SupplyCost, 2);
            //退款
            ucReceipt.lblPriReturn.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(balanceHead.FT.ReturnCost, 2);

            ucReceipt.lblReceiptNo.Text = balanceHead.Invoice.BeginNO;
            if (balanceHead.FT.TotCost > 0)
            {
                ucReceipt.lblTotCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(balanceHead.FT.TotCost, 2);
            }
            #region 大写总金额

            ucReceipt.lblDaXie.Text = Function.GetUpperCashByNumber(Neusoft.FrameWork.Public.String.FormatNumber(balanceHead.FT.TotCost, 2));

            #endregion
            #endregion

            return(0);
        } /// <summary>