Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
satcfdi committed Mar 13, 2024
1 parent 890b9ed commit aa8c923
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
23 changes: 21 additions & 2 deletions satdigitalinvoice/facturacion.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from . import __version__, TEMP_DIRECTORY, ARCHIVOS_DIRECTORY, DATA_DIRECTORY, METADATA_FILE
from .client_validation import validar_client, clientes_generar_txt
from .environments import facturacion_environment
from .file_data_managers import ClientsManager, FacturasManager
from .file_data_managers import ClientsManager, FacturasManager, ProductosManager
from .gui_functions import generate_ingresos, pago_factura, exportar_facturas, archivos_folder, period_desc, parse_fecha_pago, parse_importe_pago, preview_cfdis, center_location, \
CALENDAR_FECHA_FMT, ConsoleErrors, \
generate_ajustes, generar_depositos, calculate_declaracion_provisional, calculate_diot
Expand Down Expand Up @@ -720,6 +720,17 @@ def nuevas_facturas(self, values, force=False):
values=cfdis,
)

def nuevos_productos(self, values, force=False):
productos_table = self.window['productos_table']
has_value = bool(productos_table.metadata)
productos_table.update(values=[])

if has_value or force:
productos = [{"Producto": k} | v for k, v in ProductosManager().items()]
productos_table.update(
values=productos,
)

def nuevos_ajustes(self, values, force=False):
ajustes_table = self.window['ajustes_table']
has_value = bool(ajustes_table.metadata)
Expand Down Expand Up @@ -761,6 +772,9 @@ def main_tab_group(self, values):
self.action_button_manager.clear()

match values['main_tab_group']:
case 'productos_tab':
self.nuevos_productos(values)

case 'facturas_tab':
self.nuevas_facturas(values)

Expand Down Expand Up @@ -1040,11 +1054,16 @@ def action(self, event, values):
)
)

case "editar_facturas" | "editar_ajustes":
case "editar_facturas" | "editar_ajustes" | "editar_depositos":
open_file(
os.path.abspath("facturas.yaml")
)

case "editar_productos":
open_file(
os.path.abspath("productos.yaml")
)

case "editar_configurar":
open_file(
os.path.abspath("config.yaml")
Expand Down
27 changes: 27 additions & 0 deletions satdigitalinvoice/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,33 @@ def make_layout(emisores, local_db):
]],
key='facturas_tab',
),
sg.Tab(
'Productos '.center(13),
[
[
sg.Button(image_data=EDIT_ICON, key="editar_productos", border_width=0, button_color=BUTTON_COLOR),
],
[
MyTable(
key="productos_table",
headings=[
'#',
'Producto',
'Descripcion',
'CuentaPredial',
'ClaveProdServ'
],
row_fn=lambda i, r: [
i,
r['Producto'],
r['Concepto']['Descripcion'],
r['Concepto'].get('CuentaPredial'),
r['Concepto']['ClaveProdServ']
]
)
]],
key='productos_tab',
),
sg.Tab(
'Correos'.center(13),
[
Expand Down

0 comments on commit aa8c923

Please sign in to comment.