@@ -0,0 +1,1740 @@
+from datetime import date%0A%0Afrom django.core.management import BaseCommand%0A%0Afrom dmd.models import NCSOConcession%0A%0A%0Aclass Command(BaseCommand):%0A    def handle(self, *args, **kwargs):%0A        today = date.today()%0A        first_of_month = date(today.year, today.month, 1)%0A%0A        num_concessions = NCSOConcession.objects.count()%0A        num_concessions_in_this_month = NCSOConcession.objects.filter(%0A            date=first_of_month%0A        ).count()%0A        unmatched_concessions = NCSOConcession.objects.filter(vmpp_id__isnull=True)%0A        num_unmatched_concessions = unmatched_concessions.count()%0A%0A        lines = %5B%5D%0A%0A        lines.append(%22There are %7B%7D concessions%22.format(num_concessions))%0A        lines.append(%0A            %22There are %7B%7D concessions for %7B%7D%22.format(%0A                num_concessions_in_this_month, today.strftime(%22%25B %25Y%22)%0A            )%0A        )%0A%0A        if num_unmatched_concessions == 0:%0A            lines.append(%22There are no unreconciled concessions%22)%0A        elif num_unmatched_concessions == 1:%0A            lines.append(%22There is 1 unreconciled concession%22)%0A        else:%0A            lines.append(%0A                %22There are %7B%7D unreconciled concessions%22.format(%0A                    num_unmatched_concessions%0A                )%0A            )%0A%0A        if num_unmatched_concessions %3E 0:%0A            lines.append(%22%22)%0A            lines.append(%22To reconcile, tell ebmbot:%22)%0A            lines.append(%22%60op reconcile concession %5BID%5D against %5BVMPP ID%5D%60%22)%0A%0A        for c in unmatched_concessions:%0A            lines.append(%22-%22 * 80)%0A            lines.append(%22ID: %7B%7D%22.format(c.id))%0A            lines.append(u%22Drug: %7B%7D%22.format(c.drug))%0A            lines.append(u%22Pack size: %7B%7D%22.format(c.pack_size))%0A%0A        print(%22%5Cn%22.join(lines))%0A

Add task to summarise concessions