83 lines
3.7 KiB
C#
83 lines
3.7 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;
|
|
using System.Data;
|
|
|
|
namespace Payroll.Report
|
|
{
|
|
public partial class frmCCWiseBudgetReport : Form
|
|
{
|
|
ObjectsTemplate<BudgetProcessMonthlyDetail> _BudgetProcessMonthlieDetails = new ObjectsTemplate<BudgetProcessMonthlyDetail>();
|
|
ObjectsTemplate<BudgetMaster> _BudgetMasters = null;
|
|
public frmCCWiseBudgetReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void btnPreview_Click(object sender, EventArgs e)
|
|
{
|
|
Cursor.Current = Cursors.WaitCursor;
|
|
List<ReportDataSource> dataSource = new List<ReportDataSource>();
|
|
ObjectsTemplate<Employee> oEmps = Employee.Get();
|
|
ObjectsTemplate<EmployeeCostCenter> oEmpCCs = EmployeeCostCenter.Get();
|
|
_BudgetProcessMonthlieDetails = BudgetProcessMonthlyDetail.Get(Ease.CoreV35.Utility.Global.DateFunctions.FirstDateOfMonth(dtpFromDate.Value), Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfMonth(dtpToDate.Value), Convert.ToInt16(cmbBudget.SelectedValue.ToString()));
|
|
if (_BudgetProcessMonthlieDetails.Count == 0)
|
|
{
|
|
MessageBox.Show("No data found", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
return;
|
|
}
|
|
ObjectsTemplate<Costcenter> oCrgs = new ObjectsTemplate<Costcenter>();
|
|
oCrgs = Costcenter.Get();
|
|
DataTable oBody = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.BudgetCCDataTable();
|
|
ObjectsTemplate<BudgetProcessMonthly> oMonthlys=BudgetProcessMonthly.Get(Convert.ToInt16(cmbBudget.SelectedValue.ToString()));
|
|
foreach (BudgetProcessMonthlyDetail oItem in _BudgetProcessMonthlieDetails)
|
|
{
|
|
Employee oEmp = oEmps.Find(delegate(Employee emp) { return oItem.EmployeeID == emp.ID; });
|
|
EmployeeCostCenter empCC = oEmpCCs.Find(delegate(EmployeeCostCenter cc) { return oItem.EmployeeID == cc.EmployeeID; });
|
|
if (empCC!=null)
|
|
oBody.Rows.Add(empCC.Costcenter.Name, oEmp == null ? oItem.EmployeeID.ToString() : oEmp.EmployeeNo, oEmp == null ? oItem.EmployeeID.ToString() : oEmp.Name, "", oItem.Name, Ease.CoreV35.Utility.Global.NumericFunctions.TakaFormat(Math.Round(oItem.Calculatedamount,2)), "Budget Name: " + cmbBudget.Text + " From " + dtpFromDate.Value.ToString("MMM yyyy") + " To " + dtpToDate.Value.ToString("MMM yyyy"));
|
|
}
|
|
|
|
string embeddedResource = "Payroll.Report.RDLC.rptBudgetCCReport.rdlc";
|
|
string caption = "Cost Center Wise Budget Report";
|
|
dataSource = new List<ReportDataSource>();
|
|
dataSource.Add(new ReportDataSource("dsEmpLeaveLedger_BudgetCC", oBody));
|
|
|
|
Cursor.Current = Cursors.Default;
|
|
try
|
|
{
|
|
fReportViewer fViewer = new fReportViewer();
|
|
fViewer.PreviewReport(dataSource, embeddedResource, caption);
|
|
}
|
|
catch (Exception exp)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
private void frmCCWiseBudgetReport_Load(object sender, EventArgs e)
|
|
{
|
|
_BudgetMasters = new ObjectsTemplate<BudgetMaster>();
|
|
_BudgetMasters = BudgetMaster.Get();
|
|
cmbBudget.DataSource = _BudgetMasters;
|
|
cmbBudget.DisplayMember = "Name";
|
|
cmbBudget.ValueMember = "ID";
|
|
}
|
|
}
|
|
}
|