Пример #1
0
        private void Load_CurrentForm_Records()
        {
            pvtLeaveTypeDataView = null;
            pvtLeaveTypeDataView = new DataView(pvtDataSet.Tables["LeaveType"],
                                                "COMPANY_NO = " + Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")) + " AND PAY_CATEGORY_TYPE = '" + this.dgvPayrollTypeDataGridView[0, this.Get_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView)].Value.ToString().Substring(0, 1) + "'",
                                                "EARNING_DESC",
                                                DataViewRowState.CurrentRows);

            clsISUtilities.DataViewIndex = 0;

            if (clsISUtilities.DataBind_Form_And_DataView_To_Class() == false)
            {
                clsISUtilities.DataBind_DataView_And_Index(this, pvtLeaveTypeDataView, "EARNING_NO");

                clsISUtilities.DataBind_DataView_To_TextBox(this.txtLeaveType, "EARNING_DESC", true, "Enter Leave Type Description.", true);

                clsISUtilities.DataBind_DataView_To_ComboBox(this.cboPercentage, "LEAVE_PERCENTAGE", false, "", false);
                clsISUtilities.DataBind_Control_Required_If_Enabled(this.cboPercentage, "Select Percentage Paid.");

                clsISUtilities.DataBind_DataView_To_TextBox(this.txtHeader1, "EARNING_REPORT_HEADER1", true, "Enter Spreadsheet Report Header - Line 1", true);
                clsISUtilities.DataBind_DataView_To_TextBox(this.txtHeader2, "EARNING_REPORT_HEADER2", false, "", true);
            }
            else
            {
                //Rebind dataView
                clsISUtilities.Re_DataBind_DataView(pvtLeaveTypeDataView);
            }

            this.Set_Form_For_Read();

            this.Clear_DataGridView(this.dgvLeaveTypeDataGridView);

            this.pvtblnLeaveTypeDataGridViewLoaded = false;
            int intLeaveTypeRow = 0;

            if (this.dgvPayrollTypeDataGridView[0, this.Get_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView)].Value.ToString().Substring(0, 1) == "W")
            {
                this.lblLeaveTypeLockDesc.Text = "Some Leave Type Records are Locked due to Current Wage Run";
            }
            else
            {
                this.lblLeaveTypeLockDesc.Text = "Some Leave Type Records are Locked due to Current Salary Run";
            }

            this.grbLeaveLock.Visible = false;

            for (int intRow = 0; intRow < pvtLeaveTypeDataView.Count; intRow++)
            {
                this.dgvLeaveTypeDataGridView.Rows.Add("",
                                                       pvtLeaveTypeDataView[intRow]["EARNING_DESC"].ToString(),
                                                       intRow.ToString());

                if (Convert.ToInt32(pvtLeaveTypeDataView[intRow]["EARNING_NO"]) == pvtintLeaveTypeNo)
                {
                    intLeaveTypeRow = intRow;
                }

                if (pvtLeaveTypeDataView[intRow]["PAYROLL_LINK"] != System.DBNull.Value)
                {
                    this.dgvLeaveTypeDataGridView[0, this.dgvLeaveTypeDataGridView.Rows.Count - 1].Style = this.PayrollLinkDataGridViewCellStyle;
                    this.grbLeaveLock.Visible = true;
                }
            }

            this.pvtblnLeaveTypeDataGridViewLoaded = true;

            if (this.dgvLeaveTypeDataGridView.Rows.Count > 0)
            {
                this.btnUpdate.Enabled = true;
                this.btnDelete.Enabled = true;

                this.Set_DataGridView_SelectedRowIndex(dgvLeaveTypeDataGridView, intLeaveTypeRow);
            }
            else
            {
                this.Clear_Form_Fields();
            }
        }
