コード例 #1
0
ファイル: views.py プロジェクト: wilsonc86/ledger
    def get(self, request, *args, **kwargs):
        invoice = get_object_or_404(Invoice, reference=self.kwargs['reference'])
        bi=BookingInvoice.objects.filter(invoice_reference=invoice.reference).last()

        response = HttpResponse(content_type='application/pdf')
        response.write(create_confirmation_pdf_bytes('confirmation.pdf',invoice, bi.booking))
        return response
コード例 #2
0
def send_confirmation_tclass_email_notification(sender,
                                                booking,
                                                invoice,
                                                recipients,
                                                is_test=False):
    email = ConfirmationTClassSendNotificationEmail()

    context = {
        'booking_number': booking.booking_number,
    }

    filename = 'confirmation.pdf'
    doc = create_confirmation_pdf_bytes(filename, invoice, booking)
    attachment = (filename, doc, 'application/pdf')

    msg = email.send(recipients, attachments=[attachment], context=context)
    if is_test:
        return

    _log_proposal_email(msg, booking.proposal, sender=sender)
    #_log_org_email(msg, booking.proposal.applicant, booking.proposal.submitter, sender=sender)
    if booking.proposal.org_applicant:
        _log_org_email(msg,
                       booking.proposal.org_applicant,
                       booking.proposal.submitter,
                       sender=sender)
    else:
        _log_user_email(msg,
                        booking.proposal.submitter,
                        booking.proposal.submitter,
                        sender=sender)
コード例 #3
0
ファイル: email.py プロジェクト: wilsonc86/ledger
def send_confirmation_tclass_email_notification(request, booking, invoice,
                                                recipients):
    email = ConfirmationTClassSendNotificationEmail()
    #url = request.build_absolute_uri(reverse('external-proposal-detail',kwargs={'proposal_pk': proposal.id}))

    #import ipdb; ipdb.set_trace()
    context = {
        'booking_number': booking.booking_number,
        #'url': url,
    }

    filename = 'confirmation.pdf'
    doc = create_confirmation_pdf_bytes(filename, invoice, booking)
    attachment = (filename, doc, 'application/pdf')

    msg = email.send(recipients, attachments=[attachment], context=context)
    sender = request.user if request else settings.DEFAULT_FROM_EMAIL
    _log_proposal_email(msg, booking.proposal, sender=sender)
    #_log_org_email(msg, booking.proposal.applicant, booking.proposal.submitter, sender=sender)
    if booking.proposal.org_applicant:
        _log_org_email(msg,
                       booking.proposal.org_applicant,
                       booking.proposal.submitter,
                       sender=sender)
    else:
        _log_user_email(msg,
                        booking.proposal.submitter,
                        booking.proposal.submitter,
                        sender=sender)
コード例 #4
0
def send_application_fee_confirmation_tclass_email_notification(
        request, application_fee, invoice, recipients, is_test=False):
    email = ApplicationFeeConfirmationTClassSendNotificationEmail()
    #url = request.build_absolute_uri(reverse('external-proposal-detail',kwargs={'proposal_pk': proposal.id}))

    proposal = application_fee.proposal
    context = {
        'lodgement_number': proposal.lodgement_number,
        #'url': url,
    }

    filename = 'confirmation.pdf'
    doc = create_confirmation_pdf_bytes(filename, invoice, application_fee)
    #doc = create_invoice_pdf_bytes(filename, invoice, proposal)
    attachment = (filename, doc, 'application/pdf')

    msg = email.send(recipients, attachments=[attachment], context=context)
    if is_test:
        return

    sender = request.user if request else settings.DEFAULT_FROM_EMAIL
    _log_proposal_email(msg, proposal, sender=sender)
    if proposal.org_applicant:
        _log_org_email(msg,
                       proposal.org_applicant,
                       proposal.submitter,
                       sender=sender)
    else:
        _log_user_email(msg,
                        proposal.submitter,
                        proposal.submitter,
                        sender=sender)
コード例 #5
0
    def get(self, request, *args, **kwargs):
        invoice = get_object_or_404(Invoice, reference=self.kwargs['reference'])
        bi=BookingInvoice.objects.filter(invoice_reference=invoice.reference).last()
        organisation = bi.booking.proposal.org_applicant.organisation.organisation_set.all()[0]

        if self.check_owner(organisation):
            # GST ignored here because GST amount is not included on the confirmation PDF
            response = HttpResponse(content_type='application/pdf')
            response.write(create_confirmation_pdf_bytes('confirmation.pdf',invoice, bi.booking))
            return response
        raise PermissionDenied