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