public static string InsertInfos(Dictionary <string, string> dict)
    {
        string     res    = CostSharingInfoSrv.InsertInfos(dict);
        SqlExceRes sqlRes = new SqlExceRes(res);

        return(sqlRes.GetResultString("新建成功", "网点信息有重复,请重新输入"));
    }
Exemple #2
0
    public static string DeleteTemplate(string type)
    {
        string     res    = LeaveStockInfoSrv.DeleteTemplate(type);
        SqlExceRes sqlRes = new SqlExceRes(res);

        return(sqlRes.GetResultString("删除成功!", ""));
    }
Exemple #3
0
    public static string Delete(string id)
    {
        string     res    = UserInfoSrv.Delete(id);
        SqlExceRes sqlRes = new SqlExceRes(res);

        return(sqlRes.GetResultString("操作成功", ""));
    }
Exemple #4
0
    public static string UpdateInfos(Dictionary <string, string> dict, string id)
    {
        string     res    = UserInfoSrv.UpdateInfos(dict, id);
        SqlExceRes sqlRes = new SqlExceRes(res);

        return(sqlRes.GetResultString("修改成功", ""));
    }
    public static string returnDocument(string table, string docCode, UserInfo user)
    {
        String  res = "";
        DataSet ds  = ApprovalFlowSrv.GetDocumentInfo(table, docCode, ref res);

        if (ds == null)//出错,返回错误信息
        {
            return("获取单据信息出错,错误信息:" + res);
        }

        if (Convert.ToInt32(ds.Tables[3].Rows[0]["Level"]) > 1)
        {
            return("该单据已被审批,无法进行撤回");
        }
        //保存单据撤回记录
        SqlExceRes sqlRes = new SqlExceRes(ApprovalFlowSrv.returnDocument(user, ds));

        res = sqlRes.GetResultString("撤回成功!", "该单据已被审批,无法进行撤回!");
        if (res != "撤回成功!")
        {
            return("撤回单据出错,错误信息:" + res);
        }

        // 更新表单状态
        ApprovalFlowSrv.UpdateDocStatus(table, docCode, "未提交", 0);

        //清除审批人相关信息
        ApprovalFlowSrv.ClearCurrentApproverInfo(table, docCode);

        return(res);
    }
Exemple #6
0
    public static string AddTree(Dictionary <string, string> dict)
    {
        string     res    = UserInfoSrv.AddTree(dict);
        SqlExceRes sqlRes = new SqlExceRes(res);

        return(sqlRes.GetResultString("新建成功", "部门名称有重复,请重新输入"));
    }
    public static string SubmitDocument(string table, string docCode, UserInfo user, string url1, string url2,
                                        string appSecret, string thisAppName, string agentId)
    {
        string  res = "";
        DataSet ds  = ApprovalFlowSrv.GetDocumentInfo(table, docCode, ref res);

        if (ds == null)//出错,返回错误信息
        {
            return("获取单据信息出错,错误信息:" + res);
        }

        if (ds.Tables[0].Rows.Count > 0 && ds.Tables[2].Rows.Count > 0)
        {
            return("该单据已提交,请勿重复提交");
        }
        //保存审批记录信息
        Dictionary <string, string> dict = new Dictionary <string, string>();
        SqlExceRes sqlRes = new SqlExceRes(ApprovalFlowSrv.SubmitDocumentSaveRecord(user, ds, ref dict));

        res = sqlRes.GetResultString("提交成功!", "该单据已提交,请勿重复提交!");
        if (res != "提交成功!")
        {
            return("提交单据出错,错误信息:" + res);
        }
        //保存所有审批人信息
        JArray listApproverInfo = null;//所有审批人信息

        ApprovalFlowSrv.SaveAllApproverInfo(user, ds, dict, ref listApproverInfo);

        //更新单据状态,state="审批中",level=1
        res = ApprovalFlowSrv.UpdateDocStatus(table, docCode, "审批中", 1);

        DataSet userDs = ApprovalFlowSrv.GetUserInfoByUserId(
            ApprovalFlowSrv.GetApproverIddByLevel(1, listApproverInfo));

        string approverIds = "";

        foreach (DataTable dt in userDs.Tables)
        {
            approverIds += dt.Rows[0]["wechatUserId"].ToString() + "|";
        }
        approverIds = approverIds.Substring(0, approverIds.Length - 1);

        WxNetSalesHelper wxNetSalesHelper = new WxNetSalesHelper(appSecret, thisAppName, agentId);

        //// 给待审批人发送消息
        //wxNetSalesHelper.GetJsonAndSendWxMsg(approverIds, "请及时审批 提交人为:" + user.userName
        //    + "的单据,谢谢!", url2, agentId);
        //// 给提交人发送消息
        wxNetSalesHelper.GetJsonAndSendWxMsg(user.wechatUserId, "您的审批单据已提交 请耐心等待审批人审批", url1, agentId);

        return(res);
    }
