This commit is contained in:
Shubhankar45
2026-10-27 12:03:31 +00:00
parent 2ed3945b5d
commit 4e5e95775d
104 changed files with 5210 additions and 606 deletions
+7
View File
@@ -29,6 +29,7 @@ from app.common.enums import AuditAction, EntityType
from app.config.settings import settings
from app.pdf.forms import approval_signature_line, build_dcr_context, build_form_context
from app.reports.models import DailyCallReport
from app.reports.serializers import planned_visits
from app.users.models import User
logger = logging.getLogger(__name__)
@@ -198,11 +199,17 @@ class PDFService:
return {"name": approver.full_name, "at": when}
async def _context(self, dcr: DailyCallReport) -> dict:
missed = [
{"name": p.name, "kind": p.kind.title(), "reason": p.missed_reason}
for p in planned_visits(dcr)
if p.status == "MISSED"
]
return build_dcr_context(
dcr,
sorted(dcr.doctor_calls, key=lambda c: c.visit_time),
sorted(dcr.chemist_calls, key=lambda c: c.visit_time),
await self._approval(dcr),
missed,
)
async def render_bytes(self, dcr: DailyCallReport) -> bytes: