> ## Documentation Index
> Fetch the complete documentation index at: https://docs.procuros.io/llms.txt
> Use this file to discover all available pages before exploring further.

# How to set up Batches

> Step by step guide to setting up batches in Xentral

## What are Batches?

Batch management enables product traceability and is particularly important in the food and pharmaceutical industries.

### Setting Up Batches

<Steps>
  <Step title="Activate batches in Xentral">
    First, navigate to batch management in the Xentral system settings.

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/Chargen(1).jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=ebcabbcaa7bab25bc4d03b37567d2ab1" alt="Chargen (1).jpg" width="1920" height="1080" data-path="Chargen(1).jpg" />
  </Step>

  <Step title="New Report">
    Create a new Report and name it: Procuros: Gelieferte Chargeninformationen

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/Chargen11.jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=438e14854bc6438986c41d34e8f23843" alt="Chargen 11.jpg" width="1920" height="1080" data-path="Chargen11.jpg" />
  </Step>

  <Step title="New Variable">
    Create a new variable with the following values:

    * the variable name must be LIEFERSCHEINID
    * the ‘default value’ must be an ID from a delivery note that contains batches:

      * to find this ID, go to a delivery note that contains batches that already exist in your system
      * open this delivery note
      * copy the ID from the URL and enter it in the Default value field

          <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/Chargen7.jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=f5551db089ea2dec7291ef580816c54c" alt="Chargen 7.jpg" width="1920" height="1080" data-path="Chargen7.jpg" />
  </Step>

  <Step title="Copy&Paste the SQL-Code">
    Copy the following SQL-Code-Snippet and paste it into the SQL Field. Click the play-Button afterwards.

    ```
    SELECT *FROM mhd_log WHERE doctype = 'lieferschein' AND doctypeid = '{LIEFERSCHEINID}'
    ```

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/Chargen8.jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=2932219acf0ecb25fa1dc816ab4d8d06" alt="Chargen 8.jpg" width="1920" height="1080" data-path="Chargen8.jpg" />
  </Step>

  <Step title="Generate columns">
    Click on "generate columns"

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/Chargen9.jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=57613c9ad92945fb2ee1aa9f71baeb6e" alt="Chargen 9.jpg" width="1920" height="1080" data-path="Chargen9.jpg" />
  </Step>

  <Step title="API Access">
    Go over to the "Transfer"-Tab and set the following API Access settings:

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/Chargen10.jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=5e740ff735a9ce52726154af0508bb25" alt="Chargen 10.jpg" width="1920" height="1080" data-path="Chargen10.jpg" />
  </Step>

  <Step title="Send ID to Procuros">
    Open the report and you will find the ID in the URL (e.g. ...\&id=170). This number must be sent to Procuros. If you are not sure which number to use, simply send us the entire link. Send an e-mail to [edi@procuros.io](mailto:edi@procuros.io) - we will then store this ID in our system.
  </Step>
</Steps>

### Managing Best-Before Dates

Closely connected to batch management is the management of best-before dates:

<Steps>
  <Step title="Activate BBD management">
    Activate the management of best-before dates in the article settings

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/MHD1(1).jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=d113159fed3d96aed7f00a0f9e14ffa9" alt="MHD1 (1).jpg" width="1920" height="1080" data-path="MHD1(1).jpg" />
  </Step>

  <Step title="Set the Dates">
    Navigate to Best Before + Batch and enter the number of items, the corresponding best-before date and the desired storage location of the item.

    <img src="https://mintcdn.com/procuros-c35f505c/WEWxE_97bveYqyyM/MHD3(2).jpg?fit=max&auto=format&n=WEWxE_97bveYqyyM&q=85&s=9f97c72eac34f3489317e12ffc04aedb" alt="MHD3 (2).jpg" width="1920" height="1080" data-path="MHD3(2).jpg" />
  </Step>
</Steps>

<Note>
  The correct management of batches and best-before dates is particularly important for companies subject to legal traceability obligations.
</Note>
