My company charges actual freight to our customers. We collect payment for the product when the sales order is entered. Freight is added before shipment is confirmed. When the invoice is released a payment is created to cover freight.
I get another process has updated the ‘ARRegister’ record. Your changes will be lost error.
The following code does create the payment, but the payment staying in Pending Process status and the Invoice is not released. I would like to be able to release the payment and the invoice. Is there a way to do this?
if (pay.PaymentMethodID == "TXCRCARD")
{
if (doc.CuryUnpaidBalance > 0)
{
var invoice = Base.Document.Current;
var createPaymentDialog = Base.GetExtension<CreatePaymentExt>();
SOQuickPayment dialogInfo = new SOQuickPayment
{
CuryOrigDocAmt = balance,
PaymentMethodID = "TXCRCARD",
ExtRefNbr = Base.Document.Current.RefNbr,
Capture = true,
CashAccountID = 999,
};
var paymentGraph = createPaymentDialog.CreatePayment(dialogInfo, invoice, ARPaymentType.Payment);
paymentGraph.Save.Press();
}
}
Trace Information: