/// <summary>
        /// Validate Payment currency
        /// </summary>
        private void PaymentCurrency(string paymentCcy, PaymentTypes paymentType, string paymentId, string swift)
        {
            if (exportFormat == ExportFormatType.DanskeBank_CSV && PaymentTypes.VendorBankAccount == paymentType)
            {
                var countryId = string.Empty;
                if (!string.IsNullOrEmpty(swift))
                {
                    swift = Regex.Replace(swift, "[^\\w\\d]", "");
                    if (swift.Length > 6)
                    {
                        countryId = countryId == string.Empty ? swift.Substring(4, 2).ToUpper() : countryId;
                    }
                }

                if (paymentCcy != BaseDocument.CCYDKK && paymentCcy != BaseDocument.CCYEUR && (countryId == string.Empty || countryId == BaseDocument.COUNTRY_DK))
                {
                    checkErrors.Add(new CheckError(String.Format("Only currency DKK and EUR is allowed for domestic payments")));
                }
            }

            if (exportFormat == ExportFormatType.Nordea_CSV || exportFormat == ExportFormatType.BEC_CSV)
            {
                var countryId = string.Empty;
                if (paymentType == PaymentTypes.IBAN)
                {
                    if (!string.IsNullOrEmpty(paymentId))
                    {
                        paymentId = Regex.Replace(paymentId, "[^\\w\\d]", "");
                        countryId = paymentId.Length < 2 ? string.Empty : paymentId.Substring(0, 2).ToUpper();
                    }
                }

                if (!string.IsNullOrEmpty(swift))
                {
                    swift = Regex.Replace(swift, "[^\\w\\d]", "");
                    if (swift.Length > 6)
                    {
                        countryId = countryId == string.Empty ? swift.Substring(4, 2).ToUpper() : countryId;
                    }
                }

                if (paymentType == PaymentTypes.VendorBankAccount && paymentCcy != BaseDocument.CCYDKK && (countryId == string.Empty || countryId == BaseDocument.COUNTRY_DK))
                {
                    checkErrors.Add(new CheckError(String.Format("Only currency DKK is allowed for domestic payments")));
                }
            }
        }
Exemplo n.º 2
0
 public Customers(int customerID, string customerName, string customerContactName, string accountID, string active, string phone1, string phone2, string email, List <Addresses> addresses, Drivers preferedDrivers, PaymentTypes paymentType, string comments, string registrationNumber, string billingAddress)
 {
     CustomerID          = customerID;
     CustomerName        = customerName;
     CustomerContactName = customerContactName;
     AccountID           = accountID;
     Active             = active;
     Phone1             = phone1;
     Phone2             = phone2;
     Email              = email;
     Addresses          = addresses;
     PreferedDrivers    = preferedDrivers;
     PaymentType        = paymentType;
     Comments           = comments;
     RegistrationNumber = registrationNumber;
     BillingAddress     = billingAddress;
 }
Exemplo n.º 3
0
 public PaymentReceipt(decimal amount, Currencies currency,
                       PaymentTypes method, string referenceCode, DocumentRegistrationInfo invoiceInfo, string accommodationName, DateTime checkInDate,
                       DateTime checkOutDate, DateTime?deadlineDate, List <ReceiptItemInfo> receiptItems, BuyerInfo buyerDetails, string clientName = default)
 {
     Amount            = amount;
     Currency          = currency;
     Method            = method;
     ReferenceCode     = referenceCode;
     InvoiceInfo       = invoiceInfo;
     CustomerName      = clientName ?? string.Empty;
     BuyerDetails      = buyerDetails;
     AccommodationName = accommodationName;
     CheckInDate       = checkInDate;
     CheckOutDate      = checkOutDate;
     DeadlineDate      = deadlineDate;
     ReceiptItems      = receiptItems;
 }
Exemplo n.º 4
0
 public AccommodationBookingInfo(int bookingId, AccommodationBookingDetails bookingDetails, int agencyId,
                                 BookingPaymentStatuses paymentStatus, MoneyAmount totalPrice, MoneyAmount cancellationPenalty, Suppliers?supplier,
                                 BookingAgentInformation agentInformation, PaymentTypes paymentMethod, List <string> tags,
                                 bool?isDirectContract)
 {
     BookingId           = bookingId;
     BookingDetails      = bookingDetails;
     AgencyId            = agencyId;
     PaymentStatus       = paymentStatus;
     TotalPrice          = totalPrice;
     CancellationPenalty = cancellationPenalty;
     Supplier            = supplier;
     AgentInformation    = agentInformation;
     PaymentMethod       = paymentMethod;
     Tags             = tags;
     IsDirectContract = isDirectContract;
 }
Exemplo n.º 5
0
        private void rbChecked(object sender, EventArgs e)
        {
            RadioButton rb = sender as RadioButton;

            if (rb.Name == "rbCash")
            {
                pType                       = PaymentTypes.Nakit;
                label7.Visible              = true;
                label8.Visible              = true;
                txtOdenenPara.Visible       = true;
                lblRemainderOfMoney.Visible = true;
            }
            else if (rb.Name == "rbCreditCard")
            {
                pType = PaymentTypes.KrediKarti;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new instance of a payment entry with minimal values to insert
 /// </summary>
 /// <param name="date">Date</param>
 /// <param name="type">Payment type</param>
 /// <param name="company">Transaction entity</param>
 /// <param name="paidFromAccount">Source account</param>
 /// <param name="paidToAccount">Destination account</param>
 /// <param name="currency">Currency</param>
 /// <param name="amount">Amount transferred</param>
 /// <param name="partyType">Party type (customer, supplier, ...)</param>
 /// <param name="party">Party name (customer, ...)</param>
 /// <param name="referenceNo">Unique ID</param>
 public PaymentEntry(DateTime date, PaymentTypes type, string company,
                     string paidFromAccount, string paidToAccount, string currency, double amount,
                     string partyType, string party, string referenceNo)
     : this(new ERPObject(DocType.PaymentEntry))
 {
     PaymentType = type;
     SetDate(date);
     Company         = company;
     AccountPaidFrom = paidFromAccount;
     AccountPaidTo   = paidToAccount;
     data.paid_from_account_currency = currency;
     data.paid_to_account_currency   = currency;
     PaidAmount     = amount;
     ReceivedAmount = amount;
     PartyType      = partyType;
     Party          = party;
     ReferenceNo    = referenceNo;
 }
Exemplo n.º 7
0
    public List <PaymentTypes> getPaymentTypesList()
    {
        #region DB functions
        string query = "select * from PaymentTypes order by PaymentType ";

        List <PaymentTypes> list = new List <PaymentTypes>();
        DbService           db   = new DbService();
        DataSet             ds   = db.GetDataSetByQuery(query);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            PaymentTypes tmp = new PaymentTypes((int)dr["PaymentTypeID"], dr["PaymentType"].ToString());
            list.Add(tmp);
        }
        #endregion

        return(list);
    }
Exemplo n.º 8
0
 internal BusinessEventViewModel(BusinessTypes businessType, double value, string currency, string itemName, int transactionCount,
                                 string cartName, string extraDetails, PaymentTypes paymentType, bool specialEvent, string specialEventName, double amount, bool virtualCurrency)
 {
     BusinessType     = businessType;
     Value            = value;
     Currency         = currency;
     ItemName         = itemName;
     TransactionCount = transactionCount;
     CartName         = cartName;
     ExtraDetails     = extraDetails;
     PaymentType      = paymentType;
     SpecialEvent     = specialEvent;
     SpecialEventName = specialEventName;
     Amount           = amount;
     VirtualCurrency  = virtualCurrency;
     DeviceInfo.WriteBaseEventDataViewModel(this.GetType().Name, this);
     Broker.BusinessEventCreated(this);
 }
Exemplo n.º 9
0
        public override bool Equals(object obj)
        {
            if (!(obj is Beneficiary))
            {
                return(false);
            }

            var beneficiary = obj as Beneficiary;

            return(Id == beneficiary.Id &&
                   BankAccountHolderName == beneficiary.BankAccountHolderName &&
                   Name == beneficiary.Name &&
                   Email == beneficiary.Email &&
                   PaymentTypes.SequenceEqual(beneficiary.PaymentTypes) &&
                   BeneficiaryAddress.SequenceEqual(beneficiary.BeneficiaryAddress) &&
                   BeneficiaryCountry == beneficiary.BeneficiaryCountry &&
                   BeneficiaryEntityType == beneficiary.BeneficiaryEntityType &&
                   BeneficiaryCompanyName == beneficiary.BeneficiaryCompanyName &&
                   BeneficiaryFirstName == beneficiary.BeneficiaryFirstName &&
                   BeneficiaryLastName == beneficiary.BeneficiaryLastName &&
                   BeneficiaryCity == beneficiary.BeneficiaryCity &&
                   BeneficiaryPostcode == beneficiary.BeneficiaryPostcode &&
                   BeneficiaryStateOrProvince == beneficiary.BeneficiaryStateOrProvince &&
                   BeneficiaryDateOfBirth == beneficiary.BeneficiaryDateOfBirth &&
                   BeneficiaryIdentificationType == beneficiary.BeneficiaryIdentificationType &&
                   BeneficiaryIdentificationValue == beneficiary.BeneficiaryIdentificationValue &&
                   BankCountry == beneficiary.BankCountry &&
                   BankName == beneficiary.BankName &&
                   BankAccountType == beneficiary.BankAccountType &&
                   Currency == beneficiary.Currency &&
                   AccountNumber == beneficiary.AccountNumber &&
                   RoutingCodeType1 == beneficiary.RoutingCodeType1 &&
                   RoutingCodeValue1 == beneficiary.RoutingCodeValue1 &&
                   RoutingCodeType2 == beneficiary.RoutingCodeType2 &&
                   RoutingCodeValue2 == beneficiary.RoutingCodeValue2 &&
                   BicSwift == beneficiary.BicSwift &&
                   Iban == beneficiary.Iban &&
                   DefaultBeneficiary == beneficiary.DefaultBeneficiary &&
                   CreatorContactId == beneficiary.CreatorContactId &&
                   BankAddress.SequenceEqual(beneficiary.BankAddress) &&
                   CreatedAt == beneficiary.CreatedAt &&
                   UpdatedAt == beneficiary.UpdatedAt &&
                   BeneficiaryExternalReference == beneficiary.BeneficiaryExternalReference);
        }
Exemplo n.º 10
0
        private DialogResult ShowPayment()
        {
            DialogResult paymentResult = DialogResult.Cancel;

            if (Convert.ToDecimal(lblBalance.Text) > 0)
            {
                PaymentsWnd payment = new PaymentsWnd();
                Data.SalesTransactionDetails clsSalesTransactionDetails = new Data.SalesTransactionDetails();
                clsSalesTransactionDetails.SubTotal = mclsCustomerDetails.Credit;

                payment.SalesTransactionDetails = clsSalesTransactionDetails;
                //payment.TransactionNo = string.Empty; //will get from the transction nos.
                payment.CustomerDetails = mclsCustomerDetails;
                //payment.Discount = Convert.ToDecimal(0);
                //payment.SubTotal = mclsCustomerDetails.Credit;
                payment.IsRefund = false;

                payment.ShowDialog(this);

                paymentResult = payment.Result;

                mdecAmountPaid        = payment.AmountPaid;
                mdecCashPayment       = payment.CashPayment;
                mdecChequePayment     = payment.ChequePayment;
                mdecCreditCardPayment = payment.CreditCardPayment;
                mdecDebitPayment      = payment.DebitPayment;
                mdecBalanceAmount     = payment.BalanceAmount;
                mdecChangeAmount      = payment.ChangeAmount;
                PaymentTypes mPaymentType = payment.PaymentType;
                marrCashPaymentDetails       = payment.CashPaymentDetails;
                marrChequePaymentDetails     = payment.ChequePaymentDetails;
                marrCreditCardPaymentDetails = payment.CreditCardPaymentDetails;
                marrDebitPaymentDetails      = payment.DebitPaymentDetails;
                payment.Close();
                payment.Dispose();

                if (paymentResult == DialogResult.OK)
                {
                    SavePayments(mdecAmountPaid, mdecCashPayment, mdecChequePayment, mdecCreditCardPayment, mdecDebitPayment,
                                 marrCashPaymentDetails, marrChequePaymentDetails, marrCreditCardPaymentDetails, marrDebitPaymentDetails);
                }
            }
            return(paymentResult);
        }
        public ActionResult AddUpdatePaymentType(PaymentTypes PT)
        {
            if (PT.pk_PaymentTypeId == 0)
            {
                //PT.pk_PaymentTypeId = DateTime.Now.Year + DateTime.Now.Millisecond;
                _db.PaymentTypes.Add(PT);
                _db.SaveChanges();
            }
            else
            {
                var paymentTypeInDB = _db.PaymentTypes.FirstOrDefault(a => a.pk_PaymentTypeId == PT.pk_PaymentTypeId);
                paymentTypeInDB.PaymentType = PT.PaymentType;
                _db.SaveChanges();
            }

            Session.Remove("PAYMENTTYPES"); //Remove so that List call will get them all again.

            return(RedirectToAction("PaymentTypeList"));
        }
Exemplo n.º 12
0
        public ActionResult Pay(PaymentTypes paymentType)
        {
            var userId = CurrentUser.Id;

            if (userId == Guid.Empty)
            {
                userId = GetUserId();
            }

            var order = _ordersService.GetOrderByUserId(userId);

            var orderPay = new OrderPayment()
            {
                Id     = order.Id,
                UserId = order.UserId,
                Cost   = order.Cost
            };

            return(_paymentStrategy.GetPaymentStrategy(paymentType, orderPay));
        }
Exemplo n.º 13
0
        private async Task <Payment> SaveAsync(Yandex.Checkout.V3.Payment payment, User user, Currency currency,
                                               PaymentTypes type)
        {
            var dbPayment = new Payment
            {
                Key          = payment.Id,
                Value        = payment.Amount.Value,
                Status       = payment.Status,
                UserId       = user.Id,
                CurrencyId   = currency.Id,
                Type         = type,
                ProviderType = PaymentProviderTypes.Kassa
            };

            await _db.Payments.AddAsync(dbPayment);

            await _db.SaveChangesAsync();

            return(dbPayment);
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Post([FromBody] PaymentTypes paymentType)
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"INSERT INTO PaymentType (Name, Active)
                                        OUTPUT INSERTED.Id
                                        VALUES (@Name, @Active)";
                    cmd.Parameters.Add(new SqlParameter("@Name", paymentType.Name));
                    cmd.Parameters.Add(new SqlParameter("@Active", paymentType.Active));



                    int newId = (int)cmd.ExecuteScalar();
                    paymentType.Id = newId;
                    return(CreatedAtRoute("GetPaymentTypes", new { id = newId }, paymentType));
                }
            }
        }
Exemplo n.º 15
0
        public static double CreditOverflow(PaymentTypes pmnttype)
        {
            switch (pmnttype)
            {
            case PaymentTypes.PayInAdvance:
                return(0);

                break;

            case PaymentTypes.Terms:
                return(0);

                break;

            default:
                return(0);

                break;
                return(0);
            }
        }
