cancel
Showing results for 
Search instead for 
Did you mean: 

Payment reconciliation with A/R Invoice + close Invoice

Former Member
0 Kudos

Hi Again,

I am doing a Payment directly from A/R Invoice; but the A/R Invoice is still Open and there is no reconciliation between the Payment and the A/R Invoice.

Any code sample you can give me to close A/R Invoice with reconciliation of the Payment, and if half paid I assume the A/R Invoice is still open and the A/R Invoice is reconciliated with the payment?

See my code below which is missing the reconciliation.

Thank you

Rune

oPayments = (SAPbobsCOM.Payments)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments);

                    oPayments.CardCode = vmp_CardCode_string;
                    oPayments.DocDate = DateTime.Now;
                    oPayments.JournalRemarks = "Incoming - Payment Bank Transfer";
                    oPayments.TaxDate = DateTime.Now;
                    
                    SAPbobsCOM.Recordset oRecordset_BankAccount = null;
                    oRecordset_BankAccount = ((SAPbobsCOM.Recordset)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
                    oRecordset_BankAccount.DoQuery("SELECT * FROM [dbo].[@PAY_TYPE] WHERE [U_PayMethod] = '01'");
                    oRecordset_BankAccount.MoveFirst();
                    if (oRecordset_BankAccount.EoF == true) // No Records
                    {
                    }
                    else
                    {
                        vmp_BankAccount_string = Convert.ToString(oRecordset_BankAccount.Fields.Item("U_BankAccount").Value);
                    }

                    oPayments.TransferAccount = vmp_BankAccount_string;// "_SYS00000000343"; //"1010140-001";
                    oPayments.TransferDate = DateTime.Now;
                    oPayments.TransferReference = vmp_CardCode_string;
                    oPayments.TransferSum = vmp_Amount_double;

                    vc_Message_Result_Int32 = oPayments.Add();

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I assume I have to add following code to my payment to close the invoice; see below.

But I get following error:

Invalid total [(----) 131-44]

Thank you,

Rune

oPayments = (SAPbobsCOM.Payments)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments);

oPayments.Invoices.AppliedFC = 0;
oPayments.Invoices.DocEntry = vmp_DocEntry_Int32;
oPayments.Invoices.DocLine = 0;
oPayments.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice;//13;
oPayments.Invoices.SumApplied = vmp_Amount_double;
oPayments.Invoices.Add();

oPayments.CardCode = vmp_CardCode_string;
oPayments.DocDate = DateTime.Now;
oPayments.JournalRemarks = "Incoming - Payment Cash";
oPayments.TaxDate = DateTime.Now;
oPayments.CashAccount = vm_CachAccountNumber_string;    //"_SYS00000000342"
oPayments.CashSum = vmp_Amount_double;

vc_Message_Result_Int32 = oPayments.Add();

if (vc_Message_Result_Int32 != 0)		// Check the result
{
}

Former Member
0 Kudos

Hi Again,

It is this part that crash with the payment, if I remove the code it works; but the A/R Invoice stays open and the payment is not reconciliated with the payment.

Any code to reconciliated the payment with A/R Invoice when you do a payment?

vPay.Invoices.AppliedFC = 0;
vPay.Invoices.DocEntry = vmp_DocEntry_Int32;
vPay.Invoices.DocLine = 0;
vPay.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice;//13;
vPay.Invoices.SumApplied = vmp_Amount_double;
vPay.Invoices.Add();

Former Member
0 Kudos

Set following option to zero (0);

oPayments.Invoices.DiscountPercent = 0;