コード例 #1
0
    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();
        }
    }
コード例 #2
0
    protected void GenerateReport(string strMonth, string strYear, string strEmpID, string IsFromPayroll)
    {
        dsFinalPayment objFinalPay = new dsFinalPayment();

        ReportDoc  = new ReportDocument();
        ReportPath = Server.MapPath("~/CrystalReports/Payroll/rptFinalPayment.rpt");

        DataTable dtTmp = objGrMgr.GetFinalPaymentData(strMonth, strYear, strEmpID, IsFromPayroll);

        foreach (DataRow dRow in dtTmp.Rows)
        {
            clscashword objWord = new clscashword();
            DataRow     nRow    = objFinalPay.dtFinalPayment.NewRow();

            nRow["EmpId"]          = dRow["EmpId"];
            nRow["FullName"]       = dRow["FullName"];
            nRow["JobTitle"]       = dRow["JobTitleName"];
            nRow["JoiningDate"]    = dRow["JoiningDate"];
            nRow["SEPERATEDATE"]   = dRow["SeparateDate"];
            nRow["SeparationType"] = dRow["SeparateTypeId"];
            nRow["Salary"]         = dRow["Salary"];
            nRow["SalayUpto"]      = dRow["SalayUpto"];
            nRow["Bonus"]          = dRow["Bonus"];
            nRow["SalaryMinBonus"] = dRow["SalaryMinBonus"];
            nRow["BonusDays"]      = dRow["BonusDays"];
            nRow["Gratuity"]       = dRow["Gratuity"];
            nRow["GrPayDate"]      = dRow["GrPayDate"];
            nRow["LeaveEncash"]    = dRow["LeaveEncash"];
            nRow["AnnualLeave"]    = dRow["AnnualLeave"];
            nRow["PFAmount"]       = dRow["PFAmount"];
            nRow["TotalAmt"]       = dRow["TotalAmt"];
            nRow["InWord"]         = objWord.getCashWord(dRow["TotalAmt"].ToString());
            nRow["BasicSalary"]    = dRow["BasicSalary"];
            nRow["BONUSALLOW"]     = dRow["BONUSALLOW"];

            objFinalPay.dtFinalPayment.Rows.Add(nRow);
        }
        objFinalPay.dtFinalPayment.AcceptChanges();

        ReportDoc.Load(ReportPath);
        ReportDoc.SetDataSource(objFinalPay.Tables["dtFinalPayment"]);
        CRV.ReportSource = ReportDoc;
    }