Exemplo n.º 16
0
        public string GenerateString(long CustomerNumber, PaymentTypes PaymentType, double toCollect, double Amount, bool visual)
        {
            if (visual)
            {
                // TODO :: Rewrite this routine to implement proper alignment of text
                // i hate this padding shit... feels so much like a temporary thing
                string cusnum    = "  " + CustomerNumber.ToString();
                string paytype   = MyConstants.OutputCodeForPaymentType(PaymentType);
                string tocollect = String.Format("${0}", toCollect);
                string amount    = String.Format("${0}", Amount);
                cusnum    = cusnum.PadRight(20);
                paytype   = paytype.PadRight(20);
                tocollect = tocollect.PadLeft(4);
                amount    = amount.PadLeft(20);

                return(String.Format("{0} {1} {2} {3}", cusnum, paytype, tocollect, amount));
            }
            else
            {
                return(String.Format("{0}\t{1}\t${2}\t${3}\t${4}\r\n", CustomerNumber, MyConstants.OutputCodeForPaymentType(PaymentType), toCollect, Amount, ClusterFees));
            }
        }
Exemplo n.º 17
0
        private PaymentEntry getPaymentFromForm(PaymentEntry original)
        {
            PaymentTypes type = PaymentTypes.Receive;

            switch (cmbPaymentType.SelectedItem.ToString())
            {
            case "Receive": type = PaymentTypes.Receive; break;

            case "Pay": type = PaymentTypes.Pay; break;

            default: type = PaymentTypes.InternalTransfer; break;
            }
            string paidFrom  = cmbPaymentFromAccount.SelectedItem.ToString();
            string paidTo    = cmbPaymentToAccount.SelectedItem.ToString();
            string partyType = cmbPaymentPartyType.SelectedItem.ToString();
            string party     = cmbPaymentCustomer.SelectedItem.ToString();

            if (original == null)
            {
                original = new PaymentEntry(datePaymentDate.Value,
                                            type, "OmniPro", paidFrom, paidTo, "CHF",
                                            Convert.ToDouble(numPaymentAmount.Value),
                                            "Customer", party, txtPaymentReference.Text);
            }
            else
            {
                original.PostingDate     = datePaymentDate.Value;
                original.ReferenceDate   = datePaymentDate.Value;
                original.PaymentType     = type;
                original.AccountPaidFrom = paidFrom;
                original.AccountPaidTo   = paidTo;
                original.PaidAmount      = Convert.ToDouble(numPaymentAmount.Value);
                original.ReceivedAmount  = Convert.ToDouble(numPaymentAmount.Value);
                original.Party           = party;
                original.ReferenceNo     = txtPaymentReference.Text;
                original.DocStatus       = Functions.DocStatusFromString(cmbPaymentEntryStatus.SelectedItem.ToString());
            }
            return(original);
        }
