The function qty_docs_based calculates the sum of quantities for a specific product, taking into account selected documents.

Parameters:
product_aa INTEGER: The identifier of the product for which the quantity needs to be calculated.
add_docs VARCHAR(1000): Line number of documents, separated by commas, based on which the quantity is added.
deduct_docs VARCHAR(1000): Line number of documents, separated by commas, based on which the quantity is subtracted.

Returns:
FLOAT: The calculated quantity of the specific product based on the provided documents.

Χρήση:
To use the function, you need to specify the product line number and the documents that add to and subtract from the quantity.

Example:

This example calculates the quantity for the product with line number 123, adding quantities from documents 1, 2, 3, and subtracting quantities from documents 4, 5, 6.