Commit 94d9c4f9563c06b235fff5e1c24ccf95b8faa697
1 parent
55f6418a6b
Exists in
master
guardo remito
desactivo camel case porque una propiedad de remito altera pre-commit
Showing
3 changed files
with
48 additions
and
34 deletions
Show diff stats
src/js/businessService.js
... | ... | @@ -9,6 +9,7 @@ angular.module('focaCrearRemito') |
9 | 9 | delete articulosRemito[i].editPrecio; |
10 | 10 | articulosRemito[i].idRemito = idRemito; |
11 | 11 | articulosRemito[i].precio = articulosRemito[i].precio * cotizacion; |
12 | + delete articulosRemito[i].idNotaPedido; | |
12 | 13 | crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); |
13 | 14 | } |
14 | 15 | }, |
src/js/controller.js
... | ... | @@ -160,7 +160,13 @@ angular.module('focaCrearRemito') .controller('remitoController', |
160 | 160 | cabeceras.push(cabeceraBomba); |
161 | 161 | } |
162 | 162 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
163 | + $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; | |
163 | 164 | $scope.remito = notaPedido; |
165 | + $scope.remito.vendedor = notaPedido.vendedor[0]; | |
166 | + $scope.remito.cliente = notaPedido.cliente[0]; | |
167 | + $scope.remito.proveedor = notaPedido.proveedor[0]; | |
168 | + $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; | |
169 | + $scope.remito.cotizacion = notaPedido.cotizacion[0]; | |
164 | 170 | addArrayCabecera(cabeceras); |
165 | 171 | |
166 | 172 | }, function() { |
... | ... | @@ -226,34 +232,28 @@ angular.module('focaCrearRemito') .controller('remitoController', |
226 | 232 | // ), 1); |
227 | 233 | // } |
228 | 234 | // }; |
229 | - | |
235 | + //validacion por domicilio y por plazo pago | |
230 | 236 | $scope.crearRemito = function() { |
231 | - if(!$scope.remito.vendedor.codigo) { | |
237 | + if(!$scope.remito.vendedor) { | |
232 | 238 | focaModalService.alert('Ingrese Vendedor'); |
233 | 239 | return; |
234 | - } else if(!$scope.remito.cliente.cod) { | |
240 | + } else if(!$scope.remito.cliente) { | |
235 | 241 | focaModalService.alert('Ingrese Cliente'); |
236 | 242 | return; |
237 | - } else if(!$scope.remito.proveedor.codigo) { | |
243 | + } else if(!$scope.remito.proveedor) { | |
238 | 244 | focaModalService.alert('Ingrese Proveedor'); |
239 | 245 | return; |
240 | - } else if(!$scope.remito.moneda.id) { | |
246 | + } else if(!$scope.remito.moneda.ID) { | |
241 | 247 | focaModalService.alert('Ingrese Moneda'); |
242 | 248 | return; |
243 | 249 | } else if(!$scope.remito.cotizacion.ID) { |
244 | 250 | focaModalService.alert('Ingrese Cotización'); |
245 | 251 | return; |
246 | - } else if(!$scope.plazosPagos) { | |
247 | - focaModalService.alert('Ingrese Precios y Condiciones'); | |
248 | - return; | |
249 | 252 | } else if( |
250 | 253 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
251 | 254 | { |
252 | 255 | focaModalService.alert('Ingrese Flete'); |
253 | 256 | return; |
254 | - } else if(!$scope.remito.domicilio.id) { | |
255 | - focaModalService.alert('Ingrese Domicilio'); | |
256 | - return; | |
257 | 257 | } else if($scope.articulosTabla.length === 0) { |
258 | 258 | focaModalService.alert('Debe cargar al menos un articulo'); |
259 | 259 | return; |
... | ... | @@ -261,37 +261,50 @@ angular.module('focaCrearRemito') .controller('remitoController', |
261 | 261 | var date = new Date(); |
262 | 262 | var remito = { |
263 | 263 | id: 0, |
264 | - fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
264 | + fechaRemito: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
265 | 265 | .toISOString().slice(0, 19).replace('T', ' '), |
266 | - idVendedor: $scope.remito.vendedor.codigo, | |
267 | - idCliente: $scope.remito.cliente.cod, | |
268 | - nombreCliente: $scope.remito.cliente.nom, | |
269 | - cuitCliente: $scope.remito.cliente.cuit, | |
270 | - idProveedor: $scope.remito.proveedor.codigo, | |
271 | - idDomicilio: $scope.remito.domicilio.id, | |
272 | - idCotizacion: $scope.remito.cotizacion.ID, | |
273 | - cotizacion: $scope.remito.cotizacion.COTIZACION, | |
266 | + idCliente: $scope.remito.idCliente, | |
267 | + nombreCliente: $scope.remito.nombreCliente, | |
268 | + cuitCliente: $scope.remito.cuitCliente, | |
269 | + responsabilidadIvaCliente: 0,//TODO, | |
270 | + descuento: 0,//TODO, | |
271 | + importeNeto: 0,//TODO | |
272 | + importeExento: 0,//TODO | |
273 | + importeIva: 0,//TODO | |
274 | + importeIvaServicios: 0,//TODO | |
275 | + importeImpuestoInterno: 0,//TODO | |
276 | + importeImpuestoInterno1: 0,//TODO | |
277 | + importeImpuestoInterno2: 0,//TODO | |
278 | + percepcion: 0,//TODO | |
279 | + percepcionIva: 0,//TODO | |
280 | + redondeo: 0,//TODO | |
281 | + total: $scope.getTotal(), | |
282 | + numeroNotaPedido: $scope.remito.numeroNotaPedido, | |
283 | + anulado: false, | |
284 | + planilla: 0,//TODO | |
285 | + lugar: 0,//TODO | |
286 | + cuentaMadre: 0,// | |
287 | + cuentaContable: 0,//TODO | |
288 | + asiento: 0,//TODO | |
289 | + e_hd: '',//TODO | |
290 | + c_hd: '', | |
291 | + numeroLiquidoProducto: 0,//TODO | |
292 | + idVendedor: $scope.remito.idVendedor, | |
293 | + idProveedor: $scope.remito.idProveedor, | |
294 | + idDomicilio: 0,//TODO | |
295 | + idCotizacion: $scope.remito.idCotizacion, | |
274 | 296 | flete: $scope.remito.flete, |
275 | 297 | fob: $scope.remito.fob, |
276 | 298 | bomba: $scope.remito.bomba, |
277 | 299 | kilometros: $scope.remito.kilometros, |
278 | - estado: 0, | |
279 | - total: $scope.getTotal() | |
300 | + estado: 0,//TODO | |
301 | + destinoVenta: 0,//TODO | |
302 | + operacionTipo: 0//TODO | |
280 | 303 | }; |
281 | 304 | crearRemitoService.crearRemito(remito).then( |
282 | 305 | function(data) { |
283 | 306 | remitoBusinessService.addArticulos($scope.articulosTabla, |
284 | 307 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
285 | - var plazos = $scope.plazosPagos; | |
286 | - for(var j = 0; j < plazos.length; j++) { | |
287 | - var json = { | |
288 | - idRemito: data.data.id, | |
289 | - dias: plazos[j].dias | |
290 | - }; | |
291 | - crearRemitoService.crearPlazosParaRemito(json); | |
292 | - } | |
293 | - remitoBusinessService.addEstado(data.data.id, | |
294 | - $scope.remito.vendedor.codigo); | |
295 | 308 | |
296 | 309 | focaModalService.alert('Nota remito creada'); |
297 | 310 | $scope.cabecera = []; |
src/js/service.js
... | ... | @@ -4,7 +4,7 @@ angular.module('focaCrearRemito') |
4 | 4 | return { |
5 | 5 | crearRemito: function(remito) { |
6 | 6 | // TODO: Cambiar para usar el servicio /remito |
7 | - return $http.post(route + '/nota-pedido', {remito: remito}); | |
7 | + return $http.post(route + '/remito', {remito: remito}); | |
8 | 8 | }, |
9 | 9 | obtenerRemito: function() { |
10 | 10 | return $http.get(route +'/nota-pedido'); |
... | ... | @@ -22,7 +22,7 @@ angular.module('focaCrearRemito') |
22 | 22 | return $http.get(route+'/articulos/nota-pedido/'+id); |
23 | 23 | }, |
24 | 24 | crearArticulosParaRemito: function(articuloRemito) { |
25 | - return $http.post(route + '/articulos/nota-pedido', | |
25 | + return $http.post(route + '/articulos/remito', | |
26 | 26 | {articuloRemito: articuloRemito}); |
27 | 27 | }, |
28 | 28 | getDomiciliosByIdRemito: function(id) { |