private void OnClickRow()
        {
            try
            {
                //DataRow CurrentRow = gridView_AttendanceData.GetDataRow(gridView_AttendanceData.FocusedRowHandle);
                int        row                 = (gridControl_AttendanceData.FocusedView as ColumnView).FocusedRowHandle;
                ColumnView detailView          = (ColumnView)gridControl_AttendanceData.FocusedView;
                int        cellValue_serial_id = ConvertTo.IntVal(detailView.GetFocusedRowCellValue("SerialId")); //.GetRowCellValue(row, "Edit_Link").ToString();
                                                                                                                  //
                string employee_code   = detailView.GetFocusedRowCellValue("EmployeeCode").ToString();
                string attendance_date = ConvertTo.DateFormatDb(detailView.GetFocusedRowCellValue("AttendanceDate").ToString());

                PrintLogWin.PrintLog("%%%%%%%%%%%%%%%%" + cellValue_serial_id);
                PrintLogWin.PrintLog("%%%%%%%%%%%%%%%%" + row);

                //MessageBox.Show(CurrentRow[0] + "");


                OpenAttendanceForm(cellValue_serial_id, employee_code, attendance_date);
            }
            catch (Exception ex)
            {
                PrintLogWin.PrintLog("%%%%%%%%%%%%%%%% => Exception : " + ex);
            }
        }
Exemplo n.º 2
0
        private void SetFormValues(int rowIndex, string _employee_code, string _attendance_date, int _serial_id)
        {
            try
            {
                string str = "sp_GatePassData_Single '" + _employee_code + "', '" + ConvertTo.DateFormatDb(ConvertTo.DateTimeVal(_attendance_date)) + "', " + _serial_id + string.Empty;

                PrintLogWin.PrintLog(str);

                DataSet _ds = ProjectFunctionsUtils.GetDataSet(str);

                if (ComparisonUtils.IsNotNull_DataSet(_ds))
                {
                    DataRow dr = _ds.Tables[0].Rows[rowIndex];
                    DtDate.EditValue = Convert.ToDateTime(dr["AttendanceDate"]);
                    txtEmpCode.Text  = dr["EmpCode"].ToString();
                    txtEmpCode.Tag   = dr["SerialId"].ToString();

                    txtEmpCodeDesc.Text = dr["EmpName"].ToString();
                    txtEmpCodeDesc.Tag  = dr["DeptDesc"].ToString();

                    txtStatusCode.Text = dr["StatusCode"].ToString();
                    txtStatusCode.Tag  = dr["UnitName"].ToString();

                    txtStatusCodeDesc.Text = dr["Status"].ToString();

                    timeEdit_Time_Out.EditValue = dr["TimeOut"].ToString();
                    timeEdit_Time_In.EditValue  = dr["TimeIn"].ToString();

                    pictureBox1.Image = ImageUtils.ConvertBinaryToImage((byte[])dr["EmpImage"]);

                    PrintLogWin.PrintLog("TimeOut " + dr["TimeOut"].ToString());
                    PrintLogWin.PrintLog("TimeIn " + dr["TimeIn"].ToString());

                    ////////////////////////

                    /*XtraReportGatePass report = new XtraReportGatePass(
                     * dr["EmpCode"].ToString(),
                     * ConvertTo.IntVal(dr["SerialId"].ToString()),
                     * dr["EmpName"].ToString(),
                     * dr["DeptDesc"].ToString() + "",
                     * dr["UnitName"].ToString() + "",
                     * "",
                     * dr["Status"].ToString(),
                     * timeEdit_Time_Out.EditValue + "",
                     * timeEdit_Time_In.EditValue + "",
                     * pictureBox1.Image
                     * );*/
                }
                else
                {
                    //clear();
                }
            }
            catch (Exception ex)
            {
                PrintLogWin.PrintLog(ex);
                //                clear();
            }
        }
 private void BtnExportXsls_Click(object sender, EventArgs e)
 {
     if (ComparisonUtils.IsEmpty(DtStartDate.EditValue) || ComparisonUtils.IsEmpty(txtEmpCode.EditValue))
     {
         ProjectFunctions.SpeakError("Enter Attendance Month and Employee Code");
         txtEmpCode.Focus();
     }
     else
     {
         string path = txtEmpCode.EditValue + "_Attendance_For_Month_" + ConvertTo.DateFormatDb(DtStartDate.EditValue) + ".xlsx";
         gridControl_AttendanceData.ExportToXlsx(path);
         // Open the created XLSX file with the default application.
         Process.Start(path);
     }
 }