Пример #2
0
        private void Load_CurrentForm_Records()
        {
            this.grbDeductionLock.Visible = false;

            this.Clear_DataGridView(this.dgvDeductionDataGridView);

            pvtDeductionDataView = null;

            pvtDeductionDataView = new DataView(pvtDataSet.Tables["Deduction"],
                                                "COMPANY_NO = " + AppDomain.CurrentDomain.GetData("CompanyNo").ToString() + " AND PAY_CATEGORY_TYPE = '" + pvtstrPayrollType + "'",
                                                "DEDUCTION_DESC",
                                                DataViewRowState.CurrentRows);

            clsISUtilities.DataViewIndex = 0;

            if (clsISUtilities.DataBind_Form_And_DataView_To_Class() == false)
            {
                clsISUtilities.DataBind_DataView_And_Index(this, pvtDeductionDataView, "DEDUCTION_NO");

                clsISUtilities.DataBind_DataView_To_TextBox(this.txtDeduction, "DEDUCTION_DESC", true, "Enter Deduction Description.", true);

                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnUserToEnter, "DEDUCTION_TYPE_IND", "U");
                clsISUtilities.DataBind_RadioButton_Default(this.rbnUserToEnter);
                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnFixedAmount, "DEDUCTION_TYPE_IND", "F");
                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnPercentageOfEarnings, "DEDUCTION_TYPE_IND", "P");

                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnEachPayPeriod, "DEDUCTION_PERIOD_IND", "E");
                clsISUtilities.DataBind_RadioButton_Default(this.rbnEachPayPeriod);
                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnMonthly, "DEDUCTION_PERIOD_IND", "M");

                clsISUtilities.DataBind_DataView_To_Numeric_TextBox(this.txtValue, "DEDUCTION_VALUE", 2, false, "", false, 0, false);
                clsISUtilities.DataBind_Control_Required_If_Enabled(this.txtValue, "Enter Value.");

                clsISUtilities.DataBind_DataView_To_Numeric_TextBox(this.txtMinValue, "DEDUCTION_MIN_VALUE", 2, false, "", false, 0, false);
                //clsISUtilities.DataBind_Control_Required_If_Enabled(this.txtMinValue, "Enter Minimum Value.");

                clsISUtilities.DataBind_DataView_To_Numeric_TextBox(this.txtMaxValue, "DEDUCTION_MAX_VALUE", 2, false, "", false, 0, false);
                //clsISUtilities.DataBind_Control_Required_If_Enabled(this.txtMaxValue, "Enter Maximum Value.");

                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnNoLoanType, "DEDUCTION_LOAN_TYPE_IND", "N");
                clsISUtilities.DataBind_RadioButton_Default(this.rbnNoLoanType);
                clsISUtilities.DataBind_DataView_To_RadioButton(this.rbnYesLoanType, "DEDUCTION_LOAN_TYPE_IND", "Y");

                clsISUtilities.DataBind_DataView_To_ComboBox(this.cboNumberSubAccount, "DEDUCTION_SUB_ACCOUNT_COUNT", false, "", false);
                clsISUtilities.DataBind_Control_Required_If_Enabled(this.cboNumberSubAccount, "Select Number of Sub-Account.");

                //clsISUtilities.DataBind_DataView_To_TextBox(this.txtIRP5Code, "IRP5_CODE", false, "", false);
                clsISUtilities.DataBind_DataView_To_Numeric_TextBox(this.txtIRP5Code, "IRP5_CODE", 0, false, "", false, 0, true);

                clsISUtilities.DataBind_DataView_To_TextBox(this.txtHeader1, "DEDUCTION_REPORT_HEADER1", true, "Enter Spreadsheet Report Header Line 1.", true);
                clsISUtilities.DataBind_DataView_To_TextBox(this.txtHeader2, "DEDUCTION_REPORT_HEADER2", false, "", true);
            }
            else
            {
                clsISUtilities.Re_DataBind_DataView(pvtDeductionDataView);
            }

            if (pvtstrPayrollType == "W")
            {
                this.rbnMonthly.Visible = true;
                this.cboDay.Visible     = true;
            }
            else
            {
                this.rbnMonthly.Visible = false;
                this.cboDay.Visible     = false;
            }

            if (pvtDeductionDataView.Count == 0)
            {
                Clear_Form_Fields();

                this.btnUpdate.Enabled = false;
                this.btnDelete.Enabled = false;

                Set_Form_For_Read();
            }
            else
            {
                int intComboSelectedIndex = 0;

                Set_Form_For_Read();

                if (this.pvtDataSet.Tables["Company"].Rows[0]["ACCESS_IND"].ToString() == "R")
                {
                    this.btnUpdate.Enabled = false;
                }
                else
                {
                    this.btnUpdate.Enabled = true;
                }

                pvtblnDeductionDataGridViewLoaded = false;

                for (int intRowCount = 0; intRowCount < pvtDeductionDataView.Count; intRowCount++)
                {
                    this.dgvDeductionDataGridView.Rows.Add("",
                                                           pvtDeductionDataView[intRowCount]["IRP5_CODE"].ToString(),
                                                           pvtDeductionDataView[intRowCount]["DEDUCTION_DESC"].ToString(),
                                                           intRowCount.ToString());

                    if (Convert.ToInt32(pvtDeductionDataView[intRowCount]["DEDUCTION_NO"]) == pvtintDeductionNo)
                    {
                        intComboSelectedIndex = intRowCount;
                    }

                    if (pvtDeductionDataView[intRowCount]["PAYROLL_LINK"] != System.DBNull.Value)
                    {
                        this.dgvDeductionDataGridView[0, this.dgvDeductionDataGridView.Rows.Count - 1].Style = LockedPayrollRunDataGridViewCellStyle;
                        this.grbDeductionLock.Visible = true;

                        this.btnNew.Enabled    = false;
                        this.btnUpdate.Enabled = false;
                        this.btnDelete.Enabled = false;
                    }
                }

                pvtblnDeductionDataGridViewLoaded = true;

                this.Set_DataGridView_SelectedRowIndex(this.dgvDeductionDataGridView, intComboSelectedIndex);
            }
        }