Commit ebf3e5e8d688ec8d0a37c3b5ae738eee6a62afc8
1 parent
8cc007888b
Exists in
master
- Agregué el modal de cotización.
- Modifiqué la lógica para continuar desde moneda a cotización. - Modifiqué addCabecera y removeCabecera para hacer perfect match. - Agregué límite de fecha hasta hoy.
Showing
2 changed files
with
34 additions
and
4 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
4 | 'focaModalService', | 4 | 'focaModalService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService |
7 | ) { | 7 | ) { |
8 | $scope.botonera = [ | 8 | $scope.botonera = [ |
9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
13 | { | 13 | { |
14 | texto: 'Precios y condiciones', | 14 | texto: 'Precios y condiciones', |
15 | accion: function() {$scope.abrirModalListaPrecio();}}, | 15 | accion: function() {$scope.abrirModalListaPrecio();}}, |
16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
17 | {texto: '', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
18 | {texto: '', accion: function() {}} | 18 | {texto: '', accion: function() {}} |
19 | ]; | 19 | ]; |
20 | $scope.datepickerAbierto = false; | 20 | $scope.datepickerAbierto = false; |
21 | 21 | ||
22 | $scope.show = false; | 22 | $scope.show = false; |
23 | $scope.cargando = true; | 23 | $scope.cargando = true; |
24 | $scope.dateOptions = { | 24 | $scope.dateOptions = { |
25 | maxDate: new Date(), | 25 | maxDate: new Date(), |
26 | minDate: new Date(2010, 0, 1) | 26 | minDate: new Date(2010, 0, 1) |
27 | }; | 27 | }; |
28 | 28 | ||
29 | $scope.notaPedido = { | 29 | $scope.notaPedido = { |
30 | vendedor: {}, | 30 | vendedor: {}, |
31 | cliente: {}, | 31 | cliente: {}, |
32 | domicilio: {dom: ''}, | 32 | domicilio: {dom: ''}, |
33 | moneda: {detalle: ''} | 33 | moneda: {detalle: ''} |
34 | }; | 34 | }; |
35 | 35 | ||
36 | $scope.cabecera = []; | 36 | $scope.cabecera = []; |
37 | $scope.showCabecera = true; | 37 | $scope.showCabecera = true; |
38 | 38 | ||
39 | $scope.now = new Date(); | 39 | $scope.now = new Date(); |
40 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 40 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
41 | $scope.comprobante = Math.round(Math.random() * 1000000); | 41 | $scope.comprobante = Math.round(Math.random() * 1000000); |
42 | 42 | ||
43 | $scope.articulosTabla = []; | 43 | $scope.articulosTabla = []; |
44 | var idLista; | 44 | var idLista; |
45 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 45 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
46 | crearNotaPedidoService.getPrecioCondicion().then( | 46 | crearNotaPedidoService.getPrecioCondicion().then( |
47 | function(res) { | 47 | function(res) { |
48 | $scope.precioCondiciones = res.data; | 48 | $scope.precioCondiciones = res.data; |
49 | } | 49 | } |
50 | ); | 50 | ); |
51 | if (notaPedidoTemp !== undefined) { | 51 | if (notaPedidoTemp !== undefined) { |
52 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 52 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
53 | $scope.notaPedido = notaPedidoTemp; | 53 | $scope.notaPedido = notaPedidoTemp; |
54 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 54 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
55 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 55 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
56 | idLista = $scope.notaPedido.precioCondicion; | 56 | idLista = $scope.notaPedido.precioCondicion; |
57 | crearNotaPedidoService | 57 | crearNotaPedidoService |
58 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 58 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
59 | function(res) { | 59 | function(res) { |
60 | $scope.articulosTabla = res.data; | 60 | $scope.articulosTabla = res.data; |
61 | } | 61 | } |
62 | ); | 62 | ); |
63 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 63 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
64 | //(NO REQUERIDO EN ESTA VERSION) | 64 | //(NO REQUERIDO EN ESTA VERSION) |
65 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 65 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
66 | // function(res) { | 66 | // function(res) { |
67 | // $scope.notaPedido.domicilio = res.data; | 67 | // $scope.notaPedido.domicilio = res.data; |
68 | // } | 68 | // } |
69 | // ); | 69 | // ); |
70 | } else { | 70 | } else { |
71 | $scope.notaPedido.fechaCarga = new Date(); | 71 | $scope.notaPedido.fechaCarga = new Date(); |
72 | $scope.notaPedido.bomba = '0'; | 72 | $scope.notaPedido.bomba = '0'; |
73 | $scope.notaPedido.flete = '0'; | 73 | $scope.notaPedido.flete = '0'; |
74 | idLista = undefined; | 74 | idLista = undefined; |
75 | } | 75 | } |
76 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 76 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
77 | // $scope.addNewDom = function() { | 77 | // $scope.addNewDom = function() { |
78 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 78 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
79 | // }; | 79 | // }; |
80 | // $scope.removeNewChoice = function(choice) { | 80 | // $scope.removeNewChoice = function(choice) { |
81 | // if ($scope.notaPedido.domicilio.length > 1) { | 81 | // if ($scope.notaPedido.domicilio.length > 1) { |
82 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 82 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
83 | // function(c) { | 83 | // function(c) { |
84 | // return c.$$hashKey === choice.$$hashKey; | 84 | // return c.$$hashKey === choice.$$hashKey; |
85 | // } | 85 | // } |
86 | // ), 1); | 86 | // ), 1); |
87 | // } | 87 | // } |
88 | // }; | 88 | // }; |
89 | $scope.crearNotaPedido = function() { | 89 | $scope.crearNotaPedido = function() { |
90 | if($scope.articulosTabla.length === 0) { | 90 | if($scope.articulosTabla.length === 0) { |
91 | focaModalService.alert('Debe cargar almenos un articulo'); | 91 | focaModalService.alert('Debe cargar almenos un articulo'); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | if($scope.notaPedido.domicilio.id === undefined) { | 94 | if($scope.notaPedido.domicilio.id === undefined) { |
95 | $scope.notaPedido.domicilio.id = 0; | 95 | $scope.notaPedido.domicilio.id = 0; |
96 | } | 96 | } |
97 | var date = new Date(); | 97 | var date = new Date(); |
98 | var notaPedido = { | 98 | var notaPedido = { |
99 | id: 0, | 99 | id: 0, |
100 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 100 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
101 | .toISOString().slice(0, 19).replace('T', ' '), | 101 | .toISOString().slice(0, 19).replace('T', ' '), |
102 | vendedor: $scope.notaPedido.vendedor.nombre, | 102 | vendedor: $scope.notaPedido.vendedor.nombre, |
103 | idCliente: $scope.notaPedido.cliente.id, | 103 | idCliente: $scope.notaPedido.cliente.id, |
104 | domicilio: $scope.notaPedido.domicilio, | 104 | domicilio: $scope.notaPedido.domicilio, |
105 | bomba: $scope.notaPedido.bomba, | 105 | bomba: $scope.notaPedido.bomba, |
106 | flete: $scope.notaPedido.flete, | 106 | flete: $scope.notaPedido.flete, |
107 | total: $scope.getTotal() | 107 | total: $scope.getTotal() |
108 | }; | 108 | }; |
109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
110 | function(data) { | 110 | function(data) { |
111 | focaModalService.alert('Nota pedido creada'); | 111 | focaModalService.alert('Nota pedido creada'); |
112 | if($scope.notaPedido.flete === 1) { | 112 | if($scope.notaPedido.flete === 1) { |
113 | var flete = { | 113 | var flete = { |
114 | idNotaPedido: data.data.id, | 114 | idNotaPedido: data.data.id, |
115 | idTransportista: $scope.notaPedido.fleteId, | 115 | idTransportista: $scope.notaPedido.fleteId, |
116 | idChofer: $scope.notaPedido.chofer.id, | 116 | idChofer: $scope.notaPedido.chofer.id, |
117 | idVehiculo: $scope.notaPedido.vehiculo.id, | 117 | idVehiculo: $scope.notaPedido.vehiculo.id, |
118 | kilometros: $scope.notaPedido.kilometros, | 118 | kilometros: $scope.notaPedido.kilometros, |
119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
120 | }; | 120 | }; |
121 | crearNotaPedidoService.crearFlete(flete); | 121 | crearNotaPedidoService.crearFlete(flete); |
122 | } | 122 | } |
123 | var articulosNotaPedido = $scope.articulosTabla; | 123 | var articulosNotaPedido = $scope.articulosTabla; |
124 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 124 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
125 | delete articulosNotaPedido[i].edit; | 125 | delete articulosNotaPedido[i].edit; |
126 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 126 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
127 | crearNotaPedidoService | 127 | crearNotaPedidoService |
128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
129 | } | 129 | } |
130 | $scope.limpiarPantalla(); | 130 | $scope.limpiarPantalla(); |
131 | } | 131 | } |
132 | ); | 132 | ); |
133 | }; | 133 | }; |
134 | 134 | ||
135 | $scope.seleccionarArticulo = function() { | 135 | $scope.seleccionarArticulo = function() { |
136 | if (idLista === undefined) { | 136 | if (idLista === undefined) { |
137 | focaModalService.alert( | 137 | focaModalService.alert( |
138 | 'Primero seleccione una lista de precio y condicion'); | 138 | 'Primero seleccione una lista de precio y condicion'); |
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | var modalInstance = $uibModal.open( | 141 | var modalInstance = $uibModal.open( |
142 | { | 142 | { |
143 | ariaLabelledBy: 'Busqueda de Productos', | 143 | ariaLabelledBy: 'Busqueda de Productos', |
144 | templateUrl: 'modal-busqueda-productos.html', | 144 | templateUrl: 'modal-busqueda-productos.html', |
145 | controller: 'modalBusquedaProductosCtrl', | 145 | controller: 'modalBusquedaProductosCtrl', |
146 | resolve: { idLista: function() { return idLista; } }, | 146 | resolve: { idLista: function() { return idLista; } }, |
147 | size: 'lg' | 147 | size: 'lg' |
148 | } | 148 | } |
149 | ); | 149 | ); |
150 | modalInstance.result.then( | 150 | modalInstance.result.then( |
151 | function(producto) { | 151 | function(producto) { |
152 | var newArt = | 152 | var newArt = |
153 | { | 153 | { |
154 | id: 0, | 154 | id: 0, |
155 | codigo: producto.codigo, | 155 | codigo: producto.codigo, |
156 | sector: producto.sector, | 156 | sector: producto.sector, |
157 | sectorCodigo: producto.sector + '-' + producto.codigo, | 157 | sectorCodigo: producto.sector + '-' + producto.codigo, |
158 | descripcion: producto.descripcion, | 158 | descripcion: producto.descripcion, |
159 | item: $scope.articulosTabla.length + 1, | 159 | item: $scope.articulosTabla.length + 1, |
160 | nombre: producto.descripcion, | 160 | nombre: producto.descripcion, |
161 | precio: producto.precio.toFixed(2), | 161 | precio: producto.precio.toFixed(2), |
162 | costoUnitario: producto.costo, | 162 | costoUnitario: producto.costo, |
163 | edit: false | 163 | edit: false |
164 | }; | 164 | }; |
165 | $scope.articuloACargar = newArt; | 165 | $scope.articuloACargar = newArt; |
166 | $scope.cargando = false; | 166 | $scope.cargando = false; |
167 | }, function() { | 167 | }, function() { |
168 | // funcion ejecutada cuando se cancela el modal | 168 | // funcion ejecutada cuando se cancela el modal |
169 | } | 169 | } |
170 | ); | 170 | ); |
171 | }; | 171 | }; |
172 | 172 | ||
173 | $scope.seleccionarVendedor = function() { | 173 | $scope.seleccionarVendedor = function() { |
174 | var modalInstance = $uibModal.open( | 174 | var modalInstance = $uibModal.open( |
175 | { | 175 | { |
176 | ariaLabelledBy: 'Busqueda de Vendedores', | 176 | ariaLabelledBy: 'Busqueda de Vendedores', |
177 | templateUrl: 'modal-vendedores.html', | 177 | templateUrl: 'modal-vendedores.html', |
178 | controller: 'modalVendedoresCtrl', | 178 | controller: 'modalVendedoresCtrl', |
179 | size: 'lg' | 179 | size: 'lg' |
180 | } | 180 | } |
181 | ); | 181 | ); |
182 | modalInstance.result.then( | 182 | modalInstance.result.then( |
183 | function(vendedor) { | 183 | function(vendedor) { |
184 | addCabecera('Vendedor:', vendedor.NomVen); | 184 | addCabecera('Vendedor:', vendedor.NomVen); |
185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
186 | }, function() { | 186 | }, function() { |
187 | 187 | ||
188 | } | 188 | } |
189 | ); | 189 | ); |
190 | }; | 190 | }; |
191 | 191 | ||
192 | $scope.seleccionarProveedor = function() { | 192 | $scope.seleccionarProveedor = function() { |
193 | var modalInstance = $uibModal.open( | 193 | var modalInstance = $uibModal.open( |
194 | { | 194 | { |
195 | ariaLabelledBy: 'Busqueda de Proveedor', | 195 | ariaLabelledBy: 'Busqueda de Proveedor', |
196 | templateUrl: 'modal-proveedor.html', | 196 | templateUrl: 'modal-proveedor.html', |
197 | controller: 'focaModalProveedorCtrl', | 197 | controller: 'focaModalProveedorCtrl', |
198 | size: 'lg' | 198 | size: 'lg' |
199 | } | 199 | } |
200 | ); | 200 | ); |
201 | modalInstance.result.then( | 201 | modalInstance.result.then( |
202 | function(proveedor) { | 202 | function(proveedor) { |
203 | $scope.notaPedido.proveedor = proveedor.NOM; | 203 | $scope.notaPedido.proveedor = proveedor.NOM; |
204 | addCabecera('Proveedor:', proveedor.NOM); | 204 | addCabecera('Proveedor:', proveedor.NOM); |
205 | }, function() { | 205 | }, function() { |
206 | 206 | ||
207 | } | 207 | } |
208 | ); | 208 | ); |
209 | }; | 209 | }; |
210 | 210 | ||
211 | $scope.seleccionarCliente = function() { | 211 | $scope.seleccionarCliente = function() { |
212 | var modalInstance = $uibModal.open( | 212 | var modalInstance = $uibModal.open( |
213 | { | 213 | { |
214 | ariaLabelledBy: 'Busqueda de Cliente', | 214 | ariaLabelledBy: 'Busqueda de Cliente', |
215 | templateUrl: 'foca-busqueda-cliente-modal.html', | 215 | templateUrl: 'foca-busqueda-cliente-modal.html', |
216 | controller: 'focaBusquedaClienteModalController', | 216 | controller: 'focaBusquedaClienteModalController', |
217 | size: 'lg' | 217 | size: 'lg' |
218 | } | 218 | } |
219 | ); | 219 | ); |
220 | modalInstance.result.then( | 220 | modalInstance.result.then( |
221 | function(cliente) { | 221 | function(cliente) { |
222 | $scope.notaPedido.cliente.nombre = cliente.nom; | 222 | $scope.notaPedido.cliente.nombre = cliente.nom; |
223 | $scope.notaPedido.cliente.id = cliente.cod; | 223 | $scope.notaPedido.cliente.id = cliente.cod; |
224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
225 | function(data) { | 225 | function(data) { |
226 | if(data.data.length === 0){ | 226 | if(data.data.length === 0){ |
227 | focaModalService | 227 | focaModalService |
228 | .alert('El cliente no tienen domicilios de entrega') | 228 | .alert('El cliente no tienen domicilios de entrega') |
229 | .then( | 229 | .then( |
230 | function() { | 230 | function() { |
231 | $scope.seleccionarCliente(); | 231 | $scope.seleccionarCliente(); |
232 | $scope.notaPedido.cliente = {nombre: ''}; | 232 | $scope.notaPedido.cliente = {nombre: ''}; |
233 | } | 233 | } |
234 | ); | 234 | ); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | var modalInstanceDomicilio = $uibModal.open( | 237 | var modalInstanceDomicilio = $uibModal.open( |
238 | { | 238 | { |
239 | ariaLabelledBy: 'Busqueda de Domicilios', | 239 | ariaLabelledBy: 'Busqueda de Domicilios', |
240 | templateUrl: 'modal-domicilio.html', | 240 | templateUrl: 'modal-domicilio.html', |
241 | controller: 'focaModalDomicilioController', | 241 | controller: 'focaModalDomicilioController', |
242 | resolve: { idCliente: function() { return cliente.cod; }}, | 242 | resolve: { idCliente: function() { return cliente.cod; }}, |
243 | size: 'lg', | 243 | size: 'lg', |
244 | backdrop: 'static', | 244 | backdrop: 'static', |
245 | } | 245 | } |
246 | ); | 246 | ); |
247 | modalInstanceDomicilio.result.then( | 247 | modalInstanceDomicilio.result.then( |
248 | function(domicilio) { | 248 | function(domicilio) { |
249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | 249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); |
250 | }, function() { | 250 | }, function() { |
251 | $scope.notaPedido.cliente.nombre = ''; | 251 | $scope.notaPedido.cliente.nombre = ''; |
252 | $scope.notaPedido.cliente.id = ''; | 252 | $scope.notaPedido.cliente.id = ''; |
253 | removeCabecera('Cliente:'); | 253 | removeCabecera('Cliente:'); |
254 | $scope.seleccionarCliente(); | 254 | $scope.seleccionarCliente(); |
255 | return; | 255 | return; |
256 | } | 256 | } |
257 | ); | 257 | ); |
258 | } | 258 | } |
259 | ); | 259 | ); |
260 | addCabecera('Cliente:', cliente.nom); | 260 | addCabecera('Cliente:', cliente.nom); |
261 | }, function() { | 261 | }, function() { |
262 | 262 | ||
263 | } | 263 | } |
264 | ); | 264 | ); |
265 | }; | 265 | }; |
266 | 266 | ||
267 | $scope.mostrarFichaCliente = function() { | 267 | $scope.mostrarFichaCliente = function() { |
268 | $uibModal.open( | 268 | $uibModal.open( |
269 | { | 269 | { |
270 | ariaLabelledBy: 'Datos del Cliente', | 270 | ariaLabelledBy: 'Datos del Cliente', |
271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
272 | controller: 'focaCrearNotaPedidoFichaClienteController', | 272 | controller: 'focaCrearNotaPedidoFichaClienteController', |
273 | size: 'lg' | 273 | size: 'lg' |
274 | } | 274 | } |
275 | ); | 275 | ); |
276 | }; | 276 | }; |
277 | 277 | ||
278 | $scope.getTotal = function() { | 278 | $scope.getTotal = function() { |
279 | var total = 0; | 279 | var total = 0; |
280 | var arrayTempArticulos = $scope.articulosTabla; | 280 | var arrayTempArticulos = $scope.articulosTabla; |
281 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 281 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
283 | } | 283 | } |
284 | return total.toFixed(2); | 284 | return total.toFixed(2); |
285 | }; | 285 | }; |
286 | 286 | ||
287 | $scope.getSubTotal = function() { | 287 | $scope.getSubTotal = function() { |
288 | if($scope.articuloACargar) { | 288 | if($scope.articuloACargar) { |
289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
290 | } | 290 | } |
291 | }; | 291 | }; |
292 | 292 | ||
293 | $scope.abrirModalListaPrecio = function() { | 293 | $scope.abrirModalListaPrecio = function() { |
294 | var modalInstance = $uibModal.open( | 294 | var modalInstance = $uibModal.open( |
295 | { | 295 | { |
296 | ariaLabelledBy: 'Busqueda de Precio Condición', | 296 | ariaLabelledBy: 'Busqueda de Precio Condición', |
297 | templateUrl: 'modal-precio-condicion.html', | 297 | templateUrl: 'modal-precio-condicion.html', |
298 | controller: 'focaModalPrecioCondicionController', | 298 | controller: 'focaModalPrecioCondicionController', |
299 | size: 'lg' | 299 | size: 'lg' |
300 | } | 300 | } |
301 | ); | 301 | ); |
302 | modalInstance.result.then( | 302 | modalInstance.result.then( |
303 | function(precioCondicion) { | 303 | function(precioCondicion) { |
304 | var cabecera = ''; | 304 | var cabecera = ''; |
305 | var plazosConcat = ''; | 305 | var plazosConcat = ''; |
306 | if(!Array.isArray(precioCondicion)) { | 306 | if(!Array.isArray(precioCondicion)) { |
307 | $scope.plazosPagos = precioCondicion.plazoPago; | 307 | $scope.plazosPagos = precioCondicion.plazoPago; |
308 | idLista = precioCondicion.idListaPrecio; | 308 | idLista = precioCondicion.idListaPrecio; |
309 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 309 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
310 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 310 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
311 | } | 311 | } |
312 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 312 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
313 | } else { //Cuando se ingresan los plazos manualmente | 313 | } else { //Cuando se ingresan los plazos manualmente |
314 | idLista = -1; //-1, el modal productos busca todos los productos | 314 | idLista = -1; //-1, el modal productos busca todos los productos |
315 | $scope.notaPedido.plazoPago = precioCondicion; | 315 | $scope.notaPedido.plazoPago = precioCondicion; |
316 | for(var j = 0; j < precioCondicion.length; j++) { | 316 | for(var j = 0; j < precioCondicion.length; j++) { |
317 | plazosConcat += precioCondicion[j].dias + ' '; | 317 | plazosConcat += precioCondicion[j].dias + ' '; |
318 | } | 318 | } |
319 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 319 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
320 | } | 320 | } |
321 | $scope.articulosTabla = []; | 321 | $scope.articulosTabla = []; |
322 | addCabecera('Precios y condiciones:', cabecera); | 322 | addCabecera('Precios y condiciones:', cabecera); |
323 | }, function() { | 323 | }, function() { |
324 | 324 | ||
325 | } | 325 | } |
326 | ); | 326 | ); |
327 | }; | 327 | }; |
328 | 328 | ||
329 | $scope.abrirModalFlete = function() { | 329 | $scope.abrirModalFlete = function() { |
330 | var modalInstance = $uibModal.open( | 330 | var modalInstance = $uibModal.open( |
331 | { | 331 | { |
332 | ariaLabelledBy: 'Busqueda de Flete', | 332 | ariaLabelledBy: 'Busqueda de Flete', |
333 | templateUrl: 'modal-flete.html', | 333 | templateUrl: 'modal-flete.html', |
334 | controller: 'focaModalFleteController', | 334 | controller: 'focaModalFleteController', |
335 | size: 'lg', | 335 | size: 'lg', |
336 | resolve: { | 336 | resolve: { |
337 | parametrosFlete: | 337 | parametrosFlete: |
338 | function() { | 338 | function() { |
339 | return { | 339 | return { |
340 | flete: $scope.notaPedido.flete, | 340 | flete: $scope.notaPedido.flete, |
341 | bomba: $scope.notaPedido.bomba, | 341 | bomba: $scope.notaPedido.bomba, |
342 | kilometros: $scope.notaPedido.kilometros | 342 | kilometros: $scope.notaPedido.kilometros |
343 | }; | 343 | }; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | } | 346 | } |
347 | ); | 347 | ); |
348 | modalInstance.result.then( | 348 | modalInstance.result.then( |
349 | function(datos) { | 349 | function(datos) { |
350 | $scope.notaPedido.flete = datos.flete; | 350 | $scope.notaPedido.flete = datos.flete; |
351 | $scope.notaPedido.bomba = datos.bomba; | 351 | $scope.notaPedido.bomba = datos.bomba; |
352 | $scope.notaPedido.kilometros = datos.kilometros; | 352 | $scope.notaPedido.kilometros = datos.kilometros; |
353 | 353 | ||
354 | addCabecera('Flete:', datos.flete); | 354 | addCabecera('Flete:', datos.flete); |
355 | if(datos.flete === 'si') { | 355 | if(datos.flete === 'si') { |
356 | addCabecera('Bomba:', datos.bomba); | 356 | addCabecera('Bomba:', datos.bomba); |
357 | addCabecera('Kilometros:', datos.kilometros); | 357 | addCabecera('Kilometros:', datos.kilometros); |
358 | } else { | 358 | } else { |
359 | removeCabecera('Bomba:'); | 359 | removeCabecera('Bomba:'); |
360 | removeCabecera('Kilometros:'); | 360 | removeCabecera('Kilometros:'); |
361 | } | 361 | } |
362 | }, function() { | 362 | }, function() { |
363 | 363 | ||
364 | } | 364 | } |
365 | ); | 365 | ); |
366 | }; | 366 | }; |
367 | 367 | ||
368 | $scope.abrirModalMoneda = function() { | 368 | $scope.abrirModalMoneda = function() { |
369 | var modalInstance = $uibModal.open( | 369 | var modalInstance = $uibModal.open( |
370 | { | 370 | { |
371 | ariaLabelledBy: 'Busqueda de Moneda', | 371 | ariaLabelledBy: 'Busqueda de Moneda', |
372 | templateUrl: 'modal-moneda.html', | 372 | templateUrl: 'modal-moneda.html', |
373 | controller: 'focaModalMonedaController', | 373 | controller: 'focaModalMonedaController', |
374 | size: 'lg' | 374 | size: 'lg' |
375 | } | 375 | } |
376 | ); | 376 | ); |
377 | modalInstance.result.then( | 377 | modalInstance.result.then( |
378 | function(moneda) { | 378 | function(moneda) { |
379 | $scope.notaPedido.moneda = { | 379 | $scope.notaPedido.moneda = { |
380 | id: moneda.ID, | 380 | id: moneda.ID, |
381 | detalle: moneda.DETALLE, | 381 | detalle: moneda.DETALLE, |
382 | simbolo: moneda.SIMBOLO | 382 | simbolo: moneda.SIMBOLO |
383 | }; | 383 | }; |
384 | 384 | ||
385 | addCabecera('Moneda:', moneda.DETALLE); | 385 | addCabecera('Moneda:', moneda.DETALLE); |
386 | $scope.abrirModalCotizacion(moneda.ID); | ||
387 | }, function() { | ||
388 | |||
389 | } | ||
390 | ); | ||
391 | }; | ||
392 | |||
393 | $scope.abrirModalCotizacion = function(idMoneda) { | ||
394 | var modalInstance = $uibModal.open( | ||
395 | { | ||
396 | ariaLabelledBy: 'Busqueda de Cotización', | ||
397 | templateUrl: 'modal-cotizacion.html', | ||
398 | controller: 'focaModalCotizacionController', | ||
399 | size: 'lg', | ||
400 | resolve: {idMoneda: function() {return idMoneda;}} | ||
401 | } | ||
402 | ); | ||
403 | modalInstance.result.then( | ||
404 | function(cotizacion) { | ||
405 | $scope.notaPedido.cotizacion = { | ||
406 | id: cotizacion.ID, | ||
407 | cotizacion: cotizacion.COTIZACION | ||
408 | }; | ||
409 | |||
410 | addCabecera( | ||
411 | 'Fecha cotizacion:', | ||
412 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | ||
413 | ); | ||
414 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | ||
386 | }, function() { | 415 | }, function() { |
387 | 416 | ||
388 | } | 417 | } |
389 | ); | 418 | ); |
390 | }; | 419 | }; |
391 | 420 | ||
392 | $scope.agregarATabla = function(key) { | 421 | $scope.agregarATabla = function(key) { |
393 | if(key === 13) { | 422 | if(key === 13) { |
394 | if($scope.articuloACargar.cantidad === undefined || | 423 | if($scope.articuloACargar.cantidad === undefined || |
395 | $scope.articuloACargar.cantidad === 0 || | 424 | $scope.articuloACargar.cantidad === 0 || |
396 | $scope.articuloACargar.cantidad === null ){ | 425 | $scope.articuloACargar.cantidad === null ){ |
397 | focaModalService.alert('El valor debe ser al menos 1'); | 426 | focaModalService.alert('El valor debe ser al menos 1'); |
398 | return; | 427 | return; |
399 | } | 428 | } |
400 | delete $scope.articuloACargar.sectorCodigo; | 429 | delete $scope.articuloACargar.sectorCodigo; |
401 | $scope.articulosTabla.push($scope.articuloACargar); | 430 | $scope.articulosTabla.push($scope.articuloACargar); |
402 | $scope.cargando = true; | 431 | $scope.cargando = true; |
403 | } | 432 | } |
404 | }; | 433 | }; |
405 | 434 | ||
406 | $scope.quitarArticulo = function(key) { | 435 | $scope.quitarArticulo = function(key) { |
407 | $scope.articulosTabla.splice(key, 1); | 436 | $scope.articulosTabla.splice(key, 1); |
408 | }; | 437 | }; |
409 | 438 | ||
410 | $scope.editarArticulo = function(key, articulo) { | 439 | $scope.editarArticulo = function(key, articulo) { |
411 | if(key === 13) { | 440 | if(key === 13) { |
412 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 441 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
413 | articulo.cantidad === undefined){ | 442 | articulo.cantidad === undefined){ |
414 | focaModalService.alert('El valor debe ser al menos 1'); | 443 | focaModalService.alert('El valor debe ser al menos 1'); |
415 | return; | 444 | return; |
416 | } | 445 | } |
417 | articulo.edit = false; | 446 | articulo.edit = false; |
418 | } | 447 | } |
419 | }; | 448 | }; |
420 | 449 | ||
421 | $scope.cambioEdit = function(articulo) { | 450 | $scope.cambioEdit = function(articulo) { |
422 | articulo.edit = true; | 451 | articulo.edit = true; |
423 | }; | 452 | }; |
424 | 453 | ||
425 | $scope.limpiarFlete = function() { | 454 | $scope.limpiarFlete = function() { |
426 | $scope.notaPedido.fleteNombre = ''; | 455 | $scope.notaPedido.fleteNombre = ''; |
427 | $scope.notaPedido.chofer = ''; | 456 | $scope.notaPedido.chofer = ''; |
428 | $scope.notaPedido.vehiculo = ''; | 457 | $scope.notaPedido.vehiculo = ''; |
429 | $scope.notaPedido.kilometros = ''; | 458 | $scope.notaPedido.kilometros = ''; |
430 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 459 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
431 | $scope.choferes = ''; | 460 | $scope.choferes = ''; |
432 | $scope.vehiculos = ''; | 461 | $scope.vehiculos = ''; |
433 | }; | 462 | }; |
434 | 463 | ||
435 | $scope.limpiarPantalla = function() { | 464 | $scope.limpiarPantalla = function() { |
436 | $scope.limpiarFlete(); | 465 | $scope.limpiarFlete(); |
437 | $scope.notaPedido.flete = '0'; | 466 | $scope.notaPedido.flete = '0'; |
438 | $scope.notaPedido.bomba = '0'; | 467 | $scope.notaPedido.bomba = '0'; |
439 | $scope.notaPedido.precioCondicion = ''; | 468 | $scope.notaPedido.precioCondicion = ''; |
440 | $scope.articulosTabla = []; | 469 | $scope.articulosTabla = []; |
441 | $scope.notaPedido.vendedor.nombre = ''; | 470 | $scope.notaPedido.vendedor.nombre = ''; |
442 | $scope.notaPedido.cliente = {nombre: ''}; | 471 | $scope.notaPedido.cliente = {nombre: ''}; |
443 | $scope.notaPedido.domicilio = {dom: ''}; | 472 | $scope.notaPedido.domicilio = {dom: ''}; |
444 | $scope.domiciliosCliente = []; | 473 | $scope.domiciliosCliente = []; |
445 | }; | 474 | }; |
446 | 475 | ||
447 | $scope.resetFilter = function() { | 476 | $scope.resetFilter = function() { |
448 | $scope.articuloACargar = {}; | 477 | $scope.articuloACargar = {}; |
449 | $scope.cargando = true; | 478 | $scope.cargando = true; |
450 | }; | 479 | }; |
451 | 480 | ||
452 | $scope.selectFocus = function($event) { | 481 | $scope.selectFocus = function($event) { |
453 | $event.target.select(); | 482 | $event.target.select(); |
454 | }; | 483 | }; |
455 | 484 | ||
456 | $scope.salir = function() { | 485 | $scope.salir = function() { |
457 | $location.path('/'); | 486 | $location.path('/'); |
458 | }; | 487 | }; |
459 | 488 | ||
460 | function addCabecera(label, valor) { | 489 | function addCabecera(label, valor) { |
461 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 490 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
462 | if(propiedad.length === 1) { | 491 | if(propiedad.length === 1) { |
463 | propiedad[0].valor = valor; | 492 | propiedad[0].valor = valor; |
464 | } else { | 493 | } else { |
465 | $scope.cabecera.push({label: label, valor: valor}); | 494 | $scope.cabecera.push({label: label, valor: valor}); |
466 | } | 495 | } |
467 | } | 496 | } |
468 | 497 | ||
469 | function removeCabecera(label) { | 498 | function removeCabecera(label) { |
470 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 499 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
471 | if(propiedad.length === 1){ | 500 | if(propiedad.length === 1){ |
472 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 501 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
473 | } | 502 | } |
474 | } | 503 | } |
475 | } | 504 | } |
476 | ] | 505 | ] |
477 | ) | 506 | ) |
478 | .controller('notaPedidoListaCtrl', [ | 507 | .controller('notaPedidoListaCtrl', [ |
479 | '$scope', | 508 | '$scope', |
480 | 'crearNotaPedidoService', | 509 | 'crearNotaPedidoService', |
481 | '$location', | 510 | '$location', |
482 | function($scope, crearNotaPedidoService, $location) { | 511 | function($scope, crearNotaPedidoService, $location) { |
483 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 512 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
484 | $scope.notaPedidos = datos.data; | 513 | $scope.notaPedidos = datos.data; |
485 | }); | 514 | }); |
486 | $scope.editar = function(notaPedido) { | 515 | $scope.editar = function(notaPedido) { |
487 | crearNotaPedidoService.setNotaPedido(notaPedido); | 516 | crearNotaPedidoService.setNotaPedido(notaPedido); |
488 | $location.path('/venta-nota-pedido/abm/'); | 517 | $location.path('/venta-nota-pedido/abm/'); |
489 | }; | 518 | }; |
490 | $scope.crearPedido = function() { | 519 | $scope.crearPedido = function() { |
491 | crearNotaPedidoService.clearNotaPedido(); | 520 | crearNotaPedidoService.clearNotaPedido(); |
492 | $location.path('/venta-nota-pedido/abm/'); | 521 | $location.path('/venta-nota-pedido/abm/'); |
493 | }; | 522 | }; |
494 | } | 523 | } |
495 | ]) | 524 | ]) |
496 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 525 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
497 | '$scope', | 526 | '$scope', |
498 | 'crearNotaPedidoService', | 527 | 'crearNotaPedidoService', |
499 | '$location', | 528 | '$location', |
500 | function($scope, crearNotaPedidoService, $location) { | 529 | function($scope, crearNotaPedidoService, $location) { |
501 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 530 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
502 | $scope.notaPedidos = datos.data; | 531 | $scope.notaPedidos = datos.data; |
503 | }); | 532 | }); |
504 | $scope.editar = function(notaPedido) { | 533 | $scope.editar = function(notaPedido) { |
505 | crearNotaPedidoService.setNotaPedido(notaPedido); | 534 | crearNotaPedidoService.setNotaPedido(notaPedido); |
506 | $location.path('/venta-nota-pedido/abm/'); | 535 | $location.path('/venta-nota-pedido/abm/'); |
507 | }; | 536 | }; |
508 | $scope.crearPedido = function() { | 537 | $scope.crearPedido = function() { |
509 | crearNotaPedidoService.clearNotaPedido(); | 538 | crearNotaPedidoService.clearNotaPedido(); |
510 | $location.path('/venta-nota-pedido/abm/'); | 539 | $location.path('/venta-nota-pedido/abm/'); |
511 | }; | 540 | }; |
512 | } | 541 | } |
513 | ]); | 542 | ]); |
514 | 543 |
src/views/nota-pedido.html
1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" 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-pedido"> | 8 | <div class="col-12 col-sm-4 nota-pedido"> |
9 | <h5>NOTA DE PEDIDO</h5> | 9 | <h5>NOTA DE PEDIDO</h5> |
10 | </div> | 10 | </div> |
11 | <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> | 11 | <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> |
12 | <div class="col-6 col-sm-4 text-right crear-nota-pedido-fecha"> | 12 | <div class="col-6 col-sm-4 text-right crear-nota-pedido-fecha"> |
13 | Fecha: | 13 | Fecha: |
14 | <span | 14 | <span |
15 | ng-show="!datepickerAbierto" | 15 | ng-show="!datepickerAbierto" |
16 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | 16 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" |
17 | ng-click="datepickerAbierto = true" | 17 | ng-click="datepickerAbierto = true" |
18 | > | 18 | > |
19 | </span> | 19 | </span> |
20 | <input | 20 | <input |
21 | ng-show="datepickerAbierto" | 21 | ng-show="datepickerAbierto" |
22 | type="date" | 22 | type="date" |
23 | ng-model="now" | 23 | ng-model="now" |
24 | ng-change="datepickerAbierto = false" | 24 | ng-change="datepickerAbierto = false" |
25 | ng-blur="datepickerAbierto = false" | 25 | ng-blur="datepickerAbierto = false" |
26 | class="form-control form-control-sm col-8 float-right" | 26 | class="form-control form-control-sm col-8 float-right" |
27 | foca-focus="datepickerAbierto" | 27 | foca-focus="datepickerAbierto" |
28 | hasta-hoy | ||
28 | /> | 29 | /> |
29 | </div> | 30 | </div> |
30 | </div> | 31 | </div> |
31 | <div class="row"> | 32 | <div class="row"> |
32 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 33 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
33 | <span class="label" ng-bind="cab.label"></span> | 34 | <span class="label" ng-bind="cab.label"></span> |
34 | <span class="valor" ng-bind="cab.valor"></span> | 35 | <span class="valor" ng-bind="cab.valor"></span> |
35 | </div> | 36 | </div> |
36 | <a | 37 | <a |
37 | class="btn col-12 btn-secondary d-sm-none" | 38 | class="btn col-12 btn-secondary d-sm-none" |
38 | ng-show="cabecera.length > 0" | 39 | ng-show="cabecera.length > 0" |
39 | ng-click="showCabecera = !showCabecera" | 40 | ng-click="showCabecera = !showCabecera" |
40 | > | 41 | > |
41 | <i | 42 | <i |
42 | class="fa fa-chevron-down" | 43 | class="fa fa-chevron-down" |
43 | ng-hide="showCabecera" | 44 | ng-hide="showCabecera" |
44 | aria-hidden="true" | 45 | aria-hidden="true" |
45 | > | 46 | > |
46 | </i> | 47 | </i> |
47 | <i | 48 | <i |
48 | class="fa fa-chevron-up" | 49 | class="fa fa-chevron-up" |
49 | ng-show="showCabecera" | 50 | ng-show="showCabecera" |
50 | aria-hidden="true"> | 51 | aria-hidden="true"> |
51 | </i> | 52 | </i> |
52 | </a> | 53 | </a> |
53 | </div> | 54 | </div> |
54 | </div> | 55 | </div> |
55 | </div> | 56 | </div> |
56 | <div class="row p-1 botonera-secundaria"> | 57 | <div class="row p-1 botonera-secundaria"> |
57 | <div class="col-12"> | 58 | <div class="col-12"> |
58 | <div class="row"> | 59 | <div class="row"> |
59 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 60 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
60 | <button | 61 | <button |
61 | type="button" | 62 | type="button" |
62 | class="btn btn-default btn-block btn-xs text-left py-2" | 63 | class="btn btn-default btn-block btn-xs text-left py-2" |
63 | ng-click="boton.accion()" | 64 | ng-click="boton.accion()" |
64 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 65 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
65 | > | 66 | > |
66 | <i | 67 | <i |
67 | class="fa fa-arrow-circle-right" | 68 | class="fa fa-arrow-circle-right" |
68 | ng-show="boton.texto != ''" | 69 | ng-show="boton.texto != ''" |
69 | ></i> | 70 | ></i> |
70 | | 71 | |
71 | {{boton.texto}} | 72 | {{boton.texto}} |
72 | </button> | 73 | </button> |
73 | </div> | 74 | </div> |
74 | </div> | 75 | </div> |
75 | </div> | 76 | </div> |
76 | </div> | 77 | </div> |
77 | </div> | 78 | </div> |
78 | </div> | 79 | </div> |
79 | </form> | 80 | </form> |
80 | <div class="row"> | 81 | <div class="row"> |
81 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 82 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
82 | <!-- PC --> | 83 | <!-- PC --> |
83 | <div class="row grilla-articulo align-items-end"> | 84 | <div class="row grilla-articulo align-items-end"> |
84 | <table class="table tabla-articulo table-striped table-sm table-dark mb-0"> | 85 | <table class="table tabla-articulo table-striped table-sm table-dark mb-0"> |
85 | <thead> | 86 | <thead> |
86 | <tr class="d-flex"> | 87 | <tr class="d-flex"> |
87 | <th class="">#</th> | 88 | <th class="">#</th> |
88 | <th class="col">Código</th> | 89 | <th class="col">Código</th> |
89 | <th class="col-4">Descripción</th> | 90 | <th class="col-4">Descripción</th> |
90 | <th class="col text-right">Cantidad</th> | 91 | <th class="col text-right">Cantidad</th> |
91 | <th class="col text-right">Precio Unitario</th> | 92 | <th class="col text-right">Precio Unitario</th> |
92 | <th class="col text-right">SubTotal</th> | 93 | <th class="col text-right">SubTotal</th> |
93 | <th class="text-right"> | 94 | <th class="text-right"> |
94 | <button | 95 | <button |
95 | class="btn btn-outline-secondary selectable" | 96 | class="btn btn-outline-secondary selectable" |
96 | ng-click="show = !show; masMenos()" | 97 | ng-click="show = !show; masMenos()" |
97 | > | 98 | > |
98 | <i | 99 | <i |
99 | class="fa fa-chevron-down" | 100 | class="fa fa-chevron-down" |
100 | ng-show="show" | 101 | ng-show="show" |
101 | aria-hidden="true" | 102 | aria-hidden="true" |
102 | > | 103 | > |
103 | </i> | 104 | </i> |
104 | <i | 105 | <i |
105 | class="fa fa-chevron-up" | 106 | class="fa fa-chevron-up" |
106 | ng-hide="show" | 107 | ng-hide="show" |
107 | aria-hidden="true"> | 108 | aria-hidden="true"> |
108 | </i> | 109 | </i> |
109 | </button> | 110 | </button> |
110 | </th> | 111 | </th> |
111 | </tr> | 112 | </tr> |
112 | </thead> | 113 | </thead> |
113 | <tbody class="tabla-articulo-body"> | 114 | <tbody class="tabla-articulo-body"> |
114 | <tr | 115 | <tr |
115 | ng-repeat="(key, articulo) in articulosTabla" | 116 | ng-repeat="(key, articulo) in articulosTabla" |
116 | ng-show="show || key == (articulosTabla.length - 1)" | 117 | ng-show="show || key == (articulosTabla.length - 1)" |
117 | class="d-flex" | 118 | class="d-flex" |
118 | > | 119 | > |
119 | <td ng-bind="key + 1"></td> | 120 | <td ng-bind="key + 1"></td> |
120 | <td | 121 | <td |
121 | class="col" | 122 | class="col" |
122 | ng-bind="articulo.sector + '-' + articulo.codigo" | 123 | ng-bind="articulo.sector + '-' + articulo.codigo" |
123 | ></td> | 124 | ></td> |
124 | <td | 125 | <td |
125 | class="col-4" | 126 | class="col-4" |
126 | ng-bind="articulo.descripcion" | 127 | ng-bind="articulo.descripcion" |
127 | ></td> | 128 | ></td> |
128 | <td class="col text-right"> | 129 | <td class="col text-right"> |
129 | <input | 130 | <input |
130 | ng-show="articulo.edit" | 131 | ng-show="articulo.edit" |
131 | ng-model="articulo.cantidad" | 132 | ng-model="articulo.cantidad" |
132 | class="form-control" | 133 | class="form-control" |
133 | type="number" | 134 | type="number" |
134 | min="1" | 135 | min="1" |
135 | foca-focus="articulo.edit" | 136 | foca-focus="articulo.edit" |
136 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 137 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
137 | ng-focus="selectFocus($event)" | 138 | ng-focus="selectFocus($event)" |
138 | > | 139 | > |
139 | <i | 140 | <i |
140 | class="selectable" | 141 | class="selectable" |
141 | ng-click="cambioEdit(articulo)" | 142 | ng-click="cambioEdit(articulo)" |
142 | ng-hide="articulo.edit" | 143 | ng-hide="articulo.edit" |
143 | ng-bind="articulo.cantidad"> | 144 | ng-bind="articulo.cantidad"> |
144 | </i> | 145 | </i> |
145 | </td> | 146 | </td> |
146 | <td | 147 | <td |
147 | class="col text-right" | 148 | class="col text-right" |
148 | ng-bind="articulo.precio | currency: '$'" | 149 | ng-bind="articulo.precio | currency: '$'" |
149 | ></td> | 150 | ></td> |
150 | <td | 151 | <td |
151 | class="col text-right" | 152 | class="col text-right" |
152 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | 153 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> |
153 | </td> | 154 | </td> |
154 | <td class="text-center"> | 155 | <td class="text-center"> |
155 | <button | 156 | <button |
156 | class="btn btn-outline-secondary" | 157 | class="btn btn-outline-secondary" |
157 | ng-click="quitarArticulo(key)" | 158 | ng-click="quitarArticulo(key)" |
158 | > | 159 | > |
159 | <i class="fa fa-trash"></i> | 160 | <i class="fa fa-trash"></i> |
160 | </button> | 161 | </button> |
161 | </td> | 162 | </td> |
162 | </tr> | 163 | </tr> |
163 | </tbody> | 164 | </tbody> |
164 | <tfoot> | 165 | <tfoot> |
165 | <tr ng-show="!cargando" class="d-flex"> | 166 | <tr ng-show="!cargando" class="d-flex"> |
166 | <td | 167 | <td |
167 | class="align-middle" | 168 | class="align-middle" |
168 | ng-bind="articulosTabla.length + 1" | 169 | ng-bind="articulosTabla.length + 1" |
169 | ></td> | 170 | ></td> |
170 | <td class="col"> | 171 | <td class="col"> |
171 | <input | 172 | <input |
172 | class="form-control" | 173 | class="form-control" |
173 | ng-model="articuloACargar.sectorCodigo" | 174 | ng-model="articuloACargar.sectorCodigo" |
174 | readonly | 175 | readonly |
175 | > | 176 | > |
176 | </td> | 177 | </td> |
177 | <td class="col-4 tabla-articulo-descripcion"> | 178 | <td class="col-4 tabla-articulo-descripcion"> |
178 | <input | 179 | <input |
179 | class="form-control" | 180 | class="form-control" |
180 | ng-model="articuloACargar.descripcion" | 181 | ng-model="articuloACargar.descripcion" |
181 | readonly | 182 | readonly |
182 | > | 183 | > |
183 | </td> | 184 | </td> |
184 | <td class="col text-right"> | 185 | <td class="col text-right"> |
185 | <input | 186 | <input |
186 | class="form-control" | 187 | class="form-control" |
187 | type="number" | 188 | type="number" |
188 | min="1" | 189 | min="1" |
189 | ng-model="articuloACargar.cantidad" | 190 | ng-model="articuloACargar.cantidad" |
190 | foca-focus="!cargando" | 191 | foca-focus="!cargando" |
191 | esc-key="resetFilter()" | 192 | esc-key="resetFilter()" |
192 | ng-keypress="agregarATabla($event.keyCode)" | 193 | ng-keypress="agregarATabla($event.keyCode)" |
193 | > | 194 | > |
194 | </td> | 195 | </td> |
195 | <td class="col text-right"> | 196 | <td class="col text-right"> |
196 | <input | 197 | <input |
197 | class="form-control" | 198 | class="form-control" |
198 | ng-value="articuloACargar.precio | currency: '$'" | 199 | ng-value="articuloACargar.precio | currency: '$'" |
199 | readonly | 200 | readonly |
200 | > | 201 | > |
201 | </td> | 202 | </td> |
202 | <td class="col text-right"> | 203 | <td class="col text-right"> |
203 | <input | 204 | <input |
204 | class="form-control" | 205 | class="form-control" |
205 | ng-value="getSubTotal() | currency: '$'" | 206 | ng-value="getSubTotal() | currency: '$'" |
206 | readonly | 207 | readonly |
207 | ></td> | 208 | ></td> |
208 | <td class="text-center align-middle"> | 209 | <td class="text-center align-middle"> |
209 | <button | 210 | <button |
210 | class="btn btn-outline-secondary" | 211 | class="btn btn-outline-secondary" |
211 | ng-click="agregarATabla(13)" | 212 | ng-click="agregarATabla(13)" |
212 | > | 213 | > |
213 | <i class="fa fa-save"></i> | 214 | <i class="fa fa-save"></i> |
214 | </button> | 215 | </button> |
215 | </td> | 216 | </td> |
216 | </tr> | 217 | </tr> |
217 | <tr ng-show="cargando" class="d-flex"> | 218 | <tr ng-show="cargando" class="d-flex"> |
218 | <td colspan="7" class="col-12"> | 219 | <td colspan="7" class="col-12"> |
219 | <input | 220 | <input |
220 | placeholder="Seleccione Articulo" | 221 | placeholder="Seleccione Articulo" |
221 | class="form-control form-control-sm" | 222 | class="form-control form-control-sm" |
222 | readonly | 223 | readonly |
223 | ng-click="seleccionarArticulo()" | 224 | ng-click="seleccionarArticulo()" |
224 | /> | 225 | /> |
225 | </td> | 226 | </td> |
226 | </tr> | 227 | </tr> |
227 | <tr class="d-flex"> | 228 | <tr class="d-flex"> |
228 | <td colspan="4"> | 229 | <td colspan="4"> |
229 | <strong>Cantidad Items:</strong> | 230 | <strong>Cantidad Items:</strong> |
230 | <a ng-bind="articulosTabla.length"></a> | 231 | <a ng-bind="articulosTabla.length"></a> |
231 | </td> | 232 | </td> |
232 | <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> | 233 | <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> |
233 | <td class="table-celda-total text-right" colspan="1"> | 234 | <td class="table-celda-total text-right" colspan="1"> |
234 | <h3>{{getTotal() | currency: '$'}}</h3> | 235 | <h3>{{getTotal() | currency: '$'}}</h3> |
235 | </td> | 236 | </td> |
236 | <td class="text-right"> | 237 | <td class="text-right"> |
237 | <button | 238 | <button |
238 | type="button" | 239 | type="button" |
239 | class="btn btn-default btn-sm" | 240 | class="btn btn-default btn-sm" |
240 | > | 241 | > |
241 | Totales | 242 | Totales |
242 | </button> | 243 | </button> |
243 | </td> | 244 | </td> |
244 | </tr> | 245 | </tr> |
245 | </tfoot> | 246 | </tfoot> |
246 | </table> | 247 | </table> |
247 | </div> | 248 | </div> |
248 | </div> | 249 | </div> |
249 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> | 250 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> |
250 | <div class="row align-items-end"> | 251 | <div class="row align-items-end"> |
251 | <div class="col-12"> | 252 | <div class="col-12"> |
252 | <button | 253 | <button |
253 | ng-click="crearNotaPedido()" | 254 | ng-click="crearNotaPedido()" |
254 | type="submit" | 255 | type="submit" |
255 | title="Crear nota pedido" | 256 | title="Crear nota pedido" |
256 | class="btn btn-default btn-block mb-2"> | 257 | class="btn btn-default btn-block mb-2"> |
257 | Guardar | 258 | Guardar |
258 | </button> | 259 | </button> |
259 | <button | 260 | <button |
260 | ng-click="salir()" | 261 | ng-click="salir()" |
261 | type="button" | 262 | type="button" |
262 | title="Salir" | 263 | title="Salir" |
263 | class="btn btn-default btn-block"> | 264 | class="btn btn-default btn-block"> |
264 | Salir | 265 | Salir |
265 | </button> | 266 | </button> |
266 | </div> | 267 | </div> |
267 | </div> | 268 | </div> |
268 | </div> | 269 | </div> |
269 | </div> | 270 | </div> |
270 | </div> | 271 | </div> |
271 | 272 |