Commit fd7e00c8eb0bd61a9be36200a71da7df855a282d
1 parent
af5dab89fe
Exists in
master
limpio pantalla despues de crear nota pedido
Showing
1 changed file
with
13 additions
and
1 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
2 | .controller('notaPedidoCtrl', | 2 | .controller('notaPedidoCtrl', |
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.show = false; | 5 | $scope.show = false; |
6 | $scope.cargando = true; | 6 | $scope.cargando = true; |
7 | $scope.dateOptions = { | 7 | $scope.dateOptions = { |
8 | maxDate: new Date(), | 8 | maxDate: new Date(), |
9 | minDate: new Date(2010, 0, 1) | 9 | minDate: new Date(2010, 0, 1) |
10 | }; | 10 | }; |
11 | $scope.notaPedido = { | 11 | $scope.notaPedido = { |
12 | vendedor: {}, | 12 | vendedor: {}, |
13 | cliente: {} | 13 | cliente: {} |
14 | }; | 14 | }; |
15 | $scope.articulosTabla = []; | 15 | $scope.articulosTabla = []; |
16 | var idLista; | 16 | var idLista; |
17 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 17 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
18 | $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); | 18 | $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); |
19 | crearNotaPedidoService.getPrecioCondicion().then( | 19 | crearNotaPedidoService.getPrecioCondicion().then( |
20 | function(res) { | 20 | function(res) { |
21 | $scope.precioCondiciones = res.data; | 21 | $scope.precioCondiciones = res.data; |
22 | } | 22 | } |
23 | ); | 23 | ); |
24 | if (notaPedidoTemp !== undefined) { | 24 | if (notaPedidoTemp !== undefined) { |
25 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 25 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
26 | $scope.notaPedido = notaPedidoTemp; | 26 | $scope.notaPedido = notaPedidoTemp; |
27 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 27 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
28 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 28 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
29 | idLista = $scope.notaPedido.precioCondicion; | 29 | idLista = $scope.notaPedido.precioCondicion; |
30 | crearNotaPedidoService | 30 | crearNotaPedidoService |
31 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 31 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
32 | function(res) { | 32 | function(res) { |
33 | $scope.articulosTabla = res.data; | 33 | $scope.articulosTabla = res.data; |
34 | } | 34 | } |
35 | ); | 35 | ); |
36 | crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 36 | crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
37 | function(res) { | 37 | function(res) { |
38 | $scope.notaPedido.domicilio = res.data; | 38 | $scope.notaPedido.domicilio = res.data; |
39 | } | 39 | } |
40 | ); | 40 | ); |
41 | } else { | 41 | } else { |
42 | $scope.notaPedido.fechaCarga = new Date(); | 42 | $scope.notaPedido.fechaCarga = new Date(); |
43 | $scope.notaPedido.domicilio = [{ id: 0 }]; | 43 | $scope.notaPedido.domicilio = [{ id: 0 }]; |
44 | $scope.notaPedido.bomba = '1'; | 44 | $scope.notaPedido.bomba = '1'; |
45 | $scope.notaPedido.flete = '0'; | 45 | $scope.notaPedido.flete = '0'; |
46 | idLista = undefined; | 46 | idLista = undefined; |
47 | } | 47 | } |
48 | $scope.addNewDom = function() { | 48 | $scope.addNewDom = function() { |
49 | $scope.notaPedido.domicilio.push({ 'id': 0 }); | 49 | $scope.notaPedido.domicilio.push({ 'id': 0 }); |
50 | }; | 50 | }; |
51 | $scope.removeNewChoice = function(choice) { | 51 | $scope.removeNewChoice = function(choice) { |
52 | if ($scope.notaPedido.domicilio.length > 1) { | 52 | if ($scope.notaPedido.domicilio.length > 1) { |
53 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 53 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
54 | function(c) { | 54 | function(c) { |
55 | return c.$$hashKey === choice.$$hashKey; | 55 | return c.$$hashKey === choice.$$hashKey; |
56 | } | 56 | } |
57 | ), 1); | 57 | ), 1); |
58 | } | 58 | } |
59 | }; | 59 | }; |
60 | $scope.crearNotaPedido = function() { | 60 | $scope.crearNotaPedido = function() { |
61 | var notaPedido = { | 61 | var notaPedido = { |
62 | id: 0, | 62 | id: 0, |
63 | fechaCarga: $scope.notaPedido.fechaCarga, | 63 | fechaCarga: $scope.notaPedido.fechaCarga, |
64 | vendedor: $scope.notaPedido.vendedor.nombre, | 64 | vendedor: $scope.notaPedido.vendedor.nombre, |
65 | cliente: $scope.notaPedido.cliente.nombre, | 65 | cliente: $scope.notaPedido.cliente.nombre, |
66 | domicilio: $scope.notaPedido.domicilio.id, | 66 | domicilio: $scope.notaPedido.domicilio.id, |
67 | precioCondicion: $scope.notaPedido.precioCondicion, | 67 | precioCondicion: $scope.notaPedido.precioCondicion, |
68 | bomba: $scope.notaPedido.bomba, | 68 | bomba: $scope.notaPedido.bomba, |
69 | flete: $scope.notaPedido.flete, | 69 | flete: $scope.notaPedido.flete, |
70 | total: $scope.getTotal() | 70 | total: $scope.getTotal() |
71 | }; | 71 | }; |
72 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 72 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
73 | function() { | 73 | function() { |
74 | focaModalService.alert('Nota pedido creada'); | 74 | focaModalService.alert('Nota pedido creada'); |
75 | // $location.path('/venta-nota-pedido'); | 75 | // $location.path('/venta-nota-pedido'); |
76 | // var flete = { | 76 | // var flete = { |
77 | // idNotaPedido: data.data.id, | 77 | // idNotaPedido: data.data.id, |
78 | // idTransportista: $scope.notaPedido.fleteId, | 78 | // idTransportista: $scope.notaPedido.fleteId, |
79 | // idChofer: $scope.chofer.id, | 79 | // idChofer: $scope.chofer.id, |
80 | // idVehiculo: $scope.vehiculo.id, | 80 | // idVehiculo: $scope.vehiculo.id, |
81 | // kilometros: $scope.notaPedido.kilometros, | 81 | // kilometros: $scope.notaPedido.kilometros, |
82 | // costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 82 | // costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
83 | // }; | 83 | // }; |
84 | //TO DO - Insert de flete | 84 | //TO DO - Insert de flete |
85 | } | 85 | } |
86 | ); | 86 | ); |
87 | var articulosNotaPedido = $scope.articulosTabla; | 87 | var articulosNotaPedido = $scope.articulosTabla; |
88 | for(var i = 0; i< articulosNotaPedido.length;i++) { | 88 | for(var i = 0; i< articulosNotaPedido.length;i++) { |
89 | articulosNotaPedido.edit = undefined; | ||
89 | crearNotaPedidoService | 90 | crearNotaPedidoService |
90 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( | 91 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( |
91 | function() { | 92 | function() { |
92 | return; | 93 | return; |
93 | } | 94 | } |
94 | ); | 95 | ); |
95 | } | 96 | } |
96 | 97 | $scope.notaPedido.precioCondicion = ''; | |
98 | $scope.articulosTabla = []; | ||
99 | $scope.notaPedido.fleteNombre = ''; | ||
100 | $scope.notaPedido.chofer = ''; | ||
101 | $scope.notaPedido.vehiculo = ''; | ||
102 | $scope.notaPedido.kilometros = ''; | ||
103 | $scope.notaPedido.costoUnitarioKmFlete = ''; | ||
104 | $scope.notaPedido.vendedor.nombre = ''; | ||
105 | $scope.notaPedido.cliente.nombre = ''; | ||
106 | $scope.domicilio.dom = ''; | ||
107 | $scope.notaPedido.flete = 0; | ||
108 | focaModalService.alert('Nota de pedido creada'); | ||
97 | }; | 109 | }; |
98 | $scope.siguienteTab = function() { | 110 | $scope.siguienteTab = function() { |
99 | $scope.active = 1; | 111 | $scope.active = 1; |
100 | }; | 112 | }; |
101 | $scope.seleccionarArticulo = function() { | 113 | $scope.seleccionarArticulo = function() { |
102 | if (idLista === undefined) { | 114 | if (idLista === undefined) { |
103 | focaModalService.alert( | 115 | focaModalService.alert( |
104 | 'primero seleccione una lista de precio y condicion'); | 116 | 'primero seleccione una lista de precio y condicion'); |
105 | return; | 117 | return; |
106 | } | 118 | } |
107 | var modalInstance = $uibModal.open( | 119 | var modalInstance = $uibModal.open( |
108 | { | 120 | { |
109 | ariaLabelledBy: 'Busqueda de Productos', | 121 | ariaLabelledBy: 'Busqueda de Productos', |
110 | templateUrl: 'modal-busqueda-productos.html', | 122 | templateUrl: 'modal-busqueda-productos.html', |
111 | controller: 'modalBusquedaProductosCtrl', | 123 | controller: 'modalBusquedaProductosCtrl', |
112 | resolve: { idLista: function() { return idLista; } }, | 124 | resolve: { idLista: function() { return idLista; } }, |
113 | size: 'lg' | 125 | size: 'lg' |
114 | } | 126 | } |
115 | ); | 127 | ); |
116 | modalInstance.result.then( | 128 | modalInstance.result.then( |
117 | function(producto) { | 129 | function(producto) { |
118 | var newArt = | 130 | var newArt = |
119 | { | 131 | { |
120 | id: 0, | 132 | id: 0, |
121 | codigo: producto.codigo, | 133 | codigo: producto.codigo, |
122 | sector: producto.sector, | 134 | sector: producto.sector, |
123 | descripcion: producto.descripcion, | 135 | descripcion: producto.descripcion, |
124 | item: $scope.articulosTabla.length + 1, | 136 | item: $scope.articulosTabla.length + 1, |
125 | nombre: producto.descripcion, | 137 | nombre: producto.descripcion, |
126 | precio: producto.precio.toFixed(2), | 138 | precio: producto.precio.toFixed(2), |
127 | costoUnitario: producto.costo, | 139 | costoUnitario: producto.costo, |
128 | edit: false | 140 | edit: false |
129 | }; | 141 | }; |
130 | $scope.articuloACargar = newArt; | 142 | $scope.articuloACargar = newArt; |
131 | $scope.cargando = false; | 143 | $scope.cargando = false; |
132 | }, function() { | 144 | }, function() { |
133 | // funcion ejecutada cuando se cancela el modal | 145 | // funcion ejecutada cuando se cancela el modal |
134 | } | 146 | } |
135 | ); | 147 | ); |
136 | }; | 148 | }; |
137 | $scope.seleccionarVendedor = function() { | 149 | $scope.seleccionarVendedor = function() { |
138 | var modalInstance = $uibModal.open( | 150 | var modalInstance = $uibModal.open( |
139 | { | 151 | { |
140 | ariaLabelledBy: 'Busqueda de Vendedores', | 152 | ariaLabelledBy: 'Busqueda de Vendedores', |
141 | templateUrl: 'modal-vendedores.html', | 153 | templateUrl: 'modal-vendedores.html', |
142 | controller: 'modalVendedoresCtrl', | 154 | controller: 'modalVendedoresCtrl', |
143 | size: 'lg' | 155 | size: 'lg' |
144 | } | 156 | } |
145 | ); | 157 | ); |
146 | modalInstance.result.then( | 158 | modalInstance.result.then( |
147 | function(vendedor) { | 159 | function(vendedor) { |
148 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 160 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
149 | }, function() { | 161 | }, function() { |
150 | 162 | ||
151 | } | 163 | } |
152 | ); | 164 | ); |
153 | }; | 165 | }; |
154 | $scope.seleccionarPetrolera = function() { | 166 | $scope.seleccionarPetrolera = function() { |
155 | var modalInstance = $uibModal.open( | 167 | var modalInstance = $uibModal.open( |
156 | { | 168 | { |
157 | ariaLabelledBy: 'Busqueda de Petrolera', | 169 | ariaLabelledBy: 'Busqueda de Petrolera', |
158 | templateUrl: 'modal-petroleras.html', | 170 | templateUrl: 'modal-petroleras.html', |
159 | controller: 'modalPetrolerasCtrl', | 171 | controller: 'modalPetrolerasCtrl', |
160 | size: 'lg' | 172 | size: 'lg' |
161 | } | 173 | } |
162 | ); | 174 | ); |
163 | modalInstance.result.then( | 175 | modalInstance.result.then( |
164 | function(petrolera) { | 176 | function(petrolera) { |
165 | $scope.notaPedido.petrolera = petrolera.NOM; | 177 | $scope.notaPedido.petrolera = petrolera.NOM; |
166 | }, function() { | 178 | }, function() { |
167 | 179 | ||
168 | } | 180 | } |
169 | ); | 181 | ); |
170 | }; | 182 | }; |
171 | $scope.seleccionarCliente = function() { | 183 | $scope.seleccionarCliente = function() { |
172 | var modalInstance = $uibModal.open( | 184 | var modalInstance = $uibModal.open( |
173 | { | 185 | { |
174 | ariaLabelledBy: 'Busqueda de Cliente', | 186 | ariaLabelledBy: 'Busqueda de Cliente', |
175 | templateUrl: 'foca-busqueda-cliente-modal.html', | 187 | templateUrl: 'foca-busqueda-cliente-modal.html', |
176 | controller: 'focaBusquedaClienteModalController', | 188 | controller: 'focaBusquedaClienteModalController', |
177 | size: 'lg' | 189 | size: 'lg' |
178 | } | 190 | } |
179 | ); | 191 | ); |
180 | modalInstance.result.then( | 192 | modalInstance.result.then( |
181 | function(cliente) { | 193 | function(cliente) { |
182 | $scope.notaPedido.cliente.nombre = cliente.nom; | 194 | $scope.notaPedido.cliente.nombre = cliente.nom; |
183 | }, function() { | 195 | }, function() { |
184 | 196 | ||
185 | } | 197 | } |
186 | ); | 198 | ); |
187 | }; | 199 | }; |
188 | $scope.mostrarFichaCliente = function() { | 200 | $scope.mostrarFichaCliente = function() { |
189 | $uibModal.open( | 201 | $uibModal.open( |
190 | { | 202 | { |
191 | ariaLabelledBy: 'Datos del Cliente', | 203 | ariaLabelledBy: 'Datos del Cliente', |
192 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 204 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
193 | controller: 'focaCrearNotaPedidoFichaClienteController', | 205 | controller: 'focaCrearNotaPedidoFichaClienteController', |
194 | size: 'lg' | 206 | size: 'lg' |
195 | } | 207 | } |
196 | ); | 208 | ); |
197 | }; | 209 | }; |
198 | $scope.obtenerDomicilios = function(id) { | 210 | $scope.obtenerDomicilios = function(id) { |
199 | crearNotaPedidoService.getDomicilios(id).then( | 211 | crearNotaPedidoService.getDomicilios(id).then( |
200 | function(res) { | 212 | function(res) { |
201 | $scope.notaPedido.domicilio = res.data; | 213 | $scope.notaPedido.domicilio = res.data; |
202 | } | 214 | } |
203 | ); | 215 | ); |
204 | }; | 216 | }; |
205 | $scope.getTotal = function() { | 217 | $scope.getTotal = function() { |
206 | var total = 0; | 218 | var total = 0; |
207 | var array = $scope.articulosTabla; | 219 | var array = $scope.articulosTabla; |
208 | for (var i = 0; i < array.length; i++) { | 220 | for (var i = 0; i < array.length; i++) { |
209 | total += array[i].precio * array[i].cantidad; | 221 | total += array[i].precio * array[i].cantidad; |
210 | } | 222 | } |
211 | return total.toFixed(2); | 223 | return total.toFixed(2); |
212 | }; | 224 | }; |
213 | $scope.getSubTotal = function() { | 225 | $scope.getSubTotal = function() { |
214 | if($scope.articuloACargar) { | 226 | if($scope.articuloACargar) { |
215 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 227 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
216 | } | 228 | } |
217 | }; | 229 | }; |
218 | $scope.cargarArticulos = function() { | 230 | $scope.cargarArticulos = function() { |
219 | idLista = $scope.notaPedido.precioCondicion; | 231 | idLista = $scope.notaPedido.precioCondicion; |
220 | $scope.articulosTabla = []; | 232 | $scope.articulosTabla = []; |
221 | }; | 233 | }; |
222 | $scope.abrirModalListaPrecio = function() { | 234 | $scope.abrirModalListaPrecio = function() { |
223 | var modalInstance = $uibModal.open( | 235 | var modalInstance = $uibModal.open( |
224 | { | 236 | { |
225 | ariaLabelledBy: 'Busqueda de Precio Condición', | 237 | ariaLabelledBy: 'Busqueda de Precio Condición', |
226 | templateUrl: 'modal-precio-condicion.html', | 238 | templateUrl: 'modal-precio-condicion.html', |
227 | controller: 'focaModalPrecioCondicionController', | 239 | controller: 'focaModalPrecioCondicionController', |
228 | size: 'lg' | 240 | size: 'lg' |
229 | } | 241 | } |
230 | ); | 242 | ); |
231 | modalInstance.result.then( | 243 | modalInstance.result.then( |
232 | function(precioCondicion) { | 244 | function(precioCondicion) { |
233 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 245 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
234 | idLista = precioCondicion.idListaPrecio; | 246 | idLista = precioCondicion.idListaPrecio; |
235 | $scope.articulosTabla = []; | 247 | $scope.articulosTabla = []; |
236 | }, function() { | 248 | }, function() { |
237 | 249 | ||
238 | } | 250 | } |
239 | ); | 251 | ); |
240 | }; | 252 | }; |
241 | $scope.abrirModalFlete = function() { | 253 | $scope.abrirModalFlete = function() { |
242 | if($scope.notaPedido.flete === '1') { | 254 | if($scope.notaPedido.flete === '1') { |
243 | var modalInstance = $uibModal.open( | 255 | var modalInstance = $uibModal.open( |
244 | { | 256 | { |
245 | ariaLabelledBy: 'Busqueda de Flete', | 257 | ariaLabelledBy: 'Busqueda de Flete', |
246 | templateUrl: 'modal-flete.html', | 258 | templateUrl: 'modal-flete.html', |
247 | controller: 'focaModalFleteController', | 259 | controller: 'focaModalFleteController', |
248 | size: 'lg' | 260 | size: 'lg' |
249 | } | 261 | } |
250 | ); | 262 | ); |
251 | modalInstance.result.then( | 263 | modalInstance.result.then( |
252 | function(flete) { | 264 | function(flete) { |
253 | $scope.choferes = ''; | 265 | $scope.choferes = ''; |
254 | $scope.vehiculos = ''; | 266 | $scope.vehiculos = ''; |
255 | $scope.notaPedido.chofer = ''; | 267 | $scope.notaPedido.chofer = ''; |
256 | $scope.notaPedido.vehiculo = ''; | 268 | $scope.notaPedido.vehiculo = ''; |
257 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 269 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
258 | $scope.notaPedido.fleteNombre = flete.nombre; | 270 | $scope.notaPedido.fleteNombre = flete.nombre; |
259 | $scope.notaPedido.fleteId = flete.id; | 271 | $scope.notaPedido.fleteId = flete.id; |
260 | $scope.choferes = flete.chofer; | 272 | $scope.choferes = flete.chofer; |
261 | $scope.vehiculos = flete.vehiculo; | 273 | $scope.vehiculos = flete.vehiculo; |
262 | }, function() { | 274 | }, function() { |
263 | 275 | ||
264 | } | 276 | } |
265 | ); | 277 | ); |
266 | } | 278 | } |
267 | }; | 279 | }; |
268 | $scope.agregarATabla = function(key) { | 280 | $scope.agregarATabla = function(key) { |
269 | if(key === 13) { | 281 | if(key === 13) { |
270 | if($scope.articuloACargar.cantidad === undefined || | 282 | if($scope.articuloACargar.cantidad === undefined || |
271 | $scope.articuloACargar.cantidad === 0 || | 283 | $scope.articuloACargar.cantidad === 0 || |
272 | $scope.articuloACargar.cantidad === null ){ | 284 | $scope.articuloACargar.cantidad === null ){ |
273 | focaModalService.alert('El valor debe ser al menos 1'); | 285 | focaModalService.alert('El valor debe ser al menos 1'); |
274 | return; | 286 | return; |
275 | } | 287 | } |
276 | $scope.articulosTabla.unshift($scope.articuloACargar); | 288 | $scope.articulosTabla.unshift($scope.articuloACargar); |
277 | $scope.cargando = true; | 289 | $scope.cargando = true; |
278 | } | 290 | } |
279 | }; | 291 | }; |
280 | $scope.quitarArticulo = function(key) { | 292 | $scope.quitarArticulo = function(key) { |
281 | $scope.articulosTabla.splice(key, 1); | 293 | $scope.articulosTabla.splice(key, 1); |
282 | }; | 294 | }; |
283 | $scope.editarArticulo = function(key, articulo) { | 295 | $scope.editarArticulo = function(key, articulo) { |
284 | if(key === 13) { | 296 | if(key === 13) { |
285 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 297 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
286 | articulo.cantidad === undefined){ | 298 | articulo.cantidad === undefined){ |
287 | focaModalService.alert('El valor debe ser al menos 1'); | 299 | focaModalService.alert('El valor debe ser al menos 1'); |
288 | return; | 300 | return; |
289 | } | 301 | } |
290 | articulo.edit = false; | 302 | articulo.edit = false; |
291 | } | 303 | } |
292 | }; | 304 | }; |
293 | $scope.cambioEdit = function(articulo) { | 305 | $scope.cambioEdit = function(articulo) { |
294 | articulo.edit = true; | 306 | articulo.edit = true; |
295 | }; | 307 | }; |
296 | $scope.limpiarFlete = function() { | 308 | $scope.limpiarFlete = function() { |
297 | $scope.notaPedido.fleteNombre = ''; | 309 | $scope.notaPedido.fleteNombre = ''; |
298 | $scope.notaPedido.chofer = ''; | 310 | $scope.notaPedido.chofer = ''; |
299 | $scope.notaPedido.vehiculo = ''; | 311 | $scope.notaPedido.vehiculo = ''; |
300 | $scope.notaPedido.kilometros = ''; | 312 | $scope.notaPedido.kilometros = ''; |
301 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 313 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
302 | }; | 314 | }; |
303 | $scope.crearPedidoDemo = function() { | 315 | $scope.crearPedidoDemo = function() { |
304 | focaModalService.alert('Pedido Creado'); | 316 | focaModalService.alert('Pedido Creado'); |
305 | $scope.notaPedido.precioCondicion = ''; | 317 | $scope.notaPedido.precioCondicion = ''; |
306 | $scope.articulosTabla = []; | 318 | $scope.articulosTabla = []; |
307 | $scope.notaPedido.fleteNombre = ''; | 319 | $scope.notaPedido.fleteNombre = ''; |
308 | $scope.notaPedido.chofer = ''; | 320 | $scope.notaPedido.chofer = ''; |
309 | $scope.notaPedido.vehiculo = ''; | 321 | $scope.notaPedido.vehiculo = ''; |
310 | $scope.notaPedido.kilometros = ''; | 322 | $scope.notaPedido.kilometros = ''; |
311 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 323 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
312 | $scope.notaPedido.vendedor.nombre = ''; | 324 | $scope.notaPedido.vendedor.nombre = ''; |
313 | $scope.notaPedido.cliente.nombre = ''; | 325 | $scope.notaPedido.cliente.nombre = ''; |
314 | $scope.domicilio.dom = ''; | 326 | $scope.domicilio.dom = ''; |
315 | $scope.notaPedido.flete = 0; | 327 | $scope.notaPedido.flete = 0; |
316 | }; | 328 | }; |
317 | $scope.resetFilter = function() { | 329 | $scope.resetFilter = function() { |
318 | $scope.articuloACargar = {}; | 330 | $scope.articuloACargar = {}; |
319 | $scope.cargando = true; | 331 | $scope.cargando = true; |
320 | }; | 332 | }; |
321 | } | 333 | } |
322 | ] | 334 | ] |
323 | ) | 335 | ) |
324 | .controller('notaPedidoListaCtrl', [ | 336 | .controller('notaPedidoListaCtrl', [ |
325 | '$scope', | 337 | '$scope', |
326 | 'crearNotaPedidoService', | 338 | 'crearNotaPedidoService', |
327 | '$location', | 339 | '$location', |
328 | function($scope, crearNotaPedidoService, $location) { | 340 | function($scope, crearNotaPedidoService, $location) { |
329 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 341 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
330 | $scope.notaPedidos = datos.data; | 342 | $scope.notaPedidos = datos.data; |
331 | }); | 343 | }); |
332 | $scope.editar = function(notaPedido) { | 344 | $scope.editar = function(notaPedido) { |
333 | crearNotaPedidoService.setNotaPedido(notaPedido); | 345 | crearNotaPedidoService.setNotaPedido(notaPedido); |
334 | $location.path('/venta-nota-pedido/abm/'); | 346 | $location.path('/venta-nota-pedido/abm/'); |
335 | }; | 347 | }; |
336 | $scope.crearPedido = function() { | 348 | $scope.crearPedido = function() { |
337 | crearNotaPedidoService.clearNotaPedido(); | 349 | crearNotaPedidoService.clearNotaPedido(); |
338 | $location.path('/venta-nota-pedido/abm/'); | 350 | $location.path('/venta-nota-pedido/abm/'); |
339 | }; | 351 | }; |
340 | } | 352 | } |
341 | ]) | 353 | ]) |
342 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 354 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
343 | '$scope', | 355 | '$scope', |
344 | 'crearNotaPedidoService', | 356 | 'crearNotaPedidoService', |
345 | '$location', | 357 | '$location', |
346 | function($scope, crearNotaPedidoService, $location) { | 358 | function($scope, crearNotaPedidoService, $location) { |
347 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 359 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
348 | $scope.notaPedidos = datos.data; | 360 | $scope.notaPedidos = datos.data; |
349 | }); | 361 | }); |
350 | $scope.editar = function(notaPedido) { | 362 | $scope.editar = function(notaPedido) { |
351 | crearNotaPedidoService.setNotaPedido(notaPedido); | 363 | crearNotaPedidoService.setNotaPedido(notaPedido); |
352 | $location.path('/venta-nota-pedido/abm/'); | 364 | $location.path('/venta-nota-pedido/abm/'); |
353 | }; | 365 | }; |
354 | $scope.crearPedido = function() { | 366 | $scope.crearPedido = function() { |
355 | crearNotaPedidoService.clearNotaPedido(); | 367 | crearNotaPedidoService.clearNotaPedido(); |
356 | $location.path('/venta-nota-pedido/abm/'); | 368 | $location.path('/venta-nota-pedido/abm/'); |
357 | }; | 369 | }; |
358 | } | 370 | } |
359 | ]); | 371 | ]); |
360 | 372 |