--
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user