Commit ecc5d71fb65c330c51618317743d7297932384e7

Authored by Eric Fernandez
1 parent b266ef32ab
Exists in master

angular-ladda

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