private string getDocument() { string code = Request.Form["docCode"]; UserInfo user = (UserInfo)Session["user"]; // 查询这一级的审批人是否是该用户 DataSet checkApproverDt = ReimbursementManage.checkApprover(code, user.userId.ToString()); string msg = ""; if (checkApproverDt == null || checkApproverDt.Tables[0] == null || checkApproverDt.Tables[0].Columns.Count == 0 || checkApproverDt.Tables[0].Rows.Count == 0) { msg = "当前用户无审批权限"; return(JsonHelper.SerializeObject(msg)); } DataSet ds = ReimbursementManage.GetDocumnetsInfosByCode(code, user.userName); string res = "单据未找到或无权限查看该单据!"; if (ds != null && ds.Tables[0].Rows.Count > 0) { var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } res = JsonHelper.SerializeObject(dt); } return(res.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "")); }
private string getProcessInfoAndAttachment() { string docCode = Request.Form["docCode"]; DataTable dt = ReimbursementManage.getApproverByCode(docCode); DataTable recordDt = ReimbursementManage.getApprovalRecordCount(docCode); DataTable attachmentDt = ReimbursementManage.getAttachmentByCode(docCode); DataTable reimburseDetailDt = SqlHelper.Find(string.Format("select * from yl_reimburse_detail t1 left join yl_reimburse t2 on t1.code = t2.code where t2.id = '{0}'", docCode)).Tables[0]; JObject jObject = new JObject { { "data", JsonHelper.DataTable2Json(dt) }, { "count", JsonHelper.DataTable2Json(recordDt) }, { "attachment", JsonHelper.DataTable2Json(attachmentDt) }, { "detail", JsonHelper.DataTable2Json(reimburseDetailDt) } }; if (dt == null || dt.Columns.Count == 0) { return(""); } return(jObject.ToString()); }
private string getInfosRelatedToMe() { string sort = Request.Form["sort"]; string order = Request.Form["order"]; string keyword = Request.Form["keyword"]; string res = "F"; UserInfo user = (UserInfo)Session["user"]; if (user != null) { DataSet ds = ReimbursementManage.GetDocumnetsInfosRelatedToMe(user.userId.ToString(), keyword); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } res = JsonHelper.DataTableToJsonForEasyUiDataGridLoadDataMethod(dt); } } return(res.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "")); }
private string getInfos() { string sort = Request.Form["sort"]; string order = Request.Form["order"]; string keyword = Request.Form["keyword"]; int year = Convert.ToInt32(Request.Form["year"]); int month = Convert.ToInt32(Request.Form["month"]); string res = "F"; UserInfo user = (UserInfo)Session["user"]; if (user != null) { DataSet ds = ReimbursementManage.GetInfos(user.userName, keyword, year, month); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = PinYinHelper.SortByPinYin(ds.Tables[0], sort, order); foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } res = JsonHelper.DataTableToJsonForEasyUiDataGridLoadDataMethod(dt); } } return(res.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "")); }
//protected string exportExcel() //{ // string applystarttm = Request.Params["applystarttm"]; // string applyendtm = Request.Params["applyendtm"]; // string starttm = Request.Params["starttm"]; // string endtm = Request.Params["endtm"]; // string applyName = Request.Params["apply_name"]; // string depart = Request.Params["depart"]; // string fee_depart = Request.Params["fee_depart"]; // string fee_detail = Request.Params["fee_detail"]; // string account_status = Request.Form["account_status"]; // DataTable dt = ReimbursementManage.findByCond(applystarttm, applyendtm, starttm, endtm, applyName, depart, fee_depart, fee_detail, account_status, null); // JObject resultJObject = new JObject(); // if (dt == null || dt.Columns.Count == 0) // { // resultJObject.Add("msg", "暂无数据导出"); // } // else // { // string[] chineseHeaders = new string[] {"序号", "编号", "提交日期", "审批日期", "财务审批日期", // "提交人", "部门", "费用归属部门", "产品", "费用明细", "金额", "实报金额", "状态", "审批人", "财务审批人", "抄送人", "备注", "审批意见", "审批结果"}; // ExcelHelperV2_0.ExportByWeb(dt, "财务审批单据信息", "财务审批单据信息.xlsx", chineseHeaders); // resultJObject.Add("msg", "导出成功"); // } // return resultJObject.ToString(); //} //private string uploadBudgetFile() //{ // string res = "读取文件失败!"; // DataTable dt = ExcelHelperV2_0.Import(Request); // if (dt != null) // { // res=ReimbursementManage.uploadBudgetFile(dt); // } // return res; //} private string uploadFile() { string res = "上传成功!"; DataTable dt = ExcelHelperV2_0.Import(Request); UserInfo user = (UserInfo)Session["user"]; string sql = ""; if (dt != null) { List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); foreach (DataRow row in dt.Rows) { Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("code", row[0].ToString()); dict.Add("actual_fee_amount", row[1].ToString()); dict.Add("approver", user.userName.ToString()); dict.Add("actual_fee_amount_time", DateTime.Now); list.Add(dict); } string msg = ReimbursementManage.updateActualFee(list); } return(res); }
private string getBudget() { string docCode = Request.Form["docCode"]; string sql = "select * from yl_reimburse where id = " + docCode; DataTable dt = SqlHelper.Find(sql).Tables[0]; return(ReimbursementManage.IsOverBudget(dt.Rows[0]["fee_department"].ToString(), dt.Rows[0]["fee_detail"].ToString() , Convert.ToDouble(dt.Rows[0]["fee_amount"].ToString()), DateTime.Now).ToString()); }
private string getDocument() { string code = Request.Form["code"]; DataTable dt = ReimbursementManage.findByCode(code); foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } return(JsonHelper.DataTable2Json(dt)); }
protected string updateActualFee() { string codes = Request.Form["codes"]; List <string> codeList = JsonHelper.DeserializeJsonToObject <List <string> >(codes); string names = Request.Form["names"]; List <string> nameList = JsonHelper.DeserializeJsonToObject <List <string> >(names); string fees = Request.Form["actual_fee_amount"]; string originFees = Request.Form["originFees"]; UserInfo user = (UserInfo)Session["user"]; string approvalName = user.userName; List <string> originFeeList = new List <string>(); if (originFees != null) { originFeeList = JsonHelper.DeserializeJsonToObject <List <string> >(originFees); } List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); for (int i = 0; i < codeList.Count; i++) { Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("code", codeList[i]); if (originFees != null) { dict.Add("actual_fee_amount", originFeeList[i]); } else { dict.Add("actual_fee_amount", fees); } dict.Add("name", nameList[i]); dict.Add("approver", approvalName); list.Add(dict); } string msg = ReimbursementManage.updateActualFee(list); JObject resultJObject = new JObject(); resultJObject.Add("msg", msg); return(resultJObject.ToString()); }
private string getDocument() { string code = Request.Form["docCode"]; UserInfo user = (UserInfo)Session["user"]; DataSet ds = ReimbursementManage.GetDocumnetsInfosByCode(code, user.userName); string res = "单据未找到或无权限查看该单据!"; if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } res = JsonHelper.SerializeObject(dt); } return(res.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "")); }
private string cancel() { string docCode = Request.Form["code"]; UserInfo userInfo = (UserInfo)Session["user"]; string msg = ReimbursementManage.cancel(docCode, userInfo); JObject jObject = new JObject(); if (msg.Contains("操作成功")) { jObject.Add("ErrCode", "0"); } else { jObject.Add("ErrCode", "-1"); } return(jObject.ToString()); }
public string dataEchoed() { string docCode = Request.Form["docCode"]; DataTable dt = ReimbursementManage.findByCode(docCode); foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } // 再获取知悉人和图片 DataTable informerDt = MobileReimburseManage.findInformerByCode(docCode).Tables[0]; string informerId = informerDt.Rows[0]["userId"].ToString(); string informerName = informerDt.Rows[0]["userName"].ToString(); dt.Columns.Add("informerId", Type.GetType("System.String")); dt.Columns.Add("informerName", Type.GetType("System.String")); dt.Rows[0]["informerId"] = informerId; dt.Rows[0]["informerName"] = informerName; DataTable attachmentDt = MobileReimburseManage.findInformerByCode(docCode).Tables[1]; dt.Columns.Add("attachmentUrl", Type.GetType("System.String")); dt.Rows[0]["attachmentUrl"] = attachmentDt.Rows[0]["url"].ToString(); // 明细数据回调 DataTable tempDt = SqlHelper.Find(string.Format("select * from yl_reimburse_detail where code = '{0}'", docCode)).Tables[0]; dt.Columns.Add("reimburseDetail", Type.GetType("System.String")); dt.Rows[0]["reimburseDetail"] = JsonHelper.SerializeObject(tempDt); return(JsonHelper.DataTable2Json(dt)); }
private string getList() { UserInfo userInfo = (UserInfo)Session["user"]; string sort = Request.Form["sort"]; string order = Request.Form["order"]; string keyWord = Request.Form["keyword"]; DataTable dt = ReimbursementManage.GetDocumnetsInfosToBeSubmitedByMe(userInfo.userName, keyWord).Tables[0]; string res = "F"; if (dt != null && dt.Rows.Count > 0) { dt = PinYinHelper.SortByPinYin(dt, sort, order); foreach (DataRow dr in dt.Rows) { dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString()); } res = JsonHelper.DataTable2Json(dt); } return(res.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "")); }
private string approvalReimburse() { string docCode = Request.Form["docCode"]; string ApprovalResult = Request.Form["ApprovalResult"]; string ApprovalOpinions = Request.Form["ApprovalOpinions"]; UserInfo userInfo = (UserInfo)Session["user"]; string sql = "select * from yl_reimburse where id = " + docCode; DataTable dt = SqlHelper.Find(sql).Tables[0]; string code = dt.Rows[0]["code"].ToString(); // 查询这一级的审批人是否是该用户 DataSet checkApproverDt = ReimbursementManage.checkApprover(code, userInfo.userId.ToString()); string msg = ""; if (checkApproverDt == null || checkApproverDt.Tables[0] == null || checkApproverDt.Tables[0].Columns.Count == 0 || checkApproverDt.Tables[0].Rows.Count == 0) { msg = "当前用户无审批权限"; return(JsonHelper.SerializeObject(msg)); } //// 若提交时间超过当月25号 则不允许审批 // DateTime submitTime = Convert.ToDateTime(dt.Rows[0]["apply_time"]); // DateTime theTime = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-25" + " 00:00:00"); // if (submitTime > theTime) // { // msg = "该单据超过25号提交,暂无法审批!"; // return JsonHelper.SerializeObject(msg); // } //if (ApprovalResult == "同意" && dt.Rows[0]["IsOverBudget"].ToString() != "1") //{ // JObject j = ReimbursementManage.IsOverBudget(dt.Rows[0]["fee_department"].ToString(), dt.Rows[0]["fee_detail"].ToString(), Convert.ToDouble(dt.Rows[0]["fee_amount"].ToString()), DateTime.Now); // if (msg.Contains("预算余额不足")) // { // return JsonHelper.SerializeObject(msg); // } //} if (ApprovalResult == "同意" && dt.Rows[0]["isOverBudget"].ToString() != "1") { JObject res = ReimbursementManage.IsOverBudget(dt.Rows[0]["fee_department"].ToString(), dt.Rows[0]["fee_detail"].ToString(), Convert.ToDouble(dt.Rows[0]["fee_amount"].ToString()) , Convert.ToDateTime(dt.Rows[0]["apply_time"].ToString())); if (res == null || Convert.ToDouble(res["budget"]) < Convert.ToDouble(res["hasApprove"]) + Convert.ToDouble(dt.Rows[0]["fee_amount"].ToString())) { return(JsonHelper.SerializeObject("预算余额不足")); } } msg = ApprovalFlowManage.ApproveDocument("yl_reimburse", docCode, userInfo, ApprovalResult, ApprovalOpinions, "http://yelioa.top/mMySubmittedReimburse.aspx?docCode=" + code, "http://yelioa.top/mMobileReimbursement.aspx?docCode=" + code, "http://yelioa.top/mMySubmittedReimburse.aspx?docCode=" + code, "UM0i5TXSIqQIOWk-DmUlfTqBqvZAfbZdGGDKiFZ-nRk", "yl_reimburse", "1000006"); if ("审批流程结束".Equals(msg) || "审批拒绝!".Equals(msg)) { // 清除approval_process表中内容 MobileReimburseManage.clearApprovalProcess(docCode); // 更新审批时间 MobileReimburseManage.updateApprovalTimeAndResultAndOpinion(docCode, ApprovalResult, ApprovalOpinions); // 删除关联差旅申请 sql += string.Format("delete from wf_form_差旅申请 where reimburseCode = '{0}';", code); // 删除关联借款单 并把借款单的金额还原 dt = SqlHelper.Find(string.Format("select * from yl_reimburse_loan where ReimburseCode = '{0}'", code)).Tables[0]; sql += string.Format("delete from yl_reimburse_loan where ReimburseCode = '{0}';", code); 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(JsonHelper.SerializeObject(msg)); }
protected string approval() { string codes = Request.Form["codes"]; List <string> codeList = JsonHelper.DeserializeJsonToObject <List <string> >(codes); string names = Request.Form["names"]; List <string> nameList = JsonHelper.DeserializeJsonToObject <List <string> >(names); string account_approval_results = Request.Form["account_approval_results"]; List <string> accountApprovalResultList = JsonHelper.DeserializeJsonToObject <List <string> >(account_approval_results); string approvalOption = Request.Form["approvalOption"]; string approvalResult = Request.Form["approvalResult"]; UserInfo user = (UserInfo)Session["user"]; string approvalName = user.userName; ArrayList list = new ArrayList(); DataTable accountRecordDt = new DataTable(); accountRecordDt.Columns.Add("name", Type.GetType("System.String")); accountRecordDt.Columns.Add("code", Type.GetType("System.String")); accountRecordDt.Columns.Add("event", Type.GetType("System.String")); accountRecordDt.Columns.Add("lmt", Type.GetType("System.String")); for (int i = 0; i < codeList.Count; i++) { if (accountApprovalResultList[i] == null || "".Equals(accountApprovalResultList[i])) { Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("code", codeList[i]); dict.Add("account_approver", approvalName); dict.Add("account_result", approvalResult); dict.Add("account_opinion", approvalOption); dict.Add("name", nameList[i]); dict.Add("account_approval_time", DateTime.Now.ToShortDateString().ToString() + " " + DateTime.Now.ToLongTimeString().ToString()); list.Add(dict); DataRow accountRecordDr = accountRecordDt.NewRow(); accountRecordDr["name"] = approvalName; accountRecordDr["code"] = codeList[i]; accountRecordDr["event"] = "财务审批" + approvalResult; accountRecordDr["lmt"] = DateTime.Now.ToString(); accountRecordDt.Rows.Add(accountRecordDr); } } JObject resultJObject = new JObject(); if (list.Count == 0) { resultJObject.Add("msg", "所选单据都已审批,请重新选择"); } else { resultJObject.Add("msg", ReimbursementManage.Approval(list)); //财务审批的操作记录 ReimbursementManage.recordAccountEvent(accountRecordDt); } return(resultJObject.ToString()); }
protected string getFinancialApprovalData() { string starttm = Request.Form["starttm"]; string endtm = Request.Form["endtm"]; string applystarttm = Request.Form["applystarttm"]; string applyendtm = Request.Form["applyendtm"]; string apply_name = Request.Form["apply_name"]; string depart = Request.Form["depart"]; string fee_depart = Request.Form["fee_depart"]; string fee_detail = Request.Form["fee_detail"]; string account_status = Request.Form["account_status"]; string status = Request.Form["status"]; string sortName = Request.Form["sortName"]; string sortOrder = Request.Form["sortOrder"]; DataTable dt = ReimbursementManage.findByCond(applystarttm, applyendtm, starttm, endtm, apply_name, depart, fee_depart, fee_detail, account_status, status , sortName, sortOrder); if (dt == null) { return(null); } //DataTable res = dt.Clone(); //res.Columns["isPrepaid"].DataType = typeof(string); //res.Columns["isHasReceipt"].DataType = typeof(string); DataTable res = dt.Clone(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = res.NewRow(); row.ItemArray = dt.Rows[i].ItemArray; //foreach(DataColumn c in dt.Columns) //{ // if(c.ColumnName != "isPrepaid" && c.ColumnName != "isHasReceipt") // row[c.ColumnName] = dt.Rows[i][c.ColumnName]; //} //int val = 0; //if (dt.Rows[i]["isPrepaid"] == DBNull.Value) // row["isPrepaid"] = "否"; //else //{ // val = Convert.ToInt32(dt.Rows[i]["isPrepaid"]); // if (val == 1) // { // row["isPrepaid"] = "是"; // } // else // row["isPrepaid"] = "否"; //} //if (dt.Rows[i]["isHasReceipt"] == DBNull.Value) // row["isHasReceipt"] = "是"; //else //{ // val = Convert.ToInt32(dt.Rows[i]["isHasReceipt"]); // if (val == 1) // { // row["isHasReceipt"] = "是"; // } // else // row["isHasReceipt"] = "否"; //} row["remark"] = SqlHelper.DesDecrypt(dt.Rows[i]["remark"].ToString()); //row["receiptAmount"] = SqlHelper.Find(string.Format("select sum(amount) from yl_reimburse_detail_relevance where reimburseCode = '{0}'", dt.Rows[i]["code"])).Tables[0].Rows[0][0].ToString(); res.Rows.Add(row); } return(JsonHelper.DataTable2Json(res)); //NameValueCollection data = new NameValueCollection(); //data.Add("starttm", starttm); //data.Add("endtm", endtm); //data.Add("apply_name", apply_name); //data.Add("depart", depart); //data.Add("fee_depart", fee_depart); //data.Add("fee_detail", fee_detail); //data.Add("account_status", account_status); //data.Add("status", status); //data.Add("act", "getFinancialApprovalData"); //string res = HttpHelper.Post(YlTokenHelper.GetUrl() + "FinancialReimburseManage.aspx?Token=" // + YlTokenHelper.GetToken(), data); //return res; }
private string submitReimburse() { UserInfo user = (UserInfo)Session["user"]; string apply_time = Request.Form["apply_time"]; string product = Request.Form["product"]; string branch = Request.Form["branch"]; string fee_department = Request.Form["fee_department"]; string fee_company = Request.Form["fee_company"]; string fee_detail = Request.Form["fee_detail"]; string fee_amount = Request.Form["fee_amount"]; string file = Request.Form["file"]; string remark = SqlHelper.DesEncrypt(Request.Form["remark"]); string approver = Request.Form["approvers"]; string department = Request.Form["department"]; string informer = Request.Form["chooseInformerId"]; string approverData = Request.Form["approverData"]; string uploadFileUrls = Request.Form["uploadFileUrls"]; string docCode = Request.Form["docCode"]; string project = Request.Form["project"]; string isOverBudget = Request.Form["isOverBudget"];//是否是预算外的标志,1表示预算外,0表示预算内 string isPrepaid = Request.Form["isPrepaid"]; string isHasReceipt = Request.Form["isHasReceipt"]; string reimburseDetail = Request.Form["reimburseDetail"]; string travelCode = Request.Form["travelCode"]; string loanCode = Request.Form["loanCode"]; List <string> informerList = JsonHelper.DeserializeJsonToList <string>(informer); List <JObject> approverDataList = JsonHelper.DeserializeJsonToList <JObject>(approverData); List <string> uploadFileUrlsList = JsonHelper.DeserializeJsonToList <string>(uploadFileUrls); List <JObject> reimburseDetailList = JsonHelper.DeserializeJsonToList <JObject>(reimburseDetail); string msg = ""; JObject res = ReimbursementManage.IsOverBudget(fee_department, fee_detail, Convert.ToDouble(fee_amount) , Convert.ToDateTime(apply_time)); if (res == null || Convert.ToDouble(res["budget"]) >= Convert.ToDouble(res["hasApprove"]) + Convert.ToDouble(fee_amount) || isOverBudget == "1") { msg = MobileReimburseManage.insertMobileReimburse(apply_time, product, branch, fee_department, fee_detail, fee_amount, file, remark, user, approver, department, informerList, approverDataList, uploadFileUrlsList, docCode, project, isOverBudget, isPrepaid, isHasReceipt, reimburseDetailList, fee_company, travelCode, loanCode); } else { string code = GenerateDocCode.getReimburseCode(); if (department == null || "".Equals(department)) { department = MobileReimburseSrv.findDepartmentNameByWechatUserId(user.wechatUserId).Tables[0].Rows[0][0].ToString(); } if (string.IsNullOrEmpty(docCode)) { MobileReimburseSrv.insertMobileReimburse(code, apply_time, product, branch, fee_department, fee_detail, fee_amount, file, remark, user, approver, department, project, isOverBudget, isPrepaid, isHasReceipt, fee_company, ""); SqlHelper.Exce(string.Format("update yl_reimburse set status = '草稿' where code = '{0}'", code)); } msg = "本月预算为" + res["budget"].ToString() + ",已用" + res["hasApprove"].ToString() + ",预算不足,请减少申请金额或者走预算外报销申请," + code; } return(msg); }