Commit a03597111ebea129393c6fc72bfe9d2fb676f81a
1 parent
6f8b91c018
Exists in
master
resolve transportista para modal proveedores
Showing
2 changed files
with
7 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', |
4 | 'focaModalService', 'remitoBusinessService', | 4 | 'focaModalService', 'remitoBusinessService', |
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 | vendedor: {}, | 31 | vendedor: {}, |
32 | cliente: {}, | 32 | cliente: {}, |
33 | proveedor: {}, | 33 | proveedor: {}, |
34 | domicilio: {dom: ''}, | 34 | domicilio: {dom: ''}, |
35 | moneda: {}, | 35 | moneda: {}, |
36 | cotizacion: {} | 36 | cotizacion: {} |
37 | }; | 37 | }; |
38 | var monedaPorDefecto; | 38 | var monedaPorDefecto; |
39 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 39 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
40 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 40 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
41 | monedaPorDefecto = { | 41 | monedaPorDefecto = { |
42 | id: res.data[0].ID, | 42 | id: res.data[0].ID, |
43 | detalle: res.data[0].DETALLE, | 43 | detalle: res.data[0].DETALLE, |
44 | simbolo: res.data[0].SIMBOLO, | 44 | simbolo: res.data[0].SIMBOLO, |
45 | cotizaciones: res.data[0].cotizaciones | 45 | cotizaciones: res.data[0].cotizaciones |
46 | }; | 46 | }; |
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 = Math.round(Math.random() * 10000); | 59 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
60 | $scope.comprobante = Math.round(Math.random() * 1000000); | 60 | $scope.comprobante = Math.round(Math.random() * 1000000); |
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.numeroNotaPedido, 8); | 76 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 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 | resolve: { | 90 | resolve: { |
91 | parametroNotaPedido: { | 91 | parametroNotaPedido: { |
92 | idLista: $scope.idLista, | 92 | idLista: $scope.idLista, |
93 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 93 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
94 | simbolo: $scope.remito.moneda.simbolo | 94 | simbolo: $scope.remito.moneda.simbolo |
95 | } | 95 | } |
96 | }, | 96 | }, |
97 | size: 'lg' | 97 | size: 'lg' |
98 | } | 98 | } |
99 | ); | 99 | ); |
100 | modalInstance.result.then( | 100 | modalInstance.result.then( |
101 | function(producto) { | 101 | function(producto) { |
102 | var newArt = | 102 | var newArt = |
103 | { | 103 | { |
104 | id: 0, | 104 | id: 0, |
105 | codigo: producto.codigo, | 105 | codigo: producto.codigo, |
106 | sector: producto.sector, | 106 | sector: producto.sector, |
107 | sectorCodigo: producto.sector + '-' + producto.codigo, | 107 | sectorCodigo: producto.sector + '-' + producto.codigo, |
108 | descripcion: producto.descripcion, | 108 | descripcion: producto.descripcion, |
109 | item: $scope.articulosTabla.length + 1, | 109 | item: $scope.articulosTabla.length + 1, |
110 | nombre: producto.descripcion, | 110 | nombre: producto.descripcion, |
111 | precio: parseFloat(producto.precio.toFixed(4)), | 111 | precio: parseFloat(producto.precio.toFixed(4)), |
112 | costoUnitario: producto.costo, | 112 | costoUnitario: producto.costo, |
113 | editCantidad: false, | 113 | editCantidad: false, |
114 | editPrecio: false | 114 | editPrecio: false |
115 | }; | 115 | }; |
116 | $scope.articuloACargar = newArt; | 116 | $scope.articuloACargar = newArt; |
117 | $scope.cargando = false; | 117 | $scope.cargando = false; |
118 | }, function() { | 118 | }, function() { |
119 | // funcion ejecutada cuando se cancela el modal | 119 | // funcion ejecutada cuando se cancela el modal |
120 | } | 120 | } |
121 | ); | 121 | ); |
122 | }; | 122 | }; |
123 | 123 | ||
124 | $scope.seleccionarRemito = function() { | 124 | $scope.seleccionarRemito = function() { |
125 | var modalInstance = $uibModal.open( | 125 | var modalInstance = $uibModal.open( |
126 | { | 126 | { |
127 | ariaLabelledBy: 'Busqueda de Remito', | 127 | ariaLabelledBy: 'Busqueda de Remito', |
128 | templateUrl: 'foca-modal-remito.html', | 128 | templateUrl: 'foca-modal-remito.html', |
129 | controller: 'focaModalRemitoController', | 129 | controller: 'focaModalRemitoController', |
130 | resolve: { | 130 | resolve: { |
131 | parametroRemito: { | 131 | parametroRemito: { |
132 | idLista: $scope.idLista, | 132 | idLista: $scope.idLista, |
133 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 133 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
134 | simbolo: $scope.remito.moneda.simbolo | 134 | simbolo: $scope.remito.moneda.simbolo |
135 | } | 135 | } |
136 | }, | 136 | }, |
137 | size: 'lg' | 137 | size: 'lg' |
138 | } | 138 | } |
139 | ); | 139 | ); |
140 | modalInstance.result.then( | 140 | modalInstance.result.then( |
141 | function(producto) { | 141 | function(producto) { |
142 | var newArt = | 142 | var newArt = |
143 | { | 143 | { |
144 | id: 0, | 144 | id: 0, |
145 | codigo: producto.codigo, | 145 | codigo: producto.codigo, |
146 | sector: producto.sector, | 146 | sector: producto.sector, |
147 | sectorCodigo: producto.sector + '-' + producto.codigo, | 147 | sectorCodigo: producto.sector + '-' + producto.codigo, |
148 | descripcion: producto.descripcion, | 148 | descripcion: producto.descripcion, |
149 | item: $scope.articulosTabla.length + 1, | 149 | item: $scope.articulosTabla.length + 1, |
150 | nombre: producto.descripcion, | 150 | nombre: producto.descripcion, |
151 | precio: parseFloat(producto.precio.toFixed(4)), | 151 | precio: parseFloat(producto.precio.toFixed(4)), |
152 | costoUnitario: producto.costo, | 152 | costoUnitario: producto.costo, |
153 | editCantidad: false, | 153 | editCantidad: false, |
154 | editPrecio: false | 154 | editPrecio: false |
155 | }; | 155 | }; |
156 | $scope.articuloACargar = newArt; | 156 | $scope.articuloACargar = newArt; |
157 | $scope.cargando = false; | 157 | $scope.cargando = false; |
158 | }, function() { | 158 | }, function() { |
159 | // funcion ejecutada cuando se cancela el modal | 159 | // funcion ejecutada cuando se cancela el modal |
160 | } | 160 | } |
161 | ); | 161 | ); |
162 | }; | 162 | }; |
163 | 163 | ||
164 | //La pantalla solo se usa para cargar remitos | 164 | //La pantalla solo se usa para cargar remitos |
165 | // if (remitoTemp !== undefined) { | 165 | // if (remitoTemp !== undefined) { |
166 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 166 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
167 | // $scope.remito = remitoTemp; | 167 | // $scope.remito = remitoTemp; |
168 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 168 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
169 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 169 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
170 | // $scope.idLista = $scope.remito.precioCondicion; | 170 | // $scope.idLista = $scope.remito.precioCondicion; |
171 | // crearRemitoService | 171 | // crearRemitoService |
172 | // .getArticulosByIdRemito($scope.remito.id).then( | 172 | // .getArticulosByIdRemito($scope.remito.id).then( |
173 | // function(res) { | 173 | // function(res) { |
174 | // $scope.articulosTabla = res.data; | 174 | // $scope.articulosTabla = res.data; |
175 | // } | 175 | // } |
176 | // ); | 176 | // ); |
177 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 177 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
178 | //(NO REQUERIDO EN ESTA VERSION) | 178 | //(NO REQUERIDO EN ESTA VERSION) |
179 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 179 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
180 | // function(res) { | 180 | // function(res) { |
181 | // $scope.remito.domicilio = res.data; | 181 | // $scope.remito.domicilio = res.data; |
182 | // } | 182 | // } |
183 | // ); | 183 | // ); |
184 | // } else { | 184 | // } else { |
185 | // $scope.remito.fechaCarga = new Date(); | 185 | // $scope.remito.fechaCarga = new Date(); |
186 | // $scope.remito.bomba = '0'; | 186 | // $scope.remito.bomba = '0'; |
187 | // $scope.remito.flete = '0'; | 187 | // $scope.remito.flete = '0'; |
188 | // $scope.idLista = undefined; | 188 | // $scope.idLista = undefined; |
189 | // } | 189 | // } |
190 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 190 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
191 | // $scope.addNewDom = function() { | 191 | // $scope.addNewDom = function() { |
192 | // $scope.remito.domicilio.push({ 'id': 0 }); | 192 | // $scope.remito.domicilio.push({ 'id': 0 }); |
193 | // }; | 193 | // }; |
194 | // $scope.removeNewChoice = function(choice) { | 194 | // $scope.removeNewChoice = function(choice) { |
195 | // if ($scope.remito.domicilio.length > 1) { | 195 | // if ($scope.remito.domicilio.length > 1) { |
196 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 196 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
197 | // function(c) { | 197 | // function(c) { |
198 | // return c.$$hashKey === choice.$$hashKey; | 198 | // return c.$$hashKey === choice.$$hashKey; |
199 | // } | 199 | // } |
200 | // ), 1); | 200 | // ), 1); |
201 | // } | 201 | // } |
202 | // }; | 202 | // }; |
203 | 203 | ||
204 | $scope.crearRemito = function() { | 204 | $scope.crearRemito = function() { |
205 | if(!$scope.remito.vendedor.codigo) { | 205 | if(!$scope.remito.vendedor.codigo) { |
206 | focaModalService.alert('Ingrese Vendedor'); | 206 | focaModalService.alert('Ingrese Vendedor'); |
207 | return; | 207 | return; |
208 | } else if(!$scope.remito.cliente.cod) { | 208 | } else if(!$scope.remito.cliente.cod) { |
209 | focaModalService.alert('Ingrese Cliente'); | 209 | focaModalService.alert('Ingrese Cliente'); |
210 | return; | 210 | return; |
211 | } else if(!$scope.remito.proveedor.codigo) { | 211 | } else if(!$scope.remito.proveedor.codigo) { |
212 | focaModalService.alert('Ingrese Proveedor'); | 212 | focaModalService.alert('Ingrese Proveedor'); |
213 | return; | 213 | return; |
214 | } else if(!$scope.remito.moneda.id) { | 214 | } else if(!$scope.remito.moneda.id) { |
215 | focaModalService.alert('Ingrese Moneda'); | 215 | focaModalService.alert('Ingrese Moneda'); |
216 | return; | 216 | return; |
217 | } else if(!$scope.remito.cotizacion.ID) { | 217 | } else if(!$scope.remito.cotizacion.ID) { |
218 | focaModalService.alert('Ingrese Cotización'); | 218 | focaModalService.alert('Ingrese Cotización'); |
219 | return; | 219 | return; |
220 | } else if(!$scope.plazosPagos) { | 220 | } else if(!$scope.plazosPagos) { |
221 | focaModalService.alert('Ingrese Precios y Condiciones'); | 221 | focaModalService.alert('Ingrese Precios y Condiciones'); |
222 | return; | 222 | return; |
223 | } else if( | 223 | } else if( |
224 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 224 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
225 | { | 225 | { |
226 | focaModalService.alert('Ingrese Flete'); | 226 | focaModalService.alert('Ingrese Flete'); |
227 | return; | 227 | return; |
228 | } else if(!$scope.remito.domicilio.id) { | 228 | } else if(!$scope.remito.domicilio.id) { |
229 | focaModalService.alert('Ingrese Domicilio'); | 229 | focaModalService.alert('Ingrese Domicilio'); |
230 | return; | 230 | return; |
231 | } else if($scope.articulosTabla.length === 0) { | 231 | } else if($scope.articulosTabla.length === 0) { |
232 | focaModalService.alert('Debe cargar al menos un articulo'); | 232 | focaModalService.alert('Debe cargar al menos un articulo'); |
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | var date = new Date(); | 235 | var date = new Date(); |
236 | var remito = { | 236 | var remito = { |
237 | id: 0, | 237 | id: 0, |
238 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 238 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
239 | .toISOString().slice(0, 19).replace('T', ' '), | 239 | .toISOString().slice(0, 19).replace('T', ' '), |
240 | idVendedor: $scope.remito.vendedor.codigo, | 240 | idVendedor: $scope.remito.vendedor.codigo, |
241 | idCliente: $scope.remito.cliente.cod, | 241 | idCliente: $scope.remito.cliente.cod, |
242 | nombreCliente: $scope.remito.cliente.nom, | 242 | nombreCliente: $scope.remito.cliente.nom, |
243 | cuitCliente: $scope.remito.cliente.cuit, | 243 | cuitCliente: $scope.remito.cliente.cuit, |
244 | idProveedor: $scope.remito.proveedor.codigo, | 244 | idProveedor: $scope.remito.proveedor.codigo, |
245 | idDomicilio: $scope.remito.domicilio.id, | 245 | idDomicilio: $scope.remito.domicilio.id, |
246 | idCotizacion: $scope.remito.cotizacion.ID, | 246 | idCotizacion: $scope.remito.cotizacion.ID, |
247 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 247 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
248 | flete: $scope.remito.flete, | 248 | flete: $scope.remito.flete, |
249 | fob: $scope.remito.fob, | 249 | fob: $scope.remito.fob, |
250 | bomba: $scope.remito.bomba, | 250 | bomba: $scope.remito.bomba, |
251 | kilometros: $scope.remito.kilometros, | 251 | kilometros: $scope.remito.kilometros, |
252 | estado: 0, | 252 | estado: 0, |
253 | total: $scope.getTotal() | 253 | total: $scope.getTotal() |
254 | }; | 254 | }; |
255 | crearRemitoService.crearRemito(remito).then( | 255 | crearRemitoService.crearRemito(remito).then( |
256 | function(data) { | 256 | function(data) { |
257 | remitoBusinessService.addArticulos($scope.articulosTabla, | 257 | remitoBusinessService.addArticulos($scope.articulosTabla, |
258 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 258 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
259 | var plazos = $scope.plazosPagos; | 259 | var plazos = $scope.plazosPagos; |
260 | for(var j = 0; j < plazos.length; j++) { | 260 | for(var j = 0; j < plazos.length; j++) { |
261 | var json = { | 261 | var json = { |
262 | idRemito: data.data.id, | 262 | idRemito: data.data.id, |
263 | dias: plazos[j].dias | 263 | dias: plazos[j].dias |
264 | }; | 264 | }; |
265 | crearRemitoService.crearPlazosParaRemito(json); | 265 | crearRemitoService.crearPlazosParaRemito(json); |
266 | } | 266 | } |
267 | remitoBusinessService.addEstado(data.data.id, | 267 | remitoBusinessService.addEstado(data.data.id, |
268 | $scope.remito.vendedor.codigo); | 268 | $scope.remito.vendedor.codigo); |
269 | 269 | ||
270 | focaModalService.alert('Nota remito creada'); | 270 | focaModalService.alert('Nota remito creada'); |
271 | $scope.cabecera = []; | 271 | $scope.cabecera = []; |
272 | addCabecera('Moneda:', $scope.remito.moneda.detalle); | 272 | addCabecera('Moneda:', $scope.remito.moneda.detalle); |
273 | addCabecera( | 273 | addCabecera( |
274 | 'Fecha cotizacion:', | 274 | 'Fecha cotizacion:', |
275 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 275 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
276 | ); | 276 | ); |
277 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 277 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
278 | $scope.remito.vendedor = {}; | 278 | $scope.remito.vendedor = {}; |
279 | $scope.remito.cliente = {}; | 279 | $scope.remito.cliente = {}; |
280 | $scope.remito.proveedor = {}; | 280 | $scope.remito.proveedor = {}; |
281 | $scope.remito.domicilio = {}; | 281 | $scope.remito.domicilio = {}; |
282 | $scope.remito.flete = null; | 282 | $scope.remito.flete = null; |
283 | $scope.remito.fob = null; | 283 | $scope.remito.fob = null; |
284 | $scope.remito.bomba = null; | 284 | $scope.remito.bomba = null; |
285 | $scope.remito.kilometros = null; | 285 | $scope.remito.kilometros = null; |
286 | $scope.articulosTabla = []; | 286 | $scope.articulosTabla = []; |
287 | } | 287 | } |
288 | ); | 288 | ); |
289 | }; | 289 | }; |
290 | 290 | ||
291 | $scope.seleccionarArticulo = function() { | 291 | $scope.seleccionarArticulo = function() { |
292 | if ($scope.idLista === undefined) { | 292 | if ($scope.idLista === undefined) { |
293 | focaModalService.alert( | 293 | focaModalService.alert( |
294 | 'Primero seleccione una lista de precio y condicion'); | 294 | 'Primero seleccione una lista de precio y condicion'); |
295 | return; | 295 | return; |
296 | } | 296 | } |
297 | var modalInstance = $uibModal.open( | 297 | var modalInstance = $uibModal.open( |
298 | { | 298 | { |
299 | ariaLabelledBy: 'Busqueda de Productos', | 299 | ariaLabelledBy: 'Busqueda de Productos', |
300 | templateUrl: 'modal-busqueda-productos.html', | 300 | templateUrl: 'modal-busqueda-productos.html', |
301 | controller: 'modalBusquedaProductosCtrl', | 301 | controller: 'modalBusquedaProductosCtrl', |
302 | resolve: { | 302 | resolve: { |
303 | parametroProducto: { | 303 | parametroProducto: { |
304 | idLista: $scope.idLista, | 304 | idLista: $scope.idLista, |
305 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 305 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
306 | simbolo: $scope.remito.moneda.simbolo | 306 | simbolo: $scope.remito.moneda.simbolo |
307 | } | 307 | } |
308 | }, | 308 | }, |
309 | size: 'lg' | 309 | size: 'lg' |
310 | } | 310 | } |
311 | ); | 311 | ); |
312 | modalInstance.result.then( | 312 | modalInstance.result.then( |
313 | function(producto) { | 313 | function(producto) { |
314 | var newArt = | 314 | var newArt = |
315 | { | 315 | { |
316 | id: 0, | 316 | id: 0, |
317 | codigo: producto.codigo, | 317 | codigo: producto.codigo, |
318 | sector: producto.sector, | 318 | sector: producto.sector, |
319 | sectorCodigo: producto.sector + '-' + producto.codigo, | 319 | sectorCodigo: producto.sector + '-' + producto.codigo, |
320 | descripcion: producto.descripcion, | 320 | descripcion: producto.descripcion, |
321 | item: $scope.articulosTabla.length + 1, | 321 | item: $scope.articulosTabla.length + 1, |
322 | nombre: producto.descripcion, | 322 | nombre: producto.descripcion, |
323 | precio: parseFloat(producto.precio.toFixed(4)), | 323 | precio: parseFloat(producto.precio.toFixed(4)), |
324 | costoUnitario: producto.costo, | 324 | costoUnitario: producto.costo, |
325 | editCantidad: false, | 325 | editCantidad: false, |
326 | editPrecio: false | 326 | editPrecio: false |
327 | }; | 327 | }; |
328 | $scope.articuloACargar = newArt; | 328 | $scope.articuloACargar = newArt; |
329 | $scope.cargando = false; | 329 | $scope.cargando = false; |
330 | }, function() { | 330 | }, function() { |
331 | // funcion ejecutada cuando se cancela el modal | 331 | // funcion ejecutada cuando se cancela el modal |
332 | } | 332 | } |
333 | ); | 333 | ); |
334 | }; | 334 | }; |
335 | 335 | ||
336 | $scope.seleccionarVendedor = function() { | 336 | $scope.seleccionarVendedor = function() { |
337 | var modalInstance = $uibModal.open( | 337 | var modalInstance = $uibModal.open( |
338 | { | 338 | { |
339 | ariaLabelledBy: 'Busqueda de Vendedores', | 339 | ariaLabelledBy: 'Busqueda de Vendedores', |
340 | templateUrl: 'modal-vendedores.html', | 340 | templateUrl: 'modal-vendedores.html', |
341 | controller: 'modalVendedoresCtrl', | 341 | controller: 'modalVendedoresCtrl', |
342 | size: 'lg' | 342 | size: 'lg' |
343 | } | 343 | } |
344 | ); | 344 | ); |
345 | modalInstance.result.then( | 345 | modalInstance.result.then( |
346 | function(vendedor) { | 346 | function(vendedor) { |
347 | addCabecera('Vendedor:', vendedor.NomVen); | 347 | addCabecera('Vendedor:', vendedor.NomVen); |
348 | $scope.remito.vendedor.codigo = vendedor.CodVen; | 348 | $scope.remito.vendedor.codigo = vendedor.CodVen; |
349 | }, function() { | 349 | }, function() { |
350 | 350 | ||
351 | } | 351 | } |
352 | ); | 352 | ); |
353 | }; | 353 | }; |
354 | 354 | ||
355 | $scope.seleccionarProveedor = function() { | 355 | $scope.seleccionarProveedor = function() { |
356 | var modalInstance = $uibModal.open( | 356 | var modalInstance = $uibModal.open( |
357 | { | 357 | { |
358 | ariaLabelledBy: 'Busqueda de Proveedor', | 358 | ariaLabelledBy: 'Busqueda de Proveedor', |
359 | templateUrl: 'modal-proveedor.html', | 359 | templateUrl: 'modal-proveedor.html', |
360 | controller: 'focaModalProveedorCtrl', | 360 | controller: 'focaModalProveedorCtrl', |
361 | size: 'lg' | 361 | size: 'lg', |
362 | resolve: { | ||
363 | transportista: function() { | ||
364 | return false; | ||
365 | } | ||
366 | } | ||
362 | } | 367 | } |
363 | ); | 368 | ); |
364 | modalInstance.result.then( | 369 | modalInstance.result.then( |
365 | function(proveedor) { | 370 | function(proveedor) { |
366 | $scope.remito.proveedor.codigo = proveedor.COD; | 371 | $scope.remito.proveedor.codigo = proveedor.COD; |
367 | addCabecera('Proveedor:', proveedor.NOM); | 372 | addCabecera('Proveedor:', proveedor.NOM); |
368 | }, function() { | 373 | }, function() { |
369 | 374 | ||
370 | } | 375 | } |
371 | ); | 376 | ); |
372 | }; | 377 | }; |
373 | 378 | ||
374 | $scope.seleccionarCliente = function() { | 379 | $scope.seleccionarCliente = function() { |
375 | 380 | ||
376 | var modalInstance = $uibModal.open( | 381 | var modalInstance = $uibModal.open( |
377 | { | 382 | { |
378 | ariaLabelledBy: 'Busqueda de Cliente', | 383 | ariaLabelledBy: 'Busqueda de Cliente', |
379 | templateUrl: 'foca-busqueda-cliente-modal.html', | 384 | templateUrl: 'foca-busqueda-cliente-modal.html', |
380 | controller: 'focaBusquedaClienteModalController', | 385 | controller: 'focaBusquedaClienteModalController', |
381 | size: 'lg' | 386 | size: 'lg' |
382 | } | 387 | } |
383 | ); | 388 | ); |
384 | modalInstance.result.then( | 389 | modalInstance.result.then( |
385 | function(cliente) { | 390 | function(cliente) { |
386 | $scope.abrirModalDomicilios(cliente); | 391 | $scope.abrirModalDomicilios(cliente); |
387 | }, function() { | 392 | }, function() { |
388 | 393 | ||
389 | } | 394 | } |
390 | ); | 395 | ); |
391 | }; | 396 | }; |
392 | 397 | ||
393 | $scope.abrirModalDomicilios = function(cliente) { | 398 | $scope.abrirModalDomicilios = function(cliente) { |
394 | var modalInstanceDomicilio = $uibModal.open( | 399 | var modalInstanceDomicilio = $uibModal.open( |
395 | { | 400 | { |
396 | ariaLabelledBy: 'Busqueda de Domicilios', | 401 | ariaLabelledBy: 'Busqueda de Domicilios', |
397 | templateUrl: 'modal-domicilio.html', | 402 | templateUrl: 'modal-domicilio.html', |
398 | controller: 'focaModalDomicilioController', | 403 | controller: 'focaModalDomicilioController', |
399 | resolve: { idCliente: function() { return cliente.cod; }}, | 404 | resolve: { idCliente: function() { return cliente.cod; }}, |
400 | size: 'lg', | 405 | size: 'lg', |
401 | } | 406 | } |
402 | ); | 407 | ); |
403 | modalInstanceDomicilio.result.then( | 408 | modalInstanceDomicilio.result.then( |
404 | function(domicilio) { | 409 | function(domicilio) { |
405 | $scope.remito.domicilio.id = domicilio.nivel2; | 410 | $scope.remito.domicilio.id = domicilio.nivel2; |
406 | $scope.remito.cliente = cliente; | 411 | $scope.remito.cliente = cliente; |
407 | 412 | ||
408 | addCabecera('Cliente:', cliente.nom); | 413 | addCabecera('Cliente:', cliente.nom); |
409 | addCabecera('Domicilio:', domicilio.dom); | 414 | addCabecera('Domicilio:', domicilio.dom); |
410 | }, function() { | 415 | }, function() { |
411 | $scope.seleccionarCliente(); | 416 | $scope.seleccionarCliente(); |
412 | return; | 417 | return; |
413 | } | 418 | } |
414 | ); | 419 | ); |
415 | }; | 420 | }; |
416 | 421 | ||
417 | $scope.mostrarFichaCliente = function() { | 422 | $scope.mostrarFichaCliente = function() { |
418 | $uibModal.open( | 423 | $uibModal.open( |
419 | { | 424 | { |
420 | ariaLabelledBy: 'Datos del Cliente', | 425 | ariaLabelledBy: 'Datos del Cliente', |
421 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 426 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
422 | controller: 'focaCrearRemitoFichaClienteController', | 427 | controller: 'focaCrearRemitoFichaClienteController', |
423 | size: 'lg' | 428 | size: 'lg' |
424 | } | 429 | } |
425 | ); | 430 | ); |
426 | }; | 431 | }; |
427 | 432 | ||
428 | $scope.getTotal = function() { | 433 | $scope.getTotal = function() { |
429 | var total = 0; | 434 | var total = 0; |
430 | var arrayTempArticulos = $scope.articulosTabla; | 435 | var arrayTempArticulos = $scope.articulosTabla; |
431 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 436 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
432 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 437 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
433 | } | 438 | } |
434 | return parseFloat(total.toFixed(2)); | 439 | return parseFloat(total.toFixed(2)); |
435 | }; | 440 | }; |
436 | 441 | ||
437 | $scope.getSubTotal = function() { | 442 | $scope.getSubTotal = function() { |
438 | if($scope.articuloACargar) { | 443 | if($scope.articuloACargar) { |
439 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 444 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
440 | } | 445 | } |
441 | }; | 446 | }; |
442 | 447 | ||
443 | $scope.abrirModalListaPrecio = function() { | 448 | $scope.abrirModalListaPrecio = function() { |
444 | var modalInstance = $uibModal.open( | 449 | var modalInstance = $uibModal.open( |
445 | { | 450 | { |
446 | ariaLabelledBy: 'Busqueda de Precio Condición', | 451 | ariaLabelledBy: 'Busqueda de Precio Condición', |
447 | templateUrl: 'modal-precio-condicion.html', | 452 | templateUrl: 'modal-precio-condicion.html', |
448 | controller: 'focaModalPrecioCondicionController', | 453 | controller: 'focaModalPrecioCondicionController', |
449 | size: 'lg' | 454 | size: 'lg' |
450 | } | 455 | } |
451 | ); | 456 | ); |
452 | modalInstance.result.then( | 457 | modalInstance.result.then( |
453 | function(precioCondicion) { | 458 | function(precioCondicion) { |
454 | var cabecera = ''; | 459 | var cabecera = ''; |
455 | var plazosConcat = ''; | 460 | var plazosConcat = ''; |
456 | if(!Array.isArray(precioCondicion)) { | 461 | if(!Array.isArray(precioCondicion)) { |
457 | $scope.plazosPagos = precioCondicion.plazoPago; | 462 | $scope.plazosPagos = precioCondicion.plazoPago; |
458 | $scope.idLista = precioCondicion.idListaPrecio; | 463 | $scope.idLista = precioCondicion.idListaPrecio; |
459 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 464 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
460 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 465 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
461 | } | 466 | } |
462 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 467 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
463 | } else { //Cuando se ingresan los plazos manualmente | 468 | } else { //Cuando se ingresan los plazos manualmente |
464 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 469 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
465 | $scope.plazosPagos = precioCondicion; | 470 | $scope.plazosPagos = precioCondicion; |
466 | for(var j = 0; j < precioCondicion.length; j++) { | 471 | for(var j = 0; j < precioCondicion.length; j++) { |
467 | plazosConcat += precioCondicion[j].dias + ' '; | 472 | plazosConcat += precioCondicion[j].dias + ' '; |
468 | } | 473 | } |
469 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 474 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
470 | } | 475 | } |
471 | $scope.articulosTabla = []; | 476 | $scope.articulosTabla = []; |
472 | addCabecera('Precios y condiciones:', cabecera); | 477 | addCabecera('Precios y condiciones:', cabecera); |
473 | }, function() { | 478 | }, function() { |
474 | 479 | ||
475 | } | 480 | } |
476 | ); | 481 | ); |
477 | }; | 482 | }; |
478 | 483 | ||
479 | $scope.abrirModalFlete = function() { | 484 | $scope.abrirModalFlete = function() { |
480 | var modalInstance = $uibModal.open( | 485 | var modalInstance = $uibModal.open( |
481 | { | 486 | { |
482 | ariaLabelledBy: 'Busqueda de Flete', | 487 | ariaLabelledBy: 'Busqueda de Flete', |
483 | templateUrl: 'modal-flete.html', | 488 | templateUrl: 'modal-flete.html', |
484 | controller: 'focaModalFleteController', | 489 | controller: 'focaModalFleteController', |
485 | size: 'lg', | 490 | size: 'lg', |
486 | resolve: { | 491 | resolve: { |
487 | parametrosFlete: | 492 | parametrosFlete: |
488 | function() { | 493 | function() { |
489 | return { | 494 | return { |
490 | flete: $scope.remito.flete ? '1' : | 495 | flete: $scope.remito.flete ? '1' : |
491 | ($scope.remito.fob ? 'FOB' : | 496 | ($scope.remito.fob ? 'FOB' : |
492 | ($scope.remito.flete === undefined ? null : '0')), | 497 | ($scope.remito.flete === undefined ? null : '0')), |
493 | bomba: $scope.remito.bomba ? '1' : | 498 | bomba: $scope.remito.bomba ? '1' : |
494 | ($scope.remito.bomba === undefined ? null : '0'), | 499 | ($scope.remito.bomba === undefined ? null : '0'), |
495 | kilometros: $scope.remito.kilometros | 500 | kilometros: $scope.remito.kilometros |
496 | }; | 501 | }; |
497 | } | 502 | } |
498 | } | 503 | } |
499 | } | 504 | } |
500 | ); | 505 | ); |
501 | modalInstance.result.then( | 506 | modalInstance.result.then( |
502 | function(datos) { | 507 | function(datos) { |
503 | $scope.remito.flete = datos.flete; | 508 | $scope.remito.flete = datos.flete; |
504 | $scope.remito.fob = datos.FOB; | 509 | $scope.remito.fob = datos.FOB; |
505 | $scope.remito.bomba = datos.bomba; | 510 | $scope.remito.bomba = datos.bomba; |
506 | $scope.remito.kilometros = datos.kilometros; | 511 | $scope.remito.kilometros = datos.kilometros; |
507 | 512 | ||
508 | addCabecera('Flete:', datos.flete ? 'Si' : | 513 | addCabecera('Flete:', datos.flete ? 'Si' : |
509 | ($scope.remito.fob ? 'FOB' : 'No')); | 514 | ($scope.remito.fob ? 'FOB' : 'No')); |
510 | if(datos.flete) { | 515 | if(datos.flete) { |
511 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 516 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
512 | addCabecera('Kilometros:', datos.kilometros); | 517 | addCabecera('Kilometros:', datos.kilometros); |
513 | } else { | 518 | } else { |
514 | removeCabecera('Bomba:'); | 519 | removeCabecera('Bomba:'); |
515 | removeCabecera('Kilometros:'); | 520 | removeCabecera('Kilometros:'); |
516 | $scope.remito.fob = false; | 521 | $scope.remito.fob = false; |
517 | $scope.remito.bomba = false; | 522 | $scope.remito.bomba = false; |
518 | $scope.remito.kilometros = null; | 523 | $scope.remito.kilometros = null; |
519 | } | 524 | } |
520 | }, function() { | 525 | }, function() { |
521 | 526 | ||
522 | } | 527 | } |
523 | ); | 528 | ); |
524 | }; | 529 | }; |
525 | 530 | ||
526 | $scope.abrirModalMoneda = function() { | 531 | $scope.abrirModalMoneda = function() { |
527 | var modalInstance = $uibModal.open( | 532 | var modalInstance = $uibModal.open( |
528 | { | 533 | { |
529 | ariaLabelledBy: 'Busqueda de Moneda', | 534 | ariaLabelledBy: 'Busqueda de Moneda', |
530 | templateUrl: 'modal-moneda.html', | 535 | templateUrl: 'modal-moneda.html', |
531 | controller: 'focaModalMonedaController', | 536 | controller: 'focaModalMonedaController', |
532 | size: 'lg' | 537 | size: 'lg' |
533 | } | 538 | } |
534 | ); | 539 | ); |
535 | modalInstance.result.then( | 540 | modalInstance.result.then( |
536 | function(moneda) { | 541 | function(moneda) { |
537 | $scope.abrirModalCotizacion(moneda); | 542 | $scope.abrirModalCotizacion(moneda); |
538 | }, function() { | 543 | }, function() { |
539 | 544 | ||
540 | } | 545 | } |
541 | ); | 546 | ); |
542 | }; | 547 | }; |
543 | 548 | ||
544 | $scope.abrirModalCotizacion = function(moneda) { | 549 | $scope.abrirModalCotizacion = function(moneda) { |
545 | var modalInstance = $uibModal.open( | 550 | var modalInstance = $uibModal.open( |
546 | { | 551 | { |
547 | ariaLabelledBy: 'Busqueda de Cotización', | 552 | ariaLabelledBy: 'Busqueda de Cotización', |
548 | templateUrl: 'modal-cotizacion.html', | 553 | templateUrl: 'modal-cotizacion.html', |
549 | controller: 'focaModalCotizacionController', | 554 | controller: 'focaModalCotizacionController', |
550 | size: 'lg', | 555 | size: 'lg', |
551 | resolve: {idMoneda: function() {return moneda.ID;}} | 556 | resolve: {idMoneda: function() {return moneda.ID;}} |
552 | } | 557 | } |
553 | ); | 558 | ); |
554 | modalInstance.result.then( | 559 | modalInstance.result.then( |
555 | function(cotizacion) { | 560 | function(cotizacion) { |
556 | var articulosTablaTemp = $scope.articulosTabla; | 561 | var articulosTablaTemp = $scope.articulosTabla; |
557 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 562 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
558 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 563 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
559 | $scope.remito.cotizacion.COTIZACION; | 564 | $scope.remito.cotizacion.COTIZACION; |
560 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 565 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
561 | cotizacion.COTIZACION; | 566 | cotizacion.COTIZACION; |
562 | } | 567 | } |
563 | $scope.articulosTabla = articulosTablaTemp; | 568 | $scope.articulosTabla = articulosTablaTemp; |
564 | $scope.remito.moneda = { | 569 | $scope.remito.moneda = { |
565 | id: moneda.ID, | 570 | id: moneda.ID, |
566 | detalle: moneda.DETALLE, | 571 | detalle: moneda.DETALLE, |
567 | simbolo: moneda.SIMBOLO | 572 | simbolo: moneda.SIMBOLO |
568 | }; | 573 | }; |
569 | $scope.remito.cotizacion = { | 574 | $scope.remito.cotizacion = { |
570 | ID: cotizacion.ID, | 575 | ID: cotizacion.ID, |
571 | COTIZACION: cotizacion.COTIZACION, | 576 | COTIZACION: cotizacion.COTIZACION, |
572 | FECHA: cotizacion.FECHA | 577 | FECHA: cotizacion.FECHA |
573 | }; | 578 | }; |
574 | addCabecera('Moneda:', moneda.DETALLE); | 579 | addCabecera('Moneda:', moneda.DETALLE); |
575 | addCabecera( | 580 | addCabecera( |
576 | 'Fecha cotizacion:', | 581 | 'Fecha cotizacion:', |
577 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 582 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
578 | ); | 583 | ); |
579 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 584 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
580 | }, function() { | 585 | }, function() { |
581 | 586 | ||
582 | } | 587 | } |
583 | ); | 588 | ); |
584 | }; | 589 | }; |
585 | 590 | ||
586 | $scope.agregarATabla = function(key) { | 591 | $scope.agregarATabla = function(key) { |
587 | if(key === 13) { | 592 | if(key === 13) { |
588 | if($scope.articuloACargar.cantidad === undefined || | 593 | if($scope.articuloACargar.cantidad === undefined || |
589 | $scope.articuloACargar.cantidad === 0 || | 594 | $scope.articuloACargar.cantidad === 0 || |
590 | $scope.articuloACargar.cantidad === null ){ | 595 | $scope.articuloACargar.cantidad === null ){ |
591 | focaModalService.alert('El valor debe ser al menos 1'); | 596 | focaModalService.alert('El valor debe ser al menos 1'); |
592 | return; | 597 | return; |
593 | } | 598 | } |
594 | delete $scope.articuloACargar.sectorCodigo; | 599 | delete $scope.articuloACargar.sectorCodigo; |
595 | $scope.articulosTabla.push($scope.articuloACargar); | 600 | $scope.articulosTabla.push($scope.articuloACargar); |
596 | $scope.cargando = true; | 601 | $scope.cargando = true; |
597 | } | 602 | } |
598 | }; | 603 | }; |
599 | 604 | ||
600 | $scope.quitarArticulo = function(key) { | 605 | $scope.quitarArticulo = function(key) { |
601 | $scope.articulosTabla.splice(key, 1); | 606 | $scope.articulosTabla.splice(key, 1); |
602 | }; | 607 | }; |
603 | 608 | ||
604 | $scope.editarArticulo = function(key, articulo) { | 609 | $scope.editarArticulo = function(key, articulo) { |
605 | if(key === 13) { | 610 | if(key === 13) { |
606 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 611 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
607 | articulo.cantidad === undefined){ | 612 | articulo.cantidad === undefined){ |
608 | focaModalService.alert('El valor debe ser al menos 1'); | 613 | focaModalService.alert('El valor debe ser al menos 1'); |
609 | return; | 614 | return; |
610 | } | 615 | } |
611 | articulo.editCantidad = false; | 616 | articulo.editCantidad = false; |
612 | articulo.editPrecio = false; | 617 | articulo.editPrecio = false; |
613 | } | 618 | } |
614 | }; | 619 | }; |
615 | 620 | ||
616 | $scope.cambioEdit = function(articulo, propiedad) { | 621 | $scope.cambioEdit = function(articulo, propiedad) { |
617 | if(propiedad === 'cantidad') { | 622 | if(propiedad === 'cantidad') { |
618 | articulo.editCantidad = true; | 623 | articulo.editCantidad = true; |
619 | } else if(propiedad === 'precio') { | 624 | } else if(propiedad === 'precio') { |
620 | articulo.editPrecio = true; | 625 | articulo.editPrecio = true; |
621 | } | 626 | } |
622 | }; | 627 | }; |
623 | 628 | ||
624 | $scope.limpiarFlete = function() { | 629 | $scope.limpiarFlete = function() { |
625 | $scope.remito.fleteNombre = ''; | 630 | $scope.remito.fleteNombre = ''; |
626 | $scope.remito.chofer = ''; | 631 | $scope.remito.chofer = ''; |
627 | $scope.remito.vehiculo = ''; | 632 | $scope.remito.vehiculo = ''; |
628 | $scope.remito.kilometros = ''; | 633 | $scope.remito.kilometros = ''; |
629 | $scope.remito.costoUnitarioKmFlete = ''; | 634 | $scope.remito.costoUnitarioKmFlete = ''; |
630 | $scope.choferes = ''; | 635 | $scope.choferes = ''; |
631 | $scope.vehiculos = ''; | 636 | $scope.vehiculos = ''; |
632 | }; | 637 | }; |
633 | 638 | ||
634 | $scope.limpiarPantalla = function() { | 639 | $scope.limpiarPantalla = function() { |
635 | $scope.limpiarFlete(); | 640 | $scope.limpiarFlete(); |
636 | $scope.remito.flete = '0'; | 641 | $scope.remito.flete = '0'; |
637 | $scope.remito.bomba = '0'; | 642 | $scope.remito.bomba = '0'; |
638 | $scope.remito.precioCondicion = ''; | 643 | $scope.remito.precioCondicion = ''; |
639 | $scope.articulosTabla = []; | 644 | $scope.articulosTabla = []; |
640 | $scope.remito.vendedor.nombre = ''; | 645 | $scope.remito.vendedor.nombre = ''; |
641 | $scope.remito.cliente = {nombre: ''}; | 646 | $scope.remito.cliente = {nombre: ''}; |
642 | $scope.remito.domicilio = {dom: ''}; | 647 | $scope.remito.domicilio = {dom: ''}; |
643 | $scope.domiciliosCliente = []; | 648 | $scope.domiciliosCliente = []; |
644 | }; | 649 | }; |
645 | 650 | ||
646 | $scope.resetFilter = function() { | 651 | $scope.resetFilter = function() { |
647 | $scope.articuloACargar = {}; | 652 | $scope.articuloACargar = {}; |
648 | $scope.cargando = true; | 653 | $scope.cargando = true; |
649 | }; | 654 | }; |
650 | 655 | ||
651 | $scope.selectFocus = function($event) { | 656 | $scope.selectFocus = function($event) { |
652 | $event.target.select(); | 657 | $event.target.select(); |
653 | }; | 658 | }; |
654 | 659 | ||
655 | $scope.salir = function() { | 660 | $scope.salir = function() { |
656 | $location.path('/'); | 661 | $location.path('/'); |
657 | }; | 662 | }; |
658 | 663 | ||
659 | function addCabecera(label, valor) { | 664 | function addCabecera(label, valor) { |
660 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 665 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
661 | if(propiedad.length === 1) { | 666 | if(propiedad.length === 1) { |
662 | propiedad[0].valor = valor; | 667 | propiedad[0].valor = valor; |
663 | } else { | 668 | } else { |
664 | $scope.cabecera.push({label: label, valor: valor}); | 669 | $scope.cabecera.push({label: label, valor: valor}); |
665 | } | 670 | } |
666 | } | 671 | } |
667 | 672 | ||
668 | function removeCabecera(label) { | 673 | function removeCabecera(label) { |
669 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 674 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
670 | if(propiedad.length === 1){ | 675 | if(propiedad.length === 1){ |
671 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 676 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
672 | } | 677 | } |
673 | } | 678 | } |
674 | 679 | ||
675 | function rellenar(relleno, longitud) { | 680 | function rellenar(relleno, longitud) { |
676 | relleno = '' + relleno; | 681 | relleno = '' + relleno; |
677 | while (relleno.length < longitud) { | 682 | while (relleno.length < longitud) { |
678 | relleno = '0' + relleno; | 683 | relleno = '0' + relleno; |
679 | } | 684 | } |
680 | 685 | ||
681 | return relleno; | 686 | return relleno; |
682 | } | 687 | } |
683 | } | 688 | } |
684 | ] | 689 | ] |
685 | ) | 690 | ) |
686 | .controller('remitoListaCtrl', [ | 691 | .controller('remitoListaCtrl', [ |
687 | '$scope', | 692 | '$scope', |
688 | 'crearRemitoService', | 693 | 'crearRemitoService', |
689 | '$location', | 694 | '$location', |
690 | function($scope, crearRemitoService, $location) { | 695 | function($scope, crearRemitoService, $location) { |
691 | crearRemitoService.obtenerRemito().then(function(datos) { | 696 | crearRemitoService.obtenerRemito().then(function(datos) { |
692 | $scope.remitos = datos.data; | 697 | $scope.remitos = datos.data; |
693 | }); | 698 | }); |
694 | $scope.editar = function(remito) { | 699 | $scope.editar = function(remito) { |
695 | crearRemitoService.setRemito(remito); | 700 | crearRemitoService.setRemito(remito); |
696 | $location.path('/venta-nota-remito/abm/'); | 701 | $location.path('/venta-nota-remito/abm/'); |
697 | }; | 702 | }; |
698 | $scope.crearRemito = function() { | 703 | $scope.crearRemito = function() { |
699 | crearRemitoService.clearRemito(); | 704 | crearRemitoService.clearRemito(); |
700 | $location.path('/venta-nota-remito/abm/'); | 705 | $location.path('/venta-nota-remito/abm/'); |
701 | }; | 706 | }; |
702 | } | 707 | } |
703 | ]) | 708 | ]) |
704 | .controller('focaCrearRemitoFichaClienteController', [ | 709 | .controller('focaCrearRemitoFichaClienteController', [ |
705 | '$scope', | 710 | '$scope', |
706 | 'crearRemitoService', | 711 | 'crearRemitoService', |
707 | '$location', | 712 | '$location', |
708 | function($scope, crearRemitoService, $location) { | 713 | function($scope, crearRemitoService, $location) { |
709 | crearRemitoService.obtenerRemito().then(function(datos) { | 714 | crearRemitoService.obtenerRemito().then(function(datos) { |
710 | $scope.remitos = datos.data; | 715 | $scope.remitos = datos.data; |
711 | }); | 716 | }); |
712 | $scope.editar = function(remito) { | 717 | $scope.editar = function(remito) { |
713 | crearRemitoService.setRemito(remito); | 718 | crearRemitoService.setRemito(remito); |
714 | $location.path('/venta-nota-remito/abm/'); | 719 | $location.path('/venta-nota-remito/abm/'); |
715 | }; | 720 | }; |
716 | $scope.crearRemito = function() { | 721 | $scope.crearRemito = function() { |
717 | crearRemitoService.clearRemito(); | 722 | crearRemitoService.clearRemito(); |
718 | $location.path('/venta-nota-remito/abm/'); | 723 | $location.path('/venta-nota-remito/abm/'); |
719 | }; | 724 | }; |
720 | } | 725 | } |
721 | ]); | 726 | ]); |
722 | 727 |
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" | 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 | | 81 | |
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 | type="number" | 144 | type="number" |
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 | > | 149 | > |
150 | <i | 150 | <i |
151 | class="selectable" | 151 | class="selectable" |
152 | ng-click="cambioEdit(articulo, 'cantidad')" | 152 | ng-click="cambioEdit(articulo, 'cantidad')" |
153 | ng-hide="articulo.editCantidad" | 153 | ng-hide="articulo.editCantidad" |
154 | ng-bind="articulo.cantidad"> | 154 | ng-bind="articulo.cantidad"> |
155 | </i> | 155 | </i> |
156 | </td> | 156 | </td> |
157 | <td class="col text-right"> | 157 | <td class="col text-right"> |
158 | <input | 158 | <input |
159 | ng-show="articulo.editPrecio" | 159 | ng-show="articulo.editPrecio" |
160 | ng-model="articulo.precio" | 160 | ng-model="articulo.precio" |
161 | class="form-control" | 161 | class="form-control" |
162 | type="number" | 162 | type="number" |
163 | min="1" | 163 | min="1" |
164 | step="0.0001" | 164 | step="0.0001" |
165 | foca-focus="articulo.editPrecio" | 165 | foca-focus="articulo.editPrecio" |
166 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 166 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
167 | ng-focus="selectFocus($event)" | 167 | ng-focus="selectFocus($event)" |
168 | > | 168 | > |
169 | <i | 169 | <i |
170 | class="selectable" | 170 | class="selectable" |
171 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 171 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
172 | ng-hide="articulo.editPrecio" | 172 | ng-hide="articulo.editPrecio" |
173 | ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> | 173 | ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> |
174 | </i> | 174 | </i> |
175 | </td> | 175 | </td> |
176 | <td | 176 | <td |
177 | class="col text-right" | 177 | class="col text-right" |
178 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> | 178 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> |
179 | </td> | 179 | </td> |
180 | <td class="text-center"> | 180 | <td class="text-center"> |
181 | <button | 181 | <button |
182 | class="btn btn-outline-secondary" | 182 | class="btn btn-outline-secondary" |
183 | ng-click="quitarArticulo(key)" | 183 | ng-click="quitarArticulo(key)" |
184 | > | 184 | > |
185 | <i class="fa fa-trash"></i> | 185 | <i class="fa fa-trash"></i> |
186 | </button> | 186 | </button> |
187 | </td> | 187 | </td> |
188 | </tr> | 188 | </tr> |
189 | </tbody> | 189 | </tbody> |
190 | <tfoot> | 190 | <tfoot> |
191 | <tr ng-show="!cargando" class="d-flex"> | 191 | <tr ng-show="!cargando" class="d-flex"> |
192 | <td | 192 | <td |
193 | class="align-middle" | 193 | class="align-middle" |
194 | ng-bind="articulosTabla.length + 1" | 194 | ng-bind="articulosTabla.length + 1" |
195 | ></td> | 195 | ></td> |
196 | <td class="col"> | 196 | <td class="col"> |
197 | <input | 197 | <input |
198 | class="form-control" | 198 | class="form-control" |
199 | ng-model="articuloACargar.sectorCodigo" | 199 | ng-model="articuloACargar.sectorCodigo" |
200 | readonly | 200 | readonly |
201 | > | 201 | > |
202 | </td> | 202 | </td> |
203 | <td class="col-4 tabla-articulo-descripcion"> | 203 | <td class="col-4 tabla-articulo-descripcion"> |
204 | <input | 204 | <input |
205 | class="form-control" | 205 | class="form-control" |
206 | ng-model="articuloACargar.descripcion" | 206 | ng-model="articuloACargar.descripcion" |
207 | readonly | 207 | readonly |
208 | > | 208 | > |
209 | </td> | 209 | </td> |
210 | <td class="col text-right"> | 210 | <td class="col text-right"> |
211 | <input | 211 | <input |
212 | class="form-control" | 212 | class="form-control" |
213 | type="number" | 213 | type="number" |
214 | min="1" | 214 | min="1" |
215 | ng-model="articuloACargar.cantidad" | 215 | ng-model="articuloACargar.cantidad" |
216 | foca-focus="!cargando" | 216 | foca-focus="!cargando" |
217 | esc-key="resetFilter()" | 217 | esc-key="resetFilter()" |
218 | ng-keypress="agregarATabla($event.keyCode)" | 218 | ng-keypress="agregarATabla($event.keyCode)" |
219 | > | 219 | > |
220 | </td> | 220 | </td> |
221 | <td class="col text-right"> | 221 | <td class="col text-right"> |
222 | <input | 222 | <input |
223 | class="form-control" | 223 | class="form-control" |
224 | ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" | 224 | ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" |
225 | ng-show="idLista != -1" | 225 | ng-show="idLista != -1" |
226 | readonly | 226 | readonly |
227 | > | 227 | > |
228 | <input | 228 | <input |
229 | class="form-control" | 229 | class="form-control" |
230 | type="number" | 230 | type="number" |
231 | step="0.0001" | 231 | step="0.0001" |
232 | ng-model="articuloACargar.precio" | 232 | ng-model="articuloACargar.precio" |
233 | esc-key="resetFilter()" | 233 | esc-key="resetFilter()" |
234 | ng-keypress="agregarATabla($event.keyCode)" | 234 | ng-keypress="agregarATabla($event.keyCode)" |
235 | ng-show="idLista == -1" | 235 | ng-show="idLista == -1" |
236 | > | 236 | > |
237 | </td> | 237 | </td> |
238 | <td class="col text-right"> | 238 | <td class="col text-right"> |
239 | <input | 239 | <input |
240 | class="form-control" | 240 | class="form-control" |
241 | ng-value="getSubTotal() | currency: remito.moneda.simbolo" | 241 | ng-value="getSubTotal() | currency: remito.moneda.simbolo" |
242 | readonly | 242 | readonly |
243 | ></td> | 243 | ></td> |
244 | <td class="text-center align-middle"> | 244 | <td class="text-center align-middle"> |
245 | <button | 245 | <button |
246 | class="btn btn-outline-secondary" | 246 | class="btn btn-outline-secondary" |
247 | ng-click="agregarATabla(13)" | 247 | ng-click="agregarATabla(13)" |
248 | > | 248 | > |
249 | <i class="fa fa-save"></i> | 249 | <i class="fa fa-save"></i> |
250 | </button> | 250 | </button> |
251 | </td> | 251 | </td> |
252 | </tr> | 252 | </tr> |
253 | <tr ng-show="cargando" class="d-flex"> | 253 | <tr ng-show="cargando" class="d-flex"> |
254 | <td colspan="7" class="col-12"> | 254 | <td colspan="7" class="col-12"> |
255 | <input | 255 | <input |
256 | placeholder="Seleccione Articulo" | 256 | placeholder="Seleccione Articulo" |
257 | class="form-control form-control-sm" | 257 | class="form-control form-control-sm" |
258 | readonly | 258 | readonly |
259 | ng-click="seleccionarArticulo()" | 259 | ng-click="seleccionarArticulo()" |
260 | /> | 260 | /> |
261 | </td> | 261 | </td> |
262 | </tr> | 262 | </tr> |
263 | <tr class="d-flex"> | 263 | <tr class="d-flex"> |
264 | <td colspan="4" class="no-border-top"> | 264 | <td colspan="4" class="no-border-top"> |
265 | <strong>Items:</strong> | 265 | <strong>Items:</strong> |
266 | <a ng-bind="articulosTabla.length"></a> | 266 | <a ng-bind="articulosTabla.length"></a> |
267 | </td> | 267 | </td> |
268 | <td class="text-right ml-auto table-celda-total no-border-top"> | 268 | <td class="text-right ml-auto table-celda-total no-border-top"> |
269 | <h3>Total:</h3> | 269 | <h3>Total:</h3> |
270 | </td> | 270 | </td> |
271 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 271 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
272 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> | 272 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> |
273 | </td> | 273 | </td> |
274 | <td class="text-right no-border-top"> | 274 | <td class="text-right no-border-top"> |
275 | <button | 275 | <button |
276 | type="button" | 276 | type="button" |
277 | class="btn btn-default btn-sm" | 277 | class="btn btn-default btn-sm" |
278 | > | 278 | > |
279 | Totales | 279 | Totales |
280 | </button> | 280 | </button> |
281 | </td> | 281 | </td> |
282 | </tr> | 282 | </tr> |
283 | </tfoot> | 283 | </tfoot> |
284 | </table> | 284 | </table> |
285 | </div> | 285 | </div> |
286 | 286 | ||
287 | <!-- MOBILE --> | 287 | <!-- MOBILE --> |
288 | <div class="row d-sm-none"> | 288 | <div class="row d-sm-none"> |
289 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> | 289 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> |
290 | <thead> | 290 | <thead> |
291 | <tr class="d-flex"> | 291 | <tr class="d-flex"> |
292 | <th class="">#</th> | 292 | <th class="">#</th> |
293 | <th class="col px-0"> | 293 | <th class="col px-0"> |
294 | <div class="d-flex"> | 294 | <div class="d-flex"> |
295 | <div class="col-4 px-1">Código</div> | 295 | <div class="col-4 px-1">Código</div> |
296 | <div class="col-8 px-1">Descripción</div> | 296 | <div class="col-8 px-1">Descripción</div> |
297 | </div> | 297 | </div> |
298 | <div class="d-flex"> | 298 | <div class="d-flex"> |
299 | <div class="col-3 px-1">Cantidad</div> | 299 | <div class="col-3 px-1">Cantidad</div> |
300 | <div class="col px-1 text-right">P. Uni.</div> | 300 | <div class="col px-1 text-right">P. Uni.</div> |
301 | <div class="col px-1 text-right">Subtotal</div> | 301 | <div class="col px-1 text-right">Subtotal</div> |
302 | </div> | 302 | </div> |
303 | </th> | 303 | </th> |
304 | <th class="text-center tamaño-boton"> | 304 | <th class="text-center tamaño-boton"> |
305 | | 305 | |
306 | </th> | 306 | </th> |
307 | </tr> | 307 | </tr> |
308 | </thead> | 308 | </thead> |
309 | <tbody> | 309 | <tbody> |
310 | <tr | 310 | <tr |
311 | ng-repeat="(key, articulo) in articulosTabla" | 311 | ng-repeat="(key, articulo) in articulosTabla" |
312 | ng-show="show || key == articulosTabla.length - 1" | 312 | ng-show="show || key == articulosTabla.length - 1" |
313 | > | 313 | > |
314 | <td class="w-100 align-middle d-flex p-0"> | 314 | <td class="w-100 align-middle d-flex p-0"> |
315 | <div class="align-middle p-1"> | 315 | <div class="align-middle p-1"> |
316 | <span ng-bind="key+1" class="align-middle"></span> | 316 | <span ng-bind="key+1" class="align-middle"></span> |
317 | </div> | 317 | </div> |
318 | <div class="col px-0"> | 318 | <div class="col px-0"> |
319 | <div class="d-flex"> | 319 | <div class="d-flex"> |
320 | <div class="col-4 px-1"> | 320 | <div class="col-4 px-1"> |
321 | <span | 321 | <span |
322 | ng-bind="articulo.sector + '-' + articulo.codigo" | 322 | ng-bind="articulo.sector + '-' + articulo.codigo" |
323 | ></span> | 323 | ></span> |
324 | </div> | 324 | </div> |
325 | <div class="col-8 px-1"> | 325 | <div class="col-8 px-1"> |
326 | <span ng-bind="articulo.descripcion"></span> | 326 | <span ng-bind="articulo.descripcion"></span> |
327 | </div> | 327 | </div> |
328 | </div> | 328 | </div> |
329 | <div class="d-flex"> | 329 | <div class="d-flex"> |
330 | <div class="col-3 px-1"> | 330 | <div class="col-3 px-1"> |
331 | <span ng-bind="'x' + articulo.cantidad"></span> | 331 | <span ng-bind="'x' + articulo.cantidad"></span> |
332 | </div> | 332 | </div> |
333 | <div class="col-3 px-1 text-right"> | 333 | <div class="col-3 px-1 text-right"> |
334 | <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> | 334 | <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> |
335 | </div> | 335 | </div> |
336 | <div class="col px-1 text-right"> | 336 | <div class="col px-1 text-right"> |
337 | <span | 337 | <span |
338 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" | 338 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" |
339 | > | 339 | > |
340 | </span> | 340 | </span> |
341 | </div> | 341 | </div> |
342 | </div> | 342 | </div> |
343 | </div> | 343 | </div> |
344 | <div class="align-middle p-1"> | 344 | <div class="align-middle p-1"> |
345 | <button | 345 | <button |
346 | class="btn btn-outline-secondary" | 346 | class="btn btn-outline-secondary" |
347 | ng-click="quitarArticulo(key)" | 347 | ng-click="quitarArticulo(key)" |
348 | > | 348 | > |
349 | <i class="fa fa-trash"></i> | 349 | <i class="fa fa-trash"></i> |
350 | </button> | 350 | </button> |
351 | </div> | 351 | </div> |
352 | </td> | 352 | </td> |
353 | </tr> | 353 | </tr> |
354 | </tbody> | 354 | </tbody> |
355 | <tfoot> | 355 | <tfoot> |
356 | <!-- CARGANDO ITEM --> | 356 | <!-- CARGANDO ITEM --> |
357 | <tr ng-show="!cargando" class="d-flex"> | 357 | <tr ng-show="!cargando" class="d-flex"> |
358 | <td | 358 | <td |
359 | class="align-middle p-1" | 359 | class="align-middle p-1" |
360 | ng-bind="articulosTabla.length + 1" | 360 | ng-bind="articulosTabla.length + 1" |
361 | ></td> | 361 | ></td> |
362 | <td class="col p-0"> | 362 | <td class="col p-0"> |
363 | <div class="d-flex"> | 363 | <div class="d-flex"> |
364 | <div class="col-4 px-1"> | 364 | <div class="col-4 px-1"> |
365 | <span | 365 | <span |
366 | ng-bind="articuloACargar.sectorCodigo" | 366 | ng-bind="articuloACargar.sectorCodigo" |
367 | ></span> | 367 | ></span> |
368 | </div> | 368 | </div> |
369 | <div class="col-8 px-1"> | 369 | <div class="col-8 px-1"> |
370 | <span ng-bind="articuloACargar.descripcion"></span> | 370 | <span ng-bind="articuloACargar.descripcion"></span> |
371 | </div> | 371 | </div> |
372 | </div> | 372 | </div> |
373 | <div class="d-flex"> | 373 | <div class="d-flex"> |
374 | <div class="col-3 px-1 m-1"> | 374 | <div class="col-3 px-1 m-1"> |
375 | <input | 375 | <input |
376 | class="form-control p-1" | 376 | class="form-control p-1" |
377 | type="number" | 377 | type="number" |
378 | min="1" | 378 | min="1" |
379 | ng-model="articuloACargar.cantidad" | 379 | ng-model="articuloACargar.cantidad" |
380 | foca-focus="!cargando" | 380 | foca-focus="!cargando" |
381 | ng-keypress="agregarATabla($event.keyCode)" | 381 | ng-keypress="agregarATabla($event.keyCode)" |
382 | style="height: auto; line-height: 1.1em" | 382 | style="height: auto; line-height: 1.1em" |
383 | > | 383 | > |
384 | </div> | 384 | </div> |
385 | <div class="col-3 px-1 text-right"> | 385 | <div class="col-3 px-1 text-right"> |
386 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> | 386 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> |
387 | </div> | 387 | </div> |
388 | <div class="col px-1 text-right"> | 388 | <div class="col px-1 text-right"> |
389 | <span | 389 | <span |
390 | ng-bind="getSubTotal() | currency: remito.moneda.simbolo" | 390 | ng-bind="getSubTotal() | currency: remito.moneda.simbolo" |
391 | > | 391 | > |
392 | </span> | 392 | </span> |
393 | </div> | 393 | </div> |
394 | </div> | 394 | </div> |
395 | </td> | 395 | </td> |
396 | <td class="text-center align-middle"> | 396 | <td class="text-center align-middle"> |
397 | <button | 397 | <button |
398 | class="btn btn-outline-secondary" | 398 | class="btn btn-outline-secondary" |
399 | ng-click="agregarATabla(13)" | 399 | ng-click="agregarATabla(13)" |
400 | > | 400 | > |
401 | <i class="fa fa-save"></i> | 401 | <i class="fa fa-save"></i> |
402 | </button> | 402 | </button> |
403 | </td> | 403 | </td> |
404 | </tr> | 404 | </tr> |
405 | <!-- SELECCIONAR PRODUCTO --> | 405 | <!-- SELECCIONAR PRODUCTO --> |
406 | <tr ng-show="cargando" class="d-flex"> | 406 | <tr ng-show="cargando" class="d-flex"> |
407 | <td class="col-12"> | 407 | <td class="col-12"> |
408 | <input | 408 | <input |
409 | placeholder="Seleccione Articulo" | 409 | placeholder="Seleccione Articulo" |
410 | class="form-control form-control-sm" | 410 | class="form-control form-control-sm" |
411 | readonly | 411 | readonly |
412 | ng-click="seleccionarArticulo()" | 412 | ng-click="seleccionarArticulo()" |
413 | /> | 413 | /> |
414 | </td> | 414 | </td> |
415 | </tr> | 415 | </tr> |
416 | <!-- TOOGLE EXPANDIR --> | 416 | <!-- TOOGLE EXPANDIR --> |
417 | <tr> | 417 | <tr> |
418 | <td class="col"> | 418 | <td class="col"> |
419 | <button | 419 | <button |
420 | class="btn btn-outline-secondary selectable w-100" | 420 | class="btn btn-outline-secondary selectable w-100" |
421 | ng-click="show = !show; masMenos()" | 421 | ng-click="show = !show; masMenos()" |
422 | ng-show="articulosTabla.length > 0" | 422 | ng-show="articulosTabla.length > 0" |
423 | > | 423 | > |
424 | <i | 424 | <i |
425 | class="fa fa-chevron-down" | 425 | class="fa fa-chevron-down" |
426 | ng-hide="show" | 426 | ng-hide="show" |
427 | aria-hidden="true" | 427 | aria-hidden="true" |
428 | > | 428 | > |
429 | </i> | 429 | </i> |
430 | <i | 430 | <i |
431 | class="fa fa-chevron-up" | 431 | class="fa fa-chevron-up" |
432 | ng-show="show" | 432 | ng-show="show" |
433 | aria-hidden="true"> | 433 | aria-hidden="true"> |
434 | </i> | 434 | </i> |
435 | </button> | 435 | </button> |
436 | </td> | 436 | </td> |
437 | </tr> | 437 | </tr> |
438 | <!-- FOOTER --> | 438 | <!-- FOOTER --> |
439 | <tr class="d-flex"> | 439 | <tr class="d-flex"> |
440 | <td class="align-middle no-border-top" colspan="2"> | 440 | <td class="align-middle no-border-top" colspan="2"> |
441 | <strong>Cantidad Items:</strong> | 441 | <strong>Cantidad Items:</strong> |
442 | <a ng-bind="articulosTabla.length"></a> | 442 | <a ng-bind="articulosTabla.length"></a> |
443 | </td> | 443 | </td> |
444 | <td class="text-right ml-auto table-celda-total no-border-top"> | 444 | <td class="text-right ml-auto table-celda-total no-border-top"> |
445 | <h3>Total:</h3> | 445 | <h3>Total:</h3> |
446 | </td> | 446 | </td> |
447 | <td class="table-celda-total text-right no-border-top"> | 447 | <td class="table-celda-total text-right no-border-top"> |
448 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> | 448 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> |
449 | </td> | 449 | </td> |
450 | </tr> | 450 | </tr> |
451 | </tfoot> | 451 | </tfoot> |
452 | </table> | 452 | </table> |
453 | </div> | 453 | </div> |
454 | </div> | 454 | </div> |
455 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | 455 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> |
456 | <div class="row align-items-end"> | 456 | <div class="row align-items-end"> |
457 | <div class="col-12"> | 457 | <div class="col-12"> |
458 | <button | 458 | <button |
459 | ng-click="crearRemito()" | 459 | ng-click="crearRemito()" |
460 | type="submit" | 460 | type="submit" |
461 | title="Crear nota remito" | 461 | title="Crear nota remito" |
462 | class="btn btn-default btn-block mb-2"> | 462 | class="btn btn-default btn-block mb-2"> |
463 | Guardar | 463 | Guardar |
464 | </button> | 464 | </button> |
465 | <button | 465 | <button |
466 | ng-click="salir()" | 466 | ng-click="salir()" |
467 | type="button" | 467 | type="button" |
468 | title="Salir" | 468 | title="Salir" |
469 | class="btn btn-default btn-block"> | 469 | class="btn btn-default btn-block"> |
470 | Salir | 470 | Salir |
471 | </button> | 471 | </button> |
472 | </div> | 472 | </div> |
473 | </div> | 473 | </div> |
474 | </div> | 474 | </div> |
475 | </div> | 475 | </div> |
476 | <div class="row d-md-none fixed-bottom"> | 476 | <div class="row d-md-none fixed-bottom"> |
477 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 477 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
478 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 478 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
479 | <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> | 479 | <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> |
480 | </div> | 480 | </div> |
481 | </div> | 481 | </div> |
482 | </div> | 482 | </div> |
483 | 483 |