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