Exemplo n.º 1
0
    public void GetReport()
    {
        DateTime FromDate = new DateTime();
        DateTime ToDate   = new DateTime();
        string   Emplist  = string.Empty;

        if (Session["EmpList"] == null)
        {
            Response.Redirect("../Attendance_Report/AttendanceReport.aspx");
        }
        else
        {
            FromDate = objSys.getDateForInput(Session["FromDate"].ToString());
            ToDate   = objSys.getDateForInput(Session["ToDate"].ToString());

            Emplist = Session["EmpList"].ToString();

            DataTable dtFilter = new DataTable();

            AttendanceDataSet rptdata = new AttendanceDataSet();

            rptdata.EnforceConstraints = false;
            AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter adp = new AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter();

            adp.Fill(rptdata.sp_Att_AttendanceRegister_Report, Convert.ToDateTime(FromDate), Convert.ToDateTime(ToDate));



            if (Emplist != "")
            {
                dtFilter = new DataView(rptdata.sp_Att_AttendanceRegister_Report, "Emp_Id in (" + Emplist.Substring(0, Emplist.Length - 1) + ") ", "", DataViewRowState.CurrentRows).ToTable();
            }
            dtFilter = new DataView(dtFilter, "Is_Absent='True'", "", DataViewRowState.CurrentRows).ToTable();

            string CompanyName    = "";
            string CompanyAddress = "";
            string Imageurl       = "";

            DataTable DtCompany = objComp.GetCompanyMasterById(Session["CompId"].ToString());
            DataTable DtAddress = ObjAddress.GetAddressChildDataByAddTypeAndAddRefId("Company", Session["CompId"].ToString());
            if (DtCompany.Rows.Count > 0)
            {
                CompanyName = DtCompany.Rows[0]["Company_Name"].ToString();
                Imageurl    = "~/CompanyResource/" + Session["CompId"].ToString() + "/" + DtCompany.Rows[0]["Logo_Path"].ToString();
            }
            if (DtAddress.Rows.Count > 0)
            {
                CompanyAddress = DtAddress.Rows[0]["Address"].ToString();
            }
            RptShift.SetImage(Imageurl);
            RptShift.setTitleName("Absent Report" + " From " + FromDate.ToString(objSys.SetDateFormat()) + " To " + ToDate.ToString(objSys.SetDateFormat()));
            RptShift.setcompanyname(CompanyName);
            RptShift.setaddress(CompanyAddress);


            RptShift.DataSource     = dtFilter;
            RptShift.DataMember     = "sp_Att_AttendanceRegister_Report";
            rptViewer.Report        = RptShift;
            rptToolBar.ReportViewer = rptViewer;
        }
    }
    public void GetReport()
    {
        if (Session["SelectedEmpId"] == null)
        {
            return;
        }

        Table1.Rows.Clear();

        DataTable dtShortCode = (DataTable)Session["DtShortCode"];


        //set color and short code
        string Normal = "P";
        string Absent = (new DataView(dtShortCode, "Type='Absent'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ShortId"].ToString();


        string WeekOff   = (new DataView(dtShortCode, "Type='WeekOff'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ShortId"].ToString();
        string Holiday   = (new DataView(dtShortCode, "Type='Holiday'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ShortId"].ToString();
        string Leave     = "L";
        string Normalcol = (new DataView(dtShortCode, "Type='Normal'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ColorCOde"].ToString();
        string Absentcol = (new DataView(dtShortCode, "Type='Absent'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ColorCOde"].ToString();

        string Leavecol   = (new DataView(dtShortCode, "Type='Leave'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ColorCOde"].ToString();
        string WeekOffcol = (new DataView(dtShortCode, "Type='WeekOff'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ColorCOde"].ToString();
        string Holidaycol = (new DataView(dtShortCode, "Type='Holiday'", "", DataViewRowState.CurrentRows).ToTable()).Rows[0]["ColorCOde"].ToString();

        DateTime          dtFrom     = new DateTime(Convert.ToInt32(txtYear.Text), Convert.ToInt32(ddlMonth.SelectedValue), 1);
        DateTime          InitDtFrom = Convert.ToDateTime(dtFrom.ToString());
        int               totalDays  = DateTime.DaysInMonth(Convert.ToInt32(txtYear.Text), Convert.ToInt32(ddlMonth.SelectedValue.ToString()));
        DateTime          dtTo       = dtFrom.AddDays(totalDays - 1);
        DateTime          dtFromBK   = dtFrom;
        AttendanceDataSet rptdata    = new AttendanceDataSet();

        rptdata.EnforceConstraints = false;
        AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter adp = new AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter();
        adp.Fill(rptdata.sp_Att_AttendanceRegister_Report, Convert.ToDateTime(dtFrom.ToString()), Convert.ToDateTime(dtTo.ToString()));

        DataTable dtFilter = new DataTable();

        if (Session["SelectedEmpId"].ToString() != "")
        {
            dtFilter = new DataView(rptdata.sp_Att_AttendanceRegister_Report, "Emp_Id in (" + Session["SelectedEmpId"].ToString().Substring(0, Session["SelectedEmpId"].ToString().Length - 1) + ") ", "", DataViewRowState.CurrentRows).ToTable();
        }
        else
        {
            rptdata.sp_Att_AttendanceRegister_Report.Rows.Clear();
        }


        TableRow tr        = new TableRow();
        TableRow trWeekDay = new TableRow();

        trWeekDay.Cells.Add(new TableCell());
        trWeekDay.Cells.Add(new TableCell());
        trWeekDay.Cells.Add(new TableCell());
        TableCell tcSNO = new TableCell();

        tcSNO.Text = "SNO";
        tr.Cells.Add(tcSNO);
        TableCell tcId = new TableCell();

        tcId.Wrap = false;
        tcId.Text = "ID";

        tr.Cells.Add(tcId);
        TableCell tcName = new TableCell();

        tcName.Wrap = false;
        tcName.Text = "Name";

        tr.Cells.Add(tcName);
        int count = 1;

        while (count <= totalDays)
        {
            TableCell tcDay     = new TableCell();
            TableCell tcWeekDay = new TableCell();

            tcDay.Text     = count.ToString();
            tcWeekDay.Text = dtFrom.AddDays(count - 1).DayOfWeek.ToString().Substring(0, 2).ToUpper();
            tr.Cells.Add(tcDay);
            trWeekDay.Cells.Add(tcWeekDay);
            count++;
        }
        TableCell tcPresent = new TableCell();

        tcPresent.RowSpan = 2;

        tcPresent.Text = "Present/Total";
        tr.Cells.Add(tcPresent);

        Table1.Rows.Add(tr);
        Table1.Rows.Add(trWeekDay);

        DataTable dtEmpList  = dtFilter.DefaultView.ToTable(true, "Emp_Id");
        int       empCounter = 0;

        if (dtEmpList.Rows.Count > 0)
        {
            while (empCounter < dtEmpList.Rows.Count)
            {
                DataTable dtAttbyEmpId = new DataView(dtFilter, "Emp_Id = '" + dtEmpList.Rows[empCounter][0].ToString() + "'", "Att_Date", DataViewRowState.CurrentRows).ToTable();

                DateTime dtFromTemp = InitDtFrom;
                DateTime dtToTemp   = dtTo;
                int      maxshift   = 0;
                while (dtFromTemp < dtToTemp)
                {
                    dtFromTemp = dtFromTemp.AddDays(1);
                    DataTable dtTempDateRecordEmp = new DataView(dtAttbyEmpId, "Att_Date = '" + dtFromTemp.ToString("dd-MMM-yyyy") + "'", "Att_Date", DataViewRowState.CurrentRows).ToTable();

                    if (maxshift < dtTempDateRecordEmp.Rows.Count)
                    {
                        maxshift = dtTempDateRecordEmp.Rows.Count;
                    }
                }

                TableRow[] trEmp   = new TableRow[maxshift];
                int[]      absent  = new int[maxshift];
                int[]      present = new int[maxshift];
                int[]      early   = new int[maxshift];
                int[]      late    = new int[maxshift];
                int[]      total   = new int[maxshift];


                try
                {
                    present[0] = 0;
                    early[0]   = 0;
                    late[0]    = 0;
                    total[0]   = 0;
                }
                catch
                {
                }
                int tempcounter = 0;

                while (tempcounter < maxshift)
                {
                    trEmp[tempcounter] = new TableRow();
                    tempcounter++;
                }

                TableCell tcSNOEmp = new TableCell();
                tcSNOEmp.Text = (empCounter + 1).ToString();
                if (maxshift > 0)
                {
                    trEmp[0].Cells.Add(tcSNOEmp);



                    TableCell tcNameEmp1 = new TableCell();
                    tcNameEmp1.Text = dtAttbyEmpId.Rows[1]["Emp_Code"].ToString();

                    trEmp[0].Cells.Add(tcNameEmp1);



                    TableCell tcNameEmp = new TableCell();
                    tcNameEmp.Text = dtAttbyEmpId.Rows[0]["Emp_Name"].ToString();

                    trEmp[0].Cells.Add(tcNameEmp);



                    dtFrom = dtFromBK;
                }
                int presentcount = 0;
                while (dtFrom <= dtTo)
                {
                    int shiftCounter = 0;

                    DataTable dtTempDateRecordEmp = new DataView(dtAttbyEmpId, "Att_Date = '" + dtFrom.ToString("dd-MMM-yyyy") + "'", "Att_Date", DataViewRowState.CurrentRows).ToTable();


                    while (shiftCounter < maxshift)
                    {
                        TableCell tcDay  = new TableCell();
                        string    attEmp = string.Empty;

                        if (shiftCounter < dtTempDateRecordEmp.Rows.Count)
                        {
                            if ((Convert.ToBoolean(dtTempDateRecordEmp.Rows[shiftCounter]["Is_Week_Off"].ToString())))
                            {
                                attEmp          = attEmp + WeekOff;
                                tcDay.BackColor = System.Drawing.ColorTranslator.FromHtml(hextoint(WeekOffcol).ToString());
                            }
                            else if ((Convert.ToBoolean(dtTempDateRecordEmp.Rows[shiftCounter]["Is_Holiday"].ToString())))
                            {
                                attEmp          = attEmp + Holiday;
                                tcDay.BackColor = System.Drawing.ColorTranslator.FromHtml(hextoint(Holidaycol).ToString());
                            }


                            else if (Convert.ToBoolean(dtTempDateRecordEmp.Rows[shiftCounter]["Is_Leave"].ToString()))
                            {
                                attEmp          = attEmp + Leave;
                                tcDay.BackColor = System.Drawing.ColorTranslator.FromHtml(hextoint(Leavecol).ToString());
                            }
                            else if (Convert.ToBoolean(dtTempDateRecordEmp.Rows[shiftCounter]["Is_Absent"].ToString()))
                            {
                                attEmp          = attEmp + Absent;
                                tcDay.BackColor = System.Drawing.ColorTranslator.FromHtml(hextoint(Absentcol).ToString());
                            }
                            else
                            {
                                attEmp = attEmp + Normal;

                                tcDay.BackColor = System.Drawing.ColorTranslator.FromHtml(hextoint(Normalcol).ToString());
                                presentcount++;
                            }
                            absent[shiftCounter] = absent[shiftCounter] + 1;
                        }
                        else
                        {
                            attEmp = "-";
                        }


                        tcDay.Text = attEmp;
                        trEmp[shiftCounter].Cells.Add(tcDay);
                        trEmp[shiftCounter].Cells.Add(tcDay);

                        if (dtFrom == dtTo)
                        {
                            TableCell tcabsnt = new TableCell();
                            tcabsnt.Text = presentcount.ToString() + "/" + totalDays.ToString();
                            trEmp[shiftCounter].Cells.Add(tcabsnt);
                        }



                        //

                        shiftCounter = shiftCounter + 1;
                    }


                    dtFrom = dtFrom.AddDays(1);
                }



                for (int maxcounter = 1; maxcounter <= maxshift; maxcounter++)
                {
                    if (maxcounter < maxshift)
                    {
                        trEmp[maxcounter].Cells.AddAt(0, new TableCell());
                        trEmp[maxcounter].Cells.AddAt(0, new TableCell());
                        trEmp[maxcounter].Cells.AddAt(0, new TableCell());
                    }

                    Table1.Rows.Add(trEmp[maxcounter - 1]);
                }



                empCounter++;
            }
        }
        lblmonthname.Text = "Month " + ": " + ddlMonth.SelectedItem.Text;
    }
    public void GetReport()
    {
        DateTime FromDate = new DateTime();
        DateTime ToDate   = new DateTime();
        string   Emplist  = string.Empty;

        if (Session["EmpList"] == null)
        {
            Response.Redirect("../Attendance_Report/AttendanceReport.aspx");
        }
        else
        {
            FromDate = objSys.getDateForInput(Session["FromDate"].ToString());
            ToDate   = objSys.getDateForInput(Session["ToDate"].ToString());

            Emplist = Session["EmpList"].ToString();

            DataTable dtFilter = new DataTable();

            AttendanceDataSet rptdata = new AttendanceDataSet();

            rptdata.EnforceConstraints = false;
            AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter adp = new AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter();

            adp.Fill(rptdata.sp_Att_AttendanceRegister_Report, Convert.ToDateTime(FromDate), Convert.ToDateTime(ToDate));



            if (Emplist != "")
            {
                dtFilter = new DataView(rptdata.sp_Att_AttendanceRegister_Report, "Emp_Id in (" + Emplist.Substring(0, Emplist.Length - 1) + ") ", "", DataViewRowState.CurrentRows).ToTable();
            }

            DataTable dtReport = dtFilter.Clone();


            for (int i = 0; i < dtFilter.Rows.Count; i++)
            {
                if (dtFilter.Rows[i]["In_Time"].ToString().Contains("00:00") && dtFilter.Rows[i]["Out_Time"].ToString().Contains("00:00"))
                {
                    //  dtFilter.Rows[i]["Field1"] = "NA";
                    //  dtReport.ImportRow(dtFilter.Rows[i]);
                }
                else if (!dtFilter.Rows[i]["In_Time"].ToString().Contains("00:00") && dtFilter.Rows[i]["Out_Time"].ToString().Contains("00:00"))
                {
                    if (!Convert.ToBoolean(dtFilter.Rows[i]["Is_Leave"].ToString()) && !Convert.ToBoolean(dtFilter.Rows[i]["Is_Holiday"].ToString()) && !Convert.ToBoolean(dtFilter.Rows[i]["Is_Week_Off"].ToString()))
                    {
                        dtFilter.Rows[i]["Field1"] = "Out";
                        dtReport.ImportRow(dtFilter.Rows[i]);
                    }
                }

                else if (dtFilter.Rows[i]["In_Time"].ToString().Contains("00:00") && !dtFilter.Rows[i]["Out_Time"].ToString().Contains("00:00"))
                {
                    if (!Convert.ToBoolean(dtFilter.Rows[i]["Is_Leave"].ToString()) && !Convert.ToBoolean(dtFilter.Rows[i]["Is_Holiday"].ToString()) && !Convert.ToBoolean(dtFilter.Rows[i]["Is_Week_Off"].ToString()))
                    {
                        dtFilter.Rows[i]["Field1"] = "In";
                        dtReport.ImportRow(dtFilter.Rows[i]);
                    }
                }
            }



            string CompanyName    = "";
            string CompanyAddress = "";
            string Imageurl       = "";

            DataTable DtCompany = objComp.GetCompanyMasterById(Session["CompId"].ToString());
            DataTable DtAddress = ObjAddress.GetAddressChildDataByAddTypeAndAddRefId("Company", Session["CompId"].ToString());
            if (DtCompany.Rows.Count > 0)
            {
                CompanyName = DtCompany.Rows[0]["Company_Name"].ToString();
                Imageurl    = "~/CompanyResource/" + Session["CompId"].ToString() + "/" + DtCompany.Rows[0]["Logo_Path"].ToString();
            }
            if (DtAddress.Rows.Count > 0)
            {
                CompanyAddress = DtAddress.Rows[0]["Address"].ToString();
            }
            RptShift.SetImage(Imageurl);
            RptShift.setTitleName("In Out Exception Report" + " From " + FromDate.ToString(objSys.SetDateFormat()) + " To " + ToDate.ToString(objSys.SetDateFormat()));
            RptShift.setcompanyname(CompanyName);
            RptShift.setaddress(CompanyAddress);


            RptShift.DataSource     = dtReport;
            RptShift.DataMember     = "sp_Att_AttendanceRegister_Report";
            rptViewer.Report        = RptShift;
            rptToolBar.ReportViewer = rptViewer;
        }
    }
    public void GetReport()
    {
        DateTime FromDate  = new DateTime();
        DateTime ToDate    = new DateTime();
        DateTime FromDate1 = new DateTime();
        string   Emplist   = string.Empty;

        if (Session["EmpList"] == null)
        {
            Response.Redirect("../Attendance_Report/AttendanceReport.aspx");
        }
        else
        {
            FromDate  = objSys.getDateForInput(Session["FromDate"].ToString());
            ToDate    = objSys.getDateForInput(Session["ToDate"].ToString());
            FromDate1 = FromDate;
            Emplist   = Session["EmpList"].ToString();

            DataTable dtFilter = new DataTable();

            AttendanceDataSet rptdata = new AttendanceDataSet();

            rptdata.EnforceConstraints = false;
            AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter adp = new AttendanceDataSetTableAdapters.sp_Att_AttendanceRegister_ReportTableAdapter();

            adp.Fill(rptdata.sp_Att_AttendanceRegister_Report, Convert.ToDateTime(FromDate), Convert.ToDateTime(ToDate));



            if (Emplist != "")
            {
                dtFilter = new DataView(rptdata.sp_Att_AttendanceRegister_Report, "Emp_Id in (" + Emplist.Substring(0, Emplist.Length - 1) + ") ", "", DataViewRowState.CurrentRows).ToTable();
            }

            DataTable dtEmp  = dtFilter.DefaultView.ToTable(true, "Emp_Id");
            DataTable dtTemp = new DataTable();

            DataTable dtSalary = new DataTable();
            dtSalary = dtFilter.Clone();
            int Total_Days          = 0;
            int Days_In_WorkMin     = 0;
            int Worked_Days         = 0;
            int Week_Off_Days       = 0;
            int Holiday_Days        = 0;
            int Leave_Days          = 0;
            int Absent_Days         = 0;
            int Assigned_Worked_Min = 0;


            double Basic_Salary              = 0;
            double Basic_Min_Salary          = 0;
            double Normal_OT_Salary          = 0;
            double Week_Off_OT_Salary        = 0;
            double Holiday_OT_Salary         = 0;
            double Absent_Penalty            = 0;
            double Late_Penalty_Min          = 0;
            double Early_Penalty_Min         = 0;
            double Partial_Penalty_Min       = 0;
            int    Total_Worked_Min          = 0;
            int    Holiday_OT_Min            = 0;
            int    Week_Off_OT_Min           = 0;
            int    Normal_OT_Min             = 0;
            int    Late_Min                  = 0;
            int    Early_Min                 = 0;
            int    Partial_Min               = 0;
            double Basic_Work_Salary         = 0;
            double Normal_OT_Work_Salary     = 0;
            double WeekOff_OT_Work_Salary    = 0;
            double Holiday_OT_Work_Salary    = 0;
            double Week_Off_Days_Salary      = 0;
            double Holiday_Days_Salary       = 0;
            double Leave_Days_Salary         = 0;
            double Absent_Day_Penalty        = 0;
            double Late_Min_Penalty          = 0;
            double Early_Min_Penalty         = 0;
            double Parital_Violation_Penalty = 0;


            bool   IsEmpLate            = false;
            bool   IsEmpEarly           = false;
            bool   IsEmpPartial         = false;
            string LateMethod           = string.Empty;
            string EarlyMethod          = string.Empty;
            string PartialMethod        = string.Empty;
            int    LatePenaltyDedMin    = 0;
            int    EarlyPenaltyDedMin   = 0;
            int    PartialPenaltyDedMin = 0;
            int    PartialMin           = 0;
            int    TotalOTMin           = 0;
            double TotalGrossSalary     = 0;
            int    j = 0;
            for (int i = 0; i < dtEmp.Rows.Count; i++)
            {
                FromDate             = FromDate1;
                IsEmpLate            = false;
                IsEmpEarly           = false;
                IsEmpPartial         = false;
                LateMethod           = string.Empty;
                EarlyMethod          = string.Empty;
                PartialMethod        = string.Empty;
                LatePenaltyDedMin    = 0;
                EarlyPenaltyDedMin   = 0;
                PartialPenaltyDedMin = 0;
                TotalOTMin           = 0;

                Assigned_Worked_Min = 0;


                Basic_Salary        = 0;
                Basic_Min_Salary    = 0;
                Normal_OT_Salary    = 0;
                Week_Off_OT_Salary  = 0;
                Holiday_OT_Salary   = 0;
                Absent_Penalty      = 0;
                Late_Penalty_Min    = 0;
                Early_Penalty_Min   = 0;
                Partial_Penalty_Min = 0;
                TotalGrossSalary    = 0;
                try
                {
                    IsEmpEarly   = Convert.ToBoolean(objEmpParam.GetEmployeeParameterByParameterName(dtEmp.Rows[i]["Emp_Id"].ToString(), "Field2"));
                    IsEmpLate    = Convert.ToBoolean(objEmpParam.GetEmployeeParameterByParameterName(dtEmp.Rows[i]["Emp_Id"].ToString(), "Field1"));
                    IsEmpPartial = Convert.ToBoolean(objEmpParam.GetEmployeeParameterByParameterName(dtEmp.Rows[i]["Emp_Id"].ToString(), "Is_Partial_Enable"));

                    LateMethod           = objAppParam.GetApplicationParameterValueByParamName("Is_Late_Penalty_Method", Session["CompId"].ToString());
                    EarlyMethod          = objAppParam.GetApplicationParameterValueByParamName("Is_Early_Penalty_Method", Session["CompId"].ToString());
                    PartialMethod        = objAppParam.GetApplicationParameterValueByParamName("Partial_Penalty_Method", Session["CompId"].ToString());
                    LatePenaltyDedMin    = int.Parse(objAppParam.GetApplicationParameterValueByParamName("Late_Penalty_Min_Deduct", Session["CompId"].ToString()));
                    EarlyPenaltyDedMin   = int.Parse(objAppParam.GetApplicationParameterValueByParamName("Early_Penalty_Min_Deduct", Session["CompId"].ToString()));
                    PartialPenaltyDedMin = int.Parse(objAppParam.GetApplicationParameterValueByParamName("Partial_Penalty_Min_Deduct", Session["CompId"].ToString()));
                    Total_Days           = ToDate.Subtract(FromDate).Days + 1;

                    Days_In_WorkMin = int.Parse(objEmpParam.GetEmployeeParameterByParameterName(dtEmp.Rows[i]["Emp_Id"].ToString(), "Assign_Min"));
                }
                catch
                {
                }

                try
                {
                    Basic_Salary = double.Parse(objEmpParam.GetEmployeeParameterByParameterName(dtEmp.Rows[i]["Emp_Id"].ToString(), "Basic_Salary"));
                }
                catch
                {
                }

                int assingmin = 0;
                try
                {
                    assingmin = int.Parse(objEmpParam.GetEmployeeParameterByParameterName(dtEmp.Rows[i]["Emp_Id"].ToString(), "Assign_Min"));
                }
                catch
                {
                }

                Basic_Min_Salary = Basic_Salary / (Total_Days * assingmin);
                if (Basic_Min_Salary.ToString() == "NaN")
                {
                    Basic_Min_Salary = 0;
                }

                Normal_OT_Salary   = GetOTOneMinSalary(dtEmp.Rows[i]["Emp_Id"].ToString(), "Normal", Basic_Min_Salary);
                Week_Off_OT_Salary = GetOTOneMinSalary(dtEmp.Rows[i]["Emp_Id"].ToString(), "WeekOff", Basic_Min_Salary);
                Holiday_OT_Salary  = GetOTOneMinSalary(dtEmp.Rows[i]["Emp_Id"].ToString(), "Holiday", Basic_Min_Salary);

                Absent_Penalty = OnDayAbsentSalary(Basic_Min_Salary, dtEmp.Rows[i]["Emp_Id"].ToString());

                Late_Penalty_Min = OnMinuteLatePenalty(Basic_Min_Salary, dtEmp.Rows[i]["Emp_Id"].ToString());

                Early_Penalty_Min = OnMinuteEarlyPenalty(Basic_Min_Salary, dtEmp.Rows[i]["Emp_Id"].ToString());

                Partial_Penalty_Min = OnMinuteParialPenalty(Basic_Min_Salary, dtEmp.Rows[i]["Emp_Id"].ToString());


                while (FromDate <= ToDate)
                {
                    PartialMin = 0;

                    Total_Worked_Min          = 0;
                    Holiday_OT_Min            = 0;
                    Week_Off_OT_Min           = 0;
                    Normal_OT_Min             = 0;
                    Late_Min                  = 0;
                    Early_Min                 = 0;
                    Partial_Min               = 0;
                    Basic_Work_Salary         = 0;
                    Normal_OT_Work_Salary     = 0;
                    WeekOff_OT_Work_Salary    = 0;
                    Holiday_OT_Work_Salary    = 0;
                    Week_Off_Days_Salary      = 0;
                    Holiday_Days_Salary       = 0;
                    Leave_Days_Salary         = 0;
                    Absent_Day_Penalty        = 0;
                    Late_Min_Penalty          = 0;
                    Early_Min_Penalty         = 0;
                    Parital_Violation_Penalty = 0;
                    PartialMin                = 0;


                    dtTemp = dtFilter.Clone();
                    dtTemp = new DataView(dtFilter, "Att_Date='" + FromDate.ToString("dd-MMM-yyyy") + "' and Emp_Id='" + dtEmp.Rows[i]["Emp_Id"].ToString() + "'   ", "", DataViewRowState.CurrentRows).ToTable();


                    if (dtTemp.Rows.Count > 0)
                    {
                        for (int k = 0; k < dtTemp.Rows.Count; k++)
                        {
                            dtSalary.ImportRow(dtTemp.Rows[k]);

                            dtSalary.Rows[j]["Field2"] = "";
                            dtSalary.Rows[j]["Field3"] = "";
                            dtSalary.Rows[j]["Field4"] = "";
                            //
                            Late_Min = int.Parse(dtTemp.Rows[k]["LateMin"].ToString());

                            if (IsEmpLate && LateMethod == "Min")
                            {
                                Late_Min = Late_Min * LatePenaltyDedMin;
                            }

                            Early_Min = int.Parse(dtTemp.Rows[k]["EarlyMin"].ToString());

                            if (IsEmpEarly && EarlyMethod == "Min")
                            {
                                Early_Min = Early_Min * EarlyPenaltyDedMin;
                            }

                            PartialMin       = int.Parse(dtTemp.Rows[k]["Partial_Violation_Min"].ToString());
                            Total_Worked_Min = int.Parse(dtTemp.Rows[k]["TotalAssign_Min"].ToString());
                            Days_In_WorkMin  = int.Parse(dtTemp.Rows[k]["EffectiveWork_Min"].ToString());

                            // Days_In_WorkMin = int.Parse(getWorkMinute(Days_In_WorkMin.ToString(),Total_Worked_Min.ToString()));

                            Normal_OT_Min   = int.Parse(dtTemp.Rows[k]["OverTime_Min"].ToString());
                            Week_Off_OT_Min = int.Parse(dtTemp.Rows[k]["Week_Off_Min"].ToString());
                            Holiday_OT_Min  = int.Parse(dtTemp.Rows[k]["Holiday_Min"].ToString());

                            Late_Min_Penalty          = Late_Min * Late_Penalty_Min;
                            Early_Min_Penalty         = Early_Penalty_Min * Early_Min;
                            Parital_Violation_Penalty = Partial_Penalty_Min * PartialMin;
                            Absent_Day_Penalty        = Absent_Penalty * Total_Worked_Min;

                            Basic_Work_Salary = Basic_Min_Salary * Days_In_WorkMin;

                            Normal_OT_Work_Salary  = Normal_OT_Salary * Normal_OT_Min;
                            WeekOff_OT_Work_Salary = Week_Off_OT_Salary * Week_Off_OT_Min;
                            Holiday_OT_Work_Salary = Holiday_OT_Salary * Holiday_OT_Min;

                            double TotalSalary = 0;

                            TotalOTMin += int.Parse(dtTemp.Rows[k]["OverTime_Min"].ToString());
                            if (Convert.ToBoolean(dtTemp.Rows[k]["Is_Week_Off"].ToString()))
                            {
                                dtSalary.Rows[j]["Field4"] = System.Math.Round(WeekOff_OT_Work_Salary, 2).ToString();
                                TotalSalary = Total_Worked_Min * Basic_Min_Salary;
                                dtSalary.Rows[j]["OverTime_Min"] = dtTemp.Rows[k]["Week_Off_Min"];
                                TotalOTMin += int.Parse(dtTemp.Rows[k]["Week_Off_Min"].ToString());
                            }
                            else if (Convert.ToBoolean(dtTemp.Rows[k]["Is_Holiday"].ToString()))
                            {
                                dtSalary.Rows[j]["Field4"] = System.Math.Round(Holiday_OT_Work_Salary, 2).ToString();
                                TotalSalary = Total_Worked_Min * Basic_Min_Salary;
                                dtSalary.Rows[j]["OverTime_Min"] = dtTemp.Rows[k]["Holiday_Min"];
                                TotalOTMin += int.Parse(dtTemp.Rows[k]["Holiday_Min"].ToString());
                            }
                            else if (Convert.ToBoolean(dtTemp.Rows[k]["Is_Leave"].ToString()))
                            {
                                TotalSalary = Total_Worked_Min * Basic_Min_Salary;
                                dtSalary.Rows[j]["Field4"] = "0";
                            }
                            else if (Convert.ToBoolean(dtTemp.Rows[k]["Is_Absent"].ToString()))
                            {
                                TotalSalary = Basic_Work_Salary - Absent_Day_Penalty;
                                dtSalary.Rows[j]["Field4"] = "0";
                            }
                            else if (Days_In_WorkMin != 0)
                            {
                                dtSalary.Rows[j]["Field4"] = System.Math.Round(Normal_OT_Work_Salary, 2).ToString();
                            }
                            TotalSalary = Basic_Work_Salary - Late_Min_Penalty - Early_Min_Penalty - Parital_Violation_Penalty;

                            dtSalary.Rows[j]["Field3"] = System.Math.Round(TotalSalary, 2).ToString();

                            dtSalary.Rows[j]["Field2"] = TotalOTMin.ToString();
                            try
                            {
                                TotalGrossSalary = TotalGrossSalary + TotalSalary + double.Parse(dtSalary.Rows[j]["Field4"].ToString());
                            }
                            catch
                            {
                                TotalGrossSalary = TotalGrossSalary + TotalSalary;
                            }
                            dtSalary.Rows[j]["Field5"] = System.Math.Round(TotalGrossSalary, 2).ToString();

                            //

                            j++;
                        }
                    }


                    FromDate = FromDate.AddDays(1);
                }
            }


            string CompanyName    = "";
            string CompanyAddress = "";
            string Imageurl       = "";

            DataTable DtCompany = objComp.GetCompanyMasterById(Session["CompId"].ToString());
            DataTable DtAddress = ObjAddress.GetAddressChildDataByAddTypeAndAddRefId("Company", Session["CompId"].ToString());
            if (DtCompany.Rows.Count > 0)
            {
                CompanyName = DtCompany.Rows[0]["Company_Name"].ToString();
                Imageurl    = "~/CompanyResource/" + Session["CompId"].ToString() + "/" + DtCompany.Rows[0]["Logo_Path"].ToString();
            }
            if (DtAddress.Rows.Count > 0)
            {
                CompanyAddress = DtAddress.Rows[0]["Address"].ToString();
            }
            RptShift.SetImage(Imageurl);
            RptShift.setTitleName("Daily Salary Report" + " From " + FromDate1.ToString(objSys.SetDateFormat()) + " To " + ToDate.ToString(objSys.SetDateFormat()));
            RptShift.setcompanyname(CompanyName);
            RptShift.setaddress(CompanyAddress);


            RptShift.DataSource     = dtSalary;
            RptShift.DataMember     = "sp_Att_AttendanceRegister_Report";
            rptViewer.Report        = RptShift;
            rptToolBar.ReportViewer = rptViewer;
        }
    }