Пример #1
0
    protected void confirm_Click(object sender, EventArgs e)
    {
        BusinessTripRei bi = new BusinessTripRei();

        bi.StaffName  = staffName.Text;
        bi.Department = department.Text;
        bi.ApplyDate  = Convert.ToDateTime(applyDate.Text);
        bi.StartDate  = Convert.ToDateTime(startDate.Value);
        bi.EndDate    = Convert.ToDateTime(endDate.Value);

        bi.ProjectName    = projectNameList.SelectedValue;
        bi.ProjectAccount = accountList.SelectedValue;
        bi.Reason         = reason.Text;
        bi.Traffic        = traffic.Text;
        bi.Cars           = cars.Text;
        bi.Hotel          = hotels.Text;
        bi.Meal           = meal.Text;
        bi.Others         = others.Text;
        bi.MoneyEstimate  = Convert.ToDouble(moneyEstimate.Text);
        bi.MoneyRei       = Convert.ToDouble(moneyRei.Text);
        bi.ApproveProcess = "";

        BusinessTripRei.SetBusinessTripRei(bi, -1);
        Response.Redirect("~/Account/ApplyListPage.aspx");
    }
    /// <summary>
    /// 若账号调整,需要再经过财务主管审核
    /// </summary>
    /// <returns></returns>
    private string judgeAdjust(string position, string department)
    {
        int             recordID        = Convert.ToInt32(Request["RecordID"]);
        BusinessTripRei bi              = BusinessTripRei.GetBusinessTripReiByID(recordID);
        string          originalAccount = ProjectInfo.GetProjectInfoByName(projectName.Text).ProjectAccount;

        if (originalAccount == accountList.SelectedValue)
        {
            if (position == "会计" || bi.ApproveProcess.Contains("财务主管"))
            {
                return("出纳");
            }
            else
            {
                return(Department.GetDepartmentByName(department).BULeader);
            }
        }
        else
        {
            if (position == "会计")
            {
                return("财务主管");
            }
            else
            {
                return("出纳");
            }
        }
    }
Пример #3
0
    /// <summary>
    /// 根据编号获取特定的出差报销申请记录
    /// </summary>
    /// <param name="recordID"></param>
    /// <returns></returns>
    public static BusinessTripRei GetBusinessTripReiByID(int recordID)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd  = new SqlCommand("SELECT * FROM [BusinessTripRei] WHERE [RecordID] = @RecordID", conn);

        cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value = recordID;
        conn.Open();
        SqlDataReader   sdr = cmd.ExecuteReader();
        BusinessTripRei bi  = null;

        if (sdr.Read())
        {
            bi                = new BusinessTripRei();
            bi.staffName      = (string)sdr["StaffName"];
            bi.department     = (string)sdr["Department"];
            bi.startDate      = Convert.ToDateTime(sdr["StartDate"]);
            bi.endDate        = Convert.ToDateTime(sdr["EndDate"]);
            bi.applyDate      = Convert.ToDateTime(sdr["ApplyDate"]);
            bi.projectName    = (string)sdr["ProjectName"];
            bi.projectAccount = (string)sdr["ProjectAccount"];
            bi.reason         = (string)sdr["Reason"];
            bi.traffic        = (string)sdr["Traffic"];
            bi.cars           = (string)sdr["Cars"];
            bi.hotel          = (string)sdr["Hotel"];
            bi.meal           = (string)sdr["Meal"];
            bi.others         = (string)sdr["Others"];
            bi.moneyEstimate  = Convert.ToDouble(sdr["MoneyEstimate"]);
            bi.moneyRei       = Convert.ToDouble(sdr["MoneyRei"]);

            bi.ApproveProcess = sdr["ApproveProcess"] == DBNull.Value ? "" : (string)sdr["ApproveProcess"];
        }
        sdr.Close();
        conn.Close();
        return(bi);
    }
