Example #1
0
    /// <summary>
    /// 根据编号获取工资表
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static SalaryApply GetSalaryApplyByID(int id)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd  = new SqlCommand("SELECT * FROM [SalaryMonthly] WHERE [ApplyID] = @ApplyID", conn);

        cmd.Parameters.Add("@ApplyID", SqlDbType.Int).Value = id;
        conn.Open();
        SqlDataReader sdr = cmd.ExecuteReader();
        SalaryApply   si  = null;

        if (sdr.Read())
        {
            si = new SalaryApply();
            si.staffSalaryList = new List <SalaryDetail>();
            si.staffName       = (string)sdr["StaffName"];
            si.applyDate       = Convert.ToDateTime(sdr["ApplyDate"]);
            si.ApproveProcess  = sdr["ApproveProcess"] == DBNull.Value ? "" : (string)sdr["ApproveProcess"];
        }
        sdr.Close();
        conn.Close();

        List <SalaryDetail> result = SalaryDetail.GetSalaryListByID(id);

        si.staffSalaryList.AddRange(result);

        return(si);
    }
Example #2
0
    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);
        SalaryApply si       = SalaryApply.GetSalaryApplyByID(recordID);

        if (!IsPostBack)
        {
            salaryList.Text = transResult(si.StaffSalaryList, ref allCash);
        }

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

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

            if (info.Position.Trim() != "出纳")
            {
                cashierButton.Visible = false;
                rejectButton.Visible  = false;
                whyDisagree.Visible   = false;
            }
        }
        else if (info.Position.Trim() == "会计")
        {
            cashierButton.Visible = false;
            rejectButton.Visible  = false;
        }
        else
        {
            cashierButton.Visible = false;
            rejectButton.Visible  = false;
        }
        //测试阶段保持处理流程可见,运行阶段记得去掉
        processShow.Visible = true;
    }
Example #3
0
    protected void rejectButton_Click(object sender, EventArgs e)
    {
        int         recordID = Convert.ToInt32(Request["RecordID"]);
        SalaryApply si       = SalaryApply.GetSalaryApplyByID(recordID);

        Users     usr  = (Users)Session["Identify"];
        BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID);

        updateApprove("不同意," + whyDisagree.Text, si.StaffName, info, true);
        Response.Redirect("~/Account/ApplyListPage.aspx");
    }
Example #4
0
    private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back)
    {
        Users       usr      = (Users)Session["Identify"];
        int         recordID = Convert.ToInt32(Request["RecordID"]);
        SalaryApply si       = SalaryApply.GetSalaryApplyByID(recordID);

        si.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ",";
        SalaryApply.SetSalaryApplyByID(recordID, si);

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

        Apply.UpdateNextApprover(applyID, nextApprover, if_back);
    }
Example #5
0
    protected void confirm_Click(object sender, EventArgs e)
    {
        SalaryApply si = new SalaryApply();

        si.StaffName = staffName.Text;
        DateTime dt = Convert.ToDateTime(ApplyDate.Value);

        si.ApplyDate      = new DateTime(dt.Year, dt.Month, 1);
        si.ApproveProcess = "";

        int applyid = SalaryApply.SetSalaryApplyByID(-1, si);


        Response.Redirect(string.Format("~/Finance/SalaryPersonal.aspx?applyid={0}&&year={1}&&month={2}", applyid, si.ApplyDate.Year, si.ApplyDate.Month));
    }
Example #6
0
    /// <summary>
    /// 根据编号新增或更新办公用品申购记录
    /// </summary>
    /// <param name="id"></param>
    /// <param name="oi"></param>
    /// <param name="projectName"></param>
    public static int SetSalaryApplyByID(int id, SalaryApply si)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd;
        bool          isExist = HasSalaryApplyInfo(id);

        if (isExist)
        {
            cmd = new SqlCommand("UPDATE [SalaryMonthly] SET [StaffName] = @StaffName, [ApplyDate]=@ApplyDate, [ApproveProcess]=@ApproveProcess WHERE [ApplyID] = @ApplyID", conn);
        }
        else
        {
            cmd = new SqlCommand("INSERT INTO [SalaryMonthly] ([StaffName], [ApplyDate], [ApproveProcess]) VALUES (@StaffName,  @ApplyDate, @ApproveProcess)  Select @@Identity as 'Identity'", conn);
        }
        cmd.Parameters.Add("@ApplyID", SqlDbType.Int).Value            = id;
        cmd.Parameters.Add("@StaffName", SqlDbType.VarChar).Value      = si.staffName;
        cmd.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value     = si.applyDate;
        cmd.Parameters.Add("@ApproveProcess", SqlDbType.VarChar).Value = si.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 = si.staffName;
            cmd2.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value = DateTime.Today;
            cmd2.Parameters.Add("@ApplyType", SqlDbType.VarChar).Value  = "工资表";
            cmd2.Parameters.Add("@RecordID", SqlDbType.Int).Value       = recordId;


            cmd2.Parameters.Add("@NextApprover", SqlDbType.VarChar).Value = "财务主管";
            cmd2.Parameters.Add("@Result", SqlDbType.Bit).Value           = false;
            cmd2.ExecuteNonQuery();
        }


        conn.Close();
        return(recordId);
    }
Example #7
0
    /// <summary>
    /// 根据当前审批人,获取下一审批人职位
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    private string getNextApprover(BasicInfo info)
    {
        int         recordID = Convert.ToInt32(Request["RecordID"]);
        SalaryApply si       = SalaryApply.GetSalaryApplyByID(recordID);

        string result = null;

        switch (info.Position.Trim())
        {
        case "财务主管": result = "机构负责人"; break;

        case "机构负责人": result = "会计"; break;

        case "会计": result = "出纳"; break;

        case "出纳": result = si.StaffName; break;

        default: break;
        }
        return(result);
    }