Commit 8ceb5c49d9ef28a38b4ae2235342f5fbbbb2dbd0
Exists in
master
Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-crear-remito
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', |
4 | 'focaModalService', 'remitoBusinessService', | 4 | 'focaModalService', 'remitoBusinessService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, |
7 | remitoBusinessService | 7 | remitoBusinessService |
8 | ) { | 8 | ) { |
9 | $scope.botonera = [ | 9 | $scope.botonera = [ |
10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, | 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, |
11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
15 | { | 15 | { |
16 | texto: 'Precios y condiciones', | 16 | texto: 'Precios y condiciones', |
17 | accion: function() {$scope.abrirModalListaPrecio();}}, | 17 | accion: function() {$scope.abrirModalListaPrecio();}}, |
18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
19 | {texto: '', accion: function() {}} | 19 | {texto: '', accion: function() {}} |
20 | ]; | 20 | ]; |
21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
22 | 22 | ||
23 | $scope.show = false; | 23 | $scope.show = false; |
24 | $scope.cargando = true; | 24 | $scope.cargando = true; |
25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
28 | }; | 28 | }; |
29 | 29 | ||
30 | $scope.remito = { | 30 | $scope.remito = { |
31 | id: 0, | 31 | id: 0, |
32 | vendedor: {}, | 32 | vendedor: {}, |
33 | cliente: {}, | 33 | cliente: {}, |
34 | proveedor: {}, | 34 | proveedor: {}, |
35 | domicilio: {dom: ''}, | 35 | domicilio: {dom: ''}, |
36 | moneda: {}, | 36 | moneda: {}, |
37 | cotizacion: {} | 37 | cotizacion: {} |
38 | }; | 38 | }; |
39 | |||
40 | $scope.notaPedido = { | ||
41 | id: 0 | ||
42 | }; | ||
39 | var monedaPorDefecto; | 43 | var monedaPorDefecto; |
40 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 44 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
41 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 45 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
42 | monedaPorDefecto = { | 46 | monedaPorDefecto = { |
43 | id: res.data[0].ID, | 47 | id: res.data[0].ID, |
44 | detalle: res.data[0].DETALLE, | 48 | detalle: res.data[0].DETALLE, |
45 | simbolo: res.data[0].SIMBOLO, | 49 | simbolo: res.data[0].SIMBOLO, |
46 | cotizaciones: res.data[0].cotizaciones | 50 | cotizaciones: res.data[0].cotizaciones |
47 | }; | 51 | }; |
48 | addCabecera('Moneda:', monedaPorDefecto.detalle); | 52 | addCabecera('Moneda:', monedaPorDefecto.detalle); |
49 | addCabecera('Fecha cotizacion:', | 53 | addCabecera('Fecha cotizacion:', |
50 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | 54 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); |
51 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | 55 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); |
52 | $scope.remito.moneda = monedaPorDefecto; | 56 | $scope.remito.moneda = monedaPorDefecto; |
53 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; | 57 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; |
54 | }); | 58 | }); |
55 | 59 | ||
56 | $scope.cabecera = []; | 60 | $scope.cabecera = []; |
57 | $scope.showCabecera = true; | 61 | $scope.showCabecera = true; |
58 | 62 | ||
59 | $scope.now = new Date(); | 63 | $scope.now = new Date(); |
60 | $scope.puntoVenta = rellenar(0, 4); | 64 | $scope.puntoVenta = rellenar(0, 4); |
61 | $scope.comprobante = rellenar(0, 8); | 65 | $scope.comprobante = rellenar(0, 8); |
62 | 66 | ||
63 | $scope.articulosTabla = []; | 67 | $scope.articulosTabla = []; |
64 | $scope.idLista = undefined; | 68 | $scope.idLista = undefined; |
65 | //La pantalla solo se usa para cargar remitos | 69 | //La pantalla solo se usa para cargar remitos |
66 | //var remitoTemp = crearRemitoService.getRemito(); | 70 | //var remitoTemp = crearRemitoService.getRemito(); |
67 | 71 | ||
68 | crearRemitoService.getPrecioCondicion().then( | 72 | crearRemitoService.getPrecioCondicion().then( |
69 | function(res) { | 73 | function(res) { |
70 | $scope.precioCondiciones = res.data; | 74 | $scope.precioCondiciones = res.data; |
71 | } | 75 | } |
72 | ); | 76 | ); |
73 | 77 | ||
74 | crearRemitoService.getNumeroRemito().then( | 78 | crearRemitoService.getNumeroRemito().then( |
75 | function(res) { | 79 | function(res) { |
76 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
77 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
78 | }, | 82 | }, |
79 | function(err) { | 83 | function(err) { |
80 | focaModalService.alert('La terminal no esta configurada correctamente'); | 84 | focaModalService.alert('La terminal no esta configurada correctamente'); |
81 | console.info(err); | 85 | console.info(err); |
82 | } | 86 | } |
83 | ); | 87 | ); |
84 | 88 | ||
85 | $scope.seleccionarNotaPedido = function() { | 89 | $scope.seleccionarNotaPedido = function() { |
86 | var modalInstance = $uibModal.open( | 90 | var modalInstance = $uibModal.open( |
87 | { | 91 | { |
88 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 92 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
89 | templateUrl: 'foca-modal-nota-pedido.html', | 93 | templateUrl: 'foca-modal-nota-pedido.html', |
90 | controller: 'focaModalNotaPedidoController', | 94 | controller: 'focaModalNotaPedidoController', |
91 | size: 'lg' | 95 | size: 'lg' |
92 | } | 96 | } |
93 | ); | 97 | ); |
94 | modalInstance.result.then( | 98 | modalInstance.result.then( |
95 | function(notaPedido) { | 99 | function(notaPedido) { |
96 | //añado cabeceras | 100 | //añado cabeceras |
101 | $scope.notaPedido.id = notaPedido.id; | ||
97 | removeCabecera('Moneda:'); | 102 | removeCabecera('Moneda:'); |
98 | removeCabecera('Fecha cotizacion:'); | 103 | removeCabecera('Fecha cotizacion:'); |
99 | removeCabecera('Cotizacion:'); | 104 | removeCabecera('Cotizacion:'); |
100 | var cabeceras = [ | 105 | var cabeceras = [ |
101 | { | 106 | { |
102 | label: 'Moneda', | 107 | label: 'Moneda', |
103 | valor: notaPedido.cotizacion[0].moneda[0].DETALLE | 108 | valor: notaPedido.cotizacion[0].moneda[0].DETALLE |
104 | }, | 109 | }, |
105 | { | 110 | { |
106 | label: 'Fecha cotizacion', | 111 | label: 'Fecha cotizacion', |
107 | valor: $filter('date')(notaPedido.cotizacion[0].FECHA, | 112 | valor: $filter('date')(notaPedido.cotizacion[0].FECHA, |
108 | 'dd/MM/yyyy') | 113 | 'dd/MM/yyyy') |
109 | }, | 114 | }, |
110 | { | 115 | { |
111 | label: 'Cotizacion', | 116 | label: 'Cotizacion', |
112 | valor: notaPedido.cotizacion[0].VENDEDOR | 117 | valor: notaPedido.cotizacion[0].VENDEDOR |
113 | }, | 118 | }, |
114 | { | 119 | { |
115 | label: 'Cliente:', | 120 | label: 'Cliente:', |
116 | valor: notaPedido.cliente[0].NOM | 121 | valor: notaPedido.cliente[0].NOM |
117 | }, | 122 | }, |
118 | { | 123 | { |
119 | label: 'Domicilio:', | 124 | label: 'Domicilio:', |
120 | valor: notaPedido.domicilioStamp | 125 | valor: notaPedido.domicilioStamp |
121 | }, | 126 | }, |
122 | { | 127 | { |
123 | label: 'Vendedor:', | 128 | label: 'Vendedor:', |
124 | valor: notaPedido.vendedor[0].NomVen | 129 | valor: notaPedido.vendedor[0].NomVen |
125 | }, | 130 | }, |
126 | { | 131 | { |
127 | label: 'Proveedor:', | 132 | label: 'Proveedor:', |
128 | valor: notaPedido.proveedor[0].NOM | 133 | valor: notaPedido.proveedor[0].NOM |
129 | }, | 134 | }, |
130 | { | 135 | { |
131 | label: 'Flete:', | 136 | label: 'Flete:', |
132 | valor: notaPedido.flete === 1 ? 'Si' : 'No' | 137 | valor: notaPedido.flete === 1 ? 'Si' : 'No' |
133 | }, | 138 | }, |
134 | { | 139 | { |
135 | label: 'FOB:', | 140 | label: 'FOB:', |
136 | valor: notaPedido.fob === 1 ? 'Si' : 'No' | 141 | valor: notaPedido.fob === 1 ? 'Si' : 'No' |
137 | }, | 142 | }, |
138 | { | 143 | { |
139 | label: 'Precio condicion:', | 144 | label: 'Precio condicion:', |
140 | valor: valorPrecioCondicion() | 145 | valor: valorPrecioCondicion() |
141 | } | 146 | } |
142 | ]; | 147 | ]; |
143 | //TO DO CUANDO MOSTRAR PLAZOS | 148 | //TO DO CUANDO MOSTRAR PLAZOS |
144 | function valorPrecioCondicion() { | 149 | function valorPrecioCondicion() { |
145 | if(notaPedido.idPrecioCondicion > 0) { | 150 | if(notaPedido.idPrecioCondicion > 0) { |
146 | return notaPedido.precioCondicion[0].nombre; | 151 | return notaPedido.precioCondicion[0].nombre; |
147 | } else { | 152 | } else { |
148 | return 'Ingreso Manual'; | 153 | return 'Ingreso Manual'; |
149 | } | 154 | } |
150 | 155 | ||
151 | } | 156 | } |
152 | 157 | ||
153 | if(notaPedido.flete === 1) { | 158 | if(notaPedido.flete === 1) { |
154 | var cabeceraBomba = { | 159 | var cabeceraBomba = { |
155 | label: 'Bomba', | 160 | label: 'Bomba', |
156 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 161 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
157 | }; | 162 | }; |
158 | if(notaPedido.kilometros) { | 163 | if(notaPedido.kilometros) { |
159 | var cabeceraKilometros = { | 164 | var cabeceraKilometros = { |
160 | label: 'Kilometros', | 165 | label: 'Kilometros', |
161 | valor: notaPedido.kilometros | 166 | valor: notaPedido.kilometros |
162 | }; | 167 | }; |
163 | cabeceras.push(cabeceraKilometros); | 168 | cabeceras.push(cabeceraKilometros); |
164 | } | 169 | } |
165 | cabeceras.push(cabeceraBomba); | 170 | cabeceras.push(cabeceraBomba); |
166 | } | 171 | } |
167 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 172 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
168 | if(notaPedido.precioCondicion.length > 0) { | 173 | if(notaPedido.precioCondicion.length > 0) { |
169 | $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; | 174 | $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; |
170 | } else { | 175 | } else { |
171 | $scope.idLista = -1; | 176 | $scope.idLista = -1; |
172 | } | 177 | } |
173 | delete notaPedido.id; | 178 | delete notaPedido.id; |
174 | $scope.remito.domicilioStamp = notaPedido.domicilioStamp; | 179 | $scope.remito.domicilioStamp = notaPedido.domicilioStamp; |
175 | $scope.remito = notaPedido; | 180 | $scope.remito = notaPedido; |
176 | $scope.remito.vendedor = notaPedido.vendedor[0]; | 181 | $scope.remito.vendedor = notaPedido.vendedor[0]; |
177 | $scope.remito.cliente = notaPedido.cliente[0]; | 182 | $scope.remito.cliente = notaPedido.cliente[0]; |
178 | $scope.remito.proveedor = notaPedido.proveedor[0]; | 183 | $scope.remito.proveedor = notaPedido.proveedor[0]; |
179 | $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; | 184 | $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; |
180 | $scope.remito.cotizacion = notaPedido.cotizacion[0]; | 185 | $scope.remito.cotizacion = notaPedido.cotizacion[0]; |
181 | addArrayCabecera(cabeceras); | 186 | addArrayCabecera(cabeceras); |
182 | 187 | ||
183 | }, function() { | 188 | }, function() { |
184 | // funcion ejecutada cuando se cancela el modal | 189 | // funcion ejecutada cuando se cancela el modal |
185 | } | 190 | } |
186 | ); | 191 | ); |
187 | }; | 192 | }; |
188 | 193 | ||
189 | $scope.seleccionarRemito = function() { | 194 | $scope.seleccionarRemito = function() { |
190 | var modalInstance = $uibModal.open( | 195 | var modalInstance = $uibModal.open( |
191 | { | 196 | { |
192 | ariaLabelledBy: 'Busqueda de Remito', | 197 | ariaLabelledBy: 'Busqueda de Remito', |
193 | templateUrl: 'foca-modal-remito.html', | 198 | templateUrl: 'foca-modal-remito.html', |
194 | controller: 'focaModalRemitoController', | 199 | controller: 'focaModalRemitoController', |
195 | size: 'lg' | 200 | size: 'lg' |
196 | } | 201 | } |
197 | ); | 202 | ); |
198 | modalInstance.result.then( | 203 | modalInstance.result.then( |
199 | function(remito) { | 204 | function(remito) { |
200 | //añado cabeceras | 205 | //añado cabeceras |
201 | removeCabecera('Moneda:'); | 206 | removeCabecera('Moneda:'); |
202 | removeCabecera('Fecha cotizacion:'); | 207 | removeCabecera('Fecha cotizacion:'); |
203 | removeCabecera('Cotizacion:'); | 208 | removeCabecera('Cotizacion:'); |
204 | var cabeceras = [ | 209 | var cabeceras = [ |
205 | { | 210 | { |
206 | label: 'Moneda', | 211 | label: 'Moneda', |
207 | valor: remito.cotizacion[0].moneda[0].DETALLE | 212 | valor: remito.cotizacion[0].moneda[0].DETALLE |
208 | }, | 213 | }, |
209 | { | 214 | { |
210 | label: 'Fecha cotizacion', | 215 | label: 'Fecha cotizacion', |
211 | valor: $filter('date')(remito.cotizacion[0].FECHA, | 216 | valor: $filter('date')(remito.cotizacion[0].FECHA, |
212 | 'dd/MM/yyyy') | 217 | 'dd/MM/yyyy') |
213 | }, | 218 | }, |
214 | { | 219 | { |
215 | label: 'Cotizacion', | 220 | label: 'Cotizacion', |
216 | valor: remito.cotizacion[0].VENDEDOR | 221 | valor: remito.cotizacion[0].VENDEDOR |
217 | }, | 222 | }, |
218 | { | 223 | { |
219 | label: 'Cliente:', | 224 | label: 'Cliente:', |
220 | valor: remito.cliente[0].NOM | 225 | valor: remito.cliente[0].NOM |
221 | }, | 226 | }, |
222 | { | 227 | { |
223 | label: 'Domicilio:', | 228 | label: 'Domicilio:', |
224 | valor: remito.domicilioStamp | 229 | valor: remito.domicilioStamp |
225 | }, | 230 | }, |
226 | { | 231 | { |
227 | label: 'Vendedor:', | 232 | label: 'Vendedor:', |
228 | valor: remito.vendedor[0].NomVen | 233 | valor: remito.vendedor[0].NomVen |
229 | }, | 234 | }, |
230 | { | 235 | { |
231 | label: 'Proveedor:', | 236 | label: 'Proveedor:', |
232 | valor: remito.proveedor[0].NOM | 237 | valor: remito.proveedor[0].NOM |
233 | }, | 238 | }, |
234 | { | 239 | { |
235 | label: 'Flete:', | 240 | label: 'Flete:', |
236 | valor: remito.flete === 1 ? 'Si' : 'No' | 241 | valor: remito.flete === 1 ? 'Si' : 'No' |
237 | }, | 242 | }, |
238 | { | 243 | { |
239 | label: 'FOB:', | 244 | label: 'FOB:', |
240 | valor: remito.fob === 1 ? 'Si' : 'No' | 245 | valor: remito.fob === 1 ? 'Si' : 'No' |
241 | }, | 246 | }, |
242 | { | 247 | { |
243 | label: 'Precio condicion:', | 248 | label: 'Precio condicion:', |
244 | valor: valorPrecioCondicion() | 249 | valor: valorPrecioCondicion() |
245 | } | 250 | } |
246 | ]; | 251 | ]; |
247 | //TO DO CUANDO MOSTRAR PLAZOS | 252 | //TO DO CUANDO MOSTRAR PLAZOS |
248 | function valorPrecioCondicion() { | 253 | function valorPrecioCondicion() { |
249 | if(remito.idPrecioCondicion > 0) { | 254 | if(remito.idPrecioCondicion > 0) { |
250 | return remito.precioCondicion[0].nombre; | 255 | return remito.precioCondicion[0].nombre; |
251 | } else { | 256 | } else { |
252 | return 'Ingreso Manual'; | 257 | return 'Ingreso Manual'; |
253 | } | 258 | } |
254 | 259 | ||
255 | } | 260 | } |
256 | 261 | ||
257 | if(remito.flete === 1) { | 262 | if(remito.flete === 1) { |
258 | var cabeceraBomba = { | 263 | var cabeceraBomba = { |
259 | label: 'Bomba', | 264 | label: 'Bomba', |
260 | valor: remito.bomba === 1 ? 'Si' : 'No' | 265 | valor: remito.bomba === 1 ? 'Si' : 'No' |
261 | }; | 266 | }; |
262 | if(remito.kilometros) { | 267 | if(remito.kilometros) { |
263 | var cabeceraKilometros = { | 268 | var cabeceraKilometros = { |
264 | label: 'Kilometros', | 269 | label: 'Kilometros', |
265 | valor: remito.kilometros | 270 | valor: remito.kilometros |
266 | }; | 271 | }; |
267 | cabeceras.push(cabeceraKilometros); | 272 | cabeceras.push(cabeceraKilometros); |
268 | } | 273 | } |
269 | cabeceras.push(cabeceraBomba); | 274 | cabeceras.push(cabeceraBomba); |
270 | } | 275 | } |
271 | $scope.articulosTabla = remito.articulosRemito; | 276 | $scope.articulosTabla = remito.articulosRemito; |
272 | if(remito.precioCondicion.length > 0) { | 277 | if(remito.precioCondicion.length > 0) { |
273 | $scope.idLista = remito.precioCondicion[0].idListaPrecio; | 278 | $scope.idLista = remito.precioCondicion[0].idListaPrecio; |
274 | } else { | 279 | } else { |
275 | $scope.idLista = -1; | 280 | $scope.idLista = -1; |
276 | } | 281 | } |
277 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 282 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
278 | $scope.remito = remito; | 283 | $scope.remito = remito; |
279 | $scope.remito.vendedor = remito.vendedor[0]; | 284 | $scope.remito.vendedor = remito.vendedor[0]; |
280 | $scope.remito.cliente = remito.cliente[0]; | 285 | $scope.remito.cliente = remito.cliente[0]; |
281 | $scope.remito.proveedor = remito.proveedor[0]; | 286 | $scope.remito.proveedor = remito.proveedor[0]; |
282 | $scope.remito.moneda = remito.cotizacion[0].moneda[0]; | 287 | $scope.remito.moneda = remito.cotizacion[0].moneda[0]; |
283 | $scope.remito.cotizacion = remito.cotizacion[0]; | 288 | $scope.remito.cotizacion = remito.cotizacion[0]; |
284 | addArrayCabecera(cabeceras); | 289 | addArrayCabecera(cabeceras); |
285 | }, function() { | 290 | }, function() { |
286 | // funcion ejecutada cuando se cancela el modal | 291 | // funcion ejecutada cuando se cancela el modal |
287 | } | 292 | } |
288 | ); | 293 | ); |
289 | }; | 294 | }; |
290 | 295 | ||
291 | //La pantalla solo se usa para cargar remitos | 296 | //La pantalla solo se usa para cargar remitos |
292 | // if (remitoTemp !== undefined) { | 297 | // if (remitoTemp !== undefined) { |
293 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 298 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
294 | // $scope.remito = remitoTemp; | 299 | // $scope.remito = remitoTemp; |
295 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 300 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
296 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 301 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
297 | // $scope.idLista = $scope.remito.precioCondicion; | 302 | // $scope.idLista = $scope.remito.precioCondicion; |
298 | // crearRemitoService | 303 | // crearRemitoService |
299 | // .getArticulosByIdRemito($scope.remito.id).then( | 304 | // .getArticulosByIdRemito($scope.remito.id).then( |
300 | // function(res) { | 305 | // function(res) { |
301 | // $scope.articulosTabla = res.data; | 306 | // $scope.articulosTabla = res.data; |
302 | // } | 307 | // } |
303 | // ); | 308 | // ); |
304 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 309 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
305 | //(NO REQUERIDO EN ESTA VERSION) | 310 | //(NO REQUERIDO EN ESTA VERSION) |
306 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 311 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
307 | // function(res) { | 312 | // function(res) { |
308 | // $scope.remito.domicilio = res.data; | 313 | // $scope.remito.domicilio = res.data; |
309 | // } | 314 | // } |
310 | // ); | 315 | // ); |
311 | // } else { | 316 | // } else { |
312 | // $scope.remito.fechaCarga = new Date(); | 317 | // $scope.remito.fechaCarga = new Date(); |
313 | // $scope.remito.bomba = '0'; | 318 | // $scope.remito.bomba = '0'; |
314 | // $scope.remito.flete = '0'; | 319 | // $scope.remito.flete = '0'; |
315 | // $scope.idLista = undefined; | 320 | // $scope.idLista = undefined; |
316 | // } | 321 | // } |
317 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 322 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
318 | // $scope.addNewDom = function() { | 323 | // $scope.addNewDom = function() { |
319 | // $scope.remito.domicilio.push({ 'id': 0 }); | 324 | // $scope.remito.domicilio.push({ 'id': 0 }); |
320 | // }; | 325 | // }; |
321 | // $scope.removeNewChoice = function(choice) { | 326 | // $scope.removeNewChoice = function(choice) { |
322 | // if ($scope.remito.domicilio.length > 1) { | 327 | // if ($scope.remito.domicilio.length > 1) { |
323 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 328 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
324 | // function(c) { | 329 | // function(c) { |
325 | // return c.$$hashKey === choice.$$hashKey; | 330 | // return c.$$hashKey === choice.$$hashKey; |
326 | // } | 331 | // } |
327 | // ), 1); | 332 | // ), 1); |
328 | // } | 333 | // } |
329 | // }; | 334 | // }; |
330 | //validacion por domicilio y por plazo pago | 335 | //validacion por domicilio y por plazo pago |
331 | $scope.crearRemito = function() { | 336 | $scope.crearRemito = function() { |
332 | if(!$scope.remito.vendedor) { | 337 | if(!$scope.remito.vendedor) { |
333 | focaModalService.alert('Ingrese Vendedor'); | 338 | focaModalService.alert('Ingrese Vendedor'); |
334 | return; | 339 | return; |
335 | } else if(!$scope.remito.cliente) { | 340 | } else if(!$scope.remito.cliente) { |
336 | focaModalService.alert('Ingrese Cliente'); | 341 | focaModalService.alert('Ingrese Cliente'); |
337 | return; | 342 | return; |
338 | } else if(!$scope.remito.proveedor) { | 343 | } else if(!$scope.remito.proveedor) { |
339 | focaModalService.alert('Ingrese Proveedor'); | 344 | focaModalService.alert('Ingrese Proveedor'); |
340 | return; | 345 | return; |
341 | } else if(!$scope.remito.moneda.ID) { | 346 | } else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { |
342 | focaModalService.alert('Ingrese Moneda'); | 347 | focaModalService.alert('Ingrese Moneda'); |
343 | return; | 348 | return; |
344 | } else if(!$scope.remito.cotizacion.ID) { | 349 | } else if(!$scope.remito.cotizacion.ID) { |
345 | focaModalService.alert('Ingrese Cotización'); | 350 | focaModalService.alert('Ingrese Cotización'); |
346 | return; | 351 | return; |
347 | } else if( | 352 | } else if( |
348 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 353 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
349 | { | 354 | { |
350 | focaModalService.alert('Ingrese Flete'); | 355 | focaModalService.alert('Ingrese Flete'); |
351 | return; | 356 | return; |
352 | } else if($scope.articulosTabla.length === 0) { | 357 | } else if($scope.articulosTabla.length === 0) { |
353 | focaModalService.alert('Debe cargar al menos un articulo'); | 358 | focaModalService.alert('Debe cargar al menos un articulo'); |
354 | return; | 359 | return; |
355 | } | 360 | } |
356 | var date = new Date(); | 361 | var date = new Date(); |
357 | var remito = { | 362 | var save = { |
358 | id: $scope.remito.id, | 363 | remito: { |
359 | fechaRemito: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 364 | id: 0, |
360 | .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter | 365 | fechaRemito: |
361 | idCliente: $scope.remito.cliente.COD, | 366 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
362 | nombreCliente: $scope.remito.cliente.NOM, | 367 | .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter |
363 | cuitCliente: $scope.remito.cliente.CUIT, | 368 | idCliente: $scope.remito.idCliente, |
364 | responsabilidadIvaCliente: 0,//TODO, | 369 | nombreCliente: $scope.remito.nombreCliente, |
365 | descuento: 0,//TODO, | 370 | cuitCliente: $scope.remito.cuitCliente, |
366 | importeNeto: 0,//TODO | 371 | responsabilidadIvaCliente: 0,//TODO, |
367 | importeExento: 0,//TODO | 372 | descuento: 0,//TODO, |
368 | importeIva: 0,//TODO | 373 | importeNeto: 0,//TODO |
369 | importeIvaServicios: 0,//TODO | 374 | importeExento: 0,//TODO |
370 | importeImpuestoInterno: 0,//TODO | 375 | importeIva: 0,//TODO |
371 | importeImpuestoInterno1: 0,//TODO | 376 | importeIvaServicios: 0,//TODO |
372 | importeImpuestoInterno2: 0,//TODO | 377 | importeImpuestoInterno: 0,//TODO |
373 | percepcion: 0,//TODO | 378 | importeImpuestoInterno1: 0,//TODO |
374 | percepcionIva: 0,//TODO | 379 | importeImpuestoInterno2: 0,//TODO |
375 | redondeo: 0,//TODO | 380 | percepcion: 0,//TODO |
376 | total: $scope.getTotal(), | 381 | percepcionIva: 0,//TODO |
377 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 382 | redondeo: 0,//TODO |
378 | anulado: false, | 383 | total: $scope.getTotal(), |
379 | planilla: 0,//TODO | 384 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
380 | lugar: 0,//TODO | 385 | anulado: false, |
381 | cuentaMadre: 0,// | 386 | planilla: 0,//TODO |
382 | cuentaContable: 0,//TODO | 387 | lugar: 0,//TODO |
383 | asiento: 0,//TODO | 388 | cuentaMadre: 0,// |
384 | e_hd: '',//TODO | 389 | cuentaContable: 0,//TODO |
385 | c_hd: '', | 390 | asiento: 0,//TODO |
386 | numeroLiquidoProducto: 0,//TODO | 391 | e_hd: '',//TODO |
387 | idVendedor: $scope.remito.idVendedor, | 392 | c_hd: '', |
388 | idProveedor: $scope.remito.idProveedor, | 393 | numeroLiquidoProducto: 0,//TODO |
389 | idDomicilio: 0,//TODO | 394 | idVendedor: $scope.remito.idVendedor, |
390 | domicilioStamp: $scope.remito.domicilioStamp, | 395 | idProveedor: $scope.remito.idProveedor, |
391 | idCotizacion: $scope.remito.cotizacion.ID, | 396 | idDomicilio: 0,//TODO |
392 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 397 | idCotizacion: $scope.remito.idCotizacion, |
393 | flete: $scope.remito.flete, | 398 | flete: $scope.remito.flete, |
394 | fob: $scope.remito.fob, | 399 | fob: $scope.remito.fob, |
395 | bomba: $scope.remito.bomba, | 400 | bomba: $scope.remito.bomba, |
396 | kilometros: $scope.remito.kilometros, | 401 | kilometros: $scope.remito.kilometros, |
397 | estado: 0,//TODO | 402 | estado: 0,//TODO |
398 | destinoVenta: 0,//TODO | 403 | destinoVenta: 0,//TODO |
404 | operacionTipo: 0//TODO | ||
405 | }, | ||
399 | operacionTipo: 0//TODO | 406 | notaPedido: $scope.notaPedido |
400 | }; | 407 | }; |
401 | crearRemitoService.crearRemito(remito).then( | 408 | crearRemitoService.crearRemito(save).then( |
402 | function(data) { | 409 | function(data) { |
403 | remitoBusinessService.addArticulos($scope.articulosTabla, | 410 | remitoBusinessService.addArticulos($scope.articulosTabla, |
404 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 411 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
405 | 412 | ||
406 | focaModalService.alert('Nota remito creada'); | 413 | focaModalService.alert('Nota remito creada'); |
407 | $scope.cabecera = []; | 414 | $scope.cabecera = []; |
408 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); | 415 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); |
409 | addCabecera( | 416 | addCabecera( |
410 | 'Fecha cotizacion:', | 417 | 'Fecha cotizacion:', |
411 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 418 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
412 | ); | 419 | ); |
413 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 420 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
414 | $scope.remito.vendedor = {}; | 421 | $scope.remito.vendedor = {}; |
415 | $scope.remito.cliente = {}; | 422 | $scope.remito.cliente = {}; |
416 | $scope.remito.proveedor = {}; | 423 | $scope.remito.proveedor = {}; |
417 | $scope.remito.domicilio = {}; | 424 | $scope.remito.domicilio = {}; |
418 | $scope.remito.flete = null; | 425 | $scope.remito.flete = null; |
419 | $scope.remito.fob = null; | 426 | $scope.remito.fob = null; |
420 | $scope.remito.bomba = null; | 427 | $scope.remito.bomba = null; |
421 | $scope.remito.kilometros = null; | 428 | $scope.remito.kilometros = null; |
422 | $scope.articulosTabla = []; | 429 | $scope.articulosTabla = []; |
423 | crearRemitoService.getNumeroRemito().then( | 430 | crearRemitoService.getNumeroRemito().then( |
424 | function(res) { | 431 | function(res) { |
425 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 432 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
426 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 433 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
427 | }, | 434 | }, |
428 | function(err) { | 435 | function(err) { |
429 | focaModalService | 436 | focaModalService |
430 | .alert('La terminal no esta configurada correctamente'); | 437 | .alert('La terminal no esta configurada correctamente'); |
431 | console.info(err); | 438 | console.info(err); |
432 | } | 439 | } |
440 | ); | ||
441 | |||
442 | $scope.notaPedido = { | ||
443 | id: 0 | ||
433 | ); | 444 | }; |
434 | } | 445 | } |
435 | ); | 446 | ); |
436 | }; | 447 | }; |
437 | 448 | ||
438 | $scope.seleccionarArticulo = function() { | 449 | $scope.seleccionarArticulo = function() { |
439 | if ($scope.idLista === undefined) { | 450 | if ($scope.idLista === undefined) { |
440 | focaModalService.alert( | 451 | focaModalService.alert( |
441 | 'Primero seleccione una lista de precio y condicion'); | 452 | 'Primero seleccione una lista de precio y condicion'); |
442 | return; | 453 | return; |
443 | } | 454 | } |
444 | var modalInstance = $uibModal.open( | 455 | var modalInstance = $uibModal.open( |
445 | { | 456 | { |
446 | ariaLabelledBy: 'Busqueda de Productos', | 457 | ariaLabelledBy: 'Busqueda de Productos', |
447 | templateUrl: 'modal-busqueda-productos.html', | 458 | templateUrl: 'modal-busqueda-productos.html', |
448 | controller: 'modalBusquedaProductosCtrl', | 459 | controller: 'modalBusquedaProductosCtrl', |
449 | resolve: { | 460 | resolve: { |
450 | parametroProducto: { | 461 | parametroProducto: { |
451 | idLista: $scope.idLista, | 462 | idLista: $scope.idLista, |
452 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 463 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
453 | simbolo: $scope.remito.moneda.simbolo | 464 | simbolo: $scope.remito.moneda.simbolo |
454 | } | 465 | } |
455 | }, | 466 | }, |
456 | size: 'lg' | 467 | size: 'lg' |
457 | } | 468 | } |
458 | ); | 469 | ); |
459 | modalInstance.result.then( | 470 | modalInstance.result.then( |
460 | function(producto) { | 471 | function(producto) { |
461 | var newArt = | 472 | var newArt = |
462 | { | 473 | { |
463 | id: 0, | 474 | id: 0, |
464 | codigo: producto.codigo, | 475 | codigo: producto.codigo, |
465 | sector: producto.sector, | 476 | sector: producto.sector, |
466 | sectorCodigo: producto.sector + '-' + producto.codigo, | 477 | sectorCodigo: producto.sector + '-' + producto.codigo, |
467 | descripcion: producto.descripcion, | 478 | descripcion: producto.descripcion, |
468 | item: $scope.articulosTabla.length + 1, | 479 | item: $scope.articulosTabla.length + 1, |
469 | nombre: producto.descripcion, | 480 | nombre: producto.descripcion, |
470 | precio: parseFloat(producto.precio.toFixed(4)), | 481 | precio: parseFloat(producto.precio.toFixed(4)), |
471 | costoUnitario: producto.costo, | 482 | costoUnitario: producto.costo, |
472 | editCantidad: false, | 483 | editCantidad: false, |
473 | editPrecio: false, | 484 | editPrecio: false, |
474 | rubro: producto.CodRub, | 485 | rubro: producto.CodRub, |
475 | exentoUnitario: producto.precio, | 486 | exentoUnitario: producto.precio, |
476 | ivaUnitario: producto.IMPIVA, | 487 | ivaUnitario: producto.IMPIVA, |
477 | impuestoInternoUnitario: producto.ImpInt, | 488 | impuestoInternoUnitario: producto.ImpInt, |
478 | impuestoInterno1Unitario: producto.ImpInt2, | 489 | impuestoInterno1Unitario: producto.ImpInt2, |
479 | impuestoInterno2Unitario: producto.ImpInt3, | 490 | impuestoInterno2Unitario: producto.ImpInt3, |
480 | precioLista: producto.precio, | 491 | precioLista: producto.precio, |
481 | combustible: 1, | 492 | combustible: 1, |
482 | facturado: 0 | 493 | facturado: 0 |
483 | }; | 494 | }; |
484 | $scope.articuloACargar = newArt; | 495 | $scope.articuloACargar = newArt; |
485 | $scope.cargando = false; | 496 | $scope.cargando = false; |
486 | }, function() { | 497 | }, function() { |
487 | // funcion ejecutada cuando se cancela el modal | 498 | // funcion ejecutada cuando se cancela el modal |
488 | } | 499 | } |
489 | ); | 500 | ); |
490 | }; | 501 | }; |
491 | 502 | ||
492 | $scope.seleccionarVendedor = function() { | 503 | $scope.seleccionarVendedor = function() { |
493 | var modalInstance = $uibModal.open( | 504 | var modalInstance = $uibModal.open( |
494 | { | 505 | { |
495 | ariaLabelledBy: 'Busqueda de Vendedores', | 506 | ariaLabelledBy: 'Busqueda de Vendedores', |
496 | templateUrl: 'modal-vendedores.html', | 507 | templateUrl: 'modal-vendedores.html', |
497 | controller: 'modalVendedoresCtrl', | 508 | controller: 'modalVendedoresCtrl', |
498 | size: 'lg' | 509 | size: 'lg' |
499 | } | 510 | } |
500 | ); | 511 | ); |
501 | modalInstance.result.then( | 512 | modalInstance.result.then( |
502 | function(vendedor) { | 513 | function(vendedor) { |
503 | addCabecera('Vendedor:', vendedor.NomVen); | 514 | addCabecera('Vendedor:', vendedor.NomVen); |
504 | $scope.remito.idVendedor = vendedor.CodVen; | 515 | $scope.remito.idVendedor = vendedor.CodVen; |
505 | }, function() { | 516 | }, function() { |
506 | 517 | ||
507 | } | 518 | } |
508 | ); | 519 | ); |
509 | }; | 520 | }; |
510 | 521 | ||
511 | $scope.seleccionarProveedor = function() { | 522 | $scope.seleccionarProveedor = function() { |
512 | var modalInstance = $uibModal.open( | 523 | var modalInstance = $uibModal.open( |
513 | { | 524 | { |
514 | ariaLabelledBy: 'Busqueda de Proveedor', | 525 | ariaLabelledBy: 'Busqueda de Proveedor', |
515 | templateUrl: 'modal-proveedor.html', | 526 | templateUrl: 'modal-proveedor.html', |
516 | controller: 'focaModalProveedorCtrl', | 527 | controller: 'focaModalProveedorCtrl', |
517 | size: 'lg', | 528 | size: 'lg', |
518 | resolve: { | 529 | resolve: { |
519 | transportista: function() { | 530 | transportista: function() { |
520 | return false; | 531 | return false; |
521 | } | 532 | } |
522 | } | 533 | } |
523 | } | 534 | } |
524 | ); | 535 | ); |
525 | modalInstance.result.then( | 536 | modalInstance.result.then( |
526 | function(proveedor) { | 537 | function(proveedor) { |
527 | $scope.remito.idProveedor = proveedor.COD; | 538 | $scope.remito.idProveedor = proveedor.COD; |
528 | addCabecera('Proveedor:', proveedor.NOM); | 539 | addCabecera('Proveedor:', proveedor.NOM); |
529 | }, function() { | 540 | }, function() { |
530 | 541 | ||
531 | } | 542 | } |
532 | ); | 543 | ); |
533 | }; | 544 | }; |
534 | 545 | ||
535 | $scope.seleccionarCliente = function() { | 546 | $scope.seleccionarCliente = function() { |
536 | 547 | ||
537 | var modalInstance = $uibModal.open( | 548 | var modalInstance = $uibModal.open( |
538 | { | 549 | { |
539 | ariaLabelledBy: 'Busqueda de Cliente', | 550 | ariaLabelledBy: 'Busqueda de Cliente', |
540 | templateUrl: 'foca-busqueda-cliente-modal.html', | 551 | templateUrl: 'foca-busqueda-cliente-modal.html', |
541 | controller: 'focaBusquedaClienteModalController', | 552 | controller: 'focaBusquedaClienteModalController', |
542 | size: 'lg' | 553 | size: 'lg' |
543 | } | 554 | } |
544 | ); | 555 | ); |
545 | modalInstance.result.then( | 556 | modalInstance.result.then( |
546 | function(cliente) { | 557 | function(cliente) { |
547 | $scope.abrirModalDomicilios(cliente); | 558 | $scope.abrirModalDomicilios(cliente); |
548 | }, function() { | 559 | }, function() { |
549 | 560 | ||
550 | } | 561 | } |
551 | ); | 562 | ); |
552 | }; | 563 | }; |
553 | 564 | ||
554 | $scope.abrirModalDomicilios = function(cliente) { | 565 | $scope.abrirModalDomicilios = function(cliente) { |
555 | var modalInstanceDomicilio = $uibModal.open( | 566 | var modalInstanceDomicilio = $uibModal.open( |
556 | { | 567 | { |
557 | ariaLabelledBy: 'Busqueda de Domicilios', | 568 | ariaLabelledBy: 'Busqueda de Domicilios', |
558 | templateUrl: 'modal-domicilio.html', | 569 | templateUrl: 'modal-domicilio.html', |
559 | controller: 'focaModalDomicilioController', | ||
560 | resolve: { idCliente: function() { return cliente.cod; }}, | 570 | controller: 'focaModalDomicilioController', |
571 | size: 'lg', | ||
561 | size: 'lg', | 572 | resolve: { idCliente: function() { return cliente.cod; }} |
562 | } | 573 | } |
563 | ); | 574 | ); |
564 | modalInstanceDomicilio.result.then( | 575 | modalInstanceDomicilio.result.then( |
565 | function(domicilio) { | 576 | function(domicilio) { |
566 | //$scope.remito.domicilio.id = domicilio.nivel2; | 577 | //$scope.remito.domicilio.id = domicilio.nivel2; |
567 | $scope.remito.cliente = { | 578 | $scope.remito.cliente = { |
568 | COD: cliente.cod, | 579 | COD: cliente.cod, |
569 | CUIT: cliente.cuit, | 580 | CUIT: cliente.cuit, |
570 | NOM: cliente.nom | 581 | NOM: cliente.nom |
571 | }; | 582 | }; |
572 | 583 | ||
573 | addCabecera('Cliente:', cliente.nom); | 584 | addCabecera('Cliente:', cliente.nom); |
574 | var domicilioStamp = | 585 | var domicilioStamp = |
575 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 586 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
576 | domicilio.Localidad + ', ' + domicilio.Provincia; | 587 | domicilio.Localidad + ', ' + domicilio.Provincia; |
577 | $scope.remito.domicilioStamp = domicilioStamp; | 588 | $scope.remito.domicilioStamp = domicilioStamp; |
578 | addCabecera('Domicilio:', domicilioStamp); | 589 | addCabecera('Domicilio:', domicilioStamp); |
579 | }, function() { | 590 | }, function() { |
580 | $scope.seleccionarCliente(); | 591 | $scope.seleccionarCliente(); |
581 | return; | 592 | return; |
582 | } | 593 | } |
583 | ); | 594 | ); |
584 | }; | 595 | }; |
585 | 596 | ||
586 | $scope.mostrarFichaCliente = function() { | 597 | $scope.mostrarFichaCliente = function() { |
587 | $uibModal.open( | 598 | $uibModal.open( |
588 | { | 599 | { |
589 | ariaLabelledBy: 'Datos del Cliente', | 600 | ariaLabelledBy: 'Datos del Cliente', |
590 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 601 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
591 | controller: 'focaCrearRemitoFichaClienteController', | 602 | controller: 'focaCrearRemitoFichaClienteController', |
592 | size: 'lg' | 603 | size: 'lg' |
593 | } | 604 | } |
594 | ); | 605 | ); |
595 | }; | 606 | }; |
596 | 607 | ||
597 | $scope.getTotal = function() { | 608 | $scope.getTotal = function() { |
598 | var total = 0; | 609 | var total = 0; |
599 | var arrayTempArticulos = $scope.articulosTabla; | 610 | var arrayTempArticulos = $scope.articulosTabla; |
600 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 611 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
601 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 612 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
602 | } | 613 | } |
603 | return parseFloat(total.toFixed(2)); | 614 | return parseFloat(total.toFixed(2)); |
604 | }; | 615 | }; |
605 | 616 | ||
606 | $scope.getSubTotal = function() { | 617 | $scope.getSubTotal = function() { |
607 | if($scope.articuloACargar) { | 618 | if($scope.articuloACargar) { |
608 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 619 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
609 | } | 620 | } |
610 | }; | 621 | }; |
611 | 622 | ||
612 | $scope.abrirModalListaPrecio = function() { | 623 | $scope.abrirModalListaPrecio = function() { |
613 | var modalInstance = $uibModal.open( | 624 | var modalInstance = $uibModal.open( |
614 | { | 625 | { |
615 | ariaLabelledBy: 'Busqueda de Precio Condición', | 626 | ariaLabelledBy: 'Busqueda de Precio Condición', |
616 | templateUrl: 'modal-precio-condicion.html', | 627 | templateUrl: 'modal-precio-condicion.html', |
617 | controller: 'focaModalPrecioCondicionController', | 628 | controller: 'focaModalPrecioCondicionController', |
618 | size: 'lg' | 629 | size: 'lg' |
619 | } | 630 | } |
620 | ); | 631 | ); |
621 | modalInstance.result.then( | 632 | modalInstance.result.then( |
622 | function(precioCondicion) { | 633 | function(precioCondicion) { |
623 | var cabecera = ''; | 634 | var cabecera = ''; |
624 | var plazosConcat = ''; | 635 | var plazosConcat = ''; |
625 | if(!Array.isArray(precioCondicion)) { | 636 | if(!Array.isArray(precioCondicion)) { |
626 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 637 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
627 | $scope.plazosPagos = precioCondicion.plazoPago; | 638 | $scope.plazosPagos = precioCondicion.plazoPago; |
628 | $scope.idLista = precioCondicion.idListaPrecio; | 639 | $scope.idLista = precioCondicion.idListaPrecio; |
629 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 640 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
630 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 641 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
631 | } | 642 | } |
632 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 643 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
633 | } else { //Cuando se ingresan los plazos manualmente | 644 | } else { //Cuando se ingresan los plazos manualmente |
634 | $scope.remito.idPrecioCondicion = 0; | 645 | $scope.remito.idPrecioCondicion = 0; |
635 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 646 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
636 | $scope.plazosPagos = precioCondicion; | 647 | $scope.plazosPagos = precioCondicion; |
637 | for(var j = 0; j < precioCondicion.length; j++) { | 648 | for(var j = 0; j < precioCondicion.length; j++) { |
638 | plazosConcat += precioCondicion[j].dias + ' '; | 649 | plazosConcat += precioCondicion[j].dias + ' '; |
639 | } | 650 | } |
640 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 651 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
641 | } | 652 | } |
642 | $scope.articulosTabla = []; | 653 | $scope.articulosTabla = []; |
643 | addCabecera('Precios y condiciones:', cabecera); | 654 | addCabecera('Precios y condiciones:', cabecera); |
644 | }, function() { | 655 | }, function() { |
645 | 656 | ||
646 | } | 657 | } |
647 | ); | 658 | ); |
648 | }; | 659 | }; |
649 | 660 | ||
650 | $scope.abrirModalFlete = function() { | 661 | $scope.abrirModalFlete = function() { |
651 | var modalInstance = $uibModal.open( | 662 | var modalInstance = $uibModal.open( |
652 | { | 663 | { |
653 | ariaLabelledBy: 'Busqueda de Flete', | 664 | ariaLabelledBy: 'Busqueda de Flete', |
654 | templateUrl: 'modal-flete.html', | 665 | templateUrl: 'modal-flete.html', |
655 | controller: 'focaModalFleteController', | 666 | controller: 'focaModalFleteController', |
656 | size: 'lg', | 667 | size: 'lg', |
657 | resolve: { | 668 | resolve: { |
658 | parametrosFlete: | 669 | parametrosFlete: |
659 | function() { | 670 | function() { |
660 | return { | 671 | return { |
661 | flete: $scope.remito.flete ? '1' : | 672 | flete: $scope.remito.flete ? '1' : |
662 | ($scope.remito.fob ? 'FOB' : | 673 | ($scope.remito.fob ? 'FOB' : |
663 | ($scope.remito.flete === undefined ? null : '0')), | 674 | ($scope.remito.flete === undefined ? null : '0')), |
664 | bomba: $scope.remito.bomba ? '1' : | 675 | bomba: $scope.remito.bomba ? '1' : |
665 | ($scope.remito.bomba === undefined ? null : '0'), | 676 | ($scope.remito.bomba === undefined ? null : '0'), |
666 | kilometros: $scope.remito.kilometros | 677 | kilometros: $scope.remito.kilometros |
667 | }; | 678 | }; |
668 | } | 679 | } |
669 | } | 680 | } |
670 | } | 681 | } |
671 | ); | 682 | ); |
672 | modalInstance.result.then( | 683 | modalInstance.result.then( |
673 | function(datos) { | 684 | function(datos) { |
674 | $scope.remito.flete = datos.flete; | 685 | $scope.remito.flete = datos.flete; |
675 | $scope.remito.fob = datos.FOB; | 686 | $scope.remito.fob = datos.FOB; |
676 | $scope.remito.bomba = datos.bomba; | 687 | $scope.remito.bomba = datos.bomba; |
677 | $scope.remito.kilometros = datos.kilometros; | 688 | $scope.remito.kilometros = datos.kilometros; |
678 | 689 | ||
679 | addCabecera('Flete:', datos.flete ? 'Si' : | 690 | addCabecera('Flete:', datos.flete ? 'Si' : |
680 | ($scope.remito.fob ? 'FOB' : 'No')); | 691 | ($scope.remito.fob ? 'FOB' : 'No')); |
681 | if(datos.flete) { | 692 | if(datos.flete) { |
682 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 693 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
683 | addCabecera('Kilometros:', datos.kilometros); | 694 | addCabecera('Kilometros:', datos.kilometros); |
684 | } else { | 695 | } else { |
685 | removeCabecera('Bomba:'); | 696 | removeCabecera('Bomba:'); |
686 | removeCabecera('Kilometros:'); | 697 | removeCabecera('Kilometros:'); |
687 | $scope.remito.fob = false; | 698 | $scope.remito.fob = false; |
688 | $scope.remito.bomba = false; | 699 | $scope.remito.bomba = false; |
689 | $scope.remito.kilometros = null; | 700 | $scope.remito.kilometros = null; |
690 | } | 701 | } |
691 | }, function() { | 702 | }, function() { |
692 | 703 | ||
693 | } | 704 | } |
694 | ); | 705 | ); |
695 | }; | 706 | }; |
696 | 707 | ||
697 | $scope.abrirModalMoneda = function() { | 708 | $scope.abrirModalMoneda = function() { |
698 | var modalInstance = $uibModal.open( | 709 | var modalInstance = $uibModal.open( |
699 | { | 710 | { |
700 | ariaLabelledBy: 'Busqueda de Moneda', | 711 | ariaLabelledBy: 'Busqueda de Moneda', |
701 | templateUrl: 'modal-moneda.html', | 712 | templateUrl: 'modal-moneda.html', |
702 | controller: 'focaModalMonedaController', | 713 | controller: 'focaModalMonedaController', |
703 | size: 'lg' | 714 | size: 'lg' |
704 | } | 715 | } |
705 | ); | 716 | ); |
706 | modalInstance.result.then( | 717 | modalInstance.result.then( |
707 | function(moneda) { | 718 | function(moneda) { |
708 | $scope.abrirModalCotizacion(moneda); | 719 | $scope.abrirModalCotizacion(moneda); |
709 | }, function() { | 720 | }, function() { |
710 | 721 | ||
711 | } | 722 | } |
712 | ); | 723 | ); |
713 | }; | 724 | }; |
714 | 725 | ||
715 | $scope.abrirModalCotizacion = function(moneda) { | 726 | $scope.abrirModalCotizacion = function(moneda) { |
716 | var modalInstance = $uibModal.open( | 727 | var modalInstance = $uibModal.open( |
717 | { | 728 | { |
718 | ariaLabelledBy: 'Busqueda de Cotización', | 729 | ariaLabelledBy: 'Busqueda de Cotización', |
719 | templateUrl: 'modal-cotizacion.html', | 730 | templateUrl: 'modal-cotizacion.html', |
720 | controller: 'focaModalCotizacionController', | 731 | controller: 'focaModalCotizacionController', |
721 | size: 'lg', | 732 | size: 'lg', |
722 | resolve: {idMoneda: function() {return moneda.ID;}} | 733 | resolve: {idMoneda: function() {return moneda.ID;}} |
723 | } | 734 | } |
724 | ); | 735 | ); |
725 | modalInstance.result.then( | 736 | modalInstance.result.then( |
726 | function(cotizacion) { | 737 | function(cotizacion) { |
727 | var articulosTablaTemp = $scope.articulosTabla; | 738 | var articulosTablaTemp = $scope.articulosTabla; |
728 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 739 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
729 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 740 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
730 | $scope.remito.cotizacion.COTIZACION; | 741 | $scope.remito.cotizacion.COTIZACION; |
731 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 742 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
732 | cotizacion.COTIZACION; | 743 | cotizacion.COTIZACION; |
733 | } | 744 | } |
734 | $scope.articulosTabla = articulosTablaTemp; | 745 | $scope.articulosTabla = articulosTablaTemp; |
735 | $scope.remito.moneda = { | 746 | $scope.remito.moneda = { |
736 | id: moneda.ID, | 747 | id: moneda.ID, |
737 | detalle: moneda.DETALLE, | 748 | detalle: moneda.DETALLE, |
738 | simbolo: moneda.SIMBOLO | 749 | simbolo: moneda.SIMBOLO |
739 | }; | 750 | }; |
740 | $scope.remito.cotizacion = { | 751 | $scope.remito.cotizacion = { |
741 | ID: cotizacion.ID, | 752 | ID: cotizacion.ID, |
742 | COTIZACION: cotizacion.COTIZACION, | 753 | COTIZACION: cotizacion.COTIZACION, |
743 | FECHA: cotizacion.FECHA | 754 | FECHA: cotizacion.FECHA |
744 | }; | 755 | }; |
745 | addCabecera('Moneda:', moneda.DETALLE); | 756 | addCabecera('Moneda:', moneda.DETALLE); |
746 | addCabecera( | 757 | addCabecera( |
747 | 'Fecha cotizacion:', | 758 | 'Fecha cotizacion:', |
748 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 759 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
749 | ); | 760 | ); |
750 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 761 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
751 | }, function() { | 762 | }, function() { |
752 | 763 | ||
753 | } | 764 | } |
754 | ); | 765 | ); |
755 | }; | 766 | }; |
756 | 767 | ||
757 | $scope.agregarATabla = function(key) { | 768 | $scope.agregarATabla = function(key) { |
758 | if(key === 13) { | 769 | if(key === 13) { |
759 | if($scope.articuloACargar.cantidad === undefined || | 770 | if($scope.articuloACargar.cantidad === undefined || |
760 | $scope.articuloACargar.cantidad === 0 || | 771 | $scope.articuloACargar.cantidad === 0 || |
761 | $scope.articuloACargar.cantidad === null ) { | 772 | $scope.articuloACargar.cantidad === null ) { |
762 | focaModalService.alert('El valor debe ser al menos 1'); | 773 | focaModalService.alert('El valor debe ser al menos 1'); |
763 | return; | 774 | return; |
764 | } | 775 | } |
765 | delete $scope.articuloACargar.sectorCodigo; | 776 | delete $scope.articuloACargar.sectorCodigo; |
766 | $scope.articulosTabla.push($scope.articuloACargar); | 777 | $scope.articulosTabla.push($scope.articuloACargar); |
767 | $scope.cargando = true; | 778 | $scope.cargando = true; |
768 | } | 779 | } |
769 | }; | 780 | }; |
770 | 781 | ||
771 | $scope.quitarArticulo = function(key) { | 782 | $scope.quitarArticulo = function(key) { |
772 | $scope.articulosTabla.splice(key, 1); | 783 | $scope.articulosTabla.splice(key, 1); |
773 | }; | 784 | }; |
774 | 785 | ||
775 | $scope.editarArticulo = function(key, articulo) { | 786 | $scope.editarArticulo = function(key, articulo) { |
776 | if(key === 13) { | 787 | if(key === 13) { |
777 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 788 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
778 | articulo.cantidad === undefined) { | 789 | articulo.cantidad === undefined) { |
779 | focaModalService.alert('El valor debe ser al menos 1'); | 790 | focaModalService.alert('El valor debe ser al menos 1'); |
780 | return; | 791 | return; |
781 | } | 792 | } |
782 | articulo.editCantidad = false; | 793 | articulo.editCantidad = false; |
783 | articulo.editPrecio = false; | 794 | articulo.editPrecio = false; |
784 | } | 795 | } |
785 | }; | 796 | }; |
786 | 797 | ||
787 | $scope.cambioEdit = function(articulo, propiedad) { | 798 | $scope.cambioEdit = function(articulo, propiedad) { |
788 | if(propiedad === 'cantidad') { | 799 | if(propiedad === 'cantidad') { |
789 | articulo.editCantidad = true; | 800 | articulo.editCantidad = true; |
790 | } else if(propiedad === 'precio') { | 801 | } else if(propiedad === 'precio') { |
791 | articulo.editPrecio = true; | 802 | articulo.editPrecio = true; |
792 | } | 803 | } |
793 | }; | 804 | }; |
794 | 805 | ||
795 | $scope.limpiarFlete = function() { | 806 | $scope.limpiarFlete = function() { |
796 | $scope.remito.fleteNombre = ''; | 807 | $scope.remito.fleteNombre = ''; |
797 | $scope.remito.chofer = ''; | 808 | $scope.remito.chofer = ''; |
798 | $scope.remito.vehiculo = ''; | 809 | $scope.remito.vehiculo = ''; |
799 | $scope.remito.kilometros = ''; | 810 | $scope.remito.kilometros = ''; |
800 | $scope.remito.costoUnitarioKmFlete = ''; | 811 | $scope.remito.costoUnitarioKmFlete = ''; |
801 | $scope.choferes = ''; | 812 | $scope.choferes = ''; |
802 | $scope.vehiculos = ''; | 813 | $scope.vehiculos = ''; |
803 | }; | 814 | }; |
804 | 815 | ||
805 | $scope.limpiarPantalla = function() { | 816 | $scope.limpiarPantalla = function() { |
806 | $scope.limpiarFlete(); | 817 | $scope.limpiarFlete(); |
807 | $scope.remito.flete = '0'; | 818 | $scope.remito.flete = '0'; |
808 | $scope.remito.bomba = '0'; | 819 | $scope.remito.bomba = '0'; |
809 | $scope.remito.precioCondicion = ''; | 820 | $scope.remito.precioCondicion = ''; |
810 | $scope.articulosTabla = []; | 821 | $scope.articulosTabla = []; |
811 | $scope.remito.vendedor.nombre = ''; | 822 | $scope.remito.vendedor.nombre = ''; |
812 | $scope.remito.cliente = {nombre: ''}; | 823 | $scope.remito.cliente = {nombre: ''}; |
813 | $scope.remito.domicilio = {dom: ''}; | 824 | $scope.remito.domicilio = {dom: ''}; |
814 | $scope.domiciliosCliente = []; | 825 | $scope.domiciliosCliente = []; |
815 | }; | 826 | }; |
816 | 827 | ||
817 | $scope.resetFilter = function() { | 828 | $scope.resetFilter = function() { |
818 | $scope.articuloACargar = {}; | 829 | $scope.articuloACargar = {}; |
819 | $scope.cargando = true; | 830 | $scope.cargando = true; |
820 | }; | 831 | }; |
821 | 832 | ||
822 | $scope.selectFocus = function($event) { | 833 | $scope.selectFocus = function($event) { |
823 | $event.target.select(); | 834 | $event.target.select(); |
824 | }; | 835 | }; |
825 | 836 | ||
826 | $scope.salir = function() { | 837 | $scope.salir = function() { |
827 | $location.path('/'); | 838 | $location.path('/'); |
828 | }; | 839 | }; |
829 | function addArrayCabecera(array) { | 840 | function addArrayCabecera(array) { |
830 | for(var i = 0; i < array.length; i++) { | 841 | for(var i = 0; i < array.length; i++) { |
831 | addCabecera(array[i].label, array[i].valor); | 842 | addCabecera(array[i].label, array[i].valor); |
832 | } | 843 | } |
833 | } | 844 | } |
834 | 845 | ||
835 | function addCabecera(label, valor) { | 846 | function addCabecera(label, valor) { |
836 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 847 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
837 | if(propiedad.length === 1) { | 848 | if(propiedad.length === 1) { |
838 | propiedad[0].valor = valor; | 849 | propiedad[0].valor = valor; |
839 | } else { | 850 | } else { |
840 | $scope.cabecera.push({label: label, valor: valor}); | 851 | $scope.cabecera.push({label: label, valor: valor}); |
841 | } | 852 | } |
842 | } | 853 | } |
843 | 854 | ||
844 | function removeCabecera(label) { | 855 | function removeCabecera(label) { |
845 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 856 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
846 | if(propiedad.length === 1) { | 857 | if(propiedad.length === 1) { |
847 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 858 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
848 | } | 859 | } |
849 | } | 860 | } |
850 | 861 | ||
851 | function rellenar(relleno, longitud) { | 862 | function rellenar(relleno, longitud) { |
852 | relleno = '' + relleno; | 863 | relleno = '' + relleno; |
853 | while (relleno.length < longitud) { | 864 | while (relleno.length < longitud) { |
854 | relleno = '0' + relleno; | 865 | relleno = '0' + relleno; |
855 | } | 866 | } |
856 | 867 | ||
857 | return relleno; | 868 | return relleno; |
858 | } | 869 | } |
859 | } | 870 | } |
860 | ] | 871 | ] |
861 | ) | 872 | ) |
862 | .controller('remitoListaCtrl', [ | 873 | .controller('remitoListaCtrl', [ |
863 | '$scope', | 874 | '$scope', |
864 | 'crearRemitoService', | 875 | 'crearRemitoService', |
865 | '$location', | 876 | '$location', |
866 | function($scope, crearRemitoService, $location) { | 877 | function($scope, crearRemitoService, $location) { |
867 | crearRemitoService.obtenerRemito().then(function(datos) { | 878 | crearRemitoService.obtenerRemito().then(function(datos) { |
868 | $scope.remitos = datos.data; | 879 | $scope.remitos = datos.data; |
869 | }); | 880 | }); |
870 | $scope.editar = function(remito) { | 881 | $scope.editar = function(remito) { |
871 | crearRemitoService.setRemito(remito); | 882 | crearRemitoService.setRemito(remito); |
872 | $location.path('/venta-nota-remito/abm/'); | 883 | $location.path('/venta-nota-remito/abm/'); |
873 | }; | 884 | }; |
874 | $scope.crearRemito = function() { | 885 | $scope.crearRemito = function() { |
875 | crearRemitoService.clearRemito(); | 886 | crearRemitoService.clearRemito(); |
876 | $location.path('/venta-nota-remito/abm/'); | 887 | $location.path('/venta-nota-remito/abm/'); |
877 | }; | 888 | }; |
878 | } | 889 | } |
879 | ]) | 890 | ]) |
880 | .controller('focaCrearRemitoFichaClienteController', [ | 891 | .controller('focaCrearRemitoFichaClienteController', [ |
881 | '$scope', | 892 | '$scope', |
882 | 'crearRemitoService', | 893 | 'crearRemitoService', |
883 | '$location', | 894 | '$location', |
884 | function($scope, crearRemitoService, $location) { | 895 | function($scope, crearRemitoService, $location) { |
885 | crearRemitoService.obtenerRemito().then(function(datos) { | 896 | crearRemitoService.obtenerRemito().then(function(datos) { |
886 | $scope.remitos = datos.data; | 897 | $scope.remitos = datos.data; |
887 | }); | 898 | }); |
888 | $scope.editar = function(remito) { | 899 | $scope.editar = function(remito) { |
889 | crearRemitoService.setRemito(remito); | 900 | crearRemitoService.setRemito(remito); |
890 | $location.path('/venta-nota-remito/abm/'); | 901 | $location.path('/venta-nota-remito/abm/'); |
891 | }; | 902 | }; |
892 | $scope.crearRemito = function() { | 903 | $scope.crearRemito = function() { |
893 | crearRemitoService.clearRemito(); | 904 | crearRemitoService.clearRemito(); |
894 | $location.path('/venta-nota-remito/abm/'); | 905 | $location.path('/venta-nota-remito/abm/'); |
895 | }; | 906 | }; |
896 | } | 907 | } |
897 | ]); | 908 | ]); |
src/js/service.js
1 | angular.module('focaCrearRemito') | 1 | angular.module('focaCrearRemito') |
2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | var route = API_ENDPOINT.URL; | 3 | var route = API_ENDPOINT.URL; |
4 | return { | 4 | return { |
5 | crearRemito: function(remito) { | 5 | crearRemito: function(remito) { |
6 | // TODO: Cambiar para usar el servicio /remito | 6 | // TODO: Cambiar para usar el servicio /remito |
7 | return $http.post(route + '/remito', {remito: remito}); | 7 | return $http.post(route + '/remito', remito); |
8 | }, | 8 | }, |
9 | obtenerRemito: function() { | 9 | obtenerRemito: function() { |
10 | return $http.get(route +'/nota-pedido'); | 10 | return $http.get(route +'/nota-pedido'); |
11 | }, | 11 | }, |
12 | setRemito: function(remito) { | 12 | setRemito: function(remito) { |
13 | this.remito = remito; | 13 | this.remito = remito; |
14 | }, | 14 | }, |
15 | clearRemito: function() { | 15 | clearRemito: function() { |
16 | this.remito = undefined; | 16 | this.remito = undefined; |
17 | }, | 17 | }, |
18 | getRemito: function() { | 18 | getRemito: function() { |
19 | return this.remito; | 19 | return this.remito; |
20 | }, | 20 | }, |
21 | getArticulosByIdRemito: function(id) { | 21 | getArticulosByIdRemito: function(id) { |
22 | return $http.get(route+'/articulos/nota-pedido/'+id); | 22 | return $http.get(route+'/articulos/nota-pedido/'+id); |
23 | }, | 23 | }, |
24 | crearArticulosParaRemito: function(articuloRemito) { | 24 | crearArticulosParaRemito: function(articuloRemito) { |
25 | return $http.post(route + '/articulos/remito', | 25 | return $http.post(route + '/articulos/remito', |
26 | {articuloRemito: articuloRemito}); | 26 | {articuloRemito: articuloRemito}); |
27 | }, | 27 | }, |
28 | getDomiciliosByIdRemito: function(id) { | 28 | getDomiciliosByIdRemito: function(id) { |
29 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 29 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
30 | }, | 30 | }, |
31 | getDomiciliosByIdCliente: function(id) { | 31 | getDomiciliosByIdCliente: function(id) { |
32 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 32 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
33 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 33 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
34 | }, | 34 | }, |
35 | getPrecioCondicion: function() { | 35 | getPrecioCondicion: function() { |
36 | return $http.get(route + '/precio-condicion'); | 36 | return $http.get(route + '/precio-condicion'); |
37 | }, | 37 | }, |
38 | getPrecioCondicionById: function(id) { | 38 | getPrecioCondicionById: function(id) { |
39 | return $http.get(route + '/precio-condicion/' + id); | 39 | return $http.get(route + '/precio-condicion/' + id); |
40 | }, | 40 | }, |
41 | getPlazoPagoByPrecioCondicion: function(id) { | 41 | getPlazoPagoByPrecioCondicion: function(id) { |
42 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 42 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
43 | }, | 43 | }, |
44 | crearFlete: function(flete) { | 44 | crearFlete: function(flete) { |
45 | return $http.post(route + '/flete', {flete : flete}); | 45 | return $http.post(route + '/flete', {flete : flete}); |
46 | }, | 46 | }, |
47 | crearPlazosParaRemito: function(plazos) { | 47 | crearPlazosParaRemito: function(plazos) { |
48 | return $http.post(route + '/plazo-pago/nota-pedido', plazos); | 48 | return $http.post(route + '/plazo-pago/nota-pedido', plazos); |
49 | }, | 49 | }, |
50 | getCotizacionByIdMoneda: function(id) { | 50 | getCotizacionByIdMoneda: function(id) { |
51 | return $http.get(route + '/moneda/' + id); | 51 | return $http.get(route + '/moneda/' + id); |
52 | }, | 52 | }, |
53 | crearEstadoParaRemito: function(estado) { | 53 | crearEstadoParaRemito: function(estado) { |
54 | return $http.post(route + '/estado', {estado: estado}); | 54 | return $http.post(route + '/estado', {estado: estado}); |
55 | }, | 55 | }, |
56 | getNumeroRemito: function() { | 56 | getNumeroRemito: function() { |
57 | return $http.get(route + '/remito/numero-siguiente'); | 57 | return $http.get(route + '/remito/numero-siguiente'); |
58 | } | 58 | } |
59 | }; | 59 | }; |
60 | }]); | 60 | }]); |
61 | 61 |