Skip to content

Instantly share code, notes, and snippets.

@tkovalsky
Created August 16, 2015 17:32
Show Gist options
  • Save tkovalsky/ba0c95ecf89ecf971df0 to your computer and use it in GitHub Desktop.
Save tkovalsky/ba0c95ecf89ecf971df0 to your computer and use it in GitHub Desktop.
commission calculator
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
from django.utils import timezone
from listings.models import Listing
from notes.models import Note
from contacts.models import Contact
rent_sf = input('please enter the price per square foot:') # starting principal
lease_rate = input('please enter the rate of the lease:') # 0.03
lease_tenor = input('please enter the tenor (in years) of the lease:') #10
size_of_space = input('please enter the size(in square feet) of the space:')
gross_commission_rate = input('please enter the deal commission:')
total_rent = 0
yearly_rent = 1
print "Year %25s" % "Rent Rate%25s" % "Rate%25s" % "Square Feet%25s" % "Yearly Rent%25s" % "Monthly Rent"
for year in range( 0, lease_tenor ):
rent_rate = rent_sf * ( 1.0 + lease_rate ) ** year
yearly_rent = rent_rate * size_of_space
total_rent += int(yearly_rent)
monthly_rent = yearly_rent/12
print "%4d%21.2f%21.2f%21.2f%21.2f%21.2f" % ( year + 1, rent_rate, lease_rate, size_of_space, yearly_rent, monthly_rent)
deal_commission = gross_commission_rate * total_rent
print "the rent for the term of the lease is %d" %total_rent
print "the gross commission for the deal is %d" %deal_commission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment