Commit 0e58f4f08f161cff755674869e9ecd12e77f58ed

Authored by Jose Pinto
1 parent 25af8f88f6
Exists in master

rellenarDigitos opcion caracter

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
1 angular.module('focaFiltros', []) 1 angular.module('focaFiltros', [])
2 .filter('comprobante', function() { 2 .filter('comprobante', function() {
3 return function(valores) { 3 return function(valores) {
4 return (Array(4).join('0') + valores[0]).slice(-4) + '-' + 4 return (Array(4).join('0') + valores[0]).slice(-4) + '-' +
5 (Array(8).join('0') + valores[1]).slice(-8); 5 (Array(8).join('0') + valores[1]).slice(-8);
6 }; 6 };
7 }) 7 })
8 .filter('rellenarDigitos', function() { 8 .filter('rellenarDigitos', function() {
9 return function(valor, cantidad) { 9 return function(valor, cantidad, caracter) {
10 var ceros = ''; 10 var ceros = '';
11 for (var i = 0; i < cantidad; i++) { 11 for (var i = 0; i < cantidad; i++) {
12 ceros += '0'; 12 ceros += caracter;
13 } 13 }
14 return (ceros + valor).slice(cantidad * -1); 14 return (ceros + valor).slice(cantidad * -1);
15 }; 15 };
16 }); 16 });
17 17