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