Exemplo n.º 18
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] PaymentTypes paymentType)
        {
            try
            {
                using (SqlConnection conn = Connection)
                {
                    conn.Open();
                    using (SqlCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = @"UPDATE PaymentType
                                            SET Name = @Name,
                                                Active = @Active
                                                
                                            WHERE Id = @id";
                        cmd.Parameters.Add(new SqlParameter("@Name", paymentType.Name));
                        cmd.Parameters.Add(new SqlParameter("@Active", paymentType.Active));
                        cmd.Parameters.Add(new SqlParameter("@id", id));

                        int rowsAffected = cmd.ExecuteNonQuery();
                        if (rowsAffected > 0)
                        {
                            return(new StatusCodeResult(StatusCodes.Status204NoContent));
                        }
                        throw new Exception("No rows affected");
                    }
                }
            }
            catch (Exception)
            {
                if (!PaymentTypesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Get PaymentType
        /// </summary>
        public PaymentTypes Get(Objects.Store store)
        {
            store.Id = store.Id ?? Properties.Settings.Default.StoreId;
            PaymentTypes paymentTypes = new PaymentTypes();

            try
            {
                Database.Connection.Open();

                string Query = "SELECT * FROM PaymentTypes WHERE StoreId=@StoreId";

                MySqlCommand Command = new MySqlCommand(Query, Database.Connection);

                Command.Parameters.AddWithValue("StoreId", store.Id);
                MySqlDataReader DataReader = Command.ExecuteReader();

                //Read Data
                while (DataReader.Read())
                {
                    paymentTypes.Cash        = Func.ToBoolean(DataReader["Cash"].ToString());
                    paymentTypes.CreditCard  = Func.ToBoolean(DataReader["CreditCard"].ToString());
                    paymentTypes.StoreCredit = Func.ToBoolean(DataReader["StoreCredit"].ToString());
                }


                Database.Connection.Close();
            }
            catch (MySqlException e)
            {
                Logger.QueryError(e, "PaymentType", "Get");
            }
            if (Database.Connection.State == ConnectionState.Open)
            {
                Database.Connection.Close();
            }

            return(paymentTypes);
        }
Exemplo n.º 20
0
        public Order CreateOrderFromBasket(ShoppingBasket basket, string userId, ShippingTypes shipping, PaymentTypes payment)
        {
            Order order = new()
            {
                Date         = DateTime.Now,
                UserID       = userId,
                PaymentType  = payment,
                ShippingType = shipping,
                IsProcessed  = false
            };

            foreach (var item in basket.Items)
            {
                OrderItem oi = new()
                {
                    ProductId = item.ProductId,
                    Price     = item.Price,
                    Quantity  = item.Quantity
                };
                order.OrderItems.Add(oi);
            }
            return(order);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Validate PaymentType
        /// </summary>
        private void ISOPaymentType(string paymentCcy, string companyIBAN, PaymentTypes paymentType, string creditorCountryId)
        {
            companyIBAN       = companyIBAN ?? string.Empty;
            companyCountryId  = companyCountryId ?? string.Empty;
            creditorCountryId = creditorCountryId ?? string.Empty;

            isoPaymentType = BankSpecificSettings.ISOPaymentType(paymentCcy, companyIBAN, creditorIBAN, creditorSWIFT, creditorCountryId, companyCountryId);

            if (credPaymFormat._ExportFormat == (byte)ExportFormatType.ISO20022_DK && (CompanyBankEnum == CompanyBankENUM.DanskeBank || CompanyBankEnum == CompanyBankENUM.Nordea_DK || CompanyBankEnum == CompanyBankENUM.Nordea_NO))
            {
                if (paymentType != PaymentTypes.IBAN && isoPaymentType == ISO20022PaymentTypes.DOMESTIC && paymentCcy == BaseDocument.CCYEUR)
                {
                    checkErrors.Add(new CheckError(String.Format("It's required to use IBAN as creditor account for Domestic EUR payments.")));
                }

                //Nordea
                if ((CompanyBankEnum == CompanyBankENUM.Nordea_DK || CompanyBankEnum == CompanyBankENUM.Nordea_NO) && (paymentType != PaymentTypes.IBAN && isoPaymentType == ISO20022PaymentTypes.SEPA))
                {
                    checkErrors.Add(new CheckError(String.Format("It's required to use IBAN as creditor account for SEPA payments.")));
                }
            }
            else if (credPaymFormat._ExportFormat == (byte)ExportFormatType.ISO20022_DK)
            {
                if (paymentType == PaymentTypes.IBAN && isoPaymentType == ISO20022PaymentTypes.DOMESTIC) //Not sure which banks has this requirement.
                {
                    checkErrors.Add(new CheckError(String.Format("It's not allowed to use IBAN as creditor account for domestic payments.")));
                }
            }

            if (credPaymFormat._ExportFormat == (byte)ExportFormatType.ISO20022_LT && bankSpecificSettings.CompanyBankEnum == CompanyBankENUM.Standard)
            {
                if (isoPaymentType != ISO20022PaymentTypes.SEPA)
                {
                    checkErrors.Add(new CheckError(String.Format("Only SEPA payments are allowed")));
                }
            }
        }
        /// <summary>
        /// Asynchronous processing of the login button click.
        /// </summary>
        async void LoginButton_TouchUpInsideAsync()
        {
            try
            {
                // Clear the last displayed status.
                StatusLabel.Text = "";

                // The facade calls Concur API to login using the ClientID, LoginID, and Password entered by the user in the UI.
                await ClientLibraryFacade.LoginAsync(
                    LoginIdTextField.Text,
                    PasswordTextField.Text,
                    ClientIdTextField.Text);

                // The facade calls Concur API to get the configuration this user should use when creating expense reports.
                // Then get the list of allowed Payment Types and allowed Expense Types for this user for creating expense reports.
                var groupConfig = await ClientLibraryFacade.GetGroupConfigurationAsync();

                PaymentTypes = groupConfig.PaymentTypes;
                ExpenseTypes = groupConfig.Policies.First(p => p.IsDefault.Value == true).ExpenseTypes;

                // Display the Payment Types and the Expense Types
                (ExpenseTypePicker.Model as MyPickerModel).MyItems = ExpenseTypes.Select(t => t.Name).ToList();
                (PaymentTypePicker.Model as MyPickerModel).MyItems = PaymentTypes.Select(t => t.Name).ToList();

                // Refresh controls used for displaying and selecting Payment Type and Expense Type.
                ExpenseTypePicker.ReloadAllComponents();
                PaymentTypePicker.ReloadAllComponents();
                SetButtonTitleAsPickerSelection(ExpenseTypeExpandButton, ExpenseTypePicker);
                SetButtonTitleAsPickerSelection(PaymentTypeExpandButton, PaymentTypePicker);

                CreateReportButton.Enabled = true;
            }
            catch (Exception e)
            {
                DisplayException(e);
            }
        }
Exemplo n.º 23
0
        private IEnumerable <CommandButtonViewModel <PaymentType> > CreatePaymentButtons(ForeignCurrency foreignCurrency)
        {
            var result = new List <CommandButtonViewModel <PaymentType> >();

            if (_settleCommand != null)
            {
                result.Add(new CommandButtonViewModel <PaymentType>
                {
                    Caption = Resources.Settle,
                    Command = _settleCommand,
                });
            }

            var pts = foreignCurrency == null?PaymentTypes.Where(x => x.Account == null || x.Account.ForeignCurrencyId == 0) : PaymentTypes.Where(x => x.Account != null && x.Account.ForeignCurrencyId == foreignCurrency.Id);

            result.AddRange(pts
                            .OrderBy(x => x.Order)
                            .Select(x => new CommandButtonViewModel <PaymentType>
            {
                Caption   = x.Name.Replace(" ", "\r"),
                Command   = _makePaymentCommand,
                Color     = x.ButtonColor,
                Parameter = x
            }));

            if (_closeCommand != null)
            {
                result.Add(new CommandButtonViewModel <PaymentType>
                {
                    Caption = Resources.Close,
                    Command = _closeCommand,
                    Color   = "Red"
                });
            }
            return(result);
        }
Exemplo n.º 24
0
        public async Task <IActionResult> Get()
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"SELECT p.Id, p.Name, p.Active
                        FROM PaymentType p";

                    SqlDataReader       reader       = cmd.ExecuteReader();
                    List <PaymentTypes> paymentTypes = new List <PaymentTypes>();



                    while (reader.Read())
                    {
                        PaymentTypes paymentType = new PaymentTypes
                        {
                            Id     = reader.GetInt32(reader.GetOrdinal("Id")),
                            Name   = reader.GetString(reader.GetOrdinal("Name")),
                            Active = reader.GetBoolean(reader.GetOrdinal("Active")),
                        };
                        if (paymentType.Active == true)
                        {
                            paymentTypes.Add(paymentType);
                        }
                    }


                    reader.Close();

                    return(Ok(paymentTypes));
                }
            }
        }
Exemplo n.º 25
0
		private void ShowDebitPaymentWindow()
		{
			if (mboIsDebitAllowed)
			{
				DebitPaymentWnd debit = new DebitPaymentWnd();
				debit.SalesTransactionDetails = mclsSalesTransactionDetails;
                debit.CustomerDetails = mclsCustomerDetails;
				debit.AllowedDebit = mdecAllowedDebit;
				debit.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
                debit.IsRefund = mboIsRefund;

				debit.ShowDialog(this);
				DialogResult result = debit.Result;
				Data.DebitPaymentDetails debitDetails = debit.Details;
				debit.Close();
				debit.Dispose();

				if (result == DialogResult.OK)
				{
					lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + debitDetails.Amount).ToString("#,##0.#0");
					marrDebitPaymentDetails.Add(debitDetails);
					ComputePayments();
					lblDebit.Tag = Convert.ToDecimal(Convert.ToDecimal(lblDebit.Tag) + debitDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

					if (mPaymentType == PaymentTypes.NotYetAssigned)
						mPaymentType = PaymentTypes.Debit;
					else
						mPaymentType = PaymentTypes.Combination;
				}
				
			}
		}
Exemplo n.º 26
0
		private void ShowCreditPaymentWindow()
		{
			if (mboIsCreditAllowed)
			{
				CreditPaymentWnd credit = new CreditPaymentWnd();
                credit.TerminalDetails = mclsTerminalDetails;
				credit.SalesTransactionDetails = mclsSalesTransactionDetails;
                credit.CustomerDetails = mclsCustomerDetails;
                credit.AllowedCredit = mdecAllowedCredit;

                decimal decBalance = Convert.ToDecimal(lblBalance.Text);
                decimal decAdditionalCreditCharge = 0;
                if (mclsCustomerDetails.CreditDetails.CreditType == CreditType.Group && mclsTerminalDetails.GroupChargeType.ChargeTypeID != 0)
                {
                    if (mclsTerminalDetails.GroupChargeType.InPercent)
                        decAdditionalCreditCharge = decBalance * (mclsTerminalDetails.GroupChargeType.ChargeAmount / 100);
                    else
                        decAdditionalCreditCharge = decBalance + mclsTerminalDetails.GroupChargeType.ChargeAmount;

                    if ((decBalance + decAdditionalCreditCharge) > mdecAllowedCredit)
                    {
                        if (mclsTerminalDetails.GroupChargeType.InPercent)
                            decAdditionalCreditCharge = mdecAllowedCredit * (mclsTerminalDetails.GroupChargeType.ChargeAmount / 100);
                        else
                            decAdditionalCreditCharge = mdecAllowedCredit + mclsTerminalDetails.GroupChargeType.ChargeAmount;
                    }
                }
                else if (mclsCustomerDetails.CreditDetails.CreditType == CreditType.Individual && mclsTerminalDetails.PersonalChargeType.ChargeTypeID != 0)
                {
                    if (mclsTerminalDetails.PersonalChargeType.InPercent)
                        decAdditionalCreditCharge = decBalance * (mclsTerminalDetails.PersonalChargeType.ChargeAmount / 100);
                    else
                        decAdditionalCreditCharge = decBalance + mclsTerminalDetails.PersonalChargeType.ChargeAmount;

                    if ((decBalance + decAdditionalCreditCharge) > mdecAllowedCredit)
                    {
                        if (mclsTerminalDetails.PersonalChargeType.InPercent)
                            decAdditionalCreditCharge = mdecAllowedCredit * (mclsTerminalDetails.PersonalChargeType.ChargeAmount / 100);
                        else
                            decAdditionalCreditCharge = mdecAllowedCredit + mclsTerminalDetails.PersonalChargeType.ChargeAmount;
                    }
                }

                credit.BalanceAmount = decBalance + Convert.ToDecimal(decAdditionalCreditCharge.ToString("#,##0.#0"));
                credit.IsRefund = mboIsRefund;
				credit.ShowDialog(this);
				DialogResult result = credit.Result;
				Data.CreditPaymentDetails creditDetails = credit.Details;
				credit.Close();
				credit.Dispose();

				if (result == DialogResult.OK)
				{
                    if (mclsCustomerDetails.CreditDetails.CreditType == CreditType.Group && mclsTerminalDetails.GroupChargeType.ChargeTypeID != 0)
                    {
                        // update transaction with additional charge
                        if (mclsTerminalDetails.GroupChargeType.InPercent)
                            decAdditionalCreditCharge = creditDetails.Amount * (mclsTerminalDetails.GroupChargeType.ChargeAmount / 100);
                        else
                            decAdditionalCreditCharge = creditDetails.Amount + mclsTerminalDetails.GroupChargeType.ChargeAmount;

                        lblCharge.Text = Convert.ToDecimal(Convert.ToDecimal(lblCharge.Text) + decAdditionalCreditCharge).ToString("#,##0.#0");
                        mclsSalesTransactionDetails.CreditChargeAmount = decAdditionalCreditCharge;
                        
                        //Aug 30, 2014 delete need to move this from here to mainwnd
                        Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions();
                        clsSalesTransactions.UpdateCreditChargeAmount(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.CreditChargeAmount);
                        clsSalesTransactions.CommitAndDispose();
                    }

                    mdecAllowedCredit -= creditDetails.Amount;
					lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + creditDetails.Amount).ToString("#,##0.#0");
					marrCreditPaymentDetails.Add(creditDetails);

                    // Add 
					ComputePayments();
					lblCredit.Tag = Convert.ToDecimal(Convert.ToDecimal(lblCredit.Tag) + creditDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

					if (mPaymentType == PaymentTypes.NotYetAssigned)
						mPaymentType = PaymentTypes.Credit;
					else
						mPaymentType = PaymentTypes.Combination;
				}
			}
		}
Exemplo n.º 27
0
		private void ShowCreditCardPaymentWindow()
		{
            CreditCardPaymentWnd clsCreditCardPaymentWnd = new CreditCardPaymentWnd();
            clsCreditCardPaymentWnd.TerminalDetails = mclsTerminalDetails;
            clsCreditCardPaymentWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
            clsCreditCardPaymentWnd.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
            clsCreditCardPaymentWnd.ShowDialog(this);
            DialogResult result = clsCreditCardPaymentWnd.Result;
            Data.CreditCardPaymentDetails creditcardDetails = clsCreditCardPaymentWnd.Details;
            clsCreditCardPaymentWnd.Close();
            clsCreditCardPaymentWnd.Dispose();

			if (result == DialogResult.OK)
			{
				lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + creditcardDetails.Amount).ToString("#,##0.#0");
				marrCreditCardPaymentDetails.Add(creditcardDetails);
				ComputePayments();
				lblCreditCard.Tag = Convert.ToDecimal(Convert.ToDecimal(lblCreditCard.Tag) + creditcardDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

				if (mPaymentType == PaymentTypes.NotYetAssigned)
					mPaymentType = PaymentTypes.CreditCard;
				else
					mPaymentType = PaymentTypes.Combination;

			}
			
		}
Exemplo n.º 28
0
 public PaymentMethod GetPaymentMethod(BTCPayNetwork network, PaymentTypes paymentType, BTCPayNetworkProvider networkProvider)
 {
     return(GetPaymentMethod(new PaymentMethodId(network.CryptoCode, paymentType), networkProvider));
 }
Exemplo n.º 29
0
        public bool TryFormOrderIPN(PaymentTypes paymentType, string transactionID, Guid orderID, decimal payment_gross,
            DateTime payment_date, string specialNotes)
        {
            using (var db = new ShopDataContext())
            {
                if (db.Orders.Any(o => o.TransactionID == transactionID))
                    return true;

                var order = db.Orders.FirstOrDefault(o => o.OrderID == orderID && !o.IsPaid);

                if (order == null)
                    return false;

                var totalSum = order.OrdersRefProducts.Sum(r => (r.Product.Price + r.Product.Tax + r.Product.Shipping) * r.Count);
                if (totalSum != payment_gross)
                    return false;

                order.IsActive = false;
                order.IsPaid = true;
                order.PaymentTypeID = (int)paymentType;
                order.OrderStatusID = (int)BL.OrderStatus.Paid;
                order.TotalSum = Convert.ToDecimal(order.OrdersRefProducts.Sum(r => r.Product.Price * r.Count));
                order.CreateDate = payment_date;
                order.TransactionID = transactionID;
                order.DeliveryDate = DateTime.Now.AddHours(double.Parse(ConfigurationManager.AppSettings["DeliveryTime"]));
                order.DeliveryTypeID = (int)DeliveryTypes.NotDelivered;
                order.SpecialNote = specialNotes;
                db.SubmitChanges();
                BL.Modules.Mail.Mail.OrderAccepted(order.User);
            }
            return true;
        }
Exemplo n.º 30
0
        /// <summary>Call PROBA Business event</summary>

        public static void BusinessEvent(BusinessTypes businessType, double value = 0.0, string currency = "IRR", string itemName                  = "Item", int transactionCount = 1,
                                         string cartName         = "Main Cart", string extraDetails = "No Extra Details", PaymentTypes paymentType = PaymentTypes.Unkown, bool specialEvent = false,
                                         string specialEventName = "", double amount                = 0.0, bool virtualCurrency = false)
        {
            _ = new BusinessEventViewModel(businessType, value, currency, itemName, transactionCount, cartName, extraDetails,
                                           paymentType, specialEvent, specialEventName, amount, virtualCurrency);
        }
Exemplo n.º 31
0
        public void Refund(TransactionStatus RefundTransactionStatus, Int64 TransactionID, string ORNo, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, decimal AmountPaid, decimal CashPayment, decimal ChequePayment, decimal CreditCardPayment, decimal CreditPayment, decimal DebitPayment, decimal RewardPointsPayment, decimal RewardConvertedPayment, decimal BalanceAmount, decimal ChangeAmount, PaymentTypes PaymentType, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, Int64 CashierID, string CashierName)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL = "UPDATE tblTransactions SET " +
                                "ORNo	            =	@ORNo, " +
								"TransactionStatus	=	@TransactionStatus, " +
                                "ItemSold		    =	@ItemSold, " +
                                "QuantitySold	    =	@QuantitySold, " +
                                "GrossSales		    =	@GrossSales, " +
                                "SubTotal			=	@SubTotal, " +
                                "NetSales			=	@NetSales, " +
								"ItemsDiscount		=	@ItemsDiscount, " +
                                "SNRItemsDiscount	=	@SNRItemsDiscount, " +
                                "PWDItemsDiscount	=	@PWDItemsDiscount, " +
                                "OtherItemsDiscount	=	@OtherItemsDiscount, " +
								"Discount			=	@Discount, " +
                                "SNRDiscount		=	@SNRDiscount, " +
                                "PWDDiscount		=	@PWDDiscount, " +
                                "OtherDiscount		=	@OtherDiscount, " +
								"TransDiscount		=	@TransDiscount, " +
								"TransDiscountType	=	@TransDiscType, " +
								"VAT				=	@VAT, " +
								"VATableAmount		=	@VATableAmount, " +
                                "ZeroRatedSales     =   @ZeroRatedSales, " +
                                "NonVATableAmount   =	@NonVATableAmount, " +
                                "VATExempt  		=	@VATExempt, " +
								"EVAT				=	@EVAT, " +
								"EVATableAmount		=	@EVATableAmount, " +
                                "NonEVATableAmount	=	@NonEVATableAmount, " +
								"LocalTax			=	@LocalTax, " +
								"AmountPaid			=	@AmountPaid, " +
								"CashPayment		=	@CashPayment, " +
								"ChequePayment		=	@ChequePayment, " +
								"CreditCardPayment	=	@CreditCardPayment, " +
								"CreditPayment		=	@CreditPayment, " +
								"DebitPayment		=	@DebitPayment, " +
								"RewardPointsPayment		=	@RewardPointsPayment, " +
								"RewardConvertedPayment		=	@RewardConvertedPayment, " +
								"BalanceAmount		=	@BalanceAmount, " +
								"ChangeAmount		=	@ChangeAmount, " +
								"DateClosed			=	NOW(), " +
								"PaymentType		=	@PaymentType, " +
								"DiscountCode		=	@DiscCode,  " +
								"DiscountRemarks	=	@DiscRemarks, " +
								"Charge				=	@Charge, " +
								"ChargeAmount		=	@ChargeAmount, " +
								"ChargeCode			=	@ChargeCode, " +
								"ChargeRemarks		=	@ChargeRemarks, " +
								"CashierID			=	@CashierID, " +
								"CashierName		=	@CashierName, " +
                                "LastModified		=	NOW() " +
							"WHERE TransactionID	=	@TransactionID;";

                cmd.Parameters.AddWithValue("ORNo", ORNo);
                cmd.Parameters.AddWithValue("TransactionStatus", RefundTransactionStatus.ToString("d"));
                cmd.Parameters.AddWithValue("ItemSold", ItemSold);
                cmd.Parameters.AddWithValue("QuantitySold", QuantitySold);
                cmd.Parameters.AddWithValue("GrossSales", GrossSales);
                cmd.Parameters.AddWithValue("SubTotal", SubTotal);
                cmd.Parameters.AddWithValue("NetSales", NetSales);
                cmd.Parameters.AddWithValue("ItemsDiscount", ItemsDiscount);
                cmd.Parameters.AddWithValue("SNRItemsDiscount", SNRItemsDiscount);
                cmd.Parameters.AddWithValue("PWDItemsDiscount", PWDItemsDiscount);
                cmd.Parameters.AddWithValue("OtherItemsDiscount", OtherItemsDiscount);
                cmd.Parameters.AddWithValue("Discount", Discount);
                cmd.Parameters.AddWithValue("SNRDiscount", SNRDiscount);
                cmd.Parameters.AddWithValue("PWDDiscount", PWDDiscount);
                cmd.Parameters.AddWithValue("OtherDiscount", OtherDiscount);
                cmd.Parameters.AddWithValue("TransDiscount", TransDiscount);
                cmd.Parameters.AddWithValue("TransDiscType", TransDiscountType.ToString("d"));
                cmd.Parameters.AddWithValue("VAT", VAT);
                cmd.Parameters.AddWithValue("VATableAmount", VATableAmount);
                cmd.Parameters.AddWithValue("ZeroRatedSales", ZeroRatedSales);
                cmd.Parameters.AddWithValue("NonVATableAmount", NonVATableAmount);
                cmd.Parameters.AddWithValue("VATExempt", VATExempt);
                cmd.Parameters.AddWithValue("EVAT", EVAT);
                cmd.Parameters.AddWithValue("EVATableAmount", EVATableAmount);
                cmd.Parameters.AddWithValue("NonEVATableAmount", NonEVATableAmount);
                cmd.Parameters.AddWithValue("LocalTax", LocalTax);
                cmd.Parameters.AddWithValue("AmountPaid", AmountPaid);
                cmd.Parameters.AddWithValue("CashPayment", CashPayment);
                cmd.Parameters.AddWithValue("ChequePayment", ChequePayment);
                cmd.Parameters.AddWithValue("CreditCardPayment", CreditCardPayment);
                cmd.Parameters.AddWithValue("CreditPayment", CreditPayment);
                cmd.Parameters.AddWithValue("DebitPayment", DebitPayment);
                cmd.Parameters.AddWithValue("RewardPointsPayment", RewardPointsPayment);
                cmd.Parameters.AddWithValue("RewardConvertedPayment", RewardConvertedPayment);
                cmd.Parameters.AddWithValue("BalanceAmount", BalanceAmount);
                cmd.Parameters.AddWithValue("ChangeAmount", ChangeAmount);
                cmd.Parameters.AddWithValue("PaymentType", PaymentType.ToString("d"));
                cmd.Parameters.AddWithValue("DiscCode", string.IsNullOrEmpty(DiscountCode) ? "" : DiscountCode);
                cmd.Parameters.AddWithValue("DiscRemarks", DiscountRemarks);
                cmd.Parameters.AddWithValue("Charge", Charge);
                cmd.Parameters.AddWithValue("ChargeAmount", ChargeAmount);
                cmd.Parameters.AddWithValue("ChargeCode", ChargeCode);
                cmd.Parameters.AddWithValue("ChargeRemarks", string.IsNullOrEmpty(ChargeRemarks) ? "" : ChargeRemarks);
                cmd.Parameters.AddWithValue("CashierID", CashierID);
                cmd.Parameters.AddWithValue("CashierName", CashierName);
                cmd.Parameters.AddWithValue("TransactionID", TransactionID);

                cmd.CommandText = SQL;
				base.ExecuteNonQuery(cmd);

				SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
				clsSalesTransactionItems.RefundByTransaction(TransactionID);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Exemplo n.º 32
0
		private void ShowCreditPaymentWindow()
		{
			if (mboIsCreditAllowed)
			{
				CreditPaymentWnd credit = new CreditPaymentWnd();
                credit.SalesTransactionDetails = mclsSalesTransactionDetails;
                credit.CustomerDetails = mclsCustomerDetails;
				credit.AllowedCredit = mdecAllowedCredit;
				credit.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
				
				credit.ShowDialog(this);
				DialogResult result = credit.Result;
				Data.CreditPaymentDetails creditDetails = credit.Details;
				credit.Close();
				credit.Dispose();

				if (result == DialogResult.OK)
				{
					lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + creditDetails.Amount).ToString("#,##0.#0");
					marrCreditPaymentDetails.Add(creditDetails);

                    // Add 
					ComputePayments();
					lblCredit.Tag = Convert.ToDecimal(Convert.ToDecimal(lblCredit.Tag) + creditDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

					if (mPaymentType == PaymentTypes.NotYetAssigned)
						mPaymentType = PaymentTypes.Credit;
					else
						mPaymentType = PaymentTypes.Combination;
				}
				
			}
		}
Exemplo n.º 33
0
		private void ShowChequePaymentWindow()
		{
			ChequesPaymentWnd cheque = new ChequesPaymentWnd();
			cheque.SalesTransactionDetails = mclsSalesTransactionDetails;
			cheque.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
			cheque.ShowDialog(this);
			DialogResult result = cheque.Result;
			Data.ChequePaymentDetails chequeDetails = cheque.Details;
			cheque.Close();
			cheque.Dispose();

			if (result == DialogResult.OK)
			{
				lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + chequeDetails.Amount).ToString("#,##0.#0");
				marrChequePaymentDetails.Add(chequeDetails);
				ComputePayments();
				lblCheque.Tag = Convert.ToDecimal(Convert.ToDecimal(lblCheque.Tag) + chequeDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

				if (mPaymentType == PaymentTypes.NotYetAssigned)
					mPaymentType = PaymentTypes.Cheque;
				else
					mPaymentType = PaymentTypes.Combination;

			}
			
		}
 /// <summary>Возвращает список позиций чека, соответствующих переданному коду товара и типу оплаты. Если передан тип оплаты Unknown, то возвращаются все позиции с указанным кодом</summary>
 public List<FiscalArticle> GetArticles(string GoodsCode, PaymentTypes PaymentType)
 {
     var Result = new List<FiscalArticle>();
       foreach (var Article in Articles)
     if (Article.GoodsCode == GoodsCode)
     {
       if (PaymentType != PaymentTypes.Unknown && Article.PaymentType.Value != PaymentType) continue;
       Result.Add(Article);
     }
       return Result;
 }
Exemplo n.º 35
0
        public System.Data.DataTable SalesPerItemByGroup(string ProductGroupName, string TransactionNo, string CustomerName, string CashierName, string TerminalNo,
            DateTime StartTransactionDate, DateTime EndTransactionDate, TransactionStatus Status, PaymentTypes PaymentType, SaleperItemFilterType pvtSaleperItemFilterType)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "CALL procGenerateSalesPerItemByGroup(@SessionID, @ProductGroupName, @TransactionNo, @CustomerName, @CashierName, @TerminalNo, @StartTransactionDate, @EndTransactionDate);";


                Random clsRandom = new Random();
                MySqlParameter prmSessionID = new MySqlParameter("@SessionID", clsRandom.Next(1234567, 99999999));

                cmd.Parameters.Add(prmSessionID);
                cmd.Parameters.AddWithValue("@ProductGroupName", ProductGroupName);
                cmd.Parameters.AddWithValue("@TransactionNo", TransactionNo);
                cmd.Parameters.AddWithValue("@CustomerName", CustomerName);
                cmd.Parameters.AddWithValue("@CashierName", CashierName);
                cmd.Parameters.AddWithValue("@TerminalNo", TerminalNo);
                cmd.Parameters.AddWithValue("@StartTransactionDate", StartTransactionDate.ToString("yyyy-MM-dd HH:mm:ss"));
                cmd.Parameters.AddWithValue("@EndTransactionDate", EndTransactionDate.ToString("yyyy-MM-dd HH:mm:ss"));

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);

                SQL = "SELECT " +
                        "spi.ProductGroup," +
                        "spi.ProductID," +
                        "spi.ProductCode," +
                        "MAX(cntct.ContactCode) SupplierCode," +
                        "SUM(spi.Quantity) 'Quantity'," +
                        "SUM(spi.Amount) 'Amount'," +
                        "SUM(spi.PurchaseAmount) 'PurchaseAmount', " +
                        "SUM(spi.Discount) 'Discount', " +
                        "MIN(spi.PurchasePrice) 'PurchasePrice', " +
                        "MAX(spi.InvQuantity) 'InvQuantity', " +
                        "IFNULL(MIN(ppph.PurchasePrice),0) 'PurchasePrice2', " +
                        "IFNULL(MAX(cntct2.ContactCode),'') SupplierCode2 " +
                    "FROM tblSalesPerItem spi " +
                    "INNER JOIN tblProducts prd ON spi.ProductID = prd.ProductID " +
                    "INNER JOIN tblContacts cntct ON prd.SupplierID = cntct.ContactID " +
                    "LEFT OUTER JOIN ( " +
                    "	SELECT ProductID, SupplierID, MIN(PurchasePrice) PurchasePrice " +
                    "	FROM tblProductPurchasePriceHistory ppph WHERE ppph.PurchasePrice <> 0 " +
                    "                                                   AND PurchaseDate >= DATE_ADD(NOW(), INTERVAL -6 MONTH) " +
                    "	GROUP BY ProductID " +
                    ") ppph ON prd.ProductID = ppph.ProductID " +
                    "                                                   AND ppph.SupplierID <> prd.SupplierID " +
                    "                                                   AND ppph.PurchasePrice <> spi.PurchasePrice " +
                    //"LEFT OUTER JOIN tblProductPurchasePriceHistory ppph ON prd.ProductID = ppph.ProductID " +
                    //                                                   "AND ppph.SupplierID <> prd.SupplierID " +
                    //                                                   "AND ppph.PurchasePrice <> 0 " +
                    //                                                   "AND ppph.PurchasePrice <> spi.PurchasePrice " +
                    //                                                   "AND PurchaseDate >= DATE_ADD(NOW(), INTERVAL -6 MONTH) " +
                    "LEFT OUTER JOIN tblContacts cntct2 ON ppph.SupplierID = cntct2.ContactID " +
                    "WHERE SessionID = @SessionID ";

                switch (pvtSaleperItemFilterType)
                {
                    case SaleperItemFilterType.ShowPositiveOnly:
                        SQL += "AND Amount > PurchaseAmount ";
                        break;
                    case SaleperItemFilterType.ShowNegativeOnly:
                        SQL += "AND Amount < PurchaseAmount ";
                        break;
                }

                SQL += "GROUP BY spi.ProductGroup, spi.ProductID, spi.ProductCode ORDER BY ProductCode, MIN(ppph.PurchasePrice);";

                cmd.CommandText = SQL;
                cmd.Parameters.Clear();
                cmd.Parameters.Add(prmSessionID);

                System.Data.DataTable dt = new System.Data.DataTable("SalesTransactionPerItem");
                base.MySqlDataAdapterFill(cmd, dt);

                SQL = "DELETE FROM tblSalesPerItem WHERE SessionID = @SessionID;";

                cmd.CommandText = SQL;
                cmd.Parameters.Clear();
                cmd.Parameters.Add(prmSessionID);
                base.ExecuteNonQuery(cmd);

                return dt;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 36
