Example #1
0
        public CREATE_OFF_DAY(List <int> lstIDNhanVienNgayNghi)
        {
            this.lstIDNhanVienNgayNghi = lstIDNhanVienNgayNghi;
            data = new TinhTienLuongEntities();
            InitializeComponent();
            this.btnCapNhat.Show();
            this.btnTaoNgay.Hide();
            this.txtSearchBar.Enabled = false;
            this.btnSearch.Enabled    = false;

            this.listTitleOFFDay           = data.fnDisplayTitleOFFDay().ToList();
            this.TitleOFFDay.DataSource    = this.listTitleOFFDay;
            this.TitleOFFDay.DisplayMember = "TenNgayNghi";
            this.TitleOFFDay.ValueMember   = "ID";

            //Show info staff on datagridview
            int i = 1;

            foreach (int id in lstIDNhanVienNgayNghi)
            {
                this.bunifuCustomDataGrid1.Rows.Add(true,
                                                    i,
                                                    data.NHANSUs.Find(data.NHANVIEN_LOAINGAYNGHI.Find(id).ID_NhanVien).UserName,
                                                    data.NHANSUs.Find(data.NHANVIEN_LOAINGAYNGHI.Find(id).ID_NhanVien).HoVaTen,
                                                    data.NHANSUs.Find(data.NHANVIEN_LOAINGAYNGHI.Find(id).ID_NhanVien).SoNgayNghiPhep
                                                    );
                this.bunifuCustomDataGrid1.DefaultCellStyle.ForeColor = Color.FromArgb(64, 64, 64);
                this.lstIDNhanVien.Add((int)data.NHANVIEN_LOAINGAYNGHI.Find(id).ID_NhanVien);
                i++;
            }
            //Khi fill data vao form phải fill TitleOFFDay trước vì TitleOFFDay có sự kiện text change
            //khi tiltleOFFDay được lựa chọn nó sẽ làm thay đổi các thông tin đã nhập trước đó
            this.TitleOFFDay.SelectedValue = data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).ID_LoaiNgayNghi;

            this.txtNgayKetThuc.Value = data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).NgayKetThuc.GetValueOrDefault();
            this.txtNgayBatDau.Value  = data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).NgayBatDau.GetValueOrDefault();

            if (data.LOAINGAYNGHIs.Find(data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).ID_LoaiNgayNghi.GetValueOrDefault()).LoaiNgayNghi1.Replace(" ", "") == "CoPhep")
            {
                this.TypeOFFDay.SetSelected(0, true);
            }
            else
            {
                this.TypeOFFDay.SetSelected(1, true);
            }

            this.txtNameOfOFFDay.Text = data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).LyDo;

            if ((data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).NgayBatDau.GetValueOrDefault().Minute != 00 &&
                 data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).NgayBatDau.GetValueOrDefault().Hour != 00) ||
                (data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).NgayKetThuc.GetValueOrDefault().Minute != 00 &&
                 data.NHANVIEN_LOAINGAYNGHI.Find(lstIDNhanVienNgayNghi[0]).NgayKetThuc.GetValueOrDefault().Hour != 00))
            {
                this.checkBoxOFFAllDay.Checked = false;
            }
            else
            {
                this.checkBoxOFFAllDay.Checked = true;
            }
        }
Example #2
0
        public CREATE_OFF_DAY()
        {
            InitializeComponent();
            this.btnTaoNgay.Show();
            this.btnCapNhat.Hide();
            data = new TinhTienLuongEntities();
            this.listTitleOFFDay           = data.fnDisplayTitleOFFDay().ToList();
            this.TitleOFFDay.DataSource    = data.LOAINGAYNGHIs.ToList();
            this.TitleOFFDay.DisplayMember = "TenNgayNghi";
            this.TitleOFFDay.ValueMember   = "ID";

            ShowInfoEmployee();
        }