Пример #4
0
    /// <summary>
    /// 新增或更新指定编号的出差报销记录
    /// </summary>
    /// <param name="bi"></param>
    /// <param name="id"></param>
    public static void SetBusinessTripRei(BusinessTripRei bi, int id)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand    cmd;
        bool          isExist = HasBusinessTripRei(id);

        if (!isExist)
        {
            cmd = new SqlCommand("INSERT INTO [BusinessTripRei] ([StaffName], [Department], [StartDate], [EndDate], [ApplyDate], [ProjectName], [ProjectAccount], [Reason], [Traffic], [Cars], [Hotel], [Meal], [Others], [MoneyEstimate], [MoneyRei], [ApproveProcess]) VALUES (@StaffName, @Department, @StartDate, @EndDate, @ApplyDate, @ProjectName, @ProjectAccount, @Reason, @Traffic, @Cars, @Hotel, @Meal, @Others, @MoneyEstimate, @MoneyRei, @ApproveProcess) Select @@Identity as 'Identity'", conn);
        }
        else
        {
            cmd = new SqlCommand("UPDATE [BusinessTripRei] SET [ApproveProcess]=@ApproveProcess,[ProjectAccount]=@ProjectAccount WHERE [RecordID] = @RecordID", conn);
        }
        cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value           = id;
        cmd.Parameters.Add("@StaffName", SqlDbType.VarChar).Value      = bi.staffName;
        cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value     = bi.department;
        cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value     = bi.startDate;
        cmd.Parameters.Add("@EndDate", SqlDbType.DateTime).Value       = bi.endDate;
        cmd.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value     = bi.applyDate;
        cmd.Parameters.Add("@ProjectName", SqlDbType.VarChar).Value    = bi.projectName;
        cmd.Parameters.Add("@ProjectAccount", SqlDbType.VarChar).Value = bi.projectAccount;
        cmd.Parameters.Add("@Reason", SqlDbType.VarChar).Value         = bi.reason;
        cmd.Parameters.Add("@Traffic", SqlDbType.VarChar).Value        = bi.traffic;
        cmd.Parameters.Add("@Cars", SqlDbType.VarChar).Value           = bi.cars;
        cmd.Parameters.Add("@Hotel", SqlDbType.VarChar).Value          = bi.hotel;
        cmd.Parameters.Add("@Meal", SqlDbType.VarChar).Value           = bi.meal;
        cmd.Parameters.Add("@Others", SqlDbType.VarChar).Value         = bi.others;
        cmd.Parameters.Add("@MoneyEstimate", SqlDbType.Float).Value    = bi.moneyEstimate;
        cmd.Parameters.Add("@MoneyRei", SqlDbType.Float).Value         = bi.moneyRei;
        cmd.Parameters.Add("@ApproveProcess", SqlDbType.VarChar).Value = bi.approveProcess;

        conn.Open();
        //cmd.ExecuteNonQuery();
        //同时在标准化申请表中插入一条记录
        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   = bi.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.GetProjectInfoByName(bi.projectName).Manager;
            cmd2.Parameters.Add("@Result", SqlDbType.Bit).Value           = false;
            cmd2.ExecuteNonQuery();
        }

        conn.Close();
    }
    private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back)
    {
        //更新审批流程
        int             recordID = Convert.ToInt32(Request["RecordID"]);
        BusinessTripRei bi       = BusinessTripRei.GetBusinessTripReiByID(recordID);

        bi.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ",";
        bi.ProjectAccount  = accountList.SelectedValue;
        BusinessTripRei.SetBusinessTripRei(bi, recordID);

        //更新下一审批人
        int    applyID      = Convert.ToInt32(Request["ApplyID"]);
        string nextApprover = next;

        Apply.UpdateNextApprover(applyID, nextApprover, if_back);
    }
    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);
        BusinessTripRei bi       = BusinessTripRei.GetBusinessTripReiByID(recordID);

        if (!IsPostBack)
        {
            DataSet allPro = ProjectInfo.GetAllProjects();
            accountList.DataSource     = allPro.Tables[0].DefaultView;
            accountList.DataTextField  = "ProjectAccount";
            accountList.DataValueField = "ProjectAccount";
            accountList.DataBind();



            staffName.Text            = bi.StaffName;
            department.Text           = bi.Department;
            applyDate.Text            = bi.ApplyDate.ToShortDateString();
            startDate.Text            = bi.StartDate.ToShortDateString();
            endDate.Text              = bi.EndDate.ToShortDateString();
            projectName.Text          = bi.ProjectName;
            accountList.SelectedValue = bi.ProjectAccount;
            reason.Text        = bi.Reason;
            traffic.Text       = bi.Traffic;
            cars.Text          = bi.Cars;
            hotel.Text         = bi.Hotel;
            meal.Text          = bi.Meal;
            others.Text        = bi.Others;
            moneyEstimate.Text = bi.MoneyEstimate.ToString();
            moneyRei.Text      = bi.MoneyRei.ToString();
            processShow.Text   = bi.ApproveProcess;

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

        if (!rejected && ap.NextApprover == bi.StaffName)
        {
            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    = "已签字";
        }
        else if (info.StaffName.Trim() == bi.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;
    }