internal static void SetCustomerOrderDefaults(ICustomerOrderTransaction trans) { trans.SiteId = string.Empty; trans.WarehouseId = ApplicationSettings.Terminal.InventLocationId; trans.ChannelId = ApplicationSettings.Terminal.StorePrimaryId; trans.ExpirationDate = DateTime.Now.Date.AddDays(ApplicationSettings.Terminal.ExpirationDate); trans.CalcTotals(); }
private static void CloseOrder(ICustomerOrderTransaction transaction) { CustomerOrderTransaction cot = transaction as CustomerOrderTransaction; if (cot == null) { NetTracer.Warning("CustomerOrderTransaction is null"); throw new ArgumentNullException("CustomerOrderTransaction"); } cot.EntryStatus = PosTransaction.TransactionStatus.Cancelled; }
private static void RecalculatePrices(ICustomerOrderTransaction transaction) { CustomerOrderTransaction cot = transaction as CustomerOrderTransaction; if (cot != null) { if (cot.OrderStatus == SalesStatus.Created || cot.OrderStatus == SalesStatus.Unknown) { cot.LockPrices = false; // discounts which already exist on the transaction could have been recalled from AX, // but we don't know which ones, so to avoid over-discounting, we remove all before recalculating the order cot.ClearAllDiscounts(); SalesOrder.InternalApplication.BusinessLogic.ItemSystem.CalculatePriceTaxDiscount(transaction); } else { //Operation is not allowed for the current order status. SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56246); } } }
internal static ICustomerOrderTransaction ShowOrderDetailsOptions(ICustomerOrderTransaction transaction) { using (formOrderDetailsSelection frm = new formOrderDetailsSelection()) { ICustomerOrderTransaction result = transaction; POSFormsManager.ShowPOSForm(frm); if (frm.DialogResult == DialogResult.OK) { // when in cancel mode, we only allow to enter view details, cancel or close order modes. bool allowedOnCancelMode = IsSelectionAllowedOnCancelOrderMode(frm.Selection); CustomerOrderTransaction cot = transaction as CustomerOrderTransaction; if (cot != null && cot.Mode == CustomerOrderMode.Cancel && !allowedOnCancelMode) { SalesOrder.InternalApplication.Services.Dialog.ShowMessage(4543); return(result); } switch (frm.Selection) { case OrderDetailsSelection.ViewDetails: SalesOrderActions.ShowOrderDetails(transaction, frm.Selection); break; case OrderDetailsSelection.CloseOrder: CloseOrder(transaction); break; case OrderDetailsSelection.Recalculate: RecalculatePrices(transaction); break; default: break; } } return(result); } }
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; } } }