/// <summary>
    /// 若账号调整,需要再经过财务主管审核
    /// </summary>
    /// <returns></returns>
    private string judgeAdjust(string position, string department)
    {
        int        recordID        = Convert.ToInt32(Request["RecordID"]);
        MoneyApply mi              = MoneyApply.GetMoneyApplyByID(recordID);
        string     originalAccount = ProjectInfo.getProjectInfoByCode(projectCode.Text).ProjectAccount;

        if (originalAccount == accountList.SelectedValue)
        {
            if (position == "会计" || mi.ApproveProcess.Contains("财务主管"))
            {
                return("出纳");
            }
            else
            {
                return(Department.GetDepartmentByName(department).BULeader);
            };
        }
        else
        {
            if (position == "会计")
            {
                return("财务主管");
            }
            else
            {
                return("出纳");
            }
        }
    }
示例#2
0
    /// <summary>
    /// 根据申请编号,获取相应的资金使用申请记录
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static MoneyApply GetMoneyApplyByID(int id)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd  = new SqlCommand("SELECT * FROM [MoneyApplies] WHERE [RecordID] = @RecordID", conn);

        cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value = id;
        conn.Open();
        SqlDataReader sdr = cmd.ExecuteReader();
        MoneyApply    mi  = null;

        if (sdr.Read())
        {
            mi                = new MoneyApply();
            mi.staffName      = (string)sdr["StaffName"];
            mi.department     = (string)sdr["Department"];
            mi.telephone      = (string)sdr["Telephone"];
            mi.money          = Convert.ToDouble(sdr["Money"]);
            mi.payee          = (string)sdr["Payee"];
            mi.projectCode    = (string)sdr["ProjectCode"];
            mi.style          = (string)sdr["Style"];
            mi.usage          = (string)sdr["Usage"];
            mi.plan           = (string)sdr["PayPlan"];
            mi.payDate        = Convert.ToDateTime(sdr["PayDate"]);
            mi.ApproveProcess = sdr["ApproveProcess"] == DBNull.Value ? "" : (string)sdr["ApproveProcess"];
        }
        sdr.Close();
        conn.Close();
        return(mi);
    }
    private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back)
    {
        Users      usr      = (Users)Session["Identify"];
        int        recordID = Convert.ToInt32(Request["RecordID"]);
        MoneyApply mi       = MoneyApply.GetMoneyApplyByID(recordID);

        mi.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ",";
        MoneyApply.SetMoneyApplyByID(recordID, mi);

        string nextApprover = next;
        int    applyID      = Convert.ToInt32(Request["ApplyID"]);

        Apply.UpdateNextApprover(applyID, nextApprover, if_back);
    }
示例#4
0
    /// <summary>
    /// 更新或插入一条新的资金使用申请记录
    /// </summary>
    /// <param name="id"></param>
    /// <param name="mi"></param>
    public static void SetMoneyApplyByID(int id, MoneyApply mi)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd;
        bool          isExist = HasMoneyApplyInfo(id);

        if (isExist)
        {
            cmd = new SqlCommand("UPDATE [MoneyApplies] SET [StaffName] = @StaffName, [Department]=@Department, [Telephone]=@Telephone, [Money]=@Money, [ProjectCode] = @ProjectCode, [Style]=@Style, [Usage]=@Usage, [PayPlan]=@PayPlan, [Payee]=@Payee, [PayDate]=@PayDate, [ApproveProcess]=@ApproveProcess WHERE [RecordID] = @RecordID", conn);
        }
        else
        {
            cmd = new SqlCommand("INSERT INTO [MoneyApplies] ( [StaffName], [Department], [Telephone],  [Money], [ProjectCode], [Style], [Usage], [PayPlan], [Payee], [PayDate]) VALUES (@StaffName, @Department, @Telephone,  @Money, @ProjectCode, @Style, @Usage, @PayPlan, @Payee, @PayDate)  Select @@Identity as 'Identity'", conn);
        }
        cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value           = id;
        cmd.Parameters.Add("@StaffName", SqlDbType.VarChar).Value      = mi.staffName;
        cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value     = mi.department;
        cmd.Parameters.Add("@Telephone", SqlDbType.VarChar).Value      = mi.telephone;
        cmd.Parameters.Add("@Money", SqlDbType.Float).Value            = mi.money;
        cmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value    = mi.projectCode;
        cmd.Parameters.Add("@Style", SqlDbType.VarChar).Value          = mi.style;
        cmd.Parameters.Add("@Usage", SqlDbType.VarChar).Value          = mi.usage;
        cmd.Parameters.Add("@PayPlan", SqlDbType.VarChar).Value        = mi.plan;
        cmd.Parameters.Add("@Payee", SqlDbType.VarChar).Value          = mi.payee;
        cmd.Parameters.Add("@PayDate", SqlDbType.DateTime).Value       = mi.payDate;
        cmd.Parameters.Add("@ApproveProcess", SqlDbType.VarChar).Value = mi.approveProcess;

        conn.Open();

        //同时在标准化申请表中插入一条记录
        int recordId = Convert.ToInt32(cmd.ExecuteScalar());

        if (!isExist)
        {
            SqlCommand cmd2 = new SqlCommand("INSERT INTO [AllApplies] ( [ApplyStaff], [ApplyDate], [ApplyType], [NextApprover], [RecordID], [Result]) VALUES (@ApplyStaff, @ApplyDate, @ApplyType, @NextApprover, @RecordID, @Result)", conn);
            cmd2.Parameters.Add("@ApplyStaff", SqlDbType.VarChar).Value   = mi.staffName;
            cmd2.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value   = DateTime.Now;
            cmd2.Parameters.Add("@ApplyType", SqlDbType.VarChar).Value    = "资金使用审批";
            cmd2.Parameters.Add("@RecordID", SqlDbType.Int).Value         = recordId;
            cmd2.Parameters.Add("@NextApprover", SqlDbType.VarChar).Value = ProjectInfo.getProjectInfoByCode(mi.projectCode).Manager;
            cmd2.Parameters.Add("@Result", SqlDbType.Bit).Value           = false;
            cmd2.ExecuteNonQuery();
        }


        conn.Close();
    }