Exemplo n.º 4
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int serial_id = ConvertTo.IntVal(txtEmpCode.Tag);

                var               str      = "sp_GatePassData_AddEdit";
                RepGen            reposGen = new RepGen();
                DynamicParameters param    = new DynamicParameters();
                param.Add("@serial_id", serial_id);
                param.Add("@entry_date", ConvertTo.DateFormatDb(DateTime.Now));//Convert.ToDateTime(DateTime.Now).ToString("yyyy-MM-dd")
                param.Add("@status_id", txtStatusCode.Text);
                param.Add("@employee_code", txtEmpCode.Text);
                param.Add("@attendance_date", ConvertTo.DateFormatDb(ConvertTo.DateTimeVal(DtDate.Text)));//Convert.ToDateTime(DtDate.Text).ToString("yyyy-MM-dd")
                param.Add("@attendance_out", timeEdit_Time_Out.Text);
                param.Add("@attendance_in", timeEdit_Time_In.Text);

                param.Add("@output", dbType: DbType.Int32, direction: ParameterDirection.Output);
                param.Add("@Returnvalue", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);

                string intResult = reposGen.ExecuteNonQuery_SP(str, param);
                if (intResult.Equals("0"))
                {
                    int outputVal = param.Get <int>("@output");
                    int returnVal = param.Get <int>("@Returnvalue");

                    PrintLogWin.PrintLog("outputVal => " + outputVal);
                    PrintLogWin.PrintLog("returnVal => " + returnVal);

                    txtEmpCode.Tag = outputVal;
                    ProjectFunctions.SpeakError("Record has been saved");
                    LoadGatePassDataGrid();
                }
                else
                {
                    ProjectFunctions.SpeakError("Error in save record.");
                    PrintLogWin.PrintLog(intResult);
                }
                //this.Close();
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError("Error in save record.");
                PrintLogWin.PrintLog(ex);
            }
        }
Exemplo n.º 5
0
 private void BtnExportXsls_Click(object sender, EventArgs e)
 {
     if (ComparisonUtils.IsEmpty(DtStartDate.EditValue))
     {
         ProjectFunctions.SpeakError("Enter Salary Month");
         DtStartDate.Focus();
     }
     else
     {
         string path = Application.StartupPath + @"\Salary\" + "Salary_For_Month_" + ConvertTo.DateFormatDb(DtStartDate.EditValue) + ".xlsx";
         XlsxExportOptionsEx options = new XlsxExportOptionsEx();
         options.CustomizeCell += Options_CustomizeCell;
         gridControl_SalaryProcess.ExportToXlsx(path, options);
         ProjectFunctions.Speak("XLS GENERATED");
         Process.Start(path);
     }
 }
