Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            DateTime        From         = dateTimePicker1.Value;
            int             id           = Convert.ToInt32(comboBox3.SelectedValue);
            List <Employee> employeesALL = db.Employees.Where(a => a.Section.DepartmentId == id).ToList();
            List <Employee> employees    = employeesALL.Where(a => a.IsActive(From)).ToList();

            PopulateGrid(employees);

            DL.Department section = db.Departments.Find(id);
            label5.Text = "U: " + section.Unit.Name + ";  D: " + section.Name;
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            DateTime       dateTime    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            int            id          = Convert.ToInt32(comboBox3.SelectedValue);
            List <DL.Loan> loans       = db.Loans.Where(a => a.Employee.Section.DepartmentId == id).ToList();
            List <DL.Loan> currentLone = loans.Where(a => a.IsLoanPaid(dateTime)).ToList();

            List <ViewLoan> viewLoans = GetLoanList(currentLone, dateTime);

            viewLoanDataGridView.DataSource = null;
            viewLoanDataGridView.DataSource = viewLoans;

            DL.Department section = db.Departments.Find(id);
            label5.Text = "Unit:" + section.Unit.Name + ", Department:" + section.Name;
        }
Exemple #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            var emp = viewBonusDataGridView.DataSource;

            List <DL.ViewBonus> viewSalarySheets = (List <ViewBonus>)emp;



            int   bonusId = Convert.ToInt32(comboBox1.SelectedValue);
            Bonus bonus   = db.Bonus.Find(bonusId);

            DateTime To   = bonus.Date;
            DateTime From = To.AddYears(-1);

            int id = Convert.ToInt32(comboBox3.SelectedValue);

            DL.Department department = db.Departments.Find(id);

            int id2 = Convert.ToInt32(comboBox4.SelectedValue);

            DL.Section section = db.Sections.Find(id2);



            BonusCrystalPar salaryReportParameter = new BonusCrystalPar();

            salaryReportParameter.Unit       = department.Unit.Name;
            salaryReportParameter.Department = department.Name;
            salaryReportParameter.Section    = section.Name;
            salaryReportParameter.Date       = DateTime.Now;
            salaryReportParameter.BonusDate  = bonus.Date;
            salaryReportParameter.Festival   = bonus.Reason;

            // Calculate Company Wise
            List <Employee> employeesALL = db.Employees.Where(a => a.Section.Department.Unit.CompanyId == department.Unit.CompanyId).ToList();
            List <Employee> employees    = employeesALL.Where(a => a.IsActive(To) && a.IsEdited == true).ToList();

            try
            {
                List <ViewBonus> viewSalarySheetsCompany = GetList(employees);
                salaryReportParameter.CTE = viewSalarySheetsCompany.Sum(a => a.Bonus).ToString();
                salaryReportParameter.UTE = viewSalarySheetsCompany.Where(a => a.section.Department.UnitId == department.UnitId).Sum(a => a.Bonus).ToString();
                salaryReportParameter.DTE = viewSalarySheetsCompany.Where(a => a.section.DepartmentId == department.Id).Sum(a => a.Bonus).ToString();
                salaryReportParameter.STE = viewSalarySheets.Sum(a => a.Bonus).ToString();


                salaryReportParameter.CTB = viewSalarySheetsCompany.Count.ToString();
                salaryReportParameter.UTB = viewSalarySheetsCompany.Count(a => a.section.Department.UnitId == department.UnitId).ToString();
                salaryReportParameter.DTB = viewSalarySheetsCompany.Count(a => a.section.DepartmentId == department.Id).ToString();
                salaryReportParameter.STB = viewSalarySheets.Count.ToString();
            }
            catch
            {
            }



            using (BonusCrystalReport salaryCrystalReport = new BonusCrystalReport(salaryReportParameter, viewSalarySheets))
            {
                salaryCrystalReport.ShowDialog();
            }
        }