Пример #1
0
 public PrintPayrollLeaseCompany(PayrollLeaseCompany payroll)
 {
     Payroll  = payroll;
     Fullname = CreateFullname();
     ToPdf    = new PrintToPdf(Fullname);
     PdfFile  = new Pdf(Fullname);
 }
        public void LoadPayroll(string id)
        {
            _payrollLeaseCompany = _payrollLeaseCompanyBusiness.Get(id);

            _percentLeaseFeeValue   = _payrollLeaseCompany.PercentLeaseFeeValue;
            _percentWorkerCompValue = _payrollLeaseCompany.PercentWorkerCompValue;

            LeaseCompanies.SelectedValue = _payrollLeaseCompany.LeaseCompany.Id;
            Trucks.SelectedValue         = _payrollLeaseCompany.Truck.Id;
            Date.SelectedDate            = _payrollLeaseCompany.Date;
            FromPayment.SelectedDate     = _payrollLeaseCompany.From;
            ToPayment.SelectedDate       = _payrollLeaseCompany.To;
            PercentLeaseFeeValue.Text    = _percentLeaseFeeValue.ToString();
            PercentWorkerCompValue.Text  = _percentWorkerCompValue.ToString();
            Total.Text = _payrollLeaseCompany.Total.ToString("C");

            if (_rates.Count == 0)
            {
                foreach (var rate in _payrollLeaseCompany.Rates)
                {
                    _rates.Add(new RateDetail()
                    {
                        Companies = rate.Companies,
                        Hours     = rate.Hours,
                        Rate      = rate.Rate
                    });
                }
            }

            _details.Clear();
            foreach (var detail in _payrollLeaseCompany.Details)
            {
                _details.Add(new PayrollLeaseCompanyDetails()
                {
                    IsEnabled = !detail.Item.Contains("Diesel"),
                    Item      = detail.Item,
                    Value     = detail.Value
                });
            }

            foreach (var deduction in _payrollLeaseCompany.Deductions)
            {
                _deductions.Add(new GenericCollection()
                {
                    Item  = deduction.Item,
                    Value = deduction.Value
                });
            }

            foreach (var reimbursements in _payrollLeaseCompany.Reimbursements)
            {
                _reimbursements.Add(new GenericCollection()
                {
                    Item  = reimbursements.Item,
                    Value = reimbursements.Value
                });
            }
        }
        public PayrollLeaseCompanies()
        {
            _payrollLeaseCompanyBusiness = new business.PayrollLeaseCompany();
            _payrollBusiness             = new business.Payroll();
            _leaseCompanyBusiness        = new business.LeaseCompany();
            _payrollLeaseCompany         = new PayrollLeaseCompany();
            _details        = new ObservableCollection <PayrollLeaseCompanyDetails>();
            _deductions     = new ObservableCollection <GenericCollection>();
            _reimbursements = new ObservableCollection <GenericCollection>();
            _rates          = new ObservableCollection <RateDetail>();

            InitializeComponent();
        }
        private void Clear()
        {
            _payrollLeaseCompany = new PayrollLeaseCompany();
            _details             = new ObservableCollection <PayrollLeaseCompanyDetails>();
            _deductions          = new ObservableCollection <GenericCollection>();
            _reimbursements      = new ObservableCollection <GenericCollection>();
            _rates = new ObservableCollection <RateDetail>();

            _percentLeaseFeeValue   = business.Constant.PayrollLeaseCompany.PercentLeaseFeeValue;
            _percentWorkerCompValue = business.Constant.PayrollLeaseCompany.PercentWorkerCompValue;

            LoadDetails();

            LeaseCompanies.SelectedItem = null;
            Trucks.SelectedItem         = null;
            Total.Text                 = "$ 0";
            Details.ItemsSource        = _details;
            Deductions.ItemsSource     = _deductions;
            Reimbursements.ItemsSource = _reimbursements;
            Rates.ItemsSource          = _rates;
        }