示例#1
0
        /// <summary>
        /// Create pick list for the given order
        /// </summary>
        /// <param name="transaction"></param>
        internal static void TryCreatePickListForOrder(SalesStatus status, string orderId)
        {
            try
            {
                switch (status)
                {
                case SalesStatus.Created:
                case SalesStatus.Processing:
                case SalesStatus.Delivered:
                    // These statuses are allowed for Packslip creation
                    break;

                case SalesStatus.Canceled:
                case SalesStatus.Confirmed:
                case SalesStatus.Invoiced:
                case SalesStatus.Lost:
                case SalesStatus.Sent:
                case SalesStatus.Unknown:
                default:
                    // Please select an open order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56132, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Picking list creation if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    bool   retValue;
                    string comment;
                    SalesOrder.CreatePickingList(orderId, out retValue, out comment);

                    if (retValue)
                    {
                        // "The pick list was created"
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56233);
                    }
                    else
                    {
                        // "Pick list could not be created as this time."
                        ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56230, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, ex);
                throw;
            }
        }
示例#2
0
        /// <summary>
        /// Print a pack slip for the given order
        /// </summary>
        /// <param name="status"></param>
        /// <param name="orderId"></param>
        internal static void TryPrintPackSlip(SalesStatus status, string orderId)
        {
            try
            {
                //if (!selectedOrderStatus.Equals("Delivered"))
                if (status != SalesStatus.Delivered)
                {
                    // Please select an delivered order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56133, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (string.IsNullOrEmpty(orderId))
                {
                    // Please select a sales order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56116, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Packing slip printing if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    IRetailTransaction transaction;
                    bool   retValue = false;
                    string comment;

                    SalesOrder.InternalApplication.Services.SalesOrder.GetCustomerOrder(
                        ref retValue, orderId, out comment, out transaction);

                    if (retValue)
                    {
                        SalesOrder.InternalApplication.Services.Printing.PrintPackSlip(transaction);
                    }
                    else
                    {
                        // The sales order was not found in AX
                        ApplicationLog.Log("frmGetSalesOrder.btnPrintPackSlip_Click()",
                                           string.Format("{0}/n{1}", ApplicationLocalizer.Language.Translate(56124), comment),
                                           LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56124, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception x)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x);
                SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56220, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        private void GetSelectedRow()
        {
            DataRow row = gridView1.GetDataRow(gridView1.GetSelectedRows()[0]);

            this.SelectedSalesOrderId = row.Field <string>(SalesIdString);

            this.selectedOrderSalesStatus    = (SalesStatus)row[SalesStatusString];
            this.selectedOrderDocumentStatus = (SalesStatus)row[DocumentStatusString];

            // CustomerOrderType does not have default, failing if something else.
            this.SelectedOrderType = (CustomerOrderType)Enum.Parse(typeof(CustomerOrderType), row[OrderTypeString].ToString());

            this.selectedOrderPickupDeliveryMode = row.Field <string>(DeliveryModeString);
        }
        private void GetSelectedRow()
        {
            System.Data.DataRow Row = gridView1.GetDataRow(gridView1.GetSelectedRows()[0]);

            this.SelectedSalesOrderId = Row.Field <string>(SalesIdString);

            if (!Enum.TryParse <SalesStatus>(Row[StatusString].ToString(), out selectedOrderStatus))
            {
                this.selectedOrderStatus = SalesStatus.Unknown;
            }

            // CustomerOrderType does not have default, failing if something else.
            this.SelectedOrderType = (CustomerOrderType)Enum.Parse(typeof(CustomerOrderType), Row[OrderTypeString].ToString());

            this.selectedOrderPickupDeliveryMode = Row.Field <string>(DeliveryModeString);
        }
示例#5
0
        /// <summary>
        /// Gets the SalesStatus from SalesOrderStatus and DocumentStatus
        /// </summary>
        /// <param name="docStatus"></param>
        /// <param name="salesOrderStatus"></param>
        /// <returns></returns>
        internal static SalesStatus GetSalesStatus(SalesOrderStatus salesOrderStatus, DocumentStatus docStatus)
        {
            SalesStatus salesStatus = GetSalesStatus(salesOrderStatus);

            switch (salesStatus)
            {
            case SalesStatus.Unknown:
            case SalesStatus.Created:
                SalesStatus documentStatus = GetSalesStatus(docStatus);
                if (documentStatus == SalesStatus.Unknown)
                {
                    return(salesStatus);
                }

                return(documentStatus);

            default:
                return(salesStatus);
            }
        }
示例#6
0
        /// <summary>
        /// Create a pack slip for the given order
        /// </summary>
        /// <param name="status"></param>
        /// <param name="orderId"></param>
        internal static void TryCreatePackSlip(SalesStatus status, string orderId)
        {
            //to call pack Slip Method
            try
            {
                bool   retVal;
                string comment;

                switch (status)
                {
                case SalesStatus.Created:
                case SalesStatus.Processing:
                case SalesStatus.Delivered:
                    // These statuses are allowed for Packslip creation
                    break;

                case SalesStatus.Canceled:
                case SalesStatus.Confirmed:
                case SalesStatus.Invoiced:
                case SalesStatus.Lost:
                case SalesStatus.Sent:
                case SalesStatus.Unknown:
                default:
                    // Please select an open order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56132, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (string.IsNullOrEmpty(orderId))
                {
                    // Please select a sales order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56116, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Packing slip creation if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    //create Packing slip operation
                    SalesOrder.InternalApplication.Services.SalesOrder.CreatePackingSlip(out retVal, out comment, orderId);
                    if (retVal)
                    {
                        //A packing slip has been created.
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56120, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        // "Pack list could not be created as this time."
                        ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56231, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception x)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x);

                // "Error creating the packing slip."
                SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56220, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }