public OrderDetailsViewModel( CustomerOrderTransaction customerOrderTransaction, OrderDetailsSelection selectedMode) { this.SetTransaction(customerOrderTransaction); this.mode = selectedMode; DM.StoreDataManager storeDataManager = new DM.StoreDataManager( SalesOrder.InternalApplication.Settings.Database.Connection, SalesOrder.InternalApplication.Settings.Database.DataAreaID); DM.EmployeeDataManager employeeDataManager = new DM.EmployeeDataManager( SalesOrder.InternalApplication.Settings.Database.Connection, SalesOrder.InternalApplication.Settings.Database.DataAreaID); // Collection of all employees employees = new ReadOnlyCollection <DataEntity.Employee>(employeeDataManager.GetEmployees(ApplicationSettings.Terminal.StoreId)); // Set the default minimum expiration date to tomorrow (but do not overwrite the current expiration date already set on the transaction) this.MinimumOrderExpirationDate = DateTime.Today.AddDays(1); // Use the actual, recalled, expiration date if it is older. // This is needed to prevent the UI from forcing the older date to snap to the minimum. if (this.MinimumOrderExpirationDate > this.OrderExpirationDate) { this.MinimumOrderExpirationDate = this.OrderExpirationDate; } // Set the default sales person to the currently logged in operator if (string.IsNullOrWhiteSpace(this.SalesPersonId)) { this.SalesPersonId = LSRetailPosis.Settings.ApplicationSettings.Terminal.TerminalOperator.OperatorId; } }
private static bool IsSelectionAllowedOnCancelOrderMode(OrderDetailsSelection selectionMode) { switch (selectionMode) { case OrderDetailsSelection.CancelOrder: case OrderDetailsSelection.CloseOrder: case OrderDetailsSelection.None: case OrderDetailsSelection.ViewDetails: return(true); default: return(false); } }
internal static void ShowOrderDetails(ICustomerOrderTransaction transaction, OrderDetailsSelection selectionMode) { CustomerOrderTransaction cot = (CustomerOrderTransaction)transaction; using (formOrderDetails frm = new formOrderDetails(cot, selectionMode)) { POSFormsManager.ShowPOSForm(frm); DialogResult result = frm.DialogResult; // Get updated transaction since nested operations might have been run transaction = frm.Transaction; if (result == DialogResult.OK) { // Update the editing mode of the order. UpdateCustomerOrderMode(cot, selectionMode); // Refresh prices/totals SalesOrder.InternalApplication.BusinessLogic.ItemSystem.CalculatePriceTaxDiscount(transaction); // call CalcTotal to roll up misc charge taxes transaction.CalcTotals(); // Reminder prompt for Deposit Override w/ Zero deposit applied if (selectionMode == OrderDetailsSelection.PickupOrder && cot.PrepaymentAmountOverridden && cot.PrepaymentAmountApplied == decimal.Zero) { SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56139, MessageBoxButtons.OK, MessageBoxIcon.Information); //"No deposit has been applied to this pickup. To apply a deposit, use the ""Deposit override"" operation." } } else { // Set cancel on the transaction so the original is not updated transaction.OperationCancelled = true; } } }
private static void UpdateCustomerOrderMode(CustomerOrderTransaction cot, OrderDetailsSelection selectionMode) { switch (selectionMode) { case OrderDetailsSelection.CancelOrder: { cot.Mode = CustomerOrderMode.Cancel; } break; case OrderDetailsSelection.ViewDetails: { // if the order was cancelled before, we shouldn't change this mode when just viewing the order. if (cot.Mode != CustomerOrderMode.Cancel) { if (cot.OriginalOrderType == CustomerOrderType.Quote && cot.OrderType == CustomerOrderType.SalesOrder && !string.IsNullOrWhiteSpace(cot.QuotationId)) { // Change mode to 'Convert', if user is converting a Quote to a SalesOrder cot.Mode = CustomerOrderMode.Convert; } else if (cot.Mode == CustomerOrderMode.Convert) { // Change mode to 'Edit', if user converted from Quote to SalesOrder and then back to Quote. cot.Mode = CustomerOrderMode.Edit; } } } break; case OrderDetailsSelection.PickupOrder: //Pickup mode has already been handled by the ItemDetailsPage on frmOrderDetails default: break; } }
public formOrderDetails(CustomerOrderTransaction customerOrderTransaction, OrderDetailsSelection selectionMode) : this() { this.transaction = customerOrderTransaction; this.mode = selectionMode; }