示例#1
0
        /// <summary>
        /// Copy items from one transaction, and add them as returns to another
        /// </summary>
        /// <param name="returnedItems"></param>
        /// <param name="transToReturn"></param>
        /// <param name="retailTransaction"></param>
        internal static void InsertReturnedItemsIntoTransaction(IEnumerable <int> returnedItems, RetailTransaction transToReturn, RetailTransaction retailTransaction)
        {
            SaleLineItem returnedItem;

            foreach (int lineNum in returnedItems)
            {
                returnedItem = transToReturn.GetItem(lineNum);

                // Transfer the lineId from the returned transaction to the proper property in the new transaction.
                returnedItem.ReturnLineId = returnedItem.LineId;

                // Transfer the transactionId from the returned transacton to the proper property in the new transaction.
                returnedItem.ReturnTransId    = returnedItem.Transaction.TransactionId;
                returnedItem.ReturnStoreId    = returnedItem.Transaction.StoreId;
                returnedItem.ReturnTerminalId = returnedItem.Transaction.TerminalId;

                returnedItem.Quantity           = returnedItem.ReturnQtyAllowed * -1;
                returnedItem.QuantityDiscounted = returnedItem.QuantityDiscounted * -1;

                retailTransaction.Add(returnedItem);
            }

            //Transfer the original customer information to the "actual" transaction
            //this.Application.BusinessLogic.CustomerSystem.SetCustomer(retailTransaction, transToReturn.Customer, transToReturn.Customer);
            retailTransaction.Customer.ReturnCustomer = true;

            SalesOrder.InternalApplication.Services.Tax.CalculateTax(retailTransaction);
            retailTransaction.CalcTotals();
        }
示例#2
0
        private void btnCustomerSearch_Click(object sender, EventArgs e)
        {
            CustomerSearch custSearch = new CustomerSearch();

            custSearch.OperationID    = PosisOperations.CustomerSearch;
            custSearch.POSTransaction = this.posTransaction;
            custSearch.RunOperation();

            RetailTransaction retailPosTransaction = (RetailTransaction)posTransaction;

            if (!(retailPosTransaction.Customer.IsEmptyCustomer()) &&
                retailPosTransaction.Customer.Blocked == BlockedEnum.No)
            {
                //Get the customer information
                customerID = retailPosTransaction.Customer.CustomerId;
                labelCustomerIdValue.Text   = retailPosTransaction.Customer.CustomerId;
                labelCustomerNameValue.Text = retailPosTransaction.Customer.Name;

                //The customer might have a discount so the lines need to be calculated again
                retailPosTransaction.CalcTotals();

                //Change the Amountviewer if needed
                if (retailPosTransaction.TransSalePmtDiff != balanceAmount)
                {
                    balanceAmount = retailPosTransaction.TransSalePmtDiff;
                    amtCustAmounts.SoldLocalAmount = balanceAmount;
                    amtCustAmounts.SetButtons();

                    //If an amount has already been selected and it's higher than the new balance of the transaction (with the new discount)
                    //then we need to adjust it to reflect the new balance.
                    if (this.Amount > balanceAmount)
                    {
                        this.Amount = balanceAmount;
                    }
                }

                controlIndex = 2;
                Action(string.Empty);
            }

            /*The control itself displays information about weather a customer is found
             * else
             * {
             *  frmMessage dialog = new frmMessage(1446, MessageBoxButtons.OK, MessageBoxIcon.Information);
             *  POSFormsManager.ShowPOSForm(dialog);
             * }*/
        }
