Commit ca5e59ad057828cc5289dae3d9b470d4241adcd9
1 parent
01bc23414b
Exists in
master
refactor en servicios
Showing
1 changed file
with
23 additions
and
31 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -108,20 +108,20 @@ angular.module('focaCrearRemito') .controller('remitoController', |
108 | 108 | var cabeceras = [ |
109 | 109 | { |
110 | 110 | label: 'Moneda:', |
111 | - valor: notaPedido.cotizacion[0].moneda[0].DETALLE | |
111 | + valor: notaPedido.cotizacion.moneda.DETALLE | |
112 | 112 | }, |
113 | 113 | { |
114 | 114 | label: 'Fecha cotizacion:', |
115 | - valor: $filter('date')(notaPedido.cotizacion[0].FECHA, | |
115 | + valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
116 | 116 | 'dd/MM/yyyy') |
117 | 117 | }, |
118 | 118 | { |
119 | 119 | label: 'Cotizacion:', |
120 | - valor: notaPedido.cotizacion[0].VENDEDOR | |
120 | + valor: notaPedido.cotizacion.VENDEDOR | |
121 | 121 | }, |
122 | 122 | { |
123 | 123 | label: 'Cliente:', |
124 | - valor: notaPedido.cliente[0].NOM | |
124 | + valor: notaPedido.cliente.NOM | |
125 | 125 | }, |
126 | 126 | { |
127 | 127 | label: 'Domicilio:', |
... | ... | @@ -129,16 +129,16 @@ angular.module('focaCrearRemito') .controller('remitoController', |
129 | 129 | }, |
130 | 130 | { |
131 | 131 | label: 'Vendedor:', |
132 | - valor: notaPedido.vendedor[0].NomVen | |
132 | + valor: notaPedido.vendedor.NomVen | |
133 | 133 | }, |
134 | 134 | { |
135 | 135 | label: 'Proveedor:', |
136 | - valor: notaPedido.proveedor[0].NOM | |
136 | + valor: notaPedido.proveedor.NOM | |
137 | 137 | }, |
138 | 138 | { |
139 | 139 | label: 'Precio condicion:', |
140 | 140 | valor: valorPrecioCondicion() + ' ' + |
141 | - remitoBusinessService.plazoToString(notaPedido.plazoPago) | |
141 | + remitoBusinessService.plazoToString(notaPedido.notaPedidoPlazo) | |
142 | 142 | }, |
143 | 143 | { |
144 | 144 | label: 'Flete:', |
... | ... | @@ -149,7 +149,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
149 | 149 | |
150 | 150 | function valorPrecioCondicion() { |
151 | 151 | if(notaPedido.idPrecioCondicion > 0) { |
152 | - return notaPedido.precioCondicion[0].nombre; | |
152 | + return notaPedido.precioCondicion.nombre; | |
153 | 153 | } else { |
154 | 154 | return 'Ingreso Manual'; |
155 | 155 | } |
... | ... | @@ -176,21 +176,17 @@ angular.module('focaCrearRemito') .controller('remitoController', |
176 | 176 | |
177 | 177 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
178 | 178 | remitoBusinessService.calcularArticulos($scope.articulosTabla, |
179 | - notaPedido.cotizacion[0].VENDEDOR); | |
179 | + notaPedido.cotizacion.VENDEDOR); | |
180 | 180 | |
181 | - if(notaPedido.precioCondicion.length > 0) { | |
182 | - $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; | |
181 | + if(notaPedido.idPrecioCondicion > 0) { | |
182 | + $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | |
183 | 183 | } else { |
184 | 184 | $scope.idLista = -1; |
185 | 185 | } |
186 | 186 | |
187 | 187 | delete notaPedido.id; |
188 | 188 | $scope.remito = notaPedido; |
189 | - $scope.remito.vendedor = notaPedido.vendedor[0]; | |
190 | - $scope.remito.cliente = notaPedido.cliente[0]; | |
191 | - $scope.remito.proveedor = notaPedido.proveedor[0]; | |
192 | - $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; | |
193 | - $scope.remito.cotizacion = notaPedido.cotizacion[0]; | |
189 | + $scope.remito.moneda = notaPedido.cotizacion.moneda; | |
194 | 190 | addArrayCabecera(cabeceras); |
195 | 191 | |
196 | 192 | }, function() { |
... | ... | @@ -218,20 +214,20 @@ angular.module('focaCrearRemito') .controller('remitoController', |
218 | 214 | var cabeceras = [ |
219 | 215 | { |
220 | 216 | label: 'Moneda:', |
221 | - valor: remito.cotizacion[0].moneda[0].DETALLE | |
217 | + valor: remito.cotizacion.moneda.DETALLE | |
222 | 218 | }, |
223 | 219 | { |
224 | 220 | label: 'Fecha cotizacion:', |
225 | - valor: $filter('date')(remito.cotizacion[0].FECHA, | |
221 | + valor: $filter('date')(remito.cotizacion.FECHA, | |
226 | 222 | 'dd/MM/yyyy') |
227 | 223 | }, |
228 | 224 | { |
229 | 225 | label: 'Cotizacion:', |
230 | - valor: remito.cotizacion[0].VENDEDOR | |
226 | + valor: remito.cotizacion.VENDEDOR | |
231 | 227 | }, |
232 | 228 | { |
233 | 229 | label: 'Cliente:', |
234 | - valor: remito.cliente[0].NOM | |
230 | + valor: remito.cliente.NOM | |
235 | 231 | }, |
236 | 232 | { |
237 | 233 | label: 'Domicilio:', |
... | ... | @@ -239,11 +235,11 @@ angular.module('focaCrearRemito') .controller('remitoController', |
239 | 235 | }, |
240 | 236 | { |
241 | 237 | label: 'Vendedor:', |
242 | - valor: remito.vendedor[0].NomVen | |
238 | + valor: remito.vendedor.NomVen | |
243 | 239 | }, |
244 | 240 | { |
245 | 241 | label: 'Proveedor:', |
246 | - valor: remito.proveedor[0].NOM | |
242 | + valor: remito.proveedor.NOM | |
247 | 243 | }, |
248 | 244 | { |
249 | 245 | label: 'Flete:', |
... | ... | @@ -258,7 +254,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
258 | 254 | //TO DO CUANDO MOSTRAR PLAZOS |
259 | 255 | function valorPrecioCondicion() { |
260 | 256 | if(remito.idPrecioCondicion > 0) { |
261 | - return remito.precioCondicion[0].nombre; | |
257 | + return remito.precioCondicion.nombre; | |
262 | 258 | } else { |
263 | 259 | return 'Ingreso Manual'; |
264 | 260 | } |
... | ... | @@ -280,19 +276,15 @@ angular.module('focaCrearRemito') .controller('remitoController', |
280 | 276 | } |
281 | 277 | $scope.articulosTabla = remito.articulosRemito; |
282 | 278 | remitoBusinessService.calcularArticulos($scope.articulosTabla, |
283 | - remito.cotizacion[0].VENDEDOR); | |
284 | - if(remito.precioCondicion.length > 0) { | |
285 | - $scope.idLista = remito.precioCondicion[0].idListaPrecio; | |
279 | + remito.cotizacion.VENDEDOR); | |
280 | + if(remito.idPrecioCondicion > 0) { | |
281 | + $scope.idLista = remito.precioCondicion.idListaPrecio; | |
286 | 282 | } else { |
287 | 283 | $scope.idLista = -1; |
288 | 284 | } |
289 | 285 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
290 | 286 | $scope.remito = remito; |
291 | - $scope.remito.vendedor = remito.vendedor[0]; | |
292 | - $scope.remito.cliente = remito.cliente[0]; | |
293 | - $scope.remito.proveedor = remito.proveedor[0]; | |
294 | - $scope.remito.moneda = remito.cotizacion[0].moneda[0]; | |
295 | - $scope.remito.cotizacion = remito.cotizacion[0]; | |
287 | + $scope.remito.moneda = remito.cotizacion.moneda; | |
296 | 288 | addArrayCabecera(cabeceras); |
297 | 289 | }, function() { |
298 | 290 | // funcion ejecutada cuando se cancela el modal |