Ejemplo n.º 1
0
        private void btnSelectALL_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
#pragma warning disable CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
                var MaxRow = ((DocumentMGRGrid.KeyboardFocusView as GridView).RowCount);
#pragma warning restore CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
                if (btnSelectALL.Checked == true)
                {
                    for (var i = 0; i < MaxRow; i++)
                    {
                        DocMGRGrid.SetRowCellValue(i, "Select", "True");
                    }
                }
                if (btnSelectALL.Checked == false)
                {
                    for (var i = 0; i < MaxRow; i++)
                    {
                        DocMGRGrid.SetRowCellValue(i, "Select", "False");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void fillGrid()
        {
            try
            {
                //DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                //SplashScreenManager.Default.SetWaitFormDescription("Fetching Data");
                var strsql = String.Format("sp_EmpSalMst '{0}{1}'", DtStartDate.Text.Substring(0, 2), DtStartDate.Text.Substring(DtStartDate.Text.Length - 2, 2));

                using (var ds = ProjectFunctions.GetDataSet(strsql))
                {
                    ds.Tables[0].Columns.Add("Select", typeof(bool));
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        dr["Select"] = false;
                    }
                    DocumentMGRGrid.DataSource = ds.Tables[0];
                    DocMGRGrid.BestFitColumns();
                }
                //SplashScreenManager.CloseForm();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var Dr = DocMGRGrid.GetFocusedDataRow();

            EmpCode  = Dr["EmpCode"].ToString();
            EmpMonth = Dr["MonthYear"].ToString();
            if (btnEdit.Enabled)
            {
                if (DocMGRGrid.DataSource != null)
                {
                    if (DocMGRGrid.RowCount > 0)
                    {
                        DataSet ds = ProjectFunctions.GetDataSet("Select * from PayFinal Where MonthYear='" + EmpMonth + "' And EmpCode='" + EmpCode + "'");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["EmpSalLocTag"].ToString().Trim() == "Y")
                            {
                                XtraMessageBox.Show("Salary Has Been Locked");
                            }
                            else
                            {
                                using (var FMRU = new frm_EmpSalAddUpdate()
                                {
                                    IsUpdate = true, MMDocNo = EmpCode, MMDocNo1 = EmpMonth
                                })
                                {
                                    var P = ProjectFunctions.GetPositionInForm(this);
                                    FMRU.Location = new Point(P.X + (ClientSize.Width / 2 - FMRU.Size.Width / 2), P.Y + (ClientSize.Height / 2 - FMRU.Size.Height / 2));
                                    FMRU.ShowDialog();
                                }
                            }
                        }
                        else
                        {
                            using (var FMRU = new frm_EmpSalAddUpdate()
                            {
                                IsUpdate = true, MMDocNo = EmpCode, MMDocNo1 = EmpMonth
                            })
                            {
                                var P = ProjectFunctions.GetPositionInForm(this);
                                FMRU.Location = new Point(P.X + (ClientSize.Width / 2 - FMRU.Size.Width / 2), P.Y + (ClientSize.Height / 2 - FMRU.Size.Height / 2));
                                FMRU.ShowDialog();
                            }
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("No Records to Edit", "!Error");
                    }
                }
                else
                {
                    XtraMessageBox.Show("No Datasource, Or Unable to fetch Data.", "!Error");
                }
            }
            else
            {
                XtraMessageBox.Show("You have No permission.", "!Error");
            }
            fillGrid();
        }
Ejemplo n.º 4
0
        private void btnLoadAdvance_Click(object sender, EventArgs e)
        {
            DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
            SplashScreenManager.Default.SetWaitFormDescription("Processing Salary");
#pragma warning disable CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            var MaxRow = ((DocumentMGRGrid.KeyboardFocusView as GridView).RowCount);
#pragma warning restore CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            for (int i = 0; i < MaxRow; i++)
            {
                var currentrow = DocMGRGrid.GetDataRow(i);

                if (currentrow["Select"].ToString().ToUpper() == "TRUE")
                {
                    SplashScreenManager.Default.SetWaitFormDescription("Loading  Loan/Advances " + i.ToString());
                    Decimal LoanAmt = 0;

                    EmpCode  = currentrow["EmpCode"].ToString();
                    EmpMonth = currentrow["MonthYear"].ToString();

                    string   str      = "sp_LoadLoanBal '" + EmpCode + "'";
                    DateTime TempDate = Convert.ToDateTime("20" + EmpMonth.ToString().Substring(2, 2) + "-" + EmpMonth.ToString().Substring(0, 2) + "-" + DateTime.DaysInMonth(Convert.ToInt32("20" + EmpMonth.ToString().Substring(2, 2)), Convert.ToInt32(EmpMonth.ToString().Substring(0, 2))) + string.Empty);

                    DataSet ds = ProjectFunctions.GetDataSet(str);

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (Convert.ToDecimal(ds.Tables[0].Rows[0]["LoanBal"]) >= Convert.ToDecimal(ds.Tables[0].Rows[0]["LoanInstlmnt"]))
                        {
                            LoanAmt = Convert.ToDecimal(ds.Tables[0].Rows[0]["LoanInstlmnt"]);
                        }
                        else
                        {
                            LoanAmt = Convert.ToDecimal(ds.Tables[0].Rows[0]["LoanBal"]);
                        }
                        if (LoanAmt < 0)
                        {
                            LoanAmt = 0;
                        }
                    }
                    else
                    {
                        LoanAmt = 0;
                    }


                    Decimal Advance = 0;

                    DateTime TempAdvanveDate = Convert.ToDateTime("20" + EmpMonth.ToString().Substring(2, 2) + "-" + EmpMonth.ToString().Substring(0, 2) + "-01");
                    DataSet  dsAdvance       = ProjectFunctions.GetDataSet("select  ISNULL(sum(ExAmt),0) as Advance from ExMst where ExEmpCode='" + EmpCode + "'  And  DATEPART(MM,ExMst.ExDatePost)='" + TempAdvanveDate.Date.ToString("MM") + "' And  DATEPART(yyyy,ExMst.ExDatePost)='" + TempAdvanveDate.Date.ToString("yyyy") + "'");
                    if (dsAdvance.Tables.Count > 0)
                    {
                        if (dsAdvance.Tables[0].Rows.Count > 0)
                        {
                            Advance = Advance + Convert.ToDecimal(dsAdvance.Tables[0].Rows[0][0]);
                        }
                        else
                        {
                            Advance = 0;
                        }
                    }
                    DataSet dsCheckAgain = ProjectFunctions.GetDataSet("Select * from PayFinal Where MonthYear='" + EmpMonth + "' And EmpCode='" + EmpCode + "'");
                    if (dsCheckAgain.Tables[0].Rows.Count > 0)
                    {
                        if (dsCheckAgain.Tables[0].Rows[0]["EmpSalLocTag"].ToString().Trim() == "Y")
                        {
                        }
                        else
                        {
                            DataSet dsUpdate = ProjectFunctions.GetDataSet("update AtnData set EmpAdvAmt='" + Advance + "',EmpLoanAmt='" + LoanAmt + "' Where EmpCode='" + EmpCode + "' And MonthYear='" + EmpMonth + "'");
                        }
                    }
                    else
                    {
                        DataSet dsUpdate = ProjectFunctions.GetDataSet("update AtnData set EmpAdvAmt='" + Advance + "',EmpLoanAmt='" + LoanAmt + "' Where EmpCode='" + EmpCode + "' And MonthYear='" + EmpMonth + "'");
                    }
                }
            }
            fillGrid();
            SplashScreenManager.CloseForm();
        }