Skip to content

schinke/margin_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Biopartner Price Comparison (getButik v4)

This folder contains a small tool that helps an organic store compare:

  • Biopartner recommended sales prices (UVP) from a Biopartner Excel (.xlsx) file
  • with your current getButik v4 prices from a getButik “Artikel-Export (CSV)”

It then creates a new CSV report showing which items have different prices and proposes a new price based on simple margin rules.


What you need (overview)

  1. A computer (this guide is written for macOS. Other operating systems should work with minor differences).
  2. Python 3 installed.
  3. The current Biopartner Excel price list saved into the data/ folder.
  4. A getButik v4 article export saved as data/pos_export.csv.
  5. (Optional) An exceptions file data/exceptions.csv where you can define fixed margins for specific products.

Important: enable “Artikel-Export (CSV)” in getButik

This project needs a CSV export from getButik.

If you do not see an export option called “Artikel-Export (CSV)” (or similar), ask your getButik software provider (Dublin IT) to enable the feature for your installation.

Without this export, the tool cannot read your POS prices.


Install Python

If you are not sure whether Python is installed, open Terminal (Applications → Utilities → Terminal) and type:

  • python3 --version

If you get an error, install Python 3:

After installation, open a new Terminal window and check again:

  • python3 --version

Files and folders (what goes where)

Input files (you provide)

Put these files into the data/ folder:

  1. Biopartner Excel file (.xlsx)

    • Example name: 20260125_Bestellliste_Gesamtsortiment_123456.xlsx
    • The script automatically searches data/ and uses the newest matching .xlsx file.
  2. getButik export (CSV)

    • Must be named exactly: pos_export.csv
    • Must be located at: data/pos_export.csv

Optional input: exceptions

  • data/exceptions.csv

If the file does not exist, the script creates it automatically with this header:

  • Artikel-ID;Marge

You can then add lines like:

  • 123456;1.35

Meaning: for Artikel-ID 123456, always calculate the sales price using margin 1.35.

Output files (created automatically)

After running, the script writes a new CSV into data/ with a timestamp, e.g.:

  • data/price_comparison_20260126_150128.csv

Step 1 — Export the CSV from getButik v4

In getButik v4, use the enabled feature Artikel-Export (CSV).

When exporting, ensure (as best as possible) that:

  • The file is a CSV
  • The separator is semicolon (;) (common for DACH exports)
  • The export includes at least these columns (names may vary slightly):
    • Art.-Nr.
    • Artikel-ID
    • Bezeichnung
    • EP (purchase price)
    • UVP or Preis (sales price)
    • Einheit
    • Status
    • Anzahl (stock)

Then save the export as:

  • data/pos_export.csv

Step 2 — Put the Biopartner Excel file into data/

Download or copy the latest Biopartner Excel file into the data/ folder.

No special filename is required; the script looks for an .xlsx file with a recognizable header.


Step 3 — Run the tool

One-time setup (recommended)

Use a virtual environment so nothing else on your Mac is affected.

  1. Open Terminal
  2. Go into this project folder
  3. Create and activate a virtual environment
  4. Install required packages

This project uses pandas, which must be installed for the script to work.

Run

Run the script with Python 3. In Terminal, navigate to this project folder and run:

python3 biopartner_price_comparison.py

When it finishes, it prints a short summary and writes the result CSV into data/.


What the script does (in plain language)

  • Reads the latest Biopartner .xlsx from data/
  • Reads your getButik export from data/pos_export.csv
  • Only keeps POS rows where:
    • Einheit is Stück
    • Status is 1 (active)
  • Matches products by article number
  • Creates a report only for items where your sales price differs from Biopartner UVP
  • Proposes a new price using margin ranges defined in 'data/margin_rules.csv':
  • Allows manual margin overrides in data/exceptions.csv

Troubleshooting

“POS export file not found … data/pos_export.csv”

  • Make sure the getButik export is saved as data/pos_export.csv (exact spelling)

“No Biopartner file found in the data folder”

  • Put the Biopartner .xlsx into data/
  • Ensure it is a real Excel file (.xlsx), not a PDF or older .xls

Wrong characters (umlauts) in the CSV

The script reads the getButik CSV with Windows encoding (cp1252), which is common for such exports.

If your export uses UTF-8 instead, the file can still be used, but the script may need a small adjustment.


Data privacy

Your product and pricing data stays local on your computer. The script reads files from data/ and produces a report CSV in the same folder.


Support / changes

If you need changes (different margin logic, different export format, additional columns in the report), ask whoever maintains this repository.

About

calculate sales prices for getbutik / biopartner shops

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages