/// <summary> /// 默认分发票 /// </summary> /// <param name="count">分票的张数</param> /// <param name="splitFlag">类型 1自动 0 自定义</param> public void AddInvoiceUnits(int count, string splitFlag) { //清空控件 ClearInvoicUnits(); int xPoint = 0, yPoint = 0; DateTime dtTempPrint = this.invoice.PrintTime; for (int i = 0; i < count; i++) { splitUnit = new ucSplitUnit(); if (Math.IEEERemainder(i, 2) == 0) { xPoint = 28; } else { xPoint = 16 * 2 + splitUnit.Width + 25; } yPoint = 14 + (i / 2) * (16 + splitUnit.Height); if (i > 0) { dtTempPrint = dtTempPrint.AddDays(this.days); } splitUnit.Location = new System.Drawing.Point(xPoint, yPoint); splitUnit.Name = "splitUnit" + i.ToString(); splitUnit.InvoiceDate = dtTempPrint; splitUnit.TabIndex = i + 1; splitUnit.CostChanged += new ucSplitUnit.ChangeCost(splitUnit_CostChanged); splitUnit.ModifyFinished += new ucSplitUnit.ChangeFocus(splitUnit_ModifyFinished); if (splitFlag == "1")//自动分发票 { splitUnit.IsLast = true; } else { if (i == count - 1) { splitUnit.IsLast = true; } else { splitUnit.IsLast = false; } } this.plSplitUnits.Controls.Add(splitUnit); } this.ucInvoicePreviewGF1.InvoiceType = invoiceType; ArrayList alTempInvoice = new ArrayList(); alTempInvoice.Add(invoice); ArrayList alTempInvoiceAndDetails = new ArrayList(); alTempInvoiceAndDetails.Add(alTempInvoice); ArrayList tempInvoiceDetails = new ArrayList(); ArrayList tempInvoiceDetailsTow = new ArrayList(); tempInvoiceDetailsTow.Add(invoiceDetails); tempInvoiceDetails.Add(tempInvoiceDetailsTow); alTempInvoiceAndDetails.Add(tempInvoiceDetails); this.ucInvoicePreviewGF1.InvoiceAndDetails = alTempInvoiceAndDetails; ArrayList tempSplit = new ArrayList(); decimal errorOwnCost = 0, errorPubCost = 0, errorTotCost = 0, errorPayCost = 0; //各项金额分票时得误差 decimal errCTFee = 0, errMRIFee = 0, errSXFee = 0, errSYFee = 0; //CT费等误差 decimal sumOwnCost = 0, sumPubCost = 0, sumTotCost = 0, sumPayCost = 0; //根据发票明细汇总得发票金额 Neusoft.HISFC.Models.Fee.Outpatient.Balance tempInvoice = null; Neusoft.HISFC.Models.Fee.Outpatient.BalanceList detailTemp = null; ArrayList invoiceDetailsSplit = new ArrayList(); ArrayList invoicesSplit = new ArrayList(); int iReturn = 0; for (int i = 0; i < count; i++) { ArrayList invoiceDetailsToInvoice = new ArrayList(); string beginTempInvoiceNo = ""; string beginTempRealInvoiceNo = ""; string errText = ""; if (invoiceNoType == "2")//普通模式需要Trans支持 { Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); this.feeIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); iReturn = this.feeIntegrate.GetNextInvoiceNO(invoiceNoType, beginInvoiceNo, beginRealInvoiceNo, ref beginTempInvoiceNo, ref beginTempRealInvoiceNo, i + 1, ref errText); if (iReturn < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(errText); this.plSplitUnits.Controls.Clear(); return; } Neusoft.FrameWork.Management.PublicTrans.RollBack();//因为此时不一定插入数据库,所以回滚,保持发票不跳号 } else { iReturn = this.feeIntegrate.GetNextInvoiceNO(this.invoiceNoType, beginInvoiceNo, this.beginRealInvoiceNo, ref beginTempInvoiceNo, ref beginTempRealInvoiceNo, i, ref errText); if (iReturn < 0) { MessageBox.Show(errText); return; } } foreach (Neusoft.HISFC.Models.Fee.Outpatient.BalanceList detail in invoiceDetails) { detailTemp = detail.Clone(); detailTemp.BalanceBase.FT.TotCost = Neusoft.FrameWork.Public.String.FormatNumber((detail.BalanceBase.FT.TotCost / (decimal)count), 2); detailTemp.BalanceBase.FT.PayCost = Neusoft.FrameWork.Public.String.FormatNumber((detail.BalanceBase.FT.PayCost / (decimal)count), 2); detailTemp.BalanceBase.FT.OwnCost = Neusoft.FrameWork.Public.String.FormatNumber((detail.BalanceBase.FT.OwnCost / (decimal)count), 2); detailTemp.BalanceBase.FT.PubCost = Neusoft.FrameWork.Public.String.FormatNumber((detail.BalanceBase.FT.PubCost / (decimal)count), 2); detailTemp.CTFee = Neusoft.FrameWork.Public.String.FormatNumber((detail.CTFee / (decimal)count), 2); detailTemp.MRIFee = Neusoft.FrameWork.Public.String.FormatNumber((detail.MRIFee / (decimal)count), 2); detailTemp.SXFee = Neusoft.FrameWork.Public.String.FormatNumber((detail.SXFee / (decimal)count), 2); detailTemp.SYFee = Neusoft.FrameWork.Public.String.FormatNumber((detail.SYFee / (decimal)count), 2); detailTemp.BalanceBase.Invoice.ID = beginTempInvoiceNo; errorOwnCost = detail.BalanceBase.FT.OwnCost - detailTemp.BalanceBase.FT.OwnCost * count; errorPubCost = detail.BalanceBase.FT.PubCost - detailTemp.BalanceBase.FT.PubCost * count; errorPayCost = detail.BalanceBase.FT.PayCost - detailTemp.BalanceBase.FT.PayCost * count; errorTotCost = detail.BalanceBase.FT.TotCost - detailTemp.BalanceBase.FT.TotCost * count; errCTFee = detail.CTFee - detailTemp.CTFee * count; errMRIFee = detail.MRIFee - detailTemp.MRIFee * count; errSXFee = detail.SXFee - detailTemp.SXFee * count; errSYFee = detail.SYFee - detailTemp.SYFee * count; if (i == 0) { detailTemp.BalanceBase.FT.TotCost = detailTemp.BalanceBase.FT.TotCost + errorTotCost; detailTemp.BalanceBase.FT.PayCost = detailTemp.BalanceBase.FT.PayCost + errorPayCost; detailTemp.BalanceBase.FT.OwnCost = detailTemp.BalanceBase.FT.OwnCost + errorOwnCost; detailTemp.BalanceBase.FT.PubCost = detailTemp.BalanceBase.FT.PubCost + errorPubCost; detailTemp.CTFee += errCTFee; detailTemp.MRIFee += errMRIFee; detailTemp.SXFee += errSXFee; detailTemp.SYFee += errSYFee; } invoiceDetailsToInvoice.Add(detailTemp); } invoiceDetailsSplit.Add(invoiceDetailsToInvoice); } for (int i = 0; i < count; i++) { tempInvoice = invoice.Clone(); string beginTempInvoiceNo = ""; string beginTempRealInvoiceNo = ""; string errText = ""; if (invoiceNoType == "2")//普通模式需要Trans支持 { Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); this.feeIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); iReturn = this.feeIntegrate.GetNextInvoiceNO(invoiceNoType, beginInvoiceNo, this.beginRealInvoiceNo, ref beginTempInvoiceNo, ref beginTempRealInvoiceNo, i + 1, ref errText); if (iReturn < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(errText); this.plSplitUnits.Controls.Clear(); return; } beginTempRealInvoiceNo = (Neusoft.FrameWork.Function.NConvert.ToInt32(beginTempRealInvoiceNo) - 1).ToString(); Neusoft.FrameWork.Management.PublicTrans.RollBack();//因为此时不一定插入数据库,所以回滚,保持发票不跳号 } else { iReturn = this.feeIntegrate.GetNextInvoiceNO(this.invoiceNoType, beginInvoiceNo, this.beginRealInvoiceNo, ref beginTempInvoiceNo, ref beginTempRealInvoiceNo, i, ref errText); if (iReturn < 0) { MessageBox.Show(errText); return; } } //重新计算金额 ArrayList invoiceDetailsTemp = invoiceDetailsSplit[i] as ArrayList; foreach (Neusoft.HISFC.Models.Fee.Outpatient.BalanceList detail in invoiceDetailsTemp) { sumOwnCost += detail.BalanceBase.FT.OwnCost; sumPubCost += detail.BalanceBase.FT.PubCost; sumPayCost += detail.BalanceBase.FT.PayCost; sumTotCost += detail.BalanceBase.FT.TotCost; } tempInvoice.FT.TotCost = sumTotCost; tempInvoice.FT.PayCost = sumPayCost; tempInvoice.FT.OwnCost = sumOwnCost; tempInvoice.FT.PubCost = sumPubCost; tempInvoice.Invoice.ID = beginTempInvoiceNo; tempInvoice.PrintedInvoiceNO = beginTempRealInvoiceNo; sumTotCost = 0; sumPayCost = 0; sumOwnCost = 0; sumPubCost = 0; invoicesSplit.Add(tempInvoice); } //添加信息到控件. for (int i = 0; i < count; i++) { try { ((ucSplitUnit)plSplitUnits.Controls[i]).Invoice = invoicesSplit[i] as Neusoft.HISFC.Models.Fee.Outpatient.Balance; ((ucSplitUnit)plSplitUnits.Controls[i]).InvoiceDetails = invoiceDetailsSplit[i] as ArrayList; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// 设置现金发票打印内容 /// </summary> /// <param name="regInfo">挂号信息</param> /// <param name="invoice">发票主表信息</param> /// <param name="alInvoiceDetail">发票明细信息</param> /// <param name="alFeeItemList">费用明细信息</param> /// <param name="isPreview">是否预览模式</param> /// <returns></returns> private int SetMZFPPrintValue( Neusoft.HISFC.Models.Registration.Register regInfo, Neusoft.HISFC.Models.Fee.Outpatient.Balance invoice, ArrayList alInvoiceDetail, ArrayList alFeeItemList, bool isPreview) { try { #region 设置发票打印内容 ucMZFP ucReceipt = (ucMZFP)c; #region 医疗机构 //ucReceipt.lblYiLiaoJiGou.Text = "阜新市新邱区第二人民医院"; #endregion #region 门诊号 ucReceipt.lblCardNO.Text = regInfo.PID.CardNO; ucReceipt.lblCardNO1.Text = regInfo.PID.CardNO; #endregion #region 打印时间 ucReceipt.lblDate.Text = invoice.PrintTime.ToString("yyyy MM dd"); ucReceipt.lblDateTime.Text = invoice.PrintTime.ToShortTimeString(); ucReceipt.lblDate1.Text = invoice.PrintTime.ToString("yyyy MM dd"); //ucReceipt.lblDateTime1.Text = invoice.PrintTime.ToShortTimeString(); #endregion #region 发票号 ucReceipt.lblInvoiceNO.Text = invoice.Invoice.ID; ucReceipt.lblInvoiceNO1.Text = invoice.Invoice.ID; #endregion #region 收费员 Neusoft.HISFC.BizLogic.Manager.Person person = new Neusoft.HISFC.BizLogic.Manager.Person(); string operUserCode = string.Empty; operUserCode = person.GetPersonByID(invoice.BalanceOper.ID).Name; ucReceipt.lblOperName.Text = operUserCode; ucReceipt.lblOperName1.Text = operUserCode; #endregion #region 合同单位 //if (invoice.Patient.Pact.PayKind.ID == "01" || invoice.Patient.Pact.PayKind.ID == "02") //{ ucReceipt.lblPactName.Text = regInfo.Pact.Name; ucReceipt.lblPactName1.Text = regInfo.Pact.Name; //} #endregion #region 姓名 ucReceipt.lblName.Text = regInfo.Name; ucReceipt.lblName1.Text = regInfo.Name; #endregion #region 科别 //Neusoft.HISFC.Models.Fee.Outpatient.FeeItemList detFeeItemList = alFeeItemList[0] as Neusoft.HISFC.Models.Fee.Outpatient.FeeItemList; //ucReceipt.lblExeDept.Text = detFeeItemList.ExecOper.Dept.Name; #endregion #region 处方医师 //ucReceipt.lblRecipeOperName.Text = regInfo.DoctorInfo.Templet.Dept .Name ; #endregion #region 费用大类 //票面信息 decimal[] FeeInfo = //---------------------1-----------2------------3------------4-------------5----------------- new decimal[15] { 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, decimal.Zero }; //票面信息 string[] FeeInfoName = //---------------------1-----------2------------3------------4-------------5----------------- new string[15] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, //string.Empty,string.Empty,string.Empty,string.Empty,string.Empty, //string.Empty,string.Empty,string.Empty,string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; //统计大类项目可以直接取 for (int i = 0; i < alInvoiceDetail.Count; i++) { Neusoft.HISFC.Models.Fee.Outpatient.BalanceList detail = null; detail = (Neusoft.HISFC.Models.Fee.Outpatient.BalanceList)alInvoiceDetail[i]; if (detail.FeeCodeStat.SortID <= FeeInfo.Length) { FeeInfo[detail.FeeCodeStat.SortID - 1] += detail.BalanceBase.FT.TotCost; if (detail.FeeCodeStat.Name.Length > 5) { FeeInfoName[detail.FeeCodeStat.SortID - 1] += detail.FeeCodeStat.Name.Substring(0, 5); } else { FeeInfoName[detail.FeeCodeStat.SortID - 1] += detail.FeeCodeStat.Name; } // FeeInfoName[detail.FeeCodeStat.SortID - 1] += detail.FeeCodeStat.Name.Substring(0,5); } } int feeInfoNameIdx = 0; int FeeInfoIndex = 0; foreach (decimal d in FeeInfo) {//测试用 //FeeInfo[FeeInfoIndex] = 999999.99m; //名称 Label lName = GetFeeNameLable("lblFeeName" + feeInfoNameIdx.ToString(), lblPrint); //值 Label lValue = GetFeeNameLable("lblFeeInfo" + feeInfoNameIdx.ToString(), lblPrint); if (lName != null) { if (FeeInfo[FeeInfoIndex] > 0) { //lName.Text = FeeInfoName[FeeInfoIndex] + "普通人工器官材料费"; //lName.Text = FeeInfoName[FeeInfoIndex] + ""; lValue.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(FeeInfo[FeeInfoIndex], 2).PadLeft(9, ' '); //操作下一组控件 if (FeeInfoIndex > 2) { alName.Add(FeeInfoName[FeeInfoIndex]); alValue.Add(Neusoft.FrameWork.Public.String.FormatNumberReturnString(FeeInfo[FeeInfoIndex], 2)); } else { drugTotCost += FeeInfo[FeeInfoIndex]; } } } //名称 lName = GetFeeNameLable("lbl1FeeName" + feeInfoNameIdx.ToString(), lblPrint); //值 lValue = GetFeeNameLable("lbl1FeeInfo" + feeInfoNameIdx.ToString(), lblPrint); if (lName != null) { if (FeeInfo[FeeInfoIndex] > 0) { //lName.Text = FeeInfoName[FeeInfoIndex] + "普通人工器官材料费"; //lName.Text = FeeInfoName[FeeInfoIndex] + ""; lValue.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(FeeInfo[FeeInfoIndex], 2).PadLeft(9, ' '); } } feeInfoNameIdx++; FeeInfoIndex++; } #endregion int otherIdx = 0; if (drugTotCost > 0) { ucReceipt.lblOtherInvoiceNO0.Text = invoice.Invoice.ID; ucReceipt.lblOtherName0.Text = regInfo.Name; ucReceipt.lblOtherDate0.Text = invoice.PrintTime.ToShortDateString(); ucReceipt.lblOtherDoctorInfoTempletDeptName0.Text = regInfo.DoctorInfo.Templet.Dept.Name; ucReceipt.lblOtherFeeName0.Text = "药费"; ucReceipt.lblOtherFeeInfo0.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(drugTotCost, 2).PadLeft(9, ' '); otherIdx++; } while (alName.Count > 0) { if (otherIdx < 3) { Label lName = GetFeeNameLable("lblOtherInvoiceNO" + otherIdx.ToString(), lblPrint); lName.Text = invoice.Invoice.ID; lName = GetFeeNameLable("lblOtherName" + otherIdx.ToString(), lblPrint); lName.Text = regInfo.Name; lName = GetFeeNameLable("lblOtherDate" + otherIdx.ToString(), lblPrint); lName.Text = invoice.PrintTime.ToShortDateString(); lName = GetFeeNameLable("lblOtherDoctorInfoTempletDeptName" + otherIdx.ToString(), lblPrint); lName.Text = regInfo.DoctorInfo.Templet.Dept.Name; lName = GetFeeNameLable("lblOtherFeeName" + otherIdx.ToString(), lblPrint); lName.Text = alName[0].ToString(); lName = GetFeeNameLable("lblOtherFeeInfo" + otherIdx.ToString(), lblPrint); lName.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(System.Convert.ToDecimal(alValue[0]), 2).PadLeft(9, ' '); otherIdx++; alName.RemoveAt(0); alValue.RemoveAt(0); } else { break; } } #region 医保信息 if (invoice.Patient.Pact.PayKind.ID == "02") { ucReceipt.lblSSN.Text = regInfo.SSN; ucReceipt.lblOwnCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.OwnCost, 2); ucReceipt.lblPayCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.PayCost, 2); ucReceipt.lblPubCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.PubCost, 2); ucReceipt.lblOverCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.OverCost, 2); ucReceipt.lblIndividualBalance.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.IndividualBalance, 2); ucReceipt.lblSSN1.Text = regInfo.SSN; ucReceipt.lblOwnCost1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.OwnCost, 2); ucReceipt.lblPayCost1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.PayCost, 2); ucReceipt.lblPubCost1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.PubCost, 2); //ucReceipt.lblOverCost1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.OverCost, 2); ucReceipt.lblIndividualBalance1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.IndividualBalance, 2); //-----1---------------------------2----------------3-----------------------4-----------------------5-----------------6---------------- //|医疗费总额TotCost|个人帐户支付金额PayCost|统筹支付金额PubCost|个人现金支付OwnCost|救助金支出金额OverCost|公务员补助支出金额OfficalCost //-----------------7------------------8-----------------------9----------- //|保健对象补贴支出BaseCost|离休人员统筹支出PubOwnCost|医院付担金额HosCost //-------------10-------------11----------------------12------------13------------------ //|上次进入统筹医疗费用累计|本次进入统筹医疗费用金额|上次个人帐户余额|个人自费金额 //----14---------------15-------------16--------------------------------17---------- //|乙类药品个人自理|起付标准自付金额|分段自理金额|超过封顶线个人自付金额|住院封顶线以上公务员补助支出金额 //----18---------------------------19------20--------------21-------------------- //|住院自付部分公务员补助支出金额|住院人次|工伤基金支付金额|生育基金支付金额| string[] temp = regInfo.SIMainInfo.Memo.Split('|'); ucReceipt.lblTemp20.Text = temp[20]; ucReceipt.lblTemp21.Text = temp[21]; ucReceipt.lbl1Temp20.Text = temp[20]; ucReceipt.lbl1Temp21.Text = temp[21]; ucReceipt.lblIndividualBalanceNew.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.IndividualBalance - regInfo.SIMainInfo.PayCost, 2); ucReceipt.lblIndividualBalanceNew1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(regInfo.SIMainInfo.IndividualBalance - regInfo.SIMainInfo.PayCost, 2); } #endregion #region 小写总金额 ucReceipt.lblDownTotCost.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(invoice.FT.TotCost, 2); ucReceipt.lblDownTotCost1.Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(invoice.FT.TotCost, 2); #endregion #region 大写总金额 ucReceipt.lblUpTotCost.Text = Neusoft.FrameWork.Public.String.LowerMoneyToUpper(invoice.FT.TotCost).PadLeft(10, ' '); ucReceipt.lblUpTotCost1.Text = Neusoft.FrameWork.Public.String.LowerMoneyToUpper(invoice.FT.TotCost).PadLeft(10, ' '); #endregion #endregion } catch (Exception ex) { return(-1); } return(0); }