Example #1
0
        private TenderAllowances GetAllowancesForCurrentTender(string testTender)
        {
            TenderAllowances ta = new TenderAllowances();

            foreach (DataRow row in allowances.Rows)
            {
                string tenderID = row["TENDERTYPEID"].ToString();

                if (tenderID.Equals(testTender))
                {
                    if (row["MAXCOUNTINGDIFFERENCE"] != DBNull.Value)
                    {
                        ta.MaxCountingDifference = (Convert.ToDecimal(row["MAXCOUNTINGDIFFERENCE"].ToString()));
                    }
                    else
                    {
                        ta.MaxCountingDifference = 0M;
                    }

                    if (row["MAXRECOUNT"] != DBNull.Value)
                    {
                        ta.MaxRecount = (Convert.ToInt16(row["MAXRECOUNT"].ToString()));
                    }
                    else
                    {
                        ta.MaxRecount = 0;
                    }

                    return(ta);
                }
            }

            return(ta);
        }
Example #2
0
        private bool NeedForRecount(string currentTender, decimal currentAmount, string currentTenderName, ref int counter)
        {
            //Get allowances for that Tender from In-Memory table. The values are fetched before the counting dialog is opened.
            TenderAllowances tenderAllow = GetAllowancesForCurrentTender(currentTender);
            decimal          allowance   = tenderAllow.MaxCountingDifference;
            int recountsAllowed          = tenderAllow.MaxRecount;

            //decimal expected = currentValues.ExpectedAmount;
            decimal expected = GetExpectedAmount(currentTender, currentTenderName);

            if (attemptsDone[counter] < recountsAllowed)
            {
                attemptsDone[counter]++;
                if (Math.Abs((currentAmount - expected)) > allowance)
                {
                    ResetTenderValueToZero(currentTender, currentTenderName);
                    transaction.TenderLines.Clear();
                    string msg = string.Format(LSRetailPosis.ApplicationLocalizer.Language.Translate(3494), currentTenderName,
                                               Dialog.InternalApplication.Services.Rounding.RoundAmount(expected, ApplicationSettings.Terminal.StoreId, currentTender, true));

                    using (frmMessage dialog = new frmMessage(msg, MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error))
                    {
                        LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog);
                    }

                    return(true);  //yes, recount is necessary....
                }
            }

            return(false); // no need for recount
        }