diff --git a/sstreasury/jinja2/sstreasury/claim_edit.html b/sstreasury/jinja2/sstreasury/claim_edit.html index 1d80d3d..928edfb 100644 --- a/sstreasury/jinja2/sstreasury/claim_edit.html +++ b/sstreasury/jinja2/sstreasury/claim_edit.html @@ -23,7 +23,7 @@ {% block maincontent %}

{% if request.resolver_match.url_name == 'claim_new' %}New{% else %}Edit{% endif %} reimbursement claim

-
+
@@ -72,6 +72,31 @@
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ + +
+
+
@@ -80,6 +105,12 @@
+
+

Declaration

+

By submitting this form for processing with my MUMUS account, I agree that MUMUS Inc. will accept this communication as containing my signature for the purposes of the Electronic Transactions Acts. I certify that the information on this form is true and accurate. I acknowledge that incorrect information may result in the forfeiture of this reimbursement.

+

Under the Pay As You Go legislation and guidelines produced by the Australian Taxation Office, I state that the supply to MUMUS Inc. described on this form is wholly of a private or domestic nature for me, I have no reasonable expectation of profit or gain from the activity undertaken, and I consider that I do not meet the definition of enterprise for tax purposes. Therefore, I do not need to quote an Australian Business Number and MUMUS Inc. is not required to withhold tax from my payment.

+
+
diff --git a/sstreasury/jinja2/sstreasury/claim_print.html b/sstreasury/jinja2/sstreasury/claim_print.html index 7bec819..6616edd 100644 --- a/sstreasury/jinja2/sstreasury/claim_print.html +++ b/sstreasury/jinja2/sstreasury/claim_print.html @@ -77,6 +77,35 @@ Comments {{ claim.comments }} + + Payee + +
+
+ +
{{ claim.payee_name }}
+
+
+ +
BSB: {{ claim.payee_bsb }}
+
+
+ +
Account: {{ claim.payee_account }}
+
+
+ + + + Receipts + + + + Items diff --git a/sstreasury/jinja2/sstreasury/claim_view.html b/sstreasury/jinja2/sstreasury/claim_view.html index a08e4ba..1e8c670 100644 --- a/sstreasury/jinja2/sstreasury/claim_view.html +++ b/sstreasury/jinja2/sstreasury/claim_view.html @@ -105,6 +105,35 @@ Comments {{ claim.comments }} + + Payee + +
+
+ +
{{ claim.payee_name }}
+
+
+ +
BSB: {{ claim.payee_bsb }}
+
+
+ +
Account: {{ claim.payee_account }}
+
+
+ + + + Receipts + + + + Items diff --git a/sstreasury/models.py b/sstreasury/models.py index 619ea2f..222e00a 100644 --- a/sstreasury/models.py +++ b/sstreasury/models.py @@ -195,6 +195,10 @@ class ReimbursementClaim(models.Model): items = JSONField(default=[]) + payee_name = models.TextField() + payee_bsb = models.CharField(max_length=7) + payee_account = models.TextField(max_length=20) + def update_state(self, user, state): self.state = state.value self.save() @@ -270,7 +274,7 @@ class ReimbursementClaim(models.Model): class ClaimReceipt(models.Model): claim = models.ForeignKey(ReimbursementClaim, on_delete=models.CASCADE) - uploaded_file = models.FileField() + uploaded_file = models.FileField(upload_to='receipt_uploads/%Y/%m/%d/') class ClaimComment(models.Model): claim = models.ForeignKey(ReimbursementClaim, on_delete=models.CASCADE) diff --git a/sstreasury/views.py b/sstreasury/views.py index 14b2440..1a00c3e 100644 --- a/sstreasury/views.py +++ b/sstreasury/views.py @@ -112,7 +112,7 @@ def revision_from_form(budget, revision, form): return revision -def claim_from_form(claim, form): +def claim_from_form(claim, form, files): claim.purpose = form['purpose'] claim.date = form['date'] if form['date'] else None claim.budget_id = form['budget_id'] @@ -121,8 +121,19 @@ def claim_from_form(claim, form): claim.state = models.ClaimState.DRAFT.value claim.items = json.loads(form['items']) + claim.payee_name = form['payee_name'] + claim.payee_bsb = form['payee_bsb'] + claim.payee_account = form['payee_account'] + claim.save() + if files: + for f in files.getlist('upload_file'): + claim_receipt = models.ClaimReceipt() + claim_receipt.claim = claim + claim_receipt.uploaded_file = f + claim_receipt.save() + return claim # INDEX VIEW @@ -392,7 +403,7 @@ def claim_new(request): claim.author = request.user claim.time = timezone.now() claim.state = models.BudgetState.DRAFT.value - claim = claim_from_form(claim, request.POST) + claim = claim_from_form(claim, request.POST, request.FILES) claim_history = models.ClaimHistory() claim_history.claim = claim @@ -456,12 +467,24 @@ def claim_print(request, claim): @claim_editable def claim_edit(request, claim): if request.method == 'POST': + if request.POST['submit'].startswith('DeleteFile'): + file_id = int(request.POST['submit'][10:]) + + claim_receipt = models.ClaimReceipt.objects.get(id=file_id) + if claim_receipt.claim != claim: + raise PermissionDenied + + claim_receipt.delete() + claim_receipt.uploaded_file.delete(save=False) + + return redirect(reverse('claim_edit', kwargs={'id': claim.id})) + if request.POST['submit'] == 'Delete': claim.delete() return redirect(reverse('claim_list')) with transaction.atomic(): - claim = claim_from_form(claim, request.POST) + claim = claim_from_form(claim, request.POST, request.FILES) claim_history = models.ClaimHistory() claim_history.claim = claim