on 2025 Jan 06 3:22 PM
Buen dia
podrian ayudarme con el siguiente problema que tengo, por favor, estoy tratando de insertar documentos de proveedores con DI API, pero se me presento un problema al agregar las retenciones al documento que tiene asignadas el proveedor, ya que al momento de agregarlas me agrega valores en negativo en la columna DiscPrcnt, DiscSum y no me calcula correctamente las retenciones, si creo los documentos sin las retenciones el documento se graba correctamente que me estara haciendo falta que por ese motivo me sale de esta manera al utilizar las retenciones. dejo ejemplo del codigo que estoy utilizando.
SBO.Documents oFactProvee = (SBO.Documents)oCompany.GetBusinessObject(SBO.BoObjectTypes.oPurchaseInvoices);
var impuestos = enc.Cells["ImpuestosAplicados"].Value.ToString().Split(',').Select(i => i.Trim()).ToList();
foreach (var impuesto in impuestos)
{
oFactProvee.WithholdingTaxData.WTCode = impuesto;
oFactProvee.WithholdingTaxData.Add();
}
Request clarification before answering.
Hola
por si le sirve a alguien que sea primerizo ya encontre cual era el problema asi como lo tengo esta correcto el problema era que le estaba mandando el total del documento en el campo DocTotal y por eso no me hacia correctamente los calculos, segun entiendo el valor total del documento lo calcula SAP en base al detalle del documento, no es necesario mandar este dato al momento de crear el documento.
SBO.Documents oFactProvee = (SBO.Documents)oCompany.GetBusinessObject(SBO.BoObjectTypes.oPurchaseInvoices);
// Asignar Encabezado
oFactProvee.DiscountPercent = 0;
oFactProvee.DocDate = DataParser.ParseDate(enc.Cells["DocDate"].Value) ?? DateTime.Now;
oFactProvee.DocDueDate = DataParser.ParseDate(enc.Cells["DocDueDate"].Value) ?? DateTime.Now;
oFactProvee.CardCode = CardCode;
oFactProvee.CardName = DataParser.ParseString(enc.Cells["CardName"].Value);
oFactProvee.Confirmed = SBO.BoYesNoEnum.tYES;
oFactProvee.HandWritten = SBO.BoYesNoEnum.tNO;
oFactProvee.NumAtCard = DataParser.ParseString(enc.Cells["NumAtCard"].Value);
//oFactProvee.DocTotal = DataParser.ParseDouble(enc.Cells["DocTotal"].Value);
oFactProvee.Lines.ItemCode = ItemCode;
oFactProvee.Lines.Quantity = DataParser.ParseDouble(dtRow.Cells["Quantity"].Value);
oFactProvee.Lines.PriceAfterVAT = DataParser.ParseDouble(dtRow.Cells["PriceAfterVAT"].Value);
oFactProvee.Lines.Currency = DataParser.ParseString(dtRow.Cells["Currency"].Value);
oFactProvee.Lines.Rate = DataParser.ParseDouble(dtRow.Cells["Rate"].Value);
oFactProvee.Lines.WarehouseCode = WarehouseCode;
//oFactProvee.Lines.TaxCode = TaxCode;
oFactProvee.Lines.InventoryQuantity = DataParser.ParseDouble(dtRow.Cells["InventoryQuantity"].Value);
oFactProvee.Lines.Add();
foreach (var impuesto in impuestos)
{
oFactProvee.WithholdingTaxData.WTCode = impuesto;
oFactProvee.WithholdingTaxData.Add();
}
int result = oFactProvee.Add();
if (result!=0)
{
string error = oCompany.GetLastErrorDescription();
msg = $"Error al Crear el Documento: {error}";
MessageBox.Show($"Error al Crear el Documento: {error}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
fn.InsertarLog(cnnSBO, "Error", DocNum.ToString(), Nit, Proveedor, CardCode, msg);
return;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.