seit-p 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seit_p-1.0.0/PKG-INFO +28 -0
- seit_p-1.0.0/seit-p/__init__.py +1 -0
- seit_p-1.0.0/seit-p/invoice.py +80 -0
- seit_p-1.0.0/seit_p.egg-info/PKG-INFO +28 -0
- seit_p-1.0.0/seit_p.egg-info/SOURCES.txt +8 -0
- seit_p-1.0.0/seit_p.egg-info/dependency_links.txt +1 -0
- seit_p-1.0.0/seit_p.egg-info/requires.txt +3 -0
- seit_p-1.0.0/seit_p.egg-info/top_level.txt +1 -0
- seit_p-1.0.0/setup.cfg +4 -0
- seit_p-1.0.0/setup.py +25 -0
seit_p-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seit-p
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: This package can be used to convert Excel invoices to PDF invoices.
|
|
5
|
+
Home-page: https://randomguys.com
|
|
6
|
+
Author: Some Random Guy
|
|
7
|
+
Author-email: TheRandomGuy@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: invoice,excel,pdf
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Requires-Dist: pandas
|
|
19
|
+
Requires-Dist: fpdf
|
|
20
|
+
Requires-Dist: openpyxl
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: classifier
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: keywords
|
|
26
|
+
Dynamic: license
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .invoice import generate
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from fpdf import FPDF
|
|
5
|
+
import glob
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
def generate(invoices_path, pdfs_path, image_path, product_id, product_name,
|
|
9
|
+
amount_purchased, price_per_unit, total_price):
|
|
10
|
+
"""
|
|
11
|
+
This function converts invoice Excel files into PDF invoices.
|
|
12
|
+
:param invoices_path:
|
|
13
|
+
:param pdfs_path:
|
|
14
|
+
:param image_path:
|
|
15
|
+
:param product_id:
|
|
16
|
+
:param product_name:
|
|
17
|
+
:param amount_purchased:
|
|
18
|
+
:param price_per_unit:
|
|
19
|
+
:param total_price:
|
|
20
|
+
:return:
|
|
21
|
+
"""
|
|
22
|
+
filepaths = glob.glob(f"{invoices_path}/*.xlsx")
|
|
23
|
+
|
|
24
|
+
for filepath in filepaths:
|
|
25
|
+
|
|
26
|
+
pdf = FPDF(orientation="P", unit="mm", format="A4")
|
|
27
|
+
pdf.add_page()
|
|
28
|
+
|
|
29
|
+
filename = Path(filepath).stem
|
|
30
|
+
|
|
31
|
+
invoice_nr, date = filename.split("-")
|
|
32
|
+
|
|
33
|
+
pdf.set_font(family="Times", size=16, style="B")
|
|
34
|
+
pdf.cell(w=50, h=8, txt=f"Invoice nr. {invoice_nr}", ln=1)
|
|
35
|
+
|
|
36
|
+
pdf.set_font(family="Times", size=16, style="B")
|
|
37
|
+
pdf.cell(w=50, h=8, txt=f"Date. {date}", ln=1)
|
|
38
|
+
|
|
39
|
+
df = pd.read_excel(filepath, sheet_name="Sheet 1")
|
|
40
|
+
|
|
41
|
+
# Add header in table
|
|
42
|
+
columns = list(df.columns)
|
|
43
|
+
columns = [item.replace("_", " ").title() for item in columns]
|
|
44
|
+
pdf.set_font(family="Times", size=10, style="B")
|
|
45
|
+
pdf.set_text_color(80, 80, 80)
|
|
46
|
+
pdf.cell(w=30, h=8, txt=columns[0], border=1)
|
|
47
|
+
pdf.cell(w=70, h=8, txt=columns[1], border=1)
|
|
48
|
+
pdf.cell(w=30, h=8, txt=columns[2], border=1)
|
|
49
|
+
pdf.cell(w=30, h=8, txt=columns[3], border=1)
|
|
50
|
+
pdf.cell(w=30, h=8, txt=columns[4], border=1, ln=1)
|
|
51
|
+
|
|
52
|
+
for index, row in df.iterrows():
|
|
53
|
+
# Add rows
|
|
54
|
+
pdf.set_font(family="Times", size=10)
|
|
55
|
+
pdf.set_text_color(80, 80, 80)
|
|
56
|
+
pdf.cell(w=30, h=8, txt=str(row[product_id]), border=1)
|
|
57
|
+
pdf.cell(w=70, h=8, txt=str(row[product_name]), border=1)
|
|
58
|
+
pdf.cell(w=30, h=8, txt=str(row[amount_purchased]), border=1)
|
|
59
|
+
pdf.cell(w=30, h=8, txt=str(row[price_per_unit]), border=1)
|
|
60
|
+
pdf.cell(w=30, h=8, txt=str(row[total_price]), border=1, ln=1)
|
|
61
|
+
|
|
62
|
+
total_sum = df[total_price].sum()
|
|
63
|
+
pdf.set_font(family="Times", size=10)
|
|
64
|
+
pdf.cell(w=30, h=8, txt="", border=1)
|
|
65
|
+
pdf.cell(w=70, h=8, txt="", border=1)
|
|
66
|
+
pdf.cell(w=30, h=8, txt="", border=1)
|
|
67
|
+
pdf.cell(w=30, h=8, txt="", border=1)
|
|
68
|
+
pdf.cell(w=30, h=8, txt=str(total_sum), border=1, ln=1)
|
|
69
|
+
|
|
70
|
+
pdf.set_font(family="Times", size=10, style="BUI")
|
|
71
|
+
pdf.cell(w=30, h=8, txt=f"The total price is {total_sum}", ln=1)
|
|
72
|
+
|
|
73
|
+
pdf.set_font(family="Times", size=14, style="B")
|
|
74
|
+
pdf.cell(w=30, h=8, txt="PythonHow")
|
|
75
|
+
pdf.image(image_path, w=10)
|
|
76
|
+
|
|
77
|
+
if not os.path.exists(pdfs_path):
|
|
78
|
+
os.makedirs(pdfs_path)
|
|
79
|
+
pdf.output(f"{pdfs_path}/{filename}.pdf")
|
|
80
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seit-p
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: This package can be used to convert Excel invoices to PDF invoices.
|
|
5
|
+
Home-page: https://randomguys.com
|
|
6
|
+
Author: Some Random Guy
|
|
7
|
+
Author-email: TheRandomGuy@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: invoice,excel,pdf
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Requires-Dist: pandas
|
|
19
|
+
Requires-Dist: fpdf
|
|
20
|
+
Requires-Dist: openpyxl
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: classifier
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: keywords
|
|
26
|
+
Dynamic: license
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
seit-p
|
seit_p-1.0.0/setup.cfg
ADDED
seit_p-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
setup(
|
|
5
|
+
name = 'seit-p', #* Your package will have this name
|
|
6
|
+
packages = ['seit-p'], #* Name the package again
|
|
7
|
+
version = '1.0.0', #* To be increased every time your change your library
|
|
8
|
+
license='MIT', # Type of license. More here: https://help.github.com/articles/licensing-a-repository
|
|
9
|
+
description = 'This package can be used to convert Excel invoices to PDF invoices.', # Short description of your library
|
|
10
|
+
author = 'Some Random Guy', # Your name
|
|
11
|
+
author_email = 'TheRandomGuy@gmail.com', # Your email
|
|
12
|
+
url = 'https://randomguys.com', # Homepage of your library (e.g. github or your website)
|
|
13
|
+
keywords = ['invoice', 'excel', 'pdf'], # Keywords users can search on pypi.org
|
|
14
|
+
install_requires=['pandas', 'fpdf', 'openpyxl'], # Other 3rd-party libs that pip needs to install
|
|
15
|
+
classifiers=[
|
|
16
|
+
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
|
|
17
|
+
'Intended Audience :: Developers', # Who is the audience for your library?
|
|
18
|
+
'Topic :: Software Development :: Build Tools',
|
|
19
|
+
'License :: OSI Approved :: MIT License', # Type a license again
|
|
20
|
+
'Programming Language :: Python :: 3.8', # Python versions that your library supports
|
|
21
|
+
'Programming Language :: Python :: 3.9',
|
|
22
|
+
'Programming Language :: Python :: 3.10',
|
|
23
|
+
'Programming Language :: Python :: 3.11',
|
|
24
|
+
],
|
|
25
|
+
)
|