Exemple #1
0
        private void OpenRecord(string strSalaryType)
        {
            if (strSalaryType == "S")
            {
                lblMonth.Text = "Payslip for the Month of " + ddlMonth.SelectedItem.ToString().Trim() + ", " + ddlYear.SelectedValue.ToString().Trim();
            }
            else
            {
                lblMonth.Text = "Festival Allowance - " + ddlMonth.SelectedItem.ToString().Trim() + ", " + ddlYear.SelectedValue.ToString().Trim();
            }


            DataTable dt = new DataTable();

            dt = (DataTable)objPayRptMgr.GetPayslipMonthlyGrossAndBenefits(lblEmpId.Text.Trim(), ddlMonth.SelectedValue.ToString().Trim(), ddlYear.SelectedValue.ToString().Trim(), strSalaryType);

            grGrossandBenefits.DataSource = dt;
            grGrossandBenefits.DataBind();
            clsCashWord cal      = new clsCashWord();
            int         nouOfRow = dt.Rows.Count;

            if (string.IsNullOrEmpty(dt.Rows[nouOfRow - 1]["PAYAMT"].ToString().Trim()) == false)
            {
                lblTakaInWord.Text = "<b>In Words : </b>" + cal.getCashWord(Common.ReturnZeroForNull(dt.Rows[nouOfRow - 1]["PAYAMT"].ToString().Trim())); //nouOfRow.ToString();
            }
            dt.Rows.Clear();
            lblRemarks.Text = objPayRptMgr.GetPayrollRemarksForPayslip(lblEmpId.Text.Trim(), ddlMonth.SelectedValue.ToString().Trim(), ddlYear.SelectedValue.ToString().Trim(), strSalaryType);
            if (string.IsNullOrEmpty(lblRemarks.Text) == false)
            {
                lblRemarks.Text = "* " + lblRemarks.Text;
            }

            this.FormatGrossAndBenefitsGrid();
            this.FormatDeductionGrid();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string   strParams = Request.QueryString["params"];
            string[] strVal    = strParams.Split(',');

            if (strVal[4].Trim() == "S")
            {
                lblMonth.Text = "Payslip for the Month of " + strVal[1] + ", " + strVal[2];
            }
            else
            {
                lblMonth.Text = "Festival Allowance - " + strVal[1] + " " + strVal[2];
            }

            // Get Employee Personal data
            DataTable dtPersonal = objEmp.SelectEmpPayslipPersonalInfo(strVal[3].Trim());
            if (dtPersonal.Rows.Count > 0)
            {
                lblID.Text       = dtPersonal.Rows[0]["EmpId"].ToString().Trim();
                lblName.Text     = dtPersonal.Rows[0]["FULLNAME"].ToString().Trim();
                lblGrade.Text    = dtPersonal.Rows[0]["GradeName"].ToString().Trim();
                lblJobTitle.Text = dtPersonal.Rows[0]["JobTitleName"].ToString().Trim();
                lblBankAc.Text   = dtPersonal.Rows[0]["BankAccNo"].ToString().Trim();
                lblDesig.Text    = dtPersonal.Rows[0]["DesigName"].ToString().Trim();
                lblPostDiv.Text  = dtPersonal.Rows[0]["PostingDivName"].ToString().Trim();
                lblDept.Text     = dtPersonal.Rows[0]["DeptName"].ToString().Trim();
                lblPostDist.Text = dtPersonal.Rows[0]["PostingDistName"].ToString().Trim();
                lblSalLoc.Text   = dtPersonal.Rows[0]["SalLocName"].ToString().Trim();
                lblPostPla.Text  = dtPersonal.Rows[0]["PostingPlaceName"].ToString().Trim();
                lblSalDiv.Text   = dtPersonal.Rows[0]["SalSubLocName"].ToString().Trim();
            }
            DataTable dt = new DataTable();
            dt = (DataTable)objPayRptMgr.GetPayslipMonthlyGrossAndBenefits(strVal[3].Trim(), strVal[0].Trim(), strVal[2].Trim(), strVal[4].Trim());

            grGrossandBenefits.DataSource = dt;
            grGrossandBenefits.DataBind();
            clscashword cal      = new clscashword();
            int         nouOfRow = dt.Rows.Count;
            if (string.IsNullOrEmpty(dt.Rows[nouOfRow - 1]["PAYAMT"].ToString().Trim()) == false)
            {
                lblTakaInWord.Text = "<b>In Words : </b>" + cal.getCashWord(Common.ReturnZeroForNull(dt.Rows[nouOfRow - 1]["PAYAMT"].ToString().Trim())); //nouOfRow.ToString();
            }
            dt.Rows.Clear();
            lblRemarks.Text = objPayRptMgr.GetPayrollRemarksForPayslip(strVal[3].Trim(), strVal[0].Trim(), strVal[2].Trim(), strVal[4].Trim());
            if (string.IsNullOrEmpty(lblRemarks.Text) == false)
            {
                lblRemarks.Text = "* " + lblRemarks.Text;
            }

            this.FormatGrossAndBenefitsGrid();
            this.FormatDeductionGrid();
        }
    }
