Esta documentación describe las funciones globales de la codeunit aqaepr Extend Documents, para que los partners puedan reutilizarlas al extender reports de venta de Dynamics 365 Business Central (factura, abono, albarán, devolución, etc.).
La codeunit genera un buffer temporal de tipo aqaepr Buffer con el detalle EPR calculado para documentos y líneas de venta.
Las funciones públicas de esta codeunit permiten obtener, para un documento o línea de venta:
El resultado siempre se devuelve en un record temporal de la tabla aqaepr Buffer.
Todas las funciones públicas se llaman igual: AdderitEPRSalesValues, pero están sobrecargadas según el tipo de documento/línea recibido.
Tipo de entrada | Procedimiento |
Documento de venta | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesHeader: Record «Sales Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Línea de venta | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesLine: Record «Sales Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Factura de venta registrada | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesInvHeader: Record «Sales Invoice Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Línea factura de venta registrada | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesInvLine: Record «Sales Invoice Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Abono de venta registrado | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesCrMHeader: Record «Sales Cr.Memo Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Línea de abono de venta registrado | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesCrMLine: Record «Sales Cr.Memo Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Albarán de venta registrado | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesShipmentHeader: Record «Sales Shipment Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Línea de albarán de venta registrado | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesShipmentLine: Record «Sales Shipment Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Recepción de devolución registrada | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; ReturnReceiptHeader: Record «Return Receipt Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Línea de recepción de devolución registrada | AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; ReturnReceiptLine: Record «Return Receipt Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean) |
Buffer temporal de salida.
Importante: Cada procedimiento hace Clear(aqaEPRTempBuffer) al inicio, por lo que el buffer se reconstruye desde cero en cada llamada.
Indica qué niveles de envase se deben calcular:
Ejemplo:
Se utiliza al calcular la cantidad de envases a partir de la cantidad base del producto.
Internamente se apoya en aqa_epr Management.GetQtyfromItem(…):
Esto afecta al número de envases calculado cuando la relación entre cantidad base y unidad de medida del envase no es exacta.
En la implementación actual de esta codeunit, este parámetro no se utiliza.
Se mantiene en la firma pública, pero actualmente no altera el cálculo ni el resultado del buffer.
La función:
La función:
Las funciones rellenan principalmente estos campos del buffer temporal:
Campo | Description |
Document No. | Nº de documento origen |
Document Line No. | Nº de línea origen |
Container Category | Categoría EPR aplicada |
Container Type | Tipo de envase: primario, secundario o terciario |
Material Code | Código de material del BOM del envase |
Recycled % | % reciclado del material |
Quantity | Cantidad base de producto de la línea |
Material Weight | Peso unitario del material definido en el Package BOM |
Material Quantity | Cantidad de envases/material calculado para la línea |
Dangerous | Indica si el artículo está marcado como peligroso |
Unit Price | Tarifa por kg encontrada para la fecha de registro |
Amount | Importe EPR calculado |
Cuando existe tarifa SCRAP aplicable, el importe se calcula así:
Amount = Material Weight * Material Quantity * Unit Price * (1 – (Recycled % / 100))
Si no se encuentra tarifa válida, Unit Price y Amount permanecen a 0.
No se calculan líneas de tipo recurso, cuenta contable, comentario, etc.
Cuando el campo aqaepr EPR Category de la línea está en blanco, la codeunit toma la categoría del Item.
Si un nivel no está marcado a true, no se generarán líneas de buffer para ese nivel.
Para cada nivel seleccionado, la codeunit busca:
Si esa configuración no existe, no habrá líneas para ese nivel.
Esto ocurre cuando el BOM del envase tiene varios materiales o varios niveles de envase seleccionados.
Para las líneas registradas se usa Posting Date de la línea. En documentos de venta, la codeunit calcula el campo antes de valorar el buffer.
La valoración se busca por:
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesHeader: Record «Sales Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
Cuando el report trabaja a nivel de cabecera de documento de venta y necesita obtener el detalle EPR de todas sus líneas válidas.
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesLine: Record «Sales Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
Cuando el report ya está posicionado en una línea concreta y solo necesita calcular el EPR de esa línea.
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesInvHeader: Record «Sales Invoice Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
For reports de factura de venta registrada cuando se necesita el total de detalle EPR del documento.
Mismo patrón que Sales Header, pero recorriendo Sales Invoice Line.
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesInvLine: Record «Sales Invoice Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
Para ampliar reports de factura registrada a nivel de línea.
Calcula el EPR de una única línea registrada y valora el resultado con Sales Invoice Line.»Posting Date».
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesCrMHeader: Record «Sales Cr.Memo Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
For reports de abono de venta registrado a nivel de cabecera.
Mismo patrón que Sales Header, pero recorriendo Sales Cr.Memo Line.
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesCrMLine: Record «Sales Cr.Memo Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
Para ampliar reports de abono registrado a nivel de línea.
Calcula el EPR de una única línea registrada y valora el resultado con Sales Cr.Memo Line.»Posting Date».
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesShipmentHeader: Record «Sales Shipment Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
For reports de albarán de venta registrado a nivel de cabecera.
Mismo patrón que Sales Header, pero recorriendo Sales Shipment Line.
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; SalesShipmentLine: Record «Sales Shipment Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
Para ampliar reports de albarán registrado a nivel de línea.
Calcula el EPR de una única línea registrada y valora el resultado con Sales Shipment Line.»Posting Date».
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; ReturnReceiptHeader: Record «Return Receipt Header»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
For reports de recepción de devolución registrada a nivel de cabecera.
Mismo patrón que Sales Header, pero recorriendo Return Receipt Line.
AdderitEPRSalesValues(var aqaEPRTempBuffer: Record «aqaepr Buffer» temporary; ReturnReceiptLine: Record «Return Receipt Line»; IncludePackage: array[3] of Boolean; IncludeHighLevel: Boolean; FindVendor: Boolean)
Para ampliar reports de recepción de devolución registrada a nivel de línea.
Calcula el EPR de una única línea registrada y valora el resultado con Return Receipt Line.»Posting Date».
var
ExtendDocuments: Codeunit «aqaepr Extend Documents»;
TempBuffer: Record «aqaepr Buffer» temporary;
IncludePackage: array[3] of Boolean;
begin
IncludePackage[1] := true; // Primario
IncludePackage[2] := false;
IncludePackage[3] := false;
ExtendDocuments.AdderitEPRSalesValues(
TempBuffer,
«Sales Invoice Header»,
IncludePackage,
false,
false);
if TempBuffer.FindSet() then
repeat
// Imprimir o acumular datos EPR
// TempBuffer.»Material Code»
// TempBuffer.»Material Quantity»
// TempBuffer.Amount
until TempBuffer.Next() = 0;
end;
6. Si se quieren incluir varios niveles de envase, activar las posiciones adecuadas de IncludePackage.
7. Si el cálculo esperado depende del redondeo de envases, revisar el valor de IncludeHighLevel.
Para extensiones de reports de partners:
En general:
Para extensiones de reports de partners:
Si precisas de nuestra ayuda o tienes dudas, contáctanos vía el formulario.
También puedes llamarnos a los teléfonos indicados a continuación o enviarnos un correo.
adderit@adderit.es
Trafalgar street, nº 4, 5º B,
08010 Barcelona
(+34) 938 323 134
Paseo de la Castellana (Azca) 79, 28046 Madrid
(+34) 910 971 702
| Cookie | Duration | Description |
|---|---|---|
| cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category. |
| cookielawinfo-checkbox-analytics | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Analytics" category. |
| cookielawinfo-checkbox-functional | 1 year | The GDPR Cookie Consent plugin sets the cookie to record the user consent for the cookies in the category "Functional". |
| cookielawinfo-checkbox-necessary | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Necessary" category. |
| cookielawinfo-checkbox-others | 1 year | Set by the GDPR Cookie Consent plugin, this cookie stores user consent for cookies in the category "Others". |
| cookielawinfo-checkbox-performance | 1 year | Set by the GDPR Cookie Consent plugin, this cookie stores the user consent for cookies in the category "Performance". |
| CookieLawInfoConsent | 1 year | CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie. |
| elementor | never | The website's WordPress theme uses this cookie. It allows the website owner to implement or change the website's content in real-time. |
| rc::a | never | This cookie is set by the Google recaptcha service to identify bots to protect the website against malicious spam attacks. |
| rc::c | session | This cookie is set by the Google recaptcha service to identify bots to protect the website against malicious spam attacks. |
| Cookie | Duration | Description |
|---|---|---|
| yt-remote-cast-installed | session | The yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video. |
| yt-remote-connected-devices | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
| yt-remote-device-id | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
| yt-remote-fast-check-period | session | The yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos. |
| yt-remote-session-app | session | The yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player. |
| yt-remote-session-name | session | The yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video. |
| ytidb::LAST_RESULT_ENTRY_KEY | never | The cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future. |
| Cookie | Duration | Description |
|---|---|---|
| ANONCHK | 10 minutes | Indica si el MUID se transfiere a ANID, una cookie utilizada para publicidad. Clarity no usa ANID, por lo que siempre se establece en 0. |
| CLID | 1 year | Microsoft Clarity’s cookies send us non-personally identifiable information such as session data. |
| MR | 7 days | Indica si se debe actualizar el MUID. |
| MUID | 1 year | Identifica navegadores web únicos que visitan sitios de Microsoft. Estas cookies se utilizan para publicidad, análisis del sitio y otros fines operativos. |
| SM | 90 days | Se utiliza para sincronizar el MUID en los dominios de Microsoft. |
| _clck | 1 year | Mantiene el ID de usuario de Clarity y las preferencias únicas para ese sitio. Asegura que las visitas posteriores al mismo sitio se atribuyan al mismo ID de usuario. |
| _clsk | 24 hours | Conecta múltiples vistas de página de un usuario en una sola grabación de sesión de Clarity. |
| Cookie | Duration | Description |
|---|---|---|
| VISITOR_INFO1_LIVE | 6 months | YouTube sets this cookie to measure bandwidth, determining whether the user gets the new or old player interface. |
| VISITOR_PRIVACY_METADATA | 6 months | YouTube sets this cookie to store the user's cookie consent state for the current domain. |
| YSC | session | Youtube sets this cookie to track the views of embedded videos on Youtube pages. |
¿El IEPNR te preocupa?
TENEMOS SOLUCIÓN
El impuesto sobre plásticos no reutilizables está en vigor desde el 1 de enero de 2023.
Desde Adderit hemos desarrollado una extensión para Microsoft Dynamics 365 Business Central para que puedas estar al día con la hacienda.
Te guiamos para que puedas registrar las operaciones que realices sujetas al nuevo impuesto
sin problemas ni contratiempos.