Example #1
0
        public override void CellChanged(UFIDA.U8.UAP.UI.Runtime.Common.CellChangeEventArgs para, BusinessProxy businessObject, VoucherProxy voucherObject)
		{
			base.CellChanged(para, businessObject, voucherObject);
			if (para.ColumnName == "cBudgetItemID")
			{
				Business business = voucherObject.Businesses["27d9db0f-1099-4e02-a070-45fa6b11db89"];
				string currentPKValue = business.PrimaryKey;
				if (!string.IsNullOrEmpty(currentPKValue))
				{
                    if (para.NewHiddenValue == null && string.IsNullOrEmpty(para.NewHiddenValue.ToString()))
					{
						business.Rows[currentPKValue].Cells["cPayToken"].Value = ("");
					}
					else
					{
						VoucherSrv voucherSrv = new VoucherSrv();
                        string text = "select cToken from BG_V_ItemToken where cItemCode='" + para.NewHiddenValue.ToString() + "'";
						DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
                        if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
						{
                            DataRow dataRow = dataSet.Tables[0].Rows[0];
							business.Rows[currentPKValue].Cells["cPayToken"].Value = dataRow["cToken"] == null ? "" : dataRow["cToken"].ToString();
						}
					}
				}
			}
		}
Example #2
0
		public static Dictionary<string, CheckConfig> Init()
		{
			VoucherSrv voucherSrv = new VoucherSrv();
			DataSet dataSet = voucherSrv.ExcuteSqlInData("select sxml from u2_ZYsset where stype ='fxsrefset'");
			string text = null;
			try
			{
				if (dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
				{
					//text = dataSet.get_Tables().get_Item(0).get_Rows().get_Item(0).get_Item(0).ToString();
                    text = dataSet.Tables[0].Rows[0][0].ToString();
				}
			}
			catch (Exception var_3_73)
			{
			}
			if (string.IsNullOrEmpty(text))
			{
				throw new Exception("表u2_ZYsset的数据配置不正确");
			}
			Dictionary<string, CheckConfig> dictionary = new Dictionary<string, CheckConfig>();
			XDocument xDocument = XDocument.Parse(text);
			using (IEnumerator<XElement> enumerator = xDocument.Root.Elements().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
                    XElement current = enumerator.Current;
					CheckConfig checkConfig = new CheckConfig();
					string entityID = "";
					if (current.Name== "headref")
					{
						entityID = "12f73210-161b-4d45-94a0-6589e1ec7ae2";
					}
					else if (current.Name == "bodyref")
					{
						entityID = "a701a36d-ec4f-43c9-b95a-ef77d7600f57";
					}
					checkConfig.EntityID = entityID;
                    checkConfig.ChangedColName = current.Attribute("cfld").Value;
                    checkConfig.CheckSql = current.Attribute("checksql").Value;
					XElement xElement = current.Element("retflds");
					checkConfig.WriteCol = new Dictionary<string, string>();
					using (IEnumerator<XElement> enumerator2 = xElement.Elements().GetEnumerator())
					{
						while (enumerator2.MoveNext())
						{
                            XElement current2 = enumerator2.Current;
							checkConfig.WriteCol.Add(current2.Attribute("refkey").Value, current2.Attribute("vouchkey").Value);
						}
					}
					dictionary.Add(checkConfig.EntityID, checkConfig);
				}
			}
			return dictionary;
		}
