changing to a module usable by flaskfdx
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/bin/python
|
||||
"""
|
||||
process fdx excel files into existing sqlite3 database
|
||||
usage fdxtools TYPE INFILE DATABASE where TYPE is the report type, ie dsw
|
||||
INFILE is an excel file, DATABASE is an sqlite file
|
||||
standalone usage fdxtools TYPE INFILE DATABASE where TYPE is the
|
||||
report type, ie dsw, INFILE is an excel file, DATABASE is an sqlite file
|
||||
"""
|
||||
|
||||
import sys
|
||||
@@ -29,7 +29,7 @@ def appendLedger(conn, table, values):
|
||||
c.execute('INSERT INTO {} VALUES ({})'.format(table, holders), values)
|
||||
conn.commit()
|
||||
|
||||
def extractValues(srcSheet, conn, reportDate):
|
||||
def extractDsw(srcSheet, conn, reportDate):
|
||||
"""
|
||||
get dsw data from srcSheet and call appendLedger with values
|
||||
"""
|
||||
@@ -108,6 +108,7 @@ def getDate(srcSheet):
|
||||
def main():
|
||||
# get filename and database rom cmdline
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("type")
|
||||
parser.add_argument("inFile")
|
||||
parser.add_argument("database")
|
||||
args = parser.parse_args()
|
||||
@@ -127,7 +128,7 @@ def main():
|
||||
if checkDate(conn, reportDate):
|
||||
print("we have already processed " + reportDate)
|
||||
else:
|
||||
extractValues(srcSheet, conn, reportDate)
|
||||
extractDsw(srcSheet, conn, reportDate)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user