/// <summary> /// Validate - General /// </summary> private void ValidateHoursGeneral(TMJournalLineClientLocal rec) { if (err) { return; } if (rec.Project == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("ProjectNumber"), RowId = rec.RowId }); err = true; } if (rec.PayrollCategory == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("PayrollCategory"), RowId = rec.RowId }); err = true; } }
public CwTransportRegistration(TMJournalLineClientLocal tmJournalLine, CrudAPI _crudApi) { crudApi = _crudApi; journalline = tmJournalLine; Returning = true; company = crudApi.CompanyEntity; employee = tmJournalLine.EmployeeRef; intializeProperties(); this.DataContext = this; InitializeComponent(); lePayType.api = leProject.api = leProjectTask.api = leWorkSpace.api = crudApi; this.Title = string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("Mileage"), Uniconta.ClientTools.Localization.lookup("ProjectRegistration")); payrollCache = crudApi.GetCache(typeof(Uniconta.DataModel.EmpPayrollCategory)); projectCache = crudApi.GetCache(typeof(Uniconta.DataModel.Project)); debtor = tmJournalLine.ProjectRef?.Debtor; txtProjectName.Text = tmJournalLine.ProjectRef?._Name; installation = tmJournalLine.ProjectRef?.InstallationRef; if (!company.ProjectTask) { lblProjectTask.Visibility = Visibility.Collapsed; leProjectTask.Visibility = Visibility.Collapsed; } LoadControls(); lePayType.cacheFilter = new MileagePayrollFilter(payrollCache); SetProjectTask(); }
public CwTransportRegistration(TMJournalLineClientLocal tmJournalLine, CrudAPI _crudApi, double mileageTotal, bool returning, bool _addMileage = false) { crudApi = _crudApi; journalline = tmJournalLine; Returning = returning; intializeProperties(); this.DataContext = this; InitializeComponent(); lePayType.api = leProject.api = crudApi; this.Title = string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("Mileage"), Uniconta.ClientTools.Localization.lookup("ProjectRegistration")); employee = tmJournalLine.EmployeeRef; company = crudApi.CompanyEntity; if (journalline.RowId != 0 && journalline._RegistrationType == RegistrationType.Mileage) { chkReturning.IsEnabled = false; } else { debtor = tmJournalLine.ProjectRef?.Debtor; txtProjectName.Text = tmJournalLine.ProjectRef?._Name; installation = tmJournalLine.ProjectRef?.InstallationRef; } addMileage = _addMileage; this.mileageTotal = mileageTotal; LoadControls(); this.DataContext = this; }
/// <summary> /// Validate - Project Category /// </summary> private void ValidateMileageProjectCategory(TMJournalLineClientLocal rec) { if (err) { return; } var payrollCat = empPayrollCatList?.Get(rec.PayrollCategory); if (payrollCat._PrCategory == null) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Payroll category '{0}' need to be updated with a Project category.", rec.PayrollCategory), RowId = rec.RowId }); err = true; } if (payrollCat._Rate == 0) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Payroll category '{0}' need to be specified with kilometer rate.", rec.PayrollCategory), RowId = rec.RowId }); err = true; } if (payrollCat._InternalType != InternalType.Mileage) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Payroll category '{0}' must have Internaltype '{1}'", rec.PayrollCategory, InternalType.Mileage), RowId = rec.RowId }); err = true; } if (payrollCat._InternalProject != null && rec._Project != payrollCat._InternalProject) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Only project '{0}' is allowed for mileage registration", payrollCat._InternalProject), RowId = rec.RowId }); err = true; } }
/// <summary> /// Validate - Project /// </summary> private void ValidateMileageProject(TMJournalLineClientLocal rec) { if (err) { return; } if (rec.ProjectRef.Blocked) { checkErrors.Add(new TMJournalLineError() { Message = Uniconta.ClientTools.Localization.lookup("ProjectIsBlocked"), RowId = rec.RowId }); err = true; } }
/// <summary> /// Validate - Project /// </summary> private void ValidateHoursProject(TMJournalLineClientLocal rec) { if (err) { return; } var projRef = rec.ProjectRef; if (rec._Project != null && projRef != null && projRef._Blocked) { checkErrors.Add(new TMJournalLineError() { Message = Uniconta.ClientTools.Localization.lookup("ProjectIsBlocked"), RowId = rec.RowId }); err = true; } }
/// <summary> /// Validate - General /// </summary> private void ValidateMileageGeneral(TMJournalLineClientLocal rec) { if (err) { return; } if (rec.Project == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("ProjectNumber"), RowId = rec.RowId }); err = true; } if (rec.PayrollCategory == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("PayrollCategory"), RowId = rec.RowId }); err = true; } if (rec.AddressFrom == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("AddressFrom"), RowId = rec.RowId }); err = true; } if (rec.AddressTo == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("AddressTo"), RowId = rec.RowId }); err = true; } if (rec.Text == null) { checkErrors.Add(new TMJournalLineError() { Message = fieldCannotBeEmpty("Purpose"), RowId = rec.RowId }); err = true; } //TODO:Disabled until VechicleRegNo can be registered in table.Employee //if (rec.VechicleRegNo == null) //{ // checkErrors.Add(new TMJournalLineError() // { // Message = fieldCannotBeEmpty("VechicleRegNo"), // RowId = rec.RowId // }); // err = true; //} }
/// <summary> /// Validate - Project Category /// </summary> private void ValidateHoursProjectCategory(TMJournalLineClientLocal rec) { if (err) { return; } var proj = projCache.Get(rec._Project); var projGroup = projGroupList.Get(proj?._Group); var payrollCat = empPayrollCatList.Get(rec._PayrollCategory); if (payrollCat?._PrCategory == null) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Payroll category '{0}' need to be updated with a Project category.", rec._PayrollCategory), RowId = rec.RowId }); err = true; } if (projGroup != null && payrollCat._Invoiceable && !projGroup._Invoiceable) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Invoiceable Payroll category '{0}' cant be posted to a none Invoiceable project", rec._PayrollCategory), RowId = rec.RowId }); err = true; } if (projGroup != null && !payrollCat._Invoiceable && projGroup._Invoiceable && payrollCat._InternalProject != null) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("None invoiceable Payroll category '{0}' cant be posted to a Invoiceable project", rec._PayrollCategory), RowId = rec.RowId }); err = true; } if (payrollCat._InternalType == InternalType.Mileage) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Mileage must be registrered in Mileage section"), RowId = rec.RowId }); err = true; } if (payrollCat._InternalType != InternalType.None && rec.Project != payrollCat._InternalProject) { checkErrors.Add(new TMJournalLineError() { Message = String.Format("Project '{0}' is not allowed for Payroll category '{1}' due to setup", rec.Project, rec._PayrollCategory), RowId = rec.RowId }); err = true; } }