private void btnPrevew_Click(object sender, EventArgs e)
        {
            dsDetails = new DataSet();

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();
            string sqlQuery = "";

            string ReportPath = "";
            string SQLQuery = "", Band = "=All=", strFloor = "", strLine = "";
            Int32  DeptId = 0, EmpId = 0;


            if (optrptFormat.Value.ToString().ToUpper() == "General".ToUpper())
            {
                //Collecting Parameter Value
                if (optCriteria.Value.ToString().ToUpper() == "Department".ToUpper())
                {
                    DeptId   = Int32.Parse(gridSect.ActiveRow.Cells["SectId"].Value.ToString());
                    strFloor = cboFloor.Text.ToString();
                    strLine  = cboLine.Text.ToString();

                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptJobCardB.rdlc";
                    SQLQuery   = "Exec rptJobCardB " + Common.Classes.clsMain.intComId + ",'" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "'," + DeptId.ToString() + ", '" + strFloor + "','" + Band + "', " + EmpId + " ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);
                    clsMain.strReportName = "Job Card";

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }
                else if (optCriteria.Value.ToString().ToUpper() == "Employee".ToUpper())
                {
                    foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridEmployee.Rows)
                    {
                        if (row.Cells["EmpId"].Text.ToString().Length != 0 &&
                            row.Cells["isCheck"].Value.ToString() == "1")
                        {
                            EmpId = Int32.Parse(row.Cells["empid"].Text.ToString());

                            ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptJobCardB.rdlc";
                            SQLQuery   = "Exec rptJobCardB " + Common.Classes.clsMain.intComId + ",'" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "'," + DeptId.ToString() + ", '','" + Band + "', " + EmpId + " ";
                            clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);
                            clsMain.strReportName = "Job Card";
                        }
                    }
                }
                else if (optCriteria.Value.ToString().ToUpper() == "Line".ToUpper())
                {
                    Band = gridBand.ActiveRow.Cells["varName"].Value.ToString();

                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptJobCardB.rdlc";
                    SQLQuery   = "Exec rptJobCardB " + Common.Classes.clsMain.intComId + ",'" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "'," + DeptId.ToString() + ", '" + strFloor + "','" + Band + "', " + EmpId + " ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);
                    clsMain.strReportName = "Job Card";

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }
            }


            else
            {
                if (optCriteria.Value.ToString().ToUpper() == "Department".ToUpper())
                {
                    DeptId   = Int32.Parse(gridSect.ActiveRow.Cells["SectId"].Value.ToString());
                    strFloor = cboFloor.Text.ToString();
                    strLine  = cboLine.Text.ToString();

                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptJobCardDetails.rdlc";
                    SQLQuery   = "Exec rptJobCardMonthlyProcess " + Common.Classes.clsMain.intComId + ",'" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "'," + DeptId.ToString() + ", '" + strFloor + "','" + strLine + "', " + EmpId + "";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);
                    clsMain.strReportName = "Job Card Details";

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }

                else if (optCriteria.Value.ToString().ToUpper() == "Employee".ToUpper())
                {
                    EmpId = Int32.Parse(gridEmployee.ActiveRow.Cells["EmpId"].Value.ToString());

                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptJobCardDetails.rdlc";
                    SQLQuery   = "Exec rptJobCardMonthlyProcess " + Common.Classes.clsMain.intComId + ",'" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "'," + DeptId.ToString() + ", '" + strFloor + "','" + strLine + "', " + EmpId + "";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);
                    clsMain.strReportName = "Job Card Details";

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }

                else if (optCriteria.Value.ToString().ToUpper() == "Line".ToUpper())
                {
                    Band = gridBand.ActiveRow.Cells["varName"].Value.ToString();

                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptJobCardB.rdlc";
                    SQLQuery   = "Exec rptJobCardB " + Common.Classes.clsMain.intComId + ",'" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "'," + DeptId.ToString() + ", '" + strFloor + "','" + Band + "', " + EmpId + " ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);
                    clsMain.strReportName = "Job Card";

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }
            }


            string DataSourceName = "DataSet1";
            string FormCaption    = "Report :: Job Card ...";

            //GTRLibrary.clsReport.strReportPathMain = ReportPath;
            //GTRLibrary.clsReport.strQueryMain = SQLQuery;
            //GTRLibrary.clsReport.strDSNMain = DataSourceName;

            //clsMain.strExtension = optFormat.Value.ToString();
            //clsMain.strFormat = optFormat.Text.ToString();

            //FM.prcShowReport(FormCaption);


            clsReport.strReportPathMain         = ReportPath;
            clsReport.dsReport                  = dsDetails;
            clsReport.strDSNMain                = DataSourceName;
            Common.Classes.clsMain.strExtension = optFormat.Value.ToString();
            Common.Classes.clsMain.strFormat    = optFormat.Text.ToString();
            FM.prcShowReport(FormCaption);



            //clsReport.strReportPathMain = ReportPath;
            //clsReport.strQueryMain = SQLQuery;
            //clsReport.strDSNMain = DataSourceName;

            //clsMain.strExtension = optFormat.Value.ToString();
            //clsMain.strFormat = optFormat.Text.ToString();
        }
        private void prcShowReport(string Param, string Param2 = "")
        {
            dsDetails = new DataSet();

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();
            string sqlQuery = "";

            try
            {
                DataSourceName = "DataSet1";
                FormCaption    = "Report :: Attendance Information...";

                string SectId = "0", DesigId = "0", ShiftId = "0", EmpId = "0", EmpType = " ", Band = "=ALL=";

                if (optCriteria.Value.ToString().ToUpper() == "All".ToUpper())
                {
                    EmpType = gridType.ActiveRow.Cells["varName"].Value.ToString();
                }
                else if (optCriteria.Value.ToString().ToUpper() == "Section".ToUpper())
                {
                    SectId  = gridSection.ActiveRow.Cells["SectId"].Value.ToString();
                    ShiftId = gridShiftTime.ActiveRow.Cells["shiftid"].Value.ToString();
                    Band    = gridBand.ActiveRow.Cells["varName"].Value.ToString();
                    EmpType = gridType.ActiveRow.Cells["varName"].Value.ToString();
                }

                else if (optCriteria.Value.ToString().ToUpper() == "Shifting".ToUpper())
                {
                    ShiftId = gridShiftTime.ActiveRow.Cells["shiftid"].Value.ToString();
                    Band    = gridBand.ActiveRow.Cells["varName"].Value.ToString();
                    EmpType = gridType.ActiveRow.Cells["varName"].Value.ToString();
                }

                else if (optCriteria.Value.ToString().ToUpper() == "Type".ToUpper())
                {
                    EmpType = gridType.ActiveRow.Cells["varName"].Value.ToString();
                    Band    = gridBand.ActiveRow.Cells["varName"].Value.ToString();
                }

                else if (optCriteria.Value.ToString().ToUpper() == "Band".ToUpper())
                {
                    Band    = gridBand.ActiveRow.Cells["varName"].Value.ToString();
                    EmpType = gridType.ActiveRow.Cells["varName"].Value.ToString();
                }

                if (optCriteria.Value.ToString().ToUpper() == "Employee".ToUpper())
                {
                    EmpType = gridType.ActiveRow.Cells["varName"].Value.ToString();

                    sqlQuery = "delete tbltempattIndividual ";

                    arQuery.Add(sqlQuery);

                    EmpId = gridEmployeeID.ActiveRow.Cells["empid"].Value.ToString();

                    foreach (UltraGridRow row in gridEmployeeID.Rows)
                    {
                        if (row.Cells["isChecked"].Text.ToString() == "1")
                        {
                            //EmpId += row.Cells["EmpId"].Value + ",";

                            //sqlQuery = " Delete  tblLeave_Balance where empid = '" + row.Cells["empid"].Text.ToString() + "' and dtOpBal =  '" + row.Cells["dtOpeningDate"].Text.ToString() + "'";
                            //arQuery.Add(sqlQuery);


                            sqlQuery = "insert into tbltempattIndividual (EmpId)"
                                       + "values ('" + row.Cells["empid"].Text.ToString() + "')";

                            arQuery.Add(sqlQuery);
                            // EmpId += row.Cells["EmpId"].Value + ",";
                        }
                    }
                    clsCon.GTRSaveDataWithSQLCommand(arQuery);
                    //EmpId = EmpId.Substring(0, EmpId.Length - 1);
                }

                if (Param == "Summary")
                {
                    rptQuery = "Exec rptAttendSum " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "'," + ShiftId + ",'" + EmpType + "','" + Param2 + "'";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);
                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }

                else if (Param == "Summary Sec")
                {
                    rptQuery = "Exec rptAttendSumSec " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + EmpType + "'";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);
                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }
                else if (Param == "Movment")
                {
                    rptQuery = "Exec rptDailyMovement " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "',  '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + SectId + ", " + EmpId + " ";


                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);
                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }
                else if (Param == "AttendAll")
                {
                    rptQuery = "Exec rptAttendAll " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }

                    dsDetails.Tables[0].TableName = "Atten";

                    gridExcel.DataSource = null;
                    gridExcel.DataSource = dsDetails.Tables["Atten"];
                }
                else if (Param == "WHPresent")
                {
                    rptQuery = "Exec rptAttendWHPresent " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }

                    dsDetails.Tables[0].TableName = "Atten";

                    gridExcel.DataSource = null;
                    gridExcel.DataSource = dsDetails.Tables["Atten"];
                }
                else if (Param == "Night Allownce")
                {
                    rptQuery = "Exec rptNightAllw " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }
                else if (Param == "Over Night Allownce")
                {
                    rptQuery = "Exec rptOverNightAllw " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }

                else if (Param == "Holiday Allownce")
                {
                    rptQuery = "Exec rptHolidayAllw " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }
                }

                else if (Param == "TimeRange")
                {
                    rptQuery = "Exec rptAttendTime " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "','" + txtTime1.Value.ToString() + "','" + txtTime2.Value.ToString() + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }

                    dsDetails.Tables[0].TableName = "Atten";

                    gridExcel.DataSource = null;
                    gridExcel.DataSource = dsDetails.Tables["Atten"];
                }

                else if (Param == "PresentAbsent")
                {
                    rptQuery = "Exec [rptAttendAbtnPrnt] " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }

                    dsDetails.Tables[0].TableName = "Atten";

                    gridExcel.DataSource = null;
                    gridExcel.DataSource = dsDetails.Tables["Atten"];
                }

                else
                {
                    rptQuery = "Exec rptAttend " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', " + ShiftId + ", " + DesigId + ", " + SectId + ", '', '', " + EmpId + ",'" + EmpType + "','" + Param + "','" + optCriteria.Value.ToString() + "','" + Band + "' ";
                    clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, rptQuery);

                    if (dsDetails.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("Data Not Found");
                        return;
                    }

                    dsDetails.Tables[0].TableName = "Atten";

                    gridExcel.DataSource = null;
                    gridExcel.DataSource = dsDetails.Tables["Atten"];
                }

                clsReport.strReportPathMain         = ReportPath;
                clsReport.dsReport                  = dsDetails;
                clsReport.strDSNMain                = DataSourceName;
                Common.Classes.clsMain.strExtension = optFormat.Value.ToString();
                Common.Classes.clsMain.strFormat    = optFormat.Text.ToString();
                FM.prcShowReport(FormCaption);

                //clsReport.strReportPathMain = ReportPath;
                //clsReport.strQueryMain = rptQuery;
                //clsReport.dsReport = dsDetails;
                //clsReport.strDSNMain = DataSourceName;

                //FM.prcShowReport(FormCaption);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            finally
            {
                rptQuery       = null;
                DataSourceName = null;
                ReportPath     = null;
                clsCon         = null;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (fncBlank())
            {
                return;
            }

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();
            string sqlQuery = "";
            Int32  NewId    = 0;
            //string sqlQuery = "";
            Int32 RowID;

            try
            {
                //Member Master Table
                if (btnSave.Text.ToString() != "&Save")
                {
                }
                else
                {
                    foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridList.Rows)
                    {
                        if (row.Cells["empid"].Text.ToString().Length != 0 &&
                            row.Cells["isChecked"].Value.ToString() == "1")
                        {
                            //RowID = row.Index + 1;
                            ///CONVERT(VARCHAR,OtHour,108) AS  FROM  tblOTPermission As A

                            sqlQuery = " Delete tblTempCount;Insert into tblTempCount(EmpID,Cnt,DateTime1) Select EmpID,OTHour,dtPunchDate from tblOTPermission where empid = '" + row.Cells["empid"].Text.ToString() +
                                       "' and dtPunchDate =  '" + row.Cells["dtPunchDate"].Text.ToString() + "'";
                            arQuery.Add(sqlQuery);

                            sqlQuery = " Delete  tblOTPermission where empid = '" + row.Cells["empid"].Text.ToString() +
                                       "' and dtPunchDate =  '" + row.Cells["dtPunchDate"].Text.ToString() + "'";
                            arQuery.Add(sqlQuery);


                            sqlQuery = " Insert Into tblOTPermission(empid,dtPunchDate,OtHour,Remarks,Luserid,comid,pcname,Approval) "
                                       + " Values ('" + row.Cells["empid"].Text.ToString() + "', '" +
                                       row.Cells["dtPunchDate"].Text.ToString() + "','" +
                                       row.Cells["otHour"].Value.ToString() + "',' ' + '" +
                                       row.Cells["Remarks"].Value.ToString() + "'," + Common.Classes.clsMain.intUserId +
                                       "," + Common.Classes.clsMain.intComId + ",'" +
                                       Common.Classes.clsMain.strComputerName + "','Y')";
                            arQuery.Add(sqlQuery);

                            sqlQuery = " Update O Set O.PrevOTHour = T.Cnt from tblOTPermission O,tblTempCount T Where O.EmpID = T.EmpID and O.dtPunchDate = T.DateTime1 and O.Approval = 'Y' and O.empid = '" + row.Cells["empid"].Text.ToString() +
                                       "' and O.dtPunchDate =  '" + row.Cells["dtPunchDate"].Text.ToString() + "'";
                            arQuery.Add(sqlQuery);
                        }
                    }

                    sqlQuery = " exec  [prcProcessOTPermission] " + Common.Classes.clsMain.intComId + ", '" +
                               clsProc.GTRDate(dtInputDate.Value.ToString()) + "','" + clsProc.GTRDate(dtInputToDate.Value.ToString()) + "' ";
                    arQuery.Add(sqlQuery);

                    // Insert Information To Log File
                    sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName,tranType)"
                               + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" +
                               sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')";
                    arQuery.Add(sqlQuery);

                    //Transaction with database
                    clsCon.GTRSaveDataWithSQLCommand(arQuery);

                    MessageBox.Show("Data Saved Succefully.");
                }
                prcClearData();
                cboDept.Focus();

                prcLoadList();
                prcLoadCombo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                arQuery = null;
                clsCon  = null;
            }
        }
        private void cboAddList_Click(object sender, EventArgs e)
        {
            if (fncBlank())
            {
                return;
            }


            if (optCriteria.Value == "All")
            {
                Data = cboDept.Value.ToString();
            }
            else if (optCriteria.Value == "Sec")
            {
                Data = cboSection.Value.ToString();
            }
            else if (optCriteria.Value == "SubSec")
            {
                Data = cboSubSection.Value.ToString();
            }
            else if (optCriteria.Value == "Band")
            {
                Data = cboBand.Text.ToString();
            }
            else if (optCriteria.Value == "ShiftTime")
            {
                Data = cboShiftTime.Value.ToString();
            }


            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();
            dsDetails = new System.Data.DataSet();

            try
            {
                string sqlQuery = "Exec [prcGetOTApproval] 1," + Common.Classes.clsMain.intComId + ",'" + optCriteria.Value +
                                  "','" + strValue + "','" + clsProc.GTRDate(dtInputDate.Value.ToString()) + "','" +
                                  clsProc.GTRDate(dtInputToDate.Value.ToString()) + "' ";
                clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery);
                dsDetails.Tables[0].TableName = "tblFixData";

                gridList.DataSource = null;
                gridList.DataSource = dsDetails.Tables["tblFixData"];

                if (dsDetails.Tables["tblFixData"].Rows.Count > 0)
                {
                    btnFillData.Enabled = true;
                    groupData.Enabled   = true;

                    txtOT.Value = "0";
                }
                else
                {
                    MessageBox.Show("No Data Found.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //   throw;
            }
        }
        private void prcDisplayDetailsReg(string strParam, string strParam2)
        {
            dsDetails = new DataSet();
            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection("GTRHRIS");

            string sqlQuery = "Exec prcgetBasiAddmsn " + Int32.Parse(strParam) + "," + Common.Classes.clsMain.intComId + ",'REG'";

            clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery);
            dsDetails.Tables[0].TableName = "AdmsnInfo";
            dsDetails.Tables[1].TableName = "Pic";
            //dsDetails.Tables[2].TableName = "Template";

            dsDetails.Tables["Pic"].Columns.Add("Pic", typeof(Bitmap));


            try
            {
                DataRow dr2;
                if (dsDetails.Tables["Pic"].Rows.Count > 0)
                {
                    //dsList.Tables["Pic"].Columns.Add("Pic", typeof(Bitmap));

                    foreach (DataRow drpic in dsDetails.Tables["Pic"].Rows)
                    {
                        dr2 = dsList.Tables["Pic"].NewRow();
                        string strTarget = Common.Classes.clsMain.strPicPathCmps + @"\" + drpic["PicName"].ToString();
                        string STr       = Common.Classes.clsMain.strPicPathCmps + @"\Temp\" + drpic["PicName"].ToString();
                        //File.Delete(STr);
                        if (File.Exists(STr) == false)
                        {
                            File.Copy(strTarget, STr, false);
                        }
                        dr2            = dsList.Tables["Pic"].NewRow();
                        dr2["PicBy"]   = drpic["PicBy"].ToString();
                        dr2["picname"] = drpic["picname"].ToString();
                        // dr2["pict"] = drpic["picname"].ToString();
                        // Attachment at=new Attachment(@"D:\Work\Another One solution\GTRSolution\gt\Com\pics\CMPS\" + drpic["PicName"].ToString());
                        dr2["Pic"] = new Bitmap(Common.Classes.clsMain.strPicPathCmps + @"\Temp\" + drpic["PicName"].ToString());
                        dsList.Tables["Pic"].Rows.Add(dr2);
                    }
                }
                else
                {
                    dsList.Tables["Pic"].Rows.Clear();

                    //dsList.Tables["Pic"].Columns.Add("Pic", typeof(Bitmap));
                    //gridPics.DataSource = null;
                    //gridPics.DataSource = dsList.Tables["Pic"];

                    //gridPics.DataSource = null;
                }
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            DataRow dr;

            if (dsDetails.Tables["AdmsnInfo"].Rows.Count > 0)
            {
                dr = dsDetails.Tables["AdmsnInfo"].Rows[0];
                if (dr["Src"].ToString() == "ADMEXAM")
                {
                }


                else
                {
                }
            }
        }
        private void btnPreview_Click(object sender, EventArgs e)
        {
            dsDetails = new DataSet();

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();

            try
            {
                string ReportPath = "", SQLQuery = "", DataSourceName = "DataSet1", FormCaption = "", Band = "";

                DataSourceName = "DataSet1";
                FormCaption    = "Report :: PF...";


                if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "PF Final Report"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSheet.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',0";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "PF Final Report Excel"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSheetExcel.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',0";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "PF Summary Final"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSum.rdlc";
                    SQLQuery   = "Exec [rptPFSum] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',0";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "PF Summary"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSumShort.rdlc";
                    SQLQuery   = "Exec [rptPFSum] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',0";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Monthly PF Sheet"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptSalaryPF.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',1";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "First PF Sheet"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSheetFirst.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',2";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Release PF Sheet"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSheetReleased.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',3";
                }

                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Ledger Sheet"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFLedger.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',5";
                }

                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "PF Individual Report"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptPFSheetPaySlip.rdlc";
                    SQLQuery   = "Exec [rptPFSheet] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + cboPayMode.Value.ToString() + "', '" + cboEmpType.Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + cboStatus.Value.ToString() + "',4";
                }

                clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);

                if (dsDetails.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("Data Not Found");
                    return;
                }


                clsReport.strReportPathMain         = ReportPath;
                clsReport.dsReport                  = dsDetails;
                clsReport.strDSNMain                = DataSourceName;
                Common.Classes.clsMain.strExtension = optFormat.Value.ToString();
                Common.Classes.clsMain.strFormat    = optFormat.Text.ToString();
                FM.prcShowReport(FormCaption);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                SQLQuery       = null;
                DataSourceName = null;
                ReportPath     = null;
                dsDetails      = null;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (fncBlankA() == true)
            {
                return;
            }


            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();
            dsList = new DataSet();
            int    NewID, slno;
            string AdmID;
            string sqlQuery;

            try
            {
                if (txtAdmsnID.Text.Length > 0)
                {
                    sqlQuery = "update  tblAdm_Form set frmNo='" + txtFormNo.Text.ToString() + "', nmFirst='" + txtNm.Text + "', nmMiddle='" + txtMn.Text
                               + "', nmLast='" + txtLn.Text.Trim() + "', nmFather='" + txtFatherNm.Text.Trim() + "', nmMother='" + txtMotherNm.Text.Trim()
                               + "', sesn='" + txtSesion.Text.Trim() + "',frmTakenDt='" + clsProc.GTRDate(dtAdmsn.Value.ToString()) + "',clsid='" + cboAdmisnFor.Value.ToString()
                               + "', sex = '" + cboSex.Text.Trim() + "', relegion = '" + cboReligion.Text.Trim() + "',mobile = '" + txtMobile.Text.Trim() + "',Phone = '" + txtPhone.Text.Trim()
                               + "', amount = " + txtAmt.Text.Trim() + ",Reference = '" + txtReferrance.Text.Trim() + "',remarks = '" + txtFrmRemarks.Text.Trim() + "' " +
                               " where admid='" + txtAdmsnID.Text + "'";
                    arQuery.Add(sqlQuery);

                    sqlQuery = "Insert Into GTRSystem.dbo.tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)"
                               + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','UPDATE')";
                    arQuery.Add(sqlQuery);
                    clsCon.GTRSaveDataWithSQLCommand(arQuery);
                    MessageBox.Show("Data Update Successfully");
                }
                else
                {
                    NewID = 0;
                    slno  = 0;

                    //Select ISNULL(max((right(frmNoAuto,6))),100000 )+1 as NewID from tblAdm_Form
                    sqlQuery = "Select ISNULL(max(frmNoAuto),100000 )+1 as NewID from tblAdm_Form";
                    AdmID    = clsCon.GTRCountingData(sqlQuery).ToString();

                    // string addata =AdmID.ToString().Substring(4, 6);
                    sqlQuery = "Select convert(int,ISNULL(max(AdmId),0 )+1) as NewID from tblAdm_Form";
                    NewID    = clsCon.GTRCountingData(sqlQuery);

                    //sqlQuery = "Select convert(int,ISNULL(max(slno),0 )+1) as slno from tblAdm_Form where sesn = '"+ txtSesion.Text +"' and clsId = '"+cboClas.Value.ToString()+ "'";
                    sqlQuery = "Select convert(int,ISNULL(max(slno),0 )+1) as slno from tblAdm_Form where sesn = '" + txtSesion.Text + "'";
                    slno     = clsCon.GTRCountingData(sqlQuery);


                    sqlQuery = "Insert Into tblAdm_Form (sesn,AdmId,slno, frmNo, frmNoAuto,nmFirst, nmMiddle, nmLast, nmFather, nmMother, clsid, yrNm,frmTakenDt,Address,sex,relegion,phone,mobile,amount,Reference,remarks)";
                    sqlQuery = sqlQuery + "values('" + txtSesion.Text.Trim() + "'," + NewID + "," + slno + ",'" + txtFormNo.Text.Trim() + "'," + AdmID + ",'" + txtNm.Text.Trim() + "','" + txtMn.Text.Trim() + "','" + txtLn.Text.Trim() + "','" + txtFatherNm.Text.Trim() + "','" + txtMotherNm.Text.Trim()
                               + "','" + cboAdmisnFor.Value.ToString() + "','" + txtSesion.Text.Trim() + "','" + clsProc.GTRDate(dtAdmsn.Value.ToString()) + "','" + txtAddress.Text + "','" + cboSex.Text + "','" + cboReligion.Text + "','" + txtPhone.Text + "','" + txtMobile.Text + "','" + txtAmt.Text + "','" + txtReferrance.Text + "','" + txtFrmRemarks.Text + "')";
                    arQuery.Add(sqlQuery);

                    sqlQuery = "Insert Into GTRSystem.dbo.tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)"
                               + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Insert')";
                    arQuery.Add(sqlQuery);
                    clsCon.GTRSaveDataWithSQLCommand(arQuery);
                    MessageBox.Show("Data Saved Successfully");
                }
                PrcCleraData();
                PrcLoadList();
                PrcLoadCombo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                clsCon  = null;
                arQuery = null;
            }
        }
