public static string updateActualFee(ArrayList list) { ArrayList codeList = new ArrayList(); ArrayList actualFeeList = new ArrayList(); foreach (Dictionary <string, string> dict in list) { if (dict != null) { codeList.Add(dict["Id"].ToString()); actualFeeList.Add(dict["ApprovalNumber"].ToString()); } else { codeList.Add(""); actualFeeList.Add(""); } } string res = OperationDeliverSrv.updateActualFee(list); OperationDeliverSrv.UpdateOperationApprovalTime(codeList); // 插入一条数据到销售日表中 OperationDeliverSrv.insertSalesData(codeList); string[] msgs = res.Split(';'); DataTable dtUser = ReimbursementSrv.GetUserNameAndWxUserId(); WxCommon wx = new WxCommon("DeliverApplyReport", "vvsnJs9JYf8AisLWOE4idJbdR1QGc7roIcUtN6P2Lhc", "1000009", ""); for (int i = 0; i < msgs.Length - 1; i++) { SqlExceRes sqlRes = new SqlExceRes(msgs[i]); if (sqlRes.Result == SqlExceRes.ResState.Success) { Dictionary <string, string> dict = (Dictionary <string, string>)list[i]; string WxUserId = ""; foreach (DataRow row in dtUser.Rows) { if (row["userName"].ToString() == dict["ApprovalName"]) { WxUserId = row["wechatUserId"].ToString(); break; } } if (!string.IsNullOrEmpty(WxUserId)) { // 发送审批的消息给提交者 wx.SendWxMsg(WxUserId, "审批通知", "您编号为" + codeList[i] + "的发货单据已被运营部进行实发数量复审,审批人为:" + dict["ApprovalName"] + ",实发数量为" + actualFeeList[i] + ",请知悉" , "http://yelioa.top//mDeliverApplyReportAppRoval.aspx?type=0&docCode=" + codeList[i]); } } } return(res); }
/// <summary> /// 财务单据审批 /// </summary> /// <param name="list"> /// list元素为Dictionary<string,string>,其中key包含: /// 单据编号,code /// 审批人,approver /// 审批结果,ApprovalResult /// 审批意见,ApprovalOpinions /// 审批时间,approval_time /// 提交人, name /// </param> /// <returns> /// /// </returns> public static string Approval(ArrayList list) { // 记录code 因为下一步不更新code会把code删除 ArrayList codeList = new ArrayList(); foreach (Dictionary <string, string> dict in list) { if (dict != null) { codeList.Add(dict["code"].ToString()); } else { codeList.Add(""); } } string res = ReimbursementSrv.Approval(list); string[] msgs = res.Split(';'); DataTable dtUser = ReimbursementSrv.GetUserNameAndWxUserId(); WxCommon wx = new WxCommon("mMobileReimbursement", "UM0i5TXSIqQIOWk-DmUlfTqBqvZAfbZdGGDKiFZ-nRk", "1000006", ""); for (int i = 0; i < msgs.Length - 1; i++) { SqlExceRes sqlRes = new SqlExceRes(msgs[i]); if (sqlRes.Result == SqlExceRes.ResState.Success) { Dictionary <string, string> dict = (Dictionary <string, string>)list[i]; string WxUserId = ""; foreach (DataRow row in dtUser.Rows) { if (row["userName"].ToString() == dict["name"]) { WxUserId = row["wechatUserId"].ToString(); break; } } if (!string.IsNullOrEmpty(WxUserId)) { // 发送审批的消息给提交者 wx.SendWxMsg(WxUserId, "审批通知", "您编号为:" + codeList[i] + "的审批单据已被财务审批,审批人为:" + dict["account_approver"] + ",结果为:" + dict["account_result"] + ",意见为:" + dict["account_opinion"] + ",请知悉" , "http://yelioa.top/mMySubmittedReimburse.aspx?docCode=" + codeList[i]); } // 审批拒绝的需要把关联的发票一起拒绝 if ("拒绝" == dict["account_result"].ToString()) { string sql = string.Format("update yl_reimburse_detail set status = '拒绝', opinion = '关联的移动报销单据被拒绝' where code like '%{0}%'", codeList[i]); // 删除关联差旅申请 sql += string.Format("delete from wf_form_差旅申请 where reimburseCode = '{0}';", codeList[i]); // 删除关联借款单 并把借款单的金额还原 DataTable dt = SqlHelper.Find(string.Format("select * from yl_reimburse_loan where ReimburseCode = '{0}'", codeList[i])).Tables[0]; sql += string.Format("delete from yl_reimburse_loan where ReimburseCode = '{0}';", codeList[i]); foreach (DataRow dr in dt.Rows) { decimal amount = Decimal.Parse(dr["amount"].ToString()); string tempCode = dr["docCode"].ToString(); sql += string.Format("update wf_form_借款单 set remainAmount = remainAmount + {0} where docCode = '{1}';", amount, tempCode); } SqlHelper.Exce(sql); } } } return(res); }