Commit 325728c231f3e66d3c1e5800d56a7a070a8c4d3d

Authored by Jose Pinto
1 parent 1948c4bd4c
Exists in master

agrego foca-cabecera-facturador

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