Commit 8862ecdfd96fc9373f96b7419b989603e18d5e04

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'develop' into 'master'

Develop

See merge request !77
src/js/controller.js
1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
2 [ 2 [
3 '$scope', 3 '$scope',
4 '$uibModal', 4 '$uibModal',
5 '$location', 5 '$location',
6 '$filter', 6 '$filter',
7 '$timeout', 7 '$timeout',
8 'crearNotaPedidoService', 8 'crearNotaPedidoService',
9 'focaBotoneraLateralService', 9 'focaBotoneraLateralService',
10 'focaModalService', 10 'focaModalService',
11 'notaPedidoBusinessService', 11 'notaPedidoBusinessService',
12 '$rootScope', 12 '$rootScope',
13 'focaSeguimientoService', 13 'focaSeguimientoService',
14 'APP', 14 'APP',
15 'focaLoginService', 15 'focaLoginService',
16 '$localStorage', 16 '$localStorage',
17 function( 17 function(
18 $scope, $uibModal, $location, $filter, $timeout, crearNotaPedidoService, 18 $scope, $uibModal, $location, $filter, $timeout, crearNotaPedidoService,
19 focaBotoneraLateralService, focaModalService, notaPedidoBusinessService, 19 focaBotoneraLateralService, focaModalService, notaPedidoBusinessService,
20 $rootScope, focaSeguimientoService, APP, focaLoginService, $localStorage) 20 $rootScope, focaSeguimientoService, APP, focaLoginService, $localStorage)
21 { 21 {
22 config(); 22 config();
23 23
24 function config() { 24 function config() {
25 // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA 25 // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA
26 $scope.tmpCantidad = Number;
27 $scope.tmpPrecio = Number;
26 $scope.notaPedido = {}; 28 $scope.notaPedido = {};
27 $scope.isNumber = angular.isNumber; 29 $scope.isNumber = angular.isNumber;
28 $scope.datepickerAbierto = false; 30 $scope.datepickerAbierto = false;
29 $scope.show = false; 31 $scope.show = false;
30 $scope.cargando = true; 32 $scope.cargando = true;
31 $scope.botonera = crearNotaPedidoService.getBotonera(); 33 $scope.botonera = crearNotaPedidoService.getBotonera();
32 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); 34 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4);
33 $scope.comprobante = $filter('rellenarDigitos')(0, 8); 35 $scope.comprobante = $filter('rellenarDigitos')(0, 8);
34 $scope.dateOptions = { 36 $scope.dateOptions = {
35 maxDate: new Date(), 37 maxDate: new Date(),
36 minDate: new Date(2010, 0, 1) 38 minDate: new Date(2010, 0, 1)
37 }; 39 };
38 40
39 //SETEO BOTONERA LATERAL 41 //SETEO BOTONERA LATERAL
40 $timeout(function() { 42 $timeout(function() {
41 focaBotoneraLateralService.showSalir(false); 43 focaBotoneraLateralService.showSalir(false);
42 focaBotoneraLateralService.showPausar(true); 44 focaBotoneraLateralService.showPausar(true);
43 focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); 45 focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido);
44 focaBotoneraLateralService.addCustomButton('Salir', salir); 46 focaBotoneraLateralService.addCustomButton('Salir', salir);
45 }); 47 });
46 48
47 // SETEA BOTONERA DE FACTURADOR TENIENDO EN CUENTA SI ESTA SETEADO EL VENDEDOR 49 // SETEA BOTONERA DE FACTURADOR TENIENDO EN CUENTA SI ESTA SETEADO EL VENDEDOR
48 if (APP === 'distribuidor') { 50 if (APP === 'distribuidor') {
49 $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador; 51 $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador;
50 } 52 }
51
52 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 53 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
53 crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { 54 //Trabajo con el proveedor YPF, por eso uso siempre la primera
54 var monedaPorDefecto = res.data[0]; 55
56 var promiseMoneda = crearNotaPedidoService.getCotizacionByIdMoneda(1);
57 var promiseProveedor = crearNotaPedidoService.getProveedorById(1);
58
59 Promise.all([promiseMoneda, promiseProveedor]).then(function(res) {
60 var monedaPorDefecto = res[0].data[0];
55 $scope.notaPedido.cotizacion = Object.assign( 61 $scope.notaPedido.cotizacion = Object.assign(
56 {moneda: monedaPorDefecto}, 62 {moneda: monedaPorDefecto},
57 monedaPorDefecto.cotizaciones[0] 63 monedaPorDefecto.cotizaciones[0]
58 ); 64 );
59 $scope.inicial.cotizacion = $scope.notaPedido.cotizacion; 65 $scope.inicial.cotizacion = $scope.notaPedido.cotizacion;
66 var proveedorPorDefecto = res[1].data[0];
67 $scope.notaPedido.proveedor = Object.assign(
68 {proveedor: proveedorPorDefecto}
69 );
70 $scope.inicial.proveedor = $scope.notaPedido.proveedor;
71
60 $timeout(function() {getLSNotaPedido();}); 72 $timeout(function() {getLSNotaPedido();});
61 }); 73 });
62 74
63 init(); 75 init();
64 76
65 } 77 }
66 78
67 function init() { 79 function init() {
68 $scope.$broadcast('cleanCabecera'); 80 $scope.$broadcast('cleanCabecera');
69 81
70 $scope.notaPedido = { 82 $scope.notaPedido = {
71 id: 0, 83 id: 0,
72 cliente: {}, 84 cliente: {},
73 proveedor: {}, 85 proveedor: {},
74 domicilio: {dom: ''}, 86 domicilio: {dom: ''},
75 vendedor: {}, 87 vendedor: {},
76 fechaCarga: new Date(), 88 fechaCarga: new Date(),
77 cotizacion: {}, 89 cotizacion: {},
78 articulosNotaPedido: [], 90 articulosNotaPedido: [],
79 notaPedidoPlazo: [] 91 notaPedidoPlazo: [],
92 notaPedidoPuntoDescarga: {
93 puntoDescarga: {}
94 }
80 }; 95 };
81 $scope.idLista = undefined; 96 $scope.idLista = undefined;
82 97
83 crearNotaPedidoService.getNumeroNotaPedido().then( 98 crearNotaPedidoService.getNumeroNotaPedido().then(
84 function(res) { 99 function(res) {
85 $scope.puntoVenta = $filter('rellenarDigitos')( 100 $scope.puntoVenta = $filter('rellenarDigitos')(
86 res.data.sucursal, 4 101 res.data.sucursal, 4
87 ); 102 );
88 103
89 $scope.comprobante = $filter('rellenarDigitos')( 104 $scope.comprobante = $filter('rellenarDigitos')(
90 res.data.numeroNotaPedido, 8 105 res.data.numeroNotaPedido, 8
91 ); 106 );
92 }, 107 },
93 function(err) { 108 function(err) {
94 focaModalService.alert('La terminal no esta configurada correctamente'); 109 focaModalService.alert('La terminal no esta configurada correctamente');
95 console.info(err); 110 console.info(err);
96 } 111 }
97 ); 112 );
98 113
99 if (APP === 'distribuidor') { 114 if (APP === 'distribuidor') {
100 crearNotaPedidoService.getVendedorById($scope.idVendedor).then( 115 crearNotaPedidoService.getVendedorById($scope.idVendedor).then(
101 function(res) { 116 function(res) {
102 var vendedor = res.data; 117 var vendedor = res.data;
103 $scope.$broadcast('addCabecera', { 118 $scope.$broadcast('addCabecera', {
104 label: 'Vendedor:', 119 label: 'Vendedor:',
105 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + 120 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
106 vendedor.NOM 121 vendedor.NOM
107 }); 122 });
108 123
109 $scope.notaPedido.vendedor = vendedor; 124 $scope.notaPedido.vendedor = vendedor;
110 } 125 }
111 ); 126 );
112 } 127 }
113 128
114 $scope.inicial = angular.copy($scope.notaPedido); 129 $scope.inicial = angular.copy($scope.notaPedido);
115 } 130 }
116 131
117 $scope.$watch('notaPedido', function(newValue) { 132 $scope.$watch('notaPedido', function(newValue) {
118 focaBotoneraLateralService.setPausarData({ 133 focaBotoneraLateralService.setPausarData({
119 label: 'notaPedido', 134 label: 'notaPedido',
120 val: newValue 135 val: newValue
121 }); 136 });
122 }, true); 137 }, true);
123 138
124 $scope.crearNotaPedido = function() { 139 $scope.crearNotaPedido = function() {
125 if (!$scope.notaPedido.cliente.COD) { 140 if (!$scope.notaPedido.cliente.COD) {
126 focaModalService.alert('Ingrese Cliente'); 141 focaModalService.alert('Ingrese Cliente');
127 return; 142 return;
143 } else if ($scope.notaPedido.idRemito === -1) {
144 focaBotoneraLateralService.alert('No se puede modificar esta nota de pedido');
145 return;
128 } else if (!$scope.notaPedido.proveedor.COD) { 146 } else if (!$scope.notaPedido.proveedor.COD) {
129 focaModalService.alert('Ingrese Proveedor'); 147 focaModalService.alert('Ingrese Proveedor');
130 return; 148 return;
131 } else if (!$scope.notaPedido.cotizacion.ID) { 149 } else if (!$scope.notaPedido.cotizacion.ID) {
132 focaModalService.alert('Ingrese Cotización'); 150 focaModalService.alert('Ingrese Cotización');
133 return; 151 return;
134 } else if (!$scope.notaPedido.cotizacion.moneda.ID) { 152 } else if (!$scope.notaPedido.cotizacion.moneda.ID) {
135 focaModalService.alert('Ingrese Moneda'); 153 focaModalService.alert('Ingrese Moneda');
136 return; 154 return;
137 } else if (!$scope.notaPedido.notaPedidoPlazo) { 155 } else if (!$scope.notaPedido.notaPedidoPlazo) {
138 focaModalService.alert('Ingrese Precios y Condiciones'); 156 focaModalService.alert('Ingrese Precios y Condiciones');
139 return; 157 return;
140 } else if ( 158 } else if (
141 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) 159 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null)
142 { 160 {
143 focaModalService.alert('Ingrese Flete'); 161 focaModalService.alert('Ingrese Flete');
144 return; 162 return;
145 } else if (!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto 163 } else if (!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto
146 focaModalService.alert('Ingrese Domicilio'); 164 focaModalService.alert('Ingrese Domicilio');
147 return; 165 return;
148 } else if ($scope.notaPedido.articulosNotaPedido.length === 0) { 166 } else if ($scope.notaPedido.articulosNotaPedido.length === 0) {
149 focaModalService.alert('Debe cargar al menos un articulo'); 167 focaModalService.alert('Debe cargar al menos un articulo');
150 return; 168 return;
151 } 169 }
170
152 focaBotoneraLateralService.startGuardar(); 171 focaBotoneraLateralService.startGuardar();
153 $scope.saveLoading = true; 172 $scope.saveLoading = true;
154 var notaPedido = { 173 var notaPedido = {
155 id: $scope.notaPedido.id, 174 id: $scope.notaPedido.id,
156 fechaCarga: new Date($scope.notaPedido.fechaCarga) 175 fechaCarga: new Date($scope.notaPedido.fechaCarga)
157 .toISOString().slice(0, 19).replace('T', ' '), 176 .toISOString().slice(0, 19).replace('T', ' '),
158 idVendedor: $scope.notaPedido.vendedor.id, 177 idVendedor: $scope.notaPedido.vendedor.id,
159 idCliente: $scope.notaPedido.cliente.COD, 178 idCliente: $scope.notaPedido.cliente.COD,
160 nombreCliente: $scope.notaPedido.cliente.NOM, 179 nombreCliente: $scope.notaPedido.cliente.NOM,
161 cuitCliente: $scope.notaPedido.cliente.CUIT, 180 cuitCliente: $scope.notaPedido.cliente.CUIT,
162 idProveedor: $scope.notaPedido.proveedor.COD, 181 idProveedor: $scope.notaPedido.proveedor.COD,
163 idDomicilio: $scope.notaPedido.domicilio.id, 182 idDomicilio: $scope.notaPedido.domicilio.id,
164 idCotizacion: $scope.notaPedido.cotizacion.ID, 183 idCotizacion: $scope.notaPedido.cotizacion.ID,
165 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, 184 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion,
166 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 185 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
167 flete: $scope.notaPedido.flete, 186 flete: $scope.notaPedido.flete,
168 fob: $scope.notaPedido.fob, 187 fob: $scope.notaPedido.fob,
169 bomba: $scope.notaPedido.bomba, 188 bomba: $scope.notaPedido.bomba,
170 kilometros: $scope.notaPedido.kilometros, 189 kilometros: $scope.notaPedido.kilometros,
171 domicilioStamp: $scope.notaPedido.domicilioStamp, 190 domicilioStamp: $scope.notaPedido.domicilioStamp,
172 observaciones: $scope.notaPedido.observaciones, 191 observaciones: $scope.notaPedido.observaciones,
173 estado: 0, 192 estado: 0,
174 total: $scope.getTotal() 193 total: $scope.getTotal()
175 }; 194 };
176 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 195 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
177 function(data) { 196 function(data) {
178 // Al guardar los datos de la nota de pedido logueamos la 197 // Al guardar los datos de la nota de pedido logueamos la
179 // actividad para su seguimiento. 198 // actividad para su seguimiento.
180 //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? 199 //TODO: GUARDAR POSISIONAMIENTO AL EDITAR?
181 focaSeguimientoService.guardarPosicion( 200 focaSeguimientoService.guardarPosicion(
182 'Nota de pedido', 201 'Nota de pedido',
183 data.data.id, 202 data.data.id,
184 '' 203 ''
185 ); 204 );
186 notaPedidoBusinessService.addArticulos( 205 notaPedidoBusinessService.addArticulos(
187 $scope.notaPedido.articulosNotaPedido, 206 $scope.notaPedido.articulosNotaPedido,
188 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); 207 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR);
189 208
190 if ($scope.notaPedido.notaPedidoPuntoDescarga) { 209 if ($scope.notaPedido.notaPedidoPuntoDescarga) {
191 notaPedidoBusinessService.addPuntosDescarga(data.data.id, 210 notaPedidoBusinessService.addPuntosDescarga(data.data.id,
192 $scope.notaPedido.notaPedidoPuntoDescarga); 211 $scope.notaPedido.notaPedidoPuntoDescarga);
193 } 212 }
194 213
195 var plazos = $scope.notaPedido.notaPedidoPlazo; 214 var plazos = $scope.notaPedido.notaPedidoPlazo;
196 var plazosACrear = []; 215 var plazosACrear = [];
197 plazos.forEach(function(plazo) { 216 plazos.forEach(function(plazo) {
198 plazosACrear.push({ 217 plazosACrear.push({
199 idNotaPedido: data.data.id, 218 idNotaPedido: data.data.id,
200 dias: plazo.dias 219 dias: plazo.dias
201 }); 220 });
202 }); 221 });
203 222
204 if (plazosACrear.length) { 223 if (plazosACrear.length) {
205 crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear); 224 crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear);
206 } 225 }
207 226
208 notaPedidoBusinessService.addEstado(data.data.id, 227 notaPedidoBusinessService.addEstado(data.data.id,
209 $scope.notaPedido.vendedor.id); 228 $scope.notaPedido.vendedor.id);
210 229
211 focaBotoneraLateralService.endGuardar(true); 230 focaBotoneraLateralService.endGuardar(true);
212 $scope.saveLoading = false; 231 $scope.saveLoading = false;
213 232
214 init(); 233 init();
215 }, function(error) { 234 }, function(error) {
216 focaModalService.alert('Hubo un error al crear la nota de pedido'); 235 focaModalService.alert('Hubo un error al crear la nota de pedido');
217 focaBotoneraLateralService.endGuardar(); 236 focaBotoneraLateralService.endGuardar();
218 $scope.saveLoading = false; 237 $scope.saveLoading = false;
219 console.info(error); 238 console.info(error);
220 } 239 });
221 );
222 }; 240 };
223 241
224 $scope.seleccionarNotaPedido = function() { 242 $scope.seleccionarNotaPedido = function() {
225 var modalInstance = $uibModal.open( 243 var modalInstance = $uibModal.open(
226 { 244 {
227 ariaLabelledBy: 'Busqueda de Nota de Pedido', 245 ariaLabelledBy: 'Busqueda de Nota de Pedido',
228 templateUrl: 'foca-modal-nota-pedido.html', 246 templateUrl: 'foca-modal-nota-pedido.html',
229 controller: 'focaModalNotaPedidoController', 247 controller: 'focaModalNotaPedidoController',
230 size: 'lg', 248 size: 'lg',
231 resolve: { 249 resolve: {
232 usadoPor: function() {return 'notaPedido';}, 250 usadoPor: function() {return 'notaPedido';},
233 idVendedor: function() { 251 idVendedor: function() {
234 if (APP === 'distribuidor') 252 if (APP === 'distribuidor')
235 return $scope.notaPedido.vendedor.id; 253 return $scope.notaPedido.vendedor.id;
236 else 254 else
237 return null; 255 return null;
238 } 256 }
239 } 257 }
240 } 258 }
241 ); 259 );
242 modalInstance.result.then(setearNotaPedido); 260 modalInstance.result.then(setearNotaPedido);
243 }; 261 };
244 262
245 $scope.seleccionarProductos = function() { 263 $scope.seleccionarProductos = function() {
246 if ($scope.idLista === undefined) { 264 if ($scope.idLista === undefined) {
247 focaModalService.alert( 265 focaModalService.alert(
248 'Primero seleccione una lista de precio y condicion'); 266 'Primero seleccione una lista de precio y condicion');
249 return; 267 return;
250 } 268 }
251 var modalInstance = $uibModal.open( 269 var modalInstance = $uibModal.open(
252 { 270 {
253 ariaLabelledBy: 'Busqueda de Productos', 271 ariaLabelledBy: 'Busqueda de Productos',
254 templateUrl: 'modal-busqueda-productos.html', 272 templateUrl: 'modal-busqueda-productos.html',
255 controller: 'modalBusquedaProductosCtrl', 273 controller: 'modalBusquedaProductosCtrl',
256 resolve: { 274 resolve: {
257 parametroProducto: { 275 parametroProducto: {
258 idLista: $scope.idLista, 276 idLista: $scope.idLista,
259 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 277 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
260 simbolo: $scope.notaPedido.cotizacion.moneda.SIMBOLO 278 simbolo: $scope.notaPedido.cotizacion.moneda.SIMBOLO
261 } 279 }
262 }, 280 },
263 size: 'lg' 281 size: 'lg'
264 } 282 }
265 ); 283 );
266 modalInstance.result.then( 284 modalInstance.result.then(
267 function(producto) { 285 function(producto) {
268 var newArt = 286 var newArt =
269 { 287 {
270 id: 0, 288 id: 0,
271 codigo: producto.codigo, 289 codigo: producto.codigo,
272 sector: producto.sector, 290 sector: producto.sector,
273 sectorCodigo: producto.sector + '-' + producto.codigo, 291 sectorCodigo: producto.sector + '-' + producto.codigo,
274 descripcion: producto.descripcion, 292 descripcion: producto.descripcion,
275 item: $scope.notaPedido.articulosNotaPedido.length + 1, 293 item: $scope.notaPedido.articulosNotaPedido.length + 1,
276 nombre: producto.descripcion, 294 nombre: producto.descripcion,
277 precio: parseFloat(producto.precio.toFixed(4)), 295 precio: parseFloat(producto.precio.toFixed(4)),
278 costoUnitario: producto.costo, 296 costoUnitario: producto.costo,
279 editCantidad: false, 297 editCantidad: false,
280 editPrecio: false, 298 editPrecio: false,
281 rubro: producto.CodRub, 299 rubro: producto.CodRub,
282 exentoUnitario: producto.precio, 300 exentoUnitario: producto.precio,
283 ivaUnitario: producto.IMPIVA, 301 ivaUnitario: producto.IMPIVA,
284 impuestoInternoUnitario: producto.ImpInt, 302 impuestoInternoUnitario: producto.ImpInt,
285 impuestoInterno1Unitario: producto.ImpInt2, 303 impuestoInterno1Unitario: producto.ImpInt2,
286 impuestoInterno2Unitario: producto.ImpInt3, 304 impuestoInterno2Unitario: producto.ImpInt3,
287 precioLista: producto.precio, 305 precioLista: producto.precio,
288 combustible: 1, 306 combustible: 1,
289 facturado: 0, 307 facturado: 0,
290 idArticulo: producto.id 308 idArticulo: producto.id
291 }; 309 };
292 $scope.articuloACargar = newArt; 310 $scope.articuloACargar = newArt;
293 $scope.cargando = false; 311 $scope.cargando = false;
294 }, function() { 312 }, function() {
295 // funcion ejecutada cuando se cancela el modal 313 // funcion ejecutada cuando se cancela el modal
296 } 314 }
297 ); 315 );
298 }; 316 };
299 317
300 $scope.seleccionarPuntosDeDescarga = function() { 318 $scope.seleccionarPuntosDeDescarga = function() {
301 if (!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) { 319 if (!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) {
302 focaModalService.alert('Primero seleccione un cliente y un domicilio'); 320 focaModalService.alert('Primero seleccione un cliente y un domicilio');
303 return; 321 return;
304 } else { 322 } else {
305 var modalInstance = $uibModal.open( 323 var modalInstance = $uibModal.open(
306 { 324 {
307 ariaLabelledBy: 'Búsqueda de Puntos de descarga', 325 ariaLabelledBy: 'Búsqueda de Puntos de descarga',
308 templateUrl: 'modal-punto-descarga.html', 326 templateUrl: 'modal-punto-descarga.html',
309 controller: 'focaModalPuntoDescargaController', 327 controller: 'focaModalPuntoDescargaController',
310 size: 'lg', 328 size: 'lg',
311 resolve: { 329 resolve: {
312 filters: { 330 filters: {
313 idDomicilio: $scope.notaPedido.domicilio.id, 331 idDomicilio: $scope.notaPedido.domicilio.id,
314 idCliente: $scope.notaPedido.cliente.COD, 332 idCliente: $scope.notaPedido.cliente.COD,
315 articulos: $scope.notaPedido.articulosNotaPedido, 333 articulos: $scope.notaPedido.articulosNotaPedido,
316 puntosDescarga: $scope.notaPedido.notaPedidoPuntoDescarga, 334 puntoDescarga: $scope.notaPedido.notaPedidoPuntoDescarga,
317 domicilio: $scope.notaPedido.domicilio 335 domicilio: $scope.notaPedido.domicilio
318 } 336 }
319 } 337 }
320 } 338 }
321 ); 339 );
322 modalInstance.result.then( 340 modalInstance.result.then(
323 function(puntosDescarga) { 341 function(puntoDescarga) {
324 $scope.notaPedido.notaPedidoPuntoDescarga = puntosDescarga; 342 $scope.notaPedido.notaPedidoPuntoDescarga = puntoDescarga;
325 343
326 $scope.$broadcast('addCabecera', { 344 $scope.$broadcast('addCabecera', {
327 label: 'Puntos de descarga:', 345 label: 'Puntos de descarga:',
328 valor: getCabeceraPuntoDescarga(puntosDescarga) 346 valor: getCabeceraPuntoDescarga(puntoDescarga)
329 }); 347 });
330 }, function() { 348 }, function() {
331 $scope.abrirModalDomicilios($scope.cliente); 349 $scope.abrirModalDomicilios($scope.cliente);
332 } 350 }
333 ); 351 );
334 } 352 }
335 }; 353 };
336 354
337 $scope.seleccionarProveedor = function() { 355 $scope.seleccionarProveedor = function() {
338 $scope.abrirModalProveedores(function() { 356 $scope.abrirModalProveedores(function() {
339 if (validarNotaRemitada()) { 357 if (validarNotaRemitada()) {
340 var modalInstance = $uibModal.open( 358 var modalInstance = $uibModal.open(
341 { 359 {
342 ariaLabelledBy: 'Busqueda de Flete', 360 ariaLabelledBy: 'Busqueda de Flete',
343 templateUrl: 'modal-flete.html', 361 templateUrl: 'modal-flete.html',
344 controller: 'focaModalFleteController', 362 controller: 'focaModalFleteController',
345 size: 'lg', 363 size: 'lg',
346 resolve: { 364 resolve: {
347 parametrosFlete: 365 parametrosFlete:
348 function() { 366 function() {
349 return { 367 return {
350 flete: $scope.notaPedido.fob ? 'FOB' : 368 flete: $scope.notaPedido.fob ? 'FOB' :
351 ( $scope.notaPedido.flete ? '1' : 369 ( $scope.notaPedido.flete ? '1' :
352 ($scope.notaPedido.flete === undefined ? 370 ($scope.notaPedido.flete === undefined ?
353 null : '0')), 371 null : '0')),
354 bomba: $scope.notaPedido.bomba ? '1' : 372 bomba: $scope.notaPedido.bomba ? '1' :
355 ($scope.notaPedido.bomba === undefined ? 373 ($scope.notaPedido.bomba === undefined ?
356 null : '0'), 374 null : '0'),
357 kilometros: $scope.notaPedido.kilometros 375 kilometros: $scope.notaPedido.kilometros
358 }; 376 };
359 } 377 }
360 } 378 }
361 } 379 }
362 ); 380 );
363 modalInstance.result.then( 381 modalInstance.result.then(
364 function(datos) { 382 function(datos) {
365 $scope.notaPedido.flete = datos.flete; 383 $scope.notaPedido.flete = datos.flete;
366 $scope.notaPedido.fob = datos.FOB; 384 $scope.notaPedido.fob = datos.FOB;
367 $scope.notaPedido.bomba = datos.bomba; 385 $scope.notaPedido.bomba = datos.bomba;
368 $scope.notaPedido.kilometros = datos.kilometros; 386 $scope.notaPedido.kilometros = datos.kilometros;
369 $scope.$broadcast('addCabecera', { 387 $scope.$broadcast('addCabecera', {
370 label: 'Flete:', 388 label: 'Flete:',
371 valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') 389 valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')
372 }); 390 });
373 if (datos.flete) { 391 if (datos.flete) {
374 $scope.$broadcast('addCabecera', { 392 $scope.$broadcast('addCabecera', {
375 label: 'Bomba:', 393 label: 'Bomba:',
376 valor: datos.bomba ? 'Si' : 'No' 394 valor: datos.bomba ? 'Si' : 'No'
377 }); 395 });
378 $scope.$broadcast('addCabecera', { 396 $scope.$broadcast('addCabecera', {
379 label: 'Kilometros:', 397 label: 'Kilometros:',
380 valor: datos.kilometros 398 valor: datos.kilometros
381 }); 399 });
382 } else { 400 } else {
383 $scope.$broadcast('removeCabecera', 'Bomba:'); 401 $scope.$broadcast('removeCabecera', 'Bomba:');
384 $scope.$broadcast('removeCabecera', 'Kilometros:'); 402 $scope.$broadcast('removeCabecera', 'Kilometros:');
385 $scope.notaPedido.bomba = false; 403 $scope.notaPedido.bomba = false;
386 $scope.notaPedido.kilometros = null; 404 $scope.notaPedido.kilometros = null;
387 } 405 }
388 }, function() { 406 }, function() {
389 $scope.seleccionarTransportista(); 407 $scope.seleccionarTransportista();
390 } 408 }
391 ); 409 );
392 } 410 }
393 }); 411 });
394 }; 412 };
395 413
396 $scope.seleccionarVendedor = function(callback, ocultarVendedor) { 414 $scope.seleccionarVendedor = function(callback, ocultarVendedor) {
397 if (APP === 'distribuidor' || ocultarVendedor) { 415 if (APP === 'distribuidor' || ocultarVendedor) {
398 callback(); 416 callback();
399 return; 417 return;
400 } 418 }
401 419
402 if (validarNotaRemitada()) { 420 if (validarNotaRemitada()) {
403 var parametrosModal = { 421 var parametrosModal = {
404 titulo: 'Búsqueda vendedores', 422 titulo: 'Búsqueda vendedores',
405 query: '/vendedor', 423 query: '/vendedor',
406 columnas: [ 424 columnas: [
407 { 425 {
408 propiedad: 'NUM', 426 propiedad: 'NUM',
409 nombre: 'Código', 427 nombre: 'Código',
410 filtro: { 428 filtro: {
411 nombre: 'rellenarDigitos', 429 nombre: 'rellenarDigitos',
412 parametro: 3 430 parametro: 3
413 } 431 }
414 }, 432 },
415 { 433 {
416 propiedad: 'NOM', 434 propiedad: 'NOM',
417 nombre: 'Nombre' 435 nombre: 'Nombre'
418 } 436 }
419 ], 437 ],
420 size: 'md' 438 size: 'md'
421 }; 439 };
422 focaModalService.modal(parametrosModal).then( 440 focaModalService.modal(parametrosModal).then(
423 function(vendedor) { 441 function(vendedor) {
424 $scope.$broadcast('addCabecera', { 442 $scope.$broadcast('addCabecera', {
425 label: 'Vendedor:', 443 label: 'Vendedor:',
426 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + 444 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
427 vendedor.NOM 445 vendedor.NOM
428 }); 446 });
429 $scope.notaPedido.vendedor = vendedor; 447 $scope.notaPedido.vendedor = vendedor;
430 deleteCliente(); 448 deleteCliente();
431 callback(); 449 callback();
432 }, function() {} 450 }, function() {}
433 ); 451 );
434 } 452 }
435 }; 453 };
436 454
437 $scope.seleccionarCliente = function(ocultarVendedor) { 455 $scope.seleccionarCliente = function(ocultarVendedor) {
438 $scope.seleccionarVendedor(function() { 456 $scope.seleccionarVendedor(function() {
439 if (validarNotaRemitada()) { 457 if (validarNotaRemitada()) {
440 var modalInstance = $uibModal.open( 458 var modalInstance = $uibModal.open(
441 { 459 {
442 ariaLabelledBy: 'Busqueda de Cliente', 460 ariaLabelledBy: 'Busqueda de Cliente',
443 templateUrl: 'foca-busqueda-cliente-modal.html', 461 templateUrl: 'foca-busqueda-cliente-modal.html',
444 controller: 'focaBusquedaClienteModalController', 462 controller: 'focaBusquedaClienteModalController',
445 resolve: { 463 resolve: {
446 vendedor: function() { return $scope.notaPedido.vendedor; }, 464 vendedor: function() { return $scope.notaPedido.vendedor; },
447 cobrador: function() { return null; } 465 cobrador: function() { return null; }
448 }, 466 },
449 size: 'lg' 467 size: 'lg'
450 } 468 }
451 ); 469 );
452 modalInstance.result.then( 470 modalInstance.result.then(
453 function(cliente) { 471 function(cliente) {
454 $scope.abrirModalDomicilios(cliente); 472 $scope.abrirModalDomicilios(cliente);
455 $scope.cliente = cliente; 473 $scope.cliente = cliente;
456 }, function() { 474 }, function() {
457 if (APP !== 'distribuidor') $scope.seleccionarCliente(); 475 if (APP !== 'distribuidor') $scope.seleccionarCliente();
458 } 476 }
459 ); 477 );
460 } 478 }
461 }, ocultarVendedor); 479 }, ocultarVendedor);
462 }; 480 };
463 481
464 $scope.abrirModalProveedores = function(callback) { 482 $scope.abrirModalProveedores = function(callback) {
465 if (validarNotaRemitada()) { 483 if (validarNotaRemitada()) {
466 var parametrosModal = { 484 var parametrosModal = {
467 titulo: 'Búsqueda de Proveedor', 485 titulo: 'Búsqueda de Proveedor',
468 query: '/proveedor', 486 query: '/proveedor',
469 columnas: [ 487 columnas: [
470 { 488 {
471 nombre: 'Código', 489 nombre: 'Código',
472 propiedad: 'COD', 490 propiedad: 'COD',
473 filtro: { 491 filtro: {
474 nombre: 'rellenarDigitos', 492 nombre: 'rellenarDigitos',
475 parametro: 5 493 parametro: 5
476 } 494 }
477 }, 495 },
478 { 496 {
479 nombre: 'Nombre', 497 nombre: 'Nombre',
480 propiedad: 'NOM' 498 propiedad: 'NOM'
481 }, 499 },
482 { 500 {
483 nombre: 'CUIT', 501 nombre: 'CUIT',
484 propiedad: 'CUIT' 502 propiedad: 'CUIT'
485 } 503 }
486 ], 504 ],
487 tipo: 'POST', 505 tipo: 'POST',
488 json: {razonCuitCod: ''} 506 json: {razonCuitCod: ''}
489 }; 507 };
490 focaModalService.modal(parametrosModal).then( 508 focaModalService.modal(parametrosModal).then(
491 function(proveedor) { 509 function(proveedor) {
492 $scope.notaPedido.proveedor = proveedor; 510 $scope.notaPedido.proveedor = proveedor;
493 $scope.$broadcast('addCabecera', { 511 $scope.$broadcast('addCabecera', {
494 label: 'Proveedor:', 512 label: 'Proveedor:',
495 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + 513 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
496 proveedor.NOM 514 proveedor.NOM
497 }); 515 });
498 callback(); 516 callback();
499 }, function() { 517 }, function() {
500 518
501 } 519 }
502 ); 520 );
503 } 521 }
504 }; 522 };
505 523
506 $scope.abrirModalDomicilios = function(cliente) { 524 $scope.abrirModalDomicilios = function(cliente) {
507 var modalInstanceDomicilio = $uibModal.open( 525 var modalInstanceDomicilio = $uibModal.open(
508 { 526 {
509 ariaLabelledBy: 'Busqueda de Domicilios', 527 ariaLabelledBy: 'Busqueda de Domicilios',
510 templateUrl: 'modal-domicilio.html', 528 templateUrl: 'modal-domicilio.html',
511 controller: 'focaModalDomicilioController', 529 controller: 'focaModalDomicilioController',
512 resolve: { 530 resolve: {
513 idCliente: function() { return cliente.cod; }, 531 idCliente: function() { return cliente.cod; },
514 esNuevo: function() { return cliente.esNuevo; } 532 esNuevo: function() { return cliente.esNuevo; }
515 }, 533 },
516 size: 'lg', 534 size: 'lg',
517 } 535 }
518 ); 536 );
519 modalInstanceDomicilio.result.then( 537 modalInstanceDomicilio.result.then(
520 function(domicilio) { 538 function(domicilio) {
521 $scope.notaPedido.domicilio = domicilio; 539 $scope.notaPedido.domicilio = domicilio;
522 $scope.notaPedido.cliente = { 540 $scope.notaPedido.cliente = {
523 COD: cliente.cod, 541 COD: cliente.cod,
524 CUIT: cliente.cuit, 542 CUIT: cliente.cuit,
525 NOM: cliente.nom, 543 NOM: cliente.nom,
526 MOD: cliente.mod 544 MOD: cliente.mod
527 }; 545 };
528 var domicilioStamp = 546 var domicilioStamp =
529 domicilio.Calle + ' ' + domicilio.Numero + ', ' + 547 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
530 domicilio.Localidad + ', ' + domicilio.Provincia; 548 domicilio.Localidad + ', ' + domicilio.Provincia;
531 $scope.notaPedido.domicilioStamp = domicilioStamp; 549 $scope.notaPedido.domicilioStamp = domicilioStamp;
532 550
533 $scope.notaPedido.notaPedidoPuntoDescarga = domicilio.puntosDescarga; 551 $scope.notaPedido.notaPedidoPuntoDescarga = domicilio.puntoDescarga;
534 552
535 $scope.$broadcast('addCabecera', { 553 $scope.$broadcast('addCabecera', {
536 label: 'Cliente:', 554 label: 'Cliente:',
537 valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom 555 valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom
538 }); 556 });
539 $scope.$broadcast('addCabecera', { 557 $scope.$broadcast('addCabecera', {
540 label: 'Domicilio:', 558 label: 'Domicilio:',
541 valor: domicilioStamp 559 valor: domicilioStamp
542 }); 560 });
543 if (domicilio.verPuntos) { 561 if (domicilio.verPuntos) {
544 delete $scope.notaPedido.domicilio.verPuntos; 562 delete $scope.notaPedido.domicilio.verPuntos;
545 $scope.seleccionarPuntosDeDescarga(); 563 $scope.seleccionarPuntosDeDescarga();
546 } else { 564 } else {
547 crearNotaPedidoService 565 crearNotaPedidoService
548 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) 566 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
549 .then(function(res) { 567 .then(function(res) {
550 if (res.data.length) $scope.seleccionarPuntosDeDescarga(); 568 if (res.data.length) $scope.seleccionarPuntosDeDescarga();
551 }); 569 });
552 } 570 }
553 }, function() { 571 }, function() {
554 $scope.seleccionarCliente(true); 572 $scope.seleccionarCliente(true);
555 return; 573 return;
556 } 574 }
557 ); 575 );
558 }; 576 };
559 577
560 $scope.getTotal = function() { 578 $scope.getTotal = function() {
561 var total = 0; 579 var total = 0;
562 if ($scope.notaPedido.articulosNotaPedido) { 580 if ($scope.notaPedido.articulosNotaPedido) {
563 var arrayTempArticulos = $scope.notaPedido.articulosNotaPedido; 581 var arrayTempArticulos = $scope.notaPedido.articulosNotaPedido;
564 for (var i = 0; i < arrayTempArticulos.length; i++) { 582 for (var i = 0; i < arrayTempArticulos.length; i++) {
565 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 583 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
566 } 584 }
567 } 585 }
568 return parseFloat(total.toFixed(2)); 586 return parseFloat(total.toFixed(2));
569 }; 587 };
570 588
571 $scope.getSubTotal = function() { 589 $scope.getSubTotal = function() {
572 if ($scope.articuloACargar) { 590 if ($scope.articuloACargar) {
573 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 591 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
574 } 592 }
575 }; 593 };
576 594
577 $scope.seleccionarPreciosYCondiciones = function() { 595 $scope.seleccionarPreciosYCondiciones = function() {
578 if (!$scope.notaPedido.cliente.COD) { 596 if (!$scope.notaPedido.cliente.COD) {
579 focaModalService.alert('Primero seleccione un cliente'); 597 focaModalService.alert('Primero seleccione un cliente');
580 return; 598 return;
581 } 599 }
582 if (validarNotaRemitada()) { 600 if ($scope.notaPedido.articulosNotaPedido.length !== 0) {
601 focaModalService.confirm('Se perderan los productos ingresados').then(function(data) {
602 if (data) {
603 abrirModal();
604 }
605 });
606 } else if (validarNotaRemitada()) {
607 abrirModal();
608 }
609 function abrirModal() {
583 var modalInstance = $uibModal.open( 610 var modalInstance = $uibModal.open(
584 { 611 {
585 ariaLabelledBy: 'Busqueda de Precio Condición', 612 ariaLabelledBy: 'Busqueda de Precio Condición',
586 templateUrl: 'modal-precio-condicion.html', 613 templateUrl: 'modal-precio-condicion.html',
587 controller: 'focaModalPrecioCondicionController', 614 controller: 'focaModalPrecioCondicionController',
588 size: 'lg', 615 size: 'lg',
589 resolve: { 616 resolve: {
590 idListaPrecio: function() { 617 idListaPrecio: function() {
591 return $scope.notaPedido.cliente.MOD || null; 618 return $scope.notaPedido.cliente.MOD || null;
592 } 619 }
593 } 620 }
594 } 621 }
595 ); 622 );
623
596 modalInstance.result.then( 624 modalInstance.result.then(
597 function(precioCondicion) { 625 function(precioCondicion) {
598 var cabecera = ''; 626 var cabecera = '';
599 var plazosConcat = ''; 627 var plazosConcat = '';
600 if (!Array.isArray(precioCondicion)) { 628 if (!Array.isArray(precioCondicion)) {
601 $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago; 629 $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago;
602 $scope.notaPedido.precioCondicion = precioCondicion; 630 $scope.notaPedido.precioCondicion = precioCondicion;
603 $scope.notaPedido.idPrecioCondicion = precioCondicion.id; 631 $scope.notaPedido.idPrecioCondicion = precioCondicion.id;
604 $scope.idLista = precioCondicion.idListaPrecio; 632 $scope.idLista = precioCondicion.idListaPrecio;
605 for (var i = 0; i < precioCondicion.plazoPago.length; i++) { 633 for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
606 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 634 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
607 } 635 }
608 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + 636 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
609 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); 637 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
610 } else { //Cuando se ingresan los plazos manualmente 638 } else { //Cuando se ingresan los plazos manualmente
611 $scope.notaPedido.idPrecioCondicion = 0; 639 $scope.notaPedido.idPrecioCondicion = 0;
612 //-1, el modal productos busca todos los productos 640 //-1, el modal productos busca todos los productos
613 $scope.idLista = -1; 641 $scope.idLista = -1;
614 $scope.notaPedido.notaPedidoPlazo = precioCondicion; 642 $scope.notaPedido.notaPedidoPlazo = precioCondicion;
615 for (var j = 0; j < precioCondicion.length; j++) { 643 for (var j = 0; j < precioCondicion.length; j++) {
616 plazosConcat += precioCondicion[j].dias + ' '; 644 plazosConcat += precioCondicion[j].dias + ' ';
617 } 645 }
618 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 646 cabecera = 'Ingreso manual ' + plazosConcat.trim();
619 } 647 }
620 $scope.notaPedido.articulosNotaPedido = []; 648 $scope.notaPedido.articulosNotaPedido = [];
621 $scope.$broadcast('addCabecera', { 649 $scope.$broadcast('addCabecera', {
622 label: 'Precios y condiciones:', 650 label: 'Precios y condiciones:',
623 valor: cabecera 651 valor: cabecera
624 }); 652 });
625 }, function() { 653 }, function() {
626 654
627 } 655 }
628 ); 656 );
629 } 657 }
630 }; 658 };
631 659
632 $scope.seleccionarMoneda = function() { 660 $scope.seleccionarMoneda = function() {
633 if (validarNotaRemitada()) { 661 if (validarNotaRemitada()) {
634 var parametrosModal = { 662 var parametrosModal = {
635 titulo: 'Búsqueda de monedas', 663 titulo: 'Búsqueda de monedas',
636 query: '/moneda', 664 query: '/moneda',
637 columnas: [ 665 columnas: [
638 { 666 {
639 propiedad: 'DETALLE', 667 propiedad: 'DETALLE',
640 nombre: 'Nombre' 668 nombre: 'Nombre'
641 }, 669 },
642 { 670 {
643 propiedad: 'SIMBOLO', 671 propiedad: 'SIMBOLO',
644 nombre: 'Símbolo' 672 nombre: 'Símbolo'
645 } 673 }
646 ], 674 ],
647 size: 'md' 675 size: 'md'
648 }; 676 };
649 focaModalService.modal(parametrosModal).then( 677 focaModalService.modal(parametrosModal).then(
650 function(moneda) { 678 function(moneda) {
651 $scope.abrirModalCotizacion(moneda); 679 $scope.abrirModalCotizacion(moneda);
652 }, function() { 680 }, function() {
653 681
654 } 682 }
655 ); 683 );
656 } 684 }
657 }; 685 };
658 686
659 $scope.seleccionarObservaciones = function() { 687 $scope.seleccionarObservaciones = function() {
660 var observacion = { 688 var observacion = {
661 titulo: 'Ingrese Observaciones', 689 titulo: 'Ingrese Observaciones',
662 value: $scope.notaPedido.observaciones, 690 value: $scope.notaPedido.observaciones,
663 maxlength: 155, 691 maxlength: 155,
664 textarea: true 692 textarea: true
665 }; 693 };
666 694
667 focaModalService 695 focaModalService
668 .prompt(observacion) 696 .prompt(observacion)
669 .then(function(observaciones) { 697 .then(function(observaciones) {
670 $scope.notaPedido.observaciones = observaciones; 698 $scope.notaPedido.observaciones = observaciones;
671 }); 699 });
672 }; 700 };
673 701
674 $scope.abrirModalCotizacion = function(moneda) { 702 $scope.abrirModalCotizacion = function(moneda) {
675 var modalInstance = $uibModal.open( 703 var modalInstance = $uibModal.open(
676 { 704 {
677 ariaLabelledBy: 'Busqueda de Cotización', 705 ariaLabelledBy: 'Busqueda de Cotización',
678 templateUrl: 'modal-cotizacion.html', 706 templateUrl: 'modal-cotizacion.html',
679 controller: 'focaModalCotizacionController', 707 controller: 'focaModalCotizacionController',
680 size: 'lg', 708 size: 'lg',
681 resolve: { 709 resolve: {
682 idMoneda: function() { 710 idMoneda: function() {
683 return moneda.ID; 711 return moneda.ID;
684 } 712 }
685 } 713 }
686 } 714 }
687 ); 715 );
688 modalInstance.result.then( 716 modalInstance.result.then(
689 function(cotizacion) { 717 function(cotizacion) {
690 var articulosTablaTemp = $scope.notaPedido.articulosNotaPedido || []; 718 var articulosTablaTemp = $scope.notaPedido.articulosNotaPedido || [];
691 for (var i = 0; i < articulosTablaTemp.length; i++) { 719 for (var i = 0; i < articulosTablaTemp.length; i++) {
692 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 720 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
693 $scope.notaPedido.cotizacion.VENDEDOR; 721 $scope.notaPedido.cotizacion.VENDEDOR;
694 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 722 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
695 cotizacion.VENDEDOR; 723 cotizacion.VENDEDOR;
696 } 724 }
697 $scope.notaPedido.articulosNotaPedido = articulosTablaTemp; 725 $scope.notaPedido.articulosNotaPedido = articulosTablaTemp;
698 $scope.notaPedido.cotizacion = cotizacion; 726 $scope.notaPedido.cotizacion = cotizacion;
699 $scope.notaPedido.cotizacion.moneda = moneda; 727 $scope.notaPedido.cotizacion.moneda = moneda;
700 if (moneda.DETALLE === 'PESOS ARGENTINOS') { 728 if (moneda.DETALLE === 'PESOS ARGENTINOS') {
701 $scope.$broadcast('removeCabecera', 'Moneda:'); 729 $scope.$broadcast('removeCabecera', 'Moneda:');
702 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); 730 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
703 $scope.$broadcast('removeCabecera', 'Cotizacion:'); 731 $scope.$broadcast('removeCabecera', 'Cotizacion:');
704 } else { 732 } else {
705 $scope.$broadcast('addCabecera', { 733 $scope.$broadcast('addCabecera', {
706 label: 'Moneda:', 734 label: 'Moneda:',
707 valor: moneda.DETALLE 735 valor: moneda.DETALLE
708 }); 736 });
709 $scope.$broadcast('addCabecera', { 737 $scope.$broadcast('addCabecera', {
710 label: 'Fecha cotizacion:', 738 label: 'Fecha cotizacion:',
711 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 739 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
712 }); 740 });
713 $scope.$broadcast('addCabecera', { 741 $scope.$broadcast('addCabecera', {
714 label: 'Cotizacion:', 742 label: 'Cotizacion:',
715 valor: $filter('number')(cotizacion.VENDEDOR, '2') 743 valor: $filter('number')(cotizacion.VENDEDOR, '2')
716 }); 744 });
717 } 745 }
718 }, function() { 746 }, function() {
719 747
720 } 748 }
721 ); 749 );
722 }; 750 };
723 751
724 $scope.agregarATabla = function(key) { 752 $scope.agregarATabla = function(key) {
725 if (key === 13) { 753 if (key === 13) {
726 if ($scope.articuloACargar.cantidad === undefined || 754 if ($scope.articuloACargar.cantidad === undefined ||
727 $scope.articuloACargar.cantidad === 0 || 755 $scope.articuloACargar.cantidad === 0 ||
728 $scope.articuloACargar.cantidad === null ) { 756 $scope.articuloACargar.cantidad === null ) {
729 focaModalService.alert('El valor debe ser al menos 1'); 757 focaModalService.alert('El valor debe ser al menos 1');
730 return; 758 return;
731 } 759 }
732 delete $scope.articuloACargar.sectorCodigo; 760 delete $scope.articuloACargar.sectorCodigo;
733 $scope.notaPedido.articulosNotaPedido.push($scope.articuloACargar); 761 $scope.notaPedido.articulosNotaPedido.push($scope.articuloACargar);
734 $scope.cargando = true; 762 $scope.cargando = true;
735 } 763 }
736 }; 764 };
737 765
738 $scope.quitarArticulo = function(key) { 766 $scope.quitarArticulo = function(key) {
739 $scope.notaPedido.articulosNotaPedido.splice(key, 1); 767 $scope.notaPedido.articulosNotaPedido.splice(key, 1);
740 }; 768 };
741 769
742 $scope.editarArticulo = function(key, articulo) { 770 $scope.editarArticulo = function(key, articulo, tmpCantidad, tmpPrecio) {
743 if (key === 13) { 771 if (key === 13) {
744 if (articulo.cantidad === null || articulo.cantidad === 0 || 772 if (!articulo.cantidad || !articulo.precio) {
745 articulo.cantidad === undefined) { 773 focaModalService.alert('Los valores deben ser al menos 1');
746 focaModalService.alert('El valor debe ser al menos 1'); 774 return;
775 } else if (articulo.cantidad < 0 || articulo.precio < 0) {
776 focaModalService.alert('Los valores no pueden ser negativos');
747 return; 777 return;
748 } 778 }
749 articulo.editCantidad = false; 779 articulo.cantidad = tmpCantidad;
750 articulo.editPrecio = false; 780 articulo.precio = tmpPrecio;
781 $scope.getTotal();
782 articulo.editCantidad = articulo.editPrecio = false;
751 } 783 }
752 }; 784 };
753 785
786 $scope.cancelarEditar = function(articulo) {
787 $scope.tmpCantidad = articulo.cantidad;
788 $scope.tmpPrecio = articulo.precio;
789 articulo.editCantidad = articulo.editPrecio = false;
790 };
791
754 $scope.cambioEdit = function(articulo, propiedad) { 792 $scope.cambioEdit = function(articulo, propiedad) {
755 if (propiedad === 'cantidad') { 793 if (propiedad === 'cantidad') {
756 articulo.editCantidad = true; 794 articulo.editCantidad = true;
757 } else if (propiedad === 'precio') { 795 } else if (propiedad === 'precio') {
758 articulo.editPrecio = true; 796 articulo.editPrecio = true;
759 } 797 }
760 }; 798 };
761 799
762 $scope.resetFilter = function() { 800 $scope.resetFilter = function() {
763 $scope.articuloACargar = {}; 801 $scope.articuloACargar = {};
764 $scope.cargando = true; 802 $scope.cargando = true;
765 }; 803 };
766 //Recibe aviso si el teclado está en uso 804 //Recibe aviso si el teclado está en uso
767 $rootScope.$on('usarTeclado', function(event, data) { 805 $rootScope.$on('usarTeclado', function(event, data) {
768 if (data) { 806 if (data) {
769 $scope.mostrarTeclado = true; 807 $scope.mostrarTeclado = true;
770 return; 808 return;
771 } 809 }
772 $scope.mostrarTeclado = false; 810 $scope.mostrarTeclado = false;
773 }); 811 });
774 812
775 $scope.selectFocus = function($event) { 813 $scope.selectFocus = function($event) {
776 // Si el teclado esta en uso no selecciona el valor 814 // Si el teclado esta en uso no selecciona el valor
777 if ($scope.mostrarTeclado) { 815 if ($scope.mostrarTeclado) {
778 return; 816 return;
779 } 817 }
780 $event.target.select(); 818 $event.target.select();
781 }; 819 };
782 820
783 $scope.salir = function() { 821 $scope.salir = function() {
784 $location.path('/'); 822 $location.path('/');
785 }; 823 };
786 824
787 $scope.parsearATexto = function(articulo) { 825 $scope.parsearATexto = function(articulo) {
788 articulo.cantidad = parseFloat(articulo.cantidad); 826 articulo.cantidad = parseFloat(articulo.cantidad);
789 articulo.precio = parseFloat(articulo.precio); 827 articulo.precio = parseFloat(articulo.precio);
790 }; 828 };
791 829
792 function setearNotaPedido(notaPedido) { 830 function setearNotaPedido(notaPedido) {
793 //añado cabeceras 831 //añado cabeceras
794 $scope.notaPedido = notaPedido; 832 $scope.notaPedido = notaPedido;
795 if (!$scope.notaPedido.domicilio) { 833 if (!$scope.notaPedido.domicilio) {
796 $scope.notaPedido.domicilio = { 834 $scope.notaPedido.domicilio = {
797 id: $scope.notaPedido.idDomicilio 835 id: $scope.notaPedido.idDomicilio
798 }; 836 };
799 } 837 }
800 $scope.$broadcast('removeCabecera', 'Bomba:'); 838 $scope.$broadcast('removeCabecera', 'Bomba:');
801 $scope.$broadcast('removeCabecera', 'Kilometros:'); 839 $scope.$broadcast('removeCabecera', 'Kilometros:');
802 $scope.$broadcast('cleanCabecera'); 840 $scope.$broadcast('cleanCabecera');
803 841
804 var cabeceras = []; 842 var cabeceras = [];
805 843
806 if (notaPedido.cotizacion.moneda.CODIGO_AFIP !== 'PES') { 844 if (notaPedido.cotizacion.moneda.CODIGO_AFIP !== 'PES') {
807 cabeceras.push({ 845 cabeceras.push({
808 label: 'Moneda:', 846 label: 'Moneda:',
809 valor: notaPedido.cotizacion.moneda.DETALLE 847 valor: notaPedido.cotizacion.moneda.DETALLE
810 }); 848 });
811 cabeceras.push({ 849 cabeceras.push({
812 label: 'Fecha cotizacion:', 850 label: 'Fecha cotizacion:',
813 valor: $filter('date')(notaPedido.cotizacion.FECHA, 851 valor: $filter('date')(notaPedido.cotizacion.FECHA,
814 'dd/MM/yyyy') 852 'dd/MM/yyyy')
815 }); 853 });
816 cabeceras.push({ 854 cabeceras.push({
817 label: 'Cotizacion:', 855 label: 'Cotizacion:',
818 valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, 856 valor: $filter('number')(notaPedido.cotizacion.VENDEDOR,
819 '2') 857 '2')
820 }); 858 });
821 } 859 }
822 860
823 if (notaPedido.vendedor.NUM) { 861 if (notaPedido.vendedor.NUM) {
824 cabeceras.push({ 862 cabeceras.push({
825 label: 'Vendedor:', 863 label: 'Vendedor:',
826 valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) + 864 valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) +
827 ' - ' + notaPedido.vendedor.NOM 865 ' - ' + notaPedido.vendedor.NOM
828 }); 866 });
829 } 867 }
830 868
831 if (notaPedido.cliente.COD) { 869 if (notaPedido.cliente.COD) {
832 cabeceras.push({ 870 cabeceras.push({
833 label: 'Cliente:', 871 label: 'Cliente:',
834 valor: notaPedido.cliente.NOM 872 valor: notaPedido.cliente.NOM
835 }); 873 });
836 cabeceras.push({ 874 cabeceras.push({
837 label: 'Domicilio:', 875 label: 'Domicilio:',
838 valor: notaPedido.domicilioStamp 876 valor: notaPedido.domicilioStamp
839 }); 877 });
840 } 878 }
841 879
842 if (notaPedido.proveedor.COD) { 880 if (notaPedido.proveedor.COD) {
843 cabeceras.push({ 881 cabeceras.push({
844 label: 'Proveedor:', 882 label: 'Proveedor:',
845 valor: $filter('rellenarDigitos')(notaPedido.proveedor.COD, 5) + 883 valor: $filter('rellenarDigitos')(notaPedido.proveedor.COD, 5) +
846 ' - ' + notaPedido.proveedor.NOM 884 ' - ' + notaPedido.proveedor.NOM
847 }); 885 });
848 } 886 }
849 887
850 if (notaPedido.notaPedidoPlazo.length) { 888 if (notaPedido.notaPedidoPlazo.length) {
851 cabeceras.push({ 889 cabeceras.push({
852 label: 'Precios y condiciones:', 890 label: 'Precios y condiciones:',
853 valor: valorPrecioCondicion() + ' ' + 891 valor: valorPrecioCondicion() + ' ' +
854 notaPedidoBusinessService 892 notaPedidoBusinessService
855 .plazoToString(notaPedido.notaPedidoPlazo) 893 .plazoToString(notaPedido.notaPedidoPlazo)
856 }); 894 });
857 } 895 }
858 896
859 if (notaPedido.flete !== undefined) { 897 if (notaPedido.flete !== undefined) {
860 cabeceras.push({ 898 cabeceras.push({
861 label: 'Flete:', 899 label: 'Flete:',
862 valor: notaPedido.fob === 1 ? 'FOB' : ( 900 valor: notaPedido.fob === 1 ? 'FOB' : (
863 notaPedido.flete === 1 ? 'Si' : 'No') 901 notaPedido.flete === 1 ? 'Si' : 'No')
864 }); 902 });
865 } 903 }
866 904
867 function valorPrecioCondicion() { 905 function valorPrecioCondicion() {
868 if (notaPedido.idPrecioCondicion > 0) { 906 if (notaPedido.idPrecioCondicion > 0) {
869 return notaPedido.precioCondicion.nombre; 907 return notaPedido.precioCondicion.nombre;
870 } else { 908 } else {
871 return 'Ingreso Manual'; 909 return 'Ingreso Manual';
872 } 910 }
873 } 911 }
874 912
875 if (notaPedido.flete === 1) { 913 if (notaPedido.flete === 1) {
876 var cabeceraBomba = { 914 var cabeceraBomba = {
877 label: 'Bomba:', 915 label: 'Bomba:',
878 valor: notaPedido.bomba === 1 ? 'Si' : 'No' 916 valor: notaPedido.bomba === 1 ? 'Si' : 'No'
879 }; 917 };
880 if (notaPedido.kilometros) { 918 if (notaPedido.kilometros) {
881 var cabeceraKilometros = { 919 var cabeceraKilometros = {
882 label: 'Kilometros:', 920 label: 'Kilometros:',
883 valor: notaPedido.kilometros 921 valor: notaPedido.kilometros
884 }; 922 };
885 cabeceras.push(cabeceraKilometros); 923 cabeceras.push(cabeceraKilometros);
886 } 924 }
887 cabeceras.push(cabeceraBomba); 925 cabeceras.push(cabeceraBomba);
888 } 926 }
889 927
890 if (notaPedido.idPrecioCondicion > 0) { 928 if (notaPedido.idPrecioCondicion > 0) {
891 $scope.idLista = notaPedido.precioCondicion.idListaPrecio; 929 $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
892 } else { 930 } else {
893 $scope.idLista = -1; 931 $scope.idLista = -1;
894 } 932 }
895 933
896 $scope.puntoVenta = $filter('rellenarDigitos')( 934 $scope.puntoVenta = $filter('rellenarDigitos')(
897 notaPedido.sucursal, 4 935 notaPedido.sucursal, 4
898 ); 936 );
899 937
900 $scope.comprobante = $filter('rellenarDigitos')( 938 $scope.comprobante = $filter('rellenarDigitos')(
901 notaPedido.numeroNotaPedido, 8 939 notaPedido.numeroNotaPedido, 8
902 ); 940 );
903 941
904 if (notaPedido.notaPedidoPuntoDescarga) { 942 if (notaPedido.notaPedidoPuntoDescarga) {
905 var puntosDescarga = notaPedido.notaPedidoPuntoDescarga 943 var puntos = [];
944 notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedidoPuntoDescarga, idx, arr) {
945 puntos.push(notaPedidoPuntoDescarga.puntoDescarga);
946 });
906 cabeceras.push({ 947 cabeceras.push({
907 label: 'Puntos de descarga: ', 948 label: 'Puntos de descarga: ',
908 valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga)) 949 valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntos))
909 }); 950 });
910 } 951 }
911 952
912 addArrayCabecera(cabeceras); 953 addArrayCabecera(cabeceras);
913 } 954 }
914 955
915 function getCabeceraPuntoDescarga(puntosDescarga){ 956 function getCabeceraPuntoDescarga(puntoDescarga){
916 var puntosStamp = ''; 957 var puntosStamp = '';
917 puntosDescarga.forEach(function(punto, idx, arr) { 958 puntoDescarga.forEach(function(punto, idx, arr) {
918 puntosStamp += punto.descripcion; 959 puntosStamp += punto.descripcion;
919 if ((idx + 1) !== arr.length) puntosStamp += ', '; 960 if ((idx + 1) !== arr.length) puntosStamp += ', ';
920 }); 961 });
921 return puntosStamp; 962 return puntosStamp;
922 } 963 }
923 964
924 function addArrayCabecera(array) { 965 function addArrayCabecera(array) {
925 for (var i = 0; i < array.length; i++) { 966 for (var i = 0; i < array.length; i++) {
926 $scope.$broadcast('addCabecera', { 967 $scope.$broadcast('addCabecera', {
927 label: array[i].label, 968 label: array[i].label,
928 valor: array[i].valor 969 valor: array[i].valor
929 }); 970 });
930 } 971 }
931 } 972 }
932 973
933 function validarNotaRemitada() { 974 function validarNotaRemitada() {
934 if (!$scope.notaPedido.idRemito) { 975 if (!$scope.notaPedido.idRemito) {
935 return true; 976 return true;
936 } else { 977 } else {
937 focaModalService.alert('No se puede editar una nota de pedido remitada'); 978 focaModalService.alert('No se puede editar una nota de pedido remitada');
938 return false; 979 return false;
939 } 980 }
940 } 981 }
941 982
942 function salir() { 983 function salir() {
943 var confirmacion = false; 984 var confirmacion = false;
944 985
945 if (!angular.equals($scope.notaPedido, $scope.inicial)) { 986 if (!angular.equals($scope.notaPedido, $scope.inicial)) {
946 confirmacion = true; 987 confirmacion = true;
947 } 988 }
948 989
949 if (confirmacion) { 990 if (confirmacion) {
950 focaModalService.confirm( 991 focaModalService.confirm(
951 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 992 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
952 ).then(function(data) { 993 ).then(function(data) {
953 if (data) { 994 if (data) {
954 $location.path('/'); 995 $location.path('/');
955 } 996 }
956 }); 997 });
957 } else { 998 } else {
958 $location.path('/'); 999 $location.path('/');
959 } 1000 }
960 } 1001 }
961 1002
962 function getLSNotaPedido() { 1003 function getLSNotaPedido() {
963 var notaPedido = JSON.parse($localStorage.notaPedido || null); 1004 var notaPedido = JSON.parse($localStorage.notaPedido || null);
964 if (notaPedido) { 1005 if (notaPedido) {
965 delete $localStorage.notaPedido; 1006 delete $localStorage.notaPedido;
966 setearNotaPedido(notaPedido); 1007 setearNotaPedido(notaPedido);
967 } 1008 }
968 } 1009 }
969 1010
970 function deleteCliente() { 1011 function deleteCliente() {
971 delete $scope.notaPedido.domicilioStamp; 1012 delete $scope.notaPedido.domicilioStamp;
972 delete $scope.notaPedido.notaPedidoPuntoDescarga; 1013 delete $scope.notaPedido.notaPedidoPuntoDescarga;
973 $scope.notaPedido.domicilio = {dom: ''}; 1014 $scope.notaPedido.domicilio = {dom: ''};
974 $scope.notaPedido.cliente = {}; 1015 $scope.notaPedido.cliente = {};
975 $scope.$broadcast('removeCabecera', 'Cliente:'); 1016 $scope.$broadcast('removeCabecera', 'Cliente:');
976 $scope.$broadcast('removeCabecera', 'Domicilio:'); 1017 $scope.$broadcast('removeCabecera', 'Domicilio:');
977 $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); 1018 $scope.$broadcast('removeCabecera', 'Puntos de descarga:');
978 } 1019 }
979 } 1020 }
1 angular.module('focaCrearNotaPedido') 1 angular.module('focaCrearNotaPedido')
2 .factory('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .factory('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 3 var route = API_ENDPOINT.URL;
4 return { 4 return {
5 crearNotaPedido: function(notaPedido) { 5 crearNotaPedido: function(notaPedido) {
6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); 6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido});
7 }, 7 },
8 obtenerNotaPedido: function() { 8 obtenerNotaPedido: function() {
9 return $http.get(route +'/nota-pedido'); 9 return $http.get(route +'/nota-pedido');
10 }, 10 },
11 setNotaPedido: function(notaPedido) { 11 setNotaPedido: function(notaPedido) {
12 this.notaPedido = notaPedido; 12 this.notaPedido = notaPedido;
13 }, 13 },
14 clearNotaPedido: function() { 14 clearNotaPedido: function() {
15 this.notaPedido = undefined; 15 this.notaPedido = undefined;
16 }, 16 },
17 getNotaPedido: function() { 17 getNotaPedido: function() {
18 return this.notaPedido; 18 return this.notaPedido;
19 }, 19 },
20 getArticulosByIdNotaPedido: function(id) { 20 getArticulosByIdNotaPedido: function(id) {
21 return $http.get(route+'/articulos/nota-pedido/'+id); 21 return $http.get(route+'/articulos/nota-pedido/'+id);
22 }, 22 },
23 crearArticulosParaNotaPedido: function(articuloNotaPedido) { 23 crearArticulosParaNotaPedido: function(articuloNotaPedido) {
24 return $http.post(route + '/articulos/nota-pedido', 24 return $http.post(route + '/articulos/nota-pedido',
25 {articuloNotaPedido: articuloNotaPedido}); 25 {articuloNotaPedido: articuloNotaPedido});
26 }, 26 },
27 getDomiciliosByIdNotaPedido: function(id) { 27 getDomiciliosByIdNotaPedido: function(id) {
28 return $http.get(route +'/nota-pedido/'+id+'/domicilios'); 28 return $http.get(route +'/nota-pedido/'+id+'/domicilios');
29 }, 29 },
30 getDomiciliosByIdCliente: function(id) { 30 getDomiciliosByIdCliente: function(id) {
31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 }, 33 },
34 getPrecioCondicion: function() { 34 getPrecioCondicion: function() {
35 return $http.get(route + '/precio-condicion'); 35 return $http.get(route + '/precio-condicion');
36 }, 36 },
37 getPrecioCondicionById: function(id) { 37 getPrecioCondicionById: function(id) {
38 return $http.get(route + '/precio-condicion/' + id); 38 return $http.get(route + '/precio-condicion/' + id);
39 }, 39 },
40 getPlazoPagoByPrecioCondicion: function(id) { 40 getPlazoPagoByPrecioCondicion: function(id) {
41 return $http.get(route + '/plazo-pago/precio-condicion/'+ id); 41 return $http.get(route + '/plazo-pago/precio-condicion/'+ id);
42 }, 42 },
43 crearFlete: function(flete) { 43 crearFlete: function(flete) {
44 return $http.post(route + '/flete', {flete : flete}); 44 return $http.post(route + '/flete', {flete : flete});
45 }, 45 },
46 crearPlazosParaNotaPedido: function(plazos) { 46 crearPlazosParaNotaPedido: function(plazos) {
47 return $http.post(route + '/plazo-pago/nota-pedido', {plazos: plazos}); 47 return $http.post(route + '/plazo-pago/nota-pedido', {plazos: plazos});
48 }, 48 },
49 getCotizacionByIdMoneda: function(id) { 49 getCotizacionByIdMoneda: function(id) {
50 return $http.get(route + '/moneda/' + id); 50 return $http.get(route + '/moneda/' + id);
51 }, 51 },
52 crearEstadoParaNotaPedido: function(estado) { 52 crearEstadoParaNotaPedido: function(estado) {
53 return $http.post(route + '/estado', {estado: estado}); 53 return $http.post(route + '/estado', {estado: estado});
54 }, 54 },
55 getNumeroNotaPedido: function() { 55 getNumeroNotaPedido: function() {
56 return $http.get(route + '/nota-pedido/numero-siguiente'); 56 return $http.get(route + '/nota-pedido/numero-siguiente');
57 }, 57 },
58 getBotonera: function() { 58 getBotonera: function() {
59 var result = [ 59 var result = [
60 { 60 {
61 label: 'Cliente', 61 label: 'Cliente',
62 image: 'cliente.png' 62 image: 'cliente.png'
63 }, 63 },
64 { 64 {
65 label: 'Proveedor', 65 label: 'Proveedor',
66 image: 'proveedor.png' 66 image: 'proveedor.png'
67 }, 67 },
68 { 68 {
69 label: 'Moneda', 69 label: 'Moneda',
70 image: 'moneda.png' 70 image: 'moneda.png'
71 }, 71 },
72 { 72 {
73 label: 'Precios y condiciones', 73 label: 'Precios y condiciones',
74 image: 'precios-condiciones.png' 74 image: 'precios-condiciones.png'
75 }, 75 },
76 { 76 {
77 label: 'Productos', 77 label: 'Productos',
78 image: 'productos.png' 78 image: 'productos.png'
79 }, 79 },
80 { 80 {
81 label: 'Observaciones', 81 label: 'Observaciones',
82 image: 'botonObservaciones.png' 82 image: 'botonObservaciones.png'
83 } 83 }
84 ]; 84 ];
85 return result; 85 return result;
86 }, 86 },
87 crearPuntosDescarga: function(puntosDescarga) { 87 crearPuntosDescarga: function(puntosDescarga) {
88 return $http.post(route + '/puntos-descarga/nota-pedido', 88 return $http.post(route + '/puntos-descarga/nota-pedido',
89 {puntosDescarga: puntosDescarga}); 89 {puntosDescarga: puntosDescarga});
90 }, 90 },
91 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { 91 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) {
92 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + 92 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' +
93 idDomicilio + '/' + idCliente); 93 idDomicilio + '/' + idCliente);
94 }, 94 },
95 getVendedorById: function(id) { 95 getVendedorById: function(id) {
96 return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); 96 return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id);
97 },
98 getProveedorById: function(id) {
99 return $http.get(API_ENDPOINT.URL + '/proveedor/' + id);
97 } 100 }
101
98 }; 102 };
99 }]); 103 }]);
100 104
src/views/nota-pedido.html
1 <div class="crear-nota-pedido foca-crear row"> 1 <div class="crear-nota-pedido foca-crear row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Nota de pedido'" 3 titulo="'Nota de pedido'"
4 numero="puntoVenta + '-' + comprobante" 4 numero="puntoVenta + '-' + comprobante"
5 fecha="notaPedido.fechaCarga" 5 fecha="notaPedido.fechaCarga"
6 class="mb-0 col-lg-12" 6 class="mb-0 col-lg-12"
7 busqueda="seleccionarNotaPedido" 7 busqueda="seleccionarNotaPedido"
8 ></foca-cabecera-facturador> 8 ></foca-cabecera-facturador>
9 <marquee 9 <marquee
10 bgcolor="#FF9900" 10 bgcolor="#FF9900"
11 behavior="scroll" 11 behavior="scroll"
12 direction="left" 12 direction="left"
13 ng-bind="notaPedido.observaciones" 13 ng-bind="notaPedido.observaciones"
14 ></marquee> 14 ></marquee>
15 <div class="col-lg-12"> 15 <div class="col-lg-12">
16 <div class="row"> 16 <div class="row">
17 <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> 17 <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
18 <div class="row py-2 botonera-secundaria"> 18 <div class="row py-2 botonera-secundaria">
19 <div class="col-12 foca-facturador-px"> 19 <div class="col-12 foca-facturador-px">
20 <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> 20 <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador>
21 </div> 21 </div>
22 </div> 22 </div>
23 <!-- PC --> 23 <!-- PC -->
24 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 24 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
25 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 25 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
26 <thead> 26 <thead>
27 <tr class="d-flex"> 27 <tr class="d-flex">
28 <th valign="middle" class="">#</th> 28 <th valign="middle" class="">#</th>
29 <th valign="middle" class="col">Código</th> 29 <th valign="middle" class="col">Código</th>
30 <th valign="middle" class="col-4">Descripción</th> 30 <th valign="middle" class="col-4">Descripción</th>
31 <th valign="middle" class="col text-right">Cantidad</th> 31 <th valign="middle" class="col text-right">Cantidad</th>
32 <th valign="middle" class="col text-right">Precio Unitario</th> 32 <th valign="middle" class="col text-right">Precio Unitario</th>
33 <th valign="middle" class="col text-right">SubTotal</th> 33 <th valign="middle" class="col text-right">SubTotal</th>
34 <th valign="middle" class="text-right"> 34 <th valign="middle" class="text-right">
35 <button 35 <button
36 class="btn btn-outline-light selectable" 36 class="btn btn-outline-light selectable"
37 ng-click="show = !show; masMenos()" 37 ng-click="show = !show; masMenos()"
38 > 38 >
39 <i 39 <i
40 class="fa fa-chevron-down" 40 class="fa fa-chevron-down"
41 ng-show="show" 41 ng-show="show"
42 aria-hidden="true" 42 aria-hidden="true"
43 > 43 >
44 </i> 44 </i>
45 <i 45 <i
46 class="fa fa-chevron-up" 46 class="fa fa-chevron-up"
47 ng-hide="show" 47 ng-hide="show"
48 aria-hidden="true"> 48 aria-hidden="true">
49 </i> 49 </i>
50 </button> 50 </button>
51 </th> 51 </th>
52 </tr> 52 </tr>
53 </thead> 53 </thead>
54 <tbody class="tabla-articulo-body"> 54 <tbody class="tabla-articulo-body">
55 <tr 55 <tr
56 ng-repeat="(key, articulo) in notaPedido.articulosNotaPedido" 56 ng-repeat="(key, articulo) in notaPedido.articulosNotaPedido"
57 ng-show="show || key == (notaPedido.articulosNotaPedido.length - 1)" 57 ng-show="show || key == (notaPedido.articulosNotaPedido.length - 1)"
58 class="d-flex" 58 class="d-flex"
59 > 59 >
60 <td ng-bind="key + 1"></td> 60 <td ng-bind="key + 1"></td>
61 <td 61 <td
62 class="col" 62 class="col"
63 ng-bind="articulo.sector + '-' + articulo.codigo" 63 ng-bind="articulo.sector + '-' + articulo.codigo"
64 ></td> 64 ></td>
65 <td 65 <td
66 class="col-4" 66 class="col-4"
67 ng-bind="articulo.descripcion" 67 ng-bind="articulo.descripcion"
68 ></td> 68 ></td>
69 <td class="col text-right"> 69 <td class="col text-right">
70 <input 70 <input
71 ng-show="articulo.editCantidad" 71 ng-show="articulo.editCantidad && notaPedido.idRemito !== -1"
72 ng-model="articulo.cantidad" 72 ng-model="tmpCantidad"
73 class="form-control" 73 class="form-control"
74 foca-tipo-input 74 foca-tipo-input
75 min="1" 75 min="1"
76 step="0.001"
77 foca-focus="articulo.editCantidad" 76 foca-focus="articulo.editCantidad"
78 ng-keypress="editarArticulo($event.keyCode, articulo)" 77 ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
79 ng-focus="selectFocus($event)" 78 esc-key="cancelarEditar(articulo)"
79 ng-focus="selectFocus($event);
80 tmpCantidad = articulo.cantidad;
81 tmpPrecio = articulo.precio"
80 teclado-virtual 82 teclado-virtual
81 > 83 >
82 <i 84 <i
83 class="selectable" 85 class="selectable"
84 ng-click="cambioEdit(articulo, 'cantidad')" 86 ng-click="cambioEdit(articulo, 'cantidad')"
85 ng-hide="articulo.editCantidad" 87 ng-hide="articulo.editCantidad && notaPedido.idRemito !== -1"
86 ng-bind="articulo.cantidad"> 88 ng-bind="articulo.cantidad">
87 </i> 89 </i>
88 </td> 90 </td>
89 <td class="col text-right"> 91 <td class="col text-right">
90 <input 92 <input
91 ng-show="articulo.editPrecio" 93 ng-show="articulo.editPrecio && notaPedido.idRemito !== -1"
92 ng-model="articulo.precio" 94 ng-model="tmpPrecio"
93 class="form-control" 95 class="form-control"
94 foca-tipo-input 96 foca-tipo-input
95 min="0" 97 min="1"
96 step="0.0001" 98 step="0.0001"
97 foca-focus="articulo.editPrecio" 99 foca-focus="articulo.editPrecio"
98 ng-keypress="editarArticulo($event.keyCode, articulo)" 100 ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
99 ng-focus="selectFocus($event)" 101 esc-key="cancelarEditar(articulo)"
102 ng-focus="selectFocus($event);
103 tmpCantidad = articulo.cantidad;
104 tmpPrecio = articulo.precio"
100 teclado-virtual 105 teclado-virtual
101 > 106 >
102 <i 107 <i
103 class="selectable" 108 class="selectable"
104 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" 109 ng-click="cambioEdit(articulo, 'precio')"
105 ng-hide="articulo.editPrecio" 110 ng-hide="articulo.editPrecio && notaPedido.idRemito !== -1"
106 ng-bind="articulo.precio | 111 ng-bind="articulo.precio | number: 4"
107 number: 4"> 112 >
108 </i> 113 </i>
109 </td> 114 </td>
110 <td 115 <td
111 class="col text-right" 116 class="col text-right"
112 ng-bind="(articulo.precio * articulo.cantidad) | 117 ng-bind="(articulo.precio * articulo.cantidad) |
113 number: 2"> 118 number: 2">
114 </td> 119 </td>
115 <td class="text-center"> 120 <td class="text-center">
116 <button 121 <button
117 ng-show="articulo.editCantidad || articulo.editPrecio" 122 ng-show="articulo.editCantidad || articulo.editPrecio"
118 class="btn btn-outline-light" 123 class="btn btn-outline-light"
119 ng-click="editarArticulo(13, articulo)" 124 ng-click="editarArticulo(13, articulo)"
120 > 125 >
121 <i class="fa fa-save"></i> 126 <i class="fa fa-save"></i>
122 </button> 127 </button>
123 <button 128 <button
124 class="btn btn-outline-light" 129 class="btn btn-outline-light"
125 ng-click="quitarArticulo(key)" 130 ng-click="quitarArticulo(key)"
126 > 131 >
127 <i class="fa fa-trash"></i> 132 <i class="fa fa-trash"></i>
128 </button> 133 </button>
129 </td> 134 </td>
130 </tr> 135 </tr>
131 </tbody> 136 </tbody>
132 <tfoot> 137 <tfoot>
133 <tr ng-show="!cargando" class="d-flex"> 138 <tr ng-show="!cargando" class="d-flex">
134 <td 139 <td
135 class="align-middle" 140 class="align-middle"
136 ng-bind="notaPedido.articulosNotaPedido.length + 1" 141 ng-bind="notaPedido.articulosNotaPedido.length + 1"
137 ></td> 142 ></td>
138 <td class="col"> 143 <td class="col">
139 <input 144 <input
140 class="form-control" 145 class="form-control"
141 ng-model="articuloACargar.sectorCodigo" 146 ng-model="articuloACargar.sectorCodigo"
142 readonly 147 readonly
143 > 148 >
144 </td> 149 </td>
145 <td class="col-4 tabla-articulo-descripcion"> 150 <td class="col-4 tabla-articulo-descripcion">
146 <input 151 <input
147 class="form-control" 152 class="form-control"
148 ng-model="articuloACargar.descripcion" 153 ng-model="articuloACargar.descripcion"
149 readonly 154 readonly
150 > 155 >
151 </td> 156 </td>
152 <td class="col text-right"> 157 <td class="col text-right">
153 <input 158 <input
154 class="form-control" 159 class="form-control"
155 foca-tipo-input 160 foca-tipo-input
156 min="1" 161 min="1"
157 step="0.001" 162 step="0.001"
158 ng-model="articuloACargar.cantidad" 163 ng-model="articuloACargar.cantidad"
159 foca-focus="!cargando" 164 foca-focus="!cargando"
160 esc-key="resetFilter()" 165 esc-key="resetFilter()"
161 ng-keypress="agregarATabla($event.keyCode)" 166 ng-keypress="agregarATabla($event.keyCode)"
162 teclado-virtual 167 teclado-virtual
163 > 168 >
164 </td> 169 </td>
165 <td class="col text-right"> 170 <td class="col text-right">
166 <input 171 <input
167 class="form-control" 172 class="form-control"
168 ng-value="articuloACargar.precio | number: 2" 173 ng-value="articuloACargar.precio | number: 2"
169 ng-show="idLista != -1" 174 ng-show="idLista != -1"
170 readonly 175 readonly
171 > 176 >
172 <input 177 <input
173 class="form-control" 178 class="form-control"
174 foca-tipo-input 179 foca-tipo-input
175 min="0" 180 min="0"
176 step="0.0001" 181 step="0.0001"
177 ng-model="articuloACargar.precio" 182 ng-model="articuloACargar.precio"
178 esc-key="resetFilter()" 183 esc-key="resetFilter()"
179 ng-keypress="agregarATabla($event.keyCode)" 184 ng-keypress="agregarATabla($event.keyCode)"
180 ng-show="idLista == -1" 185 ng-show="idLista == -1"
181 teclado-virtual 186 teclado-virtual
182 > 187 >
183 </td> 188 </td>
184 <td class="col text-right"> 189 <td class="col text-right">
185 <input 190 <input
186 class="form-control" 191 class="form-control"
187 ng-value="getSubTotal() | number: 2" 192 ng-value="getSubTotal() | number: 2"
188 readonly 193 readonly
189 ></td> 194 ></td>
190 <td class="text-center align-middle"> 195 <td class="text-center align-middle">
191 <button 196 <button
192 class="btn btn-outline-light" 197 class="btn btn-outline-light"
193 ng-click="agregarATabla(13)" 198 ng-click="agregarATabla(13)"
194 > 199 >
195 <i class="fa fa-save"></i> 200 <i class="fa fa-save"></i>
196 </button> 201 </button>
197 </td> 202 </td>
198 </tr> 203 </tr>
199 <tr class="d-flex"> 204 <tr class="d-flex">
200 <td colspan="4" class="no-border-top"> 205 <td colspan="4" class="no-border-top">
201 <strong>Items:</strong> 206 <strong>Items:</strong>
202 <a ng-bind="notaPedido.articulosNotaPedido.length"></a> 207 <a ng-bind="notaPedido.articulosNotaPedido.length"></a>
203 </td> 208 </td>
204 <td class="text-right ml-auto table-celda-total no-border-top"> 209 <td class="text-right ml-auto table-celda-total no-border-top">
205 <h3>Total:</h3> 210 <h3>Total:</h3>
206 </td> 211 </td>
207 <td class="table-celda-total text-right no-border-top" colspan="1"> 212 <td class="table-celda-total text-right no-border-top" colspan="1">
208 <h3>{{getTotal() | currency: notaPedido.cotizacion.moneda.SIMBOLO}}</h3> 213 <h3>{{getTotal() | currency: notaPedido.cotizacion.moneda.SIMBOLO}}</h3>
209 </td> 214 </td>
210 <td class="text-right no-border-top"> 215 <td class="text-right no-border-top">
211 <button 216 <button
212 type="button" 217 type="button"
213 class="btn btn-default btn-sm" 218 class="btn btn-default btn-sm"
214 > 219 >
215 Totales 220 Totales
216 </button> 221 </button>
217 </td> 222 </td>
218 </tr> 223 </tr>
219 </tfoot> 224 </tfoot>
220 </table> 225 </table>
221 </div> 226 </div>
222 <!-- MOBILE --> 227 <!-- MOBILE -->
223 <div class="row d-sm-none"> 228 <div class="row d-sm-none">
224 <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> 229 <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile">
225 <thead> 230 <thead>
226 <tr class="d-flex"> 231 <tr class="d-flex">
227 <th class="">#</th> 232 <th class="">#</th>
228 <th class="col px-0"> 233 <th class="col px-0">
229 <div class="d-flex"> 234 <div class="d-flex">
230 <div class="col-4 px-1">Código</div> 235 <div class="col-4 px-1">Código</div>
231 <div class="col-8 px-1">Descripción</div> 236 <div class="col-8 px-1">Descripción</div>
232 </div> 237 </div>
233 <div class="d-flex"> 238 <div class="d-flex">
234 <div class="col-3 px-1">Cantidad</div> 239 <div class="col-3 px-1">Cantidad</div>
235 <div class="col px-1 text-right">P. Uni.</div> 240 <div class="col px-1 text-right">P. Uni.</div>
236 <div class="col px-1 text-right">Subtotal</div> 241 <div class="col px-1 text-right">Subtotal</div>
237 </div> 242 </div>
238 </th> 243 </th>
239 <th class="text-center tamaño-boton"> 244 <th class="text-center tamaño-boton">
240 &nbsp; 245 &nbsp;
241 </th> 246 </th>
242 </tr> 247 </tr>
243 </thead> 248 </thead>
244 <tbody> 249 <tbody>
245 <tr 250 <tr
246 ng-repeat="(key, articulo) in notaPedido.articulosNotaPedido" 251 ng-repeat="(key, articulo) in notaPedido.articulosNotaPedido"
247 ng-show="show || key == notaPedido.articulosNotaPedido.length - 1" 252 ng-show="show || key == notaPedido.articulosNotaPedido.length - 1"
248 > 253 >
249 <td class="w-100 align-middle d-flex p-0"> 254 <td class="w-100 align-middle d-flex p-0">
250 <div class="align-middle p-1"> 255 <div class="align-middle p-1">
251 <span ng-bind="key+1" class="align-middle"></span> 256 <span ng-bind="key+1" class="align-middle"></span>
252 </div> 257 </div>
253 <div class="col px-0"> 258 <div class="col px-0">
254 <div class="d-flex"> 259 <div class="d-flex">
255 <div class="col-4 px-1"> 260 <div class="col-4 px-1">
256 <span 261 <span
257 ng-bind="articulo.sector + '-' + articulo.codigo" 262 ng-bind="articulo.sector + '-' + articulo.codigo"
258 ></span> 263 ></span>
259 </div> 264 </div>
260 <div class="col-8 px-1"> 265 <div class="col-8 px-1">
261 <span ng-bind="articulo.descripcion"></span> 266 <span ng-bind="articulo.descripcion"></span>
262 </div> 267 </div>
263 </div> 268 </div>
264 <div class="d-flex"> 269 <div class="d-flex">
265 <div class="col-3 px-1"> 270 <div class="col-3 px-1">
266 <span 271 <span
267 ng-bind="'x' + articulo.cantidad" 272 ng-bind="'x' + articulo.cantidad"
268 ng-hide="articulo.editCantidad" 273 ng-hide="articulo.editCantidad"
269 ></span> 274 ></span>
270 <i 275 <i
271 class="fa fa-pencil text-white-50" 276 class="fa fa-pencil text-white-50"
272 aria-hidden="true" 277 aria-hidden="true"
273 ng-hide="articulo.editCantidad" 278 ng-hide="articulo.editCantidad"
274 ng-click="articulo.editCantidad = true" 279 ng-click="articulo.editCantidad = true"
275 ></i> 280 ></i>
276 <input 281 <input
277 ng-show="articulo.editCantidad" 282 ng-show="articulo.editCantidad"
278 ng-model="articulo.cantidad" 283 ng-model="articulo.cantidad"
279 class="form-control" 284 class="form-control"
280 foca-tipo-input 285 foca-tipo-input
281 min="1" 286 min="1"
282 step="0.001" 287 step="0.001"
283 foca-focus="articulo.editCantidad" 288 foca-focus="articulo.editCantidad"
284 ng-keypress="editarArticulo($event.keyCode, articulo)" 289 ng-keypress="editarArticulo($event.keyCode, articulo)"
285 ng-focus="selectFocus($event)" 290 ng-focus="selectFocus($event)"
286 > 291 >
287 </div> 292 </div>
288 <div class="col px-1 text-right"> 293 <div class="col px-1 text-right">
289 <span ng-bind="articulo.precio | 294 <span ng-bind="articulo.precio |
290 currency: notaPedido.moneda.SIMBOLO : 4"></span> 295 currency: notaPedido.moneda.SIMBOLO : 4"></span>
291 ></span> 296 ></span>
292 </div> 297 </div>
293 <div class="col px-1 text-right"> 298 <div class="col px-1 text-right">
294 <span 299 <span
295 ng-bind="(articulo.precio * articulo.cantidad) | 300 ng-bind="(articulo.precio * articulo.cantidad) |
296 currency: notaPedido.moneda.SIMBOLO" 301 currency: notaPedido.moneda.SIMBOLO"
297 > 302 >
298 </span> 303 </span>
299 </div> 304 </div>
300 </div> 305 </div>
301 </div> 306 </div>
302 <div class="align-middle p-1"> 307 <div class="align-middle p-1">
303 <button 308 <button
304 class="btn btn-outline-light" 309 class="btn btn-outline-light"
305 ng-click="quitarArticulo(key)" 310 ng-click="quitarArticulo(key)"
306 > 311 >
307 <i class="fa fa-trash"></i> 312 <i class="fa fa-trash"></i>
308 </button> 313 </button>
309 </div> 314 </div>
310 </td> 315 </td>
311 </tr> 316 </tr>
312 </tbody> 317 </tbody>
313 <tfoot> 318 <tfoot>
314 <!-- CARGANDO ITEM --> 319 <!-- CARGANDO ITEM -->
315 <tr ng-show="!cargando" class="d-flex"> 320 <tr ng-show="!cargando" class="d-flex">
316 <td 321 <td
317 class="align-middle p-1" 322 class="align-middle p-1"
318 ng-bind="notaPedido.articulosNotaPedido.length + 1" 323 ng-bind="notaPedido.articulosNotaPedido.length + 1"
319 ></td> 324 ></td>
320 <td class="col p-0"> 325 <td class="col p-0">
321 <div class="d-flex"> 326 <div class="d-flex">
322 <div class="col-4 px-1"> 327 <div class="col-4 px-1">
323 <span 328 <span
324 ng-bind="articuloACargar.sectorCodigo" 329 ng-bind="articuloACargar.sectorCodigo"
325 ></span> 330 ></span>
326 </div> 331 </div>
327 <div class="col-8 px-1"> 332 <div class="col-8 px-1">
328 <span ng-bind="articuloACargar.descripcion"></span> 333 <span ng-bind="articuloACargar.descripcion"></span>
329 </div> 334 </div>
330 </div> 335 </div>
331 <div class="d-flex"> 336 <div class="d-flex">
332 <div class="col-3 px-1 m-1"> 337 <div class="col-3 px-1 m-1">
333 <input 338 <input
334 class="form-control p-1" 339 class="form-control p-1"
335 foca-tipo-input 340 foca-tipo-input
336 min="1" 341 min="1"
337 ng-model="articuloACargar.cantidad" 342 ng-model="articuloACargar.cantidad"
338 foca-focus="!cargando" 343 foca-focus="!cargando"
339 ng-keypress="agregarATabla($event.keyCode)" 344 ng-keypress="agregarATabla($event.keyCode)"
340 style="height: auto; line-height: 1.1em" 345 style="height: auto; line-height: 1.1em"
341 > 346 >
342 </div> 347 </div>
343 <div class="col px-1 text-right"> 348 <div class="col px-1 text-right">
344 <span ng-bind="articuloACargar.precio | 349 <span ng-bind="articuloACargar.precio |
345 currency: notaPedido.moneda.SIMBOLO : 4" 350 currency: notaPedido.moneda.SIMBOLO : 4"
346 ></span> 351 ></span>
347 </div> 352 </div>
348 <div class="col px-1 text-right"> 353 <div class="col px-1 text-right">
349 <span 354 <span
350 ng-bind="getSubTotal() | 355 ng-bind="getSubTotal() |
351 currency: notaPedido.moneda.SIMBOLO" 356 currency: notaPedido.moneda.SIMBOLO"
352 > 357 >
353 </span> 358 </span>
354 </div> 359 </div>
355 </div> 360 </div>
356 </td> 361 </td>
357 <td class="text-center align-middle"> 362 <td class="text-center align-middle">
358 <button 363 <button
359 class="btn btn-outline-light" 364 class="btn btn-outline-light"
360 ng-click="agregarATabla(13)" 365 ng-click="agregarATabla(13)"
361 > 366 >
362 <i class="fa fa-save"></i> 367 <i class="fa fa-save"></i>
363 </button> 368 </button>
364 </td> 369 </td>
365 </tr> 370 </tr>
366 <!-- TOOGLE EXPANDIR --> 371 <!-- TOOGLE EXPANDIR -->
367 <tr> 372 <tr>
368 <td class="col"> 373 <td class="col">
369 <button 374 <button
370 class="btn btn-outline-light selectable w-100" 375 class="btn btn-outline-light selectable w-100"
371 ng-click="show = !show; masMenos()" 376 ng-click="show = !show; masMenos()"
372 ng-show="notaPedido.articulosNotaPedido.length > 0" 377 ng-show="notaPedido.articulosNotaPedido.length > 0"
373 > 378 >
374 <i 379 <i
375 class="fa fa-chevron-down" 380 class="fa fa-chevron-down"
376 ng-hide="show" 381 ng-hide="show"
377 aria-hidden="true" 382 aria-hidden="true"
378 > 383 >
379 </i> 384 </i>
380 <i 385 <i
381 class="fa fa-chevron-up" 386 class="fa fa-chevron-up"
382 ng-show="show" 387 ng-show="show"
383 aria-hidden="true"> 388 aria-hidden="true">
384 </i> 389 </i>
385 </button> 390 </button>
386 </td> 391 </td>
387 </tr> 392 </tr>
388 <!-- FOOTER --> 393 <!-- FOOTER -->
389 <tr class="d-flex"> 394 <tr class="d-flex">
390 <td class="align-middle no-border-top" colspan="2"> 395 <td class="align-middle no-border-top" colspan="2">
391 <strong>Cantidad Items:</strong> 396 <strong>Cantidad Items:</strong>
392 <a ng-bind="notaPedido.articulosNotaPedido.length"></a> 397 <a ng-bind="notaPedido.articulosNotaPedido.length"></a>
393 </td> 398 </td>
394 <td class="text-right ml-auto table-celda-total no-border-top"> 399 <td class="text-right ml-auto table-celda-total no-border-top">
395 <h3>Total:</h3> 400 <h3>Total:</h3>
396 </td> 401 </td>
397 <td class="table-celda-total text-right no-border-top"> 402 <td class="table-celda-total text-right no-border-top">
398 <h3>{{getTotal() | currency: notaPedido.cotizacion.moneda.SIMBOLO}}</h3> 403 <h3>{{getTotal() | currency: notaPedido.cotizacion.moneda.SIMBOLO}}</h3>
399 </td> 404 </td>
400 </tr> 405 </tr>
401 </tfoot> 406 </tfoot>
402 </table> 407 </table>
403 </div> 408 </div>
404 </div> 409 </div>
405 </div> 410 </div>
406 </div> 411 </div>
407 <div class="row d-md-none fixed-bottom"> 412 <div class="row d-md-none fixed-bottom">
408 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 413 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
409 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 414 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
410 <span 415 <span
411 class="mr-3 ml-auto" 416 class="mr-3 ml-auto"
412 ng-class="saveLoading ? 'text-muted' : ''" 417 ng-class="saveLoading ? 'text-muted' : ''"
413 ng-click="crearNotaPedido()" 418 ng-click="crearNotaPedido()"
414 ladda="saveLoading" 419 ladda="saveLoading"
415 data-style="expand-left" 420 data-style="expand-left"
416 >Guardar</span> 421 >Guardar</span>
417 </div> 422 </div>
418 </div> 423 </div>
419 </div> 424 </div>