Commit 1b34bf554edc31e85819ea1a2b807b05ce36e997

Authored by Eric Fernandez
1 parent ba93008bf5
Exists in master

fix moneda calcular precio

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