CEL_Payroll/Payroll.Report/UI/fLeavereport.cs

86 lines
2.5 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Payroll.BO;
using Ease.CoreV35.Model;
using System.Threading;
using System.IO;
using Payroll.UI;
namespace Payroll.Report
{
public partial class fLeavereport : Form
{
private ObjectsTemplate<Payroll.BO.Employee> _employees;
public fLeavereport()
{
InitializeComponent();
}
#region Events
private void btnEmployees_Click(object sender, EventArgs e)
{
_employees = null;
lblEmployee.Text = "";
fSearchEmployee emp = new fSearchEmployee();
emp.SearchForSalary = false;
emp.MultipleSelection = true;
emp.ShowDialog();
lblEmployee.Text = emp.SelectedEmployees.Count.ToString() + " Employees has been seleted.";
if (emp.SelectedEmployees.Count > 0) _employees = emp.GetEmployees();
}
private void btnPreview_Click(object sender, EventArgs e)
{
Leave _oLeave = new Leave();
rptLeave oLeave = new rptLeave();
if (_employees == null)
{
MessageBox.Show("Please select employee.", "Input validation", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
this.Cursor = Cursors.WaitCursor;
LeaveYear lyy = new LeaveYear();
lyy = (LeaveYear)cboLeaveYear.SelectedItem;
oLeave.ShowLeaveReport(_employees, lyy);
this.Cursor = Cursors.Default;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void fLeavereport_Load(object sender, EventArgs e)
{
LoadcboLeaveYear();
}
#endregion
#region Functions
private void LoadcboLeaveYear()
{
List<LeaveYear> _oLeaveYears = LeaveYear.Get();
foreach (LeaveYear item in _oLeaveYears)
{
cboLeaveYear.Items.Add(item);
cboLeaveYear.DisplayMember = "Name";
}
LeaveYear yer = _oLeaveYears.Where(obj => obj.IsCurrent).SingleOrDefault();
cboLeaveYear.SelectedItem = yer;
lblEmployee.Text = "No Employee Selected !!!";
}
#endregion
}
}