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