示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserId"] == null)
        {
            Response.Redirect("~/ERPLogin.aspx");
        }

        if (!IsPostBack)
        {
            if (Session["lang"] == null)
            {
                Session["lang"] = "1";
            }
            ViewState["CurrIndex"]    = 0;
            ViewState["SubSize"]      = 9;
            ViewState["CurrIndexbin"] = 0;
            ViewState["SubSizebin"]   = 9;
            Session["dtLeave"]        = null;
            TxtYear.Text = DateTime.Now.Year.ToString();
            int CurrentMonth = Convert.ToInt32(DateTime.Now.Month.ToString());
            ddlMonth.SelectedValue = (CurrentMonth).ToString();


            Session["empimgpath"] = null;

            Page.Form.Attributes.Add("enctype", "multipart/form-data");


            bool IsCompOT      = false;
            bool IsPartialComp = false;

            IsCompOT      = Convert.ToBoolean(objAppParam.GetApplicationParameterValueByParamName("IsOverTime", Session["CompId"].ToString()));
            IsPartialComp = Convert.ToBoolean(objAppParam.GetApplicationParameterValueByParamName("Partial_Leave_Enable", Session["CompId"].ToString()));
            btnLeave_Click(null, null);
        }

        Page.Title = objSys.GetSysTitle();

        TxtPenaltyName.Focus();
    }
示例#2
0
    void Reset()
    {
        TxtPenaltyName.Text        = "";
        TxtPenaltyDiscription.Text = "";
        ddlMonth.SelectedIndex     = 0;
        txtCalValue.Text           = "";
        DdlValueType.SelectedIndex = 0;
        TxtYear.Text = "";
        TxtPenaltyName.Focus();
        TxtYear.Text = DateTime.Now.Year.ToString();

        int CurrentMonth = Convert.ToInt32(DateTime.Now.Month.ToString());

        ddlMonth.SelectedValue = (CurrentMonth).ToString();
        foreach (GridViewRow Gvrow in gvEmpLeave.Rows)
        {
            CheckBox ChkHeader = (CheckBox)gvEmpLeave.HeaderRow.FindControl("chkgvSelectAll");
            CheckBox ChkItem   = (CheckBox)Gvrow.FindControl("chkgvSelect");

            ChkHeader.Checked = false;
            ChkItem.Checked   = false;
        }
    }
示例#3
0
    protected void btnLeave_Click(object sender, EventArgs e)
    {
        pnlLeave.BackColor = System.Drawing.ColorTranslator.FromHtml("#ccddee");

        PanelList.BackColor = System.Drawing.ColorTranslator.FromHtml("#90bde9");


        PnlEmployeeLeave.Visible = true;
        PanelSearchList.Visible  = false;



        lblSelectRecd.Text = "";
        gvEmpLeave.Visible = true;
        DataTable dtEmp = objEmp.GetEmployeeMaster(Session["CompId"].ToString());

        dtEmp = new DataView(dtEmp, "Brand_Id='" + Session["BrandId"].ToString() + "'  and Location_Id='" + Session["LocId"].ToString() + "'", "", DataViewRowState.CurrentRows).ToTable();

        if (Session["SessionDepId"] != null)
        {
            dtEmp = new DataView(dtEmp, "Department_Id in(" + Session["SessionDepId"].ToString().Substring(0, Session["SessionDepId"].ToString().Length - 1) + ")", "", DataViewRowState.CurrentRows).ToTable();
        }
        if (dtEmp.Rows.Count > 0)
        {
            Session["dtEmpLeave"] = dtEmp;
            gvEmpLeave.DataSource = dtEmp;
            gvEmpLeave.DataBind();
            lblTotalRecordsLeave.Text = Resources.Attendance.Total_Records + " : " + dtEmp.Rows.Count.ToString() + "";
        }
        Session["dtLeave"] = null;


        rbtnEmp.Checked   = true;
        rbtnGroup.Checked = false;
        EmpGroup_CheckedChanged(null, null);
        TxtPenaltyName.Focus();
    }
