56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
from datetime import datetime
|
|
|
|
|
|
def update_comment_1c(conn, doc_id, comment):
|
|
cursor = conn.cursor()
|
|
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
cursor.execute(
|
|
"""
|
|
UPDATE documents_1c
|
|
SET comment = ?, updated_at = ?
|
|
WHERE id = ?
|
|
""",
|
|
(comment.strip(), now, doc_id),
|
|
)
|
|
conn.commit()
|
|
return cursor.rowcount > 0
|
|
|
|
|
|
def update_comment_sbis(conn, doc_id, comment):
|
|
cursor = conn.cursor()
|
|
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
cursor.execute(
|
|
"""
|
|
UPDATE documents_sbis
|
|
SET comment = ?, updated_at = ?
|
|
WHERE id = ?
|
|
""",
|
|
(comment.strip(), now, doc_id),
|
|
)
|
|
conn.commit()
|
|
return cursor.rowcount > 0
|
|
|
|
|
|
def get_distinct_states_1c(conn):
|
|
rows = conn.execute(
|
|
"""
|
|
SELECT DISTINCT state
|
|
FROM documents_1c
|
|
WHERE state IS NOT NULL AND TRIM(state) != ''
|
|
ORDER BY state COLLATE NOCASE
|
|
"""
|
|
).fetchall()
|
|
return [r[0] for r in rows]
|
|
|
|
|
|
def get_distinct_states_sbis(conn):
|
|
rows = conn.execute(
|
|
"""
|
|
SELECT DISTINCT state
|
|
FROM documents_sbis
|
|
WHERE state IS NOT NULL AND TRIM(state) != ''
|
|
ORDER BY state COLLATE NOCASE
|
|
"""
|
|
).fetchall()
|
|
return [r[0] for r in rows]
|