Hi
I have a problem when create a incoming payment from customer
creating journal entry, payment, and add the journal entry on the payment
if the invoice is partially paid the payment is created sucessfully
but if the invoice is not paid send a error
error code:-10
description:Enter valid code [JDT1.ContraAct][line: 1] , 'SN0001' [??????? 173-36]
here ir the code:
//creating journal entry
var entry = company.GetBusinessObject(BoObjectTypes.oJournalEntries) as JournalEntries;
var cuenta = parametros.CodigoCuentaContableAnticiposClienteExportacion;
entry.TaxDate = pago.FechaCreacion;
entry.ReferenceDate = pago.FechaCreacion;
entry.DueDate = pago.FechaCreacion;
entry.Reference = "Aplic Anticipo cliente";
entry.Memo = "Aplic ANTICIPO CLIENTE";
entry.Reference2 = pago.Codigo.ToString();
entry.Lines.ShortName = pago.ClientePago.CardCode;
entry.Lines.Credit = (double)pago.Anticipado;
entry.Lines.TaxDate = entry.TaxDate;
entry.Lines.Add();
entry.Lines.SetCurrentLine(1);
entry.Lines.ShortName = cuenta;
entry.Lines.Debit = (double)pago.Anticipado;
entry.Lines.TaxDate = entry.TaxDate;
var statusPoliza = entry.Add();
if (statusPoliza != 0)
{
return;
}
var polizaAnticipo = company.GetNewObjectKey();
//creating payment
var payment = company.GetBusinessObject(BoObjectTypes.oIncomingPayments) as Payments;
payment.CardCode = client;
payment.DocDate = pago.FechaCreacion;
payment.DocType = BoRcptTypes.rCustomer;
payment.DocCurrency = "MXP"
var remarks = pago.PagoFacturas.Aggregate<PagoFactura, string>("",(folios, factura) => folios += "," + FolioImpreso).Substring(1);
if (remarks.Length > 50)
remarks = remarks.Substring(0, 47) + "...";
payment.JournalRemarks = remarks;
payment.Remarks = pago.Observaciones.Substring(0, pago.Observaciones.Length >= 254 ? 253 : pago.Observaciones.Length);
var pagar = pago.MontoPago
payment.CashAccount = pago.TipoMercado == TipoMercado.Exportacion ? "_SYS00000000123" : CodigoCuentaContableRedondeo;
payment.CashSum = (double)0.01;
var line = 0;
foreach (var pagoFactura in pago.PagoFacturas)
{
var factura = pagoFactura.FacturaCliente;
var folio = "";
var monto = 0m;
folio = factura.FolioSAP;
monto = pagoFactura.Monto
if (line != 0)
payment.Invoices.Add();
payment.Invoices.DocEntry = int.Parse(folio);
payment.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice; //BoRcptInvTypes.it_JournalEntry Así se indica que es una poliza
payment.Invoices.SumApplied = (double)monto;
line++;
}
// add the journal entry on the payment
if (line != 0)
payment.Invoices.Add();
payment.Invoices.DocEntry = int.Parse(polizaAnticipo);
payment.Invoices.InvoiceType = BoRcptInvTypes.it_JournalEntry; //Así se indica que es una poliza
payment.Invoices.SumApplied = -(double)pago.Anticipado;
line++;
var status = payment.Add();
I hope that you can help me
i'm usgin .net and DI API 9.0