Example #3
0
		public RefConsume(VoucherProxy _voucherObject, string CurUserID)
		{
			this.voucherObject = _voucherObject;
			this.InitializeComponent();
			RadGridView radGridView = (RadGridView)base.FindName("BHRadGrid");
            radGridView.Columns.Clear();
			this.gridDataSource = new List<GridCol_RefCon>();
			VoucherSrv voucherSrv = new VoucherSrv();
			string text = "select cs.cCardNO,cs.fConsumeAmount,cs.dConsumeDate,cs.subPrimaryKey,p.cPersonCode,p.cPersonName,cs.cConCusName,cs.cUse,cs.cBillNO from SWGW_Consumes cs join SWGW_Consume c on cs.foreignKey=c.mainPrimaryKey left join Person p on cs.cBXCode=p.cPersonCode where iIsExpensedB=0 and c.iverifystate=2";
			text = text + " and cs.cBXCode='" + CurUserID + "'";
			DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
			if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count > 0)
			{
                DataTable dataTable = dataSet.Tables[0];
				if (dataTable.Rows.Count > 0)
				{
					using (IEnumerator<DataRow> enumerator = dataTable.Rows.GetEnumerator())
					{
						while (enumerator.MoveNext())
						{
                            DataRow current = enumerator.Current;
							double 消费金额 = 0.0;
							double.TryParse(current["fConsumeAmount"], out 消费金额);
							this.gridDataSource.Add(new GridCol_RefCon
							{
								选择 = true,
								公务卡号 = current["cCardNO"],
								姓名 = current["cPersonName"],
								消费日期 = Convert.ToDateTime(current["dConsumeDate"]).ToString("yyyy-MM-dd"),
								消费金额 = 消费金额,
								ID = current["subPrimaryKey"],
								cPersonCode = current["cPersonCode"],
								商户名称 = current["cConCusName"],
								用途 = current["cUse"],
								支票号 = current["cBillNO"]
							});
						}
					}
					radGridView.ItemsSource = (this.gridDataSource);
				}
			}
		}
		public string Excuted(VoucherProxy ReceiptObject, string PreExcuteResult)
		{
			Business business = ReceiptObject.Businesses["27d9db0f-1099-4e02-a070-45fa6b11db89"];
			business.Clear();
			VoucherSrv voucherSrv = new VoucherSrv();
			string text = "select cs.cCardNO,cs.cBXCode,cs.cBillNO,cs.cConCusName,cs.cUse,ns.ExpenseMoney,n.ExpenseDate,p.cPersonName,ns.ID  ,bg.cItemCode,bg.cItemName,bgt.cToken from NE_ExpenseVouch_Sub ns join NE_ExpenVouch n on n.ID=ns.ExpenseVouchID  join SWGW_Consumes cs on cs.subPrimaryKey=ns.cNeDefine11   join Person p on cs.cBXCode=p.cPersonCode left join BG_V_CtrlItem bg on bg.cItemCode=ns.BudgetItemID left join BG_V_ItemToken bgt on bg.cItemCode=bgt.cItemCode where n.IVerifyState=2 and isnull(ns.cNeDefine12,'0')<>'1' and len(isnull(ns.cNeDefine11,''))>35";
			DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
			string result;
            if (dataSet == null || dataSet.Tables == null || dataSet.Tables.Count <= 0 || dataSet.Tables[0].Rows.Count <= 0)
			{
				result = this.MakeExcuteState(true, "");
			}
			else
			{
                DataTable dataTable = dataSet.Tables[0];
				using (IEnumerator<DataRow> enumerator = dataTable.Rows.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
                        DataRow current = enumerator.Current;
						string text2 = business.AddRow(-1);
						business.Rows[text2].Cells["cCardNO"].Value = (current["cCardNO"].ToString());
						business.FireCellChangeEvent(text2, "cBXCode", null, current["cBXCode"].ToString(), current["cPersonName"].ToString());
						business.Rows[text2].Cells["dPayDate"].Value = (current["ExpenseDate"].ToString());
						business.Rows[text2].Cells["fPayAmount"].Value = (current["ExpenseMoney"].ToString());
						business.Rows[text2].Cells["cBillNO"].Value = (current["cBillNO"].ToString());
						business.Rows[text2].Cells["cConCusName"].Value = (current["cConCusName"].ToString());
						business.Rows[text2].Cells["cUse"].Value = (current["cUse"].ToString());
                        business.Rows[text2].Cells["cExpenseDetailID"].Value = (current["ID"].ToString());
						if (current[("cItemCode")] != null && !string.IsNullOrEmpty(current["cItemCode"].ToString()))
						{
							business.FireCellChangeEvent(text2, "cBudgetItemID", null, current["cItemCode"].ToString(), current["cItemName"].ToString());
						}
						business.Rows[text2].Cells["cPayToken"].Value = ((current["cToken"] == null) ? "" : current["cToken"].ToString());
					}
				}
				result = this.MakeExcuteState(true, "");
			}
			return result;
		}
		private string getBugName(VoucherSrv srv, string bugID)
		{
			DataSet dataSet = srv.ExcuteSqlInData("select cItemName from BG_V_CtrlItem where cItemCode='" + bugID + "'");
			string result;
			if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count == 1 && dataSet.Tables[0].Rows.Count == 1)
			{
				result = dataSet.Tables[0].Rows[0][0].ToString();
			}
			else
			{
				result = "";
			}
			return result;
		}
		private void checkField(VoucherSrv srv, int iRNO, string field, ref string fieldName, string errdesc, string tableName, string idField, string nameField)
		{
			string text = string.Format("select {0} from {1} where {2}='{3}'", new object[]
			{
				nameField,
				tableName,
				idField,
				field
			});
			DataSet dataSet = srv.ExcuteSqlInData(text);
			if (dataSet == null || dataSet.Tables == null || dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0)
			{
				throw new Exception(errdesc + "编码对应数据不存在!");
			}
            if (dataSet.Tables[0].Rows.Count != 1)
			{
				throw new Exception(errdesc + "编码对应数据不唯一!");
			}
            object obj = dataSet.Tables[0].Rows[0][0];
            if (!string.IsNullOrEmpty(fieldName))
            {
                if (obj.ToString() != fieldName)
                {
                    throw new Exception(errdesc + "名称和编码对应的名称不一致!");
                }
            }
            else
            {
                fieldName = obj.ToString();
            }
		}
 //0姓名  1单位  2银行卡号  3收款银行及开户行  4省  5市  6身份证
 public void importPsn(VoucherSrv srv, string idCard, string name, string bankCardNO, string bankOpenAcc, string pvc, string city)
 {
     //exec P_SW_NE_CreatePsn '140101194910011234','党工','624311112222333','工行望京支行','sx','ty'
     string text = "exec P_SW_NE_CreatePsn '" + idCard + "','" + name + "','" + bankCardNO + "','" + bankOpenAcc + "','" + pvc + "','" + city + "'";
     DataSet dataSet = srv.ExcuteSqlInData(text);
 }
		public string Excute(VoucherProxy ReceiptObject, string PreExcuteResult)
		{
			Business bodys = ReceiptObject.Businesses["a701a36d-ec4f-43c9-b95a-ef77d7600f57"];
			Business head = ReceiptObject.Businesses["12f73210-161b-4d45-94a0-6589e1ec7ae2"];

            //voucherObject.Businesses["12f73210-161b-4d45-94a0-6589e1ec7ae2"].Cells["OperationTypeCode"].Value == "LWOCH"
            string operatorType = head.Cells["OperationTypeCode"].Value;
            Dictionary<string, string> dict = new Dictionary<string, string>();
            //dict.Add("LWTCH01", "0146"); //F_35
            //dict.Add("LWTCH02", "0126");//F_36
            //dict.Add("LWTCH03", "0046");//F_37
            //dict.Add("LWTCH04", "0005");//F_38
            //dict.Add("LWTCH05", "0047");//F_39

            //dict.Add("LWSTD", "0129");//F_76
            //dict.Add("LWOCH", "0130");//
            dict.Add("L", "0146"); //F_35
            dict.Add("W", "0126");//F_36
            dict.Add("T", "0046");//F_37
            dict.Add("C", "0005");//F_38
            dict.Add("H", "0047");//F_39

            dict.Add("S", "0129");//F_76
            dict.Add("O", "0130");//
            String defalutExpItemCode = null; 
            if (dict.ContainsKey(operatorType)) defalutExpItemCode = dict[operatorType];

            //if (head.Rows[0].RowData["ItemID"] == null)
            //{
            //    throw new Exception("请先录入项目!");
            //}
            //if (head.Rows[0].RowData["ItemID"].ToString() != "0126")
            //{
            //    throw new Exception("只有项目是【工资项目】支持导入!");
            //}

			OpenFileDialog openFileDialog = new OpenFileDialog();
			openFileDialog.Filter = ("Excel (*.xls)|*.xls");
			bool? flag = openFileDialog.ShowDialog();
			string result;
			if (!flag.GetValueOrDefault() || !flag.HasValue)
			{
				result = this.MakeExcuteState(true, "");
			}
			else
			{
				FileStream fileStream = openFileDialog.File.OpenRead();
				Workbook workbook = Workbook.Open(fileStream);
                Worksheet worksheet = workbook.Worksheets[0];
				int num = 3;
				if (worksheet.Cells.LastRowIndex < num) //从0开始
				{
					result = this.MakeExcuteState(true, "");
				}
				else
				{
					bodys.Clear();
					float num2 = 0f;
					VoucherSrv srv = new VoucherSrv();
					for (int i = num; i <= worksheet.Cells.LastRowIndex; i++)
					{
                        string stringValue_bh = worksheet.Cells[i, 0].StringValue_bh;
                        string stringValue_bh2 = worksheet.Cells[i, 1].StringValue_bh;
                        string stringValue_bh3 = worksheet.Cells[i, 2].StringValue_bh;
                        string stringValue_bh4 = worksheet.Cells[i, 3].StringValue_bh;
                        string stringValue_bh5 = worksheet.Cells[i, 4].StringValue_bh;
                        if (string.IsNullOrEmpty(stringValue_bh5))
                            stringValue_bh5 = worksheet.Cells[i, 4].StringValue;
                        string stringValue_bh6 = worksheet.Cells[i, 5].StringValue_bh;
                        string stringValue_bh7 = worksheet.Cells[i, 6].StringValue_bh;
                        string stringValue_bh8 = worksheet.Cells[i, 7].StringValue_bh;
                        string stringValue_bh9 = worksheet.Cells[i, 8].StringValue_bh;

                        string stringValue_bh10 = worksheet.Cells[i, 9].StringValue_bh;
                        string stringValue_bh11 = worksheet.Cells[i, 10].StringValue_bh;
						string rowpk = bodys.AddRow(-1);

                        if (defalutExpItemCode != null)
                        {
                            stringValue_bh6 = defalutExpItemCode;
                            stringValue_bh7 = null;
                        }

                        if (!string.IsNullOrEmpty(stringValue_bh8) && !string.IsNullOrEmpty(stringValue_bh9))
                            importPsn(srv, stringValue_bh8, stringValue_bh9, stringValue_bh10, stringValue_bh11, "北京", "北京");

						this.checkField_person(srv, i, stringValue_bh3, stringValue_bh4, "报销人", "Person", "cPersonCode", "cPersonName", bodys, rowpk, stringValue_bh);
						if (!string.IsNullOrEmpty(stringValue_bh))
						{
							this.checkField(srv, i, stringValue_bh, ref stringValue_bh2, "部门", "Department", "cDepCode", "cDepName");
						}
						this.checkField(srv, i, stringValue_bh6, ref stringValue_bh7, "费用项目", "ExpenseItem", "cExpCode", "cExpName");
						float num3 = 0f;
						if (!float.TryParse(stringValue_bh5.Replace(",", ""), out num3))
						{
							throw new Exception("excel文件中第" + i.ToString() + "行的金额不是数字格式!");
						}
						if ((double)num3 <= 0.01)
						{
							throw new Exception("金额不能为0!");
						}
						if (!string.IsNullOrEmpty(stringValue_bh))
						{
							bodys.FireCellChangeEvent(rowpk, "DeptID", null, stringValue_bh, stringValue_bh2);
						}
						bodys.FireCellChangeEvent(rowpk, "CostItemID", null, stringValue_bh6, stringValue_bh7);
						bodys.Rows[rowpk].Cells["ExpenseMoney"].Value = (num3.ToString());
                        bodys.Rows[rowpk].Cells["LocalMoney"].Value = (num3.ToString());
                        bodys.Rows[rowpk].Cells["cNeDefine13"].Value = stringValue_bh8;
                        bodys.Rows[rowpk].Cells["cNeDefine12"].Value = stringValue_bh9;
						num2 += num3;
					}
					head.Rows[0].Cells["ExpenseMoney"].Value = (num2.ToString());
                    head.Rows[0].Cells["LocalMoney"].Value = (num2.ToString());
					result = this.MakeExcuteState(true, "");
				}
			}
			return result;
		}
		private void checkField_person(VoucherSrv srv, int iRNO, string field, string fieldName, string errdesc, string tableName, string idField, string nameField, Business bodys, string pk, string depID)
		{
			string text = string.Format("select p.cDepCode,d.cDepName,p.cPersonName from Person p left join Department d on p.cDepCode=d.cDepCode where p.cPersonCode='{3}'", new object[]
			{
				nameField,
				tableName,
				idField,
				field
			});
			DataSet dataSet = srv.ExcuteSqlInData(text);
			if (dataSet == null || dataSet.Tables == null || dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0)
			{
				throw new Exception(errdesc + "编码对应数据不存在!");
			}
            if (dataSet.Tables[0].Rows.Count != 1)
			{
				throw new Exception(errdesc + "编码对应数据不唯一!");
			}
            DataRow dataRow = dataSet.Tables[0].Rows[0];
			object obj = dataRow[2];
			if (!string.IsNullOrEmpty(fieldName))
			{
				if (obj.ToString() != fieldName)
				{
					throw new Exception(errdesc + "名称和编码对应的名称不一致!");
				}
			}
			bodys.FireCellChangeEvent(pk, "ExpenserID", null, field, dataRow[2].ToString());
			if (string.IsNullOrEmpty(depID))
			{
				bodys.FireCellChangeEvent(pk, "DeptID", null, dataRow[0].ToString(), dataRow[1].ToString());
			}
		}
