Commit b9b1895caaafa9994687c8c8419a26896449b219
1 parent
56c85044dc
Exists in
master
guardar idremito en numero pedido
Showing
2 changed files
with
58 additions
and
47 deletions
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 = notaPedido; | 179 | $scope.remito = notaPedido; |
175 | $scope.remito.vendedor = notaPedido.vendedor[0]; | 180 | $scope.remito.vendedor = notaPedido.vendedor[0]; |
176 | $scope.remito.cliente = notaPedido.cliente[0]; | 181 | $scope.remito.cliente = notaPedido.cliente[0]; |
177 | $scope.remito.proveedor = notaPedido.proveedor[0]; | 182 | $scope.remito.proveedor = notaPedido.proveedor[0]; |
178 | $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; | 183 | $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; |
179 | $scope.remito.cotizacion = notaPedido.cotizacion[0]; | 184 | $scope.remito.cotizacion = notaPedido.cotizacion[0]; |
180 | addArrayCabecera(cabeceras); | 185 | addArrayCabecera(cabeceras); |
181 | 186 | ||
182 | }, function() { | 187 | }, function() { |
183 | // funcion ejecutada cuando se cancela el modal | 188 | // funcion ejecutada cuando se cancela el modal |
184 | } | 189 | } |
185 | ); | 190 | ); |
186 | }; | 191 | }; |
187 | 192 | ||
188 | $scope.seleccionarRemito = function() { | 193 | $scope.seleccionarRemito = function() { |
189 | var modalInstance = $uibModal.open( | 194 | var modalInstance = $uibModal.open( |
190 | { | 195 | { |
191 | ariaLabelledBy: 'Busqueda de Remito', | 196 | ariaLabelledBy: 'Busqueda de Remito', |
192 | templateUrl: 'foca-modal-remito.html', | 197 | templateUrl: 'foca-modal-remito.html', |
193 | controller: 'focaModalRemitoController', | 198 | controller: 'focaModalRemitoController', |
194 | size: 'lg' | 199 | size: 'lg' |
195 | } | 200 | } |
196 | ); | 201 | ); |
197 | modalInstance.result.then( | 202 | modalInstance.result.then( |
198 | function(remito) { | 203 | function(remito) { |
199 | //añado cabeceras | 204 | //añado cabeceras |
200 | removeCabecera('Moneda:'); | 205 | removeCabecera('Moneda:'); |
201 | removeCabecera('Fecha cotizacion:'); | 206 | removeCabecera('Fecha cotizacion:'); |
202 | removeCabecera('Cotizacion:'); | 207 | removeCabecera('Cotizacion:'); |
203 | var cabeceras = [ | 208 | var cabeceras = [ |
204 | { | 209 | { |
205 | label: 'Moneda', | 210 | label: 'Moneda', |
206 | valor: remito.cotizacion[0].moneda[0].DETALLE | 211 | valor: remito.cotizacion[0].moneda[0].DETALLE |
207 | }, | 212 | }, |
208 | { | 213 | { |
209 | label: 'Fecha cotizacion', | 214 | label: 'Fecha cotizacion', |
210 | valor: $filter('date')(remito.cotizacion[0].FECHA, | 215 | valor: $filter('date')(remito.cotizacion[0].FECHA, |
211 | 'dd/MM/yyyy') | 216 | 'dd/MM/yyyy') |
212 | }, | 217 | }, |
213 | { | 218 | { |
214 | label: 'Cotizacion', | 219 | label: 'Cotizacion', |
215 | valor: remito.cotizacion[0].VENDEDOR | 220 | valor: remito.cotizacion[0].VENDEDOR |
216 | }, | 221 | }, |
217 | { | 222 | { |
218 | label: 'Cliente:', | 223 | label: 'Cliente:', |
219 | valor: remito.cliente[0].NOM | 224 | valor: remito.cliente[0].NOM |
220 | }, | 225 | }, |
221 | { | 226 | { |
222 | label: 'Domicilio:', | 227 | label: 'Domicilio:', |
223 | valor: remito.domicilioStamp | 228 | valor: remito.domicilioStamp |
224 | }, | 229 | }, |
225 | { | 230 | { |
226 | label: 'Vendedor:', | 231 | label: 'Vendedor:', |
227 | valor: remito.vendedor[0].NomVen | 232 | valor: remito.vendedor[0].NomVen |
228 | }, | 233 | }, |
229 | { | 234 | { |
230 | label: 'Proveedor:', | 235 | label: 'Proveedor:', |
231 | valor: remito.proveedor[0].NOM | 236 | valor: remito.proveedor[0].NOM |
232 | }, | 237 | }, |
233 | { | 238 | { |
234 | label: 'Flete:', | 239 | label: 'Flete:', |
235 | valor: remito.flete === 1 ? 'Si' : 'No' | 240 | valor: remito.flete === 1 ? 'Si' : 'No' |
236 | }, | 241 | }, |
237 | { | 242 | { |
238 | label: 'FOB:', | 243 | label: 'FOB:', |
239 | valor: remito.fob === 1 ? 'Si' : 'No' | 244 | valor: remito.fob === 1 ? 'Si' : 'No' |
240 | }, | 245 | }, |
241 | { | 246 | { |
242 | label: 'Precio condicion:', | 247 | label: 'Precio condicion:', |
243 | valor: valorPrecioCondicion() | 248 | valor: valorPrecioCondicion() |
244 | } | 249 | } |
245 | ]; | 250 | ]; |
246 | //TO DO CUANDO MOSTRAR PLAZOS | 251 | //TO DO CUANDO MOSTRAR PLAZOS |
247 | function valorPrecioCondicion() { | 252 | function valorPrecioCondicion() { |
248 | if(remito.idPrecioCondicion > 0) { | 253 | if(remito.idPrecioCondicion > 0) { |
249 | return remito.precioCondicion[0].nombre; | 254 | return remito.precioCondicion[0].nombre; |
250 | } else { | 255 | } else { |
251 | return 'Ingreso Manual'; | 256 | return 'Ingreso Manual'; |
252 | } | 257 | } |
253 | 258 | ||
254 | } | 259 | } |
255 | 260 | ||
256 | if(remito.flete === 1) { | 261 | if(remito.flete === 1) { |
257 | var cabeceraBomba = { | 262 | var cabeceraBomba = { |
258 | label: 'Bomba', | 263 | label: 'Bomba', |
259 | valor: remito.bomba === 1 ? 'Si' : 'No' | 264 | valor: remito.bomba === 1 ? 'Si' : 'No' |
260 | }; | 265 | }; |
261 | if(remito.kilometros) { | 266 | if(remito.kilometros) { |
262 | var cabeceraKilometros = { | 267 | var cabeceraKilometros = { |
263 | label: 'Kilometros', | 268 | label: 'Kilometros', |
264 | valor: remito.kilometros | 269 | valor: remito.kilometros |
265 | }; | 270 | }; |
266 | cabeceras.push(cabeceraKilometros); | 271 | cabeceras.push(cabeceraKilometros); |
267 | } | 272 | } |
268 | cabeceras.push(cabeceraBomba); | 273 | cabeceras.push(cabeceraBomba); |
269 | } | 274 | } |
270 | $scope.articulosTabla = remito.articulosRemito; | 275 | $scope.articulosTabla = remito.articulosRemito; |
271 | if(remito.precioCondicion.length > 0) { | 276 | if(remito.precioCondicion.length > 0) { |
272 | $scope.idLista = remito.precioCondicion[0].idListaPrecio; | 277 | $scope.idLista = remito.precioCondicion[0].idListaPrecio; |
273 | } else { | 278 | } else { |
274 | $scope.idLista = -1; | 279 | $scope.idLista = -1; |
275 | } | 280 | } |
276 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 281 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
277 | $scope.remito = remito; | 282 | $scope.remito = remito; |
278 | $scope.remito.vendedor = remito.vendedor[0]; | 283 | $scope.remito.vendedor = remito.vendedor[0]; |
279 | $scope.remito.cliente = remito.cliente[0]; | 284 | $scope.remito.cliente = remito.cliente[0]; |
280 | $scope.remito.proveedor = remito.proveedor[0]; | 285 | $scope.remito.proveedor = remito.proveedor[0]; |
281 | $scope.remito.moneda = remito.cotizacion[0].moneda[0]; | 286 | $scope.remito.moneda = remito.cotizacion[0].moneda[0]; |
282 | $scope.remito.cotizacion = remito.cotizacion[0]; | 287 | $scope.remito.cotizacion = remito.cotizacion[0]; |
283 | addArrayCabecera(cabeceras); | 288 | addArrayCabecera(cabeceras); |
284 | }, function() { | 289 | }, function() { |
285 | // funcion ejecutada cuando se cancela el modal | 290 | // funcion ejecutada cuando se cancela el modal |
286 | } | 291 | } |
287 | ); | 292 | ); |
288 | }; | 293 | }; |
289 | 294 | ||
290 | //La pantalla solo se usa para cargar remitos | 295 | //La pantalla solo se usa para cargar remitos |
291 | // if (remitoTemp !== undefined) { | 296 | // if (remitoTemp !== undefined) { |
292 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 297 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
293 | // $scope.remito = remitoTemp; | 298 | // $scope.remito = remitoTemp; |
294 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 299 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
295 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 300 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
296 | // $scope.idLista = $scope.remito.precioCondicion; | 301 | // $scope.idLista = $scope.remito.precioCondicion; |
297 | // crearRemitoService | 302 | // crearRemitoService |
298 | // .getArticulosByIdRemito($scope.remito.id).then( | 303 | // .getArticulosByIdRemito($scope.remito.id).then( |
299 | // function(res) { | 304 | // function(res) { |
300 | // $scope.articulosTabla = res.data; | 305 | // $scope.articulosTabla = res.data; |
301 | // } | 306 | // } |
302 | // ); | 307 | // ); |
303 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 308 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
304 | //(NO REQUERIDO EN ESTA VERSION) | 309 | //(NO REQUERIDO EN ESTA VERSION) |
305 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 310 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
306 | // function(res) { | 311 | // function(res) { |
307 | // $scope.remito.domicilio = res.data; | 312 | // $scope.remito.domicilio = res.data; |
308 | // } | 313 | // } |
309 | // ); | 314 | // ); |
310 | // } else { | 315 | // } else { |
311 | // $scope.remito.fechaCarga = new Date(); | 316 | // $scope.remito.fechaCarga = new Date(); |
312 | // $scope.remito.bomba = '0'; | 317 | // $scope.remito.bomba = '0'; |
313 | // $scope.remito.flete = '0'; | 318 | // $scope.remito.flete = '0'; |
314 | // $scope.idLista = undefined; | 319 | // $scope.idLista = undefined; |
315 | // } | 320 | // } |
316 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 321 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
317 | // $scope.addNewDom = function() { | 322 | // $scope.addNewDom = function() { |
318 | // $scope.remito.domicilio.push({ 'id': 0 }); | 323 | // $scope.remito.domicilio.push({ 'id': 0 }); |
319 | // }; | 324 | // }; |
320 | // $scope.removeNewChoice = function(choice) { | 325 | // $scope.removeNewChoice = function(choice) { |
321 | // if ($scope.remito.domicilio.length > 1) { | 326 | // if ($scope.remito.domicilio.length > 1) { |
322 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 327 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
323 | // function(c) { | 328 | // function(c) { |
324 | // return c.$$hashKey === choice.$$hashKey; | 329 | // return c.$$hashKey === choice.$$hashKey; |
325 | // } | 330 | // } |
326 | // ), 1); | 331 | // ), 1); |
327 | // } | 332 | // } |
328 | // }; | 333 | // }; |
329 | //validacion por domicilio y por plazo pago | 334 | //validacion por domicilio y por plazo pago |
330 | $scope.crearRemito = function() { | 335 | $scope.crearRemito = function() { |
331 | if(!$scope.remito.vendedor) { | 336 | if(!$scope.remito.vendedor) { |
332 | focaModalService.alert('Ingrese Vendedor'); | 337 | focaModalService.alert('Ingrese Vendedor'); |
333 | return; | 338 | return; |
334 | } else if(!$scope.remito.cliente) { | 339 | } else if(!$scope.remito.cliente) { |
335 | focaModalService.alert('Ingrese Cliente'); | 340 | focaModalService.alert('Ingrese Cliente'); |
336 | return; | 341 | return; |
337 | } else if(!$scope.remito.proveedor) { | 342 | } else if(!$scope.remito.proveedor) { |
338 | focaModalService.alert('Ingrese Proveedor'); | 343 | focaModalService.alert('Ingrese Proveedor'); |
339 | return; | 344 | return; |
340 | } else if(!$scope.remito.moneda.ID) { | 345 | } else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { |
341 | focaModalService.alert('Ingrese Moneda'); | 346 | focaModalService.alert('Ingrese Moneda'); |
342 | return; | 347 | return; |
343 | } else if(!$scope.remito.cotizacion.ID) { | 348 | } else if(!$scope.remito.cotizacion.ID) { |
344 | focaModalService.alert('Ingrese Cotización'); | 349 | focaModalService.alert('Ingrese Cotización'); |
345 | return; | 350 | return; |
346 | } else if( | 351 | } else if( |
347 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 352 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
348 | { | 353 | { |
349 | focaModalService.alert('Ingrese Flete'); | 354 | focaModalService.alert('Ingrese Flete'); |
350 | return; | 355 | return; |
351 | } else if($scope.articulosTabla.length === 0) { | 356 | } else if($scope.articulosTabla.length === 0) { |
352 | focaModalService.alert('Debe cargar al menos un articulo'); | 357 | focaModalService.alert('Debe cargar al menos un articulo'); |
353 | return; | 358 | return; |
354 | } | 359 | } |
355 | var date = new Date(); | 360 | var date = new Date(); |
356 | var remito = { | 361 | var save = { |
357 | id: $scope.remito.id, | 362 | remito: { |
358 | fechaRemito: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 363 | id: 0, |
359 | .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter | 364 | fechaRemito: |
360 | idCliente: $scope.remito.cliente.COD, | 365 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
361 | nombreCliente: $scope.remito.cliente.NOM, | 366 | .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter |
362 | cuitCliente: $scope.remito.cliente.CUIT, | 367 | idCliente: $scope.remito.idCliente, |
363 | responsabilidadIvaCliente: 0,//TODO, | 368 | nombreCliente: $scope.remito.nombreCliente, |
364 | descuento: 0,//TODO, | 369 | cuitCliente: $scope.remito.cuitCliente, |
365 | importeNeto: 0,//TODO | 370 | responsabilidadIvaCliente: 0,//TODO, |
366 | importeExento: 0,//TODO | 371 | descuento: 0,//TODO, |
367 | importeIva: 0,//TODO | 372 | importeNeto: 0,//TODO |
368 | importeIvaServicios: 0,//TODO | 373 | importeExento: 0,//TODO |
369 | importeImpuestoInterno: 0,//TODO | 374 | importeIva: 0,//TODO |
370 | importeImpuestoInterno1: 0,//TODO | 375 | importeIvaServicios: 0,//TODO |
371 | importeImpuestoInterno2: 0,//TODO | 376 | importeImpuestoInterno: 0,//TODO |
372 | percepcion: 0,//TODO | 377 | importeImpuestoInterno1: 0,//TODO |
373 | percepcionIva: 0,//TODO | 378 | importeImpuestoInterno2: 0,//TODO |
374 | redondeo: 0,//TODO | 379 | percepcion: 0,//TODO |
375 | total: $scope.getTotal(), | 380 | percepcionIva: 0,//TODO |
376 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 381 | redondeo: 0,//TODO |
377 | anulado: false, | 382 | total: $scope.getTotal(), |
378 | planilla: 0,//TODO | 383 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
379 | lugar: 0,//TODO | 384 | anulado: false, |
380 | cuentaMadre: 0,// | 385 | planilla: 0,//TODO |
381 | cuentaContable: 0,//TODO | 386 | lugar: 0,//TODO |
382 | asiento: 0,//TODO | 387 | cuentaMadre: 0,// |
383 | e_hd: '',//TODO | 388 | cuentaContable: 0,//TODO |
384 | c_hd: '', | 389 | asiento: 0,//TODO |
385 | numeroLiquidoProducto: 0,//TODO | 390 | e_hd: '',//TODO |
386 | idVendedor: $scope.remito.idVendedor, | 391 | c_hd: '', |
387 | idProveedor: $scope.remito.idProveedor, | 392 | numeroLiquidoProducto: 0,//TODO |
388 | idDomicilio: 0,//TODO | 393 | idVendedor: $scope.remito.idVendedor, |
389 | domicilioStamp: $scope.remito.domicilioStamp, | 394 | idProveedor: $scope.remito.idProveedor, |
390 | idCotizacion: $scope.remito.cotizacion.ID, | 395 | idDomicilio: 0,//TODO |
391 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 396 | idCotizacion: $scope.remito.idCotizacion, |
392 | flete: $scope.remito.flete, | 397 | flete: $scope.remito.flete, |
393 | fob: $scope.remito.fob, | 398 | fob: $scope.remito.fob, |
394 | bomba: $scope.remito.bomba, | 399 | bomba: $scope.remito.bomba, |
395 | kilometros: $scope.remito.kilometros, | 400 | kilometros: $scope.remito.kilometros, |
396 | estado: 0,//TODO | 401 | estado: 0,//TODO |
397 | destinoVenta: 0,//TODO | 402 | destinoVenta: 0,//TODO |
398 | operacionTipo: 0//TODO | 403 | operacionTipo: 0//TODO |
404 | }, | ||
405 | notaPedido: $scope.notaPedido | ||
399 | }; | 406 | }; |
400 | crearRemitoService.crearRemito(remito).then( | 407 | crearRemitoService.crearRemito(save).then( |
401 | function(data) { | 408 | function(data) { |
402 | remitoBusinessService.addArticulos($scope.articulosTabla, | 409 | remitoBusinessService.addArticulos($scope.articulosTabla, |
403 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 410 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
404 | 411 | ||
405 | focaModalService.alert('Nota remito creada'); | 412 | focaModalService.alert('Nota remito creada'); |
406 | $scope.cabecera = []; | 413 | $scope.cabecera = []; |
407 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); | 414 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); |
408 | addCabecera( | 415 | addCabecera( |
409 | 'Fecha cotizacion:', | 416 | 'Fecha cotizacion:', |
410 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 417 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
411 | ); | 418 | ); |
412 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 419 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
413 | $scope.remito.vendedor = {}; | 420 | $scope.remito.vendedor = {}; |
414 | $scope.remito.cliente = {}; | 421 | $scope.remito.cliente = {}; |
415 | $scope.remito.proveedor = {}; | 422 | $scope.remito.proveedor = {}; |
416 | $scope.remito.domicilio = {}; | 423 | $scope.remito.domicilio = {}; |
417 | $scope.remito.flete = null; | 424 | $scope.remito.flete = null; |
418 | $scope.remito.fob = null; | 425 | $scope.remito.fob = null; |
419 | $scope.remito.bomba = null; | 426 | $scope.remito.bomba = null; |
420 | $scope.remito.kilometros = null; | 427 | $scope.remito.kilometros = null; |
421 | $scope.articulosTabla = []; | 428 | $scope.articulosTabla = []; |
422 | crearRemitoService.getNumeroRemito().then( | 429 | crearRemitoService.getNumeroRemito().then( |
423 | function(res) { | 430 | function(res) { |
424 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 431 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
425 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 432 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
426 | }, | 433 | }, |
427 | function(err) { | 434 | function(err) { |
428 | focaModalService | 435 | focaModalService |
429 | .alert('La terminal no esta configurada correctamente'); | 436 | .alert('La terminal no esta configurada correctamente'); |
430 | console.info(err); | 437 | console.info(err); |
431 | } | 438 | } |
432 | ); | 439 | ); |
440 | |||
441 | $scope.notaPedido = { | ||
442 | id: 0 | ||
443 | }; | ||
433 | } | 444 | } |
434 | ); | 445 | ); |
435 | }; | 446 | }; |
436 | 447 | ||
437 | $scope.seleccionarArticulo = function() { | 448 | $scope.seleccionarArticulo = function() { |
438 | if ($scope.idLista === undefined) { | 449 | if ($scope.idLista === undefined) { |
439 | focaModalService.alert( | 450 | focaModalService.alert( |
440 | 'Primero seleccione una lista de precio y condicion'); | 451 | 'Primero seleccione una lista de precio y condicion'); |
441 | return; | 452 | return; |
442 | } | 453 | } |
443 | var modalInstance = $uibModal.open( | 454 | var modalInstance = $uibModal.open( |
444 | { | 455 | { |
445 | ariaLabelledBy: 'Busqueda de Productos', | 456 | ariaLabelledBy: 'Busqueda de Productos', |
446 | templateUrl: 'modal-busqueda-productos.html', | 457 | templateUrl: 'modal-busqueda-productos.html', |
447 | controller: 'modalBusquedaProductosCtrl', | 458 | controller: 'modalBusquedaProductosCtrl', |
448 | resolve: { | 459 | resolve: { |
449 | parametroProducto: { | 460 | parametroProducto: { |
450 | idLista: $scope.idLista, | 461 | idLista: $scope.idLista, |
451 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 462 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
452 | simbolo: $scope.remito.moneda.simbolo | 463 | simbolo: $scope.remito.moneda.simbolo |
453 | } | 464 | } |
454 | }, | 465 | }, |
455 | size: 'lg' | 466 | size: 'lg' |
456 | } | 467 | } |
457 | ); | 468 | ); |
458 | modalInstance.result.then( | 469 | modalInstance.result.then( |
459 | function(producto) { | 470 | function(producto) { |
460 | var newArt = | 471 | var newArt = |
461 | { | 472 | { |
462 | id: 0, | 473 | id: 0, |
463 | codigo: producto.codigo, | 474 | codigo: producto.codigo, |
464 | sector: producto.sector, | 475 | sector: producto.sector, |
465 | sectorCodigo: producto.sector + '-' + producto.codigo, | 476 | sectorCodigo: producto.sector + '-' + producto.codigo, |
466 | descripcion: producto.descripcion, | 477 | descripcion: producto.descripcion, |
467 | item: $scope.articulosTabla.length + 1, | 478 | item: $scope.articulosTabla.length + 1, |
468 | nombre: producto.descripcion, | 479 | nombre: producto.descripcion, |
469 | precio: parseFloat(producto.precio.toFixed(4)), | 480 | precio: parseFloat(producto.precio.toFixed(4)), |
470 | costoUnitario: producto.costo, | 481 | costoUnitario: producto.costo, |
471 | editCantidad: false, | 482 | editCantidad: false, |
472 | editPrecio: false | 483 | editPrecio: false |
473 | }; | 484 | }; |
474 | $scope.articuloACargar = newArt; | 485 | $scope.articuloACargar = newArt; |
475 | $scope.cargando = false; | 486 | $scope.cargando = false; |
476 | }, function() { | 487 | }, function() { |
477 | // funcion ejecutada cuando se cancela el modal | 488 | // funcion ejecutada cuando se cancela el modal |
478 | } | 489 | } |
479 | ); | 490 | ); |
480 | }; | 491 | }; |
481 | 492 | ||
482 | $scope.seleccionarVendedor = function() { | 493 | $scope.seleccionarVendedor = function() { |
483 | var modalInstance = $uibModal.open( | 494 | var modalInstance = $uibModal.open( |
484 | { | 495 | { |
485 | ariaLabelledBy: 'Busqueda de Vendedores', | 496 | ariaLabelledBy: 'Busqueda de Vendedores', |
486 | templateUrl: 'modal-vendedores.html', | 497 | templateUrl: 'modal-vendedores.html', |
487 | controller: 'modalVendedoresCtrl', | 498 | controller: 'modalVendedoresCtrl', |
488 | size: 'lg' | 499 | size: 'lg' |
489 | } | 500 | } |
490 | ); | 501 | ); |
491 | modalInstance.result.then( | 502 | modalInstance.result.then( |
492 | function(vendedor) { | 503 | function(vendedor) { |
493 | addCabecera('Vendedor:', vendedor.NomVen); | 504 | addCabecera('Vendedor:', vendedor.NomVen); |
494 | $scope.remito.idVendedor = vendedor.CodVen; | 505 | $scope.remito.idVendedor = vendedor.CodVen; |
495 | }, function() { | 506 | }, function() { |
496 | 507 | ||
497 | } | 508 | } |
498 | ); | 509 | ); |
499 | }; | 510 | }; |
500 | 511 | ||
501 | $scope.seleccionarProveedor = function() { | 512 | $scope.seleccionarProveedor = function() { |
502 | var modalInstance = $uibModal.open( | 513 | var modalInstance = $uibModal.open( |
503 | { | 514 | { |
504 | ariaLabelledBy: 'Busqueda de Proveedor', | 515 | ariaLabelledBy: 'Busqueda de Proveedor', |
505 | templateUrl: 'modal-proveedor.html', | 516 | templateUrl: 'modal-proveedor.html', |
506 | controller: 'focaModalProveedorCtrl', | 517 | controller: 'focaModalProveedorCtrl', |
507 | size: 'lg', | 518 | size: 'lg', |
508 | resolve: { | 519 | resolve: { |
509 | transportista: function() { | 520 | transportista: function() { |
510 | return false; | 521 | return false; |
511 | } | 522 | } |
512 | } | 523 | } |
513 | } | 524 | } |
514 | ); | 525 | ); |
515 | modalInstance.result.then( | 526 | modalInstance.result.then( |
516 | function(proveedor) { | 527 | function(proveedor) { |
517 | $scope.remito.idProveedor = proveedor.COD; | 528 | $scope.remito.idProveedor = proveedor.COD; |
518 | addCabecera('Proveedor:', proveedor.NOM); | 529 | addCabecera('Proveedor:', proveedor.NOM); |
519 | }, function() { | 530 | }, function() { |
520 | 531 | ||
521 | } | 532 | } |
522 | ); | 533 | ); |
523 | }; | 534 | }; |
524 | 535 | ||
525 | $scope.seleccionarCliente = function() { | 536 | $scope.seleccionarCliente = function() { |
526 | 537 | ||
527 | var modalInstance = $uibModal.open( | 538 | var modalInstance = $uibModal.open( |
528 | { | 539 | { |
529 | ariaLabelledBy: 'Busqueda de Cliente', | 540 | ariaLabelledBy: 'Busqueda de Cliente', |
530 | templateUrl: 'foca-busqueda-cliente-modal.html', | 541 | templateUrl: 'foca-busqueda-cliente-modal.html', |
531 | controller: 'focaBusquedaClienteModalController', | 542 | controller: 'focaBusquedaClienteModalController', |
532 | size: 'lg' | 543 | size: 'lg' |
533 | } | 544 | } |
534 | ); | 545 | ); |
535 | modalInstance.result.then( | 546 | modalInstance.result.then( |
536 | function(cliente) { | 547 | function(cliente) { |
537 | $scope.abrirModalDomicilios(cliente); | 548 | $scope.abrirModalDomicilios(cliente); |
538 | }, function() { | 549 | }, function() { |
539 | 550 | ||
540 | } | 551 | } |
541 | ); | 552 | ); |
542 | }; | 553 | }; |
543 | 554 | ||
544 | $scope.abrirModalDomicilios = function(cliente) { | 555 | $scope.abrirModalDomicilios = function(cliente) { |
545 | var modalInstanceDomicilio = $uibModal.open( | 556 | var modalInstanceDomicilio = $uibModal.open( |
546 | { | 557 | { |
547 | ariaLabelledBy: 'Busqueda de Domicilios', | 558 | ariaLabelledBy: 'Busqueda de Domicilios', |
548 | templateUrl: 'modal-domicilio.html', | 559 | templateUrl: 'modal-domicilio.html', |
549 | controller: 'focaModalDomicilioController', | 560 | controller: 'focaModalDomicilioController', |
550 | resolve: { idCliente: function() { return cliente.cod; }}, | ||
551 | size: 'lg', | 561 | size: 'lg', |
562 | resolve: { idCliente: function() { return cliente.cod; }} | ||
552 | } | 563 | } |
553 | ); | 564 | ); |
554 | modalInstanceDomicilio.result.then( | 565 | modalInstanceDomicilio.result.then( |
555 | function(domicilio) { | 566 | function(domicilio) { |
556 | //$scope.remito.domicilio.id = domicilio.nivel2; | 567 | //$scope.remito.domicilio.id = domicilio.nivel2; |
557 | $scope.remito.cliente = { | 568 | $scope.remito.cliente = { |
558 | COD: cliente.cod, | 569 | COD: cliente.cod, |
559 | CUIT: cliente.cuit, | 570 | CUIT: cliente.cuit, |
560 | NOM: cliente.nom | 571 | NOM: cliente.nom |
561 | }; | 572 | }; |
562 | 573 | ||
563 | addCabecera('Cliente:', cliente.nom); | 574 | addCabecera('Cliente:', cliente.nom); |
564 | var domicilioStamp = | 575 | var domicilioStamp = |
565 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 576 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
566 | domicilio.Localidad + ', ' + domicilio.Provincia; | 577 | domicilio.Localidad + ', ' + domicilio.Provincia; |
567 | $scope.remito.domicilioStamp = domicilioStamp; | 578 | $scope.remito.domicilioStamp = domicilioStamp; |
568 | addCabecera('Domicilio:', domicilioStamp); | 579 | addCabecera('Domicilio:', domicilioStamp); |
569 | }, function() { | 580 | }, function() { |
570 | $scope.seleccionarCliente(); | 581 | $scope.seleccionarCliente(); |
571 | return; | 582 | return; |
572 | } | 583 | } |
573 | ); | 584 | ); |
574 | }; | 585 | }; |
575 | 586 | ||
576 | $scope.mostrarFichaCliente = function() { | 587 | $scope.mostrarFichaCliente = function() { |
577 | $uibModal.open( | 588 | $uibModal.open( |
578 | { | 589 | { |
579 | ariaLabelledBy: 'Datos del Cliente', | 590 | ariaLabelledBy: 'Datos del Cliente', |
580 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 591 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
581 | controller: 'focaCrearRemitoFichaClienteController', | 592 | controller: 'focaCrearRemitoFichaClienteController', |
582 | size: 'lg' | 593 | size: 'lg' |
583 | } | 594 | } |
584 | ); | 595 | ); |
585 | }; | 596 | }; |
586 | 597 | ||
587 | $scope.getTotal = function() { | 598 | $scope.getTotal = function() { |
588 | var total = 0; | 599 | var total = 0; |
589 | var arrayTempArticulos = $scope.articulosTabla; | 600 | var arrayTempArticulos = $scope.articulosTabla; |
590 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 601 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
591 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 602 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
592 | } | 603 | } |
593 | return parseFloat(total.toFixed(2)); | 604 | return parseFloat(total.toFixed(2)); |
594 | }; | 605 | }; |
595 | 606 | ||
596 | $scope.getSubTotal = function() { | 607 | $scope.getSubTotal = function() { |
597 | if($scope.articuloACargar) { | 608 | if($scope.articuloACargar) { |
598 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 609 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
599 | } | 610 | } |
600 | }; | 611 | }; |
601 | 612 | ||
602 | $scope.abrirModalListaPrecio = function() { | 613 | $scope.abrirModalListaPrecio = function() { |
603 | var modalInstance = $uibModal.open( | 614 | var modalInstance = $uibModal.open( |
604 | { | 615 | { |
605 | ariaLabelledBy: 'Busqueda de Precio Condición', | 616 | ariaLabelledBy: 'Busqueda de Precio Condición', |
606 | templateUrl: 'modal-precio-condicion.html', | 617 | templateUrl: 'modal-precio-condicion.html', |
607 | controller: 'focaModalPrecioCondicionController', | 618 | controller: 'focaModalPrecioCondicionController', |
608 | size: 'lg' | 619 | size: 'lg' |
609 | } | 620 | } |
610 | ); | 621 | ); |
611 | modalInstance.result.then( | 622 | modalInstance.result.then( |
612 | function(precioCondicion) { | 623 | function(precioCondicion) { |
613 | var cabecera = ''; | 624 | var cabecera = ''; |
614 | var plazosConcat = ''; | 625 | var plazosConcat = ''; |
615 | if(!Array.isArray(precioCondicion)) { | 626 | if(!Array.isArray(precioCondicion)) { |
616 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 627 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
617 | $scope.plazosPagos = precioCondicion.plazoPago; | 628 | $scope.plazosPagos = precioCondicion.plazoPago; |
618 | $scope.idLista = precioCondicion.idListaPrecio; | 629 | $scope.idLista = precioCondicion.idListaPrecio; |
619 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 630 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
620 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 631 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
621 | } | 632 | } |
622 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 633 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
623 | } else { //Cuando se ingresan los plazos manualmente | 634 | } else { //Cuando se ingresan los plazos manualmente |
624 | $scope.remito.idPrecioCondicion = 0; | 635 | $scope.remito.idPrecioCondicion = 0; |
625 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 636 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
626 | $scope.plazosPagos = precioCondicion; | 637 | $scope.plazosPagos = precioCondicion; |
627 | for(var j = 0; j < precioCondicion.length; j++) { | 638 | for(var j = 0; j < precioCondicion.length; j++) { |
628 | plazosConcat += precioCondicion[j].dias + ' '; | 639 | plazosConcat += precioCondicion[j].dias + ' '; |
629 | } | 640 | } |
630 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 641 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
631 | } | 642 | } |
632 | $scope.articulosTabla = []; | 643 | $scope.articulosTabla = []; |
633 | addCabecera('Precios y condiciones:', cabecera); | 644 | addCabecera('Precios y condiciones:', cabecera); |
634 | }, function() { | 645 | }, function() { |
635 | 646 | ||
636 | } | 647 | } |
637 | ); | 648 | ); |
638 | }; | 649 | }; |
639 | 650 | ||
640 | $scope.abrirModalFlete = function() { | 651 | $scope.abrirModalFlete = function() { |
641 | var modalInstance = $uibModal.open( | 652 | var modalInstance = $uibModal.open( |
642 | { | 653 | { |
643 | ariaLabelledBy: 'Busqueda de Flete', | 654 | ariaLabelledBy: 'Busqueda de Flete', |
644 | templateUrl: 'modal-flete.html', | 655 | templateUrl: 'modal-flete.html', |
645 | controller: 'focaModalFleteController', | 656 | controller: 'focaModalFleteController', |
646 | size: 'lg', | 657 | size: 'lg', |
647 | resolve: { | 658 | resolve: { |
648 | parametrosFlete: | 659 | parametrosFlete: |
649 | function() { | 660 | function() { |
650 | return { | 661 | return { |
651 | flete: $scope.remito.flete ? '1' : | 662 | flete: $scope.remito.flete ? '1' : |
652 | ($scope.remito.fob ? 'FOB' : | 663 | ($scope.remito.fob ? 'FOB' : |
653 | ($scope.remito.flete === undefined ? null : '0')), | 664 | ($scope.remito.flete === undefined ? null : '0')), |
654 | bomba: $scope.remito.bomba ? '1' : | 665 | bomba: $scope.remito.bomba ? '1' : |
655 | ($scope.remito.bomba === undefined ? null : '0'), | 666 | ($scope.remito.bomba === undefined ? null : '0'), |
656 | kilometros: $scope.remito.kilometros | 667 | kilometros: $scope.remito.kilometros |
657 | }; | 668 | }; |
658 | } | 669 | } |
659 | } | 670 | } |
660 | } | 671 | } |
661 | ); | 672 | ); |
662 | modalInstance.result.then( | 673 | modalInstance.result.then( |
663 | function(datos) { | 674 | function(datos) { |
664 | $scope.remito.flete = datos.flete; | 675 | $scope.remito.flete = datos.flete; |
665 | $scope.remito.fob = datos.FOB; | 676 | $scope.remito.fob = datos.FOB; |
666 | $scope.remito.bomba = datos.bomba; | 677 | $scope.remito.bomba = datos.bomba; |
667 | $scope.remito.kilometros = datos.kilometros; | 678 | $scope.remito.kilometros = datos.kilometros; |
668 | 679 | ||
669 | addCabecera('Flete:', datos.flete ? 'Si' : | 680 | addCabecera('Flete:', datos.flete ? 'Si' : |
670 | ($scope.remito.fob ? 'FOB' : 'No')); | 681 | ($scope.remito.fob ? 'FOB' : 'No')); |
671 | if(datos.flete) { | 682 | if(datos.flete) { |
672 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 683 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
673 | addCabecera('Kilometros:', datos.kilometros); | 684 | addCabecera('Kilometros:', datos.kilometros); |
674 | } else { | 685 | } else { |
675 | removeCabecera('Bomba:'); | 686 | removeCabecera('Bomba:'); |
676 | removeCabecera('Kilometros:'); | 687 | removeCabecera('Kilometros:'); |
677 | $scope.remito.fob = false; | 688 | $scope.remito.fob = false; |
678 | $scope.remito.bomba = false; | 689 | $scope.remito.bomba = false; |
679 | $scope.remito.kilometros = null; | 690 | $scope.remito.kilometros = null; |
680 | } | 691 | } |
681 | }, function() { | 692 | }, function() { |
682 | 693 | ||
683 | } | 694 | } |
684 | ); | 695 | ); |
685 | }; | 696 | }; |
686 | 697 | ||
687 | $scope.abrirModalMoneda = function() { | 698 | $scope.abrirModalMoneda = function() { |
688 | var modalInstance = $uibModal.open( | 699 | var modalInstance = $uibModal.open( |
689 | { | 700 | { |
690 | ariaLabelledBy: 'Busqueda de Moneda', | 701 | ariaLabelledBy: 'Busqueda de Moneda', |
691 | templateUrl: 'modal-moneda.html', | 702 | templateUrl: 'modal-moneda.html', |
692 | controller: 'focaModalMonedaController', | 703 | controller: 'focaModalMonedaController', |
693 | size: 'lg' | 704 | size: 'lg' |
694 | } | 705 | } |
695 | ); | 706 | ); |
696 | modalInstance.result.then( | 707 | modalInstance.result.then( |
697 | function(moneda) { | 708 | function(moneda) { |
698 | $scope.abrirModalCotizacion(moneda); | 709 | $scope.abrirModalCotizacion(moneda); |
699 | }, function() { | 710 | }, function() { |
700 | 711 | ||
701 | } | 712 | } |
702 | ); | 713 | ); |
703 | }; | 714 | }; |
704 | 715 | ||
705 | $scope.abrirModalCotizacion = function(moneda) { | 716 | $scope.abrirModalCotizacion = function(moneda) { |
706 | var modalInstance = $uibModal.open( | 717 | var modalInstance = $uibModal.open( |
707 | { | 718 | { |
708 | ariaLabelledBy: 'Busqueda de Cotización', | 719 | ariaLabelledBy: 'Busqueda de Cotización', |
709 | templateUrl: 'modal-cotizacion.html', | 720 | templateUrl: 'modal-cotizacion.html', |
710 | controller: 'focaModalCotizacionController', | 721 | controller: 'focaModalCotizacionController', |
711 | size: 'lg', | 722 | size: 'lg', |
712 | resolve: {idMoneda: function() {return moneda.ID;}} | 723 | resolve: {idMoneda: function() {return moneda.ID;}} |
713 | } | 724 | } |
714 | ); | 725 | ); |
715 | modalInstance.result.then( | 726 | modalInstance.result.then( |
716 | function(cotizacion) { | 727 | function(cotizacion) { |
717 | var articulosTablaTemp = $scope.articulosTabla; | 728 | var articulosTablaTemp = $scope.articulosTabla; |
718 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 729 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
719 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 730 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
720 | $scope.remito.cotizacion.COTIZACION; | 731 | $scope.remito.cotizacion.COTIZACION; |
721 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 732 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
722 | cotizacion.COTIZACION; | 733 | cotizacion.COTIZACION; |
723 | } | 734 | } |
724 | $scope.articulosTabla = articulosTablaTemp; | 735 | $scope.articulosTabla = articulosTablaTemp; |
725 | $scope.remito.moneda = { | 736 | $scope.remito.moneda = { |
726 | id: moneda.ID, | 737 | id: moneda.ID, |
727 | detalle: moneda.DETALLE, | 738 | detalle: moneda.DETALLE, |
728 | simbolo: moneda.SIMBOLO | 739 | simbolo: moneda.SIMBOLO |
729 | }; | 740 | }; |
730 | $scope.remito.cotizacion = { | 741 | $scope.remito.cotizacion = { |
731 | ID: cotizacion.ID, | 742 | ID: cotizacion.ID, |
732 | COTIZACION: cotizacion.COTIZACION, | 743 | COTIZACION: cotizacion.COTIZACION, |
733 | FECHA: cotizacion.FECHA | 744 | FECHA: cotizacion.FECHA |
734 | }; | 745 | }; |
735 | addCabecera('Moneda:', moneda.DETALLE); | 746 | addCabecera('Moneda:', moneda.DETALLE); |
736 | addCabecera( | 747 | addCabecera( |
737 | 'Fecha cotizacion:', | 748 | 'Fecha cotizacion:', |
738 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 749 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
739 | ); | 750 | ); |
740 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 751 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
741 | }, function() { | 752 | }, function() { |
742 | 753 | ||
743 | } | 754 | } |
744 | ); | 755 | ); |
745 | }; | 756 | }; |
746 | 757 | ||
747 | $scope.agregarATabla = function(key) { | 758 | $scope.agregarATabla = function(key) { |
748 | if(key === 13) { | 759 | if(key === 13) { |
749 | if($scope.articuloACargar.cantidad === undefined || | 760 | if($scope.articuloACargar.cantidad === undefined || |
750 | $scope.articuloACargar.cantidad === 0 || | 761 | $scope.articuloACargar.cantidad === 0 || |
751 | $scope.articuloACargar.cantidad === null ) { | 762 | $scope.articuloACargar.cantidad === null ) { |
752 | focaModalService.alert('El valor debe ser al menos 1'); | 763 | focaModalService.alert('El valor debe ser al menos 1'); |
753 | return; | 764 | return; |
754 | } | 765 | } |
755 | delete $scope.articuloACargar.sectorCodigo; | 766 | delete $scope.articuloACargar.sectorCodigo; |
756 | $scope.articulosTabla.push($scope.articuloACargar); | 767 | $scope.articulosTabla.push($scope.articuloACargar); |
757 | $scope.cargando = true; | 768 | $scope.cargando = true; |
758 | } | 769 | } |
759 | }; | 770 | }; |
760 | 771 | ||
761 | $scope.quitarArticulo = function(key) { | 772 | $scope.quitarArticulo = function(key) { |
762 | $scope.articulosTabla.splice(key, 1); | 773 | $scope.articulosTabla.splice(key, 1); |
763 | }; | 774 | }; |
764 | 775 | ||
765 | $scope.editarArticulo = function(key, articulo) { | 776 | $scope.editarArticulo = function(key, articulo) { |
766 | if(key === 13) { | 777 | if(key === 13) { |
767 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 778 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
768 | articulo.cantidad === undefined) { | 779 | articulo.cantidad === undefined) { |
769 | focaModalService.alert('El valor debe ser al menos 1'); | 780 | focaModalService.alert('El valor debe ser al menos 1'); |
770 | return; | 781 | return; |
771 | } | 782 | } |
772 | articulo.editCantidad = false; | 783 | articulo.editCantidad = false; |
773 | articulo.editPrecio = false; | 784 | articulo.editPrecio = false; |
774 | } | 785 | } |
775 | }; | 786 | }; |
776 | 787 | ||
777 | $scope.cambioEdit = function(articulo, propiedad) { | 788 | $scope.cambioEdit = function(articulo, propiedad) { |
778 | if(propiedad === 'cantidad') { | 789 | if(propiedad === 'cantidad') { |
779 | articulo.editCantidad = true; | 790 | articulo.editCantidad = true; |
780 | } else if(propiedad === 'precio') { | 791 | } else if(propiedad === 'precio') { |
781 | articulo.editPrecio = true; | 792 | articulo.editPrecio = true; |
782 | } | 793 | } |
783 | }; | 794 | }; |
784 | 795 | ||
785 | $scope.limpiarFlete = function() { | 796 | $scope.limpiarFlete = function() { |
786 | $scope.remito.fleteNombre = ''; | 797 | $scope.remito.fleteNombre = ''; |
787 | $scope.remito.chofer = ''; | 798 | $scope.remito.chofer = ''; |
788 | $scope.remito.vehiculo = ''; | 799 | $scope.remito.vehiculo = ''; |
789 | $scope.remito.kilometros = ''; | 800 | $scope.remito.kilometros = ''; |
790 | $scope.remito.costoUnitarioKmFlete = ''; | 801 | $scope.remito.costoUnitarioKmFlete = ''; |
791 | $scope.choferes = ''; | 802 | $scope.choferes = ''; |
792 | $scope.vehiculos = ''; | 803 | $scope.vehiculos = ''; |
793 | }; | 804 | }; |
794 | 805 | ||
795 | $scope.limpiarPantalla = function() { | 806 | $scope.limpiarPantalla = function() { |
796 | $scope.limpiarFlete(); | 807 | $scope.limpiarFlete(); |
797 | $scope.remito.flete = '0'; | 808 | $scope.remito.flete = '0'; |
798 | $scope.remito.bomba = '0'; | 809 | $scope.remito.bomba = '0'; |
799 | $scope.remito.precioCondicion = ''; | 810 | $scope.remito.precioCondicion = ''; |
800 | $scope.articulosTabla = []; | 811 | $scope.articulosTabla = []; |
801 | $scope.remito.vendedor.nombre = ''; | 812 | $scope.remito.vendedor.nombre = ''; |
802 | $scope.remito.cliente = {nombre: ''}; | 813 | $scope.remito.cliente = {nombre: ''}; |
803 | $scope.remito.domicilio = {dom: ''}; | 814 | $scope.remito.domicilio = {dom: ''}; |
804 | $scope.domiciliosCliente = []; | 815 | $scope.domiciliosCliente = []; |
805 | }; | 816 | }; |
806 | 817 | ||
807 | $scope.resetFilter = function() { | 818 | $scope.resetFilter = function() { |
808 | $scope.articuloACargar = {}; | 819 | $scope.articuloACargar = {}; |
809 | $scope.cargando = true; | 820 | $scope.cargando = true; |
810 | }; | 821 | }; |
811 | 822 | ||
812 | $scope.selectFocus = function($event) { | 823 | $scope.selectFocus = function($event) { |
813 | $event.target.select(); | 824 | $event.target.select(); |
814 | }; | 825 | }; |
815 | 826 | ||
816 | $scope.salir = function() { | 827 | $scope.salir = function() { |
817 | $location.path('/'); | 828 | $location.path('/'); |
818 | }; | 829 | }; |
819 | function addArrayCabecera(array) { | 830 | function addArrayCabecera(array) { |
820 | for(var i = 0; i < array.length; i++) { | 831 | for(var i = 0; i < array.length; i++) { |
821 | addCabecera(array[i].label, array[i].valor); | 832 | addCabecera(array[i].label, array[i].valor); |
822 | } | 833 | } |
823 | } | 834 | } |
824 | 835 | ||
825 | function addCabecera(label, valor) { | 836 | function addCabecera(label, valor) { |
826 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 837 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
827 | if(propiedad.length === 1) { | 838 | if(propiedad.length === 1) { |
828 | propiedad[0].valor = valor; | 839 | propiedad[0].valor = valor; |
829 | } else { | 840 | } else { |
830 | $scope.cabecera.push({label: label, valor: valor}); | 841 | $scope.cabecera.push({label: label, valor: valor}); |
831 | } | 842 | } |
832 | } | 843 | } |
833 | 844 | ||
834 | function removeCabecera(label) { | 845 | function removeCabecera(label) { |
835 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 846 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
836 | if(propiedad.length === 1) { | 847 | if(propiedad.length === 1) { |
837 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 848 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
838 | } | 849 | } |
839 | } | 850 | } |
840 | 851 | ||
841 | function rellenar(relleno, longitud) { | 852 | function rellenar(relleno, longitud) { |
842 | relleno = '' + relleno; | 853 | relleno = '' + relleno; |
843 | while (relleno.length < longitud) { | 854 | while (relleno.length < longitud) { |
844 | relleno = '0' + relleno; | 855 | relleno = '0' + relleno; |
845 | } | 856 | } |
846 | 857 | ||
847 | return relleno; | 858 | return relleno; |
848 | } | 859 | } |
849 | } | 860 | } |
850 | ] | 861 | ] |
851 | ) | 862 | ) |
852 | .controller('remitoListaCtrl', [ | 863 | .controller('remitoListaCtrl', [ |
853 | '$scope', | 864 | '$scope', |
854 | 'crearRemitoService', | 865 | 'crearRemitoService', |
855 | '$location', | 866 | '$location', |
856 | function($scope, crearRemitoService, $location) { | 867 | function($scope, crearRemitoService, $location) { |
857 | crearRemitoService.obtenerRemito().then(function(datos) { | 868 | crearRemitoService.obtenerRemito().then(function(datos) { |
858 | $scope.remitos = datos.data; | 869 | $scope.remitos = datos.data; |
859 | }); | 870 | }); |
860 | $scope.editar = function(remito) { | 871 | $scope.editar = function(remito) { |
861 | crearRemitoService.setRemito(remito); | 872 | crearRemitoService.setRemito(remito); |
862 | $location.path('/venta-nota-remito/abm/'); | 873 | $location.path('/venta-nota-remito/abm/'); |
863 | }; | 874 | }; |
864 | $scope.crearRemito = function() { | 875 | $scope.crearRemito = function() { |
865 | crearRemitoService.clearRemito(); | 876 | crearRemitoService.clearRemito(); |
866 | $location.path('/venta-nota-remito/abm/'); | 877 | $location.path('/venta-nota-remito/abm/'); |
867 | }; | 878 | }; |
868 | } | 879 | } |
869 | ]) | 880 | ]) |
870 | .controller('focaCrearRemitoFichaClienteController', [ | 881 | .controller('focaCrearRemitoFichaClienteController', [ |
871 | '$scope', | 882 | '$scope', |
872 | 'crearRemitoService', | 883 | 'crearRemitoService', |
873 | '$location', | 884 | '$location', |
874 | function($scope, crearRemitoService, $location) { | 885 | function($scope, crearRemitoService, $location) { |
875 | crearRemitoService.obtenerRemito().then(function(datos) { | 886 | crearRemitoService.obtenerRemito().then(function(datos) { |
876 | $scope.remitos = datos.data; | 887 | $scope.remitos = datos.data; |
877 | }); | 888 | }); |
878 | $scope.editar = function(remito) { | 889 | $scope.editar = function(remito) { |
879 | crearRemitoService.setRemito(remito); | 890 | crearRemitoService.setRemito(remito); |
880 | $location.path('/venta-nota-remito/abm/'); | 891 | $location.path('/venta-nota-remito/abm/'); |
881 | }; | 892 | }; |
882 | $scope.crearRemito = function() { | 893 | $scope.crearRemito = function() { |
883 | crearRemitoService.clearRemito(); | 894 | crearRemitoService.clearRemito(); |
884 | $location.path('/venta-nota-remito/abm/'); | 895 | $location.path('/venta-nota-remito/abm/'); |
885 | }; | 896 | }; |
886 | } | 897 | } |
887 | ]); | 898 | ]); |
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 |