| 
					
				 | 
			
			
				@@ -154,6 +154,10 @@ namespace PTMedicalInsurance.Forms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (dgvHisSettlRec.SelectedIndex != -1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dgvHisSettlRec.Rows[dgvHisSettlRec.SelectedIndex].DefaultCellStyle.BackColor = Color.White; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 MessageBox.Show("对总账成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -174,17 +178,17 @@ namespace PTMedicalInsurance.Forms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             joCheck.insutype = dt.Rows[i]["insutype"].ToString();                       //险种类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             joCheck.clr_type = dt.Rows[i]["clr_type"].ToString();                       //清算类别             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (tbSettlOption.Text != "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                joCheck.setl_optins = tbSettlOption.Text; //dt.Rows[i]["setl_optins"].ToString();  //结算经办机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                setlOptins = tbSettlOption.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //if (tbSettlOption.Text != "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //    joCheck.setl_optins = tbSettlOption.Text; //dt.Rows[i]["setl_optins"].ToString();  //结算经办机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //    setlOptins = tbSettlOption.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 joCheck.setl_optins = dt.Rows[i]["setl_optins"].ToString();             //结算经办机构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 setlOptins = dt.Rows[i]["setl_optins"].ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             joCheck.medfee_sumamt = dt.Rows[i]["medfee_sumamt"].ToString();             //医疗费总额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             joCheck.fund_pay_sumamt = dt.Rows[i]["fund_pay_sumamt"].ToString();         //基金支付总额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             joCheck.acct_pay = dt.Rows[i]["acct_pay"].ToString();                       //个人账户支付金额 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1730,9 +1734,9 @@ namespace PTMedicalInsurance.Forms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //乘以单据类型后,IRIS会返回整数,关键不知道SQL里咋转换为浮点数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //string sqlStr = "SELECT SUM(BillType*Sumamt) AS medfee_sumamt,count(*) AS fixmedins_setl_cnt,SUM(BillType*PersonCashPay) AS cash_payamt, "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //sqlStr = sqlStr + " SUM(BillType*AccountPaySumamt) AS acct_pay,SUM(BillType*FundPaySumamt) AS fund_pay_sumamt "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //对账时个人账户=个人账户+共济账户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string sqlStr = "SELECT SUM(BillType*Sumamt) AS medfee_sumamt,count(*) AS fixmedins_setl_cnt,SUM(BillType*PersonCashPay) AS cash_payamt,  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            sqlStr = sqlStr + " SUM(billType*AccountPaySumamt) AS acct_pay,SUM(BillType*FundPaySumamt) AS fund_pay_sumamt "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sqlStr = sqlStr + " SUM(billType*(AccountPaySumamt+AccountMutualAidAmount)) AS acct_pay,SUM(BillType*FundPaySumamt) AS fund_pay_sumamt "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //sqlStr = sqlStr + " Interface_dr,clearingWay AS clr_way,clearingType AS clr_type "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 增加先行自付金额、医疗救助基金、公务员医疗补助、个人账户共济支付、企业补充、职工大额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sqlStr += ",Sum(BillType*PreSelfPayAmount) as PreSelfPayAmount,sum(BillType*MedicalAssistPay) as MedicalAssistPay,sum(BillType*CivilserviceAllowancePay) as CivilserviceAllowancePay,sum(BillType*AccountMutualAidAmount) as AccountMutualAidAmount ,sum(BillType*LargeExpensesSupplementPay) as LargeExpensesSupplementPay,sum(BillType*EnterpriseSupplementPay) as EnterpriseSupplementPay "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1764,7 +1768,7 @@ namespace PTMedicalInsurance.Forms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 conditionStr = conditionStr + " BillType,"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            sqlStr = sqlStr + " FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + dtInteface.Rows[i]["HospitalDr"].ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sqlStr = sqlStr + " FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sqlStr = sqlStr + " and OccurTime>'" + dpST.Text + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sqlStr = sqlStr + " and OccurTime<'" + dpED.Text + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1848,7 +1852,37 @@ namespace PTMedicalInsurance.Forms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void tsmCheck_Batch_Click(object sender, EventArgs e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            uiButton5_Click(sender, e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 批量对总账 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="sender"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="e"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void uiButton5_Click(object sender, EventArgs e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string errMsg = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bool success = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = 0; i < dgvSettlSummary.RowCount; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dgvSettlSummary.CurrentCell = dgvSettlSummary.Rows[i].Cells[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (Check_Single(out errMsg) != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dgvSettlSummary.Rows[i].DefaultCellStyle.BackColor = Color.Red; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    rtbCheckLog.AppendText("第" + (i + 1).ToString() + "条对账失败!" + errMsg + "\r\n"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    success = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (success) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MessageBox.Show("批量对账全部成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MessageBox.Show("部分对账失败,请查看对账结果!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |