Commit 85f3f7fd64c12d02c6940a09518253dae7b93369

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master (pmarco)

See merge request modulos-npm/foca-crear-nota-pedido!40
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', 4 'focaModalService',
5 function( 5 function(
6 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService 6 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService
7 ) { 7 ) {
8 $scope.botonera = [ 8 $scope.botonera = [
9 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, 9 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}},
10 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, 10 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
11 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, 11 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}},
12 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, 12 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}},
13 { 13 {
14 texto: 'Precios y condiciones', 14 texto: 'Precios y condiciones',
15 accion: function() {$scope.abrirModalListaPrecio();}}, 15 accion: function() {$scope.abrirModalListaPrecio();}},
16 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, 16 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}},
17 {texto: '', accion: function() {}}, 17 {texto: '', accion: function() {}},
18 {texto: '', accion: function() {}} 18 {texto: '', accion: function() {}}
19 ]; 19 ];
20 $scope.datepickerAbierto = false; 20 $scope.datepickerAbierto = false;
21 21
22 $scope.show = false; 22 $scope.show = false;
23 $scope.cargando = true; 23 $scope.cargando = true;
24 $scope.dateOptions = { 24 $scope.dateOptions = {
25 maxDate: new Date(), 25 maxDate: new Date(),
26 minDate: new Date(2010, 0, 1) 26 minDate: new Date(2010, 0, 1)
27 }; 27 };
28 28
29 $scope.notaPedido = { 29 $scope.notaPedido = {
30 vendedor: {}, 30 vendedor: {},
31 cliente: {}, 31 cliente: {},
32 domicilio: {dom: ''}, 32 domicilio: {dom: ''},
33 moneda: {detalle: ''} 33 moneda: {detalle: ''}
34 }; 34 };
35 35
36 $scope.cabecera = []; 36 $scope.cabecera = [];
37 $scope.showCabecera = true; 37 $scope.showCabecera = true;
38 38
39 $scope.now = new Date(); 39 $scope.now = new Date();
40 $scope.puntoVenta = Math.round(Math.random() * 10000); 40 $scope.puntoVenta = Math.round(Math.random() * 10000);
41 $scope.comprobante = Math.round(Math.random() * 1000000); 41 $scope.comprobante = Math.round(Math.random() * 1000000);
42 42
43 $scope.articulosTabla = []; 43 $scope.articulosTabla = [];
44 var idLista; 44 var idLista;
45 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); 45 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
46 crearNotaPedidoService.getPrecioCondicion().then( 46 crearNotaPedidoService.getPrecioCondicion().then(
47 function(res) { 47 function(res) {
48 $scope.precioCondiciones = res.data; 48 $scope.precioCondiciones = res.data;
49 } 49 }
50 ); 50 );
51 if (notaPedidoTemp !== undefined) { 51 if (notaPedidoTemp !== undefined) {
52 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); 52 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
53 $scope.notaPedido = notaPedidoTemp; 53 $scope.notaPedido = notaPedidoTemp;
54 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); 54 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
55 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); 55 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
56 idLista = $scope.notaPedido.precioCondicion; 56 idLista = $scope.notaPedido.precioCondicion;
57 crearNotaPedidoService 57 crearNotaPedidoService
58 .getArticulosByIdNotaPedido($scope.notaPedido.id).then( 58 .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
59 function(res) { 59 function(res) {
60 $scope.articulosTabla = res.data; 60 $scope.articulosTabla = res.data;
61 } 61 }
62 ); 62 );
63 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 63 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
64 //(NO REQUERIDO EN ESTA VERSION) 64 //(NO REQUERIDO EN ESTA VERSION)
65 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( 65 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
66 // function(res) { 66 // function(res) {
67 // $scope.notaPedido.domicilio = res.data; 67 // $scope.notaPedido.domicilio = res.data;
68 // } 68 // }
69 // ); 69 // );
70 } else { 70 } else {
71 $scope.notaPedido.fechaCarga = new Date(); 71 $scope.notaPedido.fechaCarga = new Date();
72 $scope.notaPedido.bomba = '0'; 72 $scope.notaPedido.bomba = '0';
73 $scope.notaPedido.flete = '0'; 73 $scope.notaPedido.flete = '0';
74 idLista = undefined; 74 idLista = undefined;
75 } 75 }
76 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 76 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
77 // $scope.addNewDom = function() { 77 // $scope.addNewDom = function() {
78 // $scope.notaPedido.domicilio.push({ 'id': 0 }); 78 // $scope.notaPedido.domicilio.push({ 'id': 0 });
79 // }; 79 // };
80 // $scope.removeNewChoice = function(choice) { 80 // $scope.removeNewChoice = function(choice) {
81 // if ($scope.notaPedido.domicilio.length > 1) { 81 // if ($scope.notaPedido.domicilio.length > 1) {
82 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( 82 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
83 // function(c) { 83 // function(c) {
84 // return c.$$hashKey === choice.$$hashKey; 84 // return c.$$hashKey === choice.$$hashKey;
85 // } 85 // }
86 // ), 1); 86 // ), 1);
87 // } 87 // }
88 // }; 88 // };
89 $scope.crearNotaPedido = function() { 89 $scope.crearNotaPedido = function() {
90 if($scope.articulosTabla.length === 0) { 90 if($scope.articulosTabla.length === 0) {
91 focaModalService.alert('Debe cargar almenos un articulo'); 91 focaModalService.alert('Debe cargar almenos un articulo');
92 return; 92 return;
93 } 93 }
94 if($scope.notaPedido.domicilio.id === undefined) { 94 if($scope.notaPedido.domicilio.id === undefined) {
95 $scope.notaPedido.domicilio.id = 0; 95 $scope.notaPedido.domicilio.id = 0;
96 } 96 }
97 var date = new Date(); 97 var date = new Date();
98 var notaPedido = { 98 var notaPedido = {
99 id: 0, 99 id: 0,
100 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 100 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
101 .toISOString().slice(0, 19).replace('T', ' '), 101 .toISOString().slice(0, 19).replace('T', ' '),
102 vendedor: $scope.notaPedido.vendedor.nombre, 102 vendedor: $scope.notaPedido.vendedor.nombre,
103 idCliente: $scope.notaPedido.cliente.id, 103 idCliente: $scope.notaPedido.cliente.id,
104 domicilio: $scope.notaPedido.domicilio, 104 domicilio: $scope.notaPedido.domicilio,
105 bomba: $scope.notaPedido.bomba, 105 bomba: $scope.notaPedido.bomba,
106 flete: $scope.notaPedido.flete, 106 flete: $scope.notaPedido.flete,
107 total: $scope.getTotal() 107 total: $scope.getTotal()
108 }; 108 };
109 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 109 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
110 function(data) { 110 function(data) {
111 if($scope.notaPedido.flete === 1) { 111 if($scope.notaPedido.flete === 1) {
112 var flete = { 112 var flete = {
113 idNotaPedido: data.data.id, 113 idNotaPedido: data.data.id,
114 idTransportista: $scope.notaPedido.fleteId, 114 idTransportista: $scope.notaPedido.fleteId,
115 idChofer: $scope.notaPedido.chofer.id, 115 idChofer: $scope.notaPedido.chofer.id,
116 idVehiculo: $scope.notaPedido.vehiculo.id, 116 idVehiculo: $scope.notaPedido.vehiculo.id,
117 kilometros: $scope.notaPedido.kilometros, 117 kilometros: $scope.notaPedido.kilometros,
118 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete 118 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete
119 }; 119 };
120 crearNotaPedidoService.crearFlete(flete); 120 crearNotaPedidoService.crearFlete(flete);
121 } 121 }
122 var articulosNotaPedido = $scope.articulosTabla; 122 var articulosNotaPedido = $scope.articulosTabla;
123 for(var i = 0; i < articulosNotaPedido.length; i++) { 123 for(var i = 0; i < articulosNotaPedido.length; i++) {
124 delete articulosNotaPedido[i].edit; 124 delete articulosNotaPedido[i].edit;
125 articulosNotaPedido[i].idNotaPedido = data.data.id; 125 articulosNotaPedido[i].idNotaPedido = data.data.id;
126 crearNotaPedidoService 126 crearNotaPedidoService
127 .crearArticulosParaNotaPedido(articulosNotaPedido[i]); 127 .crearArticulosParaNotaPedido(articulosNotaPedido[i]);
128 } 128 }
129 var plazos = $scope.plazosPagos; 129 var plazos = $scope.plazosPagos;
130 for(var j = 0; j < plazos.length; j++) { 130 for(var j = 0; j < plazos.length; j++) {
131 var json = { 131 var json = {
132 idPedido: data.data.id, 132 idPedido: data.data.id,
133 dias: plazos[j].dias 133 dias: plazos[j].dias
134 }; 134 };
135 crearNotaPedidoService.crearPlazosParaNotaPedido(json); 135 crearNotaPedidoService.crearPlazosParaNotaPedido(json);
136 } 136 }
137 focaModalService.alert('Nota pedido creada'); 137 focaModalService.alert('Nota pedido creada');
138 $scope.limpiarPantalla(); 138 $scope.limpiarPantalla();
139 } 139 }
140 ); 140 );
141 }; 141 };
142 142
143 $scope.seleccionarArticulo = function() { 143 $scope.seleccionarArticulo = function() {
144 if (idLista === undefined) { 144 if (idLista === undefined) {
145 focaModalService.alert( 145 focaModalService.alert(
146 'Primero seleccione una lista de precio y condicion'); 146 'Primero seleccione una lista de precio y condicion');
147 return; 147 return;
148 } 148 }
149 var modalInstance = $uibModal.open( 149 var modalInstance = $uibModal.open(
150 { 150 {
151 ariaLabelledBy: 'Busqueda de Productos', 151 ariaLabelledBy: 'Busqueda de Productos',
152 templateUrl: 'modal-busqueda-productos.html', 152 templateUrl: 'modal-busqueda-productos.html',
153 controller: 'modalBusquedaProductosCtrl', 153 controller: 'modalBusquedaProductosCtrl',
154 resolve: { idLista: function() { return idLista; } }, 154 resolve: { idLista: function() { return idLista; } },
155 size: 'lg' 155 size: 'lg'
156 } 156 }
157 ); 157 );
158 modalInstance.result.then( 158 modalInstance.result.then(
159 function(producto) { 159 function(producto) {
160 var newArt = 160 var newArt =
161 { 161 {
162 id: 0, 162 id: 0,
163 codigo: producto.codigo, 163 codigo: producto.codigo,
164 sector: producto.sector, 164 sector: producto.sector,
165 sectorCodigo: producto.sector + '-' + producto.codigo, 165 sectorCodigo: producto.sector + '-' + producto.codigo,
166 descripcion: producto.descripcion, 166 descripcion: producto.descripcion,
167 item: $scope.articulosTabla.length + 1, 167 item: $scope.articulosTabla.length + 1,
168 nombre: producto.descripcion, 168 nombre: producto.descripcion,
169 precio: producto.precio.toFixed(2), 169 precio: producto.precio.toFixed(2),
170 costoUnitario: producto.costo, 170 costoUnitario: producto.costo,
171 edit: false 171 edit: false
172 }; 172 };
173 $scope.articuloACargar = newArt; 173 $scope.articuloACargar = newArt;
174 $scope.cargando = false; 174 $scope.cargando = false;
175 }, function() { 175 }, function() {
176 // funcion ejecutada cuando se cancela el modal 176 // funcion ejecutada cuando se cancela el modal
177 } 177 }
178 ); 178 );
179 }; 179 };
180 180
181 $scope.seleccionarVendedor = function() { 181 $scope.seleccionarVendedor = function() {
182 var modalInstance = $uibModal.open( 182 var modalInstance = $uibModal.open(
183 { 183 {
184 ariaLabelledBy: 'Busqueda de Vendedores', 184 ariaLabelledBy: 'Busqueda de Vendedores',
185 templateUrl: 'modal-vendedores.html', 185 templateUrl: 'modal-vendedores.html',
186 controller: 'modalVendedoresCtrl', 186 controller: 'modalVendedoresCtrl',
187 size: 'lg' 187 size: 'lg'
188 } 188 }
189 ); 189 );
190 modalInstance.result.then( 190 modalInstance.result.then(
191 function(vendedor) { 191 function(vendedor) {
192 addCabecera('Vendedor:', vendedor.NomVen); 192 addCabecera('Vendedor:', vendedor.NomVen);
193 $scope.notaPedido.vendedor.nombre = vendedor.NomVen; 193 $scope.notaPedido.vendedor.nombre = vendedor.NomVen;
194 }, function() { 194 }, function() {
195 195
196 } 196 }
197 ); 197 );
198 }; 198 };
199 199
200 $scope.seleccionarProveedor = function() { 200 $scope.seleccionarProveedor = function() {
201 var modalInstance = $uibModal.open( 201 var modalInstance = $uibModal.open(
202 { 202 {
203 ariaLabelledBy: 'Busqueda de Proveedor', 203 ariaLabelledBy: 'Busqueda de Proveedor',
204 templateUrl: 'modal-proveedor.html', 204 templateUrl: 'modal-proveedor.html',
205 controller: 'focaModalProveedorCtrl', 205 controller: 'focaModalProveedorCtrl',
206 size: 'lg' 206 size: 'lg'
207 } 207 }
208 ); 208 );
209 modalInstance.result.then( 209 modalInstance.result.then(
210 function(proveedor) { 210 function(proveedor) {
211 $scope.notaPedido.proveedor = proveedor.NOM; 211 $scope.notaPedido.proveedor = proveedor.NOM;
212 addCabecera('Proveedor:', proveedor.NOM); 212 addCabecera('Proveedor:', proveedor.NOM);
213 }, function() { 213 }, function() {
214 214
215 } 215 }
216 ); 216 );
217 }; 217 };
218 218
219 $scope.seleccionarCliente = function() { 219 $scope.seleccionarCliente = function() {
220 var modalInstance = $uibModal.open( 220 var modalInstance = $uibModal.open(
221 { 221 {
222 ariaLabelledBy: 'Busqueda de Cliente', 222 ariaLabelledBy: 'Busqueda de Cliente',
223 templateUrl: 'foca-busqueda-cliente-modal.html', 223 templateUrl: 'foca-busqueda-cliente-modal.html',
224 controller: 'focaBusquedaClienteModalController', 224 controller: 'focaBusquedaClienteModalController',
225 size: 'lg' 225 size: 'lg'
226 } 226 }
227 ); 227 );
228 modalInstance.result.then( 228 modalInstance.result.then(
229 function(cliente) { 229 function(cliente) {
230 $scope.notaPedido.cliente.nombre = cliente.nom; 230 $scope.notaPedido.cliente.nombre = cliente.nom;
231 $scope.notaPedido.cliente.id = cliente.cod; 231 $scope.notaPedido.cliente.id = cliente.cod;
232 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( 232 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then(
233 function(data) { 233 function(data) {
234 if(data.data.length === 0){ 234 if(data.data.length === 0){
235 focaModalService 235 focaModalService
236 .alert('El cliente no tienen domicilios de entrega') 236 .alert('El cliente no tienen domicilios de entrega')
237 .then( 237 .then(
238 function() { 238 function() {
239 $scope.seleccionarCliente(); 239 $scope.seleccionarCliente();
240 $scope.notaPedido.cliente = {nombre: ''}; 240 $scope.notaPedido.cliente = {nombre: ''};
241 } 241 }
242 ); 242 );
243 return; 243 return;
244 } 244 }
245 var modalInstanceDomicilio = $uibModal.open( 245 var modalInstanceDomicilio = $uibModal.open(
246 { 246 {
247 ariaLabelledBy: 'Busqueda de Domicilios', 247 ariaLabelledBy: 'Busqueda de Domicilios',
248 templateUrl: 'modal-domicilio.html', 248 templateUrl: 'modal-domicilio.html',
249 controller: 'focaModalDomicilioController', 249 controller: 'focaModalDomicilioController',
250 resolve: { idCliente: function() { return cliente.cod; }}, 250 resolve: { idCliente: function() { return cliente.cod; }},
251 size: 'lg', 251 size: 'lg',
252 backdrop: 'static', 252 backdrop: 'static',
253 } 253 }
254 ); 254 );
255 modalInstanceDomicilio.result.then( 255 modalInstanceDomicilio.result.then(
256 function(domicilio) { 256 function(domicilio) {
257 focaModalService.alert('Domicilio elegido' + domicilio.dom); 257 focaModalService.alert('Domicilio elegido' + domicilio.dom);
258 }, function() { 258 }, function() {
259 $scope.notaPedido.cliente.nombre = ''; 259 $scope.notaPedido.cliente.nombre = '';
260 $scope.notaPedido.cliente.id = ''; 260 $scope.notaPedido.cliente.id = '';
261 removeCabecera('Cliente:'); 261 removeCabecera('Cliente:');
262 $scope.seleccionarCliente(); 262 $scope.seleccionarCliente();
263 return; 263 return;
264 } 264 }
265 ); 265 );
266 } 266 }
267 ); 267 );
268 addCabecera('Cliente:', cliente.nom); 268 addCabecera('Cliente:', cliente.nom);
269 }, function() { 269 }, function() {
270 270
271 } 271 }
272 ); 272 );
273 }; 273 };
274 274
275 $scope.mostrarFichaCliente = function() { 275 $scope.mostrarFichaCliente = function() {
276 $uibModal.open( 276 $uibModal.open(
277 { 277 {
278 ariaLabelledBy: 'Datos del Cliente', 278 ariaLabelledBy: 'Datos del Cliente',
279 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 279 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
280 controller: 'focaCrearNotaPedidoFichaClienteController', 280 controller: 'focaCrearNotaPedidoFichaClienteController',
281 size: 'lg' 281 size: 'lg'
282 } 282 }
283 ); 283 );
284 }; 284 };
285 285
286 $scope.getTotal = function() { 286 $scope.getTotal = function() {
287 var total = 0; 287 var total = 0;
288 var arrayTempArticulos = $scope.articulosTabla; 288 var arrayTempArticulos = $scope.articulosTabla;
289 for (var i = 0; i < arrayTempArticulos.length; i++) { 289 for (var i = 0; i < arrayTempArticulos.length; i++) {
290 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 290 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
291 } 291 }
292 return total.toFixed(2); 292 return total.toFixed(2);
293 }; 293 };
294 294
295 $scope.getSubTotal = function() { 295 $scope.getSubTotal = function() {
296 if($scope.articuloACargar) { 296 if($scope.articuloACargar) {
297 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 297 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
298 } 298 }
299 }; 299 };
300 300
301 $scope.abrirModalListaPrecio = function() { 301 $scope.abrirModalListaPrecio = function() {
302 var modalInstance = $uibModal.open( 302 var modalInstance = $uibModal.open(
303 { 303 {
304 ariaLabelledBy: 'Busqueda de Precio Condición', 304 ariaLabelledBy: 'Busqueda de Precio Condición',
305 templateUrl: 'modal-precio-condicion.html', 305 templateUrl: 'modal-precio-condicion.html',
306 controller: 'focaModalPrecioCondicionController', 306 controller: 'focaModalPrecioCondicionController',
307 size: 'lg' 307 size: 'lg'
308 } 308 }
309 ); 309 );
310 modalInstance.result.then( 310 modalInstance.result.then(
311 function(precioCondicion) { 311 function(precioCondicion) {
312 var cabecera = ''; 312 var cabecera = '';
313 var plazosConcat = ''; 313 var plazosConcat = '';
314 if(!Array.isArray(precioCondicion)) { 314 if(!Array.isArray(precioCondicion)) {
315 $scope.plazosPagos = precioCondicion.plazoPago; 315 $scope.plazosPagos = precioCondicion.plazoPago;
316 idLista = precioCondicion.idListaPrecio; 316 idLista = precioCondicion.idListaPrecio;
317 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 317 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
318 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 318 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
319 } 319 }
320 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 320 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
321 } else { //Cuando se ingresan los plazos manualmente 321 } else { //Cuando se ingresan los plazos manualmente
322 idLista = -1; //-1, el modal productos busca todos los productos 322 idLista = -1; //-1, el modal productos busca todos los productos
323 $scope.plazosPagos = precioCondicion; 323 $scope.plazosPagos = precioCondicion;
324 for(var j = 0; j < precioCondicion.length; j++) { 324 for(var j = 0; j < precioCondicion.length; j++) {
325 plazosConcat += precioCondicion[j].dias + ' '; 325 plazosConcat += precioCondicion[j].dias + ' ';
326 } 326 }
327 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 327 cabecera = 'Ingreso manual ' + plazosConcat.trim();
328 } 328 }
329 $scope.articulosTabla = []; 329 $scope.articulosTabla = [];
330 addCabecera('Precios y condiciones:', cabecera); 330 addCabecera('Precios y condiciones:', cabecera);
331 }, function() { 331 }, function() {
332 332
333 } 333 }
334 ); 334 );
335 }; 335 };
336 336
337 $scope.abrirModalFlete = function() { 337 $scope.abrirModalFlete = function() {
338 var modalInstance = $uibModal.open( 338 var modalInstance = $uibModal.open(
339 { 339 {
340 ariaLabelledBy: 'Busqueda de Flete', 340 ariaLabelledBy: 'Busqueda de Flete',
341 templateUrl: 'modal-flete.html', 341 templateUrl: 'modal-flete.html',
342 controller: 'focaModalFleteController', 342 controller: 'focaModalFleteController',
343 size: 'lg', 343 size: 'lg',
344 resolve: { 344 resolve: {
345 parametrosFlete: 345 parametrosFlete:
346 function() { 346 function() {
347 return { 347 return {
348 flete: $scope.notaPedido.flete, 348 flete: $scope.notaPedido.flete,
349 bomba: $scope.notaPedido.bomba, 349 bomba: $scope.notaPedido.bomba,
350 kilometros: $scope.notaPedido.kilometros 350 kilometros: $scope.notaPedido.kilometros
351 }; 351 };
352 } 352 }
353 } 353 }
354 } 354 }
355 ); 355 );
356 modalInstance.result.then( 356 modalInstance.result.then(
357 function(datos) { 357 function(datos) {
358 $scope.notaPedido.flete = datos.flete; 358 $scope.notaPedido.flete = datos.flete;
359 $scope.notaPedido.bomba = datos.bomba; 359 $scope.notaPedido.bomba = datos.bomba;
360 $scope.notaPedido.kilometros = datos.kilometros; 360 $scope.notaPedido.kilometros = datos.kilometros;
361 361
362 addCabecera('Flete:', datos.flete); 362 addCabecera('Flete:', datos.flete);
363 if(datos.flete === 'si') { 363 if(datos.flete === 'si') {
364 addCabecera('Bomba:', datos.bomba); 364 addCabecera('Bomba:', datos.bomba);
365 addCabecera('Kilometros:', datos.kilometros); 365 addCabecera('Kilometros:', datos.kilometros);
366 } else { 366 } else {
367 removeCabecera('Bomba:'); 367 removeCabecera('Bomba:');
368 removeCabecera('Kilometros:'); 368 removeCabecera('Kilometros:');
369 } 369 }
370 }, function() { 370 }, function() {
371 371
372 } 372 }
373 ); 373 );
374 }; 374 };
375 375
376 $scope.abrirModalMoneda = function() { 376 $scope.abrirModalMoneda = function() {
377 var modalInstance = $uibModal.open( 377 var modalInstance = $uibModal.open(
378 { 378 {
379 ariaLabelledBy: 'Busqueda de Moneda', 379 ariaLabelledBy: 'Busqueda de Moneda',
380 templateUrl: 'modal-moneda.html', 380 templateUrl: 'modal-moneda.html',
381 controller: 'focaModalMonedaController', 381 controller: 'focaModalMonedaController',
382 size: 'lg' 382 size: 'lg'
383 } 383 }
384 ); 384 );
385 modalInstance.result.then( 385 modalInstance.result.then(
386 function(moneda) { 386 function(moneda) {
387 $scope.notaPedido.moneda = { 387 $scope.notaPedido.moneda = {
388 id: moneda.ID, 388 id: moneda.ID,
389 detalle: moneda.DETALLE, 389 detalle: moneda.DETALLE,
390 simbolo: moneda.SIMBOLO 390 simbolo: moneda.SIMBOLO
391 }; 391 };
392 392
393 addCabecera('Moneda:', moneda.DETALLE); 393 addCabecera('Moneda:', moneda.DETALLE);
394 $scope.abrirModalCotizacion(moneda.ID);
395 }, function() {
396
397 }
398 );
399 };
400
401 $scope.abrirModalCotizacion = function(idMoneda) {
402 var modalInstance = $uibModal.open(
403 {
404 ariaLabelledBy: 'Busqueda de Cotización',
405 templateUrl: 'modal-cotizacion.html',
406 controller: 'focaModalCotizacionController',
407 size: 'lg',
408 resolve: {idMoneda: function() {return idMoneda;}}
409 }
410 );
411 modalInstance.result.then(
412 function(cotizacion) {
413 $scope.notaPedido.cotizacion = {
414 id: cotizacion.ID,
415 cotizacion: cotizacion.COTIZACION
416 };
417
418 addCabecera(
419 'Fecha cotizacion:',
420 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
421 );
422 addCabecera('Cotizacion:', cotizacion.COTIZACION);
394 }, function() { 423 }, function() {
395 424
396 } 425 }
397 ); 426 );
398 }; 427 };
399 428
400 $scope.agregarATabla = function(key) { 429 $scope.agregarATabla = function(key) {
401 if(key === 13) { 430 if(key === 13) {
402 if($scope.articuloACargar.cantidad === undefined || 431 if($scope.articuloACargar.cantidad === undefined ||
403 $scope.articuloACargar.cantidad === 0 || 432 $scope.articuloACargar.cantidad === 0 ||
404 $scope.articuloACargar.cantidad === null ){ 433 $scope.articuloACargar.cantidad === null ){
405 focaModalService.alert('El valor debe ser al menos 1'); 434 focaModalService.alert('El valor debe ser al menos 1');
406 return; 435 return;
407 } 436 }
408 delete $scope.articuloACargar.sectorCodigo; 437 delete $scope.articuloACargar.sectorCodigo;
409 $scope.articulosTabla.push($scope.articuloACargar); 438 $scope.articulosTabla.push($scope.articuloACargar);
410 $scope.cargando = true; 439 $scope.cargando = true;
411 } 440 }
412 }; 441 };
413 442
414 $scope.quitarArticulo = function(key) { 443 $scope.quitarArticulo = function(key) {
415 $scope.articulosTabla.splice(key, 1); 444 $scope.articulosTabla.splice(key, 1);
416 }; 445 };
417 446
418 $scope.editarArticulo = function(key, articulo) { 447 $scope.editarArticulo = function(key, articulo) {
419 if(key === 13) { 448 if(key === 13) {
420 if(articulo.cantidad === null || articulo.cantidad === 0 || 449 if(articulo.cantidad === null || articulo.cantidad === 0 ||
421 articulo.cantidad === undefined){ 450 articulo.cantidad === undefined){
422 focaModalService.alert('El valor debe ser al menos 1'); 451 focaModalService.alert('El valor debe ser al menos 1');
423 return; 452 return;
424 } 453 }
425 articulo.edit = false; 454 articulo.edit = false;
426 } 455 }
427 }; 456 };
428 457
429 $scope.cambioEdit = function(articulo) { 458 $scope.cambioEdit = function(articulo) {
430 articulo.edit = true; 459 articulo.edit = true;
431 }; 460 };
432 461
433 $scope.limpiarFlete = function() { 462 $scope.limpiarFlete = function() {
434 $scope.notaPedido.fleteNombre = ''; 463 $scope.notaPedido.fleteNombre = '';
435 $scope.notaPedido.chofer = ''; 464 $scope.notaPedido.chofer = '';
436 $scope.notaPedido.vehiculo = ''; 465 $scope.notaPedido.vehiculo = '';
437 $scope.notaPedido.kilometros = ''; 466 $scope.notaPedido.kilometros = '';
438 $scope.notaPedido.costoUnitarioKmFlete = ''; 467 $scope.notaPedido.costoUnitarioKmFlete = '';
439 $scope.choferes = ''; 468 $scope.choferes = '';
440 $scope.vehiculos = ''; 469 $scope.vehiculos = '';
441 }; 470 };
442 471
443 $scope.limpiarPantalla = function() { 472 $scope.limpiarPantalla = function() {
444 $scope.limpiarFlete(); 473 $scope.limpiarFlete();
445 $scope.notaPedido.flete = '0'; 474 $scope.notaPedido.flete = '0';
446 $scope.notaPedido.bomba = '0'; 475 $scope.notaPedido.bomba = '0';
447 $scope.notaPedido.precioCondicion = ''; 476 $scope.notaPedido.precioCondicion = '';
448 $scope.articulosTabla = []; 477 $scope.articulosTabla = [];
449 $scope.notaPedido.vendedor.nombre = ''; 478 $scope.notaPedido.vendedor.nombre = '';
450 $scope.notaPedido.cliente = {nombre: ''}; 479 $scope.notaPedido.cliente = {nombre: ''};
451 $scope.notaPedido.domicilio = {dom: ''}; 480 $scope.notaPedido.domicilio = {dom: ''};
452 $scope.domiciliosCliente = []; 481 $scope.domiciliosCliente = [];
453 }; 482 };
454 483
455 $scope.resetFilter = function() { 484 $scope.resetFilter = function() {
456 $scope.articuloACargar = {}; 485 $scope.articuloACargar = {};
457 $scope.cargando = true; 486 $scope.cargando = true;
458 }; 487 };
459 488
460 $scope.selectFocus = function($event) { 489 $scope.selectFocus = function($event) {
461 $event.target.select(); 490 $event.target.select();
462 }; 491 };
463 492
464 $scope.salir = function() { 493 $scope.salir = function() {
465 $location.path('/'); 494 $location.path('/');
466 }; 495 };
467 496
468 function addCabecera(label, valor) { 497 function addCabecera(label, valor) {
469 var propiedad = $filter('filter')($scope.cabecera, {label: label}); 498 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
470 if(propiedad.length === 1) { 499 if(propiedad.length === 1) {
471 propiedad[0].valor = valor; 500 propiedad[0].valor = valor;
472 } else { 501 } else {
473 $scope.cabecera.push({label: label, valor: valor}); 502 $scope.cabecera.push({label: label, valor: valor});
474 } 503 }
475 } 504 }
476 505
477 function removeCabecera(label) { 506 function removeCabecera(label) {
478 var propiedad = $filter('filter')($scope.cabecera, {label: label}); 507 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
479 if(propiedad.length === 1){ 508 if(propiedad.length === 1){
480 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 509 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
481 } 510 }
482 } 511 }
483 } 512 }
484 ] 513 ]
485 ) 514 )
486 .controller('notaPedidoListaCtrl', [ 515 .controller('notaPedidoListaCtrl', [
487 '$scope', 516 '$scope',
488 'crearNotaPedidoService', 517 'crearNotaPedidoService',
489 '$location', 518 '$location',
490 function($scope, crearNotaPedidoService, $location) { 519 function($scope, crearNotaPedidoService, $location) {
491 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 520 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
492 $scope.notaPedidos = datos.data; 521 $scope.notaPedidos = datos.data;
493 }); 522 });
494 $scope.editar = function(notaPedido) { 523 $scope.editar = function(notaPedido) {
495 crearNotaPedidoService.setNotaPedido(notaPedido); 524 crearNotaPedidoService.setNotaPedido(notaPedido);
496 $location.path('/venta-nota-pedido/abm/'); 525 $location.path('/venta-nota-pedido/abm/');
497 }; 526 };
498 $scope.crearPedido = function() { 527 $scope.crearPedido = function() {
499 crearNotaPedidoService.clearNotaPedido(); 528 crearNotaPedidoService.clearNotaPedido();
500 $location.path('/venta-nota-pedido/abm/'); 529 $location.path('/venta-nota-pedido/abm/');
501 }; 530 };
502 } 531 }
503 ]) 532 ])
504 .controller('focaCrearNotaPedidoFichaClienteController', [ 533 .controller('focaCrearNotaPedidoFichaClienteController', [
505 '$scope', 534 '$scope',
506 'crearNotaPedidoService', 535 'crearNotaPedidoService',
507 '$location', 536 '$location',
508 function($scope, crearNotaPedidoService, $location) { 537 function($scope, crearNotaPedidoService, $location) {
509 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 538 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
510 $scope.notaPedidos = datos.data; 539 $scope.notaPedidos = datos.data;
511 }); 540 });
512 $scope.editar = function(notaPedido) { 541 $scope.editar = function(notaPedido) {
513 crearNotaPedidoService.setNotaPedido(notaPedido); 542 crearNotaPedidoService.setNotaPedido(notaPedido);
514 $location.path('/venta-nota-pedido/abm/'); 543 $location.path('/venta-nota-pedido/abm/');
515 }; 544 };
516 $scope.crearPedido = function() { 545 $scope.crearPedido = function() {
517 crearNotaPedidoService.clearNotaPedido(); 546 crearNotaPedidoService.clearNotaPedido();
518 $location.path('/venta-nota-pedido/abm/'); 547 $location.path('/venta-nota-pedido/abm/');
519 }; 548 };
520 } 549 }
521 ]); 550 ]);
522 551
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-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> 11 <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div>
12 <div class="col-6 col-sm-4 text-right crear-nota-pedido-fecha"> 12 <div class="col-6 col-sm-4 text-right crear-nota-pedido-fecha">
13 Fecha: 13 Fecha:
14 <span 14 <span
15 ng-show="!datepickerAbierto" 15 ng-show="!datepickerAbierto"
16 ng-bind="now | date:'dd/MM/yyyy HH:mm'" 16 ng-bind="now | date:'dd/MM/yyyy HH:mm'"
17 ng-click="datepickerAbierto = true" 17 ng-click="datepickerAbierto = true"
18 > 18 >
19 </span> 19 </span>
20 <input 20 <input
21 ng-show="datepickerAbierto" 21 ng-show="datepickerAbierto"
22 type="date" 22 type="date"
23 ng-model="now" 23 ng-model="now"
24 ng-change="datepickerAbierto = false" 24 ng-change="datepickerAbierto = false"
25 ng-blur="datepickerAbierto = false" 25 ng-blur="datepickerAbierto = false"
26 class="form-control form-control-sm col-8 float-right" 26 class="form-control form-control-sm col-8 float-right"
27 foca-focus="datepickerAbierto" 27 foca-focus="datepickerAbierto"
28 hasta-hoy
28 /> 29 />
29 </div> 30 </div>
30 </div> 31 </div>
31 <div class="row"> 32 <div class="row">
32 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 33 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
33 <span class="label" ng-bind="cab.label"></span> 34 <span class="label" ng-bind="cab.label"></span>
34 <span class="valor" ng-bind="cab.valor"></span> 35 <span class="valor" ng-bind="cab.valor"></span>
35 </div> 36 </div>
36 <a 37 <a
37 class="btn col-12 btn-secondary d-sm-none" 38 class="btn col-12 btn-secondary d-sm-none"
38 ng-show="cabecera.length > 0" 39 ng-show="cabecera.length > 0"
39 ng-click="showCabecera = !showCabecera" 40 ng-click="showCabecera = !showCabecera"
40 > 41 >
41 <i 42 <i
42 class="fa fa-chevron-down" 43 class="fa fa-chevron-down"
43 ng-hide="showCabecera" 44 ng-hide="showCabecera"
44 aria-hidden="true" 45 aria-hidden="true"
45 > 46 >
46 </i> 47 </i>
47 <i 48 <i
48 class="fa fa-chevron-up" 49 class="fa fa-chevron-up"
49 ng-show="showCabecera" 50 ng-show="showCabecera"
50 aria-hidden="true"> 51 aria-hidden="true">
51 </i> 52 </i>
52 </a> 53 </a>
53 </div> 54 </div>
54 </div> 55 </div>
55 </div> 56 </div>
56 <div class="row p-1 botonera-secundaria"> 57 <div class="row p-1 botonera-secundaria">
57 <div class="col-12"> 58 <div class="col-12">
58 <div class="row"> 59 <div class="row">
59 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> 60 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
60 <button 61 <button
61 type="button" 62 type="button"
62 class="btn btn-default btn-block btn-xs text-left py-2" 63 class="btn btn-default btn-block btn-xs text-left py-2"
63 ng-click="boton.accion()" 64 ng-click="boton.accion()"
64 ng-class="{'d-none d-sm-block': boton.texto == ''}" 65 ng-class="{'d-none d-sm-block': boton.texto == ''}"
65 > 66 >
66 <i 67 <i
67 class="fa fa-arrow-circle-right" 68 class="fa fa-arrow-circle-right"
68 ng-show="boton.texto != ''" 69 ng-show="boton.texto != ''"
69 ></i> 70 ></i>
70 &nbsp; 71 &nbsp;
71 {{boton.texto}} 72 {{boton.texto}}
72 </button> 73 </button>
73 </div> 74 </div>
74 </div> 75 </div>
75 </div> 76 </div>
76 </div> 77 </div>
77 </div> 78 </div>
78 </div> 79 </div>
79 </form> 80 </form>
80 <div class="row"> 81 <div class="row">
81 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 82 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
82 <!-- PC --> 83 <!-- PC -->
83 <div class="row grilla-articulo align-items-end"> 84 <div class="row grilla-articulo align-items-end">
84 <table class="table tabla-articulo table-striped table-sm table-dark mb-0"> 85 <table class="table tabla-articulo table-striped table-sm table-dark mb-0">
85 <thead> 86 <thead>
86 <tr class="d-flex"> 87 <tr class="d-flex">
87 <th class="">#</th> 88 <th class="">#</th>
88 <th class="col">Código</th> 89 <th class="col">Código</th>
89 <th class="col-4">Descripción</th> 90 <th class="col-4">Descripción</th>
90 <th class="col text-right">Cantidad</th> 91 <th class="col text-right">Cantidad</th>
91 <th class="col text-right">Precio Unitario</th> 92 <th class="col text-right">Precio Unitario</th>
92 <th class="col text-right">SubTotal</th> 93 <th class="col text-right">SubTotal</th>
93 <th class="text-right"> 94 <th class="text-right">
94 <button 95 <button
95 class="btn btn-outline-secondary selectable" 96 class="btn btn-outline-secondary selectable"
96 ng-click="show = !show; masMenos()" 97 ng-click="show = !show; masMenos()"
97 > 98 >
98 <i 99 <i
99 class="fa fa-chevron-down" 100 class="fa fa-chevron-down"
100 ng-show="show" 101 ng-show="show"
101 aria-hidden="true" 102 aria-hidden="true"
102 > 103 >
103 </i> 104 </i>
104 <i 105 <i
105 class="fa fa-chevron-up" 106 class="fa fa-chevron-up"
106 ng-hide="show" 107 ng-hide="show"
107 aria-hidden="true"> 108 aria-hidden="true">
108 </i> 109 </i>
109 </button> 110 </button>
110 </th> 111 </th>
111 </tr> 112 </tr>
112 </thead> 113 </thead>
113 <tbody class="tabla-articulo-body"> 114 <tbody class="tabla-articulo-body">
114 <tr 115 <tr
115 ng-repeat="(key, articulo) in articulosTabla" 116 ng-repeat="(key, articulo) in articulosTabla"
116 ng-show="show || key == (articulosTabla.length - 1)" 117 ng-show="show || key == (articulosTabla.length - 1)"
117 class="d-flex" 118 class="d-flex"
118 > 119 >
119 <td ng-bind="key + 1"></td> 120 <td ng-bind="key + 1"></td>
120 <td 121 <td
121 class="col" 122 class="col"
122 ng-bind="articulo.sector + '-' + articulo.codigo" 123 ng-bind="articulo.sector + '-' + articulo.codigo"
123 ></td> 124 ></td>
124 <td 125 <td
125 class="col-4" 126 class="col-4"
126 ng-bind="articulo.descripcion" 127 ng-bind="articulo.descripcion"
127 ></td> 128 ></td>
128 <td class="col text-right"> 129 <td class="col text-right">
129 <input 130 <input
130 ng-show="articulo.edit" 131 ng-show="articulo.edit"
131 ng-model="articulo.cantidad" 132 ng-model="articulo.cantidad"
132 class="form-control" 133 class="form-control"
133 type="number" 134 type="number"
134 min="1" 135 min="1"
135 foca-focus="articulo.edit" 136 foca-focus="articulo.edit"
136 ng-keypress="editarArticulo($event.keyCode, articulo)" 137 ng-keypress="editarArticulo($event.keyCode, articulo)"
137 ng-focus="selectFocus($event)" 138 ng-focus="selectFocus($event)"
138 > 139 >
139 <i 140 <i
140 class="selectable" 141 class="selectable"
141 ng-click="cambioEdit(articulo)" 142 ng-click="cambioEdit(articulo)"
142 ng-hide="articulo.edit" 143 ng-hide="articulo.edit"
143 ng-bind="articulo.cantidad"> 144 ng-bind="articulo.cantidad">
144 </i> 145 </i>
145 </td> 146 </td>
146 <td 147 <td
147 class="col text-right" 148 class="col text-right"
148 ng-bind="articulo.precio | currency: '$'" 149 ng-bind="articulo.precio | currency: '$'"
149 ></td> 150 ></td>
150 <td 151 <td
151 class="col text-right" 152 class="col text-right"
152 ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> 153 ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'">
153 </td> 154 </td>
154 <td class="text-center"> 155 <td class="text-center">
155 <button 156 <button
156 class="btn btn-outline-secondary" 157 class="btn btn-outline-secondary"
157 ng-click="quitarArticulo(key)" 158 ng-click="quitarArticulo(key)"
158 > 159 >
159 <i class="fa fa-trash"></i> 160 <i class="fa fa-trash"></i>
160 </button> 161 </button>
161 </td> 162 </td>
162 </tr> 163 </tr>
163 </tbody> 164 </tbody>
164 <tfoot> 165 <tfoot>
165 <tr ng-show="!cargando" class="d-flex"> 166 <tr ng-show="!cargando" class="d-flex">
166 <td 167 <td
167 class="align-middle" 168 class="align-middle"
168 ng-bind="articulosTabla.length + 1" 169 ng-bind="articulosTabla.length + 1"
169 ></td> 170 ></td>
170 <td class="col"> 171 <td class="col">
171 <input 172 <input
172 class="form-control" 173 class="form-control"
173 ng-model="articuloACargar.sectorCodigo" 174 ng-model="articuloACargar.sectorCodigo"
174 readonly 175 readonly
175 > 176 >
176 </td> 177 </td>
177 <td class="col-4 tabla-articulo-descripcion"> 178 <td class="col-4 tabla-articulo-descripcion">
178 <input 179 <input
179 class="form-control" 180 class="form-control"
180 ng-model="articuloACargar.descripcion" 181 ng-model="articuloACargar.descripcion"
181 readonly 182 readonly
182 > 183 >
183 </td> 184 </td>
184 <td class="col text-right"> 185 <td class="col text-right">
185 <input 186 <input
186 class="form-control" 187 class="form-control"
187 type="number" 188 type="number"
188 min="1" 189 min="1"
189 ng-model="articuloACargar.cantidad" 190 ng-model="articuloACargar.cantidad"
190 foca-focus="!cargando" 191 foca-focus="!cargando"
191 esc-key="resetFilter()" 192 esc-key="resetFilter()"
192 ng-keypress="agregarATabla($event.keyCode)" 193 ng-keypress="agregarATabla($event.keyCode)"
193 > 194 >
194 </td> 195 </td>
195 <td class="col text-right"> 196 <td class="col text-right">
196 <input 197 <input
197 class="form-control" 198 class="form-control"
198 ng-value="articuloACargar.precio | currency: '$'" 199 ng-value="articuloACargar.precio | currency: '$'"
199 readonly 200 readonly
200 > 201 >
201 </td> 202 </td>
202 <td class="col text-right"> 203 <td class="col text-right">
203 <input 204 <input
204 class="form-control" 205 class="form-control"
205 ng-value="getSubTotal() | currency: '$'" 206 ng-value="getSubTotal() | currency: '$'"
206 readonly 207 readonly
207 ></td> 208 ></td>
208 <td class="text-center align-middle"> 209 <td class="text-center align-middle">
209 <button 210 <button
210 class="btn btn-outline-secondary" 211 class="btn btn-outline-secondary"
211 ng-click="agregarATabla(13)" 212 ng-click="agregarATabla(13)"
212 > 213 >
213 <i class="fa fa-save"></i> 214 <i class="fa fa-save"></i>
214 </button> 215 </button>
215 </td> 216 </td>
216 </tr> 217 </tr>
217 <tr ng-show="cargando" class="d-flex"> 218 <tr ng-show="cargando" class="d-flex">
218 <td colspan="7" class="col-12"> 219 <td colspan="7" class="col-12">
219 <input 220 <input
220 placeholder="Seleccione Articulo" 221 placeholder="Seleccione Articulo"
221 class="form-control form-control-sm" 222 class="form-control form-control-sm"
222 readonly 223 readonly
223 ng-click="seleccionarArticulo()" 224 ng-click="seleccionarArticulo()"
224 /> 225 />
225 </td> 226 </td>
226 </tr> 227 </tr>
227 <tr class="d-flex"> 228 <tr class="d-flex">
228 <td colspan="4"> 229 <td colspan="4">
229 <strong>Cantidad Items:</strong> 230 <strong>Cantidad Items:</strong>
230 <a ng-bind="articulosTabla.length"></a> 231 <a ng-bind="articulosTabla.length"></a>
231 </td> 232 </td>
232 <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> 233 <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td>
233 <td class="table-celda-total text-right" colspan="1"> 234 <td class="table-celda-total text-right" colspan="1">
234 <h3>{{getTotal() | currency: '$'}}</h3> 235 <h3>{{getTotal() | currency: '$'}}</h3>
235 </td> 236 </td>
236 <td class="text-right"> 237 <td class="text-right">
237 <button 238 <button
238 type="button" 239 type="button"
239 class="btn btn-default btn-sm" 240 class="btn btn-default btn-sm"
240 > 241 >
241 Totales 242 Totales
242 </button> 243 </button>
243 </td> 244 </td>
244 </tr> 245 </tr>
245 </tfoot> 246 </tfoot>
246 </table> 247 </table>
247 </div> 248 </div>
248 </div> 249 </div>
249 <div class="col-auto my-2 col-lg-2 botonera-lateral"> 250 <div class="col-auto my-2 col-lg-2 botonera-lateral">
250 <div class="row align-items-end"> 251 <div class="row align-items-end">
251 <div class="col-12"> 252 <div class="col-12">
252 <button 253 <button
253 ng-click="crearNotaPedido()" 254 ng-click="crearNotaPedido()"
254 type="submit" 255 type="submit"
255 title="Crear nota pedido" 256 title="Crear nota pedido"
256 class="btn btn-default btn-block mb-2"> 257 class="btn btn-default btn-block mb-2">
257 Guardar 258 Guardar
258 </button> 259 </button>
259 <button 260 <button
260 ng-click="salir()" 261 ng-click="salir()"
261 type="button" 262 type="button"
262 title="Salir" 263 title="Salir"
263 class="btn btn-default btn-block"> 264 class="btn btn-default btn-block">
264 Salir 265 Salir
265 </button> 266 </button>
266 </div> 267 </div>
267 </div> 268 </div>
268 </div> 269 </div>
269 </div> 270 </div>
270 </div> 271 </div>
271 272