Exemple #8
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            dsDetails = new DataSet();

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();

            try
            {
                string ReportPath = "", SQLQuery = "", DataSourceName = "DataSet1", FormCaption = "";

                DataSourceName = "DataSet1";
                FormCaption    = "Report :: Leave Information...";

                if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "General".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','=ALL=','General'";
                }

                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "ML".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'ML'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "FirstML".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'FirstML'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "LastML".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'LastML'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "Details".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveDetails.rdlc";
                    SQLQuery   = "Exec rptLeaveBalance " + Common.Classes.clsMain.intComId + ", '" + cboFinyear.Value.ToString() + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'Details'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "Summary".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveSum.rdlc";
                    SQLQuery   = "Exec rptLeaveBalance " + Common.Classes.clsMain.intComId + ", " + cboFinyear.Value.ToString() + ",'" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "','Summary'";
                }

                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "MonthDetails".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveMonthDetails.rdlc";
                    SQLQuery   = "Exec rptLeaveBalanceDetails " + Common.Classes.clsMain.intComId + ", " + cboFinyear.Value.ToString() + ",'" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'MonthDetails'";
                }

                clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);

                if (dsDetails.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("Data Not Found");
                    return;
                }

                clsReport.strReportPathMain         = ReportPath;
                clsReport.dsReport                  = dsDetails;
                clsReport.strDSNMain                = DataSourceName;
                Common.Classes.clsMain.strExtension = optFormat.Value.ToString();
                Common.Classes.clsMain.strFormat    = optFormat.Text.ToString();
                FM.prcShowReport(FormCaption);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                dsDetails = new DataSet();

                ArrayList arQuery = new ArrayList();
                GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();


                string ReportPath = "", SQLQuery = "", DataSourceName = "DataSet1", FormCaption = "", Band = "", EmpType = "";
                Band    = gridBand.ActiveRow.Cells["varName"].Value.ToString();
                EmpType = gridEmpType.ActiveRow.Cells["varName"].Value.ToString();

                DataSourceName = "DataSet1";
                FormCaption    = "Report :: Payment Information...";

                if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Active Incentive Report"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptIncentive.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Active Incentive Report'";
                }
                if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Released Incentive Report"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptIncentive.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Released Incentive Report'";
                }

                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Active Incentive Payment List"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptIncentivePayList.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Active Incentive Payment List'";
                }
                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Released Incentive Payment List"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptIncentivePayList.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Released Incentive Payment List'";
                }

                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Incentive Amount"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptIncentiveAmt.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Incentive Amount'";
                }

                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Best Performance Report"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptBestPerform.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Best Performance Report'";
                }

                else if ((gridReportCategory.ActiveRow.Cells["rptname"].Text.ToString() == "Best Performance Payslip"))
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptBestPerformPaySlip.rdlc";
                    SQLQuery   = "Exec [rptIncentive] " + Common.Classes.clsMain.intComId + ", '" + gridProssType.ActiveRow.Cells[0].Value.ToString() + "','" + gridSec.ActiveRow.Cells[0].Value.ToString() + "','" + gridEmployee.ActiveRow.Cells[0].Value.ToString() + "','" + Band + "','" + EmpType + "',1,'Best Performance Payslip'";
                }


                clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);

                if (dsDetails.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("Data Not Found");
                    return;
                }


                clsReport.strReportPathMain         = ReportPath;
                clsReport.dsReport                  = dsDetails;
                clsReport.strDSNMain                = DataSourceName;
                Common.Classes.clsMain.strExtension = optFormat.Value.ToString();
                Common.Classes.clsMain.strFormat    = optFormat.Text.ToString();
                FM.prcShowReport(FormCaption);

                //clsReport.strReportPathMain = ReportPath;
                //clsReport.strQueryMain = SQLQuery;
                //clsReport.strDSNMain = DataSourceName;

                //FM.prcShowReport(FormCaption);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #10
