public string GetNextCustomerOrderID()
        {
            try
            {
                ReceiptTransactionType transType = ReceiptTransactionType.OrnamentRepairReturn;
                string storeId    = LSRetailPosis.Settings.ApplicationSettings.Terminal.StoreId;
                string terminalId = LSRetailPosis.Settings.ApplicationSettings.Terminal.TerminalId;
                string staffId    = pos.OperatorId;
                string mask;

                string funcProfileId = LSRetailPosis.Settings.FunctionalityProfiles.Functions.ProfileId;
                orderNumber((int)transType, funcProfileId, out mask);
                if (string.IsNullOrEmpty(mask))
                {
                    return(string.Empty);
                }
                else
                {
                    string seedValue = GetSeedVal().ToString();
                    return(ReceiptMaskFiller.FillMask(mask, seedValue, storeId, terminalId, staffId));
                }
            }
            catch (Exception ex)
            {
                LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), ex);
                throw;
            }
        }
示例#2
0
            private NumberSequenceSeedData GetNumberSequenceDataByReceiptId(SalesTransaction salesTransaction)
            {
                ReceiptTransactionType receiptType = NumberSequenceSeedTypeHelper.GetReceiptTransactionType(salesTransaction.TransactionType, salesTransaction.NetAmountWithNoTax, salesTransaction.CustomerOrderMode);
                NumberSequenceSeedType seedType    = NumberSequenceSeedTypeHelper.GetNumberSequenceSeedType(receiptType);

                // get receipt mask from db
                string      functionalityProfileId = this.GetOrgUnit().FunctionalityProfileId;
                var         getReceiptMaskRequest  = new GetReceiptMaskDataRequest(functionalityProfileId, receiptType);
                ReceiptMask mask = this.Context.Runtime.Execute <SingleEntityDataServiceResponse <ReceiptMask> >(
                    getReceiptMaskRequest,
                    this.Context).Entity;

                // parse receipt number
                long numberSequenceId;

                // if mask is not available, try parsing it as a integer
                if (mask == null)
                {
                    if (!long.TryParse(salesTransaction.ReceiptId, out numberSequenceId))
                    {
                        string message = string.Format("Receipt mask is not available for receipt type {0} when using functionality profile {1}. Parsing receipt identifier as a number failed.", receiptType, functionalityProfileId);
                        RetailLogger.Log.CrtWorkflowParsingReceiptIdentifierFailure(receiptType.ToString(), functionalityProfileId);
                        throw new ConfigurationException(ConfigurationErrors.Microsoft_Dynamics_Commerce_Runtime_InvalidChannelConfiguration, ExceptionSeverity.Warning, message);
                    }
                }
                else
                {
                    numberSequenceId = ReceiptMaskFiller.GetNumberSequenceFromReceipt(mask.Mask, salesTransaction.ReceiptId);
                }

                // compose number sequence seed object
                return(new NumberSequenceSeedData {
                    DataType = seedType, DataValue = IncrementByOne(numberSequenceId)
                });
            }
示例#3
0
        /// <summary>
        /// Translates receipt transaction type to proper value of the SeedTypes class
        /// </summary>
        /// <param name="transType">Receipt transaction type</param>
        /// <returns>Appropriate value from SeedTypes</returns>
        static private NumberSequenceSeedType GetSeedType(ReceiptTransactionType transType)
        {
            switch (transType)
            {
            case ReceiptTransactionType.Sale:
                return(NumberSequenceSeedType.ReceiptSale);

            case ReceiptTransactionType.Return:
                return(NumberSequenceSeedType.ReceiptReturn);

            case ReceiptTransactionType.SalesOrder:
                return(NumberSequenceSeedType.ReceiptSalesOrder);

            case ReceiptTransactionType.SalesInvoice:
                return(NumberSequenceSeedType.ReceiptSalesInvoice);

            case ReceiptTransactionType.Payment:
                return(NumberSequenceSeedType.ReceiptPayment);

            case ReceiptTransactionType.CustomerSalesOrder:
                return(NumberSequenceSeedType.ReceiptCustomerSalesOrder);

            case ReceiptTransactionType.CustomerQuote:
                return(NumberSequenceSeedType.ReceiptCustomerQuote);

            default:
                return(NumberSequenceSeedType.ReceiptDefault);
            }
        }
示例#4
0
        public string GetNextReceiptId(IPosTransaction transaction)
        {
            try
            {
                RetailTransaction retailTrans = transaction as RetailTransaction;
                if ((retailTrans != null) && (retailTrans.EntryStatus == PosTransaction.TransactionStatus.Voided))
                {
                    return(string.Empty);
                }


                if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled())
                {
                    return(FiscalPrinter.FiscalPrinter.Instance.GetNextReceiptId(transaction));
                }

                ReceiptTransactionType transType = GetReceiptTransType(transaction);
                string storeId    = LSRetailPosis.Settings.ApplicationSettings.Terminal.StoreId;
                string terminalId = LSRetailPosis.Settings.ApplicationSettings.Terminal.TerminalId;
                string staffId    = transaction.OperatorId;

                // Get the template mask for this type of transaction
                string      mask;
                bool        isIndependent;
                string      funcProfileId = LSRetailPosis.Settings.FunctionalityProfiles.Functions.ProfileId;
                ReceiptData receiptData   = new ReceiptData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID, funcProfileId);
                receiptData.GetReceiptMask((int)transType, out mask, out isIndependent);

                // Get the next receipt seed (sequential numeric) value
                NumberSequenceSeedType seedType = NumberSequenceSeedType.ReceiptDefault;
                if (isIndependent)
                {
                    seedType = GetSeedType(transType);
                }
                string seedValue = GetAndIncrementTerminalSeed(seedType).ToString();

                return(ReceiptMaskFiller.FillMask(mask, seedValue, storeId, terminalId, staffId));
            }
            catch (Exception ex)
            {
                LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), ex);
                throw;
            }
        }