Compare View
Commits (111)
-
Master(efernandez) See merge request !2
-
Master(mpuebla) See merge request !3
-
Master(efernandez) See merge request !4
-
Master(efernandez) See merge request !5
-
Master(mpuebla) See merge request !6
-
Master(efernandez) See merge request !7
-
Master(mpuebla) See merge request !8
-
Master(mpuebla) See merge request !9
-
Master(efernandez) See merge request !10
-
Master(efernandez) See merge request !11
-
Master(efernandez) See merge request !12
-
Master(mpuebla) See merge request !13
-
Master(efernandez) See merge request !14
-
Master See merge request !15
-
Master(efernandez) See merge request !16
-
Master(mpuebla) See merge request !17
-
Master(mpuebla) See merge request !18
-
Master(efernandez) See merge request !19
-
Master(efernandez) See merge request !20
-
Master See merge request !21
-
Master(mpuebla) See merge request !22
-
Master(efernandez) See merge request !23
-
Master(efernandez) See merge request !24
-
Master(efernandez) See merge request !25
-
Master(efernandez) See merge request !26
-
Master(mpuebla) See merge request !27
-
Master(mpuebla) See merge request !28
-
Master(efernandez) See merge request !29
-
Master(efernandez) See merge request !30
-
Master(efernandez) See merge request !31
-
Master(mpuebla) See merge request !32
-
Master(mpuebla) See merge request !33
-
Master(efernandez) See merge request !34
-
Master(mpuebla) See merge request !35
-
Master(efernandez) See merge request !36
-
Master(mpuebla) See merge request !37
-
Master(mpuebla) See merge request !38
-
Master(efernandez) See merge request !39
-
Master(efernandez) See merge request !40
Showing
11 changed files
Show diff stats
package.json
1 | { | 1 | { |
2 | "name": "foca-crear-factura", | 2 | "name": "foca-crear-factura", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "", | 4 | "description": "", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "frefresh": "gulp uglify && cp tmp/foca-crear-factura.js ../wrapper-facturador/node_modules/foca-crear-factura/dist/foca-crear-factura.min.js", | ||
8 | "refresh": "gulp uglify && cp tmp/foca-crear-factura.js ../wrapper-demo/node_modules/foca-crear-factura/dist/foca-crear-factura.min.js", | ||
7 | "frefresh": "gulp uglify && cp tmp/foca-crear-factura.js ../wrapper-facturador/node_modules/foca-crear-factura/dist/foca-crear-factura.min.js", | 9 | "test": "echo \"Error: no test specified\" && exit 1", |
10 | "compile": "gulp uglify", | ||
11 | "gulp-pre-commit": "gulp pre-commit", | ||
12 | "postinstall": "npm run compile && gulp clean-post-install", | ||
8 | "refresh": "gulp uglify && cp tmp/foca-crear-factura.js ../wrapper-demo/node_modules/foca-crear-factura/dist/foca-crear-factura.min.js", | 13 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump" |
9 | "test": "echo \"Error: no test specified\" && exit 1", | 14 | }, |
15 | "pre-commit": "gulp-pre-commit", | ||
10 | "compile": "gulp uglify", | 16 | "repository": { |
11 | "gulp-pre-commit": "gulp pre-commit", | 17 | "type": "git", |
12 | "postinstall": "npm run compile && gulp clean-post-install", | 18 | "url": "http://git.focasoftware.com/npm/foca-crear-factura.git" |
13 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump" | 19 | }, |
14 | }, | 20 | "author": "Foca Software", |
15 | "pre-commit": "gulp-pre-commit", | 21 | "license": "ISC", |
16 | "repository": { | 22 | "devDependencies": { |
17 | "type": "git", | 23 | "angular": "^1.7.8", |
18 | "url": "http://git.focasoftware.com/npm/foca-crear-factura.git" | 24 | "angular-cookies": "^1.7.8", |
19 | }, | 25 | "angular-ladda": "^0.4.3", |
20 | "author": "Foca Software", | 26 | "angular-route": "^1.7.8", |
21 | "license": "ISC", | 27 | "bootstrap": "^4.3.1", |
22 | "devDependencies": { | 28 | "font-awesome": "^4.7.0", |
23 | "angular": "^1.7.8", | 29 | "gulp": "^3.9.1", |
24 | "angular-cookies": "^1.7.8", | 30 | "gulp-angular-templatecache": "^3.0.0", |
25 | "angular-ladda": "^0.4.3", | 31 | "gulp-clean": "^0.4.0", |
26 | "angular-route": "^1.7.8", | 32 | "gulp-connect": "^5.7.0", |
27 | "bootstrap": "^4.3.1", | 33 | "gulp-htmlmin": "^5.0.1", |
28 | "font-awesome": "^4.7.0", | 34 | "gulp-jshint": "^2.1.0", |
29 | "gulp": "^3.9.1", | 35 | "gulp-rename": "^1.4.0", |
30 | "gulp-angular-templatecache": "^3.0.0", | 36 | "gulp-replace": "^1.0.0", |
31 | "gulp-clean": "^0.4.0", | 37 | "gulp-sequence": "^1.0.0", |
32 | "gulp-connect": "^5.7.0", | 38 | "gulp-uglify": "^3.0.2", |
33 | "gulp-htmlmin": "^5.0.1", | 39 | "gulp-uglify-es": "^1.0.4", |
34 | "gulp-jshint": "^2.1.0", | 40 | "jasmine-core": "^3.4.0", |
35 | "gulp-rename": "^1.4.0", | 41 | "jquery": "^3.4.1", |
36 | "gulp-replace": "^1.0.0", | 42 | "jshint": "^2.10.2", |
37 | "gulp-sequence": "^1.0.0", | 43 | "ladda": "^1.0.6", |
38 | "gulp-uglify": "^3.0.2", | 44 | "pre-commit": "^1.2.2", |
39 | "gulp-uglify-es": "^1.0.4", | 45 | "pump": "^3.0.0", |
40 | "jasmine-core": "^3.4.0", | 46 | "ui-bootstrap4": "^3.0.6" |
41 | "jquery": "^3.4.1", | 47 | } |
42 | "jshint": "^2.10.2", | 48 | } |
43 | "ladda": "^1.0.6", | 49 |
src/js/controller.js
1 | angular.module('focaCrearFactura').controller('facturaController', [ | 1 | angular.module('focaCrearFactura').controller('facturaController', [ |
2 | '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', | 2 | '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', |
3 | 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', | 3 | 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', |
4 | '$localStorage', 'APP', 'focaLoginService', | 4 | '$localStorage', 'APP', 'focaLoginService', |
5 | function ( | 5 | function ( |
6 | $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, |
7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP, loginServ) { | 7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP, loginServ) { |
8 | 8 | ||
9 | config(); | 9 | config(); |
10 | 10 | ||
11 | function config() { | 11 | function config() { |
12 | $scope.tmpCantidad = '0'; | 12 | $scope.tmpCantidad = '0'; |
13 | $scope.botonera = crearFacturaService.getBotonera(); | ||
14 | $scope.botoneraProductos = []; | 13 | $scope.botonera = crearFacturaService.getBotonera(); |
14 | $scope.botoneraProductos = []; | ||
15 | $scope.isNumber = angular.isNumber; | 15 | $scope.isNumber = angular.isNumber; |
16 | $scope.datepickerAbierto = false; | 16 | $scope.datepickerAbierto = false; |
17 | $scope.show = false; | 17 | $scope.show = false; |
18 | $scope.cargando = true; | 18 | $scope.cargando = true; |
19 | $scope.now = new Date(); | 19 | $scope.now = new Date(); |
20 | $scope.puntoVenta = rellenar(0, 4); | 20 | $scope.puntoVenta = rellenar(0, 4); |
21 | $scope.comprobante = rellenar(0, 8); | 21 | $scope.comprobante = rellenar(0, 8); |
22 | $scope.dateOptions = { | 22 | $scope.dateOptions = { |
23 | maxDate: new Date(), | 23 | maxDate: new Date(), |
24 | minDate: new Date(2010, 0, 1) | 24 | minDate: new Date(2010, 0, 1) |
25 | }; | 25 | }; |
26 | $scope.cabeceras = []; | 26 | $scope.cabeceras = []; |
27 | crearFacturaService.getParametros().then(function (res) { | 27 | crearFacturaService.getParametros().then(function (res) { |
28 | 28 | ||
29 | var parametros = JSON.parse(res.data[0].jsonText); | 29 | var parametros = JSON.parse(res.data[0].jsonText); |
30 | 30 | ||
31 | if ($localStorage.factura) { | 31 | if ($localStorage.factura) { |
32 | 32 | ||
33 | $timeout(function () { getLSFactura(); }); | 33 | $timeout(function () { getLSFactura(); }); |
34 | } else { | 34 | } else { |
35 | 35 | ||
36 | for (var property in parametros) { | 36 | for (var property in parametros) { |
37 | $scope.factura[property] = parametros[property]; | 37 | $scope.factura[property] = parametros[property]; |
38 | $scope.inicial[property] = parametros[property]; | 38 | $scope.inicial[property] = parametros[property]; |
39 | } | 39 | } |
40 | 40 | ||
41 | setearFactura($scope.factura); | 41 | setearFactura($scope.factura); |
42 | } | 42 | } |
43 | 43 | ||
44 | }); | 44 | }); |
45 | 45 | ||
46 | //SETEO BOTONERA LATERAL | 46 | //SETEO BOTONERA LATERAL |
47 | $timeout(function () { | 47 | $timeout(function () { |
48 | focaBotoneraLateralService.showSalir(false); | 48 | focaBotoneraLateralService.showSalir(false); |
49 | focaBotoneraLateralService.showPausar(true); | 49 | focaBotoneraLateralService.showPausar(true); |
50 | focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); | 50 | focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); |
51 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); | 51 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); |
52 | }); | 52 | }); |
53 | 53 | ||
54 | init(); | 54 | init(); |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | function init() { | 58 | function init() { |
59 | 59 | ||
60 | $scope.$broadcast('cleanCabecera'); | 60 | $scope.$broadcast('cleanCabecera'); |
61 | 61 | ||
62 | $scope.factura = { | 62 | $scope.factura = { |
63 | id: 0, | 63 | id: 0, |
64 | estado: 0, | 64 | estado: 0, |
65 | vendedor: {}, | 65 | vendedor: {}, |
66 | cliente: {}, | 66 | cliente: {}, |
67 | proveedor: {}, | 67 | proveedor: {}, |
68 | domicilio: { dom: '' }, | 68 | domicilio: { dom: '' }, |
69 | moneda: {}, | 69 | moneda: {}, |
70 | formaPago: 1, // Por defecto paga contado | ||
70 | formaPago: 1, // Por defecto paga contado | 71 | cotizacion: $scope.cotizacionPorDefecto || {}, |
71 | cotizacion: $scope.cotizacionPorDefecto || {}, | 72 | articulosFactura: [], |
73 | despachos: [] | ||
72 | articulosFactura: [], | 74 | }; |
73 | despachos: [] | 75 | |
74 | }; | 76 | $scope.factura.articulosFactura = []; |
75 | 77 | $scope.idLista = undefined; | |
76 | $scope.factura.articulosFactura = []; | 78 | |
77 | $scope.idLista = undefined; | ||
78 | |||
79 | $scope.inicial = angular.copy($scope.factura); | ||
80 | |||
81 | getNumeroFactura('B'); | ||
82 | |||
83 | if (APP === 'facturador') { | ||
84 | crearFacturaService | ||
85 | .getVendedorPlayaById(loginServ.getLoginData().vendedorPlaya) | ||
86 | .then(function (res) { | ||
87 | |||
88 | validarPlanillaVendedor(res.data) | 79 | $scope.inicial = angular.copy($scope.factura); |
80 | |||
81 | getNumeroFactura('B'); | ||
82 | |||
83 | if (APP === 'facturador') { | ||
84 | crearFacturaService | ||
85 | .getVendedorPlayaById(loginServ.getLoginData().vendedorPlaya) | ||
86 | .then(function (res) { | ||
87 | |||
88 | validarPlanillaVendedor(res.data) | ||
89 | .then(function () { | ||
90 | |||
91 | $scope.$broadcast('addCabecera', { | ||
92 | label: 'Vendedor:', | ||
93 | valor: $filter('rellenarDigitos')(res.data.CodVen, 3) + | ||
94 | ' - ' + | ||
95 | res.data.NomVen | ||
96 | }); | ||
97 | $scope.$broadcast('addCabecera', { | ||
98 | label: 'Planilla:', | ||
99 | valor: res.data.NplVen | ||
100 | }); | ||
101 | |||
102 | $scope.factura.vendedor = res.data; | ||
103 | $scope.inicial.vendedor = res.data; | ||
104 | |||
105 | getProductosByPlanilla(res.data.NplVen); | ||
106 | }) | ||
107 | .catch(function (err) { | ||
108 | console.log(err); | ||
109 | focaModalService.alert('Ocurrió un error al intentar recuperar' + | ||
110 | 'el vendedor logeado'); | ||
111 | }); | ||
112 | }); | ||
113 | } | ||
89 | .then(function () { | 114 | } |
90 | 115 | ||
91 | $scope.$broadcast('addCabecera', { | 116 | $scope.$watch('factura', function (newValue) { |
92 | label: 'Vendedor:', | 117 | focaBotoneraLateralService.setPausarData({ |
93 | valor: $filter('rellenarDigitos')(res.data.CodVen, 3) + | 118 | label: 'factura', |
94 | ' - ' + | 119 | val: newValue |
95 | res.data.NomVen | 120 | }); |
96 | }); | 121 | }, true); |
97 | $scope.$broadcast('addCabecera', { | 122 | |
98 | label: 'Planilla:', | 123 | $scope.seleccionarFormaDePago = function () { |
99 | valor: res.data.NplVen | 124 | |
100 | }); | 125 | if (!validarGuardar()) return; |
101 | 126 | ||
127 | if ($scope.factura.formaPago === 2) { | ||
128 | $scope.crearFactura(); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | var modalInstance = $uibModal.open( | ||
133 | { | ||
134 | templateUrl: 'modal-forma-pago.html', | ||
135 | controller: 'focaModalFormaPagoController', | ||
136 | resolve: { | ||
137 | parametros: function () { | ||
138 | return { | ||
139 | importe: $scope.getTotal() | ||
140 | }; | ||
141 | }, | ||
142 | }, | ||
143 | size: 'lg', | ||
144 | } | ||
145 | ); | ||
146 | modalInstance.result | ||
147 | .then(function (data) { | ||
148 | |||
149 | if (data.tipo === 'tarjeta') { | ||
150 | $scope.factura.formaPago = 4; | ||
151 | } else { | ||
152 | $scope.factura.formaPago = 1; | ||
153 | } | ||
154 | |||
155 | $scope.crearFactura(data); | ||
156 | }) | ||
157 | .catch(function (e) { console.error(e); }); | ||
158 | }; | ||
159 | |||
160 | $scope.crearFactura = function (formaPago) { | ||
161 | |||
102 | $scope.factura.vendedor = res.data; | 162 | var save = { |
103 | $scope.inicial.vendedor = res.data; | 163 | factura: { |
104 | 164 | ||
105 | getProductosByPlanilla(res.data.NplVen); | 165 | BONIF: 0, |
106 | }) | 166 | CLI: $scope.factura.cliente.COD, |
107 | .catch(function (err) { | 167 | CUI: $scope.factura.cliente.CUIT, |
108 | console.log(err); | 168 | CTA: $scope.factura.cliente.COD, |
109 | focaModalService.alert('Ocurrió un error al intentar recuperar' + | 169 | DC1: '', |
110 | 'el vendedor logeado'); | 170 | DC2: '', |
111 | }); | 171 | DE1: '', |
112 | }); | 172 | DOM: $scope.factura.cliente.DOM, |
113 | } | 173 | FACAUT: 0, |
114 | } | 174 | DTO: 0, |
115 | 175 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), | |
116 | $scope.$watch('factura', function (newValue) { | 176 | FEC_ANT: '19000101', |
117 | focaBotoneraLateralService.setPausarData({ | 177 | FPA: $scope.factura.formaPago, |
118 | label: 'factura', | 178 | IDEXCEPCION: 0, |
119 | val: newValue | 179 | IDLP: $scope.factura.cliente.MOD.trim() || 0, |
120 | }); | 180 | IDPERSONERIA: 0, |
121 | }, true); | 181 | IMI: getImporte('IMI'), |
122 | 182 | IMI2: getImporte('IMI2'), | |
123 | $scope.seleccionarFormaDePago = function () { | 183 | IMI3: getImporte('IMI3'), |
124 | 184 | IMP_LEY: 0, | |
125 | if (!validarGuardar()) return; | 185 | IRI: getImporte('IVA'), |
126 | 186 | IRS: 0, | |
127 | if ($scope.factura.formaPago === 2) { | 187 | LEG: '', |
128 | $scope.crearFactura(); | 188 | LUG: $scope.factura.vendedor.LugVen, |
129 | return; | 189 | MK_M: 0, |
130 | } | 190 | NEE: getImporte('NEX'), |
131 | 191 | NET: getImporte('NET'), | |
132 | var modalInstance = $uibModal.open( | 192 | NFI: '', |
133 | { | 193 | NNP: 0, |
134 | templateUrl: 'modal-forma-pago.html', | 194 | NOM: $scope.factura.cliente.NOM, |
135 | controller: 'focaModalFormaPagoController', | 195 | OPE: $scope.factura.vendedor.CodVen, |
136 | resolve: { | 196 | PAG: $scope.getTotal(), |
137 | parametros: function () { | 197 | PER: 0, |
138 | return { | 198 | PER_IVA: 0, |
139 | importe: $scope.getTotal() | 199 | PLA: $scope.factura.vendedor.NplVen, |
140 | }; | 200 | PRO: '', |
141 | }, | 201 | REC_ANT: 0, |
142 | }, | 202 | SUC: parseInt($scope.puntoVenta), |
143 | size: 'lg', | 203 | TCA: 1, |
144 | } | 204 | TCO: 'FT', |
145 | ); | 205 | TFI: '', |
146 | modalInstance.result | 206 | TIP: $scope.factura.cliente.TIP, |
147 | .then(function (data) { | 207 | TIV: $scope.factura.cliente.IVA, |
148 | 208 | TOT: $scope.getTotal(), | |
149 | if (data.tipo === 'tarjeta') { | 209 | TUR: $scope.factura.vendedor.TurVen, |
150 | $scope.factura.formaPago = 4; | 210 | VEN: $scope.factura.vendedor.CodVen, |
151 | } else { | 211 | VTO_CLI: '', |
152 | $scope.factura.formaPago = 1; | 212 | ZON: 1, // TODO: ZON DE APAREMP |
153 | } | 213 | OBSERVACIONES: $scope.factura.observaciones |
154 | 214 | }, | |
155 | $scope.crearFactura(data); | 215 | cuerpo: $scope.articulosFiltro(), |
216 | despachos: $scope.factura.despachos, | ||
217 | formaPago: formaPago | ||
156 | }) | 218 | }; |
157 | .catch(function (e) { console.error(e); }); | 219 | |
158 | }; | 220 | crearFacturaService.guardarFactura(save).then(function () { |
159 | 221 | ||
160 | $scope.crearFactura = function (formaPago) { | 222 | focaBotoneraLateralService.endGuardar(true); |
161 | 223 | ||
162 | var save = { | 224 | focaModalService.alert('Comprobante guardado con éxito'); |
163 | factura: { | 225 | |
164 | 226 | config(); | |
165 | BONIF: 0, | 227 | |
166 | CLI: $scope.factura.cliente.COD, | 228 | }).catch(function (err) { |
167 | CUI: $scope.factura.cliente.CUIT, | 229 | focaModalService.alert('Hubo un error al guardar la factura'); |
168 | CTA: $scope.factura.cliente.COD, | 230 | console.error(err); |
169 | DC1: '', | 231 | }); |
170 | DC2: '', | 232 | |
171 | DE1: '', | 233 | }; |
172 | DOM: $scope.factura.cliente.DOM, | 234 | |
173 | FACAUT: 0, | 235 | $scope.seleccionarCliente = function () { |
174 | DTO: 0, | 236 | |
175 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), | 237 | var modalInstance = $uibModal.open( |
176 | FEC_ANT: '19000101', | 238 | { |
177 | FPA: $scope.factura.formaPago, | 239 | ariaLabelledBy: 'Busqueda de Cliente', |
178 | IDEXCEPCION: 0, | 240 | templateUrl: 'foca-busqueda-cliente-modal.html', |
179 | IDLP: $scope.factura.cliente.MOD.trim() || 0, | 241 | controller: 'focaBusquedaClienteModalController', |
180 | IDPERSONERIA: 0, | 242 | resolve: { |
181 | IMI: getImporte('IMI'), | 243 | parametros: function () { |
182 | IMI2: getImporte('IMI2'), | 244 | return { |
245 | vendedor: function () { return null; }, | ||
246 | cobrador: function () { return null; } | ||
247 | }; | ||
248 | } | ||
183 | IMI3: getImporte('IMI3'), | 249 | }, |
184 | IMP_LEY: 0, | 250 | size: 'lg' |
185 | IRI: getImporte('IVA'), | 251 | } |
186 | IRS: 0, | 252 | ); |
187 | LEG: '', | 253 | modalInstance.result.then( |
188 | LUG: $scope.factura.vendedor.LugVen, | 254 | function (cliente) { |
189 | MK_M: 0, | 255 | var modalInstance = $uibModal.open( |
256 | { | ||
257 | templateUrl: 'modal-estado-cuenta.html', | ||
258 | controller: 'focaModalEstadoCuentaController', | ||
259 | size: 'lg', | ||
260 | resolve: { | ||
261 | parametros: function () { | ||
262 | return { | ||
263 | idCliente: cliente.COD, | ||
264 | nombreCliente: cliente.NOM | ||
265 | }; | ||
266 | }, | ||
267 | } | ||
268 | } | ||
269 | ); | ||
270 | modalInstance.result | ||
271 | .then(function (data) { | ||
190 | NEE: getImporte('NEX'), | 272 | |
191 | NET: getImporte('NET'), | 273 | $scope.factura.formaPago = data.formaDePago; |
192 | NFI: '', | 274 | $scope.factura.cliente = cliente; |
193 | NNP: 0, | 275 | |
194 | NOM: $scope.factura.cliente.NOM, | 276 | getNumeroFactura(cliente.TIP); |
277 | |||
278 | $scope.$broadcast('addCabecera', { | ||
279 | label: 'Cliente:', | ||
280 | valor: $filter('rellenarDigitos')(cliente.COD, 3) + | ||
281 | ' - ' + cliente.NOM | ||
282 | }); | ||
195 | OPE: $scope.factura.vendedor.CodVen, | 283 | |
196 | PAG: $scope.getTotal(), | 284 | $filter('filter')($scope.botonera, |
285 | { label: 'Cliente' })[0].checked = true; | ||
286 | |||
287 | $scope.$broadcast('addCabecera', { | ||
288 | label: 'Forma de pago: ', | ||
289 | valor: data.tipo | ||
290 | }); | ||
291 | }) | ||
292 | .catch($scope.seleccionarCliente); | ||
197 | PER: 0, | 293 | |
198 | PER_IVA: 0, | 294 | }, function () { |
199 | PLA: $scope.factura.vendedor.NplVen, | 295 | } |
200 | PRO: '', | 296 | ); |
201 | REC_ANT: 0, | 297 | |
202 | SUC: parseInt($scope.puntoVenta), | 298 | }; |
203 | TCA: 1, | 299 | |
204 | TCO: 'FT', | 300 | $scope.seleccionarVendedor = function () { |
205 | TFI: '', | 301 | var parametrosModal = { |
206 | TIP: $scope.factura.cliente.TIP, | 302 | titulo: 'Búsqueda vendedores', |
207 | TIV: $scope.factura.cliente.IVA, | 303 | query: '/vendedor-playa', |
208 | TOT: $scope.getTotal(), | 304 | columnas: [ |
209 | TUR: $scope.factura.vendedor.TurVen, | 305 | { |
210 | VEN: $scope.factura.vendedor.CodVen, | 306 | propiedad: 'CodVen', |
211 | VTO_CLI: '', | 307 | nombre: 'Código', |
212 | ZON: 1, // TODO: ZON DE APAREMP | 308 | filtro: { |
213 | OBSERVACIONES: $scope.factura.observaciones | 309 | nombre: 'rellenarDigitos', |
214 | }, | 310 | parametro: 3 |
215 | cuerpo: $scope.articulosFiltro(), | 311 | } |
216 | despachos: $scope.factura.despachos, | 312 | }, |
217 | formaPago: formaPago | 313 | { |
218 | }; | 314 | propiedad: 'NomVen', |
219 | 315 | nombre: 'Nombre' | |
220 | crearFacturaService.guardarFactura(save).then(function () { | 316 | } |
221 | 317 | ], | |
222 | focaBotoneraLateralService.endGuardar(true); | 318 | size: 'md' |
223 | 319 | }; | |
224 | focaModalService.alert('Comprobante guardado con éxito'); | 320 | focaModalService.modal(parametrosModal).then( |
225 | 321 | function (vendedor) { | |
226 | config(); | 322 | |
227 | 323 | indicarPassword(vendedor) | |
228 | }).catch(function (err) { | 324 | .then(function () { |
229 | focaModalService.alert('Hubo un error al guardar la factura'); | 325 | validarPlanillaVendedor(vendedor) |
230 | console.error(err); | 326 | .then(function () { |
231 | }); | 327 | |
232 | 328 | $filter('filter')($scope.botonera, { | |
233 | }; | 329 | label: 'Vendedor' |
234 | 330 | })[0].checked = true; | |
235 | $scope.seleccionarCliente = function () { | 331 | |
236 | 332 | $scope.$broadcast('addCabecera', { | |
237 | var modalInstance = $uibModal.open( | 333 | label: 'Vendedor:', |
238 | { | 334 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + |
239 | ariaLabelledBy: 'Busqueda de Cliente', | 335 | ' - ' + |
240 | templateUrl: 'foca-busqueda-cliente-modal.html', | 336 | vendedor.NomVen |
337 | }); | ||
338 | $scope.$broadcast('addCabecera', { | ||
339 | label: 'Planilla:', | ||
340 | valor: vendedor.NplVen | ||
241 | controller: 'focaBusquedaClienteModalController', | 341 | }); |
242 | resolve: { | 342 | |
243 | parametros: function () { | 343 | $scope.factura.vendedor = vendedor; |
244 | return { | 344 | |
245 | vendedor: function () { return null; }, | 345 | getProductosByPlanilla(vendedor.NplVen); |
246 | cobrador: function () { return null; } | 346 | }) |
247 | }; | 347 | .catch($scope.seleccionarVendedor); |
248 | } | 348 | }) |
249 | }, | 349 | .catch(function (err) { |
250 | size: 'lg' | 350 | console.error(err); |
251 | } | 351 | }); |
252 | ); | 352 | |
253 | modalInstance.result.then( | 353 | }, function () { } |
254 | function (cliente) { | 354 | ); |
255 | var modalInstance = $uibModal.open( | 355 | }; |
256 | { | 356 | |
257 | templateUrl: 'modal-estado-cuenta.html', | 357 | $scope.seleccionarMoneda = function () { |
258 | controller: 'focaModalEstadoCuentaController', | 358 | |
259 | size: 'lg', | 359 | var parametrosModal = { |
260 | resolve: { | 360 | titulo: 'Búsqueda de monedas', |
261 | parametros: function () { | 361 | query: '/moneda', |
262 | return { | 362 | columnas: [ |
263 | idCliente: cliente.COD, | 363 | { |
264 | nombreCliente: cliente.NOM | 364 | propiedad: 'DETALLE', |
265 | }; | 365 | nombre: 'Nombre' |
266 | }, | 366 | }, |
267 | } | 367 | { |
268 | } | 368 | propiedad: 'SIMBOLO', |
269 | ); | 369 | nombre: 'Símbolo' |
270 | modalInstance.result | 370 | } |
271 | .then(function (data) { | 371 | ], |
272 | 372 | size: 'md' | |
273 | $scope.factura.formaPago = data.formaDePago; | 373 | }; |
274 | $scope.factura.cliente = cliente; | 374 | focaModalService.modal(parametrosModal).then( |
275 | 375 | function (moneda) { | |
276 | getNumeroFactura(cliente.TIP); | 376 | |
277 | 377 | if (moneda.ID !== 1) { | |
278 | $scope.$broadcast('addCabecera', { | 378 | $scope.abrirModalCotizacion(moneda); |
279 | label: 'Cliente:', | 379 | return; |
280 | valor: $filter('rellenarDigitos')(cliente.COD, 3) + | 380 | } |
281 | ' - ' + cliente.NOM | 381 | |
282 | }); | 382 | crearRemitoService.getCotizacionByIdMoneda(1) |
283 | 383 | .then(function (res) { | |
284 | $filter('filter')($scope.botonera, | 384 | |
285 | { label: 'Cliente' })[0].checked = true; | 385 | var cotizacionPArgentino = res.data[0].cotizaciones[0]; |
286 | 386 | cotizacionPArgentino.moneda = moneda; | |
287 | $scope.$broadcast('addCabecera', { | 387 | |
288 | label: 'Forma de pago: ', | 388 | actualizarCabeceraMoneda(cotizacionPArgentino); |
289 | valor: data.tipo | 389 | |
290 | }); | 390 | $scope.remito.cotizacion = cotizacionPArgentino; |
291 | }) | 391 | }); |
292 | .catch($scope.seleccionarCliente); | 392 | }, function () { |
293 | 393 | ||
294 | }, function () { | 394 | } |
295 | } | 395 | ); |
296 | ); | 396 | }; |
297 | 397 | ||
298 | }; | 398 | $scope.abrirModalCotizacion = function (moneda) { |
299 | 399 | var modalInstance = $uibModal.open( | |
300 | $scope.seleccionarVendedor = function () { | 400 | { |
301 | var parametrosModal = { | 401 | ariaLabelledBy: 'Busqueda de Cotización', |
302 | titulo: 'Búsqueda vendedores', | 402 | templateUrl: 'modal-cotizacion.html', |
303 | query: '/vendedor-playa', | 403 | controller: 'focaModalCotizacionController', |
304 | columnas: [ | 404 | size: 'lg', |
305 | { | 405 | resolve: { idMoneda: function () { return moneda.ID; } } |
306 | propiedad: 'CodVen', | 406 | } |
307 | nombre: 'Código', | 407 | ); |
308 | filtro: { | 408 | modalInstance.result.then( |
309 | nombre: 'rellenarDigitos', | 409 | function (cotizacion) { |
310 | parametro: 3 | 410 | |
311 | } | 411 | cotizacion.moneda = moneda; |
312 | }, | 412 | actualizarCabeceraMoneda(cotizacion); |
313 | { | 413 | $scope.factura.cotizacion = cotizacion; |
314 | propiedad: 'NomVen', | 414 | |
315 | nombre: 'Nombre' | 415 | }, function () { |
316 | } | 416 | |
317 | ], | 417 | } |
318 | size: 'md' | 418 | ); |
319 | }; | 419 | }; |
320 | focaModalService.modal(parametrosModal).then( | 420 | |
321 | function (vendedor) { | 421 | $scope.seleccionarObservaciones = function () { |
322 | 422 | var observacion = { | |
323 | indicarPassword(vendedor) | 423 | titulo: 'Ingrese Observaciones', |
324 | .then(function () { | 424 | value: $scope.factura.observaciones, |
325 | validarPlanillaVendedor(vendedor) | 425 | maxlength: 155, |
326 | .then(function () { | 426 | textarea: true |
327 | 427 | }; | |
328 | $filter('filter')($scope.botonera, { | 428 | |
329 | label: 'Vendedor' | 429 | focaModalService |
330 | })[0].checked = true; | 430 | .prompt(observacion) |
331 | 431 | .then(function (observaciones) { | |
332 | $scope.$broadcast('addCabecera', { | 432 | $scope.factura.observaciones = observaciones; |
333 | label: 'Vendedor:', | 433 | }); |
334 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + | 434 | }; |
335 | ' - ' + | 435 | |
336 | vendedor.NomVen | ||
337 | }); | 436 | $scope.articulosFiltro = function () { |
338 | $scope.$broadcast('addCabecera', { | 437 | return $scope.factura.articulosFactura.filter(function (articulo) { |
438 | return !articulo.desactivado; | ||
439 | }); | ||
339 | label: 'Planilla:', | 440 | }; |
340 | valor: vendedor.NplVen | 441 | |
341 | }); | 442 | $scope.getTotal = function () { |
342 | 443 | ||
343 | $scope.factura.vendedor = vendedor; | 444 | var total = 0; |
344 | 445 | ||
345 | getProductosByPlanilla(vendedor.NplVen); | 446 | $scope.articulosFiltro().forEach(function (articulo) { |
346 | }) | 447 | total += articulo.PUN * articulo.CAN; |
347 | .catch($scope.seleccionarVendedor); | 448 | }); |
348 | }) | 449 | |
349 | .catch(function (err) { | 450 | return parseFloat(total.toFixed(2)); |
350 | console.error(err); | 451 | }; |
351 | }); | 452 | |
453 | $scope.quitarDespacho = function (articulo, index) { | ||
454 | |||
455 | if (articulo.SUR === 0) { | ||
456 | articulo.desactivado = true; | ||
457 | return; | ||
458 | } | ||
459 | |||
460 | crearFacturaService | ||
461 | .setearDespachoDesocupado({ | ||
462 | surtidor: $scope.factura.despachos[index].SUR, | ||
463 | producto: $scope.factura.despachos[index].PRO, | ||
464 | carga: $scope.factura.despachos[index].CAR, | ||
465 | planilla: $scope.factura.despachos[index].PLA | ||
466 | }) | ||
467 | .then(function () { | ||
468 | articulo.desactivado = true; | ||
469 | $scope.factura.despachos.splice(index, 1); | ||
470 | }) | ||
471 | .catch(function () { | ||
472 | focaModalService.alert('Hubo un error al desasociar este despacho'); | ||
473 | }); | ||
474 | }; | ||
475 | |||
476 | //Recibe aviso si el teclado está en uso | ||
477 | $rootScope.$on('usarTeclado', function (event, data) { | ||
478 | if (data) { | ||
479 | $scope.mostrarTeclado = true; | ||
480 | return; | ||
481 | } | ||
482 | $scope.mostrarTeclado = false; | ||
483 | }); | ||
484 | |||
485 | $scope.selectFocus = function ($event) { | ||
486 | // Si el teclado esta en uso no selecciona el valor | ||
487 | if ($scope.mostrarTeclado) { | ||
488 | return; | ||
489 | } | ||
490 | $event.target.select(); | ||
491 | }; | ||
492 | |||
493 | |||
352 | 494 | function getProductosByPlanilla(numeroPlanilla) { | |
353 | }, function () { } | 495 | |
354 | ); | 496 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { |
355 | }; | 497 | |
356 | 498 | if (!res.data.length) { | |
357 | $scope.seleccionarMoneda = function () { | 499 | |
358 | 500 | focaModalService.alert('No hay despachos disponibles por el momento'); | |
501 | return; | ||
502 | } | ||
503 | |||
504 | $scope.botoneraProductos.length = 0; | ||
505 | $scope.topDespachos = res.data[0][0].CID; | ||
506 | |||
507 | res.data.slice(1, res.data.length).forEach(function (producto) { | ||
508 | |||
509 | $scope.botoneraProductos.push({ | ||
359 | var parametrosModal = { | 510 | label: producto.DetArt, |
360 | titulo: 'Búsqueda de monedas', | 511 | image: producto.nombreImagen, |
512 | imageDefault: 'productoDefault.png' | ||
361 | query: '/moneda', | 513 | }); |
362 | columnas: [ | 514 | |
363 | { | ||
364 | propiedad: 'DETALLE', | 515 | crearFuncionesProductos(producto); |
516 | }); | ||
365 | nombre: 'Nombre' | 517 | |
518 | $scope.botonera.push({ | ||
519 | label: 'Ultimos despachos', | ||
520 | image: 'ultimos-despachos.png', | ||
521 | imageDefault: 'productoDefault.png' | ||
366 | }, | 522 | }); |
367 | { | 523 | }); |
368 | propiedad: 'SIMBOLO', | 524 | } |
369 | nombre: 'Símbolo' | 525 | |
526 | $scope.seleccionarBusquedaProductos = function () { | ||
527 | |||
528 | if (angular.equals({}, $scope.factura.vendedor)) { | ||
529 | |||
530 | focaModalService.alert('Seleccione Vendedor'); | ||
531 | return false; | ||
532 | } | ||
533 | |||
534 | var modalInstance = $uibModal.open( | ||
535 | { | ||
536 | ariaLabelledBy: 'Busqueda de Productos', | ||
537 | templateUrl: 'modal-busqueda-productos.html', | ||
538 | controller: 'modalBusquedaProductosCtrl', | ||
539 | resolve: { | ||
540 | parametroProducto: { | ||
541 | idLista: null, | ||
542 | cotizacion: $scope.factura.cotizacion.VENDEDOR, | ||
543 | simbolo: $scope.factura.cotizacion.moneda.SIMBOLO, | ||
544 | buscarTodos: true | ||
545 | } | ||
546 | }, | ||
547 | size: 'lg' | ||
548 | } | ||
549 | ); | ||
550 | |||
551 | modalInstance.result | ||
552 | .then(function (producto) { | ||
553 | |||
554 | var articulo = { | ||
555 | TIP: $scope.factura.cliente.TIP, | ||
556 | TCO: 'FT', | ||
557 | SUC: parseInt($scope.puntoVenta), | ||
558 | ORD: $scope.articulosFiltro().length + 1, | ||
559 | SEC: producto.sector, | ||
560 | ART: producto.codigo, | ||
561 | RUB: producto.CodRub, | ||
562 | DES: producto.descripcionLarga, | ||
563 | PUN: producto.precio, | ||
564 | IVA: producto.IMPIVA, | ||
565 | NET: producto.IvaCO !== 0 ? parseFloat(producto.neto) : 0, | ||
566 | NEX: producto.IvaCO === 0 ? parseFloat(producto.neto) : 0, | ||
567 | IMI: producto.ImpInt, | ||
568 | IMI2: producto.ImpInt2, | ||
569 | IMI3: producto.ImpInt3, | ||
570 | PUT: producto.precio, | ||
571 | SUR: 0, | ||
572 | PLA: $scope.factura.vendedor.NplVen, | ||
573 | LUG: $scope.factura.vendedor.LugVen, | ||
574 | LEG: $scope.factura.vendedor.CodVen, | ||
575 | TUR: $scope.factura.vendedor.TurVen, | ||
576 | ORDEN_PRECOMPRA: '', | ||
577 | ESC: producto.tipoFactura === 'L' ? 1 : 0, | ||
578 | CMF: 0, | ||
579 | PTA: 0, | ||
580 | IVS: 0, | ||
581 | TIVA: 0, | ||
582 | CON: 0, | ||
583 | SINO: '', | ||
584 | ORD_TRA: 0, | ||
585 | IMP_DESP: 0, | ||
586 | PCD: 0, | ||
587 | RTO: '', | ||
588 | }; | ||
589 | |||
590 | $scope.factura.articulosFactura.push(articulo); | ||
591 | $scope.cambioEdit(articulo, 'cantidad'); | ||
592 | |||
593 | }) | ||
594 | .catch(function (e) { console.error(e); }); | ||
595 | }; | ||
596 | |||
597 | $scope.seleccionarUltimosDespachos = function () { | ||
598 | |||
599 | if (angular.equals($scope.factura.cliente, {})) { | ||
600 | focaModalService.alert('Seleccione cliente'); | ||
601 | return; | ||
602 | } | ||
603 | |||
604 | var modalInstance = $uibModal.open( | ||
605 | { | ||
606 | templateUrl: 'modal-ultimos-despachos.html', | ||
607 | controller: 'ultimosDespachosController', | ||
608 | resolve: { | ||
609 | parametros: function () { | ||
610 | return { | ||
611 | planilla: $scope.factura.vendedor.NplVen, | ||
612 | }; | ||
613 | } | ||
614 | }, | ||
615 | size: 'md' | ||
616 | } | ||
617 | ); | ||
618 | |||
619 | modalInstance.result.then(function (producto) { | ||
620 | |||
621 | var articulo = { | ||
622 | TIP: $scope.factura.cliente.TIP, | ||
623 | TCO: 'FT', | ||
624 | SUC: parseInt($scope.puntoVenta), | ||
625 | ORD: $scope.articulosFiltro().length + 1, | ||
626 | SEC: producto.despachos[0].SEC, | ||
627 | ART: producto.despachos[0].PRO, | ||
628 | RUB: producto.CodRub, | ||
629 | DES: producto.DetArt, | ||
630 | CAN: producto.despachos[0].LTS, | ||
631 | PUN: producto.PreVen, | ||
632 | IVA: producto.IMPIVA, | ||
633 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, | ||
634 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, | ||
635 | IMI: producto.ImpInt, | ||
636 | IMI2: producto.ImpInt2, | ||
637 | IMI3: producto.ImpInt3, | ||
638 | PUT: producto.PreVen, | ||
639 | SUR: producto.despachos[0].SUR, | ||
640 | PLA: producto.despachos[0].PLA, | ||
641 | LUG: producto.despachos[0].LUG, | ||
642 | LEG: $scope.factura.vendedor.CodVen, | ||
643 | TUR: $scope.factura.vendedor.TurVen, | ||
644 | ORDEN_PRECOMPRA: '', | ||
645 | ESC: producto.tipoFactura === 'L' ? 1 : 0, | ||
646 | CMF: 0, | ||
647 | PTA: 0, | ||
648 | IVS: 0, | ||
649 | TIVA: 21, // TODO traer POR de la tabla ACODIVA where ID = IvaCO | ||
650 | CON: 0, | ||
651 | SINO: '', | ||
652 | ORD_TRA: 0, | ||
653 | IMP_DESP: 0, | ||
654 | PCD: 0, | ||
655 | RTO: '', | ||
656 | }; | ||
657 | |||
658 | crearFacturaService.setearDespachoOcupado({ | ||
659 | surtidor: producto.despachos[0].SUR, | ||
660 | producto: producto.despachos[0].PRO, | ||
661 | carga: producto.despachos[0].CAR | ||
662 | }) | ||
663 | .then(function () { | ||
664 | $scope.factura.articulosFactura.push(articulo); | ||
665 | $scope.factura.despachos.push(producto.despachos[0]); | ||
666 | }) | ||
667 | .catch(function (err) { | ||
668 | |||
669 | console.error(err); | ||
670 | focaModalService.alert('El despacho esta en uso'); | ||
671 | }); | ||
672 | |||
673 | }) | ||
674 | .catch(function (err) { | ||
675 | console.error(err); | ||
676 | }); | ||
677 | |||
678 | }; | ||
679 | |||
370 | } | 680 | function crearFuncionesProductos(producto) { |
371 | ], | 681 | |
372 | size: 'md' | 682 | $scope[nombreFuncion(producto.DetArt)] = function () { |
373 | }; | 683 | |
374 | focaModalService.modal(parametrosModal).then( | 684 | if (angular.equals($scope.factura.cliente, {})) { |
375 | function (moneda) { | 685 | focaModalService.alert('Seleccione cliente'); |
376 | 686 | return; | |
377 | if (moneda.ID !== 1) { | 687 | } |
378 | $scope.abrirModalCotizacion(moneda); | 688 | |
379 | return; | 689 | var modalInstance = $uibModal.open( |
380 | } | 690 | { |
381 | 691 | templateUrl: 'modal-combustibles.html', | |
382 | crearRemitoService.getCotizacionByIdMoneda(1) | 692 | controller: 'focaModalCombustiblesController', |
383 | .then(function (res) { | 693 | resolve: { |
384 | 694 | parametros: function () { | |
385 | var cotizacionPArgentino = res.data[0].cotizaciones[0]; | 695 | return { |
386 | cotizacionPArgentino.moneda = moneda; | 696 | despachos: producto.despachos, |
387 | 697 | nombreProducto: producto.DetArt, | |
388 | actualizarCabeceraMoneda(cotizacionPArgentino); | 698 | topDespachos: $scope.topDespachos |
699 | }; | ||
389 | 700 | } | |
390 | $scope.remito.cotizacion = cotizacionPArgentino; | 701 | }, |
391 | }); | 702 | size: 'md' |
392 | }, function () { | 703 | } |
393 | 704 | ); | |
394 | } | ||
395 | ); | ||
396 | }; | ||
397 | |||
398 | $scope.abrirModalCotizacion = function (moneda) { | ||
399 | var modalInstance = $uibModal.open( | ||
400 | { | ||
401 | ariaLabelledBy: 'Busqueda de Cotización', | ||
402 | templateUrl: 'modal-cotizacion.html', | 705 | |
403 | controller: 'focaModalCotizacionController', | 706 | modalInstance.result.then(function (despacho) { |
404 | size: 'lg', | 707 | |
405 | resolve: { idMoneda: function () { return moneda.ID; } } | 708 | var articulo = { |
406 | } | 709 | TIP: $scope.factura.cliente.TIP, |
407 | ); | 710 | TCO: 'FT', |
408 | modalInstance.result.then( | 711 | SUC: parseInt($scope.puntoVenta), |
409 | function (cotizacion) { | 712 | ORD: $scope.articulosFiltro().length + 1, |
410 | 713 | SEC: despacho.SEC, | |
411 | cotizacion.moneda = moneda; | 714 | ART: despacho.PRO, |
412 | actualizarCabeceraMoneda(cotizacion); | 715 | RUB: producto.CodRub, |
413 | $scope.factura.cotizacion = cotizacion; | 716 | DES: producto.DetArt, |
414 | 717 | CAN: despacho.LTS, | |
415 | }, function () { | 718 | PUN: producto.PreVen, |
416 | 719 | IVA: producto.IMPIVA, | |
417 | } | 720 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, |
418 | ); | 721 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, |
419 | }; | 722 | IMI: producto.ImpInt, |
420 | 723 | IMI2: producto.ImpInt2, | |
421 | $scope.seleccionarObservaciones = function () { | 724 | IMI3: producto.ImpInt3, |
422 | var observacion = { | 725 | PUT: producto.PreVen, |
423 | titulo: 'Ingrese Observaciones', | 726 | SUR: despacho.SUR, |
424 | value: $scope.factura.observaciones, | 727 | PLA: despacho.PLA, |
425 | maxlength: 155, | 728 | LUG: despacho.LUG, |
426 | textarea: true | 729 | LEG: $scope.factura.vendedor.CodVen, |
427 | }; | 730 | TUR: $scope.factura.vendedor.TurVen, |
428 | 731 | ORDEN_PRECOMPRA: '', | |
429 | focaModalService | 732 | ESC: producto.tipoFactura === 'L' ? 1 : 0, |
430 | .prompt(observacion) | 733 | CMF: 0, |
431 | .then(function (observaciones) { | 734 | PTA: 0, |
432 | $scope.factura.observaciones = observaciones; | 735 | IVS: 0, |
433 | }); | 736 | TIVA: 21, // TODO traer POR de la tabla ACODIVA where ID = IvaCO |
434 | }; | 737 | CON: 0, |
435 | 738 | SINO: '', | |
436 | $scope.articulosFiltro = function () { | 739 | ORD_TRA: 0, |
437 | return $scope.factura.articulosFactura.filter(function (articulo) { | 740 | IMP_DESP: 0, |
438 | return !articulo.desactivado; | 741 | PCD: 0, |
439 | }); | 742 | RTO: '', |
440 | }; | 743 | }; |
441 | 744 | ||
442 | $scope.getTotal = function () { | 745 | crearFacturaService.setearDespachoOcupado({ |
746 | surtidor: despacho.SUR, | ||
747 | producto: despacho.PRO, | ||
748 | carga: despacho.CAR | ||
749 | }) | ||
750 | .then(function () { | ||
751 | $scope.factura.articulosFactura.push(articulo); | ||
752 | $scope.factura.despachos.push(despacho); | ||
753 | }) | ||
754 | .catch(function (err) { | ||
755 | |||
756 | console.error(err); | ||
757 | focaModalService.alert('El despacho esta en uso'); | ||
758 | }); | ||
759 | |||
443 | 760 | }) | |
444 | var total = 0; | 761 | .catch(function (err) { |
445 | 762 | console.error(err); | |
446 | $scope.articulosFiltro().forEach(function (articulo) { | 763 | }); |
447 | total += articulo.PUN * articulo.CAN; | 764 | |
448 | }); | 765 | }; |
449 | 766 | } | |
450 | return parseFloat(total.toFixed(2)); | 767 | |
451 | }; | 768 | function nombreFuncion(string) { |
452 | 769 | var texto = 'seleccionar'; | |
453 | $scope.quitarDespacho = function (articulo, index) { | 770 | var arr = string.split(' '); |
454 | 771 | arr.forEach(function (palabra) { | |
455 | if (articulo.SUR === 0) { | 772 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); |
456 | articulo.desactivado = true; | 773 | texto += palabra; |
457 | return; | 774 | }); |
458 | } | 775 | return texto; |
459 | 776 | } | |
460 | crearFacturaService | 777 | |
461 | .setearDespachoDesocupado({ | 778 | function indicarPassword(vendedor) { |
462 | surtidor: $scope.factura.despachos[index].SUR, | 779 | |
463 | producto: $scope.factura.despachos[index].PRO, | 780 | return new Promise(function (resolve, reject) { |
464 | carga: $scope.factura.despachos[index].CAR, | 781 | |
465 | planilla: $scope.factura.despachos[index].PLA | 782 | function openPrompt() { |
466 | }) | 783 | return focaModalService |
467 | .then(function () { | 784 | .prompt({ |
468 | articulo.desactivado = true; | 785 | titulo: 'Indique Contraseña', |
469 | $scope.factura.despachos.splice(index, 1); | 786 | value: '', |
470 | }) | 787 | tipo: 'password' |
788 | }) | ||
789 | .then(function (contraseña) { | ||
471 | .catch(function () { | 790 | |
472 | focaModalService.alert('Hubo un error al desasociar este despacho'); | 791 | if (contraseña !== vendedor.ClaVen.trim()) { |
473 | }); | 792 | |
474 | }; | 793 | focaModalService.alert('Clave incorrecta').then(function () { |
475 | 794 | openPrompt(vendedor); | |
476 | //Recibe aviso si el teclado está en uso | 795 | }); |
477 | $rootScope.$on('usarTeclado', function (event, data) { | 796 | } else { |
478 | if (data) { | 797 | resolve(); |
479 | $scope.mostrarTeclado = true; | 798 | } |
480 | return; | 799 | }) |
481 | } | 800 | .catch(reject); |
801 | } | ||
802 | |||
803 | openPrompt(); | ||
482 | $scope.mostrarTeclado = false; | 804 | }); |
483 | }); | 805 | } |
484 | 806 | ||
485 | $scope.selectFocus = function ($event) { | 807 | function validarPlanillaVendedor(vendedor) { |
486 | // Si el teclado esta en uso no selecciona el valor | 808 | |
487 | if ($scope.mostrarTeclado) { | 809 | return new Promise(function (resolve, reject) { |
488 | return; | 810 | |
489 | } | 811 | crearFacturaService |
490 | $event.target.select(); | 812 | .validarPlanillaVendedor(vendedor.CodVen.toString().trim()) |
491 | }; | 813 | .then(function (res) { |
492 | 814 | ||
493 | 815 | if (!res.data.length) { | |
494 | function getProductosByPlanilla(numeroPlanilla) { | 816 | |
495 | 817 | focaModalService | |
496 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { | 818 | .alert('No se encontró planilla abierta para el vendedor') |
497 | 819 | .then(reject); | |
498 | if (!res.data.length) { | 820 | |
499 | 821 | } else { | |
500 | focaModalService.alert('No hay despachos disponibles por el momento'); | 822 | resolve(); |
501 | return; | 823 | } |
502 | } | 824 | |
503 | 825 | }) | |
504 | $scope.botoneraProductos.length = 0; | 826 | .catch(function (err) { |
827 | console.log(err); | ||
828 | reject(); | ||
829 | }); | ||
505 | $scope.topDespachos = res.data[0][0].CID; | 830 | }); |
506 | 831 | } | |
507 | res.data.slice(1, res.data.length).forEach(function (producto) { | 832 | |
508 | 833 | function rellenar(relleno, longitud) { | |
509 | $scope.botoneraProductos.push({ | 834 | relleno = '' + relleno; |
510 | label: producto.DetArt, | 835 | while (relleno.length < longitud) { |
511 | image: producto.nombreImagen, | 836 | relleno = '0' + relleno; |
512 | imageDefault: 'productoDefault.png' | 837 | } |
513 | }); | 838 | return relleno; |
514 | 839 | } | |
515 | crearFuncionesProductos(producto); | 840 | |
516 | }); | 841 | $scope.salir = function () { |
517 | 842 | var confirmacion = false; | |
518 | $scope.botonera.push({ | 843 | |
519 | label: 'Ultimos despachos', | 844 | if (!angular.equals($scope.factura, $scope.inicial)) { |
520 | image: 'ultimos-despachos.png', | 845 | confirmacion = true; |
521 | imageDefault: 'productoDefault.png' | 846 | } |
522 | }); | 847 | |
523 | }); | 848 | if (confirmacion) { |
524 | } | 849 | focaModalService.confirm( |
525 | 850 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | |
526 | $scope.seleccionarBusquedaProductos = function () { | 851 | ).then(function (data) { |
527 | 852 | if (data) { | |
528 | if (angular.equals({}, $scope.factura.vendedor)) { | 853 | $location.path('/'); |
529 | 854 | } | |
530 | focaModalService.alert('Seleccione Vendedor'); | 855 | }); |
531 | return false; | 856 | } else { |
532 | } | 857 | $location.path('/'); |
533 | 858 | } | |
534 | var modalInstance = $uibModal.open( | 859 | }; |
535 | { | 860 | |
536 | ariaLabelledBy: 'Busqueda de Productos', | 861 | function setearFactura(factura) { |
537 | templateUrl: 'modal-busqueda-productos.html', | 862 | |
538 | controller: 'modalBusquedaProductosCtrl', | 863 | $scope.$broadcast('cleanCabecera'); |
539 | resolve: { | 864 | |
540 | parametroProducto: { | 865 | $scope.cabeceras = []; |
541 | idLista: null, | 866 | |
542 | cotizacion: $scope.factura.cotizacion.VENDEDOR, | 867 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
543 | simbolo: $scope.factura.cotizacion.moneda.SIMBOLO, | 868 | $scope.cabeceras.push({ |
544 | buscarTodos: true | 869 | label: 'Moneda:', |
545 | } | 870 | valor: factura.cotizacion.moneda.DETALLE |
546 | }, | 871 | }); |
547 | size: 'lg' | 872 | $scope.cabeceras.push({ |
548 | } | 873 | label: 'Fecha cotizacion:', |
549 | ); | 874 | valor: $filter('date')(factura.cotizacion.FECHA, |
550 | 875 | 'dd/MM/yyyy') | |
551 | modalInstance.result | 876 | }); |
552 | .then(function (producto) { | 877 | $scope.cabeceras.push({ |
553 | 878 | label: 'Cotizacion:', | |
554 | var articulo = { | 879 | valor: $filter('number')(factura.cotizacion.VENDEDOR, |
555 | TIP: $scope.factura.cliente.TIP, | 880 | '2') |
556 | TCO: 'FT', | 881 | }); |
557 | SUC: parseInt($scope.puntoVenta), | 882 | } |
558 | ORD: $scope.articulosFiltro().length + 1, | 883 | |
559 | SEC: producto.sector, | 884 | if (factura.cotizacion && factura.cotizacion.moneda) { |
560 | ART: producto.codigo, | 885 | // $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; |
561 | RUB: producto.CodRub, | 886 | } |
562 | DES: producto.descripcionLarga, | 887 | |
563 | PUN: producto.precio, | 888 | if (factura.cliente && factura.cliente.COD) { |
564 | IVA: producto.IMPIVA, | 889 | $scope.cabeceras.push({ |
565 | NET: producto.IvaCO !== 0 ? parseFloat(producto.neto) : 0, | 890 | label: 'Cliente:', |
566 | NEX: producto.IvaCO === 0 ? parseFloat(producto.neto) : 0, | 891 | valor: $filter('rellenarDigitos')(factura.cliente.COD, 3) + ' - ' + |
567 | IMI: producto.ImpInt, | 892 | factura.cliente.NOM |
568 | IMI2: producto.ImpInt2, | 893 | }); |
569 | IMI3: producto.ImpInt3, | 894 | |
570 | PUT: producto.precio, | 895 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
571 | SUR: 0, | 896 | } |
572 | PLA: $scope.factura.vendedor.NplVen, | 897 | |
573 | LUG: $scope.factura.vendedor.LugVen, | 898 | $scope.puntoVenta = rellenar(factura.sucursal, 4); |
574 | LEG: $scope.factura.vendedor.CodVen, | 899 | $scope.comprobante = rellenar(factura.numerofactura, 8); |
575 | TUR: $scope.factura.vendedor.TurVen, | 900 | $scope.factura = factura; |
576 | ORDEN_PRECOMPRA: '', | 901 | |
577 | ESC: producto.tipoFactura === 'L' ? 1 : 0, | 902 | addArrayCabecera($scope.cabeceras); |
578 | CMF: 0, | 903 | } |
579 | PTA: 0, | 904 | |
580 | IVS: 0, | 905 | function getLSFactura() { |
581 | TIVA: 0, | 906 | var factura = JSON.parse($localStorage.factura || null); |
582 | CON: 0, | 907 | if (factura) { |
583 | SINO: '', | 908 | setearFactura(factura); |
584 | ORD_TRA: 0, | 909 | delete $localStorage.factura; |
585 | IMP_DESP: 0, | 910 | } |
586 | PCD: 0, | 911 | } |
587 | RTO: '', | 912 | |
588 | }; | 913 | function addArrayCabecera(array) { |
589 | 914 | for (var i = 0; i < array.length; i++) { | |
590 | $scope.factura.articulosFactura.push(articulo); | 915 | $scope.$broadcast('addCabecera', { |
591 | $scope.cambioEdit(articulo, 'cantidad'); | 916 | label: array[i].label, |
592 | 917 | valor: array[i].valor | |
593 | }) | 918 | }); |
594 | .catch(function (e) { console.error(e); }); | 919 | } |
595 | }; | 920 | } |
596 | 921 | ||
922 | $scope.cambioEdit = function (articulo, propiedad) { | ||
923 | if (propiedad === 'cantidad' && articulo.SUR === 0) { | ||
924 | articulo.editCantidad = true; | ||
925 | } | ||
926 | }; | ||
927 | |||
928 | $scope.editarArticulo = function (key, articulo, tmpCantidad) { | ||
929 | if (key === 13) { | ||
930 | if (!articulo.cantidad && tmpCantidad.length === 0) { | ||
931 | focaModalService.alert('Los valores deben ser al menos 1'); | ||
932 | return; | ||
933 | } else if (tmpCantidad === '0') { | ||
934 | focaModalService.alert('Esta ingresando un producto con valor 0'); | ||
935 | return; | ||
936 | } else if (parseInt(tmpCantidad) < 0) { | ||
937 | focaModalService.alert('Los valores no pueden ser negativos'); | ||
938 | return; | ||
939 | } | ||
940 | articulo.CAN = parseInt(tmpCantidad); | ||
941 | $scope.getTotal(); | ||
942 | articulo.editCantidad = false; | ||
943 | } | ||
944 | }; | ||
945 | |||
946 | $scope.cancelarEditar = function (articulo) { | ||
947 | $scope.tmpCantidad = articulo.CAN; | ||
948 | articulo.editCantidad = false; | ||
949 | }; | ||
950 | |||
597 | $scope.seleccionarUltimosDespachos = function () { | 951 | function actualizarCabeceraMoneda(cotizacion) { |
598 | 952 | ||
599 | if (angular.equals($scope.factura.cliente, {})) { | 953 | $scope.factura.articulosFactura.forEach(function (art) { |
600 | focaModalService.alert('Seleccione cliente'); | 954 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); |
601 | return; | 955 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); |
602 | } | 956 | }); |
603 | 957 | ||
604 | var modalInstance = $uibModal.open( | 958 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { |
605 | { | 959 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
606 | templateUrl: 'modal-ultimos-despachos.html', | 960 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
607 | controller: 'ultimosDespachosController', | 961 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
608 | resolve: { | 962 | } else { |
609 | parametros: function () { | 963 | $scope.$broadcast('addCabecera', { |
610 | return { | 964 | label: 'Moneda:', |
611 | planilla: $scope.factura.vendedor.NplVen, | 965 | valor: cotizacion.moneda.DETALLE |
612 | }; | 966 | }); |
613 | } | 967 | $scope.$broadcast('addCabecera', { |
614 | }, | 968 | label: 'Fecha cotizacion:', |
615 | size: 'md' | 969 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
616 | } | 970 | }); |
617 | ); | 971 | $scope.$broadcast('addCabecera', { |
618 | 972 | label: 'Cotizacion:', | |
619 | modalInstance.result.then(function (producto) { | 973 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
620 | 974 | }); | |
621 | var articulo = { | 975 | } |
622 | TIP: $scope.factura.cliente.TIP, | 976 | } |
623 | TCO: 'FT', | 977 | |
624 | SUC: parseInt($scope.puntoVenta), | 978 | function validarGuardar() { |
625 | ORD: $scope.articulosFiltro().length + 1, | 979 | |
626 | SEC: producto.despachos[0].SEC, | 980 | if (angular.equals({}, $scope.factura.vendedor)) { |
627 | ART: producto.despachos[0].PRO, | 981 | |
628 | RUB: producto.CodRub, | 982 | focaModalService.alert('Seleccione Vendedor'); |
629 | DES: producto.DetArt, | 983 | return false; |
630 | CAN: producto.despachos[0].LTS, | 984 | } else if (angular.equals({}, $scope.factura.cliente)) { |
631 | PUN: producto.PreVen, | 985 | |
632 | IVA: producto.IMPIVA, | 986 | focaModalService.alert('Seleccione Cliente'); |
633 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, | 987 | return false; |
634 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, | 988 | } else if (!$scope.articulosFiltro().length) { |
635 | IMI: producto.ImpInt, | 989 | |
636 | IMI2: producto.ImpInt2, | 990 | focaModalService.alert('Seleccione al menos un Articulo'); |
637 | IMI3: producto.ImpInt3, | 991 | return false; |
638 | PUT: producto.PreVen, | 992 | } |
639 | SUR: producto.despachos[0].SUR, | 993 | |
640 | PLA: producto.despachos[0].PLA, | 994 | return true; |
641 | LUG: producto.despachos[0].LUG, | 995 | } |
996 | |||
997 | //recibo la propiedad por la cual quiero obtener el valor | ||
998 | function getImporte(propiedad) { | ||
999 | var importe = 0; | ||
1000 | |||
1001 | $scope.articulosFiltro().forEach(function (articulo) { | ||
1002 | |||
1003 | if (articulo[propiedad]) { | ||
1004 | importe += articulo[propiedad] * articulo.CAN; | ||
1005 | } | ||
1006 | return; |
src/js/controllerCombustibles.js
File was created | 1 | angular.module('focaCrearFactura') | |
2 | .controller('focaModalCombustiblesController', [ | ||
3 | '$filter', | ||
4 | '$scope', | ||
5 | '$uibModalInstance', | ||
6 | 'parametros', | ||
7 | function ($filter, $scope, $uibModalInstance, parametros) { | ||
8 | |||
9 | $scope.mangueras = []; | ||
10 | $scope.colorTexto = { color: 'black' }; | ||
11 | var productosByMangera = []; | ||
12 | |||
13 | config(); | ||
14 | |||
15 | function config() { | ||
16 | |||
17 | $scope.nombreProducto = parametros.nombreProducto; | ||
18 | setColorNombreProducto(); | ||
19 | parametros.despachos.forEach(function (despacho) { | ||
20 | |||
21 | var findCsu = productosByMangera.filter(function (csu) { | ||
22 | return csu.csu === despacho.CSU.trim(); | ||
23 | })[0]; | ||
24 | |||
25 | if (!findCsu) { | ||
26 | |||
27 | var mangera = { | ||
28 | csu: despacho.CSU.trim(), | ||
29 | despachos: [despacho], | ||
30 | show: true | ||
31 | }; | ||
32 | |||
33 | productosByMangera.unshift(mangera); | ||
34 | } else { | ||
35 | findCsu.despachos.push(despacho); | ||
36 | } | ||
37 | }); | ||
38 | } | ||
39 | |||
40 | $scope.mangueras = productosByMangera; | ||
41 | |||
42 | $scope.mangueras.forEach(function (producto) { | ||
43 | |||
44 | producto.despachos.splice(parametros.topDespachos, producto.despachos.length); | ||
45 | |||
46 | producto.despachos.sort(function (a, b) { | ||
47 | return a.FEC - b.FEC; | ||
48 | }); | ||
49 | }); | ||
50 | |||
51 | |||
52 | $scope.aceptar = function (despacho) { | ||
53 | $uibModalInstance.close(despacho); | ||
54 | }; | ||
55 | |||
56 | $scope.cancel = function () { | ||
57 | $uibModalInstance.dismiss('cancel'); | ||
58 | }; | ||
59 | |||
60 | //TODO: Cambiar switch case con los casos de nombres de productos axion | ||
61 | function setColorNombreProducto() { | ||
62 | |||
63 | // Diesel #FF852E | Euro+Diesel #6C389A | Premium #00A857 | Super #175AA5 | ||
64 | switch ($scope.nombreProducto) { | ||
65 | case 'NAFTA SUPER XXI': | ||
66 | $scope.colorTexto = { color: '#FF852E' }; | ||
67 | break; | ||
68 | case 'GO-INFINIA DIESEL': | ||
69 | $scope.colorTexto = { color: '#6C389A' }; | ||
70 | break; | ||
71 | case 'ULTRADIESEL XXI - RED': | ||
72 | $scope.colorTexto = { color: '#00A857' }; | ||
73 | break; | ||
74 | case 'NAFTA INFINIA': | ||
75 | $scope.colorTexto = { color: '#175AA5' }; | ||
76 | break; | ||
77 | default: | ||
78 | $scope.colorTexto = { color: 'black' }; | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | ]); | ||
1 | angular.module('focaCrearFactura') | 84 |
src/js/controllerEstadoCuenta.js
File was created | 1 | angular.module('focaCrearFactura') | |
2 | .controller('focaModalEstadoCuentaController', [ | ||
3 | '$scope', '$uibModalInstance', 'crearFacturaService', 'parametros', | ||
4 | function ($scope, $uibModalInstance, crearFacturaService, parametros) { | ||
5 | |||
6 | $scope.estadoCuenta = { | ||
7 | autorizado: 0.0, | ||
8 | extracciones: 0.0, | ||
9 | saldo: 0.0, | ||
10 | situacion: false, | ||
11 | facturasVencidas: 0.0 | ||
12 | }; | ||
13 | |||
14 | $scope.cliente = parametros; | ||
15 | |||
16 | init(); | ||
17 | |||
18 | function init() { | ||
19 | crearFacturaService.getResumenCuenta(parametros.idCliente) | ||
20 | .then(function (res) { | ||
21 | $scope.estadoCuenta = res.data; | ||
22 | }) | ||
23 | .catch(function (e) { console.error(e); }); | ||
24 | } | ||
25 | |||
26 | $scope.elegirTipoDePago = function (tipoDePago) { | ||
27 | $uibModalInstance.close(tipoDePago); | ||
28 | }; | ||
29 | |||
30 | $scope.cancel = function () { | ||
31 | $uibModalInstance.dismiss('cancel'); | ||
32 | }; | ||
33 | } | ||
34 | ]); | ||
1 | angular.module('focaCrearFactura') | 35 |
src/js/controllerUltimosDespachos.js
File was created | 1 | angular.module('focaCrearFactura') | |
2 | .controller('ultimosDespachosController', [ | ||
3 | '$filter', | ||
4 | '$scope', | ||
5 | '$uibModalInstance', | ||
6 | 'crearFacturaService', | ||
7 | 'parametros', | ||
8 | function ($filter, $scope, $uibModalInstance, crearFacturaService, parametros) { | ||
9 | |||
10 | config(); | ||
11 | |||
12 | function config() { | ||
13 | |||
14 | $scope.productos = []; | ||
15 | |||
16 | crearFacturaService.getUltimosDespachos(parametros.planilla).then(function (res) { | ||
17 | |||
18 | res.data.slice(1, res.data.length).forEach(function (producto) { | ||
19 | |||
20 | producto.mangueras = []; | ||
21 | |||
22 | producto.despachos.forEach(function (despacho) { | ||
23 | |||
24 | var findCsu = producto.mangueras.filter(function (csu) { | ||
25 | return csu.csu === despacho.CSU.trim(); | ||
26 | })[0]; | ||
27 | |||
28 | if (!findCsu) { | ||
29 | |||
30 | var manguera = { | ||
31 | csu: despacho.CSU.trim(), | ||
32 | despachos: [despacho], | ||
33 | show: true | ||
34 | }; | ||
35 | |||
36 | producto.mangueras.unshift(manguera); | ||
37 | } else { | ||
38 | findCsu.despachos.push(despacho); | ||
39 | } | ||
40 | }); | ||
41 | |||
42 | $scope.productos.push(producto); | ||
43 | }); | ||
44 | |||
45 | console.log($scope.productos); | ||
46 | |||
47 | }); | ||
48 | } | ||
49 | |||
50 | $scope.aceptar = function (despacho) { | ||
51 | $uibModalInstance.close(despacho); | ||
52 | }; | ||
53 | |||
54 | $scope.cancel = function () { | ||
55 | $uibModalInstance.dismiss('cancel'); | ||
56 | }; | ||
57 | |||
58 | } | ||
59 | ]); | ||
1 | angular.module('focaCrearFactura') | 60 |
src/js/service.js
1 | angular.module('focaCrearFactura') | 1 | angular.module('focaCrearFactura') |
2 | .service('crearFacturaService', ['$http', 'API_ENDPOINT', 'APP', | 2 | .service('crearFacturaService', ['$http', 'API_ENDPOINT', 'APP', |
3 | function ($http, API_ENDPOINT, APP) { | 3 | function ($http, API_ENDPOINT, APP) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | guardarFactura: function (factura) { | 6 | guardarFactura: function (factura) { |
7 | return $http.post(route + '/factura/guardar', factura); | 7 | return $http.post(route + '/factura/guardar', factura); |
8 | }, | 8 | }, |
9 | getParametros: function () { | 9 | getParametros: function () { |
10 | return $http.get(API_ENDPOINT.URL + '/parametros/factura'); | 10 | return $http.get(API_ENDPOINT.URL + '/parametros/factura'); |
11 | }, | 11 | }, |
12 | validarPlanillaVendedor: function (idVendedor) { | 12 | validarPlanillaVendedor: function (idVendedor) { |
13 | return $http.get(route + '/turnos/validar-planilla/' + idVendedor); | 13 | return $http.get(route + '/turnos/validar-planilla/' + idVendedor); |
14 | }, | 14 | }, |
15 | getProductosByPlanilla: function (numeroPlanilla) { | 15 | getProductosByPlanilla: function (numeroPlanilla) { |
16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); | 16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); |
17 | }, | 17 | }, |
18 | getUltimosDespachos: function (numeroPlanilla) { | 18 | getUltimosDespachos: function (numeroPlanilla) { |
19 | return $http.get(route + '/turnos/productos/' + numeroPlanilla + '/true'); | 19 | return $http.get(route + '/turnos/productos/' + numeroPlanilla + '/true'); |
20 | }, | 20 | }, |
21 | setearDespachoOcupado: function (parametros) { | ||
22 | return $http.post(route + '/turnos/despacho-en-uso', parametros); | ||
23 | }, | ||
24 | setearDespachoDesocupado: function (parametros) { | ||
25 | return $http.post(route + '/turnos/depacho-sin-uso', parametros); | ||
26 | }, | ||
27 | getResumenCuenta: function (idCliente) { | ||
28 | return $http.get(route + '/cliente/resumen-cuenta/' + idCliente); | ||
29 | }, | ||
30 | getVendedorPlayaById: function (id) { | ||
31 | return $http.get(route + '/vendedor-playa/' + id); | ||
32 | }, | ||
33 | getBotonera: function () { | ||
34 | var vendedor = { | ||
21 | setearDespachoOcupado: function (parametros) { | 35 | label: 'Vendedor', |
22 | return $http.post(route + '/turnos/despacho-en-uso', parametros); | 36 | image: 'vendedor.png' |
23 | }, | 37 | }; |
24 | setearDespachoDesocupado: function (parametros) { | 38 | // $scope.botoneraProductos.push({ |
25 | return $http.post(route + '/turnos/depacho-sin-uso', parametros); | 39 | // label: 'Busqueda Productos', |
26 | }, | 40 | // image: 'buscarProductos.png', |
27 | getResumenCuenta: function (idCliente) { | 41 | // imageDefault: 'productoDefault.png' |
28 | return $http.get(route + '/cliente/resumen-cuenta/' + idCliente); | 42 | // }); |
29 | }, | 43 | var botones = [ |
30 | getVendedorPlayaById: function (id) { | 44 | { |
31 | return $http.get(route + '/vendedor-playa/' + id); | 45 | label: 'Cliente', |
32 | }, | 46 | image: 'cliente.png' |
33 | getBotonera: function () { | 47 | }, |
34 | var vendedor = { | 48 | { |
49 | label: 'Busqueda Productos', | ||
50 | image: 'productos.png' | ||
51 | } | ||
52 | // { | ||
53 | // label: 'Moneda', | ||
54 | // image: 'moneda.png' | ||
55 | // }, | ||
56 | // { | ||
57 | // label: 'Observaciones', | ||
58 | // image: 'botonObservaciones.png' | ||
59 | // } | ||
60 | ]; | ||
61 | |||
62 | if (APP !== 'facturador') { | ||
63 | botones.unshift(vendedor); | ||
35 | label: 'Vendedor', | 64 | } |
36 | image: 'vendedor.png' | 65 | |
37 | }; | 66 | return botones; |
38 | // $scope.botoneraProductos.push({ | 67 | } |
39 | // label: 'Busqueda Productos', | 68 | }; |
69 | } | ||
70 | ]); | ||
40 | // image: 'buscarProductos.png', | 71 |
src/views/factura.html
1 | <div class="crear-nota-remito foca-crear row"> | 1 | <div class="crear-nota-remito foca-crear row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Factura'" | 3 | titulo="'Factura'" |
4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
5 | fecha="now" | 5 | fecha="now" |
6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
7 | busqueda="seleccionarRemito" | 7 | busqueda="seleccionarRemito" |
8 | fecha-disabled="true" | 8 | fecha-disabled="true" |
9 | ></foca-cabecera-facturador> | 9 | ></foca-cabecera-facturador> |
10 | <marquee | 10 | <marquee |
11 | bgcolor="#FF9900" | 11 | bgcolor="#FF9900" |
12 | behavior="scroll" | 12 | behavior="scroll" |
13 | direction="left" | 13 | direction="left" |
14 | ng-bind="factura.observaciones" | 14 | ng-bind="factura.observaciones" |
15 | ></marquee> | 15 | ></marquee> |
16 | <div class="col-12 col-lg-10 p-2"> | 16 | <div class="col-12 col-lg-10 p-2"> |
17 | <div class="row border border-light rounded m-0"> | 17 | <div class="row border border-light rounded m-0"> |
18 | <div class="col-12 col-sm-12"> | 18 | <div class="col-12 col-sm-12"> |
19 | <div class="row p-1 botonera-secundaria px-3 py-2"> | ||
19 | <div class="row p-1 botonera-secundaria px-3 py-2"> | 20 | <div class="col-12"> |
20 | <div class="col-12"> | 21 | <foca-botonera-facturador |
22 | botones="botonera" | ||
23 | max="botonera.length" | ||
24 | class="row"> | ||
25 | </foca-botonera-facturador> | ||
26 | </div> | ||
27 | </div> | ||
28 | <div ng-show="botoneraProductos.length > 0" class="row botonera-secundaria pb-3 px-3"> | ||
29 | <div class="col-12"> | ||
30 | <foca-botonera-productos | ||
31 | botones="botoneraProductos" | ||
32 | max="1" | ||
33 | class="row" | ||
34 | > | ||
35 | </foca-botonera-productos> | ||
21 | <foca-botonera-facturador | 36 | </div> |
22 | botones="botonera" | 37 | </div> |
23 | max="botonera.length" | 38 | <!-- PC --> |
24 | class="row"> | 39 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
25 | </foca-botonera-facturador> | 40 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
26 | </div> | 41 | <thead> |
27 | </div> | 42 | <tr class="d-flex"> |
28 | <div ng-show="botoneraProductos.length > 0" class="row botonera-secundaria pb-3 px-3"> | 43 | <th class="">#</th> |
29 | <div class="col-12"> | 44 | <th class="col">Código</th> |
30 | <foca-botonera-productos | 45 | <th class="col-4">Descripción</th> |
31 | botones="botoneraProductos" | 46 | <th class="col text-right">Cantidad</th> |
32 | max="1" | 47 | <th class="col text-right">Precio Unitario</th> |
33 | class="row" | 48 | <th class="col text-right">SubTotal</th> |
34 | > | 49 | <th class="text-right"> |
35 | </foca-botonera-productos> | 50 | <button |
36 | </div> | 51 | class="btn btn-outline-light selectable" |
37 | </div> | 52 | ng-click="show = !show; masMenos()" |
38 | <!-- PC --> | 53 | > |
39 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 54 | <i |
40 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 55 | class="fa fa-chevron-down" |
41 | <thead> | 56 | ng-show="show" |
42 | <tr class="d-flex"> | 57 | aria-hidden="true" |
43 | <th class="">#</th> | 58 | > |
44 | <th class="col">Código</th> | 59 | </i> |
45 | <th class="col-4">Descripción</th> | 60 | <i |
46 | <th class="col text-right">Cantidad</th> | 61 | class="fa fa-chevron-up" |
47 | <th class="col text-right">Precio Unitario</th> | 62 | ng-hide="show" |
48 | <th class="col text-right">SubTotal</th> | 63 | aria-hidden="true"> |
49 | <th class="text-right"> | 64 | </i> |
50 | <button | 65 | </button> |
51 | class="btn btn-outline-light selectable" | 66 | </th> |
52 | ng-click="show = !show; masMenos()" | 67 | </tr> |
53 | > | 68 | </thead> |
54 | <i | 69 | <tbody class="tabla-articulo-body"> |
55 | class="fa fa-chevron-down" | 70 | <tr |
56 | ng-show="show" | 71 | ng-repeat="(key, articulo) in articulosFiltro()" |
57 | aria-hidden="true" | 72 | ng-show="show || key == (articulosFiltro().length - 1)" |
58 | > | 73 | class="d-flex" |
59 | </i> | 74 | > |
60 | <i | 75 | <td ng-bind="key + 1"></td> |
61 | class="fa fa-chevron-up" | 76 | <td |
62 | ng-hide="show" | 77 | class="col" |
63 | aria-hidden="true"> | 78 | ng-bind="articulo.SEC + '-' + articulo.ART" |
64 | </i> | 79 | ></td> |
65 | </button> | 80 | <td |
66 | </th> | 81 | class="col-4" |
67 | </tr> | 82 | ng-bind="articulo.DES" |
68 | </thead> | 83 | ></td> |
69 | <tbody class="tabla-articulo-body"> | 84 | <td class="col text-right"> |
70 | <tr | 85 | <input |
71 | ng-repeat="(key, articulo) in articulosFiltro()" | 86 | ng-show="articulo.editCantidad" |
72 | ng-show="show || key == (articulosFiltro().length - 1)" | 87 | ng-model="tmpCantidad" |
73 | class="d-flex" | 88 | class="form-control" |
74 | > | 89 | foca-tipo-input |
75 | <td ng-bind="key + 1"></td> | 90 | min="1" |
76 | <td | 91 | foca-focus="articulo.editCantidad" |
77 | class="col" | 92 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad);" |
78 | ng-bind="articulo.SEC + '-' + articulo.ART" | 93 | esc-key="cancelarEditar(articulo)" |
79 | ></td> | 94 | ng-focus="selectFocus($event); tmpCantidad = articulo.CAN;" |
80 | <td | 95 | teclado-virtual |
81 | class="col-4" | 96 | > |
82 | ng-bind="articulo.DES" | 97 | <i |
83 | ></td> | 98 | class="selectable" |
84 | <td class="col text-right"> | 99 | ng-click="cambioEdit(articulo, 'cantidad')" |
85 | <input | 100 | ng-hide="articulo.editCantidad" |
86 | ng-show="articulo.editCantidad" | 101 | ng-bind="articulo.CAN"> |
87 | ng-model="tmpCantidad" | 102 | </i> |
88 | class="form-control" | 103 | </td> |
89 | foca-tipo-input | 104 | <td class="col text-right"> |
90 | min="1" | ||
91 | foca-focus="articulo.editCantidad" | ||
92 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad);" | ||
93 | esc-key="cancelarEditar(articulo)" | ||
94 | ng-focus="selectFocus($event); tmpCantidad = articulo.CAN;" | ||
95 | teclado-virtual | ||
96 | > | ||
97 | <i | ||
98 | class="selectable" | ||
99 | ng-click="cambioEdit(articulo, 'cantidad')" | ||
100 | ng-hide="articulo.editCantidad" | ||
101 | ng-bind="articulo.CAN"> | ||
102 | </i> | ||
103 | </td> | ||
104 | <td class="col text-right"> | ||
105 | <i | 105 | <i |
106 | class="selectable" | 106 | class="selectable" |
107 | ng-bind="articulo.PUN | number: 4"> | ||
108 | </i> | ||
109 | </td> | 107 | ng-bind="articulo.PUN | number: 4"> |
110 | <td | 108 | </i> |
111 | class="col text-right" | 109 | </td> |
112 | ng-bind="(articulo.PUN * articulo.CAN) | number: 2"> | 110 | <td |
113 | </td> | 111 | class="col text-right" |
114 | <td class="text-center"> | 112 | ng-bind="(articulo.PUN * articulo.CAN) | number: 2"> |
115 | <button | 113 | </td> |
116 | class="btn btn-outline-light" | 114 | <td class="text-center"> |
117 | ng-click="quitarDespacho(articulo, key)" | 115 | <button |
118 | > | 116 | class="btn btn-outline-light" |
119 | <i class="fa fa-trash"></i> | 117 | ng-click="quitarDespacho(articulo, key)" |
120 | </button> | 118 | > |
121 | <button | 119 | <i class="fa fa-trash"></i> |
122 | class="btn btn-outline-light" | 120 | </button> |
123 | ng-click="editarArticulo(13, articulo, tmpCantidad);" | 121 | <button |
124 | ng-show="articulo.editCantidad || articulo.editPrecio" | 122 | class="btn btn-outline-light" |
125 | > | 123 | ng-click="editarArticulo(13, articulo, tmpCantidad);" |
126 | <i class="fa fa-save"></i> | 124 | ng-show="articulo.editCantidad || articulo.editPrecio" |
127 | </button> | 125 | > |
128 | </td> | 126 | <i class="fa fa-save"></i> |
129 | </tr> | 127 | </button> |
130 | </tbody> | 128 | </td> |
131 | <tfoot> | 129 | </tr> |
132 | <tr class="d-flex"> | 130 | </tbody> |
133 | <td colspan="4" class="no-border-top"> | 131 | <tfoot> |
134 | <strong>Items:</strong> | 132 | <tr class="d-flex"> |
135 | <a ng-bind="articulosFiltro().length"></a> | 133 | <td colspan="4" class="no-border-top"> |
136 | </td> | 134 | <strong>Items:</strong> |
137 | <td class="text-right ml-auto table-celda-total no-border-top"> | 135 | <a ng-bind="articulosFiltro().length"></a> |
138 | <h3>Total:</h3> | 136 | </td> |
139 | </td> | 137 | <td class="text-right ml-auto table-celda-total no-border-top text-white"> |
140 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 138 | <h3>Total:</h3> |
141 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> | 139 | </td> |
142 | </td> | 140 | <td class="table-celda-total text-right no-border-top text-white " colspan="1"> |
143 | <td class="text-right no-border-top"> | 141 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> |
144 | <button | 142 | </td> |
145 | type="button" | 143 | |
146 | class="btn btn-sm" | ||
147 | > | ||
148 | Totales | ||
149 | </button> | ||
150 | </td> | ||
151 | </tr> | ||
152 | </tfoot> | ||
153 | </table> | 144 | </tr> |
154 | </div> | 145 | </tfoot> |
155 | <!-- MOBILE --> | 146 | </table> |
156 | <div class="row d-sm-none"> | 147 | </div> |
148 | <!-- MOBILE --> | ||
149 | <div class="row d-sm-none"> | ||
150 | <div class="col p-0 m-2 mb-5"> | ||
151 | <table class="table table-sm table-striped tabla-articulo"> | ||
152 | <thead> | ||
153 | <tr class="d-flex"> | ||
154 | <th class="">#</th> | ||
155 | <th class="col px-0"> | ||
156 | <div class="d-flex"> | ||
157 | <div class="col-4 px-1">Código</div> | ||
158 | <div class="col-8 px-1">Descripción</div> | ||
159 | </div> | ||
160 | <div class="d-flex"> | ||
161 | <div class="col-3 px-1">Cantidad</div> | ||
162 | <div class="col px-1 text-right">P. Uni.</div> | ||
163 | <div class="col px-1 text-right">Subtotal</div> | ||
164 | </div> | ||
165 | </th> | ||
166 | <th class="text-center tamaño-boton"> | ||
167 | | ||
168 | </th> | ||
169 | </tr> | ||
170 | </thead> | ||
171 | <tbody> | ||
172 | <tr | ||
173 | ng-repeat="(key, articulo) in articulosFiltro()" | ||
174 | ng-show="show || key == articulosFiltro().length - 1" | ||
175 | > | ||
176 | <td class="w-100 d-flex p-0"> | ||
177 | <div class="p-1 m-auto"> | ||
178 | <span ng-bind="key + 1"></span> | ||
179 | </div> | ||
180 | <div class="col px-0"> | ||
181 | <div class="d-flex"> | ||
182 | <div class="col-4 px-1"> | ||
183 | <span | ||
184 | ng-bind="articulo.SEC + '-' + articulo.ART" | ||
185 | ></span> | ||
186 | </div> | ||
187 | <div class="col-8 px-1"> | ||
188 | <span ng-bind="articulo.DES"></span> | ||
189 | </div> | ||
190 | </div> | ||
191 | <div class="d-flex"> | ||
192 | <div class="col-4 px-1"> | ||
193 | <span | ||
194 | ng-bind="'x' + articulo.CAN" | ||
195 | ng-hide="articulo.editCantidad" | ||
196 | ></span> | ||
197 | <i | ||
198 | class="fa fa-pencil text-white-50" | ||
199 | aria-hidden="true" | ||
200 | ng-hide="articulo.editCantidad" | ||
201 | ng-click="articulo.editCantidad = true" | ||
202 | ></i> | ||
203 | <input | ||
204 | ng-show="articulo.editCantidad" | ||
205 | ng-model="tmpCantidad" | ||
206 | class="form-control" | ||
207 | foca-tipo-input | ||
208 | min="1" | ||
209 | step="0.001" | ||
210 | foca-focus="articulo.editCantidad" | ||
211 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad)" | ||
212 | ng-focus="selectFocus($event)" | ||
213 | > | ||
214 | </div> | ||
215 | <div class="col px-1 text-right"> | ||
216 | <span ng-bind="articulo.PUN | | ||
217 | currency: factura.cotizacion.moneda.SIMBOLO : 4"></span> | ||
218 | ></span> | ||
219 | </div> | ||
220 | <div class="col px-1 text-right"> | ||
221 | <span | ||
222 | ng-bind="(articulo.PUN * articulo.CAN) | | ||
223 | currency: factura.cotizacion.moneda.SIMBOLO" | ||
224 | > | ||
225 | </span> | ||
226 | </div> | ||
227 | </div> | ||
228 | </div> | ||
229 | <div class="m-auto p-1"> | ||
230 | <button | ||
231 | class="btn btn-outline-light" | ||
232 | ng-click="quitarDespacho(articulo, key)" | ||
233 | > | ||
234 | <i class="fa fa-trash"></i> | ||
235 | </button> | ||
236 | </div> | ||
237 | </td> | ||
238 | </tr> | ||
239 | </tbody> | ||
240 | <tfoot> | ||
241 | <!-- TOOGLE EXPANDIR --> | ||
242 | <tr> | ||
243 | <td class="col"> | ||
244 | <button | ||
245 | class="btn btn-outline-light selectable w-100" | ||
246 | ng-click="show = !show; masMenos()" | ||
247 | ng-show="articulosFiltro().length > 0" | ||
248 | > | ||
249 | <i | ||
250 | class="fa fa-chevron-down" | ||
251 | ng-hide="show" | ||
252 | aria-hidden="true" | ||
253 | > | ||
254 | </i> | ||
255 | <i | ||
256 | class="fa fa-chevron-up" | ||
257 | ng-show="show" | ||
258 | aria-hidden="true"> | ||
259 | </i> | ||
260 | </button> | ||
261 | </td> | ||
262 | </tr> | ||
263 | <!-- FOOTER --> | ||
264 | <tr class="d-flex"> | ||
265 | <td class="m-auto no-border-top" colspan="2"> | ||
266 | <strong>Cantidad Items:</strong> | ||
267 | <a ng-bind="articulosFiltro().length"></a> | ||
268 | </td> | ||
269 | <td class="text-right ml-auto table-celda-total no-border-top"> | ||
270 | <h3>Total:</h3> | ||
271 | </td> | ||
272 | <td class="table-celda-total text-right no-border-top"> | ||
273 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> | ||
274 | </td> | ||
275 | </tr> | ||
276 | </tfoot> | ||
277 | </table> | ||
278 | </div> | ||
279 | </div> |
src/views/modal-combustibles.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-lg-6"> | ||
4 | <h5 class="modal-title my-1"><b>Despachos Disponibles</b></h5> | ||
5 | </div> | ||
6 | </div> | ||
7 | </div> | ||
8 | <div class="modal-body" id="modal-body"> | ||
9 | |||
10 | <div class="row pb-2 border-bottom"> | ||
11 | <div class="col"> | ||
12 | <p ng-style="colorTexto" class="m-1 h6"> | ||
13 | <b> | ||
14 | <i class="fa fa-circle" aria-hidden="true"></i> {{nombreProducto}} | ||
15 | </b> | ||
16 | </p> | ||
17 | </div> | ||
18 | </div> | ||
19 | <div ng-repeat="(key, manguera) in mangueras"> | ||
20 | <div class="row my-2"> | ||
21 | <div class="col"> | ||
22 | <label> | ||
23 | <img class="w-50" ng-src="./img/surtidor.png" alt=""> | ||
24 | {{manguera.csu}} | ||
25 | </label> | ||
26 | <button | ||
27 | type="button" | ||
28 | class="btn p-1 text-secondary float-right border" | ||
29 | ng-click="manguera.show = !manguera.show"> | ||
30 | <i ng-show="manguera.show" class="fa fa-minus px-1"></i> | ||
31 | <i ng-show="!manguera.show" class="fa fa-plus px-1"></i> | ||
32 | </button> | ||
33 | <table class="table table-sm table-striped" ng-show="manguera.show"> | ||
34 | <tbody> | ||
35 | <tr ng-repeat="(key, despacho) in manguera.despachos"> | ||
36 | <td class="py-2 py-sm-1" ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | ||
37 | <td class="py-2 py-sm-1" ng-bind="despacho.LTS"></td> | ||
38 | <td class="py-2 py-sm-1" ng-bind="despacho.IMP | currency: '$'"></td> | ||
39 | <td class="py-2 py-sm-1"> | ||
40 | <button | ||
41 | type="button" | ||
42 | class="btn btn-default btn-xs p-1 float-right" | ||
43 | title="Seleccionar" | ||
44 | ng-click="aceptar(despacho)" | ||
45 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> | ||
46 | </button> | ||
47 | </td> | ||
48 | </tr> | ||
49 | </tbody> | ||
50 | </table> | ||
51 | </div> | ||
52 | </div> | ||
53 | </div> | ||
54 | |||
55 | </div> | ||
56 | <div class="modal-footer py-2"> | ||
57 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> | ||
58 | <ul class="pagination pagination-sm mb-0"> | ||
59 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | ||
60 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | ||
61 | <span aria-hidden="true">«</span> | ||
62 | <span class="sr-only">Anterior</span> | ||
63 | </a> | ||
64 | </li> | ||
65 | <li | ||
66 | class="page-item" | ||
67 | ng-repeat="pagina in paginas" | ||
68 | ng-class="{'active': pagina == currentPage}" | ||
69 | > | ||
70 | <a | ||
71 | class="page-link" | ||
72 | href="javascript:void();" | ||
73 | ng-click="selectPage(pagina)" | ||
74 | ng-bind="pagina" | ||
75 | ></a> | ||
76 | </li> | ||
77 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | ||
78 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | ||
79 | <span aria-hidden="true">»</span> | ||
80 | <span class="sr-only">Siguiente</span> | ||
81 | </a> | ||
82 | </li> | ||
83 | </ul> | ||
84 | </nav> | ||
85 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | ||
86 | </div> | ||
1 | <div class="modal-header py-1"> | 87 |
src/views/modal-estado-cuenta.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-lg-6"> | ||
4 | <h5 class="modal-title text-center my-1">Estado cuenta corriente</h5> | ||
5 | </div> | ||
6 | </div> | ||
7 | </div> | ||
8 | <div class="modal-body" id="modal-body"> | ||
9 | <div class="row m-3"> | ||
10 | <div class="col"> | ||
11 | <!-- <div class="row mb-2"> | ||
12 | <div class="col text-center"> | ||
13 | <p class="m-0">Autorizado</p> | ||
14 | <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> | ||
15 | </div> | ||
16 | </div> --> | ||
17 | <div class="row mb-2"> | ||
18 | <div class="col text-center"> | ||
19 | <p class="m-0">Cliente</p> | ||
20 | <label class="h5" ng-bind="cliente.idCliente"></label> | ||
21 | <label class="h5"> - </label> | ||
22 | <label class="h5" ng-bind="cliente.nombreCliente"></label> | ||
23 | </div> | ||
24 | </div> | ||
25 | <div class="row border-top mb-2"> | ||
26 | <div class="col text-center"> | ||
27 | <p class="m-0">Saldo</p> | ||
28 | <p class="h5 m-0" ng-bind="estadoCuenta.saldo | currency"></p> | ||
29 | </div> | ||
30 | </div> | ||
31 | <!-- <div class="row border-top"> | ||
32 | <div class="col text-center"> | ||
33 | <p class="m-0">Situacion</p> | ||
34 | <h4> | ||
35 | <p | ||
36 | ng-show="estadoCuenta.situacion" | ||
37 | class="badge badge-success m-0 px-3">Permitido | ||
38 | </p> | ||
39 | <p | ||
40 | ng-show="!estadoCuenta.situacion" | ||
41 | class="badge badge-danger m-0 px-3">No permitido | ||
42 | </p> | ||
43 | </h4> | ||
44 | </div> | ||
45 | </div> | ||
46 | <div class="row border-top mb-2"> | ||
47 | <div class="col text-center"> | ||
48 | <p class="m-0">Facturas Vencidas</p> | ||
49 | <p class="h5 m-0" ng-bind="estadoCuenta.facturasVencidas | currency"></p> | ||
50 | </div> | ||
51 | </div> --> | ||
52 | </div> | ||
53 | </div> | ||
54 | <div class="row h-25 align-items-center mx-0 botonera-secundaria"> | ||
55 | <div class="col-6 col-sm-4 offset-sm-2"> | ||
56 | <button | ||
57 | type="button" | ||
58 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | ||
59 | ng-disabled="!estadoCuenta.situacion" | ||
60 | ng-click="elegirTipoDePago({tipo: 'Contado', formaDePago: 1})" | ||
61 | > | ||
62 | <img ng-src="./img/contado.png" alt=""> | ||
63 | <p class="m-0">Contado</p> | ||
64 | </button> | ||
65 | </div> | ||
66 | <div class="col-6 col-sm-4"> | ||
67 | <button | ||
68 | type="button" | ||
69 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | ||
70 | ng-disabled="!estadoCuenta.situacion" | ||
71 | foca-focus="true" | ||
72 | ng-click="elegirTipoDePago({tipo: 'Cuenta Corriente', formaDePago: 2})" | ||
73 | > | ||
74 | <img ng-src="./img/cuentaCorriente.png" alt=""> | ||
75 | <p class="m-0">Cta. Corriente</p> | ||
76 | </button> | ||
77 | </div> | ||
78 | </div> | ||
79 | </div> | ||
80 | <div class="modal-footer py-2"> | ||
81 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | ||
82 | </div> | ||
1 | <div class="modal-header py-1"> | 83 |
src/views/modal-seleccionar-cliente.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-lg-6"> | ||
4 | <h5 class="modal-title my-1">Seleccione Cliente</h5> | ||
5 | </div> | ||
6 | </div> | ||
7 | </div> | ||
8 | <div class="modal-body" id="modal-body"> | ||
9 | |||
10 | </div> | ||
11 | <div class="modal-footer py-1"> | ||
12 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | ||
13 | </div> | ||
1 | <div class="modal-header py-1"> | 14 |
src/views/modal-ultimos-despachos.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-lg-6"> | ||
4 | <h5 class="modal-title my-1"><b>Últimos Despachos</b></h5> | ||
5 | </div> | ||
6 | </div> | ||
7 | </div> | ||
8 | <div class="modal-body" id="modal-body"> | ||
9 | <div ng-repeat="(key, producto) in productos"> | ||
10 | <div class="row pb-2 border-bottom"> | ||
11 | <div class="col"> | ||
12 | <p class="m-1 h6"> | ||
13 | <b> | ||
14 | <i class="fa fa-circle" aria-hidden="true"></i> {{producto.DetArt}} | ||
15 | </b> | ||
16 | </p> | ||
17 | </div> | ||
18 | </div> | ||
19 | <div class="row my-2" ng-repeat="(key, manguera) in producto.mangueras"> | ||
20 | <div class="col"> | ||
21 | <label> | ||
22 | <img class="w-50" ng-src="./img/surtidor.png" alt=""> | ||
23 | {{manguera.csu}} | ||
24 | </label> | ||
25 | <button | ||
26 | type="button" | ||
27 | class="btn p-1 text-secondary float-right border" | ||
28 | ng-click="manguera.show = !manguera.show"> | ||
29 | <i ng-show="manguera.show" class="fa fa-minus px-1"></i> | ||
30 | <i ng-show="!manguera.show" class="fa fa-plus px-1"></i> | ||
31 | </button> | ||
32 | <table class="table table-sm table-striped" ng-show="manguera.show"> | ||
33 | <tbody> | ||
34 | <tr ng-repeat="despacho in manguera.despachos"> | ||
35 | <td class="py-2 py-sm-1" ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | ||
36 | <td class="py-2 py-sm-1" ng-bind="despacho.LTS"></td> | ||
37 | <td class="py-2 py-sm-1" ng-bind="despacho.IMP | currency: '$'"></td> | ||
38 | <td class="py-2 py-sm-1"> | ||
39 | <button | ||
40 | type="button" | ||
41 | class="btn btn-default btn-xs p-1 float-right" | ||
42 | title="Seleccionar" | ||
43 | ng-click="aceptar(producto)" | ||
44 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> | ||
45 | </button> | ||
46 | </td> | ||
47 | </tr> | ||
48 | </tbody> | ||
49 | </table> | ||
50 | </div> | ||
51 | </div> | ||
52 | </div> | ||
53 | |||
54 | </div> | ||
55 | <div class="modal-footer py-2"> | ||
56 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> | ||
57 | <ul class="pagination pagination-sm mb-0"> | ||
58 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | ||
59 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | ||
60 | <span aria-hidden="true">«</span> | ||
61 | <span class="sr-only">Anterior</span> | ||
62 | </a> | ||
63 | </li> | ||
64 | <li | ||
65 | class="page-item" | ||
66 | ng-repeat="pagina in paginas" | ||
67 | ng-class="{'active': pagina == currentPage}" | ||
68 | > | ||
69 | <a | ||
70 | class="page-link" | ||
71 | href="javascript:void();" | ||
72 | ng-click="selectPage(pagina)" | ||
73 | ng-bind="pagina" | ||
74 | ></a> | ||
75 | </li> | ||
76 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | ||
77 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | ||
78 | <span aria-hidden="true">»</span> | ||
79 | <span class="sr-only">Siguiente</span> | ||
80 | </a> | ||
81 | </li> | ||
82 | </ul> | ||
83 | </nav> | ||
84 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | ||
85 | </div> | ||
1 | <div class="modal-header py-1"> | 86 |