CEL_Payroll/Payroll.Report/UI/frmPFLedger.cs

98 lines
3.0 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 Ease.CoreV35;
using Microsoft.Reporting.WinForms;
using Ease.CoreV35.DataAccess;
namespace Payroll.Report
{
public partial class frmPFLedger : Form
{
DateTime FromDate;
DateTime toDate;
string sEmpID = string.Empty;
string sEmpName = string.Empty;
string sEmpNo = string.Empty;
public frmPFLedger()
{
InitializeComponent();
}
#region Event's
private void frmPFLedger_Load(object sender, EventArgs e)
{
dtpFormDate.Value = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.FirstDateOfMonth();
dtpToDate.Value = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate.FirstDateOfMonth();
}
private void btnPreview_Click(object sender, EventArgs e)
{
try
{
if(ValidateControl())
{
FromDate = GlobalFunctions.LastDateOfMonth(dtpFormDate.Value);
toDate = GlobalFunctions.LastDateOfMonth(dtpToDate.Value);
if (ctlEmployee.SelectedEmployee != null)
{
sEmpID = ctlEmployee.SelectedEmployee.EmployeeID.Integer.ToString();
sEmpName = ctlEmployee.SelectedEmployee.Name;
sEmpNo = ctlEmployee.SelectedEmployee.EmployeeNo;
}
rptPF oPF = new rptPF();
oPF.GetPFLedger(sEmpID, FromDate, toDate, sEmpName, sEmpNo);
}
}
catch(Exception ex)
{
MessageBox.Show("Error :" + ex.Message, "Error");
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void dtpFormDate_ValueChanged(object sender, EventArgs e)
{
FromDate = GlobalFunctions.LastDateOfMonth(dtpFormDate.Value);
}
private void dtpToDate_ValueChanged(object sender, EventArgs e)
{
toDate = GlobalFunctions.LastDateOfMonth(dtpToDate.Value);
}
#endregion
#region Functions
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 Month Must be Bigger than From Month!!!", "To Date", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
return true;
}
#endregion
}
}