accounting/accounting/settledate.py
2024-09-22 12:27:44 +08:00

29 lines
771 B
Python

from appPublic.timeUtils import is_match_pattern
from sqlor.sor import SQLor
from sqlor.dbpools import DBPools
from accounting.const import *
async def is_provider_settle_date(strdate:str,
providerid:str,
sor:SQLor=None) -> bool:
async def f(sor:SQLor, strdate:str, providerid:str):
sql = """select * from provider where orgid=${providerid}$"""
recs = await sor.sqlExe(sql, {'providerid':providerid})
if len(recs) == 0:
return False
pattern = recs[0]['settle_datep']
if pattern is None:
return False
return is_match_pattern(pattern, strdate)
if sor:
return await f(sor, strdate, providerid)
db = DBPools()
async with db.sqlorContext(DBNAME()) as sor:
return await f(sor, strdate, providerid)