Commit 4118d3574be8758e7fcaf88e13ae6e95f09bf14f

Authored by Jose Pinto
1 parent 172c467d18
Exists in master

nuevo diseño

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