0
        private void btnDisApprove_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure permission disapprove this employee?", "",
                                System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            if (fncBlank())
            {
                return;
            }

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();

            string sqlQuery = "", Option = "";

            Option = gridRpt.ActiveRow.Cells["PName"].Value.ToString();

            try
            {
                //Member Master Table

                foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridList.Rows)
                {
                    if (row.Cells["empid"].Text.ToString().Length != 0 &&
                        row.Cells["isChecked"].Value.ToString() == "1")
                    {
                        sqlQuery = "Exec PrcProcessPermission 1," + Common.Classes.clsMain.intComId + "," +
                                   Common.Classes.clsMain.intUserId + ",'" + Option + "','" +
                                   row.Cells["empid"].Text.ToString() + "','" +
                                   row.Cells["Remarks"].Text.ToString() + "','" +
                                   Common.Classes.clsMain.strComputerName + "'";
                        arQuery.Add(sqlQuery);

                        //prcMail();

                        sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement,PCName, tranType)"
                                   + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" +
                                   sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Disapprove')";
                        arQuery.Add(sqlQuery);
                    }
                }


                //Transaction with database
                clsCon.GTRSaveDataWithSQLCommand(arQuery);

                MessageBox.Show("Disapprove Succefully Done.");

                prcClearData();
                prcLoadData();
                //prcLoadCombo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                arQuery = null;
                clsCon  = null;
            }
        }
