Commit 08cafb03f03deb8bd920b16788a7f54722252c0f

Authored by Eric Fernandez
Exists in master

Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido

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