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