Example #1
0
 private void FillForm(int detailId)
 {
     if (detailId != 0)
     {
         dsSalary ds = new dsSalary();
         dsSalaryTableAdapters.vSalaryFormTableAdapter taSalaryDetail = new dsSalaryTableAdapters.vSalaryFormTableAdapter();
         taSalaryDetail.FillByDetailId(ds.vSalaryForm, detailId);
         var salaryDetail = ds.vSalaryForm.NewvSalaryFormRow();
         if (ds.vSalaryForm.Rows.Count > 0)
         {
             salaryDetail = ds.vSalaryForm[0];
             DateTime date = salaryDetail.SalaryDate;
             tbxSalaryMonth.Text = salaryDetail.SalaryDate.ToString("MMMM") + " " + salaryDetail.SalaryDate.Year.ToString();
             int workingDays = GetNumberOfWorkingDays(SalaryList.FirstOfMonth(date), SalaryList.LastOfMonth(date));
             salaryDetail            = ds.vSalaryForm[0];
             tbxName.Text            = salaryDetail.EmployeeName;
             tbxCode.Text            = salaryDetail.Code.ToString();
             tbxSalary.Text          = (Math.Round(salaryDetail.Salary, 2)).ToString();
             tbxJoiningDate.Text     = salaryDetail.HireDate.ToShortDateString();
             tbxWorkingDays.Text     = workingDays.ToString();
             tbxPresent.Text         = salaryDetail.Presents.ToString();
             tbxAbsents.Text         = salaryDetail.Absents.ToString();
             tbxLeaves.Text          = salaryDetail.Leaves.ToString();
             tbxAbsentDeduction.Text = (Math.Round((salaryDetail.Salary / workingDays) * Convert.ToInt32(tbxAbsents.Text), 2)).ToString();
             tbxTotalSalary.Text     = Math.Round(salaryDetail.Total, 2).ToString();
             tbxOtherDeductions.Text = salaryDetail.IsDeductionsNull() ? "0" : salaryDetail.Deductions.ToString();
             saveValues();
         }
     }
 }
Example #2
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            dsSalary ds = new dsSalary();

            dsSalaryTableAdapters.vSalaryFormTableAdapter tasalaryDetail = new dsSalaryTableAdapters.vSalaryFormTableAdapter();
            tasalaryDetail.FillByDetailId(ds.vSalaryForm, detailId);
            var salaryDetail = ds.vSalaryForm.NewvSalaryFormRow();

            if (ds.vSalaryForm.Rows.Count > 0)
            {
                int leaves;
                salaryDetail    = ds.vSalaryForm[0];
                leaves          = salaryDetail.Leaves;
                tbxPresent.Text = tasalaryDetail.GetPresents(salaryDetail.EmployeeId, SalaryList.FirstOfMonth(salaryDetail.SalaryDate).ToString(), SalaryList.LastOfMonth(salaryDetail.SalaryDate).ToString()).ToString();
                tbxAbsents.Text = tasalaryDetail.GetAbsents(salaryDetail.EmployeeId, SalaryList.FirstOfMonth(salaryDetail.SalaryDate).ToString(), SalaryList.LastOfMonth(salaryDetail.SalaryDate).ToString()).ToString();
                leaves          = Convert.ToInt32(tasalaryDetail.GetAL(salaryDetail.EmployeeId, SalaryList.FirstOfMonth(salaryDetail.SalaryDate).ToString(), SalaryList.LastOfMonth(salaryDetail.SalaryDate).ToString()));
                leaves          = leaves + Convert.ToInt32(tasalaryDetail.GetCL(salaryDetail.EmployeeId, SalaryList.FirstOfMonth(salaryDetail.SalaryDate).ToString(), SalaryList.LastOfMonth(salaryDetail.SalaryDate).ToString()));
                leaves          = leaves + Convert.ToInt32(tasalaryDetail.GetSL(salaryDetail.EmployeeId, SalaryList.FirstOfMonth(salaryDetail.SalaryDate).ToString(), SalaryList.LastOfMonth(salaryDetail.SalaryDate).ToString()));
                tbxLeaves.Text  = leaves.ToString();
                saveValues();
            }
        }