示例#5
0
    protected void confirm_Click(object sender, EventArgs e)
    {
        MoneyApply mi = new MoneyApply();

        mi.StaffName      = staffName.Text;
        mi.Department     = department.Text;
        mi.Telephone      = telephone.Text;
        mi.Money          = Convert.ToDouble(money.Text);
        mi.Payee          = "暂无";
        mi.ProjectCode    = projectCodeList.SelectedValue;
        mi.PayDate        = DateTime.Today;//Convert.ToDateTime(payDate.Value);
        mi.Usage          = usage.Text;
        mi.Plan           = plan.Text;
        mi.Style          = style.Value;
        mi.ApproveProcess = "";

        MoneyApply.SetMoneyApplyByID(-1, mi);
        Response.Redirect("~/Account/ApplyListPage.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int        recordID = Convert.ToInt32(Request["RecordID"]);
        int        applyID  = Convert.ToInt32(Request["ApplyID"]);
        bool       rejected = Convert.ToBoolean(Request["rejected"]);
        Apply      ap       = Apply.GetApplyByID(applyID);
        MoneyApply mi       = MoneyApply.GetMoneyApplyByID(recordID);

        DataSet allPro = ProjectInfo.GetAllProjects();

        accountList.DataSource     = allPro.Tables[0].DefaultView;
        accountList.DataTextField  = "ProjectAccount";
        accountList.DataValueField = "ProjectAccount";
        accountList.DataBind();

        staffName.Text   = mi.StaffName;
        department.Text  = mi.Department;
        telephone.Text   = mi.Telephone;
        payee.Text       = mi.Payee;
        projectCode.Text = mi.ProjectCode;
        usage.Text       = mi.Usage;
        plan.Text        = mi.Plan;
        money.Text       = mi.Money.ToString();
        capital.Text     = MoneyConvert.convertToCapital(mi.Money.ToString());
        payDate.Text     = mi.PayDate.ToShortDateString();
        processShow.Text = mi.ApproveProcess;


        //用户权限相关显示功能
        Users     usr  = (Users)Session["Identify"];
        BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID);

        if (!rejected && ap.NextApprover.Trim() == mi.StaffName.Trim())
        {
            agreeButton.Visible    = false;
            disagreeButton.Visible = false;
            cashierButton.Visible  = false;
            rejectButton.Visible   = false;
            whyDisagree.Visible    = false;
            accountList.Enabled    = false;
            //可打印状态
            proManager.Text = "已签字";
            depManager.Text = "已签字";
            financial.Text  = "已签字";
            company.Text    = "已签字";
            guanwei.Text    = "已签字";
        }
        else if (info.StaffName.Trim() == mi.StaffName.Trim() || info.Position.Trim() == "出纳")
        {
            agreeButton.Visible    = false;
            disagreeButton.Visible = false;

            accountList.Enabled = false;
            if (info.Position.Trim() != "出纳")
            {
                cashierButton.Visible = false;
                rejectButton.Visible  = false;
                whyDisagree.Visible   = false;
            }
        }
        else if (info.Position.Trim() == "会计")
        {
            accountList.Enabled   = true;
            cashierButton.Visible = false;
            rejectButton.Visible  = false;
        }
        else
        {
            accountList.Enabled   = false;
            cashierButton.Visible = false;
            rejectButton.Visible  = false;
        }
        //测试阶段保持处理流程可见,运行阶段记得去掉
        processShow.Visible = true;
    }