0
		private DialogResult ShowPayment()
		{
			DialogResult paymentResult = DialogResult.Cancel;

			if (Convert.ToDecimal(lblBalanceSelected.Text) > 0)
			{
                Data.SalesTransactionDetails clsSalesTransactionDetails = new Data.SalesTransactionDetails();
                switch (mclsSysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        clsSalesTransactionDetails.SubTotal = Convert.ToDecimal(lblAmountDue.Text);
                        break;
                    case CreditPaymentType.Normal:
                    case CreditPaymentType.MPC:
                    default:
                        clsSalesTransactionDetails.SubTotal = Convert.ToDecimal(lblBalanceSelected.Text);
                        break;
                }
                
                clsSalesTransactionDetails.TransactionStatus = TransactionStatus.CreditPayment;

                PaymentsWnd payment = new PaymentsWnd();
                payment.TerminalDetails = TerminalDetails;
                payment.SysConfigDetails = mclsSysConfigDetails;
                payment.CustomerDetails = mclsCustomerDetails;
                payment.SalesTransactionDetails = clsSalesTransactionDetails;
                payment.CreditCardSwiped = false;
                payment.IsRefund = false;
                payment.isFromCreditPayment = true;
                payment.ShowDialog(this);

                paymentResult = payment.Result;

                mdecAmountPaid = payment.AmountPaid;
                mdecCashPayment = payment.CashPayment;
                mdecChequePayment = payment.ChequePayment;
                mdecCreditCardPayment = payment.CreditCardPayment;
                mdecDebitPayment = payment.DebitPayment;
                mdecBalanceAmount = payment.BalanceAmount;
                mdecChangeAmount = payment.ChangeAmount;
                mPaymentType = payment.PaymentType;
                marrCashPaymentDetails = payment.CashPaymentDetails;
                marrChequePaymentDetails = payment.ChequePaymentDetails;
                marrCreditCardPaymentDetails = payment.CreditCardPaymentDetails;
                marrDebitPaymentDetails = payment.DebitPaymentDetails;
                payment.Close();
                payment.Dispose();

                if (paymentResult == DialogResult.OK)
                {
                    // Nov 2, 2014 do not save do the saving in MainWnd
                    // get the selected Transactions to be paid instead

                    //SavePayments(mdecAmountPaid, mdecCashPayment, mdecChequePayment, mdecCreditCardPayment, mdecDebitPayment,
                    //    marrCashPaymentDetails, marrChequePaymentDetails, marrCreditCardPaymentDetails, marrDebitPaymentDetails);

                    mdgvItemsSelectedRows = dgvItems.SelectedRows;
                }
			}
			return paymentResult;
		}
Exemplo n.º 37
0
        private void ShowRewardPointsPaymentWindow()
        {
            RewardPointPaymentWnd clsRewardPointPaymentWnd = new RewardPointPaymentWnd();
            clsRewardPointPaymentWnd.RewardPointsPayment = decimal.Parse(lblRewardPointsPayment.Text);
            clsRewardPointPaymentWnd.RewardConvertedPayment = Convert.ToDecimal(lblRewardPointsAmount.Tag);
            clsRewardPointPaymentWnd.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
            clsRewardPointPaymentWnd.IsRefund = mboIsRefund;
            clsRewardPointPaymentWnd.ContactDetails = mclsCustomerDetails;
            clsRewardPointPaymentWnd.TerminalDetails = mclsTerminalDetails;

            clsRewardPointPaymentWnd.ShowDialog(this);
            DialogResult result = clsRewardPointPaymentWnd.Result;
            decimal decRewardPointsPayment = clsRewardPointPaymentWnd.RewardPointsPayment;
            decimal decRewardConvertedPayment = clsRewardPointPaymentWnd.RewardConvertedPayment;
            decimal decAmount = clsRewardPointPaymentWnd.Amount;
            clsRewardPointPaymentWnd.Close();
            clsRewardPointPaymentWnd.Dispose();

            if (result == DialogResult.OK)
            {
                lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + decAmount).ToString("#,##0.#0");
                ComputePayments();
                lblRewardPointsAmount.Tag = Convert.ToDecimal(Convert.ToDecimal(lblRewardPointsAmount.Tag) + decAmount).ToString("#,##0.#0");
                lblRewardPointsPayment.Text = Convert.ToDecimal(Convert.ToDecimal(lblRewardPointsPayment.Tag) + decRewardPointsPayment).ToString("#,##0.#0");

                if (mPaymentType == PaymentTypes.NotYetAssigned)
                    mPaymentType = PaymentTypes.RewardPoints;
                else
                    mPaymentType = PaymentTypes.Combination;
            }
        }
 /// <summary>Добавить запись в список товаров фискального чека</summary>
 public FiscalArticle AddArticle(string GoodsCode, PaymentTypes PaymentType, string GoodsName, Int64 Quantity, Int64 Price, Int64 Amount, Int64 DiscountForPrice, Int64 DiscountForAmount, Int64 Bonuses)
 {
     FiscalArticle Article = new FiscalArticle(this);
       Articles.Add(Article);
       Article.Flags.Value = FiscalArticleFlags.Added;
       Article.GoodsCode = GoodsCode;
       Article.PaymentType = new DVPaymentTypes(PaymentType);
       Article.GoodsName = GoodsName;
       Article.Quantity = new DVInt64(Quantity);
       Article.PriceWithoutDiscount = new DVInt64(Price);
       Article.AmountWithoutDiscount = new DVInt64(Amount);
       Article.DiscountForPrice = new DVInt64(DiscountForPrice);
       Article.DiscountForAmount = new DVInt64(DiscountForAmount);
       Article.Bonuses = new DVInt64(Bonuses);
       return Article;
 }
 public static PaymentMethodId GetpaymentMethodId(this InvoiceCryptoInfo info)
 {
     return(new PaymentMethodId(info.CryptoCode, PaymentTypes.Parse(info.PaymentType)));
 }
Exemplo n.º 40
0
 public IProcessPayment ExecuteProcessor(PaymentTypes paymentTypes, CardTransactionData transactionData) => _paymentFactories[paymentTypes].Create(transactionData);
 /// <summary>Удаляет товарную позицию из чека. Возвращет true, если позиция удалена</summary>
 public bool DeleteArticle(string GoodsCode, PaymentTypes PaymentType)
 {
     foreach (FiscalArticle Article in Articles)
     if (Article != null)
       if (Article.GoodsCode == GoodsCode && Article.PaymentType.Value == PaymentType)
       {
     Articles.Remove(Article);
     return true;
       }
       return false;
 }
Exemplo n.º 42
0
		private void ShowCreditCardPaymentWindow(string sender = "f3")
		{
            CreditCardPaymentWnd clsCreditCardPaymentWnd = new CreditCardPaymentWnd();
            clsCreditCardPaymentWnd.IsCreditChargeExcluded = mboIsCreditChargeExcluded;
            clsCreditCardPaymentWnd.TerminalDetails = TerminalDetails;
            clsCreditCardPaymentWnd.SysConfigDetails = SysConfigDetails;
            clsCreditCardPaymentWnd.OfflineProduct = OfflineProductDesc;
            clsCreditCardPaymentWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
            if (sender == "f4") clsCreditCardPaymentWnd.CreditorDetails = mclsCustomerDetails;
            clsCreditCardPaymentWnd.arrCreditCardPaymentDetails = marrCreditCardPaymentDetails;
            clsCreditCardPaymentWnd.IsRefund = mboIsRefund;
            clsCreditCardPaymentWnd.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
            clsCreditCardPaymentWnd.ShowDialog(this);
            DialogResult result = clsCreditCardPaymentWnd.Result;
            Data.CreditCardPaymentDetails creditcardDetails = clsCreditCardPaymentWnd.Details;
            mclsCreditorDetails = clsCreditCardPaymentWnd.CreditorDetails;
            clsCreditCardPaymentWnd.Close();
            clsCreditCardPaymentWnd.Dispose();

			if (result == DialogResult.OK)
			{
                // set the credit card charges for inhouse credit cards
                if (creditcardDetails.AdditionalCharge != 0)
                {
                    lblCharge.Text = (decimal.Parse(lblCharge.Text) + creditcardDetails.AdditionalCharge).ToString("#,##0.#0");
                    mclsSalesTransactionDetails.CreditChargeAmount = creditcardDetails.AdditionalCharge;
                }

				lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + creditcardDetails.Amount).ToString("#,##0.#0");
				marrCreditCardPaymentDetails.Add(creditcardDetails);
				ComputePayments();
				lblCreditCard.Tag = Convert.ToDecimal(Convert.ToDecimal(lblCreditCard.Tag) + creditcardDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

				if (mPaymentType == PaymentTypes.NotYetAssigned)
					mPaymentType = PaymentTypes.CreditCard;
				else
					mPaymentType = PaymentTypes.Combination;
			}
		}
Exemplo n.º 43
0
        public static double CalculatePositionPrice(double price, double amount, PaymentTypes payment)
        {
            double result = 0;

            if (payment == PaymentTypes.Total)
            {
                result = price;
            }
            else
            {
                result = price * amount;
            }

            return Math.Round(result, 2);
        }
