Example #1
0
        private void buttonDrop_Click(object sender, RoutedEventArgs e)
        {
            RegisterContextMenu.IsOpen = false;
            double?amount = PosDialogWindow.PromptCurrency(Types.Strings.RegisterMenuDropAmount, null);

            if (amount.HasValue && (amount.Value > 0))
            {
                double total = RegisterManager.ActiveRegisterDrawer.CurrentAmount;
                total = RegisterDrop.GetAll(RegisterManager.ActiveRegisterDrawer.Id)
                        .Aggregate(total, (current, drop) => current - drop.Amount);
                if (amount.Value < total)
                {
                    RegisterDrop.Add(RegisterManager.ActiveRegisterDrawer.Id,
                                     SessionManager.ActiveEmployee.Id, amount.Value, DateTime.Now);
                    RegisterManager.ActiveRegisterDrawer.RemoveFromCurrentAmount(amount.Value);
                    RegisterManager.OpenCashDrawer();
                }
                else
                {
                    PosDialogWindow.ShowDialog(
                        Types.Strings.RegisterMenuCantDropThatMuch,
                        Types.Strings.RegisterMenuInvalidAmount);
                }
            }
        }
        private void AddJob()
        {
            if (listBoxAllJobs.SelectedItem == null)
            {
                return;
            }
            double?payRate = PosDialogWindow.PromptCurrency(Strings.EmployeeJobEditorPayRate, 0.0);

            if (payRate == null)
            {
                return;
            }
            FormattedListBoxItem item = listBoxAllJobs.SelectedItem as FormattedListBoxItem;

            if (item != null)
            {
                EmployeeJob job = item.ReferenceObject as EmployeeJob;
                if (job != null)
                {
                    EmployeePayRate rate =
                        EmployeePayRate.Add(SelectedEmployee.Id, job.Id, payRate.Value, 0);
                    listBoxAllJobs.Items.Remove(listBoxAllJobs.SelectedItem);
                    item = GetJobListBoxItem(job, rate);
                    listBoxSelectedJobs.Items.Add(item);
                    listBoxSelectedJobs.SelectedItem = item;
                    listBoxSelectedJobs.ScrollToEnd();
                }
            }
            buttonAdd.IsEnabled    = false;
            buttonRemove.IsEnabled = true;
        }
Example #3
0
        private void buttonDriverComp_Click(object sender, RoutedEventArgs e)
        {
            double?initialValue = _dataModel.DriverCompensation;

            _driverComp           = PosDialogWindow.PromptCurrency(Strings.DriverCompensation, _driverComp);
            buttonDriverComp.Text = _driverComp == null ? Strings.None : _driverComp.Value.ToString("C2");
            if (initialValue != _driverComp)
            {
                buttonSave.IsEnabled = true;
            }
        }
Example #4
0
        private void buttonDeposit_Click(object sender, RoutedEventArgs e)
        {
            RegisterContextMenu.IsOpen = false;
            double?amount = PosDialogWindow.PromptCurrency(Types.Strings.RegisterMenuDepositAmount, null);

            if (amount.HasValue && (amount.Value > 0))
            {
                RegisterDeposit.Add(RegisterManager.ActiveRegisterDrawer.Id,
                                    SessionManager.ActiveEmployee.Id, amount.Value);
                RegisterManager.ActiveRegisterDrawer.AddToCurrentAmount(amount.Value);
                RegisterManager.OpenCashDrawer();
            }
        }
Example #5
0
        private void buttonPayout_Click(object sender, RoutedEventArgs e)
        {
            RegisterContextMenu.IsOpen = false;
            string reason = PosDialogWindow.PromptKeyboard(Types.Strings.RegisterMenuPayoutReason, null);

            if (reason != null)
            {
                double?amount = PosDialogWindow.PromptCurrency(Types.Strings.RegisterMenuPayoutAmount, null);
                if (amount.HasValue && (amount.Value > 0))
                {
                    RegisterPayout.Add(RegisterManager.ActiveRegisterDrawer.Id,
                                       SessionManager.ActiveEmployee.Id, amount.Value, reason, DateTime.Now);
                    RegisterManager.ActiveRegisterDrawer.RemoveFromCurrentAmount(amount.Value);
                    RegisterManager.OpenCashDrawer();
                }
            }
        }
        private void EditEmployeePayRate()
        {
            double?payRate = PosDialogWindow.PromptCurrency(Strings.EmployeeJobEditorPayRate, 0.0);

            if (payRate != null)
            {
                FormattedListBoxItem item = listBoxSelectedJobs.SelectedItem as FormattedListBoxItem;
                if (item != null)
                {
                    EmployeeJob     job  = item.ReferenceObject as EmployeeJob;
                    EmployeePayRate rate =
                        EmployeePayRate.GetEmployeePayRateForJob(SelectedEmployee.Id, job.Id);
                    rate.SetWage(payRate.Value);
                    rate.Update();
                    item.Set(job, job.Description + Environment.NewLine +
                             rate.Wage.ToString("C2"));
                }
            }
        }
Example #7
0
        private void buttonTips_Click(object sender, RoutedEventArgs e)
        {
            double?    initialValue = _dataModel.DeclaredTipAmount;
            IShadeable parentWindow = Window.GetWindow(this) as IShadeable;

            parentWindow.ShowShadingOverlay = true;
            _tipsDeclared = PosDialogWindow.PromptCurrency(
                Strings.DeclareTips, _tipsDeclared);
            parentWindow.ShowShadingOverlay = false;
            if (_tipsDeclared == null)
            {
                buttonTips.Text = Strings.None;
            }
            else
            {
                buttonTips.Text = _tipsDeclared.Value.ToString("C2");
            }
            if (initialValue != _tipsDeclared)
            {
                buttonSave.IsEnabled = true;
            }
        }
        private void DeclareTips()
        {
            IShadeable parentWindow = Window.GetWindow(this) as IShadeable;

            if (parentWindow != null)
            {
                parentWindow.ShowShadingOverlay = true;
            }
            _tipsDeclared = PosDialogWindow.PromptCurrency(
                Strings.ClockOutDeclareTips, _tipsDeclared);
            if (parentWindow != null)
            {
                parentWindow.ShowShadingOverlay = false;
            }
            if (_tipsDeclared == null)
            {
                buttonDeclareTips.Text = Strings.ClockOutDeclareTips;
            }
            else
            {
                buttonDeclareTips.Text = Strings.ClockOutTips + _tipsDeclared.Value.ToString("C2");
            }
        }