コード例 #3
0
    protected void OpenRecord()
    {
        string strGenFor = "";

        if (ddlGroup.SelectedValue.Trim() == "A")
        {
            if (ddlLocation.SelectedValue.Trim() != "-1")
            {
                strGenFor = "O";
            }
            else
            {
                //lblMsg.Text = "No value is selected. Please select either DOS or Office to generate the report.";
                //return;
                strGenFor = "A";
            }
        }
        else
        {
            strGenFor = "D";
        }


        DataTable dtEmp     = new DataTable();
        DataTable dtDate    = new DataTable();
        DataTable dtRecords = new DataTable();

        if (strGenFor != "A")
        {
            dtEmp     = objITMgr.GetDistinctEmpoyeeData("-1", ddlLocation.SelectedValue.Trim(), ddlFinYear.SelectedValue.Trim(), strGenFor);
            dtDate    = objITMgr.GetDistinctDate("-1", ddlLocation.SelectedValue.Trim(), ddlFinYear.SelectedValue.Trim(), strGenFor);
            dtRecords = objITMgr.GetDetailsData("-1", ddlLocation.SelectedValue.Trim(), ddlFinYear.SelectedValue.Trim(), strGenFor);
        }
        else
        {
            dtEmp     = objITMgr.GetDistinctEmpoyeeDataAll(ddlFinYear.SelectedValue.Trim());
            dtDate    = objITMgr.GetDistinctDateAll(ddlFinYear.SelectedValue.Trim());
            dtRecords = objITMgr.GetDetailsDataAll(ddlFinYear.SelectedValue.Trim());
        }

        // Payroll data
        DataTable dtPayrollDet   = objPayRptMgr.GetPayrollDataForITStatement(ddlFinYear.SelectedValue.Trim());
        DataTable dtBenefitsHead = objPayrollMgr.GetSalaryBenefitsHead();

        DataRow[] fPayrollDet;

        lblFiscalYear.Text = ddlFinYear.SelectedItem.Text.Trim();
        // Data Filling for Report
        if (dtDate.Rows.Count == 0)
        {
            lblMsg.Text           = "No deposited reocrds found. Please use IT deposit Records screen to input the data.";
            grEmployee.DataSource = null;
            grEmployee.DataBind();
            return;
        }
        this.IniReportDataTable(dtDate.Rows.Count + 3 + dtBenefitsHead.Rows.Count + 3 + 4);
        int     inSL       = 1;
        int     i          = 2;
        decimal decTotal   = 0;
        decimal decBfTotal = 0;

        foreach (DataRow dEmpRow in dtEmp.Rows)
        {
            DataRow nRow = dtReport.NewRow();
            nRow[0]    = inSL.ToString();
            nRow[1]    = dEmpRow["EMPID"].ToString().Trim();
            nRow[2]    = dEmpRow["FULLNAME"].ToString().Trim();
            nRow[3]    = dEmpRow["JobTitleName"].ToString().Trim();
            nRow[4]    = dEmpRow["PostingDivName"].ToString().Trim();
            nRow[5]    = Common.SetDate(dEmpRow["JOININGDATE"].ToString().Trim());
            i          = 6;
            decBfTotal = 0;
            foreach (DataRow dBfRows in dtBenefitsHead.Rows)
            {
                fPayrollDet = dtPayrollDet.Select("EMPID='" + dEmpRow["EMPID"].ToString().Trim() + "' AND SHEADID=" + dBfRows["SHEADID"].ToString().Trim());
                if (fPayrollDet.Length > 0)
                {
                    nRow[i]    = Common.RoundDecimal(fPayrollDet[0]["PAYAMT"].ToString().Trim(), 0).ToString();
                    decBfTotal = decBfTotal + Common.RoundDecimal(fPayrollDet[0]["PAYAMT"].ToString().Trim(), 0);
                }
                else
                {
                    nRow[i] = "0";
                }

                i++;

                fPayrollDet = null;
            }
            nRow[i] = decBfTotal.ToString();
            i++;
            nRow[i] = objCashWord.getCashWord(decBfTotal.ToString() + ".00");
            i++;

            decTotal = 0;
            foreach (DataRow dDateRow in dtDate.Rows)
            {
                DataRow[] foundRows = dtRecords.Select("EMPID='" + dEmpRow["EMPID"].ToString().Trim() + "' AND CHALLANDATE='" + dDateRow["CHALLANDATE"].ToString().Trim() + "'");
                if (foundRows.Length > 0)
                {
                    nRow[i]  = foundRows[0]["PAYAMT"].ToString().Trim();
                    decTotal = decTotal + Convert.ToDecimal(foundRows[0]["PAYAMT"].ToString().Trim());
                }
                else
                {
                    nRow[i] = "0";
                }
                i++;
            }
            inSL++;
            nRow[i] = decTotal.ToString();
            i++;
            nRow[i] = objCashWord.getCashWord(decTotal.ToString() + ".00");

            dtReport.Rows.Add(nRow);
            dtReport.AcceptChanges();
        }

        grEmployee.DataSource = dtReport;
        grEmployee.DataBind();

        if (grEmployee.Rows.Count > 0)
        {
            grEmployee.HeaderRow.Cells[0].Text            = "SL#";
            grEmployee.HeaderRow.Cells[0].HorizontalAlign = HorizontalAlign.Left;
            grEmployee.HeaderRow.Cells[0].VerticalAlign   = VerticalAlign.Top;
            grEmployee.HeaderRow.Cells[1].Text            = "Employee ID";
            grEmployee.HeaderRow.Cells[1].HorizontalAlign = HorizontalAlign.Left;
            grEmployee.HeaderRow.Cells[2].Text            = "Employee Name";
            grEmployee.HeaderRow.Cells[2].HorizontalAlign = HorizontalAlign.Left;
            grEmployee.HeaderRow.Cells[3].Text            = "Designation";
            grEmployee.HeaderRow.Cells[3].HorizontalAlign = HorizontalAlign.Left;
            grEmployee.HeaderRow.Cells[4].Text            = "Office";
            grEmployee.HeaderRow.Cells[4].HorizontalAlign = HorizontalAlign.Left;
            grEmployee.HeaderRow.Cells[5].Text            = "Joining Date";
            grEmployee.HeaderRow.Cells[5].HorizontalAlign = HorizontalAlign.Left;

            int j = 6;
            foreach (DataRow dBfRows in dtBenefitsHead.Rows)
            {
                grEmployee.HeaderRow.Cells[j].Text            = dBfRows["HeadName"].ToString();
                grEmployee.HeaderRow.Cells[j].HorizontalAlign = HorizontalAlign.Right;
                j++;
            }

            grEmployee.HeaderRow.Cells[j].Text            = "Total Remuneration ";
            grEmployee.HeaderRow.Cells[j].HorizontalAlign = HorizontalAlign.Right;
            j++;
            grEmployee.HeaderRow.Cells[j].Text            = "In Word";
            grEmployee.HeaderRow.Cells[j].HorizontalAlign = HorizontalAlign.Left;
            j++;

            for (i = j; i < dtReport.Columns.Count - 2; i++)
            {
                grEmployee.HeaderRow.Cells[i].Text            = Common.DisplayDate(dtDate.Rows[i - j]["CHALLANDATE"].ToString().Trim()) + "<br><br>" + dtDate.Rows[i - j]["CHALLANNO"].ToString().Trim();
                grEmployee.HeaderRow.Cells[i].HorizontalAlign = HorizontalAlign.Right;
            }
            grEmployee.HeaderRow.Cells[dtReport.Columns.Count - 2].Text            = "Total Tax";
            grEmployee.HeaderRow.Cells[dtReport.Columns.Count - 2].HorizontalAlign = HorizontalAlign.Right;
            grEmployee.HeaderRow.Cells[dtReport.Columns.Count - 2].VerticalAlign   = VerticalAlign.Top;
            grEmployee.HeaderRow.Cells[dtReport.Columns.Count - 1].Text            = "In Word";
            grEmployee.HeaderRow.Cells[dtReport.Columns.Count - 1].HorizontalAlign = HorizontalAlign.Left;
            grEmployee.HeaderRow.Cells[dtReport.Columns.Count - 1].VerticalAlign   = VerticalAlign.Top;
        }

        //// Summary Total
        //decimal dclFooterTotal = 0;
        //int j = 0;
        //grEmployee.FooterRow.Cells[1].Text = "Total :";
        //grEmployee.FooterRow.Cells[1].HorizontalAlign = HorizontalAlign.Left;
        //for (i = 2; i < dtReport.Columns.Count; i++)
        //{
        //    dclFooterTotal = 0;
        //    for (j = 0; j < grEmployee.Rows.Count;j++ )
        //    {
        //        dclFooterTotal = dclFooterTotal + Convert.ToDecimal(grEmployee.Rows[j].Cells[i].Text.Trim());
        //        grEmployee.Rows[j].Cells[i].HorizontalAlign = HorizontalAlign.Right;
        //        if (Convert.ToDecimal(grEmployee.Rows[j].Cells[i].Text.Trim()) == 0)
        //            grEmployee.Rows[j].Cells[i].Text = "-";
        //    }
        //    grEmployee.FooterRow.Cells[i].Text = dclFooterTotal.ToString();
        //    grEmployee.FooterRow.Cells[i].HorizontalAlign = HorizontalAlign.Right;
        //}
    }