Commit 96b4db7dfabc9c7ab2479e83f40a5588b412912e

Authored by Jose Pinto
1 parent 199149c13b
Exists in master

selectFocus cuando teclado esta desactivado

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