示例#4
0
    protected void btnSaveLeave_Click(object sender, EventArgs e)
    {
        int b = 0;


        string TransNo = string.Empty;


        if (rbtnGroup.Checked)
        {
            string GroupIds = string.Empty;
            string EmpIds   = string.Empty;



            for (int i = 0; i < lbxGroup.Items.Count; i++)
            {
                if (lbxGroup.Items[i].Selected)
                {
                    GroupIds += lbxGroup.Items[i].Value + ",";
                }
            }



            if (GroupIds != "")
            {
                DataTable dtEmp = objEmp.GetEmployeeMaster(Session["CompId"].ToString());

                dtEmp = new DataView(dtEmp, "Brand_Id='" + Session["BrandId"].ToString() + "'  and Location_Id='" + Session["LocId"].ToString() + "'", "", DataViewRowState.CurrentRows).ToTable();
                DataTable dtEmpInGroup = objGroupEmp.GetGroup_EmployeeById(Session["CompId"].ToString());

                dtEmpInGroup = new DataView(dtEmpInGroup, "Group_Id in(" + GroupIds.Substring(0, GroupIds.Length - 1) + ")", "", DataViewRowState.CurrentRows).ToTable();

                for (int i = 0; i < dtEmpInGroup.Rows.Count; i++)
                {
                    if (!EmpIds.Split(',').Contains(dtEmpInGroup.Rows[i]["Emp_Id"].ToString()))
                    {
                        EmpIds += dtEmpInGroup.Rows[i]["Emp_Id"].ToString() + ",";
                    }
                }
            }
            else
            {
                DisplayMessage("Select Group First");
            }


            foreach (string str in EmpIds.Split(','))
            {
                if (str != "")
                {
                    DataTable dtempmonth = new DataTable();
                    dtempmonth = objPayEmpMonth.GetAllRecordPostedEmpMonth(str, ddlMonth.SelectedIndex.ToString(), TxtYear.Text.ToString());
                    if (dtempmonth.Rows.Count > 0)
                    {
                        DisplayMessage("Payroll Already Generated");
                        return;
                    }
                    else
                    {
                        b = ObjPenalty.Insert_In_Pay_Employee_Penalty(Session["CompId"].ToString(), str, TxtPenaltyName.Text.Trim(), TxtPenaltyDiscription.Text.Trim(), DdlValueType.SelectedValue, txtCalValue.Text, DateTime.Now.ToString(), ddlMonth.SelectedValue, TxtYear.Text, "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString());
                    }
                }
            }
        }

        else
        {
            if (lblSelectRecd.Text == "")
            {
                DisplayMessage("Select Employee First");
                return;
            }
            if (TxtPenaltyName.Text == "")
            {
                DisplayMessage("Enter Penalty Name");
                TxtPenaltyName.Focus();
                return;
            }
            if (DdlValueType.SelectedIndex == 0)
            {
                DisplayMessage("Select Value Type");
                DdlValueType.Focus();
                return;
            }
            if (txtCalValue.Text == "")
            {
                DisplayMessage("Enter Value");
                txtCalValue.Focus();
                return;
            }
            if (ddlMonth.SelectedIndex == 0)
            {
                DisplayMessage("Select Month");
                ddlMonth.Focus();
                return;
            }
            if (TxtYear.Text == "")
            {
                DisplayMessage("Enter Year");
                TxtYear.Focus();
                return;
            }


            foreach (string str in lblSelectRecd.Text.Split(','))
            {
                if (str != "")
                {
                    DataTable dtempmonth = new DataTable();
                    dtempmonth = objPayEmpMonth.GetAllRecordPostedEmpMonth(str, ddlMonth.SelectedIndex.ToString(), TxtYear.Text.ToString());
                    if (dtempmonth.Rows.Count > 0)
                    {
                        DisplayMessage("Payroll Already Generated");
                        return;
                    }
                    else
                    {
                        b = ObjPenalty.Insert_In_Pay_Employee_Penalty(Session["CompId"].ToString(), str, TxtPenaltyName.Text.Trim(), TxtPenaltyDiscription.Text.Trim(), DdlValueType.SelectedValue, txtCalValue.Text, DateTime.Now.ToString(), ddlMonth.SelectedValue, TxtYear.Text, "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString());
                    }
                }
            }
        }
        if (b != 0)
        {
            DisplayMessage("Record Saved");
            rbtnEmp.Checked   = true;
            rbtnGroup.Checked = false;

            EmpGroup_CheckedChanged(null, null);

            Reset();
        }
        else
        {
            DisplayMessage("Record Not Saved");
        }

        // Reset();
    }