Exemple #8
0
    //public static DataTable getCommonPurchaseData(int year, int month)
    //{
    //    DataSet ds = ImportPurchaseSrv.getCommonPurchaseData(year, month);

    //    if (ds == null)
    //        return null;

    //    return ds.Tables[0];
    //}

    public static string insertOrUpdateCommonPurchaseData(List <Dictionary <string, string> > dictList, string year, string month)
    {
        List <string> sqls = new List <string>();

        foreach (Dictionary <string, string> dict in dictList)
        {
            dict.Add("year", year);
            dict.Add("month", month);
            string sql = ImportPurchaseSrv.insertOrUpdateCommonPurchaseData(dict);
            sqls.Add(sql);
        }
        string     msg        = SqlHelper.Exce(sqls.ToArray());
        SqlExceRes sqlExceRes = new SqlExceRes(msg);

        return(sqlExceRes.GetResultString("保存成功", "保存失败"));
    }
    /// <summary>
    /// 审批流程--创建表单。
    /// 需要在dict当中添加"DocumentTableName"的key,用于保存表单表名
    /// </summary>
    /// <param name="dict"></param>
    /// <returns></returns>
    public static string CreateDocument(Dictionary <string, string> dict)
    {
        //单据草稿为可编辑状态
        if (!dict.Keys.Contains("Editable"))
        {
            dict.Add("Editable", "1");
        }
        else
        {
            dict.Remove("Editable");
            dict.Add("Editable", "1");
        }
        SqlExceRes sqlRes = new SqlExceRes(ApprovalFlowSrv.CreateDocument(dict));

        return(sqlRes.GetResultString("提交成功!", "该单据已创建,请勿重复创建!"));
    }
Exemple #10
0
    public static string saveRecord(List <Dictionary <string, string> > dictList, string name)
    {
        List <string> sqls = new List <string>();

        foreach (Dictionary <string, string> dict in dictList)
        {
            string sql = ImportPurchaseSrv.saveReocrd(dict, name);
            if (sql != null)
            {
                sqls.Add(sql);
            }
        }
        string     msg        = SqlHelper.Exce(sqls.ToArray());
        SqlExceRes sqlExceRes = new SqlExceRes(msg);

        return(sqlExceRes.GetResultString("保存成功", "保存失败"));
    }
Exemple #11
0
    public static string DataArchive(DataRow dataRow, int year, int month)
    {
        string feeDetail   = dataRow["feedetail"].ToString();
        string relatSector = dataRow["feearea"].ToString();
        float  money       = float.Parse(dataRow["money"].ToString());
        // 找到数据库中保存的报销项目
        string    feeAccount = "";
        DataTable dt         = getRelativeAccount(feeDetail);

        if (dt == null || dt.Rows.Count == 0)
        {
            return("");
        }
        else
        {
            feeAccount = dt.Rows[0]["feeAccount"].ToString();

            if ("开发费用金额".Equals(feeAccount))
            {
                feeAccount = "DevelopmentCost";
            }
            else if ("销售总监费用".Equals(feeAccount))
            {
                feeAccount = "SalesDirectorCost";
            }
            else if ("市场学术费".Equals(feeAccount))
            {
                feeAccount = "MarketCost";
            }
            else if ("市场调节基金".Equals(feeAccount))
            {
                feeAccount = "MarketReadjustmentCost";
            }
            else if ("区域中心费用".Equals(feeAccount))
            {
                feeAccount = "RegionalCenterCost";
            }
            else if ("区域中心费用VIP".Equals(feeAccount))
            {
                feeAccount = "RegionalCenterVipCost";
            }
            else if ("商务费用金额".Equals(feeAccount))
            {
                feeAccount = "BusinessCost";
            }
            else if ("产品发展基金".Equals(feeAccount))
            {
                feeAccount = "ProductDevelopmentFundCost";
            }
            else if ("实验费(TF)金额".Equals(feeAccount))
            {
                feeAccount = "TfCost";
            }
        }
        // 找到数据库中对应的盈利中心
        string sector = "";

        dt = getRelativeSector(relatSector);
        if (dt == null || dt.Rows.Count == 0)
        {
            return("");
        }
        else
        {
            sector = dt.Rows[0]["sector"].ToString();
        }

        DataTable oldMoneyDt = ItemSettingManage.getOldMoney(feeAccount, year, month, sector);

        float oldmoney = 0;

        if (oldMoneyDt != null && oldMoneyDt.Rows.Count != 0)
        {
            object feeAccountObj = oldMoneyDt.Rows[0][feeAccount];

            if (feeAccountObj != null)
            {
                oldmoney = float.Parse(feeAccountObj.ToString());
            }
        }

        SqlExceRes sqlRes = new SqlExceRes(ItemSettingInfoSrc.saveOrUpdateFinancialData(year, month, feeAccount, money + oldmoney, sector));

        return(sqlRes.GetResultString("提交成功!", "提交失败", "提交失败"));
    }
