//Загрузка данных в грид "Типы выплта" private bool LoadDataToGridTypePayment() { _vTypePayment = new List <v_TypePayment>(); _vTypePayment.Add(new v_TypePayment { Id = 0, Name = "Всі виплати" }); _vTypePayment.AddRange(TypePaymentHelper.GetTypePayment()); dgvTypePayment.DataSource = _vTypePayment; return(true); }
//Загрузка данных в грид "Виплати" private bool LoadDataToGridPayment(DateTime datClc) { string error; _payments = _repoPayment.GetPaymentByParams(0, 0, datClc, datClc, out error); if (error != string.Empty) { MessageBox.Show("Помилка завантаження виплат.\nТехнічна інформація: " + error, "Помилка"); return(false); } if (_vTypePayment == null) { _vTypePayment = TypePaymentHelper.GetTypePayment(); } _vPayments = GetViewPayments(_payments, _vTypePayment); return(true); }
private bool LoadDataForPrint(DateTime dat, EnumPaymentStatement payStat, List <int> id_payment, List <int> id_addPayment, out string error) { error = string.Empty; List <PersCard> cards = _repoCard.GetAllCards(out error); if (error != string.Empty) { return(false); } DateTime datBeg = new DateTime(dat.Year, dat.Month, 1); DateTime datEnd = new DateTime(dat.Year, dat.Month, DateTime.DaysInMonth(dat.Year, dat.Month)); List <v_TypePayment> vTypePayment = TypePaymentHelper.GetTypePayment(); List <Payment> payments = _repoPayment.GetPaymentByParams(0, 0, datBeg, datEnd, out error); if (error != string.Empty) { return(false); } List <RefTypeAddPayment> typeAddPayments = _repoRefTypeAddPayment.GetAllTypeAddPayments(out error); if (error != string.Empty) { return(false); } List <AddPayment> addPayments = _repoAddPayment.GetAddPaymentsByParams(0, 0, datBeg, datEnd, out error); if (error != string.Empty) { return(false); } if (payStat == EnumPaymentStatement.AllPayment) { _paymentStatement = (from card in cards join payment in payments on card.PersCard_Id equals payment.Payment_PersCard_Id join typePayment in vTypePayment on payment.Payment_Type equals typePayment.Id where payment.Payment_Date.Year == dat.Year && payment.Payment_Date.Month == dat.Month select new RPR_PaymentStatement { PersCard_Name = SalaryHelper.GetLastNameWithInit(card.PersCard_LName, card.PersCard_MName, card.PersCard_FName), PersCard_TIN = card.PersCard_TIN, Payment_Type = typePayment.Id, Payment_TypeName = typePayment.Name, Payment_Amt = payment.Payment_Amt, Payment_Price = payment.Payment_Price, Payment_Sm = payment.Payment_Sm }).ToList(); _addPaymentStatement = (from card in cards join addPayment in addPayments on card.PersCard_Id equals addPayment.AddPayment_PersCard_Id join typeAddPayment in typeAddPayments on addPayment.AddPayment_TypeAddPayment_Id equals typeAddPayment.RefTypeAddPayment_Id where addPayment.AddPayment_Date.Year == dat.Year && addPayment.AddPayment_Date.Month == dat.Month select new RPR_AddPaymentStatement { PersCard_Name = SalaryHelper.GetLastNameWithInit(card.PersCard_LName, card.PersCard_MName, card.PersCard_FName), PersCard_TIN = card.PersCard_TIN, AddPayment_Type = typeAddPayment.RefTypeAddPayment_Id, AddPayment_TypeName = typeAddPayment.RefTypeAddPayment_Nm, AddPayment_Sm = addPayment.AddPayment_Sm }).ToList(); } else { _paymentStatement = (from card in cards join payment in payments on card.PersCard_Id equals payment.Payment_PersCard_Id join typePayment in vTypePayment on payment.Payment_Type equals typePayment.Id where payment.Payment_Date.Year == dat.Year && payment.Payment_Date.Month == dat.Month && id_payment.Contains(typePayment.Id) select new RPR_PaymentStatement { PersCard_Name = SalaryHelper.GetLastNameWithInit(card.PersCard_LName, card.PersCard_MName, card.PersCard_FName), PersCard_TIN = card.PersCard_TIN, Payment_Type = typePayment.Id, Payment_TypeName = typePayment.Name, Payment_Amt = payment.Payment_Amt, Payment_Price = payment.Payment_Price, Payment_Sm = payment.Payment_Sm }).ToList(); _addPaymentStatement = (from card in cards join addPayment in addPayments on card.PersCard_Id equals addPayment.AddPayment_PersCard_Id join typeAddPayment in typeAddPayments on addPayment.AddPayment_TypeAddPayment_Id equals typeAddPayment.RefTypeAddPayment_Id where addPayment.AddPayment_Date.Year == dat.Year && addPayment.AddPayment_Date.Month == dat.Month && id_addPayment.Contains(typeAddPayment.RefTypeAddPayment_Id) select new RPR_AddPaymentStatement { PersCard_Name = SalaryHelper.GetLastNameWithInit(card.PersCard_LName, card.PersCard_MName, card.PersCard_FName), PersCard_TIN = card.PersCard_TIN, AddPayment_Type = typeAddPayment.RefTypeAddPayment_Id, AddPayment_TypeName = typeAddPayment.RefTypeAddPayment_Nm, AddPayment_Sm = addPayment.AddPayment_Sm }).ToList(); } return(true); }
//Загрузка данных в таблицу private void LoadDataToGridTypePayment() { List <v_TypePayment> vTypePayment = TypePaymentHelper.GetTypePayment(); dgvTypePayment.DataSource = vTypePayment; }
private bool LoadDataForPrint(DateTime dat, EnumSalaryList typeForm, List <int> id_dep, out string error) { error = string.Empty; List <PersCard> cards = _repoCard.GetAllCards(out error); if (error != string.Empty) { return(false); } List <Salary> salaries = _repoSalary.GetSalariesByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <RefDep> deps = _repoDep.GetAllDeps(out error); if (error != string.Empty) { return(false); } List <Vocation> vocations = _repoVocation.GetVocationsByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <SickList> sickLists = _repoSickList.GetSickListsByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <LawContract> lawContracts = _repoLaw.GetLawContractsByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <Payment> payments = _repoPayment.GetPaymentByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <v_TypePayment> typePayment = TypePaymentHelper.GetTypePayment(); List <AddAccr> addAccrs = _repoAddAccr.GetAddAccrByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <RefTypeAddAccr> typeAddAccrs = _repoTypeAddAccr.GetAllTypeAddAccr(out error); if (error != string.Empty) { return(false); } List <AddPayment> addPayment = _repoAddPayment.GetAddPaymentsByParams(0, 0, dat, dat, out error); if (error != string.Empty) { return(false); } List <RefTypeAddPayment> typeAddPayment = _repoTypeAddPayment.GetAllTypeAddPayments(out error); if (error != string.Empty) { return(false); } _acses = _repoAcs.GetAllACSByParam(dat, out error); if (error != string.Empty) { return(false); } if (typeForm == EnumSalaryList.ByFirma) { _paymentAccr = (from pay in payments join type in typePayment on pay.Payment_Type equals type.Id into typ from type in typ.DefaultIfEmpty() select new RPR_PaymentAccr { PersCard_Id = pay.Payment_PersCard_Id, TypeName = "Виплати", Name = type.Name, Sm = pay.Payment_Sm } ).ToList(); _paymentAccr.AddRange( (from accr in addAccrs join type in typeAddAccrs on accr.AddAccr_RefTypeAddAccr_Id equals type.RefTypeAddAccr_Id into typ from type in typ.DefaultIfEmpty() select new RPR_PaymentAccr { PersCard_Id = accr.AddAccr_PersCard_Id, TypeName = "Додаткові нарахування", Name = type.RefTypeAddAccr_Nm + " (" + ( ((type.RefTypeAddAccr_Flg & (int)EnumTypeAddAccr_Flg.TypeAddAccr_Clc) > 0) ? "Розрах." : "Не розрах.") + ")", Sm = accr.AddAccr_Sm } ) ); _paymentAccr.AddRange( (from addPay in addPayment join type in typeAddPayment on addPay.AddPayment_TypeAddPayment_Id equals type.RefTypeAddPayment_Id into typ from type in typ.DefaultIfEmpty() select new RPR_PaymentAccr { PersCard_Id = addPay.AddPayment_PersCard_Id, TypeName = "Додаткові виплати", Name = type.RefTypeAddPayment_Nm, Sm = addPay.AddPayment_Sm } ) ); _vocSickLaw = (from voc in vocations join dep in deps on voc.Vocation_RefDep_Id equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() select new RPR_VocSickLaw { PersCard_Id = voc.Vocation_PersCard_Id, TypeName = "Відпускні", RefDep_Name = department.RefDep_Nm, Days = voc.Vocation_Days, Sm = voc.Vocation_Sm } ).ToList(); _vocSickLaw.AddRange( (from list in sickLists join dep in deps on list.SickList_RefDep_Id equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() select new RPR_VocSickLaw { PersCard_Id = list.SickList_PersCard_Id, TypeName = "Лікарняні", RefDep_Name = department.RefDep_Nm, Days = list.SickList_DaysTmpDis, Sm = list.SickList_ResSm } ).ToList() ); _vocSickLaw.AddRange( (from contract in lawContracts join dep in deps on contract.LawContract_RefDep_Id equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() select new RPR_VocSickLaw { PersCard_Id = contract.LawContract_PersCard_Id, TypeName = "Договора ЦПХ", RefDep_Name = department.RefDep_Nm, Days = contract.LawContract_Days, Sm = contract.LawContract_Sm } ).ToList() ); _salaryList = (from card in cards join salary in salaries on card.PersCard_Id equals salary.Salary_PersCard_Id into sal from salary in sal.DefaultIfEmpty() join acs in _acses on card.PersCard_Id equals acs.PersCard_Id into rec from acs in rec.DefaultIfEmpty() join dep in deps on(salary == null ? 0 : salary.Salary_RefDep_Id) equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() select new RPR_SalaryList { PersCard_Id = card.PersCard_Id, PersCard_LName = card.PersCard_LName, PersCard_FName = card.PersCard_FName, PersCard_MName = card.PersCard_MName, PersCard_TIN = card.PersCard_TIN, Salary_DepName = department == null ? string.Empty : department.RefDep_Nm, SalBalance_BegMonthSm = acs == null ? 0 : acs.SalBalance_BegMonthSm, SalBalance_EndMonthSm = acs == null ? 0 : acs.SalBalance_EndMonthSm, Salary_Days = salary == null ? 0 : salary.Salary_Days, Salary_Hours = salary == null ? 0 : salary.Salary_Hours, Salary_BaseSm = salary == null ? 0 : salary.Salary_BaseSm, Salary_PensSm = salary == null ? 0 : salary.Salary_PensSm, Salary_GradeSm = salary == null ? 0 : salary.Salary_GradeSm, Salary_ExpSm = salary == null ? 0 : salary.Salary_ExpSm, Salary_OthSm = salary == null ? 0 : salary.Salary_OthSm, Salary_KTU = salary == null ? 0 : salary.Salary_KTU, Salary_KTUSm = salary == null ? 0 : salary.Salary_KTUSm, Salary_ResSm = salary == null ? 0 : salary.Salary_ResSm, Tax_Sm = acs == null ? 0 : acs.Tax_Sm, Prof_Sm = acs == null ? 0 : acs.Prof_Sm, Military_Sm = acs == null ? 0 : acs.Military_Sm, TotalDeduct_Sm = acs == null ? 0 : (acs.Tax_Sm + acs.Prof_Sm + acs.Military_Sm), NameMonth = SalaryHelper.GetMonthNameById(dat.Month, EnumCaseWorld.Nominative) }).ToList(); } else if (typeForm == EnumSalaryList.ByDep) { //Выплаты _paymentAccr = (from pay in payments join salary in salaries on pay.Payment_PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id join type in typePayment on pay.Payment_Type equals type.Id into typ from type in typ.DefaultIfEmpty() where id_dep.Contains(department.RefDep_Id) select new RPR_PaymentAccr { PersCard_Id = pay.Payment_PersCard_Id, TypeName = "Виплати", Name = type.Name, Sm = pay.Payment_Sm } ).ToList(); _paymentAccr.AddRange( (from accr in addAccrs join salary in salaries on accr.AddAccr_PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id join type in typeAddAccrs on(accr == null ? 0 : accr.AddAccr_RefTypeAddAccr_Id) equals type.RefTypeAddAccr_Id into typ from type in typ.DefaultIfEmpty() where id_dep.Contains(department.RefDep_Id) select new RPR_PaymentAccr { PersCard_Id = accr.AddAccr_PersCard_Id, TypeName = "Додаткові нарахування", Name = type.RefTypeAddAccr_Nm + " (" + ( ((type.RefTypeAddAccr_Flg & (int)EnumTypeAddAccr_Flg.TypeAddAccr_Clc) > 0) ? "Розрах." : "Не розрах.") + ")", Sm = accr.AddAccr_Sm } ) ); _paymentAccr.AddRange( (from addPay in addPayment join salary in salaries on addPay.AddPayment_PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id join type in typeAddPayment on(addPay == null ? 0 : addPay.AddPayment_TypeAddPayment_Id) equals type.RefTypeAddPayment_Id into typ from type in typ.DefaultIfEmpty() where id_dep.Contains(department.RefDep_Id) select new RPR_PaymentAccr { PersCard_Id = addPay.AddPayment_PersCard_Id, TypeName = "Додаткові виплати", Name = type.RefTypeAddPayment_Nm, Sm = addPay.AddPayment_Sm } ) ); _vocSickLaw = (from voc in vocations join salary in salaries on voc.Vocation_PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id where id_dep.Contains(department.RefDep_Id) select new RPR_VocSickLaw { PersCard_Id = voc.Vocation_PersCard_Id, TypeName = "Відпускні", RefDep_Name = department.RefDep_Nm, Days = voc.Vocation_Days, Sm = voc.Vocation_Sm } ).ToList(); _vocSickLaw.AddRange( (from list in sickLists join salary in salaries on list.SickList_PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id where id_dep.Contains(department.RefDep_Id) select new RPR_VocSickLaw { PersCard_Id = list.SickList_PersCard_Id, TypeName = "Лікарняні", RefDep_Name = department.RefDep_Nm, Days = list.SickList_DaysTmpDis, Sm = list.SickList_ResSm } ).ToList() ); _vocSickLaw.AddRange( (from contract in lawContracts join salary in salaries on contract.LawContract_PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id where id_dep.Contains(department.RefDep_Id) select new RPR_VocSickLaw { PersCard_Id = contract.LawContract_PersCard_Id, TypeName = "Договора ЦПХ", RefDep_Name = department.RefDep_Nm, Days = contract.LawContract_Days, Sm = contract.LawContract_Sm } ).ToList() ); _salaryList = (from card in cards join salary in salaries on card.PersCard_Id equals salary.Salary_PersCard_Id join department in deps on salary.Salary_RefDep_Id equals department.RefDep_Id join acs in _acses on card.PersCard_Id equals acs.PersCard_Id into rec from acs in rec.DefaultIfEmpty() where id_dep.Contains(salary.Salary_RefDep_Id) select new RPR_SalaryList { PersCard_Id = card.PersCard_Id, PersCard_LName = card.PersCard_LName, PersCard_FName = card.PersCard_FName, PersCard_MName = card.PersCard_MName, PersCard_TIN = card.PersCard_TIN, Salary_DepName = department == null ? string.Empty : department.RefDep_Nm, SalBalance_BegMonthSm = acs == null ? 0 : acs.SalBalance_BegMonthSm, SalBalance_EndMonthSm = acs == null ? 0 : acs.SalBalance_EndMonthSm, Salary_Days = salary == null ? 0 : salary.Salary_Days, Salary_Hours = salary == null ? 0 : salary.Salary_Hours, Salary_BaseSm = salary == null ? 0 : salary.Salary_BaseSm, Salary_PensSm = salary == null ? 0 : salary.Salary_PensSm, Salary_GradeSm = salary == null ? 0 : salary.Salary_GradeSm, Salary_ExpSm = salary == null ? 0 : salary.Salary_ExpSm, Salary_OthSm = salary == null ? 0 : salary.Salary_OthSm, Salary_KTU = salary == null ? 0 : salary.Salary_KTU, Salary_KTUSm = salary == null ? 0 : salary.Salary_KTUSm, Salary_ResSm = salary == null ? 0 : salary.Salary_ResSm, Tax_Sm = acs == null ? 0 : acs.Tax_Sm, Prof_Sm = acs == null ? 0 : acs.Prof_Sm, Military_Sm = acs == null ? 0 : acs.Military_Sm, TotalDeduct_Sm = acs == null ? 0 : (acs.Tax_Sm + acs.Prof_Sm + acs.Military_Sm), NameMonth = SalaryHelper.GetMonthNameById(dat.Month, EnumCaseWorld.Nominative) }).ToList(); } else if (typeForm == EnumSalaryList.ByPersCard) { _paymentAccr = (from pay in payments join type in typePayment on pay.Payment_Type equals type.Id into typ from type in typ.DefaultIfEmpty() where _checkedId.Contains(pay.Payment_PersCard_Id) select new RPR_PaymentAccr { PersCard_Id = pay.Payment_PersCard_Id, TypeName = "Виплати", Name = type.Name, Sm = pay.Payment_Sm } ).ToList(); _paymentAccr.AddRange( (from accr in addAccrs join type in typeAddAccrs on accr.AddAccr_RefTypeAddAccr_Id equals type.RefTypeAddAccr_Id into typ from type in typ.DefaultIfEmpty() where _checkedId.Contains(accr.AddAccr_PersCard_Id) select new RPR_PaymentAccr { PersCard_Id = accr.AddAccr_PersCard_Id, TypeName = "Додаткові нарахування", Name = type.RefTypeAddAccr_Nm + " (" + ( ((type.RefTypeAddAccr_Flg & (int)EnumTypeAddAccr_Flg.TypeAddAccr_Clc) > 0) ? "Розрах." : "Не розрах.") + ")", Sm = accr.AddAccr_Sm } ) ); _paymentAccr.AddRange( (from addPay in addPayment join type in typeAddPayment on addPay.AddPayment_TypeAddPayment_Id equals type.RefTypeAddPayment_Id into typ from type in typ.DefaultIfEmpty() where _checkedId.Contains(addPay.AddPayment_PersCard_Id) select new RPR_PaymentAccr { PersCard_Id = addPay.AddPayment_PersCard_Id, TypeName = "Додаткові виплати", Name = type.RefTypeAddPayment_Nm, Sm = addPay.AddPayment_Sm } ) ); _vocSickLaw = (from voc in vocations join dep in deps on voc.Vocation_RefDep_Id equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() where _checkedId.Contains(voc.Vocation_PersCard_Id) select new RPR_VocSickLaw { PersCard_Id = voc.Vocation_PersCard_Id, TypeName = "Відпускні", RefDep_Name = department.RefDep_Nm, Days = voc.Vocation_Days, Sm = voc.Vocation_Sm } ).ToList(); _vocSickLaw.AddRange( (from list in sickLists join dep in deps on list.SickList_RefDep_Id equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() where _checkedId.Contains(list.SickList_PersCard_Id) select new RPR_VocSickLaw { PersCard_Id = list.SickList_PersCard_Id, TypeName = "Лікарняні", RefDep_Name = department.RefDep_Nm, Days = list.SickList_DaysTmpDis, Sm = list.SickList_ResSm } ).ToList() ); _vocSickLaw.AddRange( (from contract in lawContracts join dep in deps on contract.LawContract_RefDep_Id equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() where _checkedId.Contains(contract.LawContract_PersCard_Id) select new RPR_VocSickLaw { PersCard_Id = contract.LawContract_PersCard_Id, TypeName = "Договора ЦПХ", RefDep_Name = department.RefDep_Nm, Days = contract.LawContract_Days, Sm = contract.LawContract_Sm } ).ToList() ); _salaryList = (from card in cards join salary in salaries on card.PersCard_Id equals salary.Salary_PersCard_Id into sal from salary in sal.DefaultIfEmpty() join acs in _acses on card.PersCard_Id equals acs.PersCard_Id into rec from acs in rec.DefaultIfEmpty() join dep in deps on(salary == null ? 0 : salary.Salary_RefDep_Id) equals dep.RefDep_Id into dep from department in dep.DefaultIfEmpty() where _checkedId.Contains(card.PersCard_Id) select new RPR_SalaryList { PersCard_Id = card.PersCard_Id, PersCard_LName = card.PersCard_LName, PersCard_FName = card.PersCard_FName, PersCard_MName = card.PersCard_MName, PersCard_TIN = card.PersCard_TIN, Salary_DepName = department == null ? string.Empty : department.RefDep_Nm, SalBalance_BegMonthSm = acs == null ? 0 : acs.SalBalance_BegMonthSm, SalBalance_EndMonthSm = acs == null ? 0 : acs.SalBalance_EndMonthSm, Salary_Days = salary == null ? 0 : salary.Salary_Days, Salary_Hours = salary == null ? 0 : salary.Salary_Hours, Salary_BaseSm = salary == null ? 0 : salary.Salary_BaseSm, Salary_PensSm = salary == null ? 0 : salary.Salary_PensSm, Salary_GradeSm = salary == null ? 0 : salary.Salary_GradeSm, Salary_ExpSm = salary == null ? 0 : salary.Salary_ExpSm, Salary_OthSm = salary == null ? 0 : salary.Salary_OthSm, Salary_KTU = salary == null ? 0 : salary.Salary_KTU, Salary_KTUSm = salary == null ? 0 : salary.Salary_KTUSm, Salary_ResSm = salary == null ? 0 : salary.Salary_ResSm, Tax_Sm = acs == null ? 0 : acs.Tax_Sm, Prof_Sm = acs == null ? 0 : acs.Prof_Sm, Military_Sm = acs == null ? 0 : acs.Military_Sm, TotalDeduct_Sm = acs == null ? 0 : (acs.Tax_Sm + acs.Prof_Sm + acs.Military_Sm), NameMonth = SalaryHelper.GetMonthNameById(dat.Month, EnumCaseWorld.Nominative) }).ToList(); } return(true); }