Exemplo n.º 6
0
        private void BtnProcessSalary_Click(object sender, EventArgs e)
        {
            DateTime salaryMonth = ConvertTo.DateTimeVal(DtStartDate.EditValue);

            if (ProjectFunctions.SpeakConfirmation("Do you want to process Salary for month [ " + salaryMonth.ToString("MMMM yyyy") + " ]", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.No)
            {
                try
                {
                    DataTable dtProcessSalary = new DataTable();
                    dtProcessSalary.Columns.Add("EmpCode", typeof(string));
                    dtProcessSalary.Columns.Add("SalaryMonth", typeof(DateTime));
                    dtProcessSalary.Columns.Add("SalaryPaid", typeof(decimal));
                    dtProcessSalary.Columns.Add("LoanInstallment", typeof(decimal));
                    dtProcessSalary.Columns.Add("SalaryCalculated", typeof(decimal));
                    dtProcessSalary.Columns.Add("TeaRate", typeof(decimal));
                    dtProcessSalary.Columns.Add("NoOfCups", typeof(decimal));
                    dtProcessSalary.Columns.Add("TotalTeaAmount", typeof(decimal));

                    for (int rowIndex = 0; rowIndex != gridView_SalaryProcess.RowCount; rowIndex++)
                    {
                        int    intRow              = gridView_SalaryProcess.GetVisibleRowHandle(rowIndex);
                        string strSalaryMonth      = gridView_SalaryProcess.GetRowCellValue(intRow, "SalaryMonth").ToString();
                        string strEmpCode          = gridView_SalaryProcess.GetRowCellValue(intRow, "EmpCode").ToString();
                        string strSalaryPaid       = gridView_SalaryProcess.GetRowCellValue(intRow, "SalaryPaid").ToString();
                        string strLoanInstallment  = gridView_SalaryProcess.GetRowCellValue(intRow, "Loan").ToString();
                        string strSalaryCalculated = gridView_SalaryProcess.GetRowCellValue(intRow, "SalaryCalculated").ToString();
                        string strTeaRate          = gridView_SalaryProcess.GetRowCellValue(intRow, "TeaRate").ToString();
                        string strNoOfCups         = gridView_SalaryProcess.GetRowCellValue(intRow, "NoOfCups").ToString();
                        string strTotalTeaAmount   = gridView_SalaryProcess.GetRowCellValue(intRow, "TotalTeaAmount").ToString();



                        PrintLogWin.PrintLog("----- btnProcessSalary_Click => strSalaryMonth: " + strSalaryMonth);
                        PrintLogWin.PrintLog("----- btnProcessSalary_Click => strEmpCode: " + strEmpCode);

                        //if (strSalaryPaid != null && strEmpCode.Equals("0030") && ConvertTo.DateTimeVal(strSalaryMonth).Month == 6)
                        if (strSalaryPaid != null)
                        {
                            if (ConvertTo.DecimalVal(strSalaryPaid) > 0)
                            {
                                PrintLogWin.PrintLog("strSalaryMonth => " + strSalaryMonth);
                                PrintLogWin.PrintLog("strEmpCode => " + strEmpCode);
                                PrintLogWin.PrintLog("strSalaryPaid => " + strSalaryPaid);
                                PrintLogWin.PrintLog("strLoanInstallment => " + strLoanInstallment);
                                PrintLogWin.PrintLog("strSalaryCalculated => " + strSalaryCalculated);
                                PrintLogWin.PrintLog("------------------------------");

                                //dt.Rows.Add(strEmpCode, ConvertTo.DateTimeVal(strSalaryMonth), ConvertTo.DecimalVal(strSalaryPaid));
                                dtProcessSalary.Rows.Add(
                                    strEmpCode,
                                    ConvertTo.DateFormatDb(strSalaryMonth),
                                    ConvertTo.DecimalVal(strSalaryPaid),
                                    ConvertTo.DecimalVal(strLoanInstallment),
                                    ConvertTo.DecimalVal(strSalaryCalculated),
                                    ConvertTo.DecimalVal(strTeaRate),
                                    ConvertTo.DecimalVal(strNoOfCups),
                                    ConvertTo.DecimalVal(strTotalTeaAmount)
                                    );

                                PrintLogWin.PrintLog("***** btnProcessSalary_Click => strSalaryMonth: " + strSalaryMonth);
                                PrintLogWin.PrintLog("***** btnProcessSalary_Click => strEmpCode: " + strEmpCode);
                            }
                        }


                        //cn.Execute(@"Insert INTO #routineUpdatedRecords VALUES('" + strEmpCode + "', '" + strSalaryMonth + "', " + strSalaryPaid + ")");
                    }

                    PrintLogWin.PrintLog("*******************************" + string.Empty);

                    using (SqlConnection con = new SqlConnection(ProjectFunctionsUtils.ConnectionString))
                    {
                        con.Open();
                        using (SqlCommand com = new SqlCommand("sp_UpdateSalaryPaid", con))
                        {
                            com.CommandType = CommandType.StoredProcedure;
                            com.Parameters.AddWithValue("@TableParam", dtProcessSalary);
                            com.ExecuteNonQuery();

                            ProjectFunctions.SpeakError("Salary Has Been Processed");
                            FillGrid();
                        }
                    }
                }
                catch (Exception ex)
                {
                    PrintLogWin.PrintLog(ex);
                }
            }
        }
Exemplo n.º 7
0
        private void FillGrid()
        {
            ClearGrid();

            //DECLARE @Salary_Month DATETIME = '2020-06-01 00:00:00';
            var str = "sp_Salary_Process '','" + ConvertTo.DateFormatDb(ConvertTo.DateTimeVal(DtStartDate.EditValue)) + "', 1, 1,'1','" + txtteatrate.Text + "','0'";

            PrintLogWin.PrintLog(str);

            DataSet ds = ProjectFunctionsUtils.GetDataSet(str);

            ds.Tables[0].Columns.Add(new DataColumn("Balance_1", typeof(double)));
            ds.Tables[0].Columns.Add(new DataColumn("Arrears_1", typeof(double)));
            ds.Tables[0].Columns.Add(new DataColumn("Loan_1", typeof(double)));
            ds.Tables[0].Columns.Add(new DataColumn("SalaryCalculated_1", typeof(double)));

            for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
            {
                ds.Tables[0].Rows[i]["Balance_1"]          = ConvertTo.DoubleVal(ds.Tables[0].Rows[i]["Balance"]);
                ds.Tables[0].Rows[i]["Arrears_1"]          = ds.Tables[0].Rows[i]["Arrears"];
                ds.Tables[0].Rows[i]["Loan_1"]             = ds.Tables[0].Rows[i]["Loan"];
                ds.Tables[0].Rows[i]["SalaryCalculated_1"] = ds.Tables[0].Rows[i]["SalaryCalculated"];
            }

            if (ComparisonUtils.IsNotNull_DataSet(ds))
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    gridControl_SalaryProcess.DataSource = ds.Tables[0];
                    gridView_SalaryProcess.BestFitColumns();

                    gridView_SalaryProcess.Columns["EmpSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "EmpSalary", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryEarned"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryEarned", string.Empty);
                    gridView_SalaryProcess.Columns["OT_Salary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "OT_Salary", string.Empty);
                    gridView_SalaryProcess.Columns["DeductionSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "DeductionSalary", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryGenerateBasic"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryGenerateBasic", string.Empty);
                    gridView_SalaryProcess.Columns["AdvanceSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "AdvanceSalary", string.Empty);
                    object p = gridView_SalaryProcess.Columns["Loan"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "Loan", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryCalculated"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryCalculated", string.Empty);
                    gridView_SalaryProcess.Columns["SalaryPaid"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SalaryPaid", string.Empty);
                    gridView_SalaryProcess.Columns["Balance"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "Balance", string.Empty);
                    gridView_SalaryProcess.Columns["Arrears"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "Arrears", string.Empty);
                    gridView_SalaryProcess.Columns["TotalTeaAmount"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "TotalTeaAmount", string.Empty);
                    //gridView_SalaryProcess.Columns["EmpSalary"].Summary.Add(DevExpress.Data.SummaryItemType.Custom);

                    gridView_SalaryProcess.UpdateTotalSummary();
                }
            }
            else
            {
            }
            gridView_SalaryProcess.OptionsBehavior.Editable = true;

            foreach (DevExpress.XtraGrid.Columns.GridColumn Col in gridView_SalaryProcess.Columns)
            {
                if (Col.FieldName == "LoanIntsallment" || Col.FieldName == "SalaryPaid" || Col.FieldName == "Loan" || Col.FieldName == "NoOfCups")
                {
                }
                else
                {
                    Col.OptionsColumn.AllowEdit = false;
                }
            }

            SetGridViewStyle();
        }
Exemplo n.º 8
0
        public void LoadGatePassDataGrid()
        {
            PrintLogWin.PrintLog("LoadGatePassDataGrid => GlobalVariables.ProgCode ******************** : " + GlobalVariables.ProgCode);
            try
            {
                gridView_GatePassData.Columns.Clear();

                string _storedProcedre = SQL_QUERIES.Sp_GatePassData_Daily_List() + " '" + txtEmpCode.EditValue + "', '" + ConvertTo.DateFormatDb(DtDate.EditValue) + "'";
                //DataSet ds = ProgramMasterData.GetData(GlobalVariables.ProgCode, _params);
                DataSet _ds = ProjectFunctionsUtils.GetDataSet(_storedProcedre);

                if (_ds.Tables[0].Rows.Count > 0)
                {
                    gridControl_GatePassData.DataSource = _ds.Tables[0];
                    gridView_GatePassData.BestFitColumns();

                    ////////////////////


                    PrintPrivewButton.Enabled = true;
                    PrintButton.Enabled       = true;
                }
                else
                {
                    gridControl_GatePassData.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString().Trim());
            }
        }