Commit 6957bd2d58956499fab018e2f46d0f4d6173ae44

Authored by Nicolás Guarnieri
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

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