Commit bff7194b464f3041416a311ba463708ecf6fdd19
1 parent
c13e9faa0d
Exists in
master
fix flete, guarda fecha correcta
Showing
1 changed file
with
17 additions
and
99 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -4,8 +4,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
4 | 4 | 'focaModalService', 'remitoBusinessService', |
5 | 5 | function( |
6 | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, |
7 | - remitoBusinessService | |
8 | - ) { | |
7 | + remitoBusinessService) | |
8 | + { | |
9 | 9 | $scope.botonera = [ |
10 | 10 | {texto: 'Nota Pedido', accion: function() { |
11 | 11 | varlidarRemitoFacturado($scope.seleccionarNotaPedido);}}, |
... | ... | @@ -67,8 +67,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
67 | 67 | |
68 | 68 | $scope.articulosTabla = []; |
69 | 69 | $scope.idLista = undefined; |
70 | - //La pantalla solo se usa para cargar remitos | |
71 | - //var remitoTemp = crearRemitoService.getRemito(); | |
72 | 70 | |
73 | 71 | crearRemitoService.getPrecioCondicion().then( |
74 | 72 | function(res) { |
... | ... | @@ -105,9 +103,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
105 | 103 | function(notaPedido) { |
106 | 104 | //añado cabeceras |
107 | 105 | $scope.notaPedido.id = notaPedido.id; |
108 | - removeCabecera('Moneda:'); | |
109 | - removeCabecera('Fecha cotizacion:'); | |
110 | - removeCabecera('Cotizacion:'); | |
106 | + removeCabecera('Bomba:'); | |
107 | + removeCabecera('Kilometros:'); | |
111 | 108 | var cabeceras = [ |
112 | 109 | { |
113 | 110 | label: 'Moneda:', |
... | ... | @@ -139,16 +136,17 @@ angular.module('focaCrearRemito') .controller('remitoController', |
139 | 136 | valor: notaPedido.proveedor[0].NOM |
140 | 137 | }, |
141 | 138 | { |
139 | + label: 'Precio condicion:', | |
140 | + valor: valorPrecioCondicion() + ' ' + | |
141 | + remitoBusinessService.plazoToString(notaPedido.plazoPago) | |
142 | + }, | |
143 | + { | |
142 | 144 | label: 'Flete:', |
143 | 145 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
144 | 146 | notaPedido.flete === 1 ? 'Si' : 'No') |
145 | - }, | |
146 | - { | |
147 | - label: 'Precio condicion:', | |
148 | - valor: valorPrecioCondicion() | |
149 | 147 | } |
150 | 148 | ]; |
151 | - //TODO: CUANDO MOSTRAR PLAZOS | |
149 | + | |
152 | 150 | function valorPrecioCondicion() { |
153 | 151 | if(notaPedido.idPrecioCondicion > 0) { |
154 | 152 | return notaPedido.precioCondicion[0].nombre; |
... | ... | @@ -159,12 +157,12 @@ angular.module('focaCrearRemito') .controller('remitoController', |
159 | 157 | |
160 | 158 | if(notaPedido.flete === 1) { |
161 | 159 | var cabeceraBomba = { |
162 | - label: 'Bomba', | |
160 | + label: 'Bomba:', | |
163 | 161 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
164 | 162 | }; |
165 | 163 | if(notaPedido.kilometros) { |
166 | 164 | var cabeceraKilometros = { |
167 | - label: 'Kilometros', | |
165 | + label: 'Kilometros:', | |
168 | 166 | valor: notaPedido.kilometros |
169 | 167 | }; |
170 | 168 | cabeceras.push(cabeceraKilometros); |
... | ... | @@ -175,11 +173,11 @@ angular.module('focaCrearRemito') .controller('remitoController', |
175 | 173 | for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { |
176 | 174 | notaPedido.articulosNotaPedido[i].id = 0; |
177 | 175 | } |
178 | - | |
176 | + | |
179 | 177 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
180 | 178 | remitoBusinessService.calcularArticulos($scope.articulosTabla, |
181 | 179 | notaPedido.cotizacion[0].VENDEDOR); |
182 | - | |
180 | + | |
183 | 181 | if(notaPedido.precioCondicion.length > 0) { |
184 | 182 | $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; |
185 | 183 | } else { |
... | ... | @@ -264,7 +262,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
264 | 262 | } else { |
265 | 263 | return 'Ingreso Manual'; |
266 | 264 | } |
267 | - | |
268 | 265 | } |
269 | 266 | |
270 | 267 | if(remito.flete === 1) { |
... | ... | @@ -303,45 +300,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
303 | 300 | ); |
304 | 301 | }; |
305 | 302 | |
306 | - //La pantalla solo se usa para cargar remitos | |
307 | - // if (remitoTemp !== undefined) { | |
308 | - // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | |
309 | - // $scope.remito = remitoTemp; | |
310 | - // $scope.remito.flete = ($scope.remito.flete).toString(); | |
311 | - // $scope.remito.bomba = ($scope.remito.bomba).toString(); | |
312 | - // $scope.idLista = $scope.remito.precioCondicion; | |
313 | - // crearRemitoService | |
314 | - // .getArticulosByIdRemito($scope.remito.id).then( | |
315 | - // function(res) { | |
316 | - // $scope.articulosTabla = res.data; | |
317 | - // } | |
318 | - // ); | |
319 | - //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | |
320 | - //(NO REQUERIDO EN ESTA VERSION) | |
321 | - // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | |
322 | - // function(res) { | |
323 | - // $scope.remito.domicilio = res.data; | |
324 | - // } | |
325 | - // ); | |
326 | - // } else { | |
327 | - // $scope.remito.fechaCarga = new Date(); | |
328 | - // $scope.remito.bomba = '0'; | |
329 | - // $scope.remito.flete = '0'; | |
330 | - // $scope.idLista = undefined; | |
331 | - // } | |
332 | - //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | |
333 | - // $scope.addNewDom = function() { | |
334 | - // $scope.remito.domicilio.push({ 'id': 0 }); | |
335 | - // }; | |
336 | - // $scope.removeNewChoice = function(choice) { | |
337 | - // if ($scope.remito.domicilio.length > 1) { | |
338 | - // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | |
339 | - // function(c) { | |
340 | - // return c.$$hashKey === choice.$$hashKey; | |
341 | - // } | |
342 | - // ), 1); | |
343 | - // } | |
344 | - // }; | |
345 | 303 | //validacion por domicilio y por plazo pago |
346 | 304 | $scope.crearRemito = function() { |
347 | 305 | if(!$scope.remito.vendedor) { |
... | ... | @@ -367,14 +325,11 @@ angular.module('focaCrearRemito') .controller('remitoController', |
367 | 325 | } else if($scope.articulosTabla.length === 0) { |
368 | 326 | focaModalService.alert('Debe cargar al menos un articulo'); |
369 | 327 | return; |
370 | - } | |
371 | - var date = new Date(); | |
328 | + } | |
372 | 329 | var save = { |
373 | 330 | remito: { |
374 | 331 | id: $scope.remito.id, |
375 | - fechaRemito: | |
376 | - new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
377 | - .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter | |
332 | + fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | |
378 | 333 | idCliente: $scope.remito.cliente.COD, |
379 | 334 | nombreCliente: $scope.remito.cliente.NOM, |
380 | 335 | cuitCliente: $scope.remito.cliente.CUIT, |
... | ... | @@ -881,41 +836,4 @@ angular.module('focaCrearRemito') .controller('remitoController', |
881 | 836 | } |
882 | 837 | } |
883 | 838 | } |
884 | - ] | |
885 | -) | |
886 | -.controller('remitoListaCtrl', [ | |
887 | - '$scope', | |
888 | - 'crearRemitoService', | |
889 | - '$location', | |
890 | - function($scope, crearRemitoService, $location) { | |
891 | - crearRemitoService.obtenerRemito().then(function(datos) { | |
892 | - $scope.remitos = datos.data; | |
893 | - }); | |
894 | - $scope.editar = function(remito) { | |
895 | - crearRemitoService.setRemito(remito); | |
896 | - $location.path('/venta-nota-remito/abm/'); | |
897 | - }; | |
898 | - $scope.crearRemito = function() { | |
899 | - crearRemitoService.clearRemito(); | |
900 | - $location.path('/venta-nota-remito/abm/'); | |
901 | - }; | |
902 | - } | |
903 | -]) | |
904 | -.controller('focaCrearRemitoFichaClienteController', [ | |
905 | - '$scope', | |
906 | - 'crearRemitoService', | |
907 | - '$location', | |
908 | - function($scope, crearRemitoService, $location) { | |
909 | - crearRemitoService.obtenerRemito().then(function(datos) { | |
910 | - $scope.remitos = datos.data; | |
911 | - }); | |
912 | - $scope.editar = function(remito) { | |
913 | - crearRemitoService.setRemito(remito); | |
914 | - $location.path('/venta-nota-remito/abm/'); | |
915 | - }; | |
916 | - $scope.crearRemito = function() { | |
917 | - crearRemitoService.clearRemito(); | |
918 | - $location.path('/venta-nota-remito/abm/'); | |
919 | - }; | |
920 | - } | |
921 | -]); | |
839 | + ]); |