Files
Excel-project/server/backend/api/report.py
2026-01-06 18:06:34 +03:00

30 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import requests
import json
import pandas as pd
from server.backend.schemas.pydantic import settings, CreateDocumentParams
from server.backend.api.session import get_session
session = get_session({
"Content-Type": "application/json",
"Accept": "application/json",
})
def create_document(params: CreateDocumentParams) -> int:
data = {
"Дата": params.DATE,
"ВидОперации": params.OPERATION,
"Организация_Key": settings.COMPANY,
"Контрагент_Key": params.CONTRACTOR,
"Склад_Key": settings.STORE,
"ДоговорКонтрагента_Key": params.CONTRACT,
"ДокументБезНДС": "false",
"СуммаВключаетНДС": "true",
"СчетУчетаРасчетовЗаПосредническиеУслуги_Key": params.ACCOUNT_INTERMEDIARY_SERVICES,
"СчетУчетаРасчетовПоАвансамПолученным_Key": params.ACCOUNT_ADVANCES_RECEIVED,
"СчетУчетаРасчетовПоАвансамВыданным_Key": params.ACCOUNT_ADVANCES_ISSUED,
"СчетУчетаРасчетовСКонтрагентом_Key": params.ACCOUNT_WITH_COUNTERPARTY,
}
response = session.post(settings.URL_REPORT, json=data)
response.raise_for_status()
return response.status_code