Skip to content

Commit

Permalink
Merge pull request #648 from xzzy/master
Browse files Browse the repository at this point in the history
Mooring Financial & Link Fixes
  • Loading branch information
dbca-asi committed Jun 19, 2019
2 parents 93de049 + b64223b commit 456b9f9
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 30 deletions.
2 changes: 1 addition & 1 deletion ledger/payments/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CashAdmin(admin.ModelAdmin):

@admin.register(models.Invoice)
class InvoiceAdmin(admin.ModelAdmin):
list_display = ('reference','order','payment_status')
list_display = ('reference','order','payment_status','settlement_date')
search_fields = ('reference',)

@admin.register(models.InvoiceBPAY)
Expand Down
20 changes: 20 additions & 0 deletions ledger/payments/invoice/migrations/0009_invoice_settlement_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-06-19 04:15
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('invoice', '0008_invoice_previous_invoice'),
]

operations = [
migrations.AddField(
model_name='invoice',
name='settlement_date',
field=models.DateField(blank=True, null=True),
),
]
1 change: 1 addition & 0 deletions ledger/payments/invoice/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Invoice(models.Model):
token = models.CharField(max_length=80,null=True,blank=True)
voided = models.BooleanField(default=False)
previous_invoice = models.ForeignKey('self',null=True,blank=True)
settlement_date = models.DateField(blank=True, null=True)

def __unicode__(self):
return 'Invoice #{0}'.format(self.reference)
Expand Down
12 changes: 11 additions & 1 deletion ledger/payments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def oracle_parser_on_invoice(date,system,system_name,override=False):
#Build a list of invoices already in the oracle parse for parse date query
for opi in op_invoices:
oracle_parser_invoices.append(opi.reference)
invoices = Invoice.objects.filter(created__date=date, system=system)
invoices = Invoice.objects.filter(settlement_date=date, system=system)

#Loop through invoices
for invoice in invoices:
Expand Down Expand Up @@ -727,6 +727,13 @@ def update_payments_allocation(invoice_reference):
deductions = D(0.0)
oracle_code_totals = {}

invoice_settlement_date = None
if BpointTransaction.objects.filter(crn1=i.reference).count() > 0:
bp = BpointTransaction.objects.filter(crn1=i.reference)[0]
invoice_settlement_date = bp.settlement_date
else:
invoice_settlement_date = datetime.datetime.now().date()

# Get Order Information
if i.order:
# total amount based on oracle code to get a negiative / positive value.
Expand Down Expand Up @@ -772,6 +779,9 @@ def update_payments_allocation(invoice_reference):


line.save()
if i.settlement_date is None:
i.settlement_date = invoice_settlement_date
i.save()
except:
print(traceback.print_exc())
raise
Expand Down
12 changes: 10 additions & 2 deletions mooring/frontend/admissions/src/admissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-5">
<div class="checkbox">
<label><input type="checkbox" value="" v-model="toc">I agree to the <a target="_blank" href="{{EXPLORE_PARKS_TERMS}}">terms and conditions</a></label>
<label><input type="checkbox" value="" v-model="toc">I agree to the <a target="_blank" id='terms-link' href="javascript:void(0);" v-on:click="loadTerms();">terms and conditions</a></label>
</div>
<button :disabled="!validToProceed" type="submit" class="btn btn-primary" style="width:180px;background-color:#4286f4;font-weight:bold;">Proceed to Payment</button>
</div>
Expand Down Expand Up @@ -251,6 +251,7 @@ export default {
toc: false,
message: null,
noPayment: false,
terms: '',
errors: {
arrivalDate: false,
overnightStay: false,
Expand Down Expand Up @@ -643,6 +644,12 @@ export default {
}).bind(this)
});
},
loadTerms: function() {
var terms = $('#terms').val();
console.log(terms);
$('<a href="'+terms+'" target="blank"></a>')[0].click();
},
calculateTotal: function(){
var date = new Date(this.arrivalDate);
var temp = date.toISOString().substring(0,10);
Expand Down Expand Up @@ -732,7 +739,8 @@ export default {
this.arrivalData.fill();
//Get the user to autofill the boxes.
// this.terms = $('#terms').val();
// $('#terms-link').val(this.terms);
$.ajax({
url: vm.mooringUrl + "/api/profile",
method: 'GET',
Expand Down
2 changes: 0 additions & 2 deletions mooring/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

ROOT_URLCONF = 'mooring.urls'
SITE_ID = 1
print ("BASE DIR")
print (os.path.join(BASE_DIR, 'staticfiles_mo'))
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_mo')

# number of seconds before expiring a temporary booking
Expand Down
2 changes: 1 addition & 1 deletion mooring/static/admissions/js/app.js

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions mooring/static/admissions/js/vendor.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions mooring/templates/mooring/admissions/admissions_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
{% block vue-component %}

<input id="location" name="location" type="hidden" value="{{loc}}"/>
<input id="terms" name="terms" type="hidden" value="{{ context_processor.EXPLORE_PARKS_TERMS}}"/>
<div id='appdiv'></div>
<div id="admissionsBooking">
<alert :show="showAlert" :type="alertType" :data-alert="alertMessage" :duration="5000">
Expand Down
2 changes: 0 additions & 2 deletions mooring/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,6 @@ def get_campsite_availability(campsites_qs, start_date, end_date, ongoing_bookin
mooring_date_selected[date_rotate_forward] = 'notselected'
mooring_rate = None
if date_rotate_forward in mooring_rate_hash:
print ("MOORING RATE ROTATE")
print (mooring_rate_hash)
if site.pk in mooring_rate_hash[date_rotate_forward]:

mooring_rate = mooring_rate_hash[date_rotate_forward][site.pk]
Expand Down
4 changes: 3 additions & 1 deletion mooring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2703,8 +2703,10 @@ class AdmissionFeesView(TemplateView):
template_name = 'mooring/admissions/admissions_form.html'

def get(self, *args, **kwargs):
context_processor = template_context(self.request)
context = {
'loc': self.kwargs['loc']
'loc': self.kwargs['loc'],
'context_processor' : context_processor
}
return render(self.request, self.template_name, context)

Expand Down

0 comments on commit 456b9f9

Please sign in to comment.