示例#3
0
        public void IssueCreditMemo(ICreditMemoTenderLineItem creditMemoItem, IRetailTransaction transaction)
        {
            if (creditMemoItem == null)
            {
                throw new ArgumentNullException("creditMemoItem");
            }

            RetailTransaction retailTransaction = transaction as RetailTransaction;

            if (retailTransaction == null)
            {
                throw new ArgumentNullException("retailTransaction");
            }
            else
            {
                if (retailTransaction.SaleIsReturnSale == true && retailTransaction.AmountDue < 0)
                {
                    InputConfirmation inC = new InputConfirmation();
                    inC.PromptText = "Remarks";
                    inC.InputType  = InputType.Normal;

                    Interaction.frmInput Oinput = new Interaction.frmInput(inC);
                    Oinput.ShowDialog();
                    if (!string.IsNullOrEmpty(Oinput.InputText))
                    {
                        retailTransaction.PartnerData.Remarks = Oinput.InputText;
                    }
                    else
                    {
                        retailTransaction.PartnerData.Remarks = "";
                    }
                }
            }

            try
            {
                LogMessage("Issuing a credit memo....", LogTraceLevel.Trace, "CreditMemo.IssueCreditMemo");

                bool   retVal           = false;
                string comment          = string.Empty;
                string creditMemoNumber = string.Empty;
                string currencyCode     = ApplicationSettings.Terminal.StoreCurrency;

                try
                {
                    // Begin by checking if there is a connection to the Transaction Service
                    this.Application.TransactionServices.CheckConnection();

                    // Publish the credit memo to the Head Office through the Transaction Services...
                    this.Application.TransactionServices.IssueCreditMemo(ref retVal, ref comment, ref creditMemoNumber,
                                                                         retailTransaction.StoreId,
                                                                         retailTransaction.TerminalId,
                                                                         retailTransaction.OperatorId,
                                                                         retailTransaction.TransactionId,
                                                                         retailTransaction.ReceiptId,
                                                                         "1",
                                                                         currencyCode,
                                                                         creditMemoItem.Amount * -1,
                                                                         DateTime.Now);

                    retailTransaction.CreditMemoItem.CreditMemoNumber = creditMemoNumber;
                    retailTransaction.CreditMemoItem.Amount           = creditMemoItem.Amount * -1;
                    creditMemoItem.SerialNumber = creditMemoNumber;
                    creditMemoItem.Comment      = creditMemoNumber;
                }
                catch (LSRetailPosis.PosisException px)
                {
                    // We cannot publish the credit memo to the HO, so we need to take action...

                    retailTransaction.TenderLines.RemoveLast();
                    retailTransaction.CalcTotals();

                    retailTransaction.CreditMemoItem = (CreditMemoItem)this.Application.BusinessLogic.Utility.CreateCreditMemoItem();

                    LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), px);
                    throw;
                }
                catch (Exception x)
                {
                    // We cannot publish the credit memo to the HO, so we need to take action...

                    retailTransaction.TenderLines.RemoveLast();
                    retailTransaction.CalcTotals();
                    retailTransaction.CreditMemoItem = (CreditMemoItem)this.Application.BusinessLogic.Utility.CreateCreditMemoItem();

                    LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), x);
                    throw new LSRetailPosis.PosisException(52300, x);
                }

                if (!retVal)
                {
                    LogMessage("Error storing the credit memo centrally...",
                               LSRetailPosis.LogTraceLevel.Error,
                               "CreditMemo.IssueCreditMemo");

                    retailTransaction.TenderLines.RemoveLast();
                    retailTransaction.CalcTotals();
                    retailTransaction.CreditMemoItem = (CreditMemoItem)this.Application.BusinessLogic.Utility.CreateCreditMemoItem();

                    throw new LSRetailPosis.PosisException(52300, new Exception(comment));
                }
            }
            catch (Exception x)
            {
                // Start :  On 14/07/2014
                foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems)
                {
                    if (saleLineItem.ItemType == LSRetailPosis.Transaction.Line.SaleItem.BaseSaleItem.ItemTypes.Service)
                    {
                        updateCustomerAdvanceAdjustment(Convert.ToString(saleLineItem.PartnerData.ServiceItemCashAdjustmentTransactionID),
                                                        Convert.ToString(saleLineItem.PartnerData.ServiceItemCashAdjustmentStoreId),
                                                        Convert.ToString(saleLineItem.PartnerData.ServiceItemCashAdjustmentTerminalId), 0);
                    }
                }
                // End :  On 14/07/2014

                LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), x);
                throw;
            }
        }