cancel
Showing results for 
Search instead for 
Did you mean: 

Payment on Account no invoice

0 Kudos
493

Hello everybody.I am trying to make a draft incomining payments without being associated with a bill (Paynocode) and I do not get a good result.First I got this error:Error: Document number not allowed [RCT2.DocEntry] [line: 1] [??????? 131-80]Then change the doctype field and DocTypte with the value rAccount but now I have the following error:Error: Can not pay an invoice with a payment on account [ORCT.DocType] [??????? 3524-88]Below my code.
SAPbobsCOM.Payments payments = (SAPbobsCOM.Payments) sapCompany.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oPaymentsDrafts);
Payments.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_IncomingPayments;Payments.CardCode = incomingPayments.CardCode;String USER = incomingPayments.UserFields.Fields.Item ("U_BKV_USUARIO"). Value.ToString ();Payments.DocType = incomingPayments.DocType;Payments.DocTypte = incomingPayments.DocTypte;

SqlDataReader readerCuentasCashCheck = sqlAdapter.exe ("select B.CashAcct, B.CheckAcct from ["+ SapCompany.CompanyDB + "] .dbo.OUDG B, [" + sapCompany.CompanyDB + "]. Dbo.OUSR A where A.USER_CODE =+ "'" + USER + "'" + "AND A.DfltsGroup = B.Code");

If (readerCuentasCashCheck.Read ()){
CashAcct = readerCuentasCashCheck.GetString (0);CheckAcct = readerCuentasCashCheck.GetString (1);}
Payments.CashSum = incomingPayments.CashSum;Payments.CashAccount = CashAcct;Payments.TransferSum = incomingPayments.TransferSum;Payments.TransferAccount = incomingPayments.TransferAccount;Payments.TransferDate = incomingPayments.TransferDate;IncomingPayments.Checks.SetCurrentLine (0); 0) ">If (incomingPayments.Checks.CheckSum> 0){For (int i = 0; i <incomingPayments.Checks.Count; i ++){
Payments.Checks.SetCurrentLine (i);

Payments.Checks.CheckSum = incomingPayments.Checks.CheckSum;Payments.Checks.CountryCode = "CO";Payments.Checks.Trnsfrable = SAPbobsCOM.BoYesNoEnum.tNO;Payments.Checks.CheckAccount = CheckAcct;Payments.Checks.ManualCheck = SAPbobsCOM.BoYesNoEnum.tNO;Payments.Checks.DueDate = incomingPayments.Checks.DueDate;Payments.Checks.BankCode = incomingPayments.Checks.BankCode;Payments.Checks.CheckNumber = incomingPayments.Checks.CheckNumber;Payments.Checks.Add ();}}For (int i = 0; i <incomingPayments.Invoices.Count; i ++){
Payments.Invoices.SetCurrentLine (i);IncomingPayments.Invoices.SetCurrentLine (i);Payments.Invoices.InvoiceType = incomingPayments.Invoices.InvoiceType;Payments.Invoices.DocEntry = incomingPayments.Invoices.DocEntry;Payments.Invoices.SumApplied = incomingPayments.Invoices.SumApplied;Payments.Invoices.Add ();}

Regards..

View Entire Topic
edy_simon
Active Contributor
0 Kudos

Hi,

For payment on account, you don't need to provide the incomingPayments.Invoices.

Remove this part

For (int i = 0; i <incomingPayments.Invoices.Count; i ++){
Payments.Invoices.SetCurrentLine (i);IncomingPayments.Invoices.SetCurrentLine (i);Payments.Invoices.InvoiceType = incomingPayments.Invoices.InvoiceType;Payments.Invoices.DocEntry = incomingPayments.Invoices.DocEntry;Payments.Invoices.SumApplied = incomingPayments.Invoices.SumApplied;Payments.Invoices.Add ();}