Bio-Matric Device Import Data from SQL Server To ERPNext

PHOTO EMBED

Wed Sep 25 2024 12:26:15 GMT+0000 (Coordinated Universal Time)

Saved by @Taimoor

Bio-Matric Device Import Data from SQL Server To ERPNex


+++++++++++++
Open Terminal.
+++++++++++++
  
Cd frappe-bench
sudo apt update
sudo apt install python3



1- // Create Virtual Environment:
python3 -m venv venv
source venv/bin/activate

2- // Install Dependencies: (Python libraries)
pip install pyodbc requests

3- curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
   curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list

4- sudo apt-get update
5- sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev
6- odbcinst -q -d -n "ODBC Driver 17 for SQL Server"



3- // Configure SQL Server:
  // Ensure your SQL Server allows remote connections.
 // Install ODBC Driver for SQL Server:
sudo apt-get install unixodbc-dev msodbcsql17

4- //Generate an API Key and API Secret for an ERPNext user (like Administrator).

5- // Write the Python Script:
  //Create a Python file (erpnext_sql.py) with the code you provided.
  //Download or Copy the following Link File and Save.
  https://www.thiscodeworks.com/embed/66f3fc60f4dcb900149d8681
  
6- // Run the Script: (Mannually)
python3 erpnext_sql.py

============================================================
To Run The Script Automatically Install The Following Script:
=============================================================

7- //Automate the Script (Optional):
crontab -e

8- //Add the cron job to run at desired intervals:

30 8 * * * /path/to/your/venv/bin/python3 /path/to/erpnext_sql.py
0 10 * * * /path/to/your/venv/bin/python3 /path/to/erpnext_sql.py
0 18 * * * /path/to/your/venv/bin/python3 /path/to/erpnext_sql.py

//To schedule the script to run at 
8:30 AM, 
10:00 AM, 
6:00 PM
every day, you can set the cron job like this:


content_copyCOPY

Integrate Any Bio-matric Attendance Device with ERPNext OR Import Attendance Log from SQL Server to ERPNexT