Initial commit

This commit is contained in:
2026-07-14 01:16:33 +03:00
commit 92f04e0e8a
29 changed files with 2454 additions and 0 deletions

55
services/documents.py Normal file
View File

@@ -0,0 +1,55 @@
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]