Skip to content

Instantly share code, notes, and snippets.

@trplll
Created July 31, 2016 17:17
Show Gist options
  • Save trplll/e3df657a52eccef993d8d4dab59fe593 to your computer and use it in GitHub Desktop.
Save trplll/e3df657a52eccef993d8d4dab59fe593 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ratio Analysis</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body>
<div class="container">
<div ng-app="myApp" ng-controller="formCtrl" ng-init="casset=150;cliab=100;tasset=550;tliab=200;reset()">
<div class="page-header">
<h1>Ratio Analysis</h1>
</div>
<div class="col-md-6">
<form>
<fieldset class="form-group">
<label for="casset">Current Assets</label>
<input type="number" class="form-control" id="casset" ng-change="reset()" ng-model="casset">
</fieldset>
<fieldset class="form-group">
<label for="cliab">Current Liabilities</label>
<input type="number" class="form-control" id="cliab" ng-change="reset()" ng-model="cliab">
</fieldset>
<fieldset class="form-group">
<label for="tasset">Total Assets </label>
<input type="number" class="form-control" id="tasset" ng-change="reset()" ng-model="tasset">
</fieldset>
<fieldset class="form-group">
<label for="tliab">Total Liabilities</label>
<input type="number" class="form-control" id="tliab" ng-change="reset()" ng-model="tliab">
</fieldset>
<fieldset class="form-group">
<label for="netin">Net Income</label>
<input type="number" class="form-control" id="netin" ng-change="reset()" ng-model="netin">
</fieldset>
<fieldset class="form-group">
<label for="prefdiv">Preferred Dividends</label>
<input type="number" class="form-control" id="prefdiv" ng-change="reset()" ng-model="prefdiv">
</fieldset>
<fieldset class="form-group">
<label for="avoutsh">Average Common Shares Outstanding</label>
<input type="number" class="form-control" id="avoutsh" ng-change="reset()" ng-model="avoutsh">
</fieldset>
<fieldset class="form-group">
<label for="netcash">Net Cash From Op Activities</label>
<input type="number" class="form-control" id="netcash" ng-change="reset()" ng-model="netcash">
</fieldset>
<fieldset class="form-group">
<label for="capexp">Capital Expenditures</label>
<input type="number" class="form-control" id="capexp" ng-change="reset()" ng-model="capexp">
</fieldset>
<fieldset class="form-group">
<label for="cashdiv">Cash Dividends</label>
<input type="number" class="form-control" id="cashdiv" ng-change="reset()" ng-model="cashdiv">
</fieldset>
</form>
</div>
<div class="col-md-6">
<div class="well well-sm">
<table class="table table-striped">
<tr>
<th>Working Capital</th>
<td>{{workingcapital}}</td>
</tr>
<tr>
<th>Current Ratio</th>
<td>{{currentratio}}</td>
</tr>
<tr>
<th>Debt to Total Assets</th>
<td>{{debttototalassets}}</td>
</tr>
<tr>
<th>Earnings Per Share</th>
<td>{{eps}}</td>
</tr>
<tr>
<th>Free Cash Flow</th>
<td>{{freecashflow}}</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {
$scope.reset = function() {
$scope.workingcapital = $scope.casset - $scope.cliab;
$scope.currentratio = $scope.casset / $scope.cliab;
$scope.debttototalassets = $scope.tliab / $scope.tasset;
$scope.eps = ($scope.netin - $scope.prefdiv) / $scope.avoutsh;
$scope.freecashflow = $scope.netcash - $scope.capexp - $scope.cashdiv;
};
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment