Compare commits

..

2 Commits

Author SHA1 Message Date
el Mau 99b2351cb9 Set zh language 2023-02-16 22:02:18 -06:00
el Mau 2897c24431 Init support for multi languages 2023-02-11 00:18:03 -06:00
31 changed files with 328 additions and 641 deletions

View File

@ -1,26 +1,3 @@
v 2.0.2 [01-Abr-2023]
---------------------
- Fix: Obtener la clave del sat al facturar por lote.
v 2.0.1 [29-Mar-2023]
---------------------
- Fix ticket #97
Es necesario hacer una migración:
```
cd /opt/empresa-libre
git pull origin master
cd source/app/models
python main.py -bk
python main.py -m -r RFC
```
v 2.0.0 [08-Ene-2023]
----------------------
- Liberamos para todos la versión CFDI 4.0
@ -191,7 +168,7 @@ v 1.42.2 [14-Sep-2021]
- Los productos pueden no llevar ningún impuesto.
v 1.42.1 [01-Jun-2021]
v 1.42.1 [31-May-2021]
----------------------
- Error - Ticket #5

View File

@ -12,4 +12,3 @@
* Crea nueva documentación
* Propon nuevas funcionalidades
* Difunde Empresa Libre

View File

@ -1,3 +1,2 @@
[ ] Permitir más de un remolque en la Carta Porte
[ ] Campos de captura de Comercio Exterior
[ ] Representación impresa de Comercio Exterior

View File

@ -1 +1 @@
2.0.4
2.0.0

View File

@ -14,4 +14,9 @@ cryptography==3.4.8
xmlsec
segno
# pyqrcode
# pypng
# python-escpos
# pyusb
# pyserial
# qrcode

View File

@ -387,10 +387,6 @@ class CFDI(object):
for field in fields:
if field in datos:
attributes[field] = datos[field]
if not attributes:
return
node_name = '{}:Impuestos'.format(self._pre)
impuestos = ET.SubElement(self._cfdi, node_name, attributes)

View File