Exemple #11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (fncBlank())
            {
                return;
            }


            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();
            string sqlQuery = "";

            try
            {
                //Member Master Table
                if (btnSave.Text.ToString() == "&Save")
                {
                    foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridDetails.Rows)
                    {
                        if (row.Cells["empid"].Text.ToString().Length != 0 &&
                            row.Cells["isChecked"].Value.ToString() == "1")
                        {
                            sqlQuery = " Delete  tblUnclaimed Where empid = '" + row.Cells["empid"].Text.ToString() +
                                       "' and ProssType = '" + row.Cells["ProssType"].Text.ToString() +
                                       "' and ComID = " + Common.Classes.clsMain.intComId + " and AllowType = '" + cboType.Text.ToString() +
                                       "' and PaidYN = 1";
                            arQuery.Add(sqlQuery);


                            sqlQuery = " Insert Into tblUnclaimed(EmpId,dtDate,ProssType,AllowType,TotalAmount,Remarks,Luserid,PCName,ComId,PaidYN) "
                                       + " Values ('" + row.Cells["empid"].Text.ToString() + "', '" + row.Cells["dtDate"].Text.ToString() + "','"
                                       + row.Cells["ProssType"].Value.ToString() + "','" + cboType.Text.ToString() + "','"
                                       + row.Cells["Amount"].Value.ToString() + "','" + row.Cells["Remarks"].Value.ToString() + "',"
                                       + Common.Classes.clsMain.intUserId + ",'" + Common.Classes.clsMain.strComputerName + "',"
                                       + Common.Classes.clsMain.intComId + ",1)";
                            arQuery.Add(sqlQuery);
                        }
                    }


                    // Insert Information To Log File
                    sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement,PCName, tranType)"
                               + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" +
                               sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')";
                    arQuery.Add(sqlQuery);

                    //Transaction with database
                    clsCon.GTRSaveDataWithSQLCommand(arQuery);

                    MessageBox.Show("Data Saved Succefully.");
                }
                //prcClearData();
                prcLoadSaveData();
                //PrcLoadCombo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                arQuery = null;
                clsCon  = null;
            }
        }