Commit c67108edd7d28510802a5d107c10806109a2b0b0

Authored by Eric Fernandez
1 parent 5447472a40
Exists in master

agrego estados a la nota de pedido

src/js/businessService.js
... ... @@ -11,6 +11,17 @@ angular.module('focaCrearNotaPedido')
11 11 articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion;
12 12 crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]);
13 13 }
  14 + },
  15 + addEstado: function(idNotaPedido, idVendedor) {
  16 + var date = new Date();
  17 + var estado = {
  18 + idNotaPedido: idNotaPedido,
  19 + fecha: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
  20 + .toISOString().slice(0, 19).replace('T', ' '),
  21 + estado: 0,
  22 + idVendedor: idVendedor
  23 + };
  24 + crearNotaPedidoService.crearEstadoParaNotaPedido(estado);
14 25 }
15 26 };
16 27 }]);
17 28 \ No newline at end of file
src/js/controller.js
... ... @@ -113,7 +113,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
113 113 if(!$scope.notaPedido.vendedor.codigo) {
114 114 focaModalService.alert('Ingrese Vendedor');
115 115 return;
116   - } else if(!$scope.notaPedido.cliente.id) {
  116 + } else if(!$scope.notaPedido.cliente.cod) {
117 117 focaModalService.alert('Ingrese Cliente');
118 118 return;
119 119 } else if(!$scope.notaPedido.proveedor.codigo) {
... ... @@ -128,7 +128,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
128 128 } else if(!$scope.plazosPagos) {
129 129 focaModalService.alert('Ingrese Precios y Condiciones');
130 130 return;
131   - } else if($scope.notaPedido.flete === undefined) {
  131 + } else if(
  132 + $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null)
  133 + {
132 134 focaModalService.alert('Ingrese Flete');
133 135 return;
134 136 } else if(!$scope.notaPedido.domicilio.id) {
... ... @@ -144,14 +146,18 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
144 146 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
145 147 .toISOString().slice(0, 19).replace('T', ' '),
146 148 idVendedor: $scope.notaPedido.vendedor.codigo,
147   - idCliente: $scope.notaPedido.cliente.id,
  149 + idCliente: $scope.notaPedido.cliente.cod,
  150 + nombreCliente: $scope.notaPedido.cliente.nom,
  151 + cuitCliente: $scope.notaPedido.cliente.cuit,
148 152 idProveedor: $scope.notaPedido.proveedor.codigo,
149 153 idDomicilio: $scope.notaPedido.domicilio.id,
150 154 idCotizacion: $scope.notaPedido.cotizacion.ID,
  155 + cotizacion: $scope.notaPedido.cotizacion.COTIZACION,
151 156 flete: $scope.notaPedido.flete,
152 157 fob: $scope.notaPedido.fob,
153 158 bomba: $scope.notaPedido.bomba,
154 159 kilometros: $scope.notaPedido.kilometros,
  160 + estado: 0,
155 161 total: $scope.getTotal()
156 162 };
157 163 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
... ... @@ -167,6 +173,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
167 173 };
168 174 crearNotaPedidoService.crearPlazosParaNotaPedido(json);
169 175 }
  176 + notaPedidoBusinessService.addEstado(data.data.id,
  177 + $scope.notaPedido.vendedor.codigo);
  178 +
170 179 focaModalService.alert('Nota pedido creada');
171 180 $scope.cabecera = [];
172 181 addCabecera('Moneda:', $scope.notaPedido.moneda.detalle);
... ... @@ -317,7 +326,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
317 326 modalInstanceDomicilio.result.then(
318 327 function(domicilio) {
319 328 $scope.notaPedido.domicilio.id = domicilio.id;
320   - $scope.notaPedido.cliente.id = cliente.cod;
  329 + $scope.notaPedido.cliente = cliente;
  330 +
321 331 addCabecera('Cliente:', cliente.nom);
322 332 addCabecera('Domicilio:', domicilio.dom);
323 333 }, function() {
... ... @@ -49,14 +49,8 @@ angular.module('focaCrearNotaPedido')
49 49 getCotizacionByIdMoneda: function(id) {
50 50 return $http.get(route + '/moneda/' + id);
51 51 },
52   - addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) {
53   - for(var i = 0; i < articulosNotaPedido.length; i++) {
54   - delete articulosNotaPedido[i].editCantidad;
55   - delete articulosNotaPedido[i].editPrecio;
56   - articulosNotaPedido[i].idNotaPedido = idNotaPedido;
57   - articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion;
58   - this.crearArticulosParaNotaPedido(articulosNotaPedido[i]);
59   - }
  52 + crearEstadoParaNotaPedido: function(estado) {
  53 + return $http.post(route + '/estado', {estado: estado});
60 54 }
61 55 };
62 56 }]);