Good day!
I'm trying to add an invoice with a corresponding payment. I have multiple payments, cash and credit card. I can add cash payments properly but when I add the credit card payment it gives me an error "Invalid Row".
Below is the script I used.
Thanks in advance! 😊
//this is where i added the cash payments foreach (DataRow _row in loSAPDAO.getCashPayments(pDate, _salesHeaders).Rows) { if (_row["salesHeaderId"].ToString() != "") { _oPaymentInvoice.CardCode = "WALK-IN"; _oPaymentInvoice.CashSum = double.Parse(_row["amount"].ToString()); _oPaymentInvoice.DocDate = pDate; _oPaymentInvoice.DocTypte = BoRcptTypes.rCustomer; _oPaymentInvoice.DocNum = int.Parse(_docNum); _oPaymentInvoice.HandWritten = BoYesNoEnum.tYES;; _oPaymentInvoice.TaxDate = pDate; } } //this is where i added the credit card payments foreach (DataRow _row in loSAPDAO.getCreditCardPayments(pDate, _salesHeaders).Rows) { if (_row["salesHeaderId"].ToString() != "") { //credit card payments _oPaymentInvoice.CreditCards.SetCurrentLine(_ccLineNum); //this is where the error occurs _oPaymentInvoice.CreditCards.AdditionalPaymentSum = 0; _oPaymentInvoice.CreditCards.CardValidUntil = DateTime.Parse(_row["expiryDate"].ToString()); _oPaymentInvoice.CreditCards.CreditCardNumber = _row["cardNumber"].ToString(); _oPaymentInvoice.CreditCards.CreditSum = double.Parse(_row["amount"].ToString()); _oPaymentInvoice.CreditCards.CreditCard = int.Parse(_row["cardType"].ToString()); _oPaymentInvoice.CreditCards.Add(); _ccLineNum++; } }