Exemplo n.º 44
0
        public System.Data.DataTable ListAsDataTable(Int32 BranchID, string TerminalNo = "", Int64 TransactionID = 0, string TransactionNo = "", DateTime? TransactionDateFrom = null, DateTime? TransactionDateTo = null,
                                                    TransactionStatus TransactionStatus = TransactionStatus.NotYetApplied, PaymentTypes PaymentType = PaymentTypes.NotYetAssigned, bool isConsignment = false, bool isPacked = false,
                                                    string CustomerName = "", string CustomerGroupName = "", Int64 CashierID = 0, string CashierName = "", string AgentName = "",
                                                    bool WithTF = false, bool ShowSuspendedOnly = false, string SortField = "", SortOption SortOption = SortOption.Ascending, Int32 limit = 0)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "CALL procTransactionsSelect(@BranchID, @TerminalNo, @TransactionID, @TransactionNo, @TransactionDateFrom, " +
                                                         "@TransactionDateTo, @TransactionStatus, @PaymentType, @isConsignment, @isPacked, @CustomerName, " +
                                                         "@CustomerGroupName, @CashierID, @CashierName, @AgentName, @WithTF, @ShowSuspended, " +
                                                         "@SortField, @SortOption, @Limit);";

                cmd.Parameters.AddWithValue("BranchID", BranchID);
                cmd.Parameters.AddWithValue("TerminalNo", TerminalNo);
                cmd.Parameters.AddWithValue("TransactionID", TransactionID);
                cmd.Parameters.AddWithValue("TransactionNo", TransactionNo);
                cmd.Parameters.AddWithValue("TransactionDateFrom", TransactionDateFrom.GetValueOrDefault() == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : TransactionDateFrom);
                cmd.Parameters.AddWithValue("TransactionDateTo", TransactionDateTo.GetValueOrDefault() == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : TransactionDateTo);
                cmd.Parameters.AddWithValue("TransactionStatus", TransactionStatus.ToString("d"));
                cmd.Parameters.AddWithValue("PaymentType", PaymentType.ToString("d"));
                cmd.Parameters.AddWithValue("isConsignment", isConsignment);
                cmd.Parameters.AddWithValue("isPacked", isPacked);
                cmd.Parameters.AddWithValue("CustomerName", CustomerName);
                cmd.Parameters.AddWithValue("CustomerGroupName", CustomerGroupName);
                cmd.Parameters.AddWithValue("CashierID", CashierID);
                cmd.Parameters.AddWithValue("CashierName", CashierName);
                cmd.Parameters.AddWithValue("AgentName", AgentName);
                cmd.Parameters.AddWithValue("WithTF", WithTF);
                cmd.Parameters.AddWithValue("ShowSuspended", ShowSuspendedOnly);
                cmd.Parameters.AddWithValue("SortField", SortField);
                cmd.Parameters.AddWithValue("SortOption", SortOption==SortOption.Ascending ? "ASC" : "DESC");
                cmd.Parameters.AddWithValue("Limit", limit);

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                return dt;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
 /// <summary>Возвращает сумму коненчных стоимостей товаров по типу оплаты</summary>
 public Int64 GetArticlesAmountByPaymentType(PaymentTypes PaymentType)
 {
     return (from a in Articles where a.PaymentType.Value == PaymentType select a.Amount).Sum(); //Result = Articles.Where(a => a.PaymentType == PaymentType).Select(a => a.Amount).Sum();
 }
Exemplo n.º 46
0
 public Payment(PaymentTypes type, double payAmount, double changeAmount)
 {
     this.Type = type;
     this.PayAmount = payAmount;
     this.ChangeAmount = changeAmount;
 }
