Skip to content

Commit

Permalink
updated myf_monthly.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tedlaz committed Sep 16, 2019
1 parent 826c2e3 commit 86c1e52
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ celerybeat-schedule
.venv
env/
venv/
.venv/
ENV/
env.bak/
venv.bak/
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# tedutil

Utility functions

[![PyPI version](https://badge.fury.io/py/tedutil.svg)](https://badge.fury.io/py/tedutil) [![Build Status](https://travis-ci.org/tedlaz/tedutil.svg?branch=master)](https://travis-ci.org/tedlaz/tedutil) [![Coverage Status](https://coveralls.io/repos/github/tedlaz/tedutil/badge.svg?branch=master)](https://coveralls.io/github/tedlaz/tedutil?branch=master) [![codecov](https://codecov.io/gh/tedlaz/tedutil/branch/master/graph/badge.svg)](https://codecov.io/gh/tedlaz/tedutil)

# Προσοχή !!!

Υπάρχουν σοβαρές αλλαγές στο αρχείο osyk.zip του ΕΦΚΑ. Αυτό έχει σαν αποτέλεσμα να μην είναι αξιόπιστο πλέον το συγκεκριμένο αρχείο.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


setup(name='tedutil',
version='0.9.5',
version='0.9.6',
description='Various utility functions',
long_description='Various utility functions',
url='https://github.com/tedlaz/tedutil',
Expand Down
35 changes: 26 additions & 9 deletions tedutil/myf.py → tedutil/myf_monthly.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Για να χρησιμοποιηθεί με την sqlite μισθοδοσία θα πρέπει να υπάρχουν τα
""" Δημιουργία μηνιαίου αρχείου Φόρου Μισθωτών Υπηρεσιών
Για να χρησιμοποιηθεί με την sqlite μισθοδοσία θα πρέπει να υπάρχουν τα
παρακάτω views :
CREATE VIEW fmy AS
Expand Down Expand Up @@ -27,7 +29,7 @@
pol as poli, odo as odos, num as arit, tk
from m12_co
"""

import os
from tedutil.fixed_size_file import ROW
from tedutil.fixed_size_file import COL
from tedutil.fixed_size_file import RowTyp
Expand Down Expand Up @@ -108,21 +110,36 @@ def create_monthly_fmy(creation_date, year, data):
return doc.render()


def create_myf(etos, minas, trejimo=None):
def myf_monthly(etos, minas, dbfile, coname, trejimo=None):
"""
etos: Χρήση
minas: Μήνας (τιμές από 1 έως 12)
coname: Συντομογραφία ονόματος εταιρίας
trejimo: Ημερομηνία δημιουργίας που θα φαίνεται στο αρχείο
Αν είναι None τότε θα πάρει την τρέχουσα ημερομηνία
"""
if not os.path.isfile(dbfile):
print('file %s does not exist' % dbfile)
return
dirname = os.path.dirname(dbfile)
trejimo = trejimo or today()
dat = {}
fil = "/home/ted/Documents/myf-miniaia/mis.m13"
# fil = "/home/ted/Documents/myf-miniaia/mis.m13"
sql1 = "SELECT * FROM codata"
dat['stoixeia'] = get_dict(sql1, fil)[0] # Only one line
dat['stoixeia'] = get_dict(sql1, dbfile)[0] # Only one line
dat['stoixeia']['year'] = etos
dat['stoixeia']['month'] = minas
sql2 = "SELECT * FROM fmy where xrisi = '%s' and id=%s" % (etos, minas)
dat['details'] = get_dict(sql2, fil)
dat['details'] = get_dict(sql2, dbfile)
result = create_monthly_fmy(trejimo, etos, dat)
tmina = '%s' % minas if minas >= 10 else '0%s' % minas
outfile = '/home/ted/Downloads/akti%s%s.zip' % (etos, tmina)
create_zip(result, outfile)
# outfile = '/home/ted/Downloads/akti%s%s.zip' % (etos, tmina)
outfile = f'myf-{coname}-{etos}{tmina}.zip'
outpath = os.path.join(dirname, outfile)
print(outpath)
create_zip(result, outpath)


if __name__ == "__main__":
create_myf(etos=2019, minas=2)
fil = "/home/ted/Documents/myf-miniaia/mis.m13"
myf_monthly(etos=2019, minas=2, dbfile=fil)

0 comments on commit 86c1e52

Please sign in to comment.