Exemple #12
0
    public static string saveOrUpdateFinancialData(int year, int month, string itemnm, float num, string sector)
    {
        SqlExceRes sqlRes = new SqlExceRes(ItemSettingInfoSrc.saveOrUpdateFinancialData(year, month, itemnm, num, sector));

        return(sqlRes.GetResultString("提交成功!", "提交失败"));
    }
Exemple #13
0
    public static String updateNetSalesAndStockAfterApproval(String docCode)
    {
        String sql = String.Format("select Hospital, Product, Sales, NetSalesNumber, CorrespondingTime from " +
                                   "v_net_sales where docCode = '{0}'", docCode);

        DataSet ds = SqlHelper.Find(sql);

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

        string netSalesNum       = ds.Tables[0].Rows[0]["NetSalesNumber"].ToString();
        string hospital          = ds.Tables[0].Rows[0]["Hospital"].ToString();
        string product           = ds.Tables[0].Rows[0]["Product"].ToString();
        string sales             = ds.Tables[0].Rows[0]["Sales"].ToString();
        string correspondingTime = ds.Tables[0].Rows[0]["CorrespondingTime"].ToString();

        string[] time = correspondingTime.Split(new char[1] {
            '-'
        });
        int    year     = Int32.Parse(time[0]);
        String monthStr = time[1];

        if (monthStr.Length == 1)
        {
            monthStr = monthStr.Substring(1, 1);
        }

        int month = Int32.Parse(monthStr) - 1;

        string updateNetSaleSql = string.Format("update flow_statistics set NetSales = {0} where Hospital = '{1}' and Product = '{2}' and sales = '{3}'" +
                                                " and Year = {4} and Month = {5}", netSalesNum, hospital, product, sales, year, month);

        SqlExceRes res1        = new SqlExceRes(SqlHelper.Exce(updateNetSaleSql));
        string     netSalesRes = res1.GetResultString("更新纯销成功", "更新纯销失败", "更新纯销失败");

        string queryStockSql = string.Format("select * from flow_statistics where Hospital = '{0}' and Product = '{1}' and sales = '{2}'" +
                                             " and Year = {3} and Month = {4}", hospital, product, sales, year, month);

        ds = SqlHelper.Find(queryStockSql);

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

        int    stockLastMonth = Int32.Parse(ds.Tables[0].Rows[0]["StockLastMonth"].ToString());
        int    flowSales      = Int32.Parse(ds.Tables[0].Rows[0]["FlowSales"].ToString());
        int    NetSales       = Int32.Parse(ds.Tables[0].Rows[0]["NetSales"].ToString());
        int    stockThisMonth = stockLastMonth + flowSales - NetSales;
        string updateStockSql = string.Format("update flow_statistics set StockThisMonth = {0} where Hospital = '{1}' and Product = '{2}' and sales = '{3}'" +
                                              " and Year = {4} and Month = {5}", stockThisMonth, hospital, product, sales, year, month);
        //List<string> list = new List<string>();
        //list.Add(updateNetSaleSql);
        //list.Add(updateStockSql);
        SqlExceRes res2     = new SqlExceRes(SqlHelper.Exce(updateStockSql));
        string     stockRes = res1.GetResultString("更新库存成功", "更新库存失败", "更新库存失败");

        if ("更新纯销成功".Equals(netSalesRes) && "更新库存成功".Equals(stockRes))
        {
            return("更新成功");
        }
        else
        {
            return("更新失败");
        }
    }
    public static string ApproveDocument(string table, string docCode, UserInfo user
                                         , string ApprovalResult, string ApprovalOpinions, string url1, string url2, string url3,
                                         string appSecret, string thisAppName, string agentId)
    {
        string  res = "";
        DataSet ds  = ApprovalFlowSrv.GetDocumentInfo(table, docCode, ref res);

        if (ds == null)//出错,返回错误信息
        {
            return("获取单据信息出错,错误信息:" + res);
        }

        WxNetSalesHelper wxNetSalesHelper = new WxNetSalesHelper(appSecret, thisAppName, agentId);
        DataTable        DtAppApprover    = ds.Tables[0];
        DataTable        DtAppProcess     = ds.Tables[1];
        DataTable        DtAppRecord      = ds.Tables[2];
        DataTable        DtDocument       = ds.Tables[3];
        DataTable        DtInformer       = ds.Tables[5];

        int     SubmitorUserId   = Convert.ToInt32(DtAppRecord.Rows[0]["SubmitterId"]);
        DataSet dsUserInfo       = ApprovalFlowSrv.GetUserInfoByUserId(new int[] { SubmitorUserId });
        string  SubmitorWechatId = dsUserInfo.Tables[0].Rows[0]["wechatUserId"].ToString();
        string  SubmitorName     = dsUserInfo.Tables[0].Rows[0]["userName"].ToString();

        int level    = Convert.ToInt32(DtDocument.Rows[0]["Level"]);
        int maxLevel = Convert.ToInt32(DtAppProcess.Rows[DtAppProcess.Rows.Count - 1]["Level"]);

        string informer = "";

        foreach (DataRow row in ds.Tables[5].Rows)
        {
            informer += row["wechatUserId"].ToString() + "|";
        }
        Boolean       flag     = false;
        List <string> tempList = new List <string>();

        for (int i = 0; i < DtAppApprover.Rows.Count; i++)
        {
            tempList.Add(DtAppApprover.Rows[i]["ApproverId"].ToString());
            if (i == level)
            {
                if (!flag)
                {
                    string     saveRecordMsg = ApprovalFlowSrv.ApproveDocumentSaveRecord(DtAppApprover.Rows[i]["ApproverId"].ToString(), ds, ApprovalResult, ApprovalOpinions, level);
                    SqlExceRes sqlRes        = new SqlExceRes(saveRecordMsg);
                    res = sqlRes.GetResultString("审批结果提交成功!", "该单据已提交,请勿重复提交!");
                    if (res != "审批结果提交成功!")
                    {
                        return("提交审批结果出错,错误信息:" + res);
                    }
                }
                else
                {
                    string     saveRecordMsg = ApprovalFlowSrv.ApproveDocumentSaveRecord(DtAppApprover.Rows[i]["ApproverId"].ToString(), ds, ApprovalResult, "自动审批", level);
                    SqlExceRes sqlRes        = new SqlExceRes(saveRecordMsg);
                    res = sqlRes.GetResultString("审批结果提交成功!", "该单据已提交,请勿重复提交!");
                    if (res != "审批结果提交成功!")
                    {
                        return("提交审批结果出错,错误信息:" + res);
                    }
                }


                if (!ApprovalResult.Contains("不同意"))//审批同意
                {
                    level++;
                    if (level > maxLevel)//审批到最后一级,审批流程结束
                    {
                        if (informer != "")
                        {
                            informer = informer.Substring(0, informer.Length - 1);
                            wxNetSalesHelper.GetJsonAndSendWxMsg(informer, "有一条与您相关的单据审批流程结束,请知悉", url1, agentId);
                        }

                        res = "审批流程结束";
                        //清除审批人相关信息
                        ApprovalFlowSrv.ClearCurrentApproverInfo(table, docCode);

                        // 更新表单状态
                        ApprovalFlowSrv.UpdateDocStatus(table, docCode, "已审批", level);

                        // 发送审批的消息给提交者
                        wxNetSalesHelper.GetJsonAndSendWxMsg(SubmitorWechatId, "您的审批单据审批流程结束,请知悉", url1, agentId);

                        // 审批流程结束后,需要把纯销数据更新到flow_statistic表中
                        //NetSalesInfoSrv.updateNetSalesAndStockAfterApproval(docCode);
                    }
                    else
                    {
                        string tempUserId = tempUserId = DtAppApprover.Rows[level]["ApproverId"].ToString();

                        res = "审批同意!";

                        // 更新表单状态
                        ApprovalFlowSrv.UpdateDocStatus(table, docCode, "审批中", level);


                        // 发送审批的消息给提交者
                        wxNetSalesHelper.GetJsonAndSendWxMsg(SubmitorWechatId, "您审批单据已被"
                                                             + user.userName + "审批,结果为同意,请知悉"
                                                             , url1, agentId);
                        if (!tempList.Contains(tempUserId))
                        {
                            // 向审批人发送审批通知
                            DataSet userDs = ApprovalFlowSrv.GetUserInfoByUserId(
                                ApprovalFlowSrv.GetApproverIddByLevel(level, DtAppApprover));

                            string approverIds = "";
                            foreach (DataTable dt in userDs.Tables)
                            {
                                approverIds += dt.Rows[0]["wechatUserId"].ToString() + "|";
                            }
                            approverIds = approverIds.Substring(0, approverIds.Length - 1);

                            wxNetSalesHelper.GetJsonAndSendWxMsg(approverIds, "已收到提交人为: " + SubmitorName
                                                                 + "的单据,请及时审批,谢谢"
                                                                 , url2, agentId);
                            break;
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                }
                else//审批不同意
                {
                    if (informer != "")//发送消息给抄送人
                    {
                        informer = informer.Substring(0, informer.Length - 1);
                        wxNetSalesHelper.GetJsonAndSendWxMsg(informer, "有一条与您相关的单据被审批拒绝,请知悉", url1, agentId);
                    }
                    //清除审批人相关信息
                    ApprovalFlowSrv.ClearCurrentApproverInfo(table, docCode);
                    // 更新表单状态
                    if ("yl_reimburse".Equals(table) || "wages".Equals(table) || "outer_wages".Equals(table) || "tax".Equals(table))
                    {
                        ApprovalFlowSrv.UpdateDocStatus(table, docCode, "已拒绝", 0);
                    }
                    else
                    {
                        ApprovalFlowSrv.UpdateDocStatus(table, docCode, "未提交", 0);
                    }

                    res = "审批拒绝!";



                    string approver = "";

                    foreach (DataRow row in DtAppProcess.Rows)
                    {
                        if (Convert.ToInt32(row["Level"]) < level && Convert.ToInt32(row["Level"]) > 0)
                        {
                            approver += row["wechatUserId"].ToString() + "|";
                        }
                    }
                    if (approver != "")//发送消息给抄送人
                    {
                        approver = approver.Substring(0, approver.Length - 1);
                        wxNetSalesHelper.GetJsonAndSendWxMsg(approver, "有一条您审批通过的单据被审批拒绝,请知悉", url1, agentId);
                    }

                    // 发送审批被拒绝的消息
                    if ("".Equals(ApprovalOpinions))
                    {
                        wxNetSalesHelper.GetJsonAndSendWxMsg(SubmitorWechatId, "您的审批单据已被"
                                                             + user.userName + "审批,结果为拒绝,请重新提交该单据"
                                                             , url3, agentId);
                    }
                    else
                    {
                        wxNetSalesHelper.GetJsonAndSendWxMsg(SubmitorWechatId, "您的审批单据已被"
                                                             + user.userName + "审批,结果为拒绝,意见为:" + ApprovalOpinions + ",请重新提交该单据"
                                                             , url3, agentId);
                    }

                    break;
                }
                if (table == "deliver_apply_report")//销售订单重复的审批人不需要自动审批
                {
                    break;
                }
            }
        }
        //保存审批记录

        return(res);
    }
Exemple #15
0
    public static string UpdateInfo(Dictionary <string, string> dict, string id)
    {
        SqlExceRes res = new SqlExceRes(OrganizationInfoSrv.UpdateInfo(dict, id));

        return(res.GetResultString("提交成功!", ""));
    }
Exemple #16
0
    public static string InsertInfo(Dictionary <string, string> dict)
    {
        SqlExceRes res = new SqlExceRes(OrganizationInfoSrv.InsertInfo(dict));

        return(res.GetResultString("提交成功!", "数据有重复"));
    }
Exemple #17
0
    public static string DeleteInfo(string id)
    {
        SqlExceRes res = new SqlExceRes(OrganizationInfoSrv.DeleteInfo(id));

        return(res.GetResultString("删除成功!", ""));
    }