Exemplo n.º 47
0
        public void CloseTransaction(Data.SalesTransactionItemDetails mTopItemDetails,
                decimal AmountPaid, decimal ChangeAmount, decimal BalanceAmount, decimal CashPayment, decimal ChequePayment,
                decimal CreditCardPayment, decimal CreditPayment, decimal CreditChargeAmount, decimal DebitPayment,
                decimal RewardConvertedPayment, decimal RewardPointsPayment, PaymentTypes PaymentType,
                ArrayList arrCashPaymentDetails, ArrayList arrChequePaymentDetails, ArrayList arrCreditCardPaymentDetails,
                ArrayList arrCreditPaymentDetails, ArrayList arrDebitPaymentDetails)
        {
            mclsSalesTransactionDetails.AmountPaid = AmountPaid;
            mclsSalesTransactionDetails.ChangeAmount = ChangeAmount;
            mclsSalesTransactionDetails.CashPayment = CashPayment;
            mclsSalesTransactionDetails.ChequePayment = ChequePayment;
            mclsSalesTransactionDetails.CreditCardPayment = CreditCardPayment;
            mclsSalesTransactionDetails.CreditPayment = CreditPayment;

            // include credit charge amount
            mclsSalesTransactionDetails.CreditChargeAmount = CreditChargeAmount;
            mclsSalesTransactionDetails.AmountDue += mclsSalesTransactionDetails.CreditChargeAmount;

            mclsSalesTransactionDetails.DebitPayment = DebitPayment;
            mclsSalesTransactionDetails.RewardPointsPayment = RewardConvertedPayment;

            /***
             * Nov 04, 2011 : for payments using reward points
             ***/
            mclsSalesTransactionDetails.RewardPointsPayment = RewardPointsPayment;
            mclsSalesTransactionDetails.RewardConvertedPayment = RewardConvertedPayment;

            /***
             * Oct 17, 2011 : Move this code here.
             * check if will print transaction or not before opening any connection to database.
             ***/
            mboDoNotPrintTransactionDate = false;
            if (mclsTerminalDetails.AutoPrint == PrintingPreference.AskFirst)
            {
                if (MessageBox.Show("Would you like to print this transaction?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, (mclsSysConfigDetails.isDefaultButtonYesInPrintTransaction ? MessageBoxDefaultButton.Button1 : MessageBoxDefaultButton.Button2)) == DialogResult.Yes)
                {
                    mclsTerminalDetails.AutoPrint = PrintingPreference.Normal;

                    if (mclsSysConfigDetails.WillAskDoNotPrintTransactionDate)
                        if (MessageBox.Show("Would you like the system NOT to print the transaction date?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                            mboDoNotPrintTransactionDate = true;
                }
            }

            // Mar 17, 2009
            // open drawer first before printing.
            //OpenDrawerDelegate opendrawerDel = new OpenDrawerDelegate(OpenDrawer);
            //Invoke(opendrawerDel);
            OpenDrawer();

            Cursor.Current = Cursors.WaitCursor;
            clsEvent.AddEventLn("[" + mclsSalesTransactionDetails.CashierName + "]      saving payments...", true);

            // for assignment of payments
            mclsSalesTransactionDetails.PaymentDetails = AssignArrayListPayments(arrCashPaymentDetails, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails);

            // start a connection for the database.
            //update the transaction table 
            Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;
            
            SavePayments(arrCashPaymentDetails, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails);

            if (mclsSalesTransactionDetails.CreditChargeAmount != 0)
            {
                //Aug 30, 2014 delete need to move this from here to mainwnd
                clsSalesTransactions.UpdateCreditChargeAmount(mclsSalesTransactionDetails.BranchID, mclsSalesTransactionDetails.TerminalNo, mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.CreditChargeAmount);
            }

            Data.Products clsProduct = new Data.Products(mConnection, mTransaction);
            mConnection = clsProduct.Connection; mTransaction = clsProduct.Transaction;

            TransactionStatus clsTransactionStatus = TransactionStatus.Closed;
            if (mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE)
            {
                clsTransactionStatus = TransactionStatus.CreditPayment;
            }
            else if (mboIsRefund)
            {
                clsTransactionStatus = TransactionStatus.Refund;

                if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.OutOfStockCustomerCode)
                {
                    clsTransactionStatus = TransactionStatus.ClosedOutOfStockRefund;
                }
                else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode)
                {
                    clsTransactionStatus = TransactionStatus.ClosedWalkInRefund;
                }
                else if (mclsSalesTransactionDetails.isConsignment)
                {
                    clsTransactionStatus = TransactionStatus.ConsignmentRefund;
                }
            }
            else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.OutOfStockCustomerCode)
            {
                clsTransactionStatus = TransactionStatus.ClosedOutOfStock;
            }
            else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode)
            {
                clsTransactionStatus = TransactionStatus.ClosedWalkIn;
            }
            else if (mclsSalesTransactionDetails.isConsignment)
            {
                clsTransactionStatus = TransactionStatus.Consignment;
            }

            if (mboIsRefund && !mclsTerminalDetails.IsParkingTerminal)
            {
                #region mboIsRefund

                clsEvent.AddEventLn("[" + mclsSalesTransactionDetails.CashierName + "]      updating refund terminal no...", true, mclsSysConfigDetails.WillWriteSystemLog);
                clsSalesTransactions.UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TerminalNo);

                if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.OutOfStockCustomerCode ||
                    mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode)
                {
                    // 20Feb2015 : Added as an exemption
                    clsEvent.AddEventLn("      no need to apply an ORNo. Customer is " + mclsSalesTransactionDetails.CustomerDetails.ContactCode, true, mclsSysConfigDetails.WillWriteSystemLog);
                }
                
                else if (!mclsSalesTransactionDetails.isConsignment)
                {
                    // 04Sep2014 : Added to put as OR No - Void NO-OR
                    mclsSalesTransactionDetails.ORNo = clsSalesTransactions.CreateORNo(mclsTerminalDetails.ORSeriesBranchID, mclsTerminalDetails.ORSeriesTerminalNo);
                    clsEvent.AddEventLn("      applying ORNo".PadRight(15) + ":" + mclsSalesTransactionDetails.ORNo, true, mclsSysConfigDetails.WillWriteSystemLog);
                }

                clsSalesTransactions.Refund(clsTransactionStatus, mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ORNo, -mclsSalesTransactionDetails.ItemSold, -mclsSalesTransactionDetails.QuantitySold, -mclsSalesTransactionDetails.GrossSales, -mclsSalesTransactionDetails.SubTotal, -mclsSalesTransactionDetails.NetSales, -mclsSalesTransactionDetails.ItemsDiscount, -mclsSalesTransactionDetails.SNRItemsDiscount, -mclsSalesTransactionDetails.PWDItemsDiscount, -mclsSalesTransactionDetails.OtherItemsDiscount, -mclsSalesTransactionDetails.Discount, -mclsSalesTransactionDetails.SNRDiscount, -mclsSalesTransactionDetails.PWDDiscount, -mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, -mclsSalesTransactionDetails.VAT, -mclsSalesTransactionDetails.VATableAmount, -mclsSalesTransactionDetails.ZeroRatedSales, - mclsSalesTransactionDetails.NonVATableAmount, -mclsSalesTransactionDetails.VATExempt, -mclsSalesTransactionDetails.EVAT, -mclsSalesTransactionDetails.EVATableAmount, -mclsSalesTransactionDetails.NonEVATableAmount, -mclsSalesTransactionDetails.LocalTax, -mclsSalesTransactionDetails.AmountPaid, -CashPayment, -ChequePayment, -CreditCardPayment, -CreditPayment, -DebitPayment, -RewardPointsPayment, -RewardConvertedPayment, -BalanceAmount, -ChangeAmount, PaymentType, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, -mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName);

                //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport);
                clsEvent.AddEventLn("[" + mclsSalesTransactionDetails.CashierName + "]      updating refund terminal report...", true, mclsSysConfigDetails.WillWriteSystemLog);
                UpdateTerminalReport(clsTransactionStatus, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, PaymentType);

                //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport);
                clsEvent.AddEventLn("[" + mclsSalesTransactionDetails.CashierName + "]      updating redunf cashier report...", true, mclsSysConfigDetails.WillWriteSystemLog);
                UpdateCashierReport(clsTransactionStatus, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, PaymentType);

                // Sep 24, 2014 : update back the LastCheckInDate to min date
                Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE);

                // Sep 14, 2014 Control printing in mclsFilePrinter.Write
                //if (mclsTerminalDetails.AutoPrint == PrintingPreference.Normal)	//print items if not yet printed
                //{
                clsEvent.AddEventLn("[" + mclsSalesTransactionDetails.CashierName  + "]      printing refund items...", true, mclsSysConfigDetails.WillWriteSystemLog);
                foreach (System.Data.DataRow dr in ItemDataTable.Rows)
                {
                    if (dr["Quantity"].ToString() != "VOID")
                    {
                        string stItemNo = "" + dr["ItemNo"].ToString();
                        string stProductCode = "" + dr["ProductCode"].ToString();
                        if (dr["MatrixDescription"].ToString() != string.Empty && dr["MatrixDescription"].ToString() != null) stProductCode += "-" + dr["MatrixDescription"].ToString();
                        string stProductUnitCode = "" + dr["ProductUnitCode"].ToString();
                        decimal decQuantity = Convert.ToDecimal(dr["Quantity"]);
                        decimal decPrice = Convert.ToDecimal(dr["Price"]);
                        decimal decDiscount = Convert.ToDecimal(dr["Discount"]);
                        decimal decAmount = Convert.ToDecimal(dr["Amount"]);
                        decimal decVAT = Convert.ToDecimal(dr["VAT"]);
                        decimal decEVAT = Convert.ToDecimal(dr["EVAT"]);
                        decimal decPromoApplied = Convert.ToDecimal(dr["PromoApplied"]);
                        string stDiscountCode = "" + dr["DiscountCode"].ToString();
                        DiscountTypes ItemDiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["ItemDiscountType"].ToString());

                        if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default)
                            PrintItem(stItemNo, stProductCode, stProductUnitCode, decQuantity, decPrice, decDiscount, decPromoApplied, decAmount, decVAT, decEVAT, stDiscountCode, ItemDiscountType);
                    }
                }

                if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default)
                    PrintReportFooterSection(true, TransactionStatus.Refund, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.AmountPaid, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, ChangeAmount, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails);
                //}
                // Sep 14, 2014 Control printing in mclsFilePrinter.Write

                // Sep 24, 2011      Lemuel E. Aceron
                // Added order slip wherein all punch items will not change sales and inventory
                // a customer named ORDER SLIP should be defined in contacts
                // lblCustomer.Text.Trim().ToUpper() != Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER

                // Added May 7, 2011 to Cater Reserved and Commit functionality
                // !mclsTerminalDetails.ReservedAndCommit

                // Sep 14, 2013: Remove the reserved and commit.
                //if (lblCustomer.Text.Trim().ToUpper() != Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER && !mclsTerminalDetails.ReservedAndCommit && !mclsTerminalDetails.IsParkingTerminal)
                if (mclsSalesTransactionDetails.CustomerName.Trim().ToUpper() != Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER && 
                    !mclsTerminalDetails.IsParkingTerminal &&
                    mclsSalesTransactionDetails.CustomerDetails.ContactCode.Trim() != mclsSysConfigDetails.OutOfStockCustomerCode) // do not change the inventory if OUT_OF_STOCK_CUSTOMER_CODE
                {
                    clsEvent.AddEventLn("[" + mclsSalesTransactionDetails.CashierName + "]      adding the refund items quantity to inv...", true, mclsSysConfigDetails.WillWriteSystemLog);
                    Data.ProductUnit clsProductUnit = new Data.ProductUnit(mConnection, mTransaction);
                    mConnection = clsProductUnit.Connection; mTransaction = clsProductUnit.Transaction;

                    foreach (System.Data.DataRow dr in ItemDataTable.Rows)
                    {
                        Int64 lProductID = Convert.ToInt64(dr["ProductID"]);
                        Int64 lVariationsMatrixID = Convert.ToInt64(dr["VariationsMatrixID"]);
                        Int32 iProductUnitID = Convert.ToInt32(dr["ProductUnitID"]);
                        decimal decQuantity = 0;
                        decimal decPackageQuantity = 0;
                        decimal decNewQuantity = 0;

                        if (dr["Quantity"].ToString().IndexOf("RETURN") != -1)
                        {
                            decimal decPrice = Convert.ToDecimal(dr["Price"]);
                            decimal decPurchasePrice = Convert.ToDecimal(dr["PurchasePrice"]);

                            decimal decDiscount = Convert.ToDecimal(dr["Discount"]);
                            decimal decAmount = -Convert.ToDecimal(dr["Amount"]);

                            decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - RETURN", "").Trim());
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);
                            decNewQuantity = -decNewQuantity;

                            clsEvent.AddEventLn("      subtracting refund-return item: prdid-" + lProductID.ToString() + " to inv: qty-" + decNewQuantity.ToString() + "...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            clsProduct.SubtractQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_REFUND_RETURN) + " @ " + (decAmount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + decPurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + decPrice.ToString("#,##0.#0") + " Discount: " + (decPrice - (decAmount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName + " Ter#: " + mclsTerminalDetails.TerminalNo, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                        }
                        else if (dr["Quantity"].ToString().IndexOf("DEMO") != -1)
                        {
                            decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - DEMO", "").Trim());
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);

                            clsEvent.AddEventLn("      adding refund-demo item: prdid-" + lProductID.ToString() + " from inv/rsrvd: qty-" + decNewQuantity.ToString() + "...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            clsProduct.AddQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.ADD_REFUND_DEMO_ITEM) + " Ter#: " + mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                        }
                        else if (dr["Quantity"].ToString() != "VOID")
                        {
                            decQuantity = Convert.ToDecimal(dr["Quantity"]);
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);

                            clsEvent.AddEventLn("      adding refund item: prdid-" + lProductID.ToString() + " from inv/rsrvd: qty-" + decNewQuantity.ToString() + "...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            clsProduct.AddQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.ADD_REFUND_ITEM) + " Ter#: " + mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                        }
                    }
                }
                #endregion
            }
            else if (!mboIsRefund)
            {
                #region Normal and ParkingTerminal

                clsEvent.AddEventLn("      closing transaction...", true, mclsSysConfigDetails.WillWriteSystemLog);

                
                if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.OutOfStockCustomerCode ||
                    mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode)
                {
                    // 20Feb2015 : Added as an exemption
                    clsEvent.AddEventLn("      no need to apply an ORNo. Customer is " + mclsSalesTransactionDetails.CustomerDetails.ContactCode, true, mclsSysConfigDetails.WillWriteSystemLog);
                }
                else if (!mclsSalesTransactionDetails.isConsignment)
                {
                    // 04Sep2014 : Added to put as OR No - Void NO-OR
                    if (mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_ADVANTAGE_CARD_RENEWAL_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_CARD_MEMBERSHIP_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_CARD_RENEWAL_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_SUPER_CARD_MEMBERSHIP_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_SUPER_CARD_RENEWAL_FEE_BARCODE ||
                            mTopItemDetails.BarCode == Data.Products.DEFAULT_SUPER_CARD_REPLACEMENT_FEE_BARCODE)
                    {
                        clsEvent.AddEventLn("      no need to apply an ORNo. Product is " + mTopItemDetails.BarCode, true, mclsSysConfigDetails.WillWriteSystemLog);
                    }
                    else
                    {
                        mclsSalesTransactionDetails.ORNo = clsSalesTransactions.CreateORNo(mclsTerminalDetails.ORSeriesBranchID, mclsTerminalDetails.ORSeriesTerminalNo);
                        clsEvent.AddEventLn("      applying ORNo".PadRight(15) + ":" + mclsSalesTransactionDetails.ORNo, true, mclsSysConfigDetails.WillWriteSystemLog);
                    }
                }

                // clsSalesTransactions.UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TerminalNo);
                // remove the above. Include the TerminalNo in clsSalesTransactions.Close below
                clsSalesTransactions.Close(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TerminalNo, mclsSalesTransactionDetails.ORNo, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.AmountPaid, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, BalanceAmount, ChangeAmount, PaymentType, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName, clsTransactionStatus);

                //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport);
                clsEvent.AddEventLn("      updating terminal report...", true, mclsSysConfigDetails.WillWriteSystemLog);
                UpdateTerminalReport(clsTransactionStatus, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, PaymentType);

                //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport);
                clsEvent.AddEventLn("      updating cashier's report...", true, mclsSysConfigDetails.WillWriteSystemLog);
                UpdateCashierReport(clsTransactionStatus, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, PaymentType);

                // Sep 24, 2014 : update back the LastCheckInDate to min date
                Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE);

                // Sep 24, 2011      Lemuel E. Aceron
                // Added order slip wherein all punch items will not change sales and inventory
                // a customer named ORDER SLIP should be defined in contacts
                //if (lblCustomer.Text.Trim().ToUpper() != Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER)

                // Added May 7, 2011 to Cater Reserved and Commit functionality    
                // !mclsTerminalDetails.ReservedAndCommit
                if (mclsTerminalDetails.IsParkingTerminal)
                {
                    clsEvent.AddEventLn("      adding back the parking slot to inv...", true, mclsSysConfigDetails.WillWriteSystemLog);
                    Data.ProductUnit clsProductUnit = new Data.ProductUnit(mConnection, mTransaction);
                    mConnection = clsProductUnit.Connection; mTransaction = clsProductUnit.Transaction;

                    Data.ProductVariationsMatrix clsProductVariationsMatrix = new Data.ProductVariationsMatrix(mConnection, mTransaction);

                    foreach (System.Data.DataRow dr in ItemDataTable.Rows)
                    {
                        long lProductID = Convert.ToInt64(dr["ProductID"]);
                        long lVariationsMatrixID = Convert.ToInt64(dr["VariationsMatrixID"]);
                        int iProductUnitID = Convert.ToInt32(dr["ProductUnitID"]);
                        decimal decQuantity = 0;
                        decimal decPackageQuantity = 0;
                        decimal decNewQuantity = 0;
                        decimal decPrice = Convert.ToDecimal(dr["Price"]);
                        decimal decPurchasePrice = Convert.ToDecimal(dr["PurchasePrice"]);

                        if ((dr["Quantity"].ToString().IndexOf("RETURN") == -1) && (dr["Quantity"].ToString() != "VOID"))
                        {
                            decQuantity = Convert.ToDecimal(dr["Quantity"]);
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);

                            clsProduct.AddQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.PARKING_OUT), mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                        }
                    }
                }
                else if (mclsSalesTransactionDetails.CustomerName.Trim().ToUpper() != Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER &&
                    !mclsTerminalDetails.IsParkingTerminal &&
                    mclsSalesTransactionDetails.CustomerDetails.ContactCode.Trim() != mclsSysConfigDetails.OutOfStockCustomerCode) // do not change the inventory if OUT_OF_STOCK_CUSTOMER_CODE
                {
                    Data.ProductUnit clsProductUnit = new Data.ProductUnit(mConnection, mTransaction);
                    mConnection = clsProductUnit.Connection; mTransaction = clsProductUnit.Transaction;

                    Data.ProductVariationsMatrix clsProductVariationsMatrix = new Data.ProductVariationsMatrix(mConnection, mTransaction);
                    
                    Data.SalesTransactionItems clsSalesTransactionItems = new Data.SalesTransactionItems(mConnection, mTransaction);

                    foreach (System.Data.DataRow dr in ItemDataTable.Rows)
                    {
                        long lProductID = Convert.ToInt64(dr["ProductID"]);
                        long lVariationsMatrixID = Convert.ToInt64(dr["VariationsMatrixID"]);
                        int iProductUnitID = Convert.ToInt32(dr["ProductUnitID"]);
                        decimal decQuantity = 0;
                        decimal decPackageQuantity = 0;
                        decimal decNewQuantity = 0;
                        decimal decPrice = Convert.ToDecimal(dr["Price"]);
                        decimal decPurchasePrice = Convert.ToDecimal(dr["PurchasePrice"]);

                        decimal decDiscount = Convert.ToDecimal(dr["Discount"]);
                        decimal decAmount = Convert.ToDecimal(dr["Amount"]);

                        if (dr["Quantity"].ToString().IndexOf("RETURN") != -1)
                        {
                            decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - RETURN", "").Trim());
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);

                            clsEvent.AddEventLn("      adding return item: prdid-" + lProductID.ToString() + " to inv: qty-" + decNewQuantity.ToString() + "...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            clsProduct.AddQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.ADD_RETURN_ITEM) + " Ter#: " + mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);

                            // 28JUn2015 : Add the RefReturnTransactionItemsID to the 
                            Int64 intReturnTransactionItemsID = Convert.ToInt64(dr["ReturnTransactionItemsID"]);
                            Int64 intTransactionItemsID = Convert.ToInt64(dr["TransactionItemsID"]);
                            clsSalesTransactionItems.UpdateRefReturnTransactionItemsID(intReturnTransactionItemsID, intTransactionItemsID);
                        }
                        else if (dr["Quantity"].ToString().IndexOf("DEMO") != -1)
                        {
                            decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - DEMO", "").Trim());
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);

                            clsEvent.AddEventLn("      subtracting demo item: prdid-" + lProductID.ToString() + " from inv/rsrvd: qty-" + decNewQuantity.ToString() + "...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            clsProduct.SubtractQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_DEMO_RETAIL) + " @ " + (decAmount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + decPurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + decPrice.ToString("#,##0.#0") + " Discount: " + (decPrice - (decAmount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName + " Ter#: " + mclsTerminalDetails.TerminalNo, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                            clsProduct.SubtractReservedQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_DEMO_RETAIL) + " @ " + (decAmount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + decPurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + decPrice.ToString("#,##0.#0") + " Discount: " + (decPrice - (decAmount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName + " Ter#: " + mclsTerminalDetails.TerminalNo, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                        }
                        else if (dr["Quantity"].ToString() != "VOID")
                        {
                            decQuantity = Convert.ToDecimal(dr["Quantity"]);
                            decPackageQuantity = Convert.ToDecimal(dr["PackageQuantity"]);
                            decNewQuantity = clsProductUnit.GetBaseUnitValue(lProductID, iProductUnitID, decQuantity * decPackageQuantity);

                            clsEvent.AddEventLn("      subtracting sold item: prdid-" + lProductID.ToString() + " from inv/rsrvd: qty-" + decNewQuantity.ToString() + "...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            clsProduct.SubtractQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_SOLD_RETAIL) + " @ " + (decAmount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + decPurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + decPrice.ToString("#,##0.#0") + " Discount: " + (decPrice - (decAmount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName + " Ter#: " + mclsTerminalDetails.TerminalNo, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                            clsProduct.SubtractReservedQuantity(mclsTerminalDetails.BranchID, lProductID, lVariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_SOLD_RETAIL) + " @ " + (decAmount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + decPurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + decPrice.ToString("#,##0.#0") + " Discount: " + (decPrice - (decAmount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName + " Ter#: " + mclsTerminalDetails.TerminalNo, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName);
                        }
                    }
                }

                // Nov 1, 2011 : Lemu - disabled reward points if product is exempted 
                clsEvent.AddEventLn("      checking if rewards is enabled...", true, mclsSysConfigDetails.WillWriteSystemLog);
                if (mclsSalesTransactionDetails.RewardCardActive && mclsTerminalDetails.RewardPointsDetails.EnableRewardPoints)
                {
                    // Note: mTopItemDetails is already set in the MainWnd.CloseTransaction()
                    if (mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_ADVANTAGE_CARD_RENEWAL_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_CARD_MEMBERSHIP_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_CREDIT_CARD_RENEWAL_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_SUPER_CARD_MEMBERSHIP_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_SUPER_CARD_RENEWAL_FEE_BARCODE ||
                        mTopItemDetails.BarCode == Data.Products.DEFAULT_SUPER_CARD_REPLACEMENT_FEE_BARCODE)
                        {
                            mclsTerminalDetails.RewardPointsDetails.EnableRewardPoints = false;
                        }
                }

                #endregion
            }

            // Oct 23, 2011 : Lemu - Added Reward Points
            #region Reward Payment

            if (mclsSalesTransactionDetails.RewardPointsPayment != 0)
            {
                clsEvent.AddEventLn("      deducting rewards payment...", true, mclsSysConfigDetails.WillWriteSystemLog);
                // this should comes before earning of points otherwise this will be wrong.
                Data.ContactReward clsContactReward = new Data.ContactReward(mConnection, mTransaction);
                mConnection = clsContactReward.Connection; mTransaction = clsContactReward.Transaction;

                clsContactReward.DeductPoints(mclsSalesTransactionDetails.CustomerID, mclsSalesTransactionDetails.RewardPointsPayment);
                string strReason = "Redeemed " + mclsSalesTransactionDetails.RewardPointsPayment + " using Reward Card #: " + mclsSalesTransactionDetails.RewardCardNo;
                clsContactReward.AddMovement(mclsSalesTransactionDetails.CustomerID, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.RewardCurrentPoints, -mclsSalesTransactionDetails.RewardPointsPayment, mclsSalesTransactionDetails.RewardCurrentPoints - mclsSalesTransactionDetails.RewardPointsPayment, mclsSalesTransactionDetails.RewardCardExpiry, strReason, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierName, mclsSalesTransactionDetails.TransactionNo);

                mclsSalesTransactionDetails.RewardPreviousPoints = mclsSalesTransactionDetails.RewardCurrentPoints;
                mclsSalesTransactionDetails.RewardCurrentPoints -= mclsSalesTransactionDetails.RewardPointsPayment;
                mclsSalesTransactionDetails.RewardEarnedPoints = 0;

                clsEvent.AddEventLn("      printing rewards slip...", true, mclsSysConfigDetails.WillWriteSystemLog);
                PrintRewardsRedemptionSlip();

                // do this after printing so that it will be equal
                mclsSalesTransactionDetails.RewardPreviousPoints = mclsSalesTransactionDetails.RewardCurrentPoints;
            }
            #endregion

            #region Add reward points to customer

            if (mclsTerminalDetails.RewardPointsDetails.EnableRewardPoints && 
                mclsSalesTransactionDetails.RewardCardActive && 
                mclsSalesTransactionDetails.RewardsCustomerID != Constants.C_RETAILPLUS_CUSTOMERID &&
                mclsTerminalDetails.RewardPointsDetails.RewardPointsMinimum <= mclsSalesTransactionDetails.AmountDue)
            {
                decimal decRewardPoints = 0;
                try
                {
                    decRewardPoints = (mclsSalesTransactionDetails.AmountDue - mclsSalesTransactionDetails.RewardConvertedPayment) / mclsTerminalDetails.RewardPointsDetails.RewardPointsEvery * mclsTerminalDetails.RewardPointsDetails.RewardPoints;

                    // round down points if RoundDown is enabled
                    if (mclsTerminalDetails.RewardPointsDetails.RoundDownRewardPoints) decRewardPoints = decimal.Floor(decRewardPoints);

                    //Data.Product clsProduct
                    //long lngProductID = 0;
                    foreach (System.Data.DataRow dr in ItemDataTable.Rows)
                    {
                        //lngProductID = decimal.Parse(dr["RewardPoints"].ToString());
                        //decRewardPoints += clsProduct.Details1(mclsTerminalDetails.BranchID, lngProductID).RewardPoints;
                        decRewardPoints += decimal.Parse(dr["RewardPoints"].ToString());
                    }
                }
                catch { }

                mclsSalesTransactionDetails.RewardEarnedPoints = decRewardPoints;
                mclsSalesTransactionDetails.RewardCurrentPoints = mclsSalesTransactionDetails.RewardPreviousPoints + mclsSalesTransactionDetails.RewardEarnedPoints;

                Data.ContactReward clsContactReward = new Data.ContactReward(mConnection, mTransaction);
                mConnection = clsContactReward.Connection; mTransaction = clsContactReward.Transaction;
                
                clsContactReward.AddPoints(mclsSalesTransactionDetails.RewardsCustomerID, mclsSalesTransactionDetails.RewardEarnedPoints);
                clsContactReward.AddPurchase(mclsSalesTransactionDetails.RewardsCustomerID, mclsSalesTransactionDetails.AmountDue);
                string strReason = "Purchase " + mclsSalesTransactionDetails.AmountDue.ToString("#,##0.#0") + " using Reward Card #: " + mclsSalesTransactionDetails.RewardCardNo;
                clsContactReward.AddMovement(mclsSalesTransactionDetails.RewardsCustomerID, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.RewardPreviousPoints, mclsSalesTransactionDetails.RewardEarnedPoints, mclsSalesTransactionDetails.RewardCurrentPoints, mclsSalesTransactionDetails.RewardCardExpiry, strReason, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierName, mclsSalesTransactionDetails.TransactionNo);
            }
            #endregion

            #region  3Nov2014 : autoamtically deposit the change if credit payment
            //#region Auto deposit for creditpayment
            //if (clsTransactionStatus == TransactionStatus.CreditPayment && mclsSysConfigDetails.WillDepositChangeOfCreditPayment)
            //{
            //    InsertAuditLog(AccessTypes.Deposit, "Auto depositing change of trx #: " + mclsSalesTransactionDetails.TransactionNo + ".");
            //    clsEvent.AddEventLn("Auto depositing change of trx #: " + mclsSalesTransactionDetails.TransactionNo + ".", true);

            //    Data.Deposits clsDeposit = new Data.Deposits(mConnection, mTransaction);
            //    mConnection = clsDeposit.Connection; mTransaction = clsDeposit.Transaction;

            //    Data.DepositDetails clsDepositDetails = new Data.DepositDetails()
            //    {
            //        BranchDetails = mclsTerminalDetails.BranchDetails,
            //        TerminalNo = mclsTerminalDetails.TerminalNo,
            //        Amount = mclsSalesTransactionDetails.ChangeAmount,
            //        PaymentType = mclsSalesTransactionDetails.PaymentType,
            //        DateCreated = DateTime.Now,
            //        CashierID = mclsSalesTransactionDetails.CashierID,
            //        CashierName = mclsSalesTransactionDetails.CashierName,
            //        ContactID = mclsSalesTransactionDetails.CustomerDetails.ContactID,
            //        ContactName = mclsSalesTransactionDetails.CustomerDetails.ContactName,
            //        Remarks = "Auto deposit from trx #: " + mclsSalesTransactionDetails.TransactionNo + ".",
            //        CreatedOn = DateTime.Now,
            //        LastModified = DateTime.Now
            //    };
            //    clsDeposit.Insert(clsDepositDetails);

            //    clsContact = new Data.Contacts(mConnection, mTransaction);
            //    mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

            //    clsContact.AddDebit(clsDepositDetails.ContactID, clsDepositDetails.Amount);
            //    clsDeposit.CommitAndDispose();

            //    InsertAuditLog(AccessTypes.Deposit, "Deposit: type='" + clsDepositDetails.PaymentType.ToString("G") + "' amount='" + clsDepositDetails.Amount.ToString(",##0.#0") + "'" + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
            //    clsEvent.AddEventLn("Done! type=" + clsDepositDetails.PaymentType.ToString("G") + " amount=" + clsDepositDetails.Amount.ToString("#,###.#0"), true);
            //}
            //#endregion
            #endregion

            // 22Nov2014 : remove the merge tables when closed or void
            if (mclsTerminalDetails.WithRestaurantFeatures)
                RemoveFromMergeTable(mclsSalesTransactionDetails.CustomerDetails.ContactCode);

            // commit the transactions here.
            // in case error s encoutered n printing. transaction is already committed.
            clsEvent.AddEventLn("      commiting transaction to database...", true, mclsSysConfigDetails.WillWriteSystemLog);
            clsSalesTransactions.CommitAndDispose();


            /***
             * print the transaction
             ***/
            #region printing
            if (mclsTerminalDetails.AutoPrint != PrintingPreference.AskFirst)
            {
                try
                {
                    if (mclsSalesTransactionDetails.isConsignment)
                    {
                        // 18Feb2015 : Print DR only if the transaction is consignment
                        clsEvent.AddEventLn("      printing delivery receipt as consginment...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintDeliveryReceipt();
                    }
                    else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.OutOfStockCustomerCode &&
                        (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice ||
                         mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt ||
                        mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR))
                    {
                        clsEvent.AddEventLn("      printing out of stock orders...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintOSReceipt();
                    }
                    else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode &&
                    (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice ||
                     mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt ||
                    mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR))
                    {
                        clsEvent.AddEventLn("      printing walk-in customer quote form...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintWalkInReceipt();
                    }
                    else if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.CreditPayment &&
                        mclsSysConfigDetails.CreditPaymentType == CreditPaymentType.Houseware)
                    {
                        // do another report for credit payment if HP
                        PrintCreditPayment();

                        // do this twice as per request of CN trader's and CS
                        PrintCreditPayment();
                    }
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice)
                    {
                        clsEvent.AddEventLn("      printing sales invoice...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintSalesInvoice();
                    }
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt)
                    {
                        clsEvent.AddEventLn("      printing delivery receipt...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintDeliveryReceipt();
                    }
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR)
                    {
                        clsEvent.AddEventLn("      printing sales invoice & delivery receipt...", true, mclsSysConfigDetails.WillWriteSystemLog);

                        if (mclsSalesTransactionDetails.TransactionStatus != TransactionStatus.Void)
                        {
                            clsEvent.AddEventLn("      will not print sales invoice. trx is void...", true, mclsSysConfigDetails.WillWriteSystemLog);
                            PrintSalesInvoice();
                        }
                        PrintDeliveryReceipt();
                    }
                    // 10Feb2010 : print sales invoice to LX as required by Wireless Link
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceForLX300Printer)
                    {
                        clsEvent.AddEventLn("      printing sales invoice for LX300...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintSalesInvoiceToLX(TerminalReceiptType.SalesInvoiceForLX300Printer);
                    }
                    //Added May 11, 2010
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceOrDR)
                    {
                        clsEvent.AddEventLn("      printing sales invoice or OR...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        if (mclsSalesTransactionDetails.CashPayment != 0 || mclsSalesTransactionDetails.CreditCardPayment != 0)
                            PrintSalesInvoice();
                        if (mclsSalesTransactionDetails.ChequePayment != 0 || mclsSalesTransactionDetails.CreditPayment != 0)
                            PrintDeliveryReceipt();
                    }
                    //Added January 17, 2011
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceForLX300PlusPrinter)
                    {
                        clsEvent.AddEventLn("      printing sales invoice for LX300 Plus...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintSalesInvoiceToLX(TerminalReceiptType.SalesInvoiceForLX300PlusPrinter);
                    }
                    //Added February 22, 2011
                    else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceForLX300PlusAmazon)
                    {
                        clsEvent.AddEventLn("      printing sales invoice for LX300 Plus Amazon...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        PrintSalesInvoiceToLX(TerminalReceiptType.SalesInvoiceForLX300PlusAmazon);
                    }
                    else if (!mboIsRefund) // do not print if refund coz its already printed above
                    {
                        // Sep 14, 2014 Control printing in mclsFilePrinter.Write
                        //if (mclsTerminalDetails.AutoPrint == PrintingPreference.Normal)	//print items if not yet printed
                        //{
                        clsEvent.AddEventLn("      printing items to POS printer...", true, mclsSysConfigDetails.WillWriteSystemLog);
                        foreach (System.Data.DataRow dr in ItemDataTable.Rows)
                        {
                            string stItemNo = "" + dr["ItemNo"].ToString();
                            string stProductUnitCode = "" + dr["ProductUnitCode"].ToString();
                            decimal decPrice = Convert.ToDecimal(dr["Price"]);
                            decimal decDiscount = Convert.ToDecimal(dr["Discount"]);
                            decimal decAmount = Convert.ToDecimal(dr["Amount"]);
                            decimal decVAT = Convert.ToDecimal(dr["VAT"]);
                            decimal decEVAT = Convert.ToDecimal(dr["EVAT"]);
                            decimal decPromoApplied = Convert.ToDecimal(dr["PromoApplied"]);
                            string stProductCode = "" + dr["ProductCode"].ToString();
                            if (dr["MatrixDescription"].ToString() != string.Empty && dr["MatrixDescription"].ToString() != null) stProductCode += "-" + dr["MatrixDescription"].ToString();
                            decimal decQuantity = 0;
                            string stDiscountCode = "" + dr["DiscountCode"].ToString();
                            DiscountTypes ItemDiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["ItemDiscountType"].ToString());

                            if (dr["Quantity"].ToString().IndexOf("RETURN") != -1)
                            {
                                stProductCode = "" + dr["ProductCode"].ToString() + "-RET";
                                decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - RETURN", "").Trim());
                                decAmount = -decAmount;
                            }
                            else if (dr["Quantity"].ToString().IndexOf("DEMO") != -1)
                            {
                                stProductCode = "" + dr["ProductCode"].ToString() + "-DEMO";
                                decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - DEMO", "").Trim());
                                decAmount = 0;
                            }
                            else if (dr["Quantity"].ToString() != "VOID")
                            {
                                decQuantity = Convert.ToDecimal(dr["Quantity"]);
                            }

                            if (dr["Quantity"].ToString().IndexOf("VOID") != -1)
                            {
                                if (mclsTerminalDetails.WillPrintVoidItem)
                                    if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default)
                                        PrintItem(stItemNo, stProductCode, stProductUnitCode, decQuantity, decPrice, decDiscount, decPromoApplied, decAmount, decVAT, decEVAT, stDiscountCode, ItemDiscountType);
                            }
                            else
                            {
                                if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default)
                                    PrintItem(stItemNo, stProductCode, stProductUnitCode, decQuantity, decPrice, decDiscount, decPromoApplied, decAmount, decVAT, decEVAT, stDiscountCode, ItemDiscountType);
                            }

                        }
                        if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default)
                        {
                            PrintReportFooterSection(true, clsTransactionStatus, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.AmountPaid, CashPayment, ChequePayment, CreditCardPayment, CreditPayment, DebitPayment, RewardPointsPayment, RewardConvertedPayment, ChangeAmount, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails);

                            // print the charge slip if not refund and will print
                            if (mclsTerminalDetails.WillPrintChargeSlip && !mboIsRefund)
                            {
                                clsEvent.AddEventLn("      printing charge slip...", true, mclsSysConfigDetails.WillWriteSystemLog);

                                // Nov 05, 2011 : Print Charge Slip
                                PrintChargeSlip(ChargeSlipType.Customer);
                                PrintChargeSlip(ChargeSlipType.Original);

                                if (mclsTerminalDetails.IncludeCreditChargeAgreement && mclsSalesTransactionDetails.CustomerDetails.CreditDetails.CardTypeDetails.WithGuarantor)
                                //if (!mclsTerminalDetails.IncludeCreditChargeAgreement) //do not print the guarantor if there is no agreement printed
                                {
                                    PrintChargeSlip(ChargeSlipType.Guarantor);
                                }
                            }
                        }
                        //}
                        // Sep 14, 2014 Control printing in mclsFilePrinter.Write
                    }
                }
                catch (Exception ex)
                {
                    clsEvent.AddErrorEventLn(ex);
                    clsEvent.AddEventLn("Error printing transaction no: " + mclsSalesTransactionDetails.TransactionNo + ". Already commited in the database.", true);
                }
            }
            #endregion

            // print all the coupon's
            #region Printing of coupons

            // print coupon's only for customer's with reward cards as per request of Sir Guy,
            // sa susunod ilalagay na sya sa selection
            if (mclsContactDetails.ContactID != Constants.C_RETAILPLUS_CUSTOMERID &&
                mclsContactDetails.RewardDetails.ContactID != 0)
            {
                Data.PromoBySupplier clsPromoBySupplier = new Data.PromoBySupplier(mConnection, mTransaction);
                mConnection = clsPromoBySupplier.Connection; mTransaction = clsPromoBySupplier.Transaction;

                try
                {
                    clsEvent.AddEventLn("Printing coupon if necessary...", true);

                    Data.PromoBySupplierDetails clsPromoBySupplierDetails = clsPromoBySupplier.getPromoBySupplierID();
                    if (clsPromoBySupplierDetails.PromoBySupplierID != 0)
                    {
                        Data.PromoBySupplierItems clsPromoBySupplierItems = new Data.PromoBySupplierItems(mConnection, mTransaction);
                        mConnection = clsPromoBySupplierItems.Connection; mTransaction = clsPromoBySupplierItems.Transaction;

                        Data.ProductGroup clsProductGroup = new Data.ProductGroup(mConnection, mTransaction);
                        mConnection = clsProductGroup.Connection; mTransaction = clsProductGroup.Transaction;

                        Data.ProductSubGroup clsProductSubGroup = new Data.ProductSubGroup(mConnection, mTransaction);
                        mConnection = clsProductSubGroup.Connection; mTransaction = clsProductSubGroup.Transaction;

                        decimal decPromoBySupplierValue = -1;
                        decimal decItemAmount = 0;
                        string strCouponRemarks = "";
                        var lstItems = mclsSalesTransactionDetails.TransactionItemsList;

                        Int64 ProductGroupID = 0, ProductSubGroupID = 0;
                        switch (clsPromoBySupplierDetails.PromoLevel)
                        {
                            case PromoLevel.All:
                                lstItems = mclsSalesTransactionDetails.TransactionItemsList;
                                decPromoBySupplierValue = -1;
                                decItemAmount = mclsSalesTransactionDetails.TransactionItemsList.Sum(x => x.Amount);
                                if (clsPromoBySupplierItems.ApplyPromoBySupplierValue(clsPromoBySupplierDetails, 0, 0, 0, 0, 0, out decPromoBySupplierValue, out strCouponRemarks, mclsSalesTransactionDetails.BranchID))
                                {
                                    if (decPromoBySupplierValue == 0 || decPromoBySupplierValue <= decItemAmount)
                                    {
                                        //print it
                                        PrintCoupon(lstItems[0], strCouponRemarks);
                                    }
                                }

                                break;
                            case PromoLevel.Contact:
                                lstItems = mclsSalesTransactionDetails.TransactionItemsList
                                    .GroupBy(x => new { x.SupplierID, x.SupplierName })
                                    .Select(data => new Data.SalesTransactionItemDetails() { SupplierID = data.Key.SupplierID, SupplierName = data.Key.SupplierName, ProductGroup = "All", ProductSubGroup = "All", Amount = data.Sum(x => x.Amount) }).ToList();

                                foreach (Data.SalesTransactionItemDetails item in lstItems)
                                {
                                    decPromoBySupplierValue = -1;
                                    decItemAmount = item.Amount;
                                    if (clsPromoBySupplierItems.ApplyPromoBySupplierValue(clsPromoBySupplierDetails, item.SupplierID, 0, 0, 0, 0, out decPromoBySupplierValue, out strCouponRemarks, mclsSalesTransactionDetails.BranchID))
                                    {
                                        if (decPromoBySupplierValue == 0 || decPromoBySupplierValue <= decItemAmount)
                                        {
                                            //print it
                                            PrintCoupon(item, strCouponRemarks);
                                        }
                                    }
                                }
                                break;
                            case PromoLevel.ProductGroup:
                                lstItems = mclsSalesTransactionDetails.TransactionItemsList
                                    .GroupBy(x => new { x.SupplierID, x.SupplierName, x.ProductGroup })
                                    .Select(data => new Data.SalesTransactionItemDetails() { SupplierID = data.Key.SupplierID, SupplierName = data.Key.SupplierName, ProductGroup = data.Key.ProductGroup, ProductSubGroup = "All", Amount = data.Sum(x => x.Amount) }).ToList();

                                foreach (Data.SalesTransactionItemDetails item in lstItems)
                                {
                                    decPromoBySupplierValue = -1;
                                    decItemAmount = item.Amount;
                                    ProductGroupID = clsProductGroup.DetailsByName(item.ProductGroup).ProductGroupID;

                                    if (clsPromoBySupplierItems.ApplyPromoBySupplierValue(clsPromoBySupplierDetails, item.SupplierID, ProductGroupID, 0, 0, 0, out decPromoBySupplierValue, out strCouponRemarks, mclsSalesTransactionDetails.BranchID))
                                    {
                                        if (decPromoBySupplierValue == 0 || decPromoBySupplierValue <= decItemAmount)
                                        {
                                            //print it
                                            PrintCoupon(item, strCouponRemarks);
                                        }
                                    }
                                }
                                break;
                            case PromoLevel.ProductSubGroup:
                                lstItems = mclsSalesTransactionDetails.TransactionItemsList
                                    .GroupBy(x => new { x.SupplierID, x.SupplierName, x.ProductGroup, x.ProductSubGroup })
                                    .Select(data => new Data.SalesTransactionItemDetails() { SupplierID = data.Key.SupplierID, SupplierName = data.Key.SupplierName, ProductGroup = data.Key.ProductGroup, ProductSubGroup = data.Key.ProductSubGroup, Amount = data.Sum(x => x.Amount) }).ToList();

                                foreach (Data.SalesTransactionItemDetails item in lstItems)
                                {
                                    decPromoBySupplierValue = -1;
                                    decItemAmount = item.Amount;

                                    ProductGroupID = clsProductGroup.DetailsByName(item.ProductGroup).ProductGroupID;
                                    ProductSubGroupID = clsProductSubGroup.DetailsByName(item.ProductSubGroup).ProductSubGroupID;
                                    if (clsPromoBySupplierItems.ApplyPromoBySupplierValue(clsPromoBySupplierDetails, item.SupplierID, ProductGroupID, ProductSubGroupID, 0, 0, out decPromoBySupplierValue, out strCouponRemarks, mclsSalesTransactionDetails.BranchID))
                                    {
                                        if (decPromoBySupplierValue == 0 || decPromoBySupplierValue <= decItemAmount)
                                        {
                                            //print it
                                            PrintCoupon(item, strCouponRemarks);
                                        }
                                    }
                                }
                                break;
                            case PromoLevel.Product:
                                lstItems = mclsSalesTransactionDetails.TransactionItemsList
                                    .GroupBy(x => new { x.SupplierID, x.SupplierName, x.ProductGroup, x.ProductSubGroup, x.ProductID })
                                    .Select(data => new Data.SalesTransactionItemDetails() { SupplierID = data.Key.SupplierID, SupplierName = data.Key.SupplierName, ProductGroup = data.Key.ProductGroup, ProductSubGroup = data.Key.ProductSubGroup, ProductID = data.Key.ProductID, Amount = data.Sum(x => x.Amount) }).ToList();

                                foreach (Data.SalesTransactionItemDetails item in lstItems)
                                {
                                    decPromoBySupplierValue = -1;
                                    decItemAmount = item.Amount;

                                    ProductGroupID = clsProductGroup.DetailsByName(item.ProductGroup).ProductGroupID;
                                    ProductSubGroupID = clsProductSubGroup.DetailsByName(item.ProductSubGroup).ProductSubGroupID;
                                    if (clsPromoBySupplierItems.ApplyPromoBySupplierValue(clsPromoBySupplierDetails, item.SupplierID, ProductGroupID, ProductSubGroupID, item.ProductID, 0, out decPromoBySupplierValue, out strCouponRemarks, mclsSalesTransactionDetails.BranchID))
                                    {
                                        if (decPromoBySupplierValue == 0 || decPromoBySupplierValue <= decItemAmount)
                                        {
                                            //print it
                                            PrintCoupon(item, strCouponRemarks);
                                        }
                                    }
                                }
                                break;
                            case PromoLevel.Variation:
                                lstItems = mclsSalesTransactionDetails.TransactionItemsList
                                    .GroupBy(x => new { x.SupplierID, x.SupplierName, x.ProductGroup, x.ProductSubGroup, x.ProductID, x.VariationsMatrixID })
                                    .Select(data => new Data.SalesTransactionItemDetails() { SupplierID = data.Key.SupplierID, SupplierName = data.Key.SupplierName, ProductGroup = data.Key.ProductGroup, ProductSubGroup = data.Key.ProductSubGroup, ProductID = data.Key.ProductID, VariationsMatrixID = data.Key.VariationsMatrixID, Amount = data.Sum(x => x.Amount) }).ToList();

                                foreach (Data.SalesTransactionItemDetails item in lstItems)
                                {
                                    decPromoBySupplierValue = -1;
                                    decItemAmount = item.Amount;

                                    ProductGroupID = clsProductGroup.DetailsByName(item.ProductGroup).ProductGroupID;
                                    ProductSubGroupID = clsProductSubGroup.DetailsByName(item.ProductSubGroup).ProductSubGroupID;
                                    if (clsPromoBySupplierItems.ApplyPromoBySupplierValue(clsPromoBySupplierDetails, item.SupplierID, ProductGroupID, ProductSubGroupID, item.ProductID, item.VariationsMatrixID, out decPromoBySupplierValue, out strCouponRemarks, mclsSalesTransactionDetails.BranchID))
                                    {
                                        if (decPromoBySupplierValue == 0 || decPromoBySupplierValue <= decItemAmount)
                                        {
                                            //print it
                                            PrintCoupon(item, strCouponRemarks);
                                        }
                                    }
                                }
                                break;
                        }

                    }
                    clsEvent.AddEventLn("done...", true);
                }
                catch (Exception ex)
                {
                    clsEvent.AddEventLn("Error printing coupon", true);
                    clsEvent.AddErrorEventLn(ex);
                }
                finally
                {
                    clsPromoBySupplier.CommitAndDispose();
                }

            }

            #endregion

            InsertAuditLog(AccessTypes.CloseTransaction, "Close transaction #: " + mclsSalesTransactionDetails.TransactionNo + "... Subtotal: " + mclsSalesTransactionDetails.SubTotal.ToString("#,###.#0") + " Discount: " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + " AmountPaid: " + mclsSalesTransactionDetails.AmountPaid.ToString("#,###.#0") + " CashPayment: " + CashPayment.ToString("#,###.#0") + " ChequePayment: " + ChequePayment.ToString("#,###.#0") + " CreditCardPayment: " + CreditCardPayment + " CreditPayment: " + CreditPayment.ToString("#,###.#0") + " DebitPayment: " + DebitPayment.ToString("#,###.#0") + " ChangeAmount: " + ChangeAmount.ToString("#,###.#0") + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

            clsEvent.AddEventLn("Done! Transaction no. " + mclsSalesTransactionDetails.TransactionNo + " has been closed. Subtotal: " + mclsSalesTransactionDetails.SubTotal.ToString("#,###.#0") + " Discount: " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + " AmountPaid: " + mclsSalesTransactionDetails.AmountPaid.ToString("#,###.#0") + " CashPayment: " + CashPayment.ToString("#,###.#0") + " ChequePayment: " + ChequePayment.ToString("#,###.#0") + " CreditCardPayment: " + CreditCardPayment + " CreditPayment: " + CreditPayment.ToString("#,###.#0") + " DebitPayment: " + DebitPayment.ToString("#,###.#0") + " ChangeAmount: " + ChangeAmount.ToString("#,###.#0"), true);

        }
        /// <summary>
        /// Unstructured Remittance Information
        /// </summary>
        public override List <string> Ustrd(string externalAdvText, ISO20022PaymentTypes ISOPaymType, PaymentTypes paymentMethod, bool extendedText)
        {
            var ustrdText = StandardPaymentFunctions.RegularExpressionReplace(externalAdvText, allowedCharactersRegEx, replaceCharactersRegEx);

            int           maxLines   = 0;
            int           maxStrLen  = 0;
            List <string> resultList = new List <string>();

            switch (companyBankEnum)
            {
            case CompanyBankENUM.SEB:      //Setup as Danske Bank
                maxLines  = 4;
                maxStrLen = 35;
                break;

            default:
                maxLines  = 1;
                maxStrLen = 140;
                break;
            }

            if (ustrdText != string.Empty)
            {
                if (ustrdText.Length > maxLines * maxStrLen)
                {
                    ustrdText = ustrdText.Substring(0, maxLines * maxStrLen);
                }

                resultList = ustrdText.Select((x, i) => i)
                             .Where(i => i % maxStrLen == 0)
                             .Select(i => ustrdText.Substring(i, ustrdText.Length - i >= maxStrLen ? maxStrLen : ustrdText.Length - i)).ToList <string>();
            }

            return(resultList);
        }
