Example #1
0
def loadfiles():
    curqc = (now().add(months=-1)) % "%Q"
    for file in ROOT / '分行上报':
        if file.lsuffix.startswith('.xls'):
            try:
                loadfile(file, curqc=curqc)
            except Exception as e:
                print(e)
Example #2
0
def show(year):
    year = year or str(now().year)
    sql = 'select * from jqb where year=?'
    obj = fetchone(sql, [year])
    if obj:
        print(f'年份: {obj[0]}')
        if obj[2]:
            print(f'初始AB户标志:{obj[2]}')
        print(obj[1])
Example #3
0
def export(begindate):
    from orange.xlsx import Book
    begindate = datetime(begindate or now() + 5) % '%Y%m%d'
    data = iter_(begindate)
    data = [x for x in data if x[0] >= begindate]
    if data:
        fn = f'假期参数表{begindate}.xlsx'
        with Book(fn) as rpt:
            rpt.add_table('A1',
                          sheet='假期参数表',
                          columns=Headers,
                          autofilter=False,
                          data=data)
Example #4
0
 def _(path: Path):
     if drop:
         execute(f'delete from {table}')
     if callable(proc):
         data = proc(path, **kw)
     else:
         data = path.iter_csv(**kw)
     if period:
         execute('insert or replace into param_period values(?,?,?)',
                 [table, period, now() % '%F %T'])
     insert(table, fields=fields, data=data, method=method)
     if callable(exec):
         exec()
     print(f'{path.name} 导入成功')
Example #5
0
def mailto():
    from orange.xlsx import Book
    from orange.mail import Mail
    begindate = datetime(now() + 5) % '%Y%m%d'
    data = iter_(begindate)
    data = [x for x in data if x[0] >= begindate]
    if data:
        filename = f'假期参数表{begindate}.xlsx'

        def writer(fn):
            with Book(fn) as rpt:
                rpt.add_table('A1',
                              sheet='假期参数表',
                              columns=Headers,
                              autofilter=False,
                              data=data)

        mail = Mail(sender='*****@*****.**',
                    to='*****@*****.**',
                    subject='假期表参数',
                    body='假期表参数,请审阅!')
        mail.attach(filename, writer=writer)
        mail.post()
        print('发送邮件成功!')