Example #3
0
        public Payroll(int IDNhanVien, DateTime ThangNam)
        {
            this.data        = new TinhTienLuongEntities();
            this.ID_NhanVien = IDNhanVien;
            this.ThangNam    = ThangNam;
            NHANSU staff = data.NHANSUs.Find(this.ID_NhanVien);

            if (staff != null && staff.ID <= 10)
            {
                Calculate val = new Calculate();

                this.Wfh                  = val.CALCULATE(("OTH_33").Split(' '), ID_NhanVien, ThangNam);
                this.AtWork               = val.CALCULATE(("OTH_32").Split(' '), ID_NhanVien, ThangNam);
                this.LeaveHours           = val.CALCULATE(("OTH_32").Split(' '), ID_NhanVien, ThangNam);
                this.Km                   = val.CALCULATE(("OTH_37").Split(' '), ID_NhanVien, ThangNam);
                this.SalaryBasic          = val.CALCULATE(("OTH_34").Split(' '), ID_NhanVien, ThangNam);
                this.OTSalary             = val.CALCULATE(("OTH_13").Split(' '), ID_NhanVien, ThangNam);
                this.Responsi_Japanese    = val.CALCULATE(("OTH_3").Split(' '), ID_NhanVien, ThangNam);
                this.Parking_Gasoline     = val.CALCULATE(("OTH_2").Split(' '), ID_NhanVien, ThangNam);
                this.BenefitWFH           = val.CALCULATE(("OTH_1").Split(' '), ID_NhanVien, ThangNam);
                this.SalaryDeduction      = val.CALCULATE(("OTH_5").Split(' '), ID_NhanVien, ThangNam);
                this.TotalAmount          = val.CALCULATE(("OTH_6").Split(' '), ID_NhanVien, ThangNam);
                this.TotalAmountInVND     = val.CALCULATE(("OTH_7").Split(' '), ID_NhanVien, ThangNam);
                this.SalaryForInsurance   = val.CALCULATE(("OTH_17").Split(' '), ID_NhanVien, ThangNam);
                this.SalaryForUnemployted = val.CALCULATE(("OTH_18").Split(' '), ID_NhanVien, ThangNam);

                this.HealthyInsuranceStaff          = val.CALCULATE(("OTH_19").Split(' '), ID_NhanVien, ThangNam);
                this.SocialInsuranceStaff           = val.CALCULATE(("OTH_20").Split(' '), ID_NhanVien, ThangNam);
                this.UnemploytedInsuranceStaff      = val.CALCULATE(("OTH_21").Split(' '), ID_NhanVien, ThangNam);
                this.UnemploytedInsuranceEnterprise = val.CALCULATE(("OTH_22").Split(' '), ID_NhanVien, ThangNam);
                this.HealthyInsuranceEnterprise     = val.CALCULATE(("OTH_23").Split(' '), ID_NhanVien, ThangNam);
                this.SocialInsuranceEnterprise      = val.CALCULATE(("OTH_24").Split(' '), ID_NhanVien, ThangNam);
                this.OTDeduction       = val.CALCULATE(("OTH_16").Split(' '), ID_NhanVien, ThangNam);
                this.PersonalDeduction = val.CALCULATE(("OTH_27").Split(' '), ID_NhanVien, ThangNam);
                this.AmountDependentPersonalDeduction = val.CALCULATE(("OTH_28").Split(' '), ID_NhanVien, ThangNam);
                this.TaxableIncome = val.CALCULATE(("OTH_29").Split(' '), ID_NhanVien, ThangNam);
                this.PITPayment    = val.CALCULATE(("OTH_30").Split(' '), ID_NhanVien, ThangNam);
            }
        }
        public void LoadData()
        {
            TinhTienLuongEntities data = new TinhTienLuongEntities();

            lsttTitleWorkingHours.DataSource    = data.LOAI_GIO_CONG.ToList();
            lsttTitleWorkingHours.DisplayMember = "LoaiGioCong";
            lsttTitleWorkingHours.ValueMember   = "ID";

            lstbTitleOFFDAYS.DataSource    = data.LOAINGAYNGHIs.ToList();
            lstbTitleOFFDAYS.DisplayMember = "TenNgayNghi";
            lstbTitleOFFDAYS.ValueMember   = "ID";

            List <TYPE_RANGE_HOURS_OT> lstOT = data.TYPE_RANGE_HOURS_OT.ToList();

            if (lstOT.Count != 0)
            {
                for (int i = 0; i < lstOT.Count; i++)
                {
                    this.bunifuCustomDataGrid1.Rows.Add(i + 1,
                                                        lstOT[i].RangeHours,
                                                        lstOT[i].PercentAmountOT.HasValue ? lstOT[i].PercentAmountOT.Value : 0);
                }
            }
        }