protected string getInfo()
    {
        string   sort    = Request.Form["sort"];
        string   order   = Request.Form["order"];
        string   keyword = Request.Form["keyword"];
        string   year    = Request.Form["year"];
        int      month   = Convert.ToInt32(Request.Form["month"]);
        string   res     = "F";
        UserInfo user    = (UserInfo)Session["user"];

        if (user != null)
        {
            DataTable dt = MobileReimburseManage.findApprovalRecord(user, keyword, year, month);
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["remark"] = SqlHelper.DesDecrypt(dr["remark"].ToString());
                }

                dt  = PinYinHelper.SortByPinYin(dt, sort, order);
                res = JsonHelper.DataTableToJsonForEasyUiDataGridLoadDataMethod(dt);
            }
        }
        return(res.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", ""));
    }
Exemple #2
0
    private string findRemoteData()
    {
        string type  = Request.Form["type"];
        string value = Request.Form["value"];

        DataTable dt = null;

        if ("用户表".Equals(type))
        {
            dt = MobileReimburseManage.findInformer(value);
        }
        else if ("部门表".Equals(type))
        {
            dt = MobileReimburseManage.findFeeDepartment("");
        }
        else if ("产品表".Equals(type))
        {
            dt = MobileReimburseManage.findProduct(value, null, "");
        }
        else if ("费用明细表".Equals(type))
        {
            dt = MobileReimburseManage.findParentFeeDetail("", "");
        }
        else if ("网点表".Equals(type))
        {
            dt = MobileReimburseManage.findBranch(value, null, "");
        }

        return(JsonHelper.DataTable2Json(dt));
    }
    private string getStatistics()
    {
        string   type  = Request.Form["type"];
        int      year  = Convert.ToInt32(Request.Form["year"]);
        int      month = Convert.ToInt32(Request.Form["month"]);
        UserInfo user  = (UserInfo)Session["user"];

        return(MobileReimburseManage.accountSelfStatistics(user.userName.ToString(), year, month, type));
    }
Exemple #4
0
    private string findInformer()
    {
        string informer = Request.Form["name"];

        DataTable dt = MobileReimburseManage.findInformer(informer);

        if (dt == null)
        {
            return(null);
        }
        return(JsonHelper.DataTable2Json(dt));
    }
Exemple #5
0
    private string findFeeDepartment()
    {
        string feeDepartment = Request.Form["name"];

        DataTable dt = MobileReimburseManage.findFeeDepartment(feeDepartment);

        if (dt == null)
        {
            return(null);
        }

        return(JsonHelper.DataTable2Json(dt));
    }
Exemple #6
0
    private string checkMultiDepartment()
    {
        UserInfo user = (UserInfo)Session["user"];

        DataTable dt = MobileReimburseManage.checkMultiDepartment(user);

        if (dt == null)
        {
            return(null);
        }

        return(JsonHelper.DataTable2Json(dt));
    }
Exemple #7
0
    private string findFeeDetail()
    {
        string feeDetail  = Request.Form["name"];
        string department = Request.Form["department"];
        string product    = Request.Form["product"];

        DataTable dt = MobileReimburseManage.findParentFeeDetail(department, product);

        if (dt == null)
        {
            return(null);
        }

        return(JsonHelper.DataTable2Json(dt));
    }
Exemple #8
0
    private string findBranch()
    {
        string branch         = Request.Form["name"];
        string departmentName = Request.Form["department"];
        List <DepartmentPost> departmentList = (List <DepartmentPost>)Session["DepartmentPostList"];

        //DataTable dt = MobileReimburseManage.findBranch(branch, departmentList, departmentName);
        UserInfo  user = (UserInfo)Session["user"];
        DataTable dt   = MobileReimburseManage.FindClient((user.userId), branch);

        if (dt == null)
        {
            return(null);
        }

        return(JsonHelper.DataTable2Json(dt));
    }
Exemple #9
0
    private string findProductName()
    {
        string productName    = Request.Form["name"];
        string departmentName = Request.Form["department"];
        List <DepartmentPost> departmentList = (List <DepartmentPost>)Session["DepartmentPostList"];

        //DataTable dt = MobileReimburseManage.findProduct(productName, departmentList, departmentName);
        UserInfo  user = (UserInfo)Session["user"];
        DataTable dt   = MobileReimburseManage.FindProduct(Convert.ToInt32(user.userId), productName);

        if (dt == null)
        {
            return(null);
        }

        return(JsonHelper.DataTable2Json(dt));
    }
Exemple #10
0
    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));
    }
    public 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)
        {
            DataTable dt = MobileReimburseManage.findRelatedReimburse(user, keyword);
            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.DataTableToJsonForEasyUiDataGridLoadDataMethod(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));
    }
Exemple #13
0
    public string getProcessInfo()
    {
        UserInfo user            = (UserInfo)Session["user"];
        string   feeDetail       = Request.Form["feeDetail"];
        double   feeAmount       = Double.Parse(Request.Form["feeAmount"]);
        string   feeDepartment   = Request.Form["feeDepartment"];
        string   department      = Request.Form["department"];
        string   isOverBudget    = Request.Form["isOverBudget"];//是否是预算外的标志,1表示预算外,0表示预算内
        int      feeDepartmentId = 0;

        if (feeDepartment != null && !"".Equals(feeDepartment))
        {
            feeDepartmentId = Int32.Parse(MobileReimburseManage.findDepartmentIdByName(feeDepartment).Rows[0][0].ToString());
        }

        if (feeDepartmentId == 0)
        {
            string self_wechatUserId = user.wechatUserId;

            feeDepartmentId = Int32.Parse(MobileReimburseSrv.findDepartmentByWechatUserId(self_wechatUserId).Tables[0].Rows[0][0].ToString());
        }

        int departmentId = 0;

        if (department != null && !"".Equals(department))
        {
            departmentId = Int32.Parse(MobileReimburseManage.findDepartmentIdByName(department).Rows[0][0].ToString());
        }

        JArray jobjectList = new JArray();

        string leaders = MobileReimburseManage.confirmApprovalProcess(ref jobjectList, feeDepartmentId, feeDetail, feeAmount, user, departmentId);

        //预算外添加总经理和财务总监两级审批
        if (isOverBudget == "1")
        {
            //总经理
            JObject topManager = new JObject();
            topManager.Add("name", "吕正和");
            topManager.Add("userId", "100000142");
            jobjectList.Insert(1, topManager);
            //财务总监
            JObject chiefFinancialOfficer = new JObject();
            chiefFinancialOfficer.Add("name", "张代俊");
            chiefFinancialOfficer.Add("userId", "100000324");
            jobjectList.Insert(1, chiefFinancialOfficer);
        }

        leaders = "";
        for (int i = 0; i < jobjectList.Count; i++)
        {
            JObject jObjectForIndex = (JObject)jobjectList[i];

            if (i > 0)
            {
                leaders += jObjectForIndex["name"] + ",";
            }

            jObjectForIndex.Add("index", i);
        }

        JObject jObject = new JObject();

        jObject.Add("leaders", leaders);
        jObject.Add("selfName", user.userName);
        jObject.Add("approverData", jobjectList);
        return(jObject.ToString());
    }
Exemple #14
0
    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);
    }