Exemplo n.º 49
0
        //public delegate void UpdateCashierReportDelegate(TransactionStatus TransStatus, decimal SubTotal, decimal Discount, decimal Charge, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal EVAT, decimal LocalTax, decimal CashPayment, decimal ChequePayment, decimal CreditCardPayment, decimal CreditPayment, decimal DebitPayment, PaymentTypes PaymentType);
        public void UpdateCashierReport(TransactionStatus TransStatus, decimal ItemSold, decimal QuantitySold, decimal SubTotal, decimal Discount, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Charge, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, decimal CashPayment, decimal ChequePayment, decimal CreditCardPayment, decimal CreditPayment, decimal DebitPayment, decimal RewardPointsPayment, decimal RewardConvertedPayment, PaymentTypes PaymentType)
        {
            Int32 intNoOfCashTransactions = 0;
            Int32 intNoOfChequeTransactions = 0;
            Int32 intNoOfCreditCardTransactions = 0;
            Int32 intNoOfCreditTransactions = 0;
            Int32 intNoOfDebitTransactions = 0;
            Int32 intNoOfCombinationPaymentTransactions = 0;
            Int32 intNoOfDiscountedTransactions = 0;
            Int32 intNoOfRewardPointsPayment = 0;
            
            decimal decPromotionalItems = 0;

            foreach (System.Data.DataRow dr in ItemDataTable.Rows)
            {

                decimal ItemQuantity = 0;
                try { ItemQuantity = Convert.ToDecimal(dr["Quantity"]); }
                catch
                {
                    try { ItemQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace("RETURN", "").Trim()); }
                    catch { }
                }

                decPromotionalItems += Convert.ToDecimal(dr["PromoApplied"]);
            }
            switch (PaymentType)
            {
                case PaymentTypes.Cash: { intNoOfCashTransactions = 1; break; }
                case PaymentTypes.Cheque: { intNoOfChequeTransactions = 1; break; }
                case PaymentTypes.CreditCard: { intNoOfCreditCardTransactions = 1; break; }
                case PaymentTypes.Credit: { intNoOfCreditTransactions = 1; break; }
                case PaymentTypes.Debit: { intNoOfDebitTransactions = 1; break; }
                case PaymentTypes.RewardPoints: { intNoOfRewardPointsPayment = 1; break; }
                case PaymentTypes.Combination: { intNoOfCombinationPaymentTransactions = 1; break; }
                default: { intNoOfCashTransactions = 1; break; }
            }

            Data.CashierReportDetails clsCashierReportDetails = new Data.CashierReportDetails();

            if (TransStatus == TransactionStatus.Closed)
            {
                clsCashierReportDetails.ItemSold = ItemSold;
                clsCashierReportDetails.QuantitySold = QuantitySold;
                clsCashierReportDetails.NoOfCashTransactions = intNoOfCashTransactions;
                clsCashierReportDetails.NoOfChequeTransactions = intNoOfChequeTransactions;
                clsCashierReportDetails.NoOfCreditCardTransactions = intNoOfCreditCardTransactions;
                clsCashierReportDetails.NoOfCreditTransactions = intNoOfCreditTransactions;
                clsCashierReportDetails.NoOfDebitPaymentTransactions = intNoOfDebitTransactions;
                clsCashierReportDetails.NoOfCombinationPaymentTransactions = intNoOfCombinationPaymentTransactions;
                clsCashierReportDetails.NoOfRewardPointsPayment = intNoOfRewardPointsPayment;
                clsCashierReportDetails.NoOfClosedTransactions = 1;

                // march 19, 2009
                clsCashierReportDetails.NoOfDiscountedTransactions = intNoOfDiscountedTransactions;
                clsCashierReportDetails.CreditSalesTax = clsCashierReportDetails.CreditPayment * (mclsTerminalDetails.VAT / 100);
                clsCashierReportDetails.PromotionalItems = decPromotionalItems;
                clsCashierReportDetails.NoOfTotalTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.Void)
            {
                clsCashierReportDetails.ItemSold = 0;
                clsCashierReportDetails.QuantitySold = 0;
                clsCashierReportDetails.NoOfVoidTransactions = 1;
                clsCashierReportDetails.NoOfTotalTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.Refund)
            {
                clsCashierReportDetails.ItemSold = -ItemSold;
                clsCashierReportDetails.QuantitySold = -QuantitySold;
                clsCashierReportDetails.NoOfRefundTransactions = 1;
                clsCashierReportDetails.NoOfTotalTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.CreditPayment)
            {
                clsCashierReportDetails.PromotionalItems = decPromotionalItems;

                clsCashierReportDetails.NoOfCreditPaymentTransactions = 1;
                clsCashierReportDetails.NoOfTotalTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.ClosedWalkIn)
            {
                clsCashierReportDetails.NoOfWalkInTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.ClosedOutOfStock)
            {
                clsCashierReportDetails.NoOfOutOfStockTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.Consignment)
            {
                clsCashierReportDetails.NoOfConsignmentTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.ClosedWalkInRefund)
            {
                clsCashierReportDetails.NoOfWalkInRefundTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.ClosedOutOfStockRefund)
            {
                clsCashierReportDetails.NoOfOutOfStockRefundTransactions = 1;
            }
            else if (TransStatus == TransactionStatus.ConsignmentRefund)
            {
                clsCashierReportDetails.NoOfConsignmentRefundTransactions = 1;
            }
            

            clsCashierReportDetails.TerminalNo = mclsTerminalDetails.TerminalNo;
            clsCashierReportDetails.BranchID = mclsTerminalDetails.BranchID;
            clsCashierReportDetails.CashierID = mclsSalesTransactionDetails.CashierID;

            Data.CashierReports clsCashierReport = new Data.CashierReports(mConnection, mTransaction);
            mConnection = clsCashierReport.Connection; mTransaction = clsCashierReport.Transaction;

            clsCashierReport.UpdateTransactionSales(clsCashierReportDetails);
        }
Exemplo n.º 50
0
 public ActionResult GetPaymentStrategy(PaymentTypes paymentType, OrderPayment orderPayment)
 {
     return(_payments.FirstOrDefault(x => x.Name == paymentType)?.Pay(orderPayment));
 }
 public static string GetKey(string GoodsCode, PaymentTypes PaymentType)
 {
     return string.Concat(GoodsCode, "|", (int)PaymentType);
 }