@ -293,8 +293,7 @@ def get_sat_productos(key):
def now():
n = datetime.datetime.now().replace(microsecond=0)
return n
return datetime.datetime.now().replace(microsecond=0)
def today():
@ -742,12 +741,7 @@ class LIBO(object):
if pakings:
col8.append((pakings[i],))
self._total_cantidades += float(cantidad)
if not count:
if not cell_5 is None:
cell_5.CellStyle = self._get_style(cell_5)
if not cell_6 is None:
cell_6.CellStyle = self._get_style(cell_6)
return
style_5 = self._get_style(cell_5)
@ -1131,7 +1125,6 @@ class LIBO(object):
return
def _cfdipays(self, data):
VERSION2 = '2.0'
version = data['Version']
related = data.pop('related', [])
@ -1165,8 +1158,7 @@ class LIBO(object):
cell_1 = self._set_cell('{doc.uuid}', uuid)
cell_2 = self._set_cell('{doc.serie}', serie)
cell_3 = self._set_cell('{doc.folio}', folio)
if version != VERSION2:
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
cell_5 = self._set_cell('{doc.moneda}', moneda)
cell_6 = self._set_cell('{doc.parcialidad}', parcialidad)
cell_7 = self._set_cell('{doc.saldoanterior}', saldo_anterior, value=True)
@ -1176,8 +1168,7 @@ class LIBO(object):
col1.append((uuid,))
col2.append((serie,))
col3.append((folio,))
if version != VERSION2:
col4.append((metodo_pago,))
col4.append((metodo_pago,))
col5.append((moneda,))
col6.append((parcialidad,))
col7.append((float(saldo_anterior),))
@ -1203,9 +1194,8 @@ class LIBO(object):
target2 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_3.getCellAddress().Column
target3 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
if version != VERSION2:
col = cell_4.getCellAddress().Column
target4 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_4.getCellAddress().Column
target4 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_5.getCellAddress().Column
target5 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_6.getCellAddress().Column
@ -1220,8 +1210,7 @@ class LIBO(object):
target1.setFormulaArray(tuple(col1))
target2.setDataArray(tuple(col2))
target3.setFormulaArray(tuple(col3))
if version != VERSION2:
target4.setDataArray(tuple(col4))
target4.setDataArray(tuple(col4))
target5.setDataArray(tuple(col5))
target6.setDataArray(tuple(col6))
target7.setDataArray(tuple(col7))
@ -1950,14 +1939,11 @@ def _totales(doc, cfdi, version):
for n in list(node):
tmp = CaseInsensitiveDict(n.attrib.copy())
if version in CFDI_VERSIONS:
tasa = ''
if 'tasaocuota' in tmp:
tasa = round(float(tmp['tasaocuota']), DECIMALES)
tasa = round(float(tmp['tasaocuota']), DECIMALES)
title = 'Traslado {} {}'.format(tn.get(tmp['impuesto']), tasa)
else:
title = 'Traslado {} {}'.format(tmp['impuesto'], tmp['tasa'])
if 'importe' in tmp:
traslados.append((title, float(tmp['importe'])))
traslados.append((title, float(tmp['importe'])))
node = imp.find('{}Retenciones'.format(PRE[version]))
if node is not None:
@ -2151,16 +2137,15 @@ def _get_info_pays_2(node):
def _cfdipays(doc, data, version):
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
node = doc.find(path)
if node is None:
pre_pays = PRE['PAGOS']['1.0']
#todo: Obtener versión de complemento
if version == '4.0':
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
node = doc.find(path)
else:
node = doc.find('{}Complemento/{}Pagos'.format(PRE[version], PRE['pagos']))
if node is None:
log.error('Node pays not found...')
return {}
if version == '4.0':
@ -2311,7 +2296,7 @@ def upload_file(rfc, opt, file_obj):
ext = tmp[-1].lower()
versions = ('_3.2.ods',
'_3.3.ods', '_3.3_cd_1.1.ods', '_3.3_cp_1.0.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', '_3.3.json',
'_3.3.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', '_3.3.json',
'_4.0.ods',
'_4.0_cn_1.2.ods',
'_4.0_cp_2.0.ods',

View File

@ -1106,11 +1106,3 @@ def get_qr(data, kind='svg', in_base64=False):
if in_base64:
qr = base64.b64encode(qr.getvalue()).decode()
return qr
def to_date(value):
t = now().time()
d = datetime.datetime.strptime(value.split(' ')[0], '%Y-%m-%d')
dt = datetime.datetime.combine(d, t)
return dt

View File

@ -62,7 +62,7 @@ class StorageEngine(object):
return main.NivelesEducativos.get_all()
def _get_titlelogin(self, values):
return main.get_title_app(2)
return main.get_title_app()
def _get_canopenpre(self, values):
return main.PreFacturasDetalle.can_open(values['id'])

View File

@ -23,7 +23,6 @@ import sqlite3
from peewee import *
from playhouse.fields import PasswordField, ManyToManyField
from playhouse.shortcuts import case, SQL, cast
from psycopg2.errors import UniqueViolation
if __name__ == '__main__':
@ -227,7 +226,6 @@ def import_invoice():
return {'ok': False, 'msg': msg}
obj = Productos.get(Productos.clave==row[0])
if isinstance(row[2], str):
msg = 'El Precio Unitario debe ser un número, debe ser 0.00, si no quieres cambiarlo'
return {'ok': False, 'msg': msg}
@ -249,7 +247,6 @@ def import_invoice():
'id_product': obj.id,
'delete': '-',
'clave': obj.clave,
'clave_sat': obj.clave_sat,
'descripcion': description or obj.descripcion,
'pedimento': pedimento,
'unidad': obj.unidad.id,
@ -326,7 +323,7 @@ def config_main(user):
'timbres': 0,
'decimales_precios': DECIMALES,
'pagos': Configuracion.get_bool('chk_config_pagos'),
'pays_data_bank': Configuracion.get_bool('chk_cfg_pays_data_bank'),
'pays_data_bank': Configuracion.get_bool('chk_cfg_pays_data_bank')
}
dp = Configuracion.get_bool('chk_config_decimales_precios')
if dp:
@ -368,7 +365,6 @@ def config_timbrar():
'cfdi_folio_custom': Configuracion.get_bool('chk_folio_custom'),
'cfdi_leyendasfiscales': Configuracion.get_bool('chk_config_leyendas_fiscales'),
'cfdi_show_total_cant': Configuracion.get_bool('chk_config_show_total_cant'),
'cfdi_change_date_invoice': Configuracion.get_bool('chk_config_change_date_invoice'),
}
return conf
@ -681,7 +677,6 @@ class Configuracion(BaseModel):
'chk_config_invoice_by_ticket',
'chk_config_show_total_cant',
'chk_cancel_invoices_by_admin',
'chk_config_change_date_invoice',
'chk_cancel_tickets_by_admin',
)
data = (Configuracion
@ -2226,7 +2221,7 @@ class CuentasBanco(BaseModel):
with database_proxy.transaction():
try:
obj = CuentasBanco.create(**values)
except (IntegrityError, UniqueViolation):
except IntegrityError:
msg = 'Esta cuenta ya existe'
return {'ok': False, 'msg': msg}
@ -2968,16 +2963,6 @@ class Socios(BaseModel):
fields.pop('accounts', '')
regimenes = fields.pop('regimenes', ())
w = (
(Socios.rfc==fields['rfc']) &
(Socios.slug==fields['slug']) &
(Socios.id!=id)
)
if Socios.select().where(w).exists():
msg = 'Ya existe otro emisor con este RFC y Razón Social'
data = {'ok': False, 'row': {}, 'new': True, 'msg': msg}
return data
try:
q = Socios.update(**fields).where(Socios.id==id)
q.execute()
@ -3396,25 +3381,11 @@ class MovimientosBanco(BaseModel):
msg = 'El movimiento esta conciliado, no se puede cancelar'
return {'ok': False, 'msg': msg}
filters = (
(CfdiPagos.movimiento==obj) &
(CfdiPagos.uuid.is_null(False)) &
(CfdiPagos.cancelada==False)
)
cp = CfdiPagos.select().where(filters).count()
if cp > 0:
msg = 'El movimiento tiene Factura de Pago activas, no se puede cancelar'
return {'ok': False, 'msg': msg}
filters = (
(CfdiPagos.movimiento==obj) &
(CfdiPagos.uuid.is_null(True)) &
(CfdiPagos.error!='')
)
cp = CfdiPagos.select().where(filters).count()
if cp > 0:
msg = 'El movimiento tiene Factura de Pago con error, no se puede cancelar'
return {'ok': False, 'msg': msg}
# ~ filters = (CfdiPagos.movimiento==obj)
# ~ cp = CfdiPagos.select().where(filters).count()
# ~ if cp > 0:
# ~ msg = 'El movimiento tiene Factura de Pago, no se puede cancelar'
# ~ return {'ok': False, 'msg': msg}
with database_proxy.transaction():
obj.cancelado = True
@ -4364,14 +4335,6 @@ class Productos(BaseModel):
if count:
return False
count = (TicketsDetalle
.select(fn.COUNT(TicketsDetalle.id)).join(Productos)
.where(Productos.id==id)
.count()
)
if count:
return False
with database_proxy.transaction():
obj = Productos.get(Productos.id==id)
obj.impuestos.clear()
@ -5632,15 +5595,6 @@ class Facturas(BaseModel):
leyendas_fiscales = utils.loads(values.pop('leyendas_fiscales', '[]'))
date_invoice = values.pop('date')
if Configuracion.get_bool('chk_config_change_date_invoice'):
values['fecha'] = utils.to_date(date_invoice)
days = (utils.now() - values['fecha']).days
if days > 2:
msg = 'Fecha inválida'
data = {'ok': False, 'row': {}, 'new': True, 'msg': msg}
return data
emisor = Emisor.select()[0]
values['serie'] = cls._get_serie(cls, user, values['serie'])
if Configuracion.get_bool('chk_folio_custom') and folio_custom:
@ -5722,14 +5676,13 @@ class Facturas(BaseModel):
decimales_precios = Configuracion.get_bool('chk_config_decimales_precios')
invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
is_global = bool(invoice.periodicidad)
base_iva_exento = 0.0
data_global = {}
if is_global:
values = invoice.periodicidad.split('|')
data_global['Periodicidad'] = values[0]
data_global['Meses'] = values[1]
data_global['Año'] = values[2]
now = utils.now()
data_global['Periodicidad'] = invoice.periodicidad
data_global['Meses'] = now.strftime('%m')
data_global['Año'] = now.strftime('%Y')
frm_vu = FORMAT
if decimales_precios:
@ -5815,10 +5768,6 @@ class Facturas(BaseModel):
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
for row in rows:
object_tax = '02'
if not row.producto is None:
object_tax = row.producto.objeto_impuesto
if is_global:
key_sat = row.clave_sat
key = row.clave
@ -5833,7 +5782,6 @@ class Facturas(BaseModel):
'Descripcion': row.descripcion,
'ValorUnitario': frm_vu.format(row.valor_unitario),
'Importe': FORMAT.format(row.importe),
'ObjetoImp': object_tax,
}
if not is_global:
concepto['Unidad'] = SATUnidades.get(SATUnidades.key==row.unidad).name[:20]
@ -5863,68 +5811,58 @@ class Facturas(BaseModel):
if invoice.tipo_comprobante != 'T':
if is_global:
ticket = None
try:
where = (
(fn.Concat(Tickets.serie, Tickets.folio)==row.clave) &
(Tickets.estatus=='Facturado')
)
ticket = (Tickets
.get(where)
)
product_taxes = (TicketsImpuestos
.select()
.where(TicketsImpuestos.ticket==ticket)
)
except Tickets.DoesNotExist:
product_taxes = row.producto.impuestos
ticket = (Tickets
.get(fn.Concat(Tickets.serie, Tickets.folio)==row.clave)
)
product_taxes = (TicketsImpuestos
.select()
.where(TicketsImpuestos.ticket==ticket)
)
else:
product_taxes = row.producto.impuestos
if object_tax == '02':
for impuesto in product_taxes:
base = float(row.importe - row.descuento)
if is_global and not ticket is None:
base = float(impuesto.base)
impuesto = impuesto.impuesto
for impuesto in product_taxes:
base = float(row.importe - row.descuento)
if is_global:
base = float(impuesto.base)
impuesto = impuesto.impuesto
if impuesto.tipo == 'E':
tax = {
'Base': FORMAT.format(base),
'Impuesto': '002',
'TipoFactor': 'Exento',
}
traslados.append(tax)
base_iva_exento += base
continue
if impuesto.key == '000':
continue
tasa = float(impuesto.tasa)
if tax_decimals:
import_tax = round(tasa * base, DECIMALES_TAX)
tmp += import_tax
xml_importe = FORMAT_TAX.format(import_tax)
else:
import_tax = round(tasa * base, DECIMALES)
xml_importe = FORMAT.format(import_tax)
tipo_factor = 'Tasa'
if impuesto.factor != 'T':
tipo_factor = 'Cuota'
if impuesto.tipo == 'E':
tax = {
"Base": FORMAT.format(base),
"Impuesto": impuesto.key,
"TipoFactor": tipo_factor,
"TasaOCuota": str(impuesto.tasa),
"Importe": xml_importe,
'Base': FORMAT.format(base),
'Impuesto': '002',
'TipoFactor': 'Exento',
}
if impuesto.tipo == 'T':
traslados.append(tax)
else:
retenciones.append(tax)
traslados.append(tax)
continue
if impuesto.key == '000':
continue
tasa = float(impuesto.tasa)
if tax_decimals:
import_tax = round(tasa * base, DECIMALES_TAX)
tmp += import_tax
xml_importe = FORMAT_TAX.format(import_tax)
else:
import_tax = round(tasa * base, DECIMALES)
xml_importe = FORMAT.format(import_tax)
tipo_factor = 'Tasa'
if impuesto.factor != 'T':
tipo_factor = 'Cuota'
tax = {
"Base": FORMAT.format(base),
"Impuesto": impuesto.key,
"TipoFactor": tipo_factor,
"TasaOCuota": str(impuesto.tasa),
"Importe": xml_importe,
}
if impuesto.tipo == 'T':
traslados.append(tax)
else:
retenciones.append(tax)
if traslados:
taxes['traslados'] = traslados
@ -5933,6 +5871,15 @@ class Facturas(BaseModel):
concepto['impuestos'] = taxes
# cfdi4
if not is_global:
concepto['ObjetoImp'] = row.producto.objeto_impuesto
else:
if taxes:
concepto['ObjetoImp'] = '02'
else:
concepto['ObjetoImp'] = '01'
conceptos.append(concepto)
impuestos = {}
@ -6002,14 +5949,6 @@ class Facturas(BaseModel):
}
retenciones.append(retencion)
if base_iva_exento:
traslado = {
'Base': FORMAT.format(base_iva_exento),
'Impuesto': '002',
'TipoFactor': 'Exento',
}
traslados.append(traslado)
impuestos['traslados'] = traslados
impuestos['retenciones'] = retenciones
impuestos['total_locales_trasladados'] = ''
@ -7299,14 +7238,12 @@ class FacturasPagos(BaseModel):
fac = Facturas.get(Facturas.id==int(i))
this_pay = values['this_pay']
importe = values['importe']
type_change = round(1 / values['type_change'], 6)
type_change = 1.00
if mov.moneda != fac.moneda:
type_change = round(1 / values['type_change'], 6)
validate = round(this_pay / type_change, 2)
while validate > importe:
type_change += 0.000001
validate = round(this_pay / type_change, 2)
while validate > importe:
type_change += 0.000001
validate = round(this_pay / type_change, 2)
mov_ant, numero = cls._movimiento_anterior(cls, mov, fac)
nuevo = {
@ -7477,33 +7414,6 @@ class CfdiPagos(BaseModel):
return {'ok': result['ok'], 'msg': result['msg'], 'id': last.id}
def _cancel2(self, values):
args = utils.loads(values['args'])
id = args.pop('id')
obj = CfdiPagos.get(CfdiPagos.id==id)
if not obj.uuid:
msg = 'La Factura de Pago no esta timbrada'
data = {'ok': False, 'msg': msg}
return data
pac = utils.get_pac_by_rfc(obj.xml)
auth = Configuracion.get_({'fields': 'auth_by_pac', 'pac': pac})
certificado = Certificado.get(Certificado.es_fiel==False)
result = utils.cancel_xml_sign(obj, args, auth, certificado)
if result['ok']:
obj.estatus = 'Cancelada'
obj.error = ''
obj.cancelada = True
obj.fecha_cancelacion = result['date']
else:
obj.error = result['msg']
obj.save()
return {'ok': result['ok'], 'msg': result['msg']}
def _get_folio(self, serie):
folio = int(Configuracion.get_('txt_config_cfdipay_folio') or '0')
start = (CfdiPagos
@ -7646,16 +7556,9 @@ class CfdiPagos(BaseModel):
tipo_factor = 'Cuota'
import_dr = round(tax.importe * tax_proporcion, 2)
base_dr = round(tax.base * tax_proporcion, 2)
new_import_tax = round(base_dr * tax.impuesto.tasa, 2)
while new_import_tax > import_dr:
base_dr -= Decimal(0.01)
new_import_tax = round(base_dr * tax.impuesto.tasa, 2)
import_dr = new_import_tax
xml_tax_base = FORMAT.format(base_dr)
xml_importe = FORMAT.format(import_dr)
base_dr = round(tax.base * tax_proporcion, 2)
xml_tax_base = FORMAT.format(base_dr)
values = {
"BaseDR": xml_tax_base,
@ -7664,7 +7567,6 @@ class CfdiPagos(BaseModel):
"TasaOCuotaDR": str(tax.impuesto.tasa),
"ImporteDR": xml_importe,
}
tax_key = tax.impuesto.key
if tax.impuesto.tipo == 'T':
traslados.append(values)
@ -7692,10 +7594,9 @@ class CfdiPagos(BaseModel):
return impuestos
# ~ Revisar Pagos
def _get_related_xml(self, id_mov, currency):
#TAX ToDo
TAX_IVA_16 = '002|0.160000'
TAX_IVA_0 = '002|0.000000'
filters = (FacturasPagos.movimiento==id_mov)
related = tuple(FacturasPagos.select(
@ -7703,7 +7604,8 @@ class CfdiPagos(BaseModel):
Facturas.serie.alias('Serie'),
Facturas.folio.alias('Folio'),
Facturas.moneda.alias('MonedaDR'),
FacturasPagos.tipo_cambio.alias('EquivalenciaDR'),
FacturasPagos.tipo_cambio.alias('TipoCambioDR'),
# ~ Facturas.metodo_pago.alias('MetodoDePagoDR'),
FacturasPagos.numero.alias('NumParcialidad'),
FacturasPagos.saldo_anterior.alias('ImpSaldoAnt'),
FacturasPagos.importe.alias('ImpPagado'),
@ -7716,15 +7618,15 @@ class CfdiPagos(BaseModel):
for r in related:
r['taxes'] = self._get_taxes_by_pay(self, r, taxes_pay)
# ~ print('\n\nMONEDA', currency, r['MonedaDR'])
r['IdDocumento'] = str(r['IdDocumento'])
r['Folio'] = str(r['Folio'])
r['NumParcialidad'] = str(r['NumParcialidad'])
r['TipoCambioDR'] = FORMAT6.format(r['TipoCambioDR'])
# ~ r['MetodoDePagoDR'] = DEFAULT_CFDIPAY['WAYPAY']
equivalencia = r['EquivalenciaDR']
if currency == r['MonedaDR']:
r['EquivalenciaDR'] = '1'
else:
r['EquivalenciaDR'] = FORMAT6.format(equivalencia)
# REVISAR
r['EquivalenciaDR'] = '1'
r['ObjetoImpDR'] = '01'
if r['taxes']['traslados'] or r['taxes']['retenciones']:
@ -7736,61 +7638,38 @@ class CfdiPagos(BaseModel):
r['ImpSaldoInsoluto'] = '0.00'
else:
r['ImpSaldoInsoluto'] = FORMAT.format(r['ImpSaldoInsoluto'])
if currency == r['MonedaDR']:
del r['TipoCambioDR']
if not r['Serie']:
del r['Serie']
total_tax_iva_16_base = 0
total_tax_iva_0_base = 0
total_tax_iva_16_importe = 0
total_tax_retenciones_isr_importe = 0
total_tax_retenciones_iva_importe = 0
for key, importe in taxes_pay['retenciones'].items():
taxes_pay['retenciones'][key] = FORMAT.format(importe)
if key == '002':
total_tax_retenciones_iva_importe += importe
else:
total_tax_retenciones_isr_importe += importe
total_tax_retenciones_isr_importe += importe
for k, tax in taxes_pay['traslados'].items():
tax_type = taxes_pay['traslados'][k]['ImpuestoP']
tax_tasa = taxes_pay['traslados'][k]['TasaOCuotaP']
tax_base = taxes_pay['traslados'][k]['BaseP']
importe = taxes_pay['traslados'][k]['ImporteP']
tax_base /= equivalencia
importe /= equivalencia
current_tax = f'{tax_type}|{tax_tasa}'
if current_tax == TAX_IVA_16:
# ~ new_import_tax = round(Decimal(tax_tasa) * tax_base, 2)
# ~ while new_import_tax > importe:
# ~ tax_base -= Decimal(0.01)
# ~ new_import_tax = round(Decimal(tax_tasa) * tax_base, 2)
if f'{tax_type}|{tax_tasa}' == TAX_IVA_16:
total_tax_iva_16_base += tax_base
total_tax_iva_16_importe += importe
elif current_tax == TAX_IVA_0:
total_tax_iva_0_base += tax_base
taxes_pay['traslados'][k]['BaseP'] = FORMAT.format(tax_base)
taxes_pay['traslados'][k]['ImporteP'] = FORMAT.format(importe)
taxes_pay['totales'] = {}
if taxes_pay['traslados']:
if total_tax_iva_16_base:
taxes_pay['totales']['TotalTrasladosBaseIVA16'] = FORMAT.format(total_tax_iva_16_base)
taxes_pay['totales']['TotalTrasladosImpuestoIVA16'] = FORMAT.format(total_tax_iva_16_importe)
if total_tax_iva_0_base:
taxes_pay['totales']['TotalTrasladosBaseIVA0'] = FORMAT.format(total_tax_iva_0_base)
taxes_pay['totales']['TotalTrasladosImpuestoIVA0'] = FORMAT.format(0.0)
taxes_pay['totales']['TotalTrasladosBaseIVA16'] = FORMAT.format(total_tax_iva_16_base)
taxes_pay['totales']['TotalTrasladosImpuestoIVA16'] = FORMAT.format(total_tax_iva_16_importe)
if taxes_pay['retenciones']:
if total_tax_retenciones_isr_importe:
taxes_pay['totales']['TotalRetencionesISR'] = FORMAT.format(total_tax_retenciones_isr_importe)
if total_tax_retenciones_iva_importe:
taxes_pay['totales']['TotalRetencionesIVA'] = FORMAT.format(total_tax_retenciones_iva_importe)
taxes_pay['totales']['TotalRetencionesISR'] = FORMAT.format(total_tax_retenciones_isr_importe)
return related, taxes_pay
@ -8012,7 +7891,6 @@ class CfdiPagos(BaseModel):
target = emisor.rfc + '/' + str(obj.fecha)[:7].replace('-', '/')
values = cls._get_not_in_xml(cls, obj, emisor)
data = util.get_data_from_xml(obj, values)
data.update(utils.CfdiToDict(obj.xml).values)
data['informacion_global'] = {}
obj = SATFormaPago.get(SATFormaPago.key==data['pays']['FormaDePagoP'])
@ -8231,9 +8109,6 @@ class Tickets(BaseModel):
class Meta:
order_by = ('fecha',)
indexes = (
(('serie', 'folio'), True),
)
def _get_folio(self, serie):
inicio = (Tickets
@ -8250,9 +8125,7 @@ class Tickets(BaseModel):
return inicio
def _without_tax(self, importe, obj):
# ~ todo
# ~ Por ahora se asume que solo tiene IVA trasladado 0.16
for tax in obj.impuestos:
tasa = 1.0 + float(tax.tasa)
base = round(importe / tasa, DECIMALES)
@ -8316,6 +8189,9 @@ class Tickets(BaseModel):
for tax in totals_tax.values():
if tax.tipo == 'E':
continue
ticket_tax = {
'ticket': ticket.id,
'impuesto': tax.id,
@ -8557,6 +8433,7 @@ class Tickets(BaseModel):
descuento_cfdi += details['descuento']
subtotal += details['importe']
FacturasDetalle.create(**details)
taxes = (TicketsImpuestos
@ -8571,6 +8448,7 @@ class Tickets(BaseModel):
tax_id = r.impuesto.id
tasa = r.impuesto.tasa
tax_importe = round(tasa * r.base, DECIMALES)
if tax_id in tax_sum:
tax_sum[tax_id]['base'] += r.base
tax_sum[tax_id]['importe'] += tax_importe
@ -8617,21 +8495,19 @@ class Tickets(BaseModel):
@classmethod
def invoice(cls, values, user):
is_invoice_day = util.get_bool(values['is_invoice_day'])
periodicidad = values.get('periodicidad', '')
periodicidad = values['periodicidad']
id_client = int(values['client'])
tickets = util.loads(values['tickets'])
# ~ invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
invoice_by_ticket = True
invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
if is_invoice_day:
filters = (
Socios.rfc == RFCS['PUBLIC'] and
Socios.slug == 'publico_en_general'
)
Socios.slug == 'publico_en_general')
try:
client = Socios.get(filters)
except Socios.DoesNotExist:
msg = 'No existe el cliente PUBLICO EN GENERAL. Agregalo primero.'
msg = 'No existe el cliente Público en General. Agregalo primero.'
data = {'ok': False, 'msg': msg}
return data
else:
@ -10924,11 +10800,11 @@ def get_sat_productos(key):
def get_title_app(by=1):
html = {
1: '<font color="#610B0B">{}</font>',
2: '<font color="#610B0B">Bienvenido a {}</font>',
2: '<font color="#610B0B">{}</font>',
3: '<font color="#000000">{}</font>',
}
# ~ return html[by].format(TITLE_APP)
return html[by].format(f'Empresa Libre v{VERSION_EMPRESA_LIBRE}')
return TITLE_APP
def test_correo(values):
@ -11271,8 +11147,6 @@ def _migrate_tables(rfc=''):
regimen_fiscal = TextField(default='')
migrations.append(migrator.add_column(table, field, regimen_fiscal))
# migrations.append(migrator.add_index('tickets', ('serie', 'folio'), True))
if migrations:
with database_proxy.atomic() as txn:
migrate(*migrations)
@ -11299,10 +11173,6 @@ def _migrate_tables(rfc=''):
else:
log.info('Valores actualizados...')
q = Configuracion.delete().where(Configuracion.clave=='chk_config_tax_decimals')
q.execute()
log.info('Config Tax Update...')
return

View File

@ -30,11 +30,6 @@ try:
except ImportError:
DEFAULT_PASSWORD = 'salgueiro3.3'
try:
from conf import TITLE_APP
except ImportError:
TITLE_APP = 'Empresa Libre'
try:
from conf import NO_HTTPS
except ImportError:
@ -42,10 +37,11 @@ except ImportError:
DEBUG = DEBUG
VERSION = '2.0.4'
TITLE = 'Empresa Libre'
VERSION = '2.0.0'
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
TITLE_APP = f'{TITLE} v{VERSION}'
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
COMPANIES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'rfc.db'))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -135,7 +135,6 @@ var controllers = {
$$('chk_config_invoice_by_ticket').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_show_total_cant').attachEvent('onItemClick', chk_config_item_click)
$$('chk_cancel_invoices_by_admin').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_change_date_invoice').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)

View File

@ -81,7 +81,6 @@ var bancos_controllers = {
$$('grid_bank_invoice_pay').attachEvent('onItemClick', grid_bank_invoice_pay_click)
$$('grid_cuentabanco').attachEvent('onItemDblClick', grid_cuentabanco_double_click)
$$('cmd_invoice_pay_sat').attachEvent('onItemClick', cmd_invoice_pay_sat_click)
$$('cmd_invoice_pay_cancel').attachEvent('onItemClick', cmd_invoice_pay_cancel_click)
init_config_bank()
}
@ -579,13 +578,13 @@ function validate_deposito(values){
return false
}
//~ if(grid.count() && current_currency!=CURRENCY_MN){
//~ if(type_change <= 1.0){
//~ msg = 'El Tipo de Cambio debe ser mayor a 1.00'
//~ msg_error(msg)
//~ return false
//~ }
//~ }
if(grid.count() && current_currency!=CURRENCY_MN){
if(type_change <= 1.0){
msg = 'El Tipo de Cambio debe ser mayor a 1.00'
msg_error(msg)
return false
}
}
var today = new Date()
if(values.deposito_fecha > today){
@ -1427,83 +1426,3 @@ function cmd_invoice_pay_sat_click(){
})
}
function cmd_invoice_pay_cancel_click(){
var g = $$('grid_bank_invoice_pay')
if(g.count() == 0){
return
}
var row = g.getSelectedItem()
if (row == undefined){
msg_error('Selecciona una factura de pago')
return
}
if (row instanceof Array){
msg_error('Selecciona solo una factura de pago')
return
}
if(!row.uuid){
msg_error('La factura de pago no esta timbrada')
return
}
win_invoice_cancel_pay2.init()
$$('win_invoice_cancel_pay2').show()
}
function cmd_invoice_cancel_pay2_click(){
var reason = $$('lst_reasons_cancel2').getValue()
var uuid = $$('txt_cancel_uuid2').getValue()
if(!reason){
msg = 'Selecciona un motivo para esta cancelación'
msg_error(msg)
return
}
if(reason=='01' & !uuid){
msg = 'Debes de capturar el UUID que reemplaza a este CFDI'
msg_error(msg)
return
}
send_invoice_cancel_pay2(reason, uuid)
$$('win_invoice_cancel_pay2').close()
}
function cmd_win_cancel_pay_close2_click(){
$$('win_invoice_cancel_pay2').close()
}
function send_invoice_cancel_pay2(reason='', uuid=''){
var grid = $$('grid_bank_invoice_pay')
var row = grid.getSelectedItem()
var data = {
'opt': 'cancel2',
args: {
id: row.id,
reason: reason,
uuid: uuid,
}
}
webix.ajax().post('cfdipay', data, function(text, data){
var values = data.json()
if(values.ok){
msg_ok(values.msg)
grid.updateItem(row.id, {'estatus': 'Cancelada'})
}else{
msg_error('No fue posible cancelar')
webix.alert({
title: 'Error al Cancelar',
text: values.msg,
type: 'alert-error'
})
}
})
}

View File

@ -23,7 +23,6 @@ var anticipo = false
var donativo = false
var cfg_invoice = new Object()
var values_comercioe = null
var values_global = ''
function init_config_invoices(){
@ -34,7 +33,6 @@ function init_config_invoices(){
g.showColumn('total')
g.showColumn('currency')
}
show('cmd_show_global_information', false)
}
@ -98,7 +96,6 @@ var invoices_controllers = {
$$('cmd_carta_copy_from_invoice').attachEvent('onItemClick', cmd_carta_copy_from_invoice_click)
$$('cmd_carta_import_json').attachEvent('onItemClick', cmd_carta_import_json_click)
$$('cmd_import_json_comercioe').attachEvent('onItemClick', cmd_import_json_comercioe_click)
$$('cmd_show_global_information').attachEvent('onItemClick', cmd_show_global_information_click)
webix.extend($$('grid_invoices'), webix.ProgressBar)
@ -257,10 +254,7 @@ function default_config(){
show('fs_divisas', values.cfdi_divisas)
show('txt_folio_custom', values.cfdi_folio_custom)
show('txt_total_cant', values.cfdi_show_total_cant)
show('date_invoice', values.cfdi_change_date_invoice)
})
values_global = ''
}
@ -302,9 +296,6 @@ function cmd_new_invoice_click(){
lst.setValue('')
lst.getList().clearAll()
$$('date_invoice').setValue(new Date())
show('cmd_show_global_information', false)
form.focus('search_client_name')
}
@ -369,21 +360,6 @@ function cmd_delete_invoice_click(id, e, node){
function validate_invoice(values){
var date_invoice = $$('date_invoice').getValue()
if(date_invoice == null){
msg = 'La fecha es requerida'
msg_error(msg)
$$('date_invoice').setFocus()
return false
}
var now = new Date()
var difference = (now.getTime() - date_invoice.getTime()) / (1000 * 3600 * 24)
if(difference > 3){
msg_error('Fecha inválida')
return false
}
var usar_cartaporte = $$('chk_cfdi_usar_cartaporte').getValue()
if(usar_cartaporte){
value = $$('lst_carta_UnidadPeso').getValue()
@ -533,28 +509,8 @@ function validate_invoice(values){
}
var is_global = $$('cmd_show_global_information').isVisible()
if(is_global){
if(values_global==''){
msg = 'Captura los datos de la Factura Global'
msg_error(msg)
return false
}
}
var rows = grid.data.getRange()
for (i = 0; i < rows.length; i++) {
if(is_global){
var key_sat = rows[i]['clave_sat']
if(key_sat!=KEY_SAT_01){
var msg = 'Clave SAT inválida para Facturar Global en la línea: ' + (i + 1)
msg_error(msg)
return false
}
}
var importe = rows[i]['importe']
if(!importe){
var msg = 'No es posible facturar importes en cero, revisa la línea: ' + (i + 1)
@ -731,7 +687,6 @@ function guardar_y_timbrar(values){
data['id'] = values.id
data['cliente'] = values.id_partner
data['productos'] = rows
data['date'] = $$('date_invoice').getValue()
data['serie'] = $$('lst_serie').getText()
data['forma_pago'] = $$('lst_forma_pago').getValue()
data['condiciones_pago'] = $$('txt_condicion_pago').getValue().trim()
@ -750,8 +705,6 @@ function guardar_y_timbrar(values){
data['folio_custom'] = $$('txt_folio_custom').getValue()
data['divisas'] = $$('opt_divisas').getValue()
data['leyendas_fiscales'] = $$('grid_leyendas_fiscales').getSelectedId(true, true)
data['periodicidad'] = values_global
$$('grid_leyendas_fiscales').unselectAll()
var usar_ine = $$('chk_cfdi_usar_ine').getValue()
@ -845,7 +798,6 @@ function guardar_y_timbrar(values){
}
values_comercioe = null
values_global = ''
$$('chk_cfdi_usar_comercioe').setValue(false)
table_relaciones.clear()
@ -854,7 +806,6 @@ function guardar_y_timbrar(values){
$$('chk_cfdi_anticipo').setValue(0)
$$('chk_cfdi_donativo').setValue(0)
$$('chk_cfdi_usar_ine').setValue(0)
show('cmd_show_global_information', false)
$$('form_invoice').setValues({id_partner: 0, lbl_partner: 'Ninguno', notas:''})
$$('multi_invoices').setValue('invoices_home')
@ -871,7 +822,6 @@ function cmd_timbrar_click(id, e, node){
}
var values = form.getValues()
if(!validate_invoice(values)){
return
}
@ -923,10 +873,6 @@ function cmd_timbrar_click(id, e, node){
}
}
if($$('cmd_show_global_information').isVisible()){
msg += 'Es una Factura Global<BR><BR>'
}
msg += '¿Estás seguro de timbrar esta factura?<BR><BR>'
webix.confirm({
@ -999,12 +945,6 @@ function set_client(row){
}
lst.setValue(lst.getPopup().getList().getFirstId())
if(row.nombre == PUBLICO && row.rfc == RFC_PUBLICO){
show('cmd_show_global_information', true)
}else{
show('cmd_show_global_information', false)
}
form.focus('search_product_id')
}
@ -2963,20 +2903,3 @@ function up_invoice_json_comercioe_on_after_file_add(obj){
}
$$('win_import_json_comercioe').close()
}
function cmd_show_global_information_click(){
win_global_information.init()
$$('win_global_information').show()
}
function cmd_save_global_information_click(){
values_global = $$('lst_global_periodicidad').getValue() + "|"
values_global += $$('lst_global_months').getValue() + "|"
values_global += $$('lst_global_year').getValue()
$$('win_global_information').close()
}
function cmd_win_global_close_click(){
$$('win_global_information').close()
}

View File

@ -0,0 +1,32 @@
{
"en": {
"test": "Test",
"languages": "Languages",
"welcome": "Welcome to ",
"access": "Access to system",
"user": "User",
"password": "Password",
"login": "Login",
"start": "Home"
},
"es": {
"test": "Prueba",
"languages": "Idiomas",
"welcome": "Bienvenido a ",
"access": "Acceso al sistema",
"user": "Usuario",
"password": "Contraseña",
"login": "Iniciar Sesión",
"start": "Inicio"
},
"zh": {
"test": "测试",
"languages": "语言",
"welcome": "欢迎来到 ",
"access": "进入系统",
"user": "用户",
"password": "密码",
"login": "登录",
"start": "首页"
}
}

View File

@ -0,0 +1,85 @@
// MultiLang - BdR 2016
// JavaScript object to handle multilanguage, load phrases from JSON etc.
var MultiLang = function(url, lang, onload)
{
// variables
this.phrases = {};
// language code from parameter or if null then default to browser language preference
// Keep only first two characters, for example 'en-US' -> 'en', or 'nl-NL' -> 'nl' etc.
this.selectedLanguage = (lang || navigator.language || navigator.userLanguage).substring(0, 2);
// onLoad callback function, call after loading JSON
this.onLoad = onload;
// load json from url
if (typeof url !== 'undefined') {
var obj = this;
var req = new XMLHttpRequest();
// NOTE: will load asynchronously!
req.open("GET", url, true);
//req.setRequestHeader("User-Agent", navigator.userAgent);
req.onreadystatechange = function (evt) {
if (evt.target.readyState == 4 && evt.target.status == 200) // status == 200, do not allow "Cross origin requests"
//if (evt.target.readyState == 4)// TESTING allow "Cross origin requests" to load from local harddisk
{
// load translations
this.phrases = JSON.parse( evt.target.responseText );
// verify that the currently selected language exists in the translations
this.setLanguage(this.selectedLanguage);
// do callback when loading JSON is ready
if (this.onLoad) {
this.onLoad();
}
};
}.bind(obj); // NOTE: bind onreadyfunction to MultiLang instead of XMLHttpRequest, so MultiLang.phrases will be set instead of added to XMLHttpRequest
req.addEventListener("error", function(e) {
console.log('MultiLang.js: Error reading json file.');
}, false);
req.send(null);
};
this.setLanguage = function(langcode) {
// check if language code <langcode> does not exist in available translations in json file
// For example, available translated texts in json are 'en' and 'fr', but client language is 'es'
if (!this.phrases.hasOwnProperty(langcode)) {
// doesn't exist so default to the first available language, i.e. the top-most language in json file
// NOTE: the order of properties in a JSON object are not *guaranteed* to be the same as loading time,
// however in practice all browsers do return them in order
for (var key in this.phrases) {
if (this.phrases.hasOwnProperty(key)) {
langcode = key; // take the first language code
break;
};
};
};
// set as selected language code
this.selectedLanguage = langcode;
};
this.get = function(key) {
// get key phrase
var str;
// check if any languages were loaded
if (this.phrases[this.selectedLanguage]) str = this.phrases[this.selectedLanguage][key];
// if key does not exist, return the literal key
str = (str || key);
return str;
};
this.get_default = function(){
var lang = (navigator.language || navigator.userLanguage).substring(0, 2);
return lang
};
}

View File

@ -232,9 +232,18 @@ function cmd_save_product_click(id, e, node){
}
var rows = $$('grid_product_taxes').getSelectedId(true, true)
//~ if (rows.length == 0){
//~ msg_error('Selecciona un impuesto')
//~ return
//~ }
var values = form.getValues();
//~ if(!isFinite(values.cant_by_packing)){
//~ msg_error('La cantidad por empaque debe ser un número')
//~ return
//~ }
if(!validate_sat_key_product(values.clave_sat, false)){
msg_error('La clave SAT no existe')
return
@ -245,19 +254,7 @@ function cmd_save_product_click(id, e, node){
return
}
if(values['objeto_impuesto']=='01' && rows.length > 0){
msg = 'Si Objeto de Impuestos = 01, no debes seleccionar ningún impuesto'
msg_error(msg)
return
}
if(values['objeto_impuesto']=='02' && rows.length == 0){
msg = 'Si Objeto de Impuestos = 02, debes de seleccionar al menos un impuesto'
msg_error(msg)
return
}
values['taxes'] = JSON.stringify(rows)
webix.ajax().sync().post('products', values, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico'

View File

@ -149,9 +149,7 @@ function configuracion_inicial_ticket_to_invoice(){
var grid = $$('grid_tickets_active')
var gridt = $$('grid_tickets_invoice')
var form = $$('form_ticket_invoice')
var chk = $$('chk_is_invoice_day')
chk.setValue(false)
get_active_tickets(grid)
form.setValues({id_partner: 0, lbl_tclient: 'Ninguno'})
gridt.attachEvent('onAfterAdd', function(id, index){
@ -615,12 +613,7 @@ function chk_is_invoice_day_change(new_value, old_value){
var value = Boolean(new_value)
show('fs_ticket_search_client', !value)
enable('lst_global_periodicidad_2', value)
enable('lst_global_months_2', value)
var current_date = new Date()
var current_month = (current_date.getMonth() + 1).toString().padStart(2, '0')
$$('lst_global_months_2').setValue(current_month)
enable('lst_periodicidad', value)
}
@ -652,7 +645,6 @@ function save_ticket_to_invoice(data){
if(values.ok){
msg_ok(values.msg)
send_timbrar_invoice(values.id)
$$('chk_is_invoice_day').setValue(false)
$$('multi_tickets').setValue('tickets_home')
}else{
msg_error(values.msg)
@ -689,26 +681,13 @@ function cmd_new_invoice_from_ticket_click(){
})
var data = new Object()
data['opt'] = 'invoice'
data['client'] = values.id_partner
data['tickets'] = tickets
data['is_invoice_day'] = chk.getValue()
data['periodicidad'] = $$('lst_periodicidad').getValue()
data['opt'] = 'invoice'
var periodicidad = ''
if(data['is_invoice_day']){
periodicidad = $$('lst_global_periodicidad_2').getValue() + '|'
periodicidad += $$('lst_global_months_2').getValue() + '|'
periodicidad += new Date().getFullYear()
}
data['periodicidad'] = periodicidad
msg = 'Todos los datos son correctos.<BR><BR>'
if(data['is_invoice_day']){
msg += 'Es Factura Global.<BR><BR>'
}
msg += '¿Estás seguro de generar esta factura?'
msg = 'Todos los datos son correctos.<BR><BR>¿Estás seguro de generar esta factura?'
webix.confirm({
title: 'Generar Factura',
ok: 'Si',

View File

@ -15,7 +15,7 @@
//~ along with this program. If not, see <http://www.gnu.org/licenses/>.
var PUBLICO = "PUBLICO EN GENERAL";
var PUBLICO = "Público en general";
var RFC_PUBLICO = "XAXX010101000";
var RFC_EXTRANJERO = "XEXX010101000";
var PAIS = "México";
@ -24,7 +24,6 @@ var DECIMALES = 2;
var DECIMALES_TAX = 4;
var CLAVE_ANTICIPOS = '84111506';
var CURRENCY_MN = 'MXN';
var KEY_SAT_01 = '01010101';
var db = new loki('data.db');
@ -628,33 +627,3 @@ function grid_parse(grid_name, values){
function activate_tab(parent, name){
$$(parent).getTabbar().setValue(name)
}
var opt_global_periodicidad = [
{id: '01', value: '[01] Diario'},
{id: '02', value: '[02] Semanal'},
{id: '03', value: '[03] Quincenal'},
{id: '04', value: '[04] Mensual'},
{id: '05', value: '[05] Bimestral'},
]
var opt_global_months = [
{id: '01', value: '[01] Enero'},
{id: '02', value: '[02] Febrero'},
{id: '03', value: '[03] Marzo'},
{id: '04', value: '[04] Abril'},
{id: '05', value: '[05] Mayo'},
{id: '06', value: '[06] Junio'},
{id: '07', value: '[07] Julio'},
{id: '08', value: '[08] Agosto'},
{id: '09', value: '[09] Septiembre'},
{id: '10', value: '[10] Octubre'},
{id: '11', value: '[11] Noviembre'},
{id: '12', value: '[12] Diciembre'},
{id: '13', value: '[13] Enero-Febrero'},
{id: '14', value: '[14] Marzo-Abril'},
{id: '15', value: '[15] Mayo-Junio'},
{id: '16', value: '[16] Julio-Agosto'},
{id: '17', value: '[17] Septiembre-Octubre'},
{id: '18', value: '[18] Noviembre-Diciembre'},
]

View File

@ -668,7 +668,7 @@ var options_admin_otros = [
{view: 'checkbox', id: 'chk_config_tax_locales', labelWidth: 0,
labelRight: 'Impuestos locales, calcular antes del descuento'},
{view: 'checkbox', id: 'chk_config_tax_decimals', labelWidth: 0,
labelRight: 'Calcular impuestos con 4 decimales', hidden: true},
labelRight: 'Calcular impuestos con 4 decimales'},
{view: 'checkbox', id: 'chk_config_price_with_taxes_in_invoice', labelWidth: 0,
labelRight: 'Precio incluye impuestos'},
{view: 'checkbox', id: 'chk_config_add_same_product', labelWidth: 0,
@ -694,11 +694,6 @@ var options_admin_otros = [
labelRight: 'Solo admins pueden cancelar'},
{}
]},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_change_date_invoice', labelWidth: 0,
labelRight: 'Permitir cambiar fecha al facturar [No recomendable]'},
{}
]},
{maxHeight: 15},
{template: 'Timbrado', type: 'section'},

View File

@ -367,13 +367,11 @@ var toolbar_bank_invoice_pay_filter = [
{view: 'richselect', id: 'filter_invoice_pay_year', label: 'Año',
labelAlign: 'right', labelWidth: 50, width: 150, options: []},
{view: 'richselect', id: 'filter_invoice_pay_month', label: 'Mes',
labelAlign: 'right', labelWidth: 50, width: 175, options: months},
labelAlign: 'right', labelWidth: 50, width: 200, options: months},
{view: 'daterangepicker', id: 'filter_invoice_pay_dates', label: 'Fechas',
labelAlign: 'right', width: 275},
labelAlign: 'right', width: 300},
{view: 'button', id: 'cmd_invoice_pay_sat', label: 'SAT',
type: 'iconButton', autowidth: true, icon: 'check-circle'},
{view: 'button', id: 'cmd_invoice_pay_cancel', label: 'Cancelar',
type: 'iconButton', autowidth: true, icon: 'ban'},
{},
]
@ -628,7 +626,7 @@ var body_invoice_cancel_pay = {rows: [{minHeight: 15},
{view: 'richselect', id: 'lst_reasons_cancel', labelPosition: 'top', label: 'Razón de cancelación', options: opt_reasons_cancel_pay, value: '', width: 400},
{view: 'text', id: 'txt_cancel_uuid', labelPosition: 'top', label: 'UUID que sustituye', width: 400},
{view: 'label', label: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás seguro de continuar?', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás segura de continuar?', autowidth: true, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_invoice_cancel_pay', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
{maxWidth: 25},
@ -654,35 +652,3 @@ var win_invoice_cancel_pay = {
$$('cmd_win_cancel_pay_close').attachEvent('onItemClick', cmd_win_cancel_pay_close_click)
}
}
var body_invoice_cancel_pay2 = {rows: [{minHeight: 15},
{view: 'richselect', id: 'lst_reasons_cancel2', labelPosition: 'top', label: 'Razón de cancelación', options: opt_reasons_cancel_pay, value: '', width: 400},
{view: 'text', id: 'txt_cancel_uuid2', labelPosition: 'top', label: 'UUID que sustituye', width: 400},
{view: 'label', label: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás seguro de continuar?', autowidth: true, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_invoice_cancel_pay2', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_cancel_pay_close2', width: 100, label: 'Cerrar'},
{}
]},
{minHeight: 20},
]}
var win_invoice_cancel_pay2 = {
init: function(){
webix.ui({
view: 'window',
id: 'win_invoice_cancel_pay2',
modal: true,
width: 400,
position: 'center',
head: 'Cancelar CFDI de Pago',
body: body_invoice_cancel_pay2,
})
$$('cmd_invoice_cancel_pay2').attachEvent('onItemClick', cmd_invoice_cancel_pay2_click)
$$('cmd_win_cancel_pay_close2').attachEvent('onItemClick', cmd_win_cancel_pay_close2_click)
}
}

View File

@ -224,8 +224,6 @@ var toolbar_invoices_generate = {view: 'toolbar', elements: [{},
labelWidth: 0, width: 100, hidden: true},
{view: 'checkbox', id: 'chk_cfdi_donativo', labelRight: 'Es Donativo',
labelWidth: 0, width: 100, hidden: true},
{view: 'button', id: 'cmd_show_global_information', label: 'Global',
type: 'iconButton', autowidth: true, hidden: false, icon: 'file-code-o'},
{}]}
@ -487,11 +485,8 @@ var suggest_students = {
}
var body_comprobante = {rows: [
{view: 'datepicker', id: 'date_invoice', label: 'Fecha', format: '%d-%F-%Y',
required: true, invalidMessage: 'Selecciona una fecha', hidden: true
},
{cols: [
var body_comprobante = {rows: [{
cols: [
{
view: 'richselect',
id: 'lst_tipo_comprobante',
@ -1430,44 +1425,3 @@ var win_import_json_comercioe = {
$$('up_invoice_json').attachEvent('onAfterFileAdd', up_invoice_json_comercioe_on_after_file_add)
}
}
var body_global_information = {rows: [{minHeight: 5},
{view: 'richselect', id: 'lst_global_periodicidad', label: 'Periodicidad:', options: opt_global_periodicidad, value: '01'},
{view: 'richselect', id: 'lst_global_months', label: 'Mes:', options: opt_global_months, value: '01'},
{view: 'richselect', id: 'lst_global_year', label: 'Año:', options: []},
{view: 'label', label: '¿Guardar estos datos?', width: 300, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_save_global_information', width: 100, label: 'Si Guardar'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_global_close', width: 100, label: 'No, Cerrar'},
{}
]},
{minHeight: 10},
]}
var win_global_information = {
init: function(){
webix.ui({
view: 'window',
id: 'win_global_information',
modal: true,
width: 400,
position: 'center',
head: 'Información Global',
body: body_global_information,
})
var current_date = new Date()
var current_month = (current_date.getMonth() + 1).toString().padStart(2, '0')
$$('lst_global_months').setValue(current_month)
var current_year = current_date.getFullYear()
$$('lst_global_year').getList().parse([{id: current_year, value: current_year}])
$$('lst_global_year').setValue(current_year)
$$('cmd_save_global_information').attachEvent('onItemClick', cmd_save_global_information_click)
$$('cmd_win_global_close').attachEvent('onItemClick', cmd_win_global_close_click)
}
}

View File

@ -1,4 +1,10 @@
var opt_languages = [
{id: 'es', value: 'Español'},
{id: 'en', value: 'English'},
{id: 'zh', value: '简体中文'},
]
var msg_rfc = 'El RFC es requerido'
var msg_user = 'El usuario es requerido'
var msg_pass = 'La contraseña es requerida'
@ -11,20 +17,23 @@ var form_controls = [
{view: 'text', label: 'Contraseña', id: 'txt_contra', name: 'contra',
type: 'password', required: true, labelPosition: 'top',
invalidMessage: msg_pass},
{margin: 10, cols:[{}, {view: 'button', value: 'Iniciar Sesión',
{margin: 10, cols:[{}, {view: 'button', value: 'Iniciar Sesión', id: 'cmd_login',
click: 'validate_login', hotkey: 'enter'}, {}]}
]
var ui_login = {
rows: [
{maxHeight: 50},
{maxHeight: 25},
{cols: [{}, {}, {view: 'richselect', id: 'lst_languages', label: 'Idiomas',
width: 200, labelAlign: "right", options: opt_languages} ]},
{maxHeight: 25},
{view: 'template', id: 'title_login', template: '', maxHeight: 50,
css: 'login_header'},
{maxHeight: 50},
{cols: [{}, {type: 'space', padding: 5,
rows: [
{view: 'template', type: 'header',
{view: 'template', type: 'header', id: 'header_access',
template: '<font color="#610B0B">Acceso al sistema</font>'},
{
container: 'form_login',

View File

@ -153,6 +153,13 @@ var controls_generals = [
width: 500, labelWidth: 150, labelAlign: "right", required: true,
invalidMessage: 'Este campo es requerido', options: opt_tax_object},
{},
//~ {view: 'text', id: 'cant_by_packing', name: 'cant_by_packing',
//~ labelAlign: 'right', labelWidth: 150, inputAlign: "right",
//~ label: 'Cantidad por empaque:'},
//~ {},
//~ {view: 'text', id: 'tags_producto', name: 'tags_producto',
//~ labelAlign: 'right', label: 'Etiquetas',
//~ placeholder: 'Separadas por comas'}
]},
{cols: [
{view: "currency", type: "text", id: "valor_unitario",

View File

@ -233,13 +233,20 @@ var cells_new_ticket = [
]
var opt_periodicidad = [
{id: '01', value: '[01] Diario'},
{id: '02', value: '[02] Semanal'},
{id: '03', value: '[03] Quincenal'},
{id: '04', value: '[04] Mensual'},
//~ {id: '05', value: '[05] Bimestral'},
]
var toolbar_ticket_invoice = {view: 'toolbar', elements: [{},
{view: 'checkbox', id: 'chk_is_invoice_day', labelWidth: 0, width: 150,
labelRight: 'Es Factura Global'},
{view: 'richselect', id: 'lst_global_periodicidad_2', labelWidth: 90, width: 225,
label: 'Periodicidad:', options: opt_global_periodicidad, value: '01', disabled: true},
{view: 'richselect', id: 'lst_global_months_2', labelWidth: 50, width: 250,
label: 'Mes:', options: opt_global_months, value: '01', disabled: true},
labelRight: 'Es factura del día'},
{view: 'richselect', id: 'lst_periodicidad', labelWidth: 90, width: 250,
label: 'Periodicidad:', options: opt_periodicidad, value: '01', disabled: true},
{},
{view: 'button', id: 'cmd_close_ticket_invoice', label: 'Cerrar',
type: 'danger', autowidth: true, align: 'center'}

View File

@ -8,6 +8,7 @@
<link rel="stylesheet" href="/static/css/air.css" type="text/css">
<link rel="stylesheet" href="/static/css/sidebar_air.css" type="text/css">
<link rel="stylesheet" href="/static/css/app.css" type="text/css">
<script src="/static/js/controller/multilang.js" type="text/javascript" ></script>
<script src="/static/js/webix.js" type="text/javascript" ></script>
<script src="/static/js/es-MX.js" type="text/javascript" ></script>
<script src="/static/js/lokijs.min.js" type="text/javascript" ></script>
@ -22,6 +23,7 @@
<script type="text/javascript" charset="utf-8">
webix.debug = false;
webix.i18n.setLocale("es-MX");
var multilang = new MultiLang('/static/js/controller/languages.json');
</script>
<%block name="content"/>

View File

@ -34,12 +34,37 @@ function validate_login(){
});
};
webix.ready(function(){
webix.ui(ui_login);
function lst_languages_change(nv, ov){
multilang.setLanguage(nv)
var html_font = '<font color="#610B0B">'
var html_font_close = '</font>'
webix.ajax().get("/values/titlelogin", function(text, data, xhr){
var value = data.json();
$$("title_login").setHTML(value);
$$('lst_languages').define('label', multilang.get('languages'))
$$('lst_languages').refresh()
var html = html_font + multilang.get('welcome') + value + html_font_close
$$('title_login').setHTML(html);
html = html_font + multilang.get('access') + html_font_close
$$('header_access').setHTML(html)
$$('txt_usuario').define('label', multilang.get('user'))
$$('txt_usuario').refresh()
$$('txt_contra').define('label', multilang.get('password'))
$$('txt_contra').refresh()
$$('cmd_login').setValue(multilang.get('login'))
})
}
webix.ready(function(){
webix.ui(ui_login);
$$('lst_languages').attachEvent('onChange', lst_languages_change)
$$('lst_languages').setValue(multilang.get_default())
$$("txt_rfc").focus();
});