Example #10
0
 private void CalcBody_zzg(UFIDA.U8.UAP.UI.Runtime.Common.CellChangeEventArgs para, BusinessProxy businessObject, VoucherProxy voucherObject)
 {
     string entityID = businessObject.EntityID;
     if (NeExpense.config.ContainsKey(entityID))
     {
         CheckConfig checkConfig = NeExpense.config[(entityID)];
         if (checkConfig.ChangedColName == para.ColumnName)
         {
             VoucherSrv voucherSrv = new VoucherSrv();
             string text = checkConfig.CheckSql.Replace("@ret", para.NewValue);
             DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
             DataRow dataRow = null;
             if (dataSet != null && dataSet.Tables != null && dataSet.Tables[0] != null && dataSet.Tables[0].Rows.Count > 0)
             {
                 dataRow = dataSet.Tables[0].Rows[0];
             }
             if (dataRow != null)
             {
                 using (Dictionary<string, string>.KeyCollection.Enumerator enumerator = checkConfig.WriteCol.Keys.GetEnumerator())
                 {
                     while (enumerator.MoveNext())
                     {
                         string current = enumerator.Current;
                         businessObject.Cells[current].Value = dataRow[checkConfig.WriteCol[current]].ToString();
                     }
                 }
             }
         }
     }
 }
