/// <summary> /// 获取实收现金部分 /// </summary> /// <param name="tbAllInvoiceList"></param> /// <returns></returns> private static FundPart GetCashPart(DataTable tbAllInvoiceList, DataTable tbAllInvoiceDetailList) { FundPart cashPart = new FundPart( ); object objSum = null; //实收现金 objSum = tbAllInvoiceList.Compute("SUM(money_fee)", ""); cashPart.TotalMoney = Convert.IsDBNull(objSum) ? 0 : Convert.ToDecimal(objSum); DataTable tbChargeInvoiceDetaiList = tbAllInvoiceDetailList.Clone( ); DataTable tbRegisterInvoiceDetaiList = tbAllInvoiceDetailList.Clone( ); //分开挂号和收费的明细 for (int i = 0; i < tbAllInvoiceDetailList.Rows.Count; i++) { int flag = Convert.ToInt32(tbAllInvoiceDetailList.Rows[i]["hang_flag"]); if (flag == 0) { tbRegisterInvoiceDetaiList.Rows.Add(tbAllInvoiceDetailList.Rows[i].ItemArray); } else { tbChargeInvoiceDetaiList.Rows.Add(tbAllInvoiceDetailList.Rows[i].ItemArray); } } //处方收费 FundInfo fundCharge = new FundInfo( ); fundCharge.PayName = "处方收费"; objSum = tbAllInvoiceList.Compute("Sum(money_fee)", "hang_flag = 1"); fundCharge.Money = Convert.IsDBNull(objSum) ? 0 : Convert.ToDecimal(objSum); //挂号收费 FundInfo fundRegFee = new FundInfo( ); fundRegFee.PayName = "挂号费"; objSum = tbRegisterInvoiceDetaiList.Compute("sum(total_fee)", "stat_item_code='05' and hang_flag=0 and money_fee<>0"); fundRegFee.Money = Convert.IsDBNull(objSum) ? 0 : Convert.ToDecimal(objSum); //挂号诊金 FundInfo fundExamine = new FundInfo( ); fundExamine.PayName = "诊查费"; objSum = tbRegisterInvoiceDetaiList.Compute("sum(total_fee)", "stat_item_code='06' and hang_flag=0 and money_fee<>0"); fundExamine.Money = Convert.IsDBNull(objSum) ? 0 : Convert.ToDecimal(objSum); cashPart.Details = new FundInfo[3]; cashPart.Details[0] = fundCharge; cashPart.Details[1] = fundRegFee; cashPart.Details[2] = fundExamine; return(cashPart); }
/// <summary> /// 获取记账部分 /// </summary> /// <param name="tbAllInvoiceList"></param> /// <returns></returns> private static FundPart GetTallyPart(DataTable tbAllInvoiceList) { List <FundInfo> lstFundInfo = new List <FundInfo>( ); decimal totalTally = 0; //按病人类型获取记账 DataTable PatientTypeList = BaseDataController.BaseDataSet[BaseDataCatalog.病人类型列表]; FundInfo[] fundPatType = new FundInfo[PatientTypeList.Rows.Count]; for (int i = 0; i < PatientTypeList.Rows.Count; i++) { fundPatType[i].PayCode = PatientTypeList.Rows[i]["PATTYPECODE"].ToString( ).Trim( ); fundPatType[i].PayName = PatientTypeList.Rows[i]["NAME"].ToString( ).Trim( ) + "_记账"; } for (int i = 0; i < fundPatType.Length; i++) { DataRow[] drsInvoice = tbAllInvoiceList.Select("meditype='" + fundPatType[i].PayCode + "'"); for (int j = 0; j < drsInvoice.Length; j++) { decimal tallyMoney = Convert.ToDecimal(drsInvoice[j]["village_fee"]); if (tallyMoney != 0) { fundPatType[i].BillCount = fundPatType[i].BillCount + 1; fundPatType[i].Money = fundPatType[i].Money + tallyMoney; totalTally = totalTally + tallyMoney; } } } lstFundInfo = fundPatType.ToList( ); //POS记账 FundInfo fundPos = new FundInfo( ); fundPos.BillCount = 0; fundPos.PayName = "POS金额"; //个人记账 FundInfo fundSelfTally = new FundInfo( ); fundSelfTally.PayName = "单位记账"; for (int i = 0; i < tbAllInvoiceList.Rows.Count; i++) { decimal posMoney = Convert.ToDecimal(tbAllInvoiceList.Rows[i]["pos_fee"]); decimal selfTallyMoney = Convert.ToDecimal(tbAllInvoiceList.Rows[i]["self_tally"]); if (posMoney != 0) { fundPos.BillCount = fundPos.BillCount + 1; fundPos.Money = fundPos.Money + posMoney; totalTally = totalTally + posMoney; } if (selfTallyMoney != 0) { fundSelfTally.BillCount = fundSelfTally.BillCount + 1; fundSelfTally.Money = fundSelfTally.Money + selfTallyMoney; totalTally = totalTally + selfTallyMoney; } } lstFundInfo.Add(fundPos); lstFundInfo.Add(fundSelfTally); FundPart tallyPart = new FundPart( ); tallyPart.TotalMoney = totalTally; tallyPart.Details = lstFundInfo.ToArray( ); return(tallyPart); }