140 lines
4.2 KiB
C#
140 lines
4.2 KiB
C#
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 Ease.CoreV35;
|
|
using Microsoft.Reporting.WinForms;
|
|
using Ease.CoreV35.DataAccess;
|
|
|
|
namespace Payroll.Report
|
|
{
|
|
public partial class frmIndEmpSalarySheet : Form
|
|
{
|
|
string sEmpID = string.Empty;
|
|
string sEmpName = string.Empty;
|
|
string _months = string.Empty;
|
|
DateTime formDate;
|
|
DateTime toDate;
|
|
|
|
public frmIndEmpSalarySheet()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region Event's
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
if (ctlEmployee.SelectedEmployee != null)
|
|
{
|
|
sEmpID = ctlEmployee.SelectedEmployee.EmployeeID.Integer.ToString();
|
|
sEmpName = ctlEmployee.SelectedEmployee.Name;
|
|
RefreshList();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("No Employee Selected!!!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void frmIndEmpSalarySheet_Load(object sender, EventArgs e)
|
|
{
|
|
formDate = GlobalFunctions.FirstDateOfMonth(dtpFormDate.Value);
|
|
toDate = GlobalFunctions.LastDateOfMonth(dtpToDate.Value);
|
|
}
|
|
|
|
private void btnPreview_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (ValidateControl())
|
|
{
|
|
if (lsvMonth.Items.Count > 0)
|
|
{
|
|
foreach (ListViewItem oItem in lsvMonth.Items)
|
|
{
|
|
if (_months == "")
|
|
{
|
|
_months = "'" + oItem.Tag.ToString() + "'";
|
|
}
|
|
else
|
|
{
|
|
_months = _months + ",'" + oItem.Tag.ToString() + "'";
|
|
}
|
|
}
|
|
|
|
rptSalarySheet oEmpSheet = new rptSalarySheet();
|
|
oEmpSheet.GetEmpIndsalarySheet(sEmpID, _months, formDate, toDate, sEmpName);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void dtpFormDate_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
formDate = GlobalFunctions.FirstDateOfMonth(dtpFormDate.Value);
|
|
}
|
|
|
|
private void dtpToDate_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
toDate = GlobalFunctions.FirstDateOfMonth(dtpToDate.Value);
|
|
}
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
private void RefreshList()
|
|
{
|
|
lsvMonth.Items.Clear();
|
|
|
|
DateTime formDate = GlobalFunctions.FirstDateOfMonth(dtpFormDate.Value);
|
|
TimeSpan toDate = GlobalFunctions.LastDateOfMonth(dtpToDate.Value).Subtract(formDate);
|
|
|
|
int month = toDate.Days/30;
|
|
|
|
for (int i = 0; i < month; i++ )
|
|
{
|
|
ListViewItem item = new ListViewItem();
|
|
item.Text = formDate.ToString("MMMM yyyy");
|
|
DateTime newDate = GlobalFunctions.LastDateOfMonth(formDate);
|
|
item.Tag = newDate.ToString("dd MMM yyyy");
|
|
formDate = formDate.AddMonths(1);
|
|
lsvMonth.Items.Add(item);
|
|
}
|
|
}
|
|
|
|
public bool ValidateControl()
|
|
{
|
|
if (ctlEmployee.SelectedEmployee == null)
|
|
{
|
|
MessageBox.Show("Select employee!!!", "Employee Info.", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
ctlEmployee.Focus();
|
|
return false;
|
|
}
|
|
if (dtpToDate.Value < dtpFormDate.Value)
|
|
{
|
|
MessageBox.Show("Your To Date Must be Bigger than From Date!!!", "To Date", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|