Example #11
0
        private void queryICBC(BusinessProxy businessObject, VoucherProxy voucherObject)
        {
            //queryICBC_QueryEnd(null, null);
            //return;
            UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-开始查询");
            string exposerID = businessObject.Cells["ExpenserID"].Value;
            if (string.IsNullOrEmpty(exposerID))
            {
                UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-报销人为空");
                return;
            }

            string date = businessObject.Cells[gwc_traceDateField].Value;
            string amountS = businessObject.Cells["ExpenseMoney"].Value;

            string card = null;
            string name = null;
            if (string.IsNullOrEmpty(date) || string.IsNullOrEmpty(amountS))
            {
                UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-日期或金额为空");
                return;
            }
            float famount = 0f;
            float.TryParse(amountS, out famount);
            if (famount < 0.001)
            {
                UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-金额小于0");
                return;
            }
            Int64 iamount = Convert.ToInt64(famount * 100);
            string amount = iamount.ToString();

            VoucherSrv voucherSrv = new VoucherSrv();
            string text = "select cPsn_Name,cbankaccount from hr_hi_Person j join  hr_hi_bankaccount a on j.cpsn_num=a.cpsn_num where j.cpsn_num='" + exposerID + "'";
            DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
            if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
            {
                DataRow dataRow = dataSet.Tables[0].Rows[0];
                card = dataRow["cbankaccount"].ToString(); 
                name = dataRow["cPsn_Name"].ToString(); 
            }

            if (string.IsNullOrEmpty(card) || string.IsNullOrEmpty(name))
            {
                UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-卡号或姓名为空");
                return;
            }
            UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-开始准备ICBC参数,date=" + date + ",amount=" + amount + ",card=" + card + ",name=" + name);
            QueryICBC query = new QueryICBC("GB2312", date, null, amount, card, name);
        //    public object businessObject { get; set; }
        //    public object voucherObject { get; set; }
            query.businessObject = businessObject;
            query.voucherObject = voucherObject;
            query.QueryEnd += new EventHandler(queryICBC_QueryEnd);
            query.QueryError += new EventHandler(query_QueryError);
            //query.QueryAsyn();
            query.QueryProxy();
            UAPDebug.WriteLine("", this, System.Reflection.MethodBase.GetCurrentMethod(), "公务卡-调用ICBC,异步结束");
        }
