Commit 09c2e71c575e50753fe651ba735b3b6cfd6706de

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Nuevo diseño

See merge request !6
src/js/controller.js
1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', 3 '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService',
4 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService', 4 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService',
5 function( 5 function(
6 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, 6 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService,
7 notaPedidoBusinessService, $rootScope, focaSeguimientoService) 7 notaPedidoBusinessService, $rootScope, focaSeguimientoService)
8 { 8 {
9 $scope.botonera = [ 9 $scope.botonera = [
10 {texto: 'Vendedor', accion: function() { 10 {texto: 'Vendedor', imagen: '../img/abmPrecios.png', accion: function() {
11 validarNotaRemitada($scope.seleccionarVendedor);}}, 11 validarNotaRemitada($scope.seleccionarVendedor);}},
12 {texto: 'Cliente', accion: function() { 12 {texto: 'Cliente', imagen: '../img/abmPrecios.png', accion: function() {
13 validarNotaRemitada($scope.seleccionarCliente);}}, 13 validarNotaRemitada($scope.seleccionarCliente);}},
14 {texto: 'Proveedor', accion: function() { 14 {texto: 'Proveedor', imagen: '../img/abmPrecios.png', accion: function() {
15 validarNotaRemitada($scope.seleccionarProveedor);}}, 15 validarNotaRemitada($scope.seleccionarProveedor);}},
16 {texto: 'Moneda', accion: function() { 16 {texto: 'Moneda', imagen: '../img/abmPrecios.png', accion: function() {
17 validarNotaRemitada($scope.abrirModalMoneda);}}, 17 validarNotaRemitada($scope.abrirModalMoneda);}},
18 {texto: 'Precios y condiciones', accion: function() { 18 {texto: 'Precios y condiciones', imagen: '../img/abmPrecios.png',
19 validarNotaRemitada($scope.abrirModalListaPrecio);}}, 19 accion: function() {
20 {texto: 'Flete', accion: function() { 20 validarNotaRemitada($scope.abrirModalListaPrecio);}},
21 {texto: 'Flete', imagen: '../img/abmPrecios.png', accion: function() {
21 validarNotaRemitada($scope.abrirModalFlete);}}, 22 validarNotaRemitada($scope.abrirModalFlete);}},
23 {texto: 'Productos', imagen: '../img/abmPrecios.png', accion: function() {
24 $scope.seleccionarArticulo();
25 }},
26 {texto: '', accion: function() {}},
27 {texto: '', accion: function() {}},
28 {texto: '', accion: function() {}},
22 {texto: '', accion: function() {}}, 29 {texto: '', accion: function() {}},
23 {texto: '', accion: function() {}} 30 {texto: '', accion: function() {}}
24 ]; 31 ];
25 32
26 $scope.isNumber = angular.isNumber; 33 $scope.isNumber = angular.isNumber;
27 $scope.datepickerAbierto = false; 34 $scope.datepickerAbierto = false;
28 $scope.show = false; 35 $scope.show = false;
29 $scope.cargando = true; 36 $scope.cargando = true;
30 $scope.dateOptions = { 37 $scope.dateOptions = {
31 maxDate: new Date(), 38 maxDate: new Date(),
32 minDate: new Date(2010, 0, 1) 39 minDate: new Date(2010, 0, 1)
33 }; 40 };
34 41
35 $scope.notaPedido = { 42 $scope.notaPedido = {
36 id: 0, 43 id: 0,
37 vendedor: {}, 44 vendedor: {},
38 cliente: {}, 45 cliente: {},
39 proveedor: {}, 46 proveedor: {},
40 domicilio: {dom: ''}, 47 domicilio: {dom: ''},
41 moneda: {}, 48 moneda: {},
42 cotizacion: {} 49 cotizacion: {}
43 }; 50 };
44 var monedaPorDefecto; 51 var monedaPorDefecto;
45 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 52 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
46 crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { 53 crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) {
47 monedaPorDefecto = res.data[0]; 54 monedaPorDefecto = res.data[0];
48 $scope.notaPedido.moneda = monedaPorDefecto; 55 $scope.notaPedido.moneda = monedaPorDefecto;
49 $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; 56 $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0];
50 }); 57 });
51 58
52 $scope.cabecera = []; 59 $scope.cabecera = [];
53 $scope.showCabecera = true; 60 $scope.showCabecera = true;
54 61
55 $scope.now = new Date(); 62 $scope.now = new Date();
56 $scope.puntoVenta = '0000'; 63 $scope.puntoVenta = '0000';
57 $scope.comprobante = '00000000'; 64 $scope.comprobante = '00000000';
58 $scope.articulosTabla = []; 65 $scope.articulosTabla = [];
59 $scope.idLista = undefined; 66 $scope.idLista = undefined;
60 67
61 crearNotaPedidoService.getPrecioCondicion().then( 68 crearNotaPedidoService.getPrecioCondicion().then(
62 function(res) { 69 function(res) {
63 $scope.precioCondiciones = res.data; 70 $scope.precioCondiciones = res.data;
64 } 71 }
65 ); 72 );
66 73
67 crearNotaPedidoService.getNumeroNotaPedido().then( 74 crearNotaPedidoService.getNumeroNotaPedido().then(
68 function(res) { 75 function(res) {
69 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 76 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
70 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); 77 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8);
71 }, 78 },
72 function(err) { 79 function(err) {
73 focaModalService.alert('La terminal no esta configurada correctamente'); 80 focaModalService.alert('La terminal no esta configurada correctamente');
74 console.info(err); 81 console.info(err);
75 } 82 }
76 ); 83 );
77 84
78 $scope.crearNotaPedido = function() { 85 $scope.crearNotaPedido = function() {
79 if(!$scope.notaPedido.vendedor.CodVen) { 86 if(!$scope.notaPedido.vendedor.CodVen) {
80 focaModalService.alert('Ingrese Vendedor'); 87 focaModalService.alert('Ingrese Vendedor');
81 return; 88 return;
82 } else if(!$scope.notaPedido.cliente.COD) { 89 } else if(!$scope.notaPedido.cliente.COD) {
83 focaModalService.alert('Ingrese Cliente'); 90 focaModalService.alert('Ingrese Cliente');
84 return; 91 return;
85 } else if(!$scope.notaPedido.proveedor.COD) { 92 } else if(!$scope.notaPedido.proveedor.COD) {
86 focaModalService.alert('Ingrese Proveedor'); 93 focaModalService.alert('Ingrese Proveedor');
87 return; 94 return;
88 } else if(!$scope.notaPedido.moneda.ID) { 95 } else if(!$scope.notaPedido.moneda.ID) {
89 focaModalService.alert('Ingrese Moneda'); 96 focaModalService.alert('Ingrese Moneda');
90 return; 97 return;
91 } else if(!$scope.notaPedido.cotizacion.ID) { 98 } else if(!$scope.notaPedido.cotizacion.ID) {
92 focaModalService.alert('Ingrese Cotización'); 99 focaModalService.alert('Ingrese Cotización');
93 return; 100 return;
94 } else if(!$scope.plazosPagos) { 101 } else if(!$scope.plazosPagos) {
95 focaModalService.alert('Ingrese Precios y Condiciones'); 102 focaModalService.alert('Ingrese Precios y Condiciones');
96 return; 103 return;
97 } else if( 104 } else if(
98 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) 105 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null)
99 { 106 {
100 focaModalService.alert('Ingrese Flete'); 107 focaModalService.alert('Ingrese Flete');
101 return; 108 return;
102 } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto 109 } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto
103 focaModalService.alert('Ingrese Domicilio'); 110 focaModalService.alert('Ingrese Domicilio');
104 return; 111 return;
105 } else if($scope.articulosTabla.length === 0) { 112 } else if($scope.articulosTabla.length === 0) {
106 focaModalService.alert('Debe cargar al menos un articulo'); 113 focaModalService.alert('Debe cargar al menos un articulo');
107 return; 114 return;
108 } 115 }
109 $scope.saveLoading = true; 116 $scope.saveLoading = true;
110 var notaPedido = { 117 var notaPedido = {
111 id: $scope.notaPedido.id, 118 id: $scope.notaPedido.id,
112 fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), 119 fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '),
113 idVendedor: $scope.notaPedido.vendedor.CodVen, 120 idVendedor: $scope.notaPedido.vendedor.CodVen,
114 idCliente: $scope.notaPedido.cliente.COD, 121 idCliente: $scope.notaPedido.cliente.COD,
115 nombreCliente: $scope.notaPedido.cliente.NOM, 122 nombreCliente: $scope.notaPedido.cliente.NOM,
116 cuitCliente: $scope.notaPedido.cliente.CUIT, 123 cuitCliente: $scope.notaPedido.cliente.CUIT,
117 idProveedor: $scope.notaPedido.proveedor.COD, 124 idProveedor: $scope.notaPedido.proveedor.COD,
118 //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID 125 //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID
119 idCotizacion: $scope.notaPedido.cotizacion.ID, 126 idCotizacion: $scope.notaPedido.cotizacion.ID,
120 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, 127 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion,
121 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 128 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
122 flete: $scope.notaPedido.flete, 129 flete: $scope.notaPedido.flete,
123 fob: $scope.notaPedido.fob, 130 fob: $scope.notaPedido.fob,
124 bomba: $scope.notaPedido.bomba, 131 bomba: $scope.notaPedido.bomba,
125 kilometros: $scope.notaPedido.kilometros, 132 kilometros: $scope.notaPedido.kilometros,
126 domicilioStamp: $scope.notaPedido.domicilioStamp, 133 domicilioStamp: $scope.notaPedido.domicilioStamp,
127 estado: 0, 134 estado: 0,
128 total: $scope.getTotal() 135 total: $scope.getTotal()
129 }; 136 };
130 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 137 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
131 function(data) { 138 function(data) {
132 // Al guardar los datos de la nota de pedido logueamos la 139 // Al guardar los datos de la nota de pedido logueamos la
133 // actividad para su seguimiento. 140 // actividad para su seguimiento.
134 //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? 141 //TODO: GUARDAR POSISIONAMIENTO AL EDITAR?
135 focaSeguimientoService.guardarPosicion( 142 focaSeguimientoService.guardarPosicion(
136 data.data.id, 143 data.data.id,
137 'Nota de pedido', 144 'Nota de pedido',
138 'Nº: ' + $filter('comprobante')([ 145 'Nº: ' + $filter('comprobante')([
139 $scope.puntoVenta, 146 $scope.puntoVenta,
140 $scope.comprobante 147 $scope.comprobante
141 ]) + '<br/>' + 148 ]) + '<br/>' +
142 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + 149 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' +
143 'Total: ' + $filter('currency')($scope.getTotal()) 150 'Total: ' + $filter('currency')($scope.getTotal())
144 ); 151 );
145 notaPedidoBusinessService.addArticulos($scope.articulosTabla, 152 notaPedidoBusinessService.addArticulos($scope.articulosTabla,
146 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); 153 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR);
147 var plazos = $scope.plazosPagos; 154 var plazos = $scope.plazosPagos;
148 155
149 for(var j = 0; j < plazos.length; j++) { 156 for(var j = 0; j < plazos.length; j++) {
150 var json = { 157 var json = {
151 idPedido: data.data.id, 158 idPedido: data.data.id,
152 dias: plazos[j].dias 159 dias: plazos[j].dias
153 }; 160 };
154 crearNotaPedidoService.crearPlazosParaNotaPedido(json); 161 crearNotaPedidoService.crearPlazosParaNotaPedido(json);
155 } 162 }
156 notaPedidoBusinessService.addEstado(data.data.id, 163 notaPedidoBusinessService.addEstado(data.data.id,
157 $scope.notaPedido.vendedor.CodVen); 164 $scope.notaPedido.vendedor.CodVen);
158 165
159 focaModalService.alert('Nota pedido creada'); 166 focaModalService.alert('Nota pedido creada');
160 $scope.saveLoading = false; 167 $scope.saveLoading = false;
161 $scope.cabecera = []; 168 $scope.cabecera = [];
162 addCabecera('Moneda:', $scope.notaPedido.moneda.DETALLE); 169 addCabecera('Moneda:', $scope.notaPedido.moneda.DETALLE);
163 addCabecera( 170 addCabecera(
164 'Fecha cotizacion:', 171 'Fecha cotizacion:',
165 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') 172 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy')
166 ); 173 );
167 addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); 174 addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR);
168 crearNotaPedidoService.getNumeroNotaPedido().then( 175 crearNotaPedidoService.getNumeroNotaPedido().then(
169 function(res) { 176 function(res) {
170 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 177 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
171 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); 178 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8);
172 }, 179 },
173 function(err) { 180 function(err) {
174 focaModalService.alert( 181 focaModalService.alert(
175 'La terminal no esta configurada correctamente'); 182 'La terminal no esta configurada correctamente');
176 console.info(err); 183 console.info(err);
177 } 184 }
178 ); 185 );
179 $scope.notaPedido.vendedor = {}; 186 $scope.notaPedido.vendedor = {};
180 $scope.notaPedido.cliente = {}; 187 $scope.notaPedido.cliente = {};
181 $scope.notaPedido.proveedor = {}; 188 $scope.notaPedido.proveedor = {};
182 $scope.notaPedido.domicilio = {}; 189 $scope.notaPedido.domicilio = {};
183 $scope.notaPedido.flete = null; 190 $scope.notaPedido.flete = null;
184 $scope.notaPedido.fob = null; 191 $scope.notaPedido.fob = null;
185 $scope.notaPedido.bomba = null; 192 $scope.notaPedido.bomba = null;
186 $scope.notaPedido.kilometros = null; 193 $scope.notaPedido.kilometros = null;
187 $scope.articulosTabla = []; 194 $scope.articulosTabla = [];
188 }, 195 },
189 function(error) { 196 function(error) {
190 focaModalService.alert('Hubo un error al crear la nota de pedido'); 197 focaModalService.alert('Hubo un error al crear la nota de pedido');
191 $scope.saveLoading = false; 198 $scope.saveLoading = false;
192 console.info(error); 199 console.info(error);
193 } 200 }
194 ); 201 );
195 }; 202 };
196 203
197 $scope.seleccionarNotaPedido = function() { 204 $scope.seleccionarNotaPedido = function() {
198 var modalInstance = $uibModal.open( 205 var modalInstance = $uibModal.open(
199 { 206 {
200 ariaLabelledBy: 'Busqueda de Nota de Pedido', 207 ariaLabelledBy: 'Busqueda de Nota de Pedido',
201 templateUrl: 'foca-modal-nota-pedido.html', 208 templateUrl: 'foca-modal-nota-pedido.html',
202 controller: 'focaModalNotaPedidoController', 209 controller: 'focaModalNotaPedidoController',
203 size: 'lg', 210 size: 'lg',
204 resolve: {usadoPor: function() {return 'notaPedido';}} 211 resolve: {usadoPor: function() {return 'notaPedido';}}
205 } 212 }
206 ); 213 );
207 modalInstance.result.then( 214 modalInstance.result.then(
208 function(notaPedido) { 215 function(notaPedido) {
209 $scope.now = new Date(notaPedido.fechaCarga); 216 $scope.now = new Date(notaPedido.fechaCarga);
210 //añado cabeceras 217 //añado cabeceras
211 $scope.notaPedido.id = notaPedido.id; 218 $scope.notaPedido.id = notaPedido.id;
212 removeCabecera('Bomba:'); 219 removeCabecera('Bomba:');
213 removeCabecera('Kilometros:'); 220 removeCabecera('Kilometros:');
214 var cabeceras = [ 221 var cabeceras = [
215 { 222 {
216 label: 'Moneda:', 223 label: 'Moneda:',
217 valor: notaPedido.cotizacion.moneda.DETALLE 224 valor: notaPedido.cotizacion.moneda.DETALLE
218 }, 225 },
219 { 226 {
220 label: 'Fecha cotizacion:', 227 label: 'Fecha cotizacion:',
221 valor: $filter('date')(notaPedido.cotizacion.FECHA, 228 valor: $filter('date')(notaPedido.cotizacion.FECHA,
222 'dd/MM/yyyy') 229 'dd/MM/yyyy')
223 }, 230 },
224 { 231 {
225 label: 'Cotizacion:', 232 label: 'Cotizacion:',
226 valor: notaPedido.cotizacion.VENDEDOR 233 valor: notaPedido.cotizacion.VENDEDOR
227 }, 234 },
228 { 235 {
229 label: 'Cliente:', 236 label: 'Cliente:',
230 valor: notaPedido.cliente.NOM 237 valor: notaPedido.cliente.NOM
231 }, 238 },
232 { 239 {
233 label: 'Domicilio:', 240 label: 'Domicilio:',
234 valor: notaPedido.domicilioStamp 241 valor: notaPedido.domicilioStamp
235 }, 242 },
236 { 243 {
237 label: 'Vendedor:', 244 label: 'Vendedor:',
238 valor: notaPedido.vendedor.NomVen 245 valor: notaPedido.vendedor.NomVen
239 }, 246 },
240 { 247 {
241 label: 'Proveedor:', 248 label: 'Proveedor:',
242 valor: notaPedido.proveedor.NOM 249 valor: notaPedido.proveedor.NOM
243 }, 250 },
244 { 251 {
245 label: 'Precio condicion:', 252 label: 'Precio condicion:',
246 valor: valorPrecioCondicion() + ' ' + 253 valor: valorPrecioCondicion() + ' ' +
247 notaPedidoBusinessService 254 notaPedidoBusinessService
248 .plazoToString(notaPedido.notaPedidoPlazo) 255 .plazoToString(notaPedido.notaPedidoPlazo)
249 }, 256 },
250 { 257 {
251 label: 'Flete:', 258 label: 'Flete:',
252 valor: notaPedido.fob === 1 ? 'FOB' : ( 259 valor: notaPedido.fob === 1 ? 'FOB' : (
253 notaPedido.flete === 1 ? 'Si' : 'No') 260 notaPedido.flete === 1 ? 'Si' : 'No')
254 } 261 }
255 ]; 262 ];
256 263
257 function valorPrecioCondicion() { 264 function valorPrecioCondicion() {
258 if(notaPedido.idPrecioCondicion > 0) { 265 if(notaPedido.idPrecioCondicion > 0) {
259 return notaPedido.precioCondicion.nombre; 266 return notaPedido.precioCondicion.nombre;
260 } else { 267 } else {
261 return 'Ingreso Manual'; 268 return 'Ingreso Manual';
262 } 269 }
263 } 270 }
264 271
265 if(notaPedido.flete === 1) { 272 if(notaPedido.flete === 1) {
266 var cabeceraBomba = { 273 var cabeceraBomba = {
267 label: 'Bomba:', 274 label: 'Bomba:',
268 valor: notaPedido.bomba === 1 ? 'Si' : 'No' 275 valor: notaPedido.bomba === 1 ? 'Si' : 'No'
269 }; 276 };
270 if(notaPedido.kilometros) { 277 if(notaPedido.kilometros) {
271 var cabeceraKilometros = { 278 var cabeceraKilometros = {
272 label: 'Kilometros:', 279 label: 'Kilometros:',
273 valor: notaPedido.kilometros 280 valor: notaPedido.kilometros
274 }; 281 };
275 cabeceras.push(cabeceraKilometros); 282 cabeceras.push(cabeceraKilometros);
276 } 283 }
277 cabeceras.push(cabeceraBomba); 284 cabeceras.push(cabeceraBomba);
278 } 285 }
279 $scope.articulosTabla = notaPedido.articulosNotaPedido; 286 $scope.articulosTabla = notaPedido.articulosNotaPedido;
280 notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, 287 notaPedidoBusinessService.calcularArticulos($scope.articulosTabla,
281 notaPedido.cotizacion.VENDEDOR); 288 notaPedido.cotizacion.VENDEDOR);
282 if(notaPedido.idPrecioCondicion > 0) { 289 if(notaPedido.idPrecioCondicion > 0) {
283 $scope.idLista = notaPedido.precioCondicion.idListaPrecio; 290 $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
284 } else { 291 } else {
285 $scope.idLista = -1; 292 $scope.idLista = -1;
286 } 293 }
287 $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); 294 $scope.puntoVenta = rellenar(notaPedido.sucursal, 4);
288 $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); 295 $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8);
289 $scope.notaPedido = notaPedido; 296 $scope.notaPedido = notaPedido;
290 $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; 297 $scope.notaPedido.moneda = notaPedido.cotizacion.moneda;
291 $scope.plazosPagos = notaPedido.notaPedidoPlazo; 298 $scope.plazosPagos = notaPedido.notaPedidoPlazo;
292 addArrayCabecera(cabeceras); 299 addArrayCabecera(cabeceras);
293 300
294 }, function() { 301 }, function() {
295 // funcion ejecutada cuando se cancela el modal 302 // funcion ejecutada cuando se cancela el modal
296 } 303 }
297 ); 304 );
298 }; 305 };
299 306
300 $scope.seleccionarArticulo = function() { 307 $scope.seleccionarArticulo = function() {
301 if ($scope.idLista === undefined) { 308 if ($scope.idLista === undefined) {
302 focaModalService.alert( 309 focaModalService.alert(
303 'Primero seleccione una lista de precio y condicion'); 310 'Primero seleccione una lista de precio y condicion');
304 return; 311 return;
305 } 312 }
306 var modalInstance = $uibModal.open( 313 var modalInstance = $uibModal.open(
307 { 314 {
308 ariaLabelledBy: 'Busqueda de Productos', 315 ariaLabelledBy: 'Busqueda de Productos',
309 templateUrl: 'modal-busqueda-productos.html', 316 templateUrl: 'modal-busqueda-productos.html',
310 controller: 'modalBusquedaProductosCtrl', 317 controller: 'modalBusquedaProductosCtrl',
311 resolve: { 318 resolve: {
312 parametroProducto: { 319 parametroProducto: {
313 idLista: $scope.idLista, 320 idLista: $scope.idLista,
314 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 321 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
315 simbolo: $scope.notaPedido.moneda.SIMBOLO 322 simbolo: $scope.notaPedido.moneda.SIMBOLO
316 } 323 }
317 }, 324 },
318 size: 'lg' 325 size: 'lg'
319 } 326 }
320 ); 327 );
321 modalInstance.result.then( 328 modalInstance.result.then(
322 function(producto) { 329 function(producto) {
323 var newArt = 330 var newArt =
324 { 331 {
325 id: 0, 332 id: 0,
326 codigo: producto.codigo, 333 codigo: producto.codigo,
327 sector: producto.sector, 334 sector: producto.sector,
328 sectorCodigo: producto.sector + '-' + producto.codigo, 335 sectorCodigo: producto.sector + '-' + producto.codigo,
329 descripcion: producto.descripcion, 336 descripcion: producto.descripcion,
330 item: $scope.articulosTabla.length + 1, 337 item: $scope.articulosTabla.length + 1,
331 nombre: producto.descripcion, 338 nombre: producto.descripcion,
332 precio: parseFloat(producto.precio.toFixed(4)), 339 precio: parseFloat(producto.precio.toFixed(4)),
333 costoUnitario: producto.costo, 340 costoUnitario: producto.costo,
334 editCantidad: false, 341 editCantidad: false,
335 editPrecio: false, 342 editPrecio: false,
336 rubro: producto.CodRub, 343 rubro: producto.CodRub,
337 exentoUnitario: producto.precio, 344 exentoUnitario: producto.precio,
338 ivaUnitario: producto.IMPIVA, 345 ivaUnitario: producto.IMPIVA,
339 impuestoInternoUnitario: producto.ImpInt, 346 impuestoInternoUnitario: producto.ImpInt,
340 impuestoInterno1Unitario: producto.ImpInt2, 347 impuestoInterno1Unitario: producto.ImpInt2,
341 impuestoInterno2Unitario: producto.ImpInt3, 348 impuestoInterno2Unitario: producto.ImpInt3,
342 precioLista: producto.precio, 349 precioLista: producto.precio,
343 combustible: 1, 350 combustible: 1,
344 facturado: 0 351 facturado: 0
345 }; 352 };
346 $scope.articuloACargar = newArt; 353 $scope.articuloACargar = newArt;
347 $scope.cargando = false; 354 $scope.cargando = false;
348 }, function() { 355 }, function() {
349 // funcion ejecutada cuando se cancela el modal 356 // funcion ejecutada cuando se cancela el modal
350 } 357 }
351 ); 358 );
352 }; 359 };
353 360
354 $scope.seleccionarVendedor = function() { 361 $scope.seleccionarVendedor = function() {
355 var modalInstance = $uibModal.open( 362 var modalInstance = $uibModal.open(
356 { 363 {
357 ariaLabelledBy: 'Busqueda de Vendedores', 364 ariaLabelledBy: 'Busqueda de Vendedores',
358 templateUrl: 'modal-vendedores.html', 365 templateUrl: 'modal-vendedores.html',
359 controller: 'modalVendedoresCtrl', 366 controller: 'modalVendedoresCtrl',
360 size: 'lg' 367 size: 'lg'
361 } 368 }
362 ); 369 );
363 modalInstance.result.then( 370 modalInstance.result.then(
364 function(vendedor) { 371 function(vendedor) {
365 addCabecera('Vendedor:', vendedor.NomVen); 372 addCabecera('Vendedor:', vendedor.NomVen);
366 $scope.notaPedido.vendedor = vendedor; 373 $scope.notaPedido.vendedor = vendedor;
367 }, function() { 374 }, function() {
368 375
369 } 376 }
370 ); 377 );
371 }; 378 };
372 379
373 $scope.seleccionarProveedor = function() { 380 $scope.seleccionarProveedor = function() {
374 var modalInstance = $uibModal.open( 381 var modalInstance = $uibModal.open(
375 { 382 {
376 ariaLabelledBy: 'Busqueda de Proveedor', 383 ariaLabelledBy: 'Busqueda de Proveedor',
377 templateUrl: 'modal-proveedor.html', 384 templateUrl: 'modal-proveedor.html',
378 controller: 'focaModalProveedorCtrl', 385 controller: 'focaModalProveedorCtrl',
379 size: 'lg', 386 size: 'lg',
380 resolve: { 387 resolve: {
381 transportista: function() { 388 transportista: function() {
382 return false; 389 return false;
383 } 390 }
384 } 391 }
385 } 392 }
386 ); 393 );
387 modalInstance.result.then( 394 modalInstance.result.then(
388 function(proveedor) { 395 function(proveedor) {
389 $scope.notaPedido.proveedor = proveedor; 396 $scope.notaPedido.proveedor = proveedor;
390 addCabecera('Proveedor:', proveedor.NOM); 397 addCabecera('Proveedor:', proveedor.NOM);
391 }, function() { 398 }, function() {
392 399
393 } 400 }
394 ); 401 );
395 }; 402 };
396 403
397 $scope.seleccionarCliente = function() { 404 $scope.seleccionarCliente = function() {
398 405
399 var modalInstance = $uibModal.open( 406 var modalInstance = $uibModal.open(
400 { 407 {
401 ariaLabelledBy: 'Busqueda de Cliente', 408 ariaLabelledBy: 'Busqueda de Cliente',
402 templateUrl: 'foca-busqueda-cliente-modal.html', 409 templateUrl: 'foca-busqueda-cliente-modal.html',
403 controller: 'focaBusquedaClienteModalController', 410 controller: 'focaBusquedaClienteModalController',
404 size: 'lg' 411 size: 'lg'
405 } 412 }
406 ); 413 );
407 modalInstance.result.then( 414 modalInstance.result.then(
408 function(cliente) { 415 function(cliente) {
409 $scope.abrirModalDomicilios(cliente); 416 $scope.abrirModalDomicilios(cliente);
410 }, function() { 417 }, function() {
411 418
412 } 419 }
413 ); 420 );
414 }; 421 };
415 422
416 $scope.abrirModalDomicilios = function(cliente) { 423 $scope.abrirModalDomicilios = function(cliente) {
417 var modalInstanceDomicilio = $uibModal.open( 424 var modalInstanceDomicilio = $uibModal.open(
418 { 425 {
419 ariaLabelledBy: 'Busqueda de Domicilios', 426 ariaLabelledBy: 'Busqueda de Domicilios',
420 templateUrl: 'modal-domicilio.html', 427 templateUrl: 'modal-domicilio.html',
421 controller: 'focaModalDomicilioController', 428 controller: 'focaModalDomicilioController',
422 resolve: { idCliente: function() { return cliente.cod; }}, 429 resolve: { idCliente: function() { return cliente.cod; }},
423 size: 'lg', 430 size: 'lg',
424 } 431 }
425 ); 432 );
426 modalInstanceDomicilio.result.then( 433 modalInstanceDomicilio.result.then(
427 function(domicilio) { 434 function(domicilio) {
428 $scope.notaPedido.domicilio = domicilio; 435 $scope.notaPedido.domicilio = domicilio;
429 $scope.notaPedido.cliente = { 436 $scope.notaPedido.cliente = {
430 COD: cliente.cod, 437 COD: cliente.cod,
431 CUIT: cliente.cuit, 438 CUIT: cliente.cuit,
432 NOM: cliente.nom 439 NOM: cliente.nom
433 }; 440 };
434 addCabecera('Cliente:', cliente.nom); 441 addCabecera('Cliente:', cliente.nom);
435 var domicilioStamp = 442 var domicilioStamp =
436 domicilio.Calle + ' ' + domicilio.Numero + ', ' + 443 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
437 domicilio.Localidad + ', ' + domicilio.Provincia; 444 domicilio.Localidad + ', ' + domicilio.Provincia;
438 $scope.notaPedido.domicilioStamp = domicilioStamp; 445 $scope.notaPedido.domicilioStamp = domicilioStamp;
439 addCabecera('Domicilio:', domicilioStamp); 446 addCabecera('Domicilio:', domicilioStamp);
440 }, function() { 447 }, function() {
441 $scope.seleccionarCliente(); 448 $scope.seleccionarCliente();
442 return; 449 return;
443 } 450 }
444 ); 451 );
445 }; 452 };
446 453
447 $scope.getTotal = function() { 454 $scope.getTotal = function() {
448 var total = 0; 455 var total = 0;
449 var arrayTempArticulos = $scope.articulosTabla; 456 var arrayTempArticulos = $scope.articulosTabla;
450 for (var i = 0; i < arrayTempArticulos.length; i++) { 457 for (var i = 0; i < arrayTempArticulos.length; i++) {
451 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 458 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
452 } 459 }
453 return parseFloat(total.toFixed(2)); 460 return parseFloat(total.toFixed(2));
454 }; 461 };
455 462
456 $scope.getSubTotal = function() { 463 $scope.getSubTotal = function() {
457 if($scope.articuloACargar) { 464 if($scope.articuloACargar) {
458 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 465 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
459 } 466 }
460 }; 467 };
461 468
462 $scope.abrirModalListaPrecio = function() { 469 $scope.abrirModalListaPrecio = function() {
463 var modalInstance = $uibModal.open( 470 var modalInstance = $uibModal.open(
464 { 471 {
465 ariaLabelledBy: 'Busqueda de Precio Condición', 472 ariaLabelledBy: 'Busqueda de Precio Condición',
466 templateUrl: 'modal-precio-condicion.html', 473 templateUrl: 'modal-precio-condicion.html',
467 controller: 'focaModalPrecioCondicionController', 474 controller: 'focaModalPrecioCondicionController',
468 size: 'lg' 475 size: 'lg'
469 } 476 }
470 ); 477 );
471 modalInstance.result.then( 478 modalInstance.result.then(
472 function(precioCondicion) { 479 function(precioCondicion) {
473 var cabecera = ''; 480 var cabecera = '';
474 var plazosConcat = ''; 481 var plazosConcat = '';
475 if(!Array.isArray(precioCondicion)) { 482 if(!Array.isArray(precioCondicion)) {
476 $scope.notaPedido.idPrecioCondicion = precioCondicion.id; 483 $scope.notaPedido.idPrecioCondicion = precioCondicion.id;
477 $scope.plazosPagos = precioCondicion.plazoPago; 484 $scope.plazosPagos = precioCondicion.plazoPago;
478 $scope.idLista = precioCondicion.idListaPrecio; 485 $scope.idLista = precioCondicion.idListaPrecio;
479 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 486 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
480 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 487 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
481 } 488 }
482 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 489 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
483 } else { //Cuando se ingresan los plazos manualmente 490 } else { //Cuando se ingresan los plazos manualmente
484 $scope.notaPedido.idPrecioCondicion = 0; 491 $scope.notaPedido.idPrecioCondicion = 0;
485 $scope.idLista = -1; //-1, el modal productos busca todos los productos 492 $scope.idLista = -1; //-1, el modal productos busca todos los productos
486 $scope.plazosPagos = precioCondicion; 493 $scope.plazosPagos = precioCondicion;
487 for(var j = 0; j < precioCondicion.length; j++) { 494 for(var j = 0; j < precioCondicion.length; j++) {
488 plazosConcat += precioCondicion[j].dias + ' '; 495 plazosConcat += precioCondicion[j].dias + ' ';
489 } 496 }
490 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 497 cabecera = 'Ingreso manual ' + plazosConcat.trim();
491 } 498 }
492 $scope.articulosTabla = []; 499 $scope.articulosTabla = [];
493 addCabecera('Precios y condiciones:', cabecera); 500 addCabecera('Precios y condiciones:', cabecera);
494 }, function() { 501 }, function() {
495 502
496 } 503 }
497 ); 504 );
498 }; 505 };
499 506
500 $scope.abrirModalFlete = function() { 507 $scope.abrirModalFlete = function() {
501 var modalInstance = $uibModal.open( 508 var modalInstance = $uibModal.open(
502 { 509 {
503 ariaLabelledBy: 'Busqueda de Flete', 510 ariaLabelledBy: 'Busqueda de Flete',
504 templateUrl: 'modal-flete.html', 511 templateUrl: 'modal-flete.html',
505 controller: 'focaModalFleteController', 512 controller: 'focaModalFleteController',
506 size: 'lg', 513 size: 'lg',
507 resolve: { 514 resolve: {
508 parametrosFlete: 515 parametrosFlete:
509 function() { 516 function() {
510 return { 517 return {
511 flete: $scope.notaPedido.fob ? 'FOB' : 518 flete: $scope.notaPedido.fob ? 'FOB' :
512 ( $scope.notaPedido.flete ? '1' : 519 ( $scope.notaPedido.flete ? '1' :
513 ($scope.notaPedido.flete === undefined ? null : '0')), 520 ($scope.notaPedido.flete === undefined ? null : '0')),
514 bomba: $scope.notaPedido.bomba ? '1' : 521 bomba: $scope.notaPedido.bomba ? '1' :
515 ($scope.notaPedido.bomba === undefined ? null : '0'), 522 ($scope.notaPedido.bomba === undefined ? null : '0'),
516 kilometros: $scope.notaPedido.kilometros 523 kilometros: $scope.notaPedido.kilometros
517 }; 524 };
518 } 525 }
519 } 526 }
520 } 527 }
521 ); 528 );
522 modalInstance.result.then( 529 modalInstance.result.then(
523 function(datos) { 530 function(datos) {
524 $scope.notaPedido.flete = datos.flete; 531 $scope.notaPedido.flete = datos.flete;
525 $scope.notaPedido.fob = datos.FOB; 532 $scope.notaPedido.fob = datos.FOB;
526 $scope.notaPedido.bomba = datos.bomba; 533 $scope.notaPedido.bomba = datos.bomba;
527 $scope.notaPedido.kilometros = datos.kilometros; 534 $scope.notaPedido.kilometros = datos.kilometros;
528 addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); 535 addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No'));
529 if(datos.flete) { 536 if(datos.flete) {
530 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 537 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
531 addCabecera('Kilometros:', datos.kilometros); 538 addCabecera('Kilometros:', datos.kilometros);
532 } else { 539 } else {
533 removeCabecera('Bomba:'); 540 removeCabecera('Bomba:');
534 removeCabecera('Kilometros:'); 541 removeCabecera('Kilometros:');
535 $scope.notaPedido.bomba = false; 542 $scope.notaPedido.bomba = false;
536 $scope.notaPedido.kilometros = null; 543 $scope.notaPedido.kilometros = null;
537 } 544 }
538 }, function() { 545 }, function() {
539 546
540 } 547 }
541 ); 548 );
542 }; 549 };
543 550
544 $scope.abrirModalMoneda = function() { 551 $scope.abrirModalMoneda = function() {
545 var modalInstance = $uibModal.open( 552 var modalInstance = $uibModal.open(
546 { 553 {
547 ariaLabelledBy: 'Busqueda de Moneda', 554 ariaLabelledBy: 'Busqueda de Moneda',
548 templateUrl: 'modal-moneda.html', 555 templateUrl: 'modal-moneda.html',
549 controller: 'focaModalMonedaController', 556 controller: 'focaModalMonedaController',
550 size: 'lg' 557 size: 'lg'
551 } 558 }
552 ); 559 );
553 modalInstance.result.then( 560 modalInstance.result.then(
554 function(moneda) { 561 function(moneda) {
555 $scope.abrirModalCotizacion(moneda); 562 $scope.abrirModalCotizacion(moneda);
556 }, function() { 563 }, function() {
557 564
558 } 565 }
559 ); 566 );
560 }; 567 };
561 568
562 $scope.abrirModalCotizacion = function(moneda) { 569 $scope.abrirModalCotizacion = function(moneda) {
563 var modalInstance = $uibModal.open( 570 var modalInstance = $uibModal.open(
564 { 571 {
565 ariaLabelledBy: 'Busqueda de Cotización', 572 ariaLabelledBy: 'Busqueda de Cotización',
566 templateUrl: 'modal-cotizacion.html', 573 templateUrl: 'modal-cotizacion.html',
567 controller: 'focaModalCotizacionController', 574 controller: 'focaModalCotizacionController',
568 size: 'lg', 575 size: 'lg',
569 resolve: {idMoneda: function() {return moneda.ID;}} 576 resolve: {idMoneda: function() {return moneda.ID;}}
570 } 577 }
571 ); 578 );
572 modalInstance.result.then( 579 modalInstance.result.then(
573 function(cotizacion) { 580 function(cotizacion) {
574 var articulosTablaTemp = $scope.articulosTabla; 581 var articulosTablaTemp = $scope.articulosTabla;
575 for(var i = 0; i < articulosTablaTemp.length; i++) { 582 for(var i = 0; i < articulosTablaTemp.length; i++) {
576 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 583 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
577 $scope.notaPedido.cotizacion.VENDEDOR; 584 $scope.notaPedido.cotizacion.VENDEDOR;
578 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 585 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
579 cotizacion.VENDEDOR; 586 cotizacion.VENDEDOR;
580 } 587 }
581 $scope.articulosTabla = articulosTablaTemp; 588 $scope.articulosTabla = articulosTablaTemp;
582 $scope.notaPedido.moneda = moneda; 589 $scope.notaPedido.moneda = moneda;
583 $scope.notaPedido.cotizacion = cotizacion; 590 $scope.notaPedido.cotizacion = cotizacion;
584 if(moneda.DETALLE == "PESOS ARGENTINOS"){ 591 if(moneda.DETALLE == "PESOS ARGENTINOS"){
585 removeCabecera('Moneda:'); 592 removeCabecera('Moneda:');
586 removeCabecera('Fecha cotizacion:'); 593 removeCabecera('Fecha cotizacion:');
587 removeCabecera('Cotizacion:'); 594 removeCabecera('Cotizacion:');
588 }else{ 595 }else{
589 addCabecera('Moneda:', moneda.DETALLE); 596 addCabecera('Moneda:', moneda.DETALLE);
590 addCabecera( 597 addCabecera(
591 'Fecha cotizacion:', 598 'Fecha cotizacion:',
592 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 599 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
593 ); 600 );
594 addCabecera('Cotizacion:', cotizacion.VENDEDOR); 601 addCabecera('Cotizacion:', cotizacion.VENDEDOR);
595 } 602 }
596 }, function() { 603 }, function() {
597 604
598 } 605 }
599 ); 606 );
600 }; 607 };
601 608
602 $scope.agregarATabla = function(key) { 609 $scope.agregarATabla = function(key) {
603 if(key === 13) { 610 if(key === 13) {
604 if($scope.articuloACargar.cantidad === undefined || 611 if($scope.articuloACargar.cantidad === undefined ||
605 $scope.articuloACargar.cantidad === 0 || 612 $scope.articuloACargar.cantidad === 0 ||
606 $scope.articuloACargar.cantidad === null ) { 613 $scope.articuloACargar.cantidad === null ) {
607 focaModalService.alert('El valor debe ser al menos 1'); 614 focaModalService.alert('El valor debe ser al menos 1');
608 return; 615 return;
609 } 616 }
610 delete $scope.articuloACargar.sectorCodigo; 617 delete $scope.articuloACargar.sectorCodigo;
611 $scope.articulosTabla.push($scope.articuloACargar); 618 $scope.articulosTabla.push($scope.articuloACargar);
612 $scope.cargando = true; 619 $scope.cargando = true;
613 } 620 }
614 }; 621 };
615 622
616 $scope.quitarArticulo = function(key) { 623 $scope.quitarArticulo = function(key) {
617 $scope.articulosTabla.splice(key, 1); 624 $scope.articulosTabla.splice(key, 1);
618 }; 625 };
619 626
620 $scope.editarArticulo = function(key, articulo) { 627 $scope.editarArticulo = function(key, articulo) {
621 if(key === 13) { 628 if(key === 13) {
622 if(articulo.cantidad === null || articulo.cantidad === 0 || 629 if(articulo.cantidad === null || articulo.cantidad === 0 ||
623 articulo.cantidad === undefined) { 630 articulo.cantidad === undefined) {
624 focaModalService.alert('El valor debe ser al menos 1'); 631 focaModalService.alert('El valor debe ser al menos 1');
625 return; 632 return;
626 } 633 }
627 articulo.editCantidad = false; 634 articulo.editCantidad = false;
628 articulo.editPrecio = false; 635 articulo.editPrecio = false;
629 } 636 }
630 }; 637 };
631 638
632 $scope.cambioEdit = function(articulo, propiedad) { 639 $scope.cambioEdit = function(articulo, propiedad) {
633 if(propiedad === 'cantidad') { 640 if(propiedad === 'cantidad') {
634 articulo.editCantidad = true; 641 articulo.editCantidad = true;
635 } else if(propiedad === 'precio') { 642 } else if(propiedad === 'precio') {
636 articulo.editPrecio = true; 643 articulo.editPrecio = true;
637 } 644 }
638 }; 645 };
639 646
640 $scope.resetFilter = function() { 647 $scope.resetFilter = function() {
641 $scope.articuloACargar = {}; 648 $scope.articuloACargar = {};
642 $scope.cargando = true; 649 $scope.cargando = true;
643 }; 650 };
644 //Recibe aviso si el teclado está en uso 651 //Recibe aviso si el teclado está en uso
645 $rootScope.$on('usarTeclado', function(event, data) { 652 $rootScope.$on('usarTeclado', function(event, data) {
646 if(data) { 653 if(data) {
647 $scope.mostrarTeclado = true; 654 $scope.mostrarTeclado = true;
648 return; 655 return;
649 } 656 }
650 $scope.mostrarTeclado = false; 657 $scope.mostrarTeclado = false;
651 }); 658 });
652 659
653 $scope.selectFocus = function($event) { 660 $scope.selectFocus = function($event) {
654 // Si el teclado esta en uso no selecciona el valor 661 // Si el teclado esta en uso no selecciona el valor
655 if($scope.mostrarTeclado) { 662 if($scope.mostrarTeclado) {
656 return; 663 return;
657 } 664 }
658 $event.target.select(); 665 $event.target.select();
659 }; 666 };
660 667
661 $scope.salir = function() { 668 $scope.salir = function() {
662 $location.path('/'); 669 $location.path('/');
663 }; 670 };
664 671
665 $scope.parsearATexto = function(articulo) { 672 $scope.parsearATexto = function(articulo) {
666 articulo.cantidad = parseFloat(articulo.cantidad); 673 articulo.cantidad = parseFloat(articulo.cantidad);
667 articulo.precio = parseFloat(articulo.precio); 674 articulo.precio = parseFloat(articulo.precio);
668 }; 675 };
669 676
670 function addArrayCabecera(array) { 677 function addArrayCabecera(array) {
671 for(var i = 0; i < array.length; i++) { 678 for(var i = 0; i < array.length; i++) {
672 addCabecera(array[i].label, array[i].valor); 679 addCabecera(array[i].label, array[i].valor);
673 } 680 }
674 } 681 }
675 682
676 function addCabecera(label, valor) { 683 function addCabecera(label, valor) {
677 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 684 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
678 if(propiedad.length === 1) { 685 if(propiedad.length === 1) {
679 propiedad[0].valor = valor; 686 propiedad[0].valor = valor;
680 } else { 687 } else {
681 $scope.cabecera.push({label: label, valor: valor}); 688 $scope.cabecera.push({label: label, valor: valor});
682 } 689 }
683 } 690 }
684 691
685 function removeCabecera(label) { 692 function removeCabecera(label) {
686 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 693 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
687 if(propiedad.length === 1) { 694 if(propiedad.length === 1) {
688 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 695 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
689 } 696 }
690 } 697 }
691 698
692 function rellenar(relleno, longitud) { 699 function rellenar(relleno, longitud) {
693 relleno = '' + relleno; 700 relleno = '' + relleno;
694 while (relleno.length < longitud) { 701 while (relleno.length < longitud) {
695 relleno = '0' + relleno; 702 relleno = '0' + relleno;
696 } 703 }
697 704
698 return relleno; 705 return relleno;
699 } 706 }
700 707
701 function validarNotaRemitada(funcion) { 708 function validarNotaRemitada(funcion) {
702 if($scope.notaPedido.idRemito) { 709 if($scope.notaPedido.idRemito) {
703 focaModalService.alert('No se puede editar una nota de pedido remitada'); 710 focaModalService.alert('No se puede editar una nota de pedido remitada');
704 } 711 }
705 else { 712 else {
706 funcion(); 713 funcion();
707 } 714 }
708 } 715 }
709 } 716 }
710 ]); 717 ]);
711 718
src/views/nota-pedido.html
1 <div class="crear-nota-pedido"> 1 <div class="crear-nota-pedido row">
2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> 2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12">
3 <div class="row"> 3 <div class="row">
4 <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> 4 <div class="col-md-10 col-lg-12">
5 <div class="row p-1 panel-informativo"> 5 <div class="row panel-informativo">
6 <div class="col-12"> 6 <div class="col-12">
7 <div class="row"> 7 <div class="row titulares">
8 <div class="col-12 col-sm-4 nota-pedido"> 8 <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle">
9 <h5>NOTA DE PEDIDO</h5> 9 <h5 class="mb-0">NOTA DE PEDIDO</h5>
10 </div> 10 </div>
11 <div class="col-5 col-sm-4 numero-pedido" 11 <div class="col-5 col-sm-3 numero-pedido border border-white align-middle"
12 >Nº {{puntoVenta}}-{{comprobante}} 12 >Nº {{puntoVenta}}-{{comprobante}}
13 <button 13 <button
14 class="btn btn-xs btn-outline-dark" 14 class="btn btn-xs btn-outline-light float-right"
15 type="button" 15 type="button"
16 ng-click="seleccionarNotaPedido()" 16 ng-click="seleccionarNotaPedido()"
17 > 17 >
18 <i class="fa fa-search"></i> 18 <i class="fa fa-search"></i>
19 </button> 19 </button>
20 </div> 20 </div>
21 <div class="col-7 col-sm-4 text-right"> 21 <div class="col-7 col-sm-3 border border-white align-middle">
22 Fecha: 22 Fecha:&#32;
23 <span 23 <span
24 ng-show="!datepickerAbierto" 24 ng-show="!datepickerAbierto"
25 ng-bind="now | date:'dd/MM/yyyy HH:mm'" 25 ng-bind="now | date:'dd/MM/yyyy'"
26 ng-click="datepickerAbierto = true" 26 ng-click="datepickerAbierto = true"
27 > 27 >
28 </span> 28 </span>
29 <input 29 <input
30 ng-show="datepickerAbierto" 30 ng-show="datepickerAbierto"
31 type="date" 31 type="date"
32 ng-model="now" 32 ng-model="now"
33 ng-change="datepickerAbierto = false" 33 ng-change="datepickerAbierto = false"
34 ng-blur="datepickerAbierto = false" 34 ng-blur="datepickerAbierto = false"
35 class="form-control form-control-sm col-8 float-right" 35 class="form-control form-control-sm col-8 float-right"
36 foca-focus="datepickerAbierto" 36 foca-focus="datepickerAbierto"
37 hasta-hoy 37 hasta-hoy
38 /> 38 />
39 </div> 39 </div>
40 <div class="col-sm-3 border border-white border-right-0 align-middle">
41 Hora:&#32;
42 <span
43 ng-show="!datepickerAbierto"
44 ng-bind="now | date:'HH:mm'"
45 ng-click="datepickerAbierto = true"
46 >
47 </span>
48 </div>
40 </div> 49 </div>
41 <div class="row"> 50 <div class="row py-2">
42 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 51 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
43 <span class="label" ng-bind="cab.label"></span> 52 <span class="label" ng-bind="cab.label"></span>
44 <span class="valor" ng-bind="cab.valor" ng-if="!isNumber(cab.valor)"></span> 53 <span class="valor" ng-bind="cab.valor" ng-if="!isNumber(cab.valor)"></span>
45 <span class="valor" ng-bind="cab.valor | number:2" ng-if="isNumber(cab.valor)"></span> 54 <span class="valor" ng-bind="cab.valor | number:2" ng-if="isNumber(cab.valor)"></span>
46 </div> 55 </div>
47 <a 56 <a
48 class="btn col-12 btn-secondary d-sm-none" 57 class="btn col-12 btn-secondary d-sm-none"
49 ng-show="cabecera.length > 0" 58 ng-show="cabecera.length > 0"
50 ng-click="showCabecera = !showCabecera" 59 ng-click="showCabecera = !showCabecera"
51 > 60 >
52 <i 61 <i
53 class="fa fa-chevron-down" 62 class="fa fa-chevron-down"
54 ng-hide="showCabecera" 63 ng-hide="showCabecera"
55 aria-hidden="true" 64 aria-hidden="true"
56 > 65 >
57 </i> 66 </i>
58 <i 67 <i
59 class="fa fa-chevron-up" 68 class="fa fa-chevron-up"
60 ng-show="showCabecera" 69 ng-show="showCabecera"
61 aria-hidden="true"> 70 aria-hidden="true">
62 </i> 71 </i>
63 </a> 72 </a>
64 </div> 73 </div>
65 </div> 74 </div>
66 </div> 75 </div>
67 <div class="row p-1 botonera-secundaria"> 76
77 </div>
78 </div>
79 </form>
80 <div class="col-lg-12">
81 <div class="row mt-4">
82 <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
83 <div class="row px-5 py-2 botonera-secundaria">
68 <div class="col-12"> 84 <div class="col-12">
69 <div class="row"> 85 <div class="row">
70 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> 86 <div
87 class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0"
88 ng-repeat="boton in botonera"
89 ng-class="{'d-none d-md-grid': boton.texto == ''}">
71 <button 90 <button
72 type="button" 91 type="button"
73 class="btn btn-default btn-block btn-xs text-left py-2" 92 class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light"
74 ng-click="boton.accion()" 93 ng-click="boton.accion()"
75 ng-class="{'d-none d-sm-block': boton.texto == ''}" 94 ng-class="{'d-sm-block h-100': boton.texto == ''}"
76 > 95 >
77 <i 96 <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen">
78 class="fa fa-arrow-circle-right" 97 <span>{{boton.texto}}</span>
79 ng-show="boton.texto != ''"
80 ></i>
81 &nbsp;
82 {{boton.texto}}
83 </button> 98 </button>
84 </div> 99 </div>
85 </div> 100 </div>
86 </div> 101 </div>
87 </div> 102 </div>
88 </div> 103 <!-- PC -->
89 </div> 104 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
90 </form> 105 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
91 <div class="row"> 106 <thead>
92 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 107 <tr class="d-flex">
93 <!-- PC --> 108 <th valign="middle" class="">#</th>
94 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 109 <th valign="middle" class="col">Código</th>
95 <table class="table tabla-articulo table-striped table-sm table-dark"> 110 <th valign="middle" class="col-4">Descripción</th>
96 <thead> 111 <th valign="middle" class="col text-right">Cantidad</th>
97 <tr class="d-flex"> 112 <th valign="middle" class="col text-right">Precio Unitario</th>
98 <th class="">#</th> 113 <th valign="middle" class="col text-right">SubTotal</th>
99 <th class="col">Código</th> 114 <th valign="middle" class="text-right">
100 <th class="col-4">Descripción</th> 115 <button
101 <th class="col text-right">Cantidad</th> 116 class="btn btn-outline-secondary selectable"
102 <th class="col text-right">Precio Unitario</th> 117 ng-click="show = !show; masMenos()"
103 <th class="col text-right">SubTotal</th> 118 >
104 <th class="text-right"> 119 <i
105 <button 120 class="fa fa-chevron-down"
106 class="btn btn-outline-secondary selectable" 121 ng-show="show"
107 ng-click="show = !show; masMenos()" 122 aria-hidden="true"
108 > 123 >
109 <i 124 </i>
110 class="fa fa-chevron-down" 125 <i
111 ng-show="show" 126 class="fa fa-chevron-up"
112 aria-hidden="true" 127 ng-hide="show"
128 aria-hidden="true">
129 </i>
130 </button>
131 </th>
132 </tr>
133 </thead>
134 <tbody class="tabla-articulo-body">
135 <tr
136 ng-repeat="(key, articulo) in articulosTabla"
137 ng-show="show || key == (articulosTabla.length - 1)"
138 class="d-flex"
139 >
140 <td ng-bind="key + 1"></td>
141 <td
142 class="col"
143 ng-bind="articulo.sector + '-' + articulo.codigo"
144 ></td>
145 <td
146 class="col-4"
147 ng-bind="articulo.descripcion"
148 ></td>
149 <td class="col text-right">
150 <input
151 ng-show="articulo.editCantidad"
152 ng-model="articulo.cantidad"
153 class="form-control"
154 foca-tipo-input
155 min="1"
156 step="0.001"
157 foca-focus="articulo.editCantidad"
158 ng-keypress="editarArticulo($event.keyCode, articulo)"
159 ng-focus="selectFocus($event)"
160 teclado-virtual
113 > 161 >
162 <i
163 class="selectable"
164 ng-click="cambioEdit(articulo, 'cantidad')"
165 ng-hide="articulo.editCantidad"
166 ng-bind="articulo.cantidad">
114 </i> 167 </i>
168 </td>
169 <td class="col text-right">
170 <input
171 ng-show="articulo.editPrecio"
172 ng-model="articulo.precio"
173 class="form-control"
174 foca-tipo-input
175 min="0"
176 step="0.0001"
177 foca-focus="articulo.editPrecio"
178 ng-keypress="editarArticulo($event.keyCode, articulo)"
179 ng-focus="selectFocus($event)"
180 teclado-virtual
181 >
115 <i 182 <i
116 class="fa fa-chevron-up" 183 class="selectable"
117 ng-hide="show" 184 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
118 aria-hidden="true"> 185 ng-hide="articulo.editPrecio"
186 ng-bind="articulo.precio |
187 currency: notaPedido.moneda.SIMBOLO : 4">
119 </i> 188 </i>
120 </button> 189 </td>
121 </th> 190 <td
122 </tr> 191 class="col text-right"
123 </thead> 192 ng-bind="(articulo.precio * articulo.cantidad) |
124 <tbody class="tabla-articulo-body"> 193 currency: notaPedido.moneda.SIMBOLO">
125 <tr 194 </td>
126 ng-repeat="(key, articulo) in articulosTabla" 195 <td class="text-center">
127 ng-show="show || key == (articulosTabla.length - 1)" 196 <button
128 class="d-flex" 197 ng-show="articulo.editCantidad || articulo.editPrecio"
129 > 198 class="btn btn-outline-secondary"
130 <td ng-bind="key + 1"></td> 199 ng-click="editarArticulo(13, articulo)"
131 <td 200 >
132 class="col" 201 <i class="fa fa-save"></i>
133 ng-bind="articulo.sector + '-' + articulo.codigo" 202 </button>
134 ></td> 203 <button
135 <td 204 class="btn btn-outline-secondary"
136 class="col-4" 205 ng-click="quitarArticulo(key)"
137 ng-bind="articulo.descripcion" 206 >
138 ></td> 207 <i class="fa fa-trash"></i>
139 <td class="col text-right"> 208 </button>
140 <input 209 </td>
141 ng-show="articulo.editCantidad" 210 </tr>
142 ng-model="articulo.cantidad" 211 </tbody>
143 class="form-control" 212 <tfoot>
144 foca-tipo-input 213 <tr ng-show="!cargando" class="d-flex">
145 min="1" 214 <td
146 step="0.001" 215 class="align-middle"
147 foca-focus="articulo.editCantidad" 216 ng-bind="articulosTabla.length + 1"
148 ng-keypress="editarArticulo($event.keyCode, articulo)"
149 ng-focus="selectFocus($event)"
150 teclado-virtual
151 >
152 <i
153 class="selectable"
154 ng-click="cambioEdit(articulo, 'cantidad')"
155 ng-hide="articulo.editCantidad"
156 ng-bind="articulo.cantidad">
157 </i>
158 </td>
159 <td class="col text-right">
160 <input
161 ng-show="articulo.editPrecio"
162 ng-model="articulo.precio"
163 class="form-control"
164 foca-tipo-input
165 min="0"
166 step="0.0001"
167 foca-focus="articulo.editPrecio"
168 ng-keypress="editarArticulo($event.keyCode, articulo)"
169 ng-focus="selectFocus($event)"
170 teclado-virtual
171 >
172 <i
173 class="selectable"
174 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
175 ng-hide="articulo.editPrecio"
176 ng-bind="articulo.precio |
177 currency: notaPedido.moneda.SIMBOLO : 4">
178 </i>
179 </td>
180 <td
181 class="col text-right"
182 ng-bind="(articulo.precio * articulo.cantidad) |
183 currency: notaPedido.moneda.SIMBOLO">
184 </td>
185 <td class="text-center">
186 <button
187 ng-show="articulo.editCantidad || articulo.editPrecio"
188 class="btn btn-outline-secondary"
189 ng-click="editarArticulo(13, articulo)"
190 >
191 <i class="fa fa-save"></i>
192 </button>
193 <button
194 class="btn btn-outline-secondary"
195 ng-click="quitarArticulo(key)"
196 >
197 <i class="fa fa-trash"></i>
198 </button>
199 </td>
200 </tr>
201 </tbody>
202 <tfoot>
203 <tr ng-show="!cargando" class="d-flex">
204 <td
205 class="align-middle"
206 ng-bind="articulosTabla.length + 1"
207 ></td>
208 <td class="col">
209 <input
210 class="form-control"
211 ng-model="articuloACargar.sectorCodigo"
212 readonly
213 >
214 </td>
215 <td class="col-4 tabla-articulo-descripcion">
216 <input
217 class="form-control"
218 ng-model="articuloACargar.descripcion"
219 readonly
220 >
221 </td>
222 <td class="col text-right">
223 <input
224 class="form-control"
225 foca-tipo-input
226 min="1"
227 step="0.001"
228 ng-model="articuloACargar.cantidad"
229 foca-focus="!cargando"
230 esc-key="resetFilter()"
231 ng-keypress="agregarATabla($event.keyCode)"
232 teclado-virtual
233 >
234 </td>
235 <td class="col text-right">
236 <input
237 class="form-control"
238 ng-value="articuloACargar.precio |
239 currency: notaPedido.moneda.SIMBOLO : 4"
240 ng-show="idLista != -1"
241 readonly
242 >
243 <input
244 class="form-control"
245 foca-tipo-input
246 min="0"
247 step="0.0001"
248 ng-model="articuloACargar.precio"
249 esc-key="resetFilter()"
250 ng-keypress="agregarATabla($event.keyCode)"
251 ng-show="idLista == -1"
252 teclado-virtual
253 >
254 </td>
255 <td class="col text-right">
256 <input
257 class="form-control"
258 ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO"
259 readonly
260 ></td> 217 ></td>
261 <td class="text-center align-middle"> 218 <td class="col">
262 <button 219 <input
263 class="btn btn-outline-secondary" 220 class="form-control"
264 ng-click="agregarATabla(13)" 221 ng-model="articuloACargar.sectorCodigo"
265 > 222 readonly
266 <i class="fa fa-save"></i> 223 >
267 </button> 224 </td>
268 </td> 225 <td class="col-4 tabla-articulo-descripcion">
269 </tr> 226 <input
270 <tr ng-show="cargando" class="d-flex"> 227 class="form-control"
271 <td colspan="7" class="col-12"> 228 ng-model="articuloACargar.descripcion"
272 <input 229 readonly
273 placeholder="Seleccione Articulo" 230 >
274 class="form-control form-control-sm" 231 </td>
275 readonly 232 <td class="col text-right">
276 ng-click="seleccionarArticulo()" 233 <input
277 /> 234 class="form-control"
278 </td> 235 foca-tipo-input
279 </tr> 236 min="1"
280 <tr class="d-flex"> 237 step="0.001"
281 <td colspan="4" class="no-border-top"> 238 ng-model="articuloACargar.cantidad"
282 <strong>Items:</strong> 239 foca-focus="!cargando"
283 <a ng-bind="articulosTabla.length"></a> 240 esc-key="resetFilter()"
284 </td> 241 ng-keypress="agregarATabla($event.keyCode)"
285 <td class="text-right ml-auto table-celda-total no-border-top"> 242 teclado-virtual
286 <h3>Total:</h3> 243 >
287 </td> 244 </td>
288 <td class="table-celda-total text-right no-border-top" colspan="1"> 245 <td class="col text-right">
289 <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> 246 <input
290 </td> 247 class="form-control"
291 <td class="text-right no-border-top"> 248 ng-value="articuloACargar.precio |
292 <button 249 currency: notaPedido.moneda.SIMBOLO : 4"
293 type="button" 250 ng-show="idLista != -1"
294 class="btn btn-default btn-sm" 251 readonly
295 > 252 >
296 Totales 253 <input
297 </button> 254 class="form-control"
298 </td> 255 foca-tipo-input
299 </tr> 256 min="0"
300 </tfoot> 257 step="0.0001"
301 </table> 258 ng-model="articuloACargar.precio"
302 </div> 259 esc-key="resetFilter()"
303 <!-- MOBILE --> 260 ng-keypress="agregarATabla($event.keyCode)"
304 <div class="row d-sm-none"> 261 ng-show="idLista == -1"
305 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 262 teclado-virtual
306 <thead> 263 >
307 <tr class="d-flex"> 264 </td>
308 <th class="">#</th> 265 <td class="col text-right">
309 <th class="col px-0"> 266 <input
310 <div class="d-flex"> 267 class="form-control"
311 <div class="col-4 px-1">Código</div> 268 ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO"
312 <div class="col-8 px-1">Descripción</div> 269 readonly
313 </div> 270 ></td>
314 <div class="d-flex"> 271 <td class="text-center align-middle">
315 <div class="col-3 px-1">Cantidad</div> 272 <button
316 <div class="col px-1 text-right">P. Uni.</div> 273 class="btn btn-outline-secondary"
317 <div class="col px-1 text-right">Subtotal</div> 274 ng-click="agregarATabla(13)"
318 </div> 275 >
319 </th> 276 <i class="fa fa-save"></i>
320 <th class="text-center tamaño-boton"> 277 </button>
321 &nbsp; 278 </td>
322 </th> 279 </tr>
323 </tr> 280 <tr class="d-flex">
324 </thead> 281 <td colspan="4" class="no-border-top">
325 <tbody> 282 <strong>Items:</strong>
326 <tr 283 <a ng-bind="articulosTabla.length"></a>
327 ng-repeat="(key, articulo) in articulosTabla" 284 </td>
328 ng-show="show || key == articulosTabla.length - 1" 285 <td class="text-right ml-auto table-celda-total no-border-top">
329 > 286 <h3>Total:</h3>
330 <td class="w-100 align-middle d-flex p-0"> 287 </td>
331 <div class="align-middle p-1"> 288 <td class="table-celda-total text-right no-border-top" colspan="1">
332 <span ng-bind="key+1" class="align-middle"></span> 289 <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3>
333 </div> 290 </td>
334 <div class="col px-0"> 291 <td class="text-right no-border-top">
292 <button
293 type="button"
294 class="btn btn-default btn-sm"
295 >
296 Totales
297 </button>
298 </td>
299 </tr>
300 </tfoot>
301 </table>
302 </div>
303 <!-- MOBILE -->
304 <div class="row d-sm-none">
305 <table class="table table-sm table-striped table-dark margin-bottom-mobile">
306 <thead>
307 <tr class="d-flex">
308 <th class="">#</th>
309 <th class="col px-0">
310 <div class="d-flex">
311 <div class="col-4 px-1">Código</div>
312 <div class="col-8 px-1">Descripción</div>
313 </div>
314 <div class="d-flex">
315 <div class="col-3 px-1">Cantidad</div>
316 <div class="col px-1 text-right">P. Uni.</div>
317 <div class="col px-1 text-right">Subtotal</div>
318 </div>
319 </th>
320 <th class="text-center tamaño-boton">
321 &nbsp;
322 </th>
323 </tr>
324 </thead>
325 <tbody>
326 <tr
327 ng-repeat="(key, articulo) in articulosTabla"
328 ng-show="show || key == articulosTabla.length - 1"
329 >
330 <td class="w-100 align-middle d-flex p-0">
331 <div class="align-middle p-1">
332 <span ng-bind="key+1" class="align-middle"></span>
333 </div>
334 <div class="col px-0">
335 <div class="d-flex">
336 <div class="col-4 px-1">
337 <span
338 ng-bind="articulo.sector + '-' + articulo.codigo"
339 ></span>
340 </div>
341 <div class="col-8 px-1">
342 <span ng-bind="articulo.descripcion"></span>
343 </div>
344 </div>
345 <div class="d-flex">
346 <div class="col-3 px-1">
347 <span
348 ng-bind="'x' + articulo.cantidad"
349 ng-hide="articulo.editCantidad"
350 ></span>
351 <i
352 class="fa fa-pencil text-white-50"
353 aria-hidden="true"
354 ng-hide="articulo.editCantidad"
355 ng-click="articulo.editCantidad = true"
356 ></i>
357 <input
358 ng-show="articulo.editCantidad"
359 ng-model="articulo.cantidad"
360 class="form-control"
361 foca-tipo-input
362 min="1"
363 step="0.001"
364 foca-focus="articulo.editCantidad"
365 ng-keypress="editarArticulo($event.keyCode, articulo)"
366 ng-focus="selectFocus($event)"
367 >
368 </div>
369 <div class="col px-1 text-right">
370 <span ng-bind="articulo.precio |
371 currency: notaPedido.moneda.SIMBOLO : 4"></span>
372 ></span>
373 </div>
374 <div class="col px-1 text-right">
375 <span
376 ng-bind="(articulo.precio * articulo.cantidad) |
377 currency: notaPedido.moneda.SIMBOLO"
378 >
379 </span>
380 </div>
381 </div>
382 </div>
383 <div class="align-middle p-1">
384 <button
385 class="btn btn-outline-secondary"
386 ng-click="quitarArticulo(key)"
387 >
388 <i class="fa fa-trash"></i>
389 </button>
390 </div>
391 </td>
392 </tr>
393 </tbody>
394 <tfoot>
395 <!-- CARGANDO ITEM -->
396 <tr ng-show="!cargando" class="d-flex">
397 <td
398 class="align-middle p-1"
399 ng-bind="articulosTabla.length + 1"
400 ></td>
401 <td class="col p-0">
335 <div class="d-flex"> 402 <div class="d-flex">
336 <div class="col-4 px-1"> 403 <div class="col-4 px-1">
337 <span 404 <span
338 ng-bind="articulo.sector + '-' + articulo.codigo" 405 ng-bind="articuloACargar.sectorCodigo"
339 ></span> 406 ></span>
340 </div> 407 </div>
341 <div class="col-8 px-1"> 408 <div class="col-8 px-1">
342 <span ng-bind="articulo.descripcion"></span> 409 <span ng-bind="articuloACargar.descripcion"></span>
343 </div> 410 </div>
344 </div> 411 </div>
345 <div class="d-flex"> 412 <div class="d-flex">
346 <div class="col-3 px-1"> 413 <div class="col-3 px-1 m-1">
347 <span
348 ng-bind="'x' + articulo.cantidad"
349 ng-hide="articulo.editCantidad"
350 ></span>
351 <i
352 class="fa fa-pencil text-white-50"
353 aria-hidden="true"
354 ng-hide="articulo.editCantidad"
355 ng-click="articulo.editCantidad = true"
356 ></i>
357 <input 414 <input
358 ng-show="articulo.editCantidad" 415 class="form-control p-1"
359 ng-model="articulo.cantidad"