{% extends "base.html" %} {% load static %} {% block title %}Delete Payment {{ object.payment_number }} - {{ block.super }}{% endblock %} {% block content %}

Delete Payment

Warning: Permanent Deletion

You are about to permanently delete this payment record. This action cannot be undone and will affect billing calculations.

Payment to be Deleted
Payment Number: {{ object.payment_number }}
Patient: {{ object.medical_bill.patient.get_full_name }}
Bill Number: {{ object.medical_bill.bill_number }}
Payment Date: {{ object.payment_date|date:"M d, Y" }}
Payment Amount: ${{ object.payment_amount|floatformat:2 }}
Payment Method: {{ object.get_payment_method_display }}
Status: {% if object.status == 'PENDING' %} Pending {% elif object.status == 'PROCESSING' %} Processing {% elif object.status == 'COMPLETED' %} Completed {% elif object.status == 'FAILED' %} Failed {% elif object.status == 'REFUNDED' %} Refunded {% endif %}
Reference: {{ object.reference_number|default:"-" }}
Deletion Impact
Will be Affected:
  • Payment record will be permanently deleted
  • Bill balance will be recalculated
  • Payment history will be updated
  • Financial reports will be affected
  • Audit trail will show deletion
Financial Impact:
Current Bill Status:
Total Amount: ${{ object.medical_bill.total_amount|floatformat:2 }}
Paid Amount: ${{ object.medical_bill.paid_amount|floatformat:2 }}
After Deletion:
New Paid Amount: ${{ object.medical_bill.paid_amount|add:object.payment_amount|floatformat:2 }}
New Balance: ${{ object.medical_bill.balance_amount|add:object.payment_amount|floatformat:2 }}
{% if object.status == 'COMPLETED' and object.processed_at %}
Deletion Restrictions
Caution: Processed Payment

This payment has been processed and completed. Deleting it may cause:

  • Discrepancies in financial reconciliation
  • Issues with bank statement matching
  • Audit trail complications
  • Patient account confusion

Recommendation: Consider creating a refund or adjustment instead of deleting the payment.

{% elif object.status == 'REFUNDED' %}
Cannot Delete Refunded Payment
Refunded Payment Cannot Be Deleted

This payment has already been refunded and cannot be deleted. Refunded payments must be retained for audit and reconciliation purposes.

{% else %}
Confirm Deletion
{% csrf_token %}
{% if object.payment_amount > 1000 %}
Supervisor Approval Required

This payment amount exceeds $1,000. Supervisor approval is required for deletion.

{% endif %}
Final Warning

Once you click "Delete Payment", this payment record will be permanently removed and the bill balance will be updated. This action cannot be reversed.

Cancel
{% endif %}
{% endblock %}