Example #12
0
        private void CalcBody_RefTypeVID(string exposerID, BusinessProxy businessObject, VoucherProxy voucherObject)
        {
            return;//身份证号手动录入不自动带了

            //15.6.25表体报销人带其它 信息。
            string exid = exposerID;
            if (!string.IsNullOrEmpty(exid))
            {
                VoucherSrv voucherSrv = new VoucherSrv();
                string text = "select vIDNo,rPersonType,vsimpleName from hr_hi_Person p left join hr_ct000 c on p.rPersonType=c.ccodeID where cpsn_num='" + exid + "'";
                DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
                if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    DataRow dataRow = dataSet.Tables[0].Rows[0];
                    //businessObject.Cells["cNeDefine12"].Value = dataRow["vsimpleName"].ToString(); //人员类别  15.7.15 改成姓名了。
                    businessObject.Cells["cNeDefine13"].Value = dataRow["vIDNo"].ToString(); //身份证
                }
            }
            else
            {
                //businessObject.Cells["cNeDefine12"].Value = null; //人员类别
                businessObject.Cells["cNeDefine13"].Value = null; //身份证
            }
        }
Example #13
0
 private void CalcBody_Tax_LWOTH(BusinessProxy businessObject, VoucherProxy voucherObject)
 {
     //Business body = voucherObject.Businesses["a701a36d-ec4f-43c9-b95a-ef77d7600f57"];
     Business head = voucherObject.Businesses["12f73210-161b-4d45-94a0-6589e1ec7ae2"];
     //15.6.25 劳务费外外聘时需要 表体根据报销金额,算税。
     string exid = businessObject.Cells["ExpenserID"].Value;
     string voucherid = head.Cells["ID"].Value;
     string amount = businessObject.Cells["ExpenseMoney"].Value;
     string cNeDefine13 = businessObject.Cells["cNeDefine13"].Value;
     if (!string.IsNullOrEmpty(exid) && !string.IsNullOrEmpty(amount) && !string.IsNullOrEmpty(cNeDefine13))
     {
         VoucherSrv voucherSrv = new VoucherSrv();
         string text = "exec P_SW_NE_CalcTax '" + exid + "','" + voucherid + "','" + amount + "','" + cNeDefine13 + "'";
         DataSet dataSet = voucherSrv.ExcuteSqlInData(text);
         if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
         {
             DataRow dataRow = dataSet.Tables[0].Rows[0];
             businessObject.Cells["cNeDefine22"].Value = dataRow[0].ToString(); //税额
             decimal damount = 0, dtax = 0,dpay = 0;
             decimal.TryParse(amount, out damount);
             decimal.TryParse(dataRow[0].ToString(), out dtax);
             dpay = damount - dtax;
             dpay = Math.Round(dpay, 2);
             businessObject.Cells["cNeDefine23"].Value = dpay.ToString("0.00"); //实发金额
         }
     }
 }
		private void GetNONameByBankAccount(VoucherSrv srv, string cardNO, out string no, out string name)
		{
			no = "";
			name = "";
			string text = "select distinct p.cPersonCode,p.cPersonName from Person p join HR_HI_BankAccount b  on p.cPersonCode=b.cPsn_Num where b.cBankAccount=";
			DataSet dataSet = srv.ExcuteSqlInData(text + "'" + cardNO + "'");
			if (dataSet != null && dataSet.Tables != null && dataSet.Tables.Count == 1 && dataSet.Tables[0].Rows.Count == 1)
			{
				no = dataSet.Tables[0].Rows[0][0];
                name = dataSet.Tables[0].Rows[0][1];
			}
		}
		public string Excuted(VoucherProxy ReceiptObject, string PreExcuteResult)
		{
			OpenFileDialog openFileDialog = new OpenFileDialog();
			openFileDialog.Filter = ("Excel (*.xls)|*.xls");
			bool? flag = openFileDialog.ShowDialog();
			string result;
			if (!flag.GetValueOrDefault() || !flag.HasValue)
			{
				result = this.MakeExcuteState(true, "");
			}
			else
			{
				FileStream fileStream = openFileDialog.File.OpenRead();
				Workbook workbook = Workbook.Open(fileStream);
                Worksheet worksheet = workbook.Worksheets[0];
				int num = 3;
				if (worksheet.Cells.LastRowIndex <= num)
				{
					result = this.MakeExcuteState(true, "");
				}
				else
				{
					Business business = ReceiptObject.Businesses["37291ff3-92b2-4009-831c-8f3b629906ec"];
					business.Clear();
					VoucherSrv srv = new VoucherSrv();
					for (int i = num; i <= worksheet.Cells.LastRowIndex; i++)
					{
                        string stringValue_bh = worksheet.Cells[i, 4].StringValue_bh;
                        string stringValue_bh2 = worksheet.Cells[i, 6].StringValue_bh;
                        string stringValue_bh3 = worksheet.Cells[i, 7].StringValue_bh;
                        string stringValue_bh4 = worksheet.Cells[i, 8].StringValue_bh;
                        string stringValue_bh5 = worksheet.Cells[i, 10].StringValue_bh;
                        string stringValue_bh6 = worksheet.Cells[i, 19].StringValue_bh;
                        string stringValue_bh7 = worksheet.Cells[i, 10].StringValue_bh;
                        string stringValue_bh8 = worksheet.Cells[i, 18].StringValue_bh;
                        string stringValue_bh9 = worksheet.Cells[i, 5].StringValue_bh;
						string text = business.AddRow(-1);
						business.Rows[text].Cells["cCardNO"].Value = (stringValue_bh);
						string value = string.Concat(new string[]
						{
							stringValue_bh2.Substring(0, 4),
							"-",
							stringValue_bh2.Substring(4, 2),
							"-",
							stringValue_bh2.Substring(6, 2),
							" ",
							stringValue_bh3.Substring(0, 2),
							":",
							stringValue_bh3.Substring(2, 2),
							":",
							stringValue_bh3.Substring(4, 2)
						});
						business.Rows[text].Cells["dConsumeDate"].Value = (value);
                        business.Rows[text].Cells["fConsumeAmount"].Value = (stringValue_bh4);
						string text2;
						string text3;
						this.GetNONameByBankAccount(srv, stringValue_bh, out text2, out text3);
						if (string.IsNullOrEmpty(text2))
						{
							throw new Exception("根据消费卡号【" + stringValue_bh + "】没有找到人员,请确认!");
						}
						if (stringValue_bh9 != text3)
						{
							throw new Exception("根据消费卡号【" + stringValue_bh + "】的持有人和U8系统中持有人不一致,请确认!");
						}
						business.Rows[text].Cells["cBXCode"].Value = (text2);
						business.Rows[text].Cells["cName"].Value = (text3);
						business.Rows[text].Cells["cConCusName"].Value = (stringValue_bh7);
						business.Rows[text].Cells["cUse"].Value = (stringValue_bh8);
                        business.Rows[text].Cells["cBillNO"].Value = (stringValue_bh6);
					}
					result = this.MakeExcuteState(true, "");
				}
			}
			return result;
		}