Esempio n. 1
0
        public void m_getGovData(string StarDate, string EndDate)
        {
            DataTable dtGovData = new DataTable();

            Domain.m_lngGetPublicMoney(StarDate, EndDate, out dtGovData);
            dtStat.Clear();
            try
            {
                dtStat.Columns.Add("公费号");
                dtStat.Columns.Add("中药");
                dtStat.Columns.Add("中成药");
                dtStat.Columns.Add("西药");
                dtStat.Columns.Add("检查");
                dtStat.Columns.Add("治疗");
                dtStat.Columns.Add("诊金");
                dtStat.Columns.Add("自付比例");
            }
            catch
            {
            }
            #region 统计数据
            if (dtGovData.Rows.Count > 0)
            {
                Domain.m_lngGetGopRla(out dtCheck);
                string    filter = "";
                DataRow[] objRow;
//				string strPercent="";//当前发票的自付比例
                for (int i1 = 0; i1 < dtGovData.Rows.Count; i1++)
                {
//					#region 获取当前发票的自付比例
//					for(int L4=0;L4<arrPatType.Length/2;L4++)
//					{
//						if(arrPatType[L4,0]==dtGovData.Rows[i1]["PAYTYPEID_CHR"].ToString().Trim())
//						{
//							strPercent=arrPatType[L4,1];
//							break;
//						}
//					}
//					#endregion
                    string strType = dtGovData.Rows[i1]["GOVCARD_CHR"].ToString().Substring(0, 2).ToUpper();
                    for (int t1 = 0; t1 < arrAllMoney.Length / 2; t1++)
                    {
                        filter = "RPTID_CHR ='" + strReportID + "' and GROUPID_CHR ='" + arrAllMoney[t1, 0] + "'";
                        objRow = dtCheck.Select(filter);
                        if (objRow.Length > 0)
                        {
                            for (int f2 = 0; f2 < objRow.Length; f2++)
                            {
                                if (dtGovData.Rows[i1]["ITEMCATID_CHR"].ToString().Trim() == objRow[f2]["TYPEID_CHR"].ToString().Trim())
                                {
                                    if (dtStat.Rows.Count > 0)
                                    {
                                        //判断统计表中是否己经存在相同类型的数据
                                        for (int k3 = 0; k3 < dtStat.Rows.Count; k3++)
                                        {
                                            if (dtStat.Rows[k3]["公费号"].ToString() == strType && dtStat.Rows[k3]["自付比例"].ToString() == dtGovData.Rows[i1]["CHARGEPERCENT_DEC"].ToString().Trim())
                                            {
                                                //如果存在修改原来的数据
                                                dtStat.Rows[k3][arrAllMoney[t1, 1]] = Convert.ToDouble(dtStat.Rows[k3][arrAllMoney[t1, 1]]) + Convert.ToDouble(dtGovData.Rows[i1]["TOLFEE_MNY"]);
                                                break;
                                            }
                                            //如果不存在插入一项数据
                                            if (k3 == dtStat.Rows.Count - 1)
                                            {
                                                DataRow newRow = dtStat.NewRow();
                                                newRow["中药"]               = 0;
                                                newRow["中成药"]              = 0;
                                                newRow["西药"]               = 0;
                                                newRow["检查"]               = 0;
                                                newRow["治疗"]               = 0;
                                                newRow["诊金"]               = 0;
                                                newRow["公费号"]              = strType;
                                                newRow["自付比例"]             = dtGovData.Rows[i1]["CHARGEPERCENT_DEC"].ToString().Trim();
                                                newRow[arrAllMoney[t1, 1]] = dtGovData.Rows[i1]["TOLFEE_MNY"];
                                                dtStat.Rows.Add(newRow);
                                                break;
                                            }
                                        }
                                    }
                                    //如果统计表中没有任何的数据插入一项数据
                                    else
                                    {
                                        DataRow newRow = dtStat.NewRow();
                                        newRow["中药"]               = 0;
                                        newRow["中成药"]              = 0;
                                        newRow["西药"]               = 0;
                                        newRow["检查"]               = 0;
                                        newRow["治疗"]               = 0;
                                        newRow["诊金"]               = 0;
                                        newRow["公费号"]              = strType;
                                        newRow["自付比例"]             = dtGovData.Rows[i1]["CHARGEPERCENT_DEC"].ToString().Trim();
                                        newRow[arrAllMoney[t1, 1]] = dtGovData.Rows[i1]["TOLFEE_MNY"];
                                        dtStat.Rows.Add(newRow);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            #endregion
        }