Commit 8682c021b12a8e530255c777f1761fbaef28e99b

Authored by Eric Fernandez
1 parent 60fba4e85e
Exists in master

filter number a datos numericos, oculto pesos argentinos en cabecera

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