Commit b9d8b314493dd86aa820ea9505cb7621a8955007
1 parent
c982de1e60
Exists in
master
agrego función concatenar plazos
Showing
1 changed file
with
7 additions
and
0 deletions
Show diff stats
src/js/businessService.js
| 1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
| 2 | .factory('notaPedidoBusinessService', [ | 2 | .factory('notaPedidoBusinessService', [ |
| 3 | 'crearNotaPedidoService', | 3 | 'crearNotaPedidoService', |
| 4 | function(crearNotaPedidoService) { | 4 | function(crearNotaPedidoService) { |
| 5 | return { | 5 | return { |
| 6 | addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) { | 6 | addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) { |
| 7 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 7 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
| 8 | delete articulosNotaPedido[i].editCantidad; | 8 | delete articulosNotaPedido[i].editCantidad; |
| 9 | delete articulosNotaPedido[i].editPrecio; | 9 | delete articulosNotaPedido[i].editPrecio; |
| 10 | articulosNotaPedido[i].idNotaPedido = idNotaPedido; | 10 | articulosNotaPedido[i].idNotaPedido = idNotaPedido; |
| 11 | articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion; | 11 | articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion; |
| 12 | crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 12 | crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
| 13 | } | 13 | } |
| 14 | }, | 14 | }, |
| 15 | addEstado: function(idNotaPedido, idVendedor) { | 15 | addEstado: function(idNotaPedido, idVendedor) { |
| 16 | var date = new Date(); | 16 | var date = new Date(); |
| 17 | var estado = { | 17 | var estado = { |
| 18 | idNotaPedido: idNotaPedido, | 18 | idNotaPedido: idNotaPedido, |
| 19 | fecha: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 19 | fecha: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 20 | .toISOString().slice(0, 19).replace('T', ' '), | 20 | .toISOString().slice(0, 19).replace('T', ' '), |
| 21 | estado: 0, | 21 | estado: 0, |
| 22 | idVendedor: idVendedor | 22 | idVendedor: idVendedor |
| 23 | }; | 23 | }; |
| 24 | crearNotaPedidoService.crearEstadoParaNotaPedido(estado); | 24 | crearNotaPedidoService.crearEstadoParaNotaPedido(estado); |
| 25 | }, | 25 | }, |
| 26 | calcularArticulos: function(articulos, cotizacion) { | 26 | calcularArticulos: function(articulos, cotizacion) { |
| 27 | for(var i = 0; i < articulos.length; i++) { | 27 | for(var i = 0; i < articulos.length; i++) { |
| 28 | articulos[i].precio = articulos[i].precio / cotizacion; | 28 | articulos[i].precio = articulos[i].precio / cotizacion; |
| 29 | } | 29 | } |
| 30 | }, | ||
| 31 | plazoToString: function (plazos) { | ||
| 32 | var result = ''; | ||
| 33 | for(var i = 0; i < plazos.length; i++) { | ||
| 34 | result += plazos[i].dias + ' '; | ||
| 35 | } | ||
| 36 | return result.trim(); | ||
| 30 | } | 37 | } |
| 31 | }; | 38 | }; |
| 32 | }]); | 39 | }]); |
| 33 | 40 |