Пример #1
0
    public static string insertDemandApplyReport(string hospitalName, string netSales, string stock,
                                                 string productName, string agentName, string spec, string unit, string applyNumber, string remark, UserInfo userInfo, List <string> approverList, List <string> informerList)
    {
        // 通过产品名 规格 单位来确定产品代码
        DataSet productDs = DemandApplyReportSrv.findProductCode(productName, spec, unit);

        string productCode = "";

        if (productDs != null && productDs.Tables[0].Rows.Count > 0)
        {
            productCode = productDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过医院名来确定医院代码
        DataSet hospitalDs = DemandApplyReportSrv.findHospitalCode(hospitalName);

        string hospitalCode = "";

        if (hospitalDs != null && hospitalDs.Tables[0].Rows.Count > 0)
        {
            hospitalCode = hospitalDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过代理商名称来确定代理商编码
        DataSet agentDs = DeliverApplyReportSrv.findAgentCode(agentName);

        string agentCode = "";

        if (agentDs != null && agentDs.Tables[0].Rows.Count > 0)
        {
            agentCode = agentDs.Tables[0].Rows[0][0].ToString();
        }

        string data = DemandApplyReportSrv.insertDemandApplyReport(hospitalCode, productCode, agentCode, applyNumber, remark, userInfo, netSales, stock);
        string id   = JsonHelper.DeserializeJsonToObject <JObject>(data)["Id"].ToString();

        // 新增审批人到审批流程表中
        List <JObject> list = new List <JObject>();

        for (int i = 0; i < approverList.Count; i++)
        {
            JObject jO = new JObject();
            jO.Add("index", i);
            jO.Add("userId", approverList[i]);

            list.Add(jO);
        }

        MobileReimburseSrv.insertApprovalProcess(id, list, "demand_apply_report");

        DataSet maxIdDt = DemandApplyReportSrv.findMaxId();
        string  docCode = maxIdDt.Tables[0].Rows[0][0].ToString();

        // 审批单提交
        ApprovalFlowManage.SubmitDocument("demand_apply_report", docCode, userInfo,
                                          "http://yelioa.top//mDemandApplyReportAppRoval.aspx?type=0&docCode=" + docCode, "http://yelioa.top//mDemandApplyReportAppRoval.aspx?type=1&docCode=" + docCode,
                                          "AirlZ8lfY50d1KGDklHPQcLV2RUFAdrhD-WXU23cA-w", "DemandApplyReport", "1000013");

        // 新增知悉人到表
        DemandApplyReportSrv.insertInformer(docCode, informerList);

        return("提交成功");
    }
    //public static string findSpecAndUnit(string name)
    //{
    //    DataSet ds = DeliverApplyReportSrv.findSpecAndUnit(name);

    //    if (ds == null || ds.Tables[0].Rows.Count == 0)
    //        return null;

    //    DataTable specDt = new DataTable();
    //    specDt.Columns.Add("value", Type.GetType("System.String"));
    //    specDt.Columns.Add("target", Type.GetType("System.String"));

    //    DataTable unitDt = new DataTable();
    //    unitDt.Columns.Add("value", Type.GetType("System.String"));
    //    unitDt.Columns.Add("target", Type.GetType("System.String"));

    //    List<string> specList = new List<string>();
    //    List<string> unitList = new List<string>();

    //    foreach (DataRow row in ds.Tables[0].Rows)
    //    {
    //        if (row["specification"] != null && !specList.Contains(row["specification"].ToString()))
    //        {
    //            DataRow specDr = specDt.NewRow();
    //            specDr["value"] = row["specification"];
    //            specDr["target"] = row["specification"];

    //            specDt.Rows.Add(specDr);

    //            specList.Add(row["specification"].ToString());
    //        }

    //        if (row["unit"] != null && !unitList.Contains(row["unit"].ToString()))
    //        {
    //            DataRow unitDr = unitDt.NewRow();
    //            unitDr["value"] = row["unit"];
    //            unitDr["target"] = row["unit"];

    //            unitDt.Rows.Add(unitDr);

    //            unitList.Add(row["unit"].ToString());
    //        }
    //    }

    //    JObject jObject = new JObject();

    //    jObject.Add("specJson", JsonHelper.DataTable2Json(specDt));
    //    jObject.Add("unitJson", JsonHelper.DataTable2Json(unitDt));

    //    return jObject.ToString();
    //}

    public static string insertDeliverApplyReport(string deliverType, string hospitalName,
                                                  string productName, string agentName, string spec, string unit, string applyNumber, string remark, UserInfo userInfo,
                                                  List <string> approverList, List <string> informerList, List <string> uploadFileUrlsList,
                                                  string stock, string netSales, string period, string isStockReceiptTogether, string deliverAddress, string deliverName, string deliverPhone)
    {
        // 通过产品名 规格 单位来确定产品代码
        DataSet productDs = DeliverApplyReportSrv.findProductCode(productName, spec, unit);

        string productCode = "";

        if (productDs != null && productDs.Tables[0].Rows.Count > 0)
        {
            productCode = productDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过医院名来确定医院代码
        DataSet hospitalDs = DeliverApplyReportSrv.findHospitalCode(hospitalName);

        string hospitalCode = "";

        if (hospitalDs != null && hospitalDs.Tables[0].Rows.Count > 0)
        {
            hospitalCode = hospitalDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过代理商名称来确定代理商编码
        DataSet agentDs = DeliverApplyReportSrv.findAgentCode(agentName);

        string agentCode = "";

        if (agentDs != null && agentDs.Tables[0].Rows.Count > 0)
        {
            agentCode = agentDs.Tables[0].Rows[0][0].ToString();
        }

        string data = DeliverApplyReportSrv.insertDeliverApplyReport(deliverType, hospitalCode, productCode, agentCode, applyNumber,
                                                                     remark, userInfo, stock, netSales, period, isStockReceiptTogether, deliverAddress, deliverName, deliverPhone);

        string id = JsonHelper.DeserializeJsonToObject <JObject>(data)["Id"].ToString();

        // 新增审批人到审批流程表中
        List <JObject> list = new List <JObject>();

        if (Double.Parse(applyNumber) > ((Double.Parse(netSales) / 30 * Double.Parse(period)) - Double.Parse(stock)))
        {
            approverList.Insert(1, "100000645");
        }

        for (int i = 0; i < approverList.Count; i++)
        {
            JObject jO = new JObject();

            jO.Add("index", i);
            jO.Add("userId", approverList[i]);

            list.Add(jO);
        }

        MobileReimburseSrv.insertApprovalProcess(id, list, "deliver_apply_report");

        // 审批单提交
        ApprovalFlowManage.SubmitDocument("deliver_apply_report", id, userInfo,
                                          "http://yelioa.top//mDeliverApplyReportAppRoval.aspx?type=0&docCode=" + id, "http://yelioa.top//mDeliverApplyReportAppRoval.aspx?type=1&docCode=" + id,
                                          "vvsnJs9JYf8AisLWOE4idJbdR1QGc7roIcUtN6P2Lhc", "DeliverApplyReport", "1000009");

        // 新增知悉人到表
        DeliverApplyReportSrv.insertInformer(id, informerList);

        if (uploadFileUrlsList != null && uploadFileUrlsList.Count > 0)
        {
            DeliverApplyReportSrv.insertAttachement(id, uploadFileUrlsList);
        }

        //// 新增一条记录到审批记录表中
        //DeliverApplyReportSrv.insertDeliverAppyReportRecord("0", userInfo.wechatUserId, userInfo.wechatUserId, "发货申请单提交", "");

        //// 给待审批人发送消息
        //WxNetSalesHelper wxNetSalesHelper = new WxNetSalesHelper();

        //wxNetSalesHelper.GetJsonAndSendWxMsg(approverIds, "请及时审批 提交人为:" + userInfo.userName
        //    + "的发货申请单,谢谢!", "http://yelioa.top/mNetSalesApproval.aspx?type=others");
        //// 给提交人发送消息
        //wxNetSalesHelper.GetJsonAndSendWxMsg(userInfo.wechatUserId, "您的发货申请单已提交,请点击查看", "http://yelioa.top/mNetSalesApproval.aspx?type=mine");

        return("提交人");
    }
Пример #3
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());
    }
Пример #4
0
 public static string cancel(string code, UserInfo userInfo)
 {
     return(MobileReimburseSrv.cancel(code, userInfo));
 }
Пример #5
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);
    }