Created
January 17, 2016 20:16
-
-
Save dafma/83628b928e3acb4e13a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> | |
| </head> | |
| <body> | |
| <div ng-app="CalculatorApp" ng-controller="CalculatorController"> | |
| <!-- se inicializa el ng-model con gn-init="nombreModel=value" --> | |
| <div ng-model="montoInicial" ng-init="montoInicial=15000.00"> | |
| Monto Inicial:{{ montoInicial }} | |
| </div> | |
| <div> | |
| Mano de Obra: - {{ manoObra }} | |
| </div> | |
| <div> | |
| Monto : {{ monto1 }} | |
| </div> | |
| <div> | |
| Comision Asesor: -{{ comisionA }} | |
| </div> | |
| <div> | |
| Monto Compra Material: {{ monto2 }} | |
| </div> | |
| <div> | |
| Iva : -{{ iva }} | |
| </div> | |
| <div> | |
| Total : {{ total }} | |
| </div> | |
| <button ng-click="calculate()">Calcular</button> | |
| </div> | |
| <script> | |
| angular.module('CalculatorApp',[]) | |
| .controller('CalculatorController',['$scope', function($scope){ | |
| $scope.calculate = function(){ | |
| $scope.manoObra = (parseInt($scope.montoInicial) * 20 /100); | |
| //cobtenemos el 20% | |
| $scope.monto1 = ($scope.montoInicial)-(parseInt($scope.montoInicial) * 20 /100); | |
| $scope.comisionA = $scope.monto1 * 4 /100; | |
| //obtenemos el 4% | |
| $scope.monto2 = $scope.monto1 - $scope.comisionA; | |
| $scope.iva = $scope.monto2 * 16 / 100; | |
| //obtenemos el iva | |
| $scope.total = $scope.monto2 - $scope.iva; | |
| } | |
| }]); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment