def Init(self, year): '''Sets up the short term finance panel.''' self.year = year if year < 3: self.slider.SetRange(0, 0) self.limitVal_st.SetLabel('$ 0') return False # Get AR, Inventory and Net Fixed Assets accountsRec = self.data.GetData1()[59][self.year-1] inventory = self.data.GetData1()[60][self.year-1] grossFixedAssets = self.data.GetData1()[61][self.year-1] depreciation = self.data.GetData1()[62][self.year-1] netFixedAssets = grossFixedAssets - depreciation self.drawLimit = int(accountsRec*0.5+inventory*0.25+netFixedAssets*0.1) self.drawLimit = X_utilities.roundto(self.drawLimit, 100) self.slider.SetRange(0, self.drawLimit) self.limitVal_st.SetLabel("$ " + format(self.drawLimit, ',d')) # Get Starting STB Amount lastDraw = self.data.GetData1()[14][year-1] # If the starting STB amount is greater than the draw limit, # set the limit to the maximum allowed. Otherwise, set # the draw to the previous year's amount. if lastDraw < self.drawLimit: self.slider.SetValue(lastDraw) else: self.slider.SetValue(self.drawLimit) self.OnBorrow(None)
def OnEquity(self, evt): '''Gets the current value from the slider and sets the value of the equity amount label.''' equity = self.slider.GetValue() equity = X_utilities.roundto(equity, 250) self.shareNum_st.SetLabel(format(equity, ',d')) self.amount_st.SetLabel('$ ' + format(equity, ',d'))
def ReturnInfo(self): '''Returns the current STD decision.''' draw = X_utilities.roundto(self.slider.GetValue(), 100) if self.rate_st.GetLabel(): rate = float(self.rate_st.GetLabel().split(' ')[0]) else: rate = 0 return [draw, rate]
def OnBorrow(self, evt): '''Gets a borrowing amount and sets the borrowing label.''' draw = X_utilities.roundto(self.slider.GetValue(), 100) self.drawVal_st.SetLabel('$ ' + format(draw, ',d')) if draw >= self.drawLimit*0.5: self.rate = 6.50 elif draw > 0 and draw < self.drawLimit*0.5: self.rate = 3.50 else: self.rate = 0 self.rate_st.SetLabel("%.2f %%" % (self.rate,))
def OnBorrow(self, evt): '''Calculates the interest rate and the payback period when the user selects a borrowing amount.''' amount = X_utilities.roundto(self.slider.GetValue(), 250) if self.year < 4: self.amount_st.SetLabel('$ ' + format(amount, ',d')) if amount <= 500000: self.rate_st.SetLabel('8 %') self.time_st.SetLabel('3 ' + self.years_lbl) elif amount > 500000 and amount <=1000000: self.rate_st.SetLabel('10 %') self.time_st.SetLabel('5 ' + self.years_lbl) elif amount > 1000000 and amount <=1500000: self.rate_st.SetLabel('12 %') self.time_st.SetLabel('7 ' + self.years_lbl) elif amount > 1500000 and amount <=2000000: self.rate_st.SetLabel('14 %') self.time_st.SetLabel('9 ' + self.years_lbl) else: self.rate_st.SetLabel('') self.time_st.SetLabel('') else: # Get the average LoC rate for Years 1 - 3 avgLoc = 0 for x in self.data.GetData1()[65][1:4]: avgLoc += (1/3.0) * Z_gameIO.GetLoCRate(x) * 100.0 self.amount_st.SetLabel('$ ' + format(amount, ',d')) if amount <= 500000: r = avgLoc + 5.0 self.rate_st.SetLabel("%.2f %%" % r) self.time_st.SetLabel('5 ' + self.years_lbl) elif amount > 500000 and amount <=1000000: r = avgLoc + 7.50 self.rate_st.SetLabel("%.2f %%" % r) self.time_st.SetLabel('6 ' + self.years_lbl) elif amount > 1000000 and amount <=1500000: r = avgLoc + 10.00 self.rate_st.SetLabel("%.2f %%" % r) self.time_st.SetLabel('7 ' + self.years_lbl) elif amount > 1500000 and amount <=2000000: r = avgLoc + 12.50 self.rate_st.SetLabel("%.2f %%" % r) self.time_st.SetLabel('8 ' + self.years_lbl) else: self.rate_st.SetLabel('') self.time_st.SetLabel('')
def ReturnInfo(self): '''Returns the current Equity decision.''' return [X_utilities.roundto(self.slider.GetValue(), 250)]