Exemple #3
0
    protected void btnSendEmail_Click(object sender, EventArgs e)
    {
        string strRetText      = "";
        string strToAddr       = "";
        string strSubject      = "";
        string strBody         = "";
        string strFromAddr     = Session["EMAILID"].ToString().Trim();
        string strPayslipMonth = ddlMonth.SelectedItem.Text.Trim() + " " + ddlYear.SelectedValue.Trim();
        string strSalType      = chkBonus.Checked == true ? "B" : "S";

        foreach (GridViewRow gRow in grEmployee.Rows)
        {
            CheckBox chkB = (CheckBox)gRow.Cells[0].FindControl("chkBox");
            if (chkB.Checked == true)
            {
                this.ResetGridView(grGrossandBenefits, true);
                this.ResetGridView(grDeduct, true);
                this.ResetGridView(grNetPay, true);

                grGrossandBenefits.DataSource = objPayRptMgr.GetPayslipMonthlyGrossAndBenefits(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType);
                grGrossandBenefits.DataBind();

                //grDeduct.DataSource = objPayRptMgr.GetPayslipMonthlyDeductions(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType);
                //grDeduct.DataBind();

                //grNetPay.DataSource = objPayRptMgr.GetPayslipMonthlyNetPay(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType);
                //grNetPay.DataBind();

                lblRemarks.Text = objPayRptMgr.GetPayrollRemarksForPayslip(gRow.Cells[2].Text.Trim(), ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), strSalType);
                if (string.IsNullOrEmpty(lblRemarks.Text) == false)
                {
                    lblRemarks.Text = "* " + lblRemarks.Text;
                }

                this.FormatGrossAndBenefitsGrid();
                this.FormatDeductionGrid();

                strToAddr = gRow.Cells[7].Text.Trim();
                if (chkBonus.Checked == true)
                {
                    strSubject = "Festival Allowance - " + strPayslipMonth;
                }
                else
                {
                    strSubject = "Payslip for the Month of " + strPayslipMonth;
                }
                strBody = " <pre style=" + "\"font-weight:bold;font-size:14px;font-family:Arial;\"" + "> " + "Save The Children " + " </pre> "
                          + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + gRow.Cells[3].Text.Trim() + " </pre> "
                          + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + gRow.Cells[5].Text.Trim() + " </pre> "
                          + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + gRow.Cells[4].Text.Trim() + " </pre> "
                          + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + "Employee ID: " + gRow.Cells[2].Text.Trim() + " </pre> "
                          + " <pre> </pre>"
                          + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> " + "Date of Issue : " + DateTime.Today.ToLongDateString() + " </pre> "
                          + " <pre> </pre>"
                          + " <pre style=" + "\"font-weight:bold;font-size:14px;font-family:Arial;\"" + "> " + strSubject + " </pre> "
                          + " <pre> </pre>"
                          + " <table style=" + "\"width:100%;\"" + "> "
                          + " \n "
                          + " <tr> "
                          + " \n "
                          + " <td style=" + "\"width:49%;vertical-align:top;\"" + "> "
                          + " \n "
                          + this.GetGridViewHTML(grGrossandBenefits)
                          + " \n "
                          + " </td> "
                          + " \n "
                          + " <td style=" + "\"width:49%;vertical-align:top;\"" + "> "
                          + " \n "
                          + this.GetGridViewHTML(grDeduct)
                          + " <pre> </pre>"
                          + this.GetGridViewHTML(grNetPay)
                          + " <pre> </pre>"
                          + lblRemarks.Text.Trim()
                          + " </td> "
                          + " \n "
                          + " </tr> "
                          + " \n "
                          + " <tr> "
                          + " \n "
                          + " <td colspan=" + "\"2\"" + ">"
                          + " \n "
                          + " <pre> </pre>"
                          + " <pre style=" + "\"font-size:12px;font-family:Arial;\"" + "> "
                          + " Note: This is a computer generated payslip and does not require any signature. If any discrepancy is found please "
                          + " inform HR Team within 7 days of the issuance. "
                          + "</pre> "
                          + " </td> "
                          + " </tr> "
                          + "\n "
                          + " </table> "
                          + " \n ";

                strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, "");
                if (strRetText == "N")
                {
                    gRow.Cells[1].ForeColor = System.Drawing.Color.Red;
                    gRow.Cells[2].ForeColor = System.Drawing.Color.Red;
                    gRow.Cells[3].ForeColor = System.Drawing.Color.Red;
                    gRow.Cells[4].ForeColor = System.Drawing.Color.Red;
                    gRow.Cells[5].ForeColor = System.Drawing.Color.Red;
                    gRow.Cells[6].ForeColor = System.Drawing.Color.Red;
                    gRow.Cells[7].ForeColor = System.Drawing.Color.Red;
                    break;
                }
                chkB.Checked            = false;
                gRow.Cells[1].ForeColor = System.Drawing.Color.Green;
                gRow.Cells[2].ForeColor = System.Drawing.Color.Green;
                gRow.Cells[3].ForeColor = System.Drawing.Color.Green;
                gRow.Cells[4].ForeColor = System.Drawing.Color.Green;
                gRow.Cells[5].ForeColor = System.Drawing.Color.Green;
                gRow.Cells[6].ForeColor = System.Drawing.Color.Green;
                gRow.Cells[7].ForeColor = System.Drawing.Color.Green;
            }
        }
        this.ResetGridView(grGrossandBenefits, false);
        this.ResetGridView(grDeduct, false);
        this.ResetGridView(grNetPay, false);
        lblRemarks.Text = "";
        if (strRetText == "N")
        {
            lblMsg.Text = "Failure in Sending Mail";
        }
        if (strRetText == "Y")
        {
            lblMsg.Text = "Payslip email has been sent successfully";
        }
    }