forked from elmau/empresa-libre
Compare commits
238 Commits
Author | SHA1 | Date |
---|---|---|
Mauricio | 7cad4093d4 | |
Mauricio | 7caf6423e1 | |
Mauricio | 8a3aea41eb | |
Mauricio | bd49356d3f | |
Mauricio | 3b54ef0a36 | |
Mauricio | 497a4be392 | |
Mauricio | 7fc6264322 | |
Mauricio | c5d0e97212 | |
Mauricio | 5bbad9ef58 | |
Mauricio | 8e7aa23d1b | |
Mauricio | f3d8b1dae5 | |
Mauricio | 2c684ae6bd | |
el Mau | febea3f289 | |
el Mau | 5facb96662 | |
el Mau | 6411c2e51e | |
el Mau | eeb128fda6 | |
el Mau | a078e27703 | |
el Mau | 28ef53043f | |
el Mau | e956c243f7 | |
el Mau | 1b33413de2 | |
el Mau | 64541a84b9 | |
el Mau | 834c1faae6 | |
el Mau | affe57bfcd | |
el Mau | 4dc54ade1e | |
el Mau | e72739a5fe | |
el Mau | dd7b9c1680 | |
el Mau | 9823bd967f | |
el Mau | aee467d98f | |
el Mau | 64917527f7 | |
el Mau | 5f56179ebb | |
el Mau | 955a0348f8 | |
el Mau | 0826b0cea2 | |
el Mau | 8b0f9fbc64 | |
el Mau | f3d827364b | |
el Mau | 50cbb3bae8 | |
el Mau | a7c8d80219 | |
el Mau | ca9d7a02e3 | |
el Mau | 31fcb63e51 | |
el Mau | bd7a31ea8a | |
el Mau | 6a6b6ca395 | |
el Mau | 3148c5ba82 | |
el Mau | 5f62ad7750 | |
el Mau | ff44162622 | |
el Mau | a37b3a5c23 | |
el Mau | 4fdea6173b | |
el Mau | 968c2744ec | |
el Mau | c9d85ca2e7 | |
el Mau | 93e64eafd8 | |
el Mau | 1984103ff5 | |
el Mau | e4ba06c0ff | |
el Mau | 38bb267e55 | |
el Mau | 602467c8e9 | |
el Mau | 4020237f68 | |
el Mau | 933c9820e6 | |
el Mau | 51daf0ad5e | |
el Mau | 709c524830 | |
el Mau | 434e15bb5b | |
el Mau | af5fa3c812 | |
el Mau | 8003fc42b9 | |
el Mau | 83bebde169 | |
el Mau | 5f641c632e | |
el Mau | 1c11a1b013 | |
el Mau | f13491d983 | |
el Mau | a90f218c76 | |
el Mau | 746c827492 | |
el Mau | 661eff1dc3 | |
el Mau | 2526a8f5aa | |
el Mau | 296874a9b1 | |
el Mau | 86e7f50621 | |
el Mau | 260ba62b2e | |
el Mau | 8e2446e8f5 | |
el Mau | 29e02e649d | |
el Mau | d47e059d93 | |
el Mau | 24777f691e | |
El Mau | 3a5fbc609b | |
El Mau | 5e888d2337 | |
El Mau | de856f28ab | |
El Mau | ae21403c59 | |
El Mau | b68d79d0ca | |
El Mau | 68c0203039 | |
El Mau | 51af15f311 | |
El Mau | 64ef75fbf5 | |
El Mau | bd6ba5d4d0 | |
El Mau | dd606be46b | |
El Mau | cc0eee1443 | |
El Mau | a609c0c6f5 | |
El Mau | 9daf07693a | |
El Mau | d2f879c224 | |
El Mau | ff8bc31f50 | |
El Mau | d2c361e174 | |
El Mau | 6de30c3417 | |
El Mau | 47ec5ad360 | |
Mauricio Baeza | 416bc65174 | |
Mauricio Baeza | 3dd88f14d6 | |
Mauricio Baeza | fb24346601 | |
Mauricio Baeza | a518278b55 | |
Mauricio Baeza | 565f36be3a | |
Mauricio Baeza | 1a9087b13a | |
Mauricio Baeza | 952dcba7ae | |
Mauricio Baeza | 12a24c1117 | |
Mauricio Baeza | fa01e6cf01 | |
Mauricio Baeza | b5bdcbbeb3 | |
Mauricio Baeza | b03fbebe09 | |
Mauricio Baeza | c98cdd7fff | |
Mauricio Baeza | 537cecbb0b | |
Mauricio Baeza | 5b8cd0ecb2 | |
Mauricio Baeza | 5c047ee9d5 | |
Mauricio Baeza | 431422361b | |
Mauricio Baeza | 739ac08205 | |
Mauricio Baeza | de06f706a6 | |
Mauricio Baeza | aaccece897 | |
Mauricio Baeza | f813fb4dd8 | |
Mauricio Baeza | 51b4386b24 | |
Mauricio Baeza | e678083eea | |
Mauricio Baeza | 32679fced3 | |
Mauricio Baeza | 0084197906 | |
Mauricio Baeza | 17fa99e45b | |
Mauricio Baeza | cca598310b | |
Mauricio Baeza | 21fd903943 | |
Mauricio Baeza | 1f3e51861d | |
Mauricio Baeza | 1c6f9cd5f7 | |
Mauricio Baeza | 8d815bf570 | |
Mauricio Baeza | 443b916056 | |
Mauricio Baeza | 980a7aafdb | |
Mauricio Baeza | 267a96ebbc | |
Mauricio Baeza | 763f3c21fb | |
Mauricio Baeza | 26e4ce3d13 | |
Mauricio Baeza | a202f12a17 | |
Mauricio Baeza | a17345c0fd | |
Mauricio Baeza | d509bfb8be | |
Mauricio Baeza | 71bd536cb1 | |
Mauricio Baeza | e94cda3577 | |
Mauricio Baeza | 77b35f8322 | |
Mauricio Baeza | 1c55fbd7c7 | |
Mauricio Baeza | 6f3d9cc3fa | |
Mauricio Baeza | ce0e960534 | |
Mauricio Baeza | abbb4cc608 | |
Mauricio Baeza | 692477f41a | |
Mauricio Baeza | 519a61e132 | |
Mauricio Baeza | 4bff2703a4 | |
Mauricio Baeza | 6cef8fe669 | |
Mauricio Baeza | 2cacb786b6 | |
Mauricio Baeza | 79cea5b092 | |
Mauricio Baeza | 43684b7fe9 | |
Mauricio Baeza | 3d300146f1 | |
Mauricio Baeza | dbf3a342bf | |
Mauricio Baeza | 997dfe90ba | |
Mauricio Baeza | ff0ee73a73 | |
Mauricio Baeza | 4660e1d4e0 | |
Mauricio Baeza | dc8aeaebba | |
Mauricio Baeza | 0bddc189b4 | |
Mauricio Baeza | bbaf709e0e | |
Mauricio Baeza | 2765958a23 | |
Mauricio Baeza | 2090aa743d | |
Mauricio Baeza | 63fc8e9a78 | |
Mauricio Baeza | 425f2ee079 | |
Mauricio Baeza | acd8604e92 | |
Mauricio Baeza | 71d773f999 | |
Mauricio Baeza | 2e98d69685 | |
Mauricio Baeza | 135d469f3e | |
Mauricio Baeza | 18b1880772 | |
Mauricio Baeza | 66111d9080 | |
Mauricio Baeza | 127ceceada | |
Mauricio Baeza | b6b5aa3447 | |
Mauricio Baeza | b0de7655cc | |
Mauricio Baeza | dea511d161 | |
Mauricio Baeza | 9081d54865 | |
Mauricio Baeza | f0ab9246e0 | |
Mauricio Baeza | 8de2b20dcf | |
Mauricio Baeza | 4608246b7d | |
Mauricio Baeza | 94240f2356 | |
Mauricio Baeza | 3163fef0d5 | |
Mauricio Baeza | 32ec443a19 | |
Mauricio Baeza | 64caf4f415 | |
Mauricio Baeza | 13836add29 | |
Mauricio Baeza | f3309429e6 | |
Mauricio Baeza | f9e4bced15 | |
Mauricio Baeza | c3d92ff45e | |
Mauricio Baeza | 3424f7f78a | |
Mauricio Baeza | de40cb0453 | |
Mauricio Baeza | da84fbafb6 | |
Mauricio Baeza | 32926740be | |
Mauricio Baeza | 57dce9670b | |
Mauricio Baeza | 03ac074c66 | |
Mauricio Baeza | 1f043746dd | |
Mauricio Baeza | 5b15166c7a | |
Mauricio Baeza | 0a48580f0c | |
Mauricio Baeza | 2f797af8b2 | |
Mauricio Baeza | aac5c04a3f | |
Mauricio Baeza | 348f2d4443 | |
Mauricio Baeza | 313af2cce1 | |
Mauricio Baeza | 7308ec86ae | |
Mauricio Baeza | dc68b54f08 | |
Mauricio Baeza | b90e0a26ba | |
Mauricio Baeza | 9ae0d7d924 | |
Mauricio Baeza | 07d51db625 | |
Mauricio Baeza | eedd253e6a | |
Mauricio Baeza | 73eb2f0b8c | |
Mauricio Baeza | fd334eade4 | |
Mauricio Baeza | 7bbfcd6cae | |
Mauricio Baeza | 6381975518 | |
Mauricio Baeza | edd1be81ed | |
Mauricio Baeza | e7a4d38681 | |
Mauricio Baeza | 9a0f74eb52 | |
Mauricio Baeza | cf73669e3a | |
Mauricio Baeza | 3db6775f57 | |
Mauricio Baeza | 8a03dba323 | |
Mauricio Baeza | 874bf11447 | |
Mauricio Baeza | bb3f6d3aed | |
Mauricio Baeza | 0ee99296a6 | |
Mauricio Baeza | e1424e2e70 | |
Mauricio Baeza | 5bfcc4ca07 | |
Mauricio Baeza | b2148e1789 | |
Mauricio Baeza | badf1b0f5f | |
Mauricio Baeza | 1c65205bea | |
Mauricio Baeza | 4bd7e335d8 | |
Mauricio Baeza | 09ccffdc62 | |
Mauricio Baeza | 0207b9fa78 | |
Mauricio Baeza | 785cb32773 | |
Mauricio Baeza | 77ff862400 | |
Mauricio Baeza | da730801d6 | |
Mauricio Baeza | 13d82f1df8 | |
Mauricio Baeza | dcfc80edc8 | |
Mauricio Baeza | 3376505ea1 | |
Mauricio Baeza | 21eafd9e4a | |
Mauricio Baeza | b7b96611a6 | |
Mauricio Baeza | 2141f84402 | |
Mauricio Baeza | 0e909628dc | |
Mauricio Baeza | 012331b523 | |
Mauricio Baeza | 64f5dd9170 | |
Mauricio Baeza | e1b975f0f9 | |
Mauricio Baeza | b73d0d6284 | |
Mauricio Baeza | 83dff5bc5f | |
Mauricio Baeza | ac481862d9 | |
Mauricio Baeza | 14f17a6188 | |
Mauricio Baeza | 7e91476e47 | |
Mauricio Baeza | e728d948d0 | |
Mauricio Baeza | 5a791eec7c |
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -1,3 +1,26 @@
|
||||||
|
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]
|
v 2.0.0 [08-Ene-2023]
|
||||||
----------------------
|
----------------------
|
||||||
- Liberamos para todos la versión CFDI 4.0
|
- Liberamos para todos la versión CFDI 4.0
|
||||||
|
@ -168,7 +191,7 @@ v 1.42.2 [14-Sep-2021]
|
||||||
- Los productos pueden no llevar ningún impuesto.
|
- Los productos pueden no llevar ningún impuesto.
|
||||||
|
|
||||||
|
|
||||||
v 1.42.1 [31-May-2021]
|
v 1.42.1 [01-Jun-2021]
|
||||||
----------------------
|
----------------------
|
||||||
- Error - Ticket #5
|
- Error - Ticket #5
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,4 @@
|
||||||
* Crea nueva documentación
|
* Crea nueva documentación
|
||||||
* Propon nuevas funcionalidades
|
* Propon nuevas funcionalidades
|
||||||
* Difunde Empresa Libre
|
* Difunde Empresa Libre
|
||||||
|
|
||||||
|
|
1
TODO.md
1
TODO.md
|
@ -1,2 +1,3 @@
|
||||||
[ ] Permitir más de un remolque en la Carta Porte
|
[ ] Permitir más de un remolque en la Carta Porte
|
||||||
|
[ ] Campos de captura de Comercio Exterior
|
||||||
[ ] Representación impresa de Comercio Exterior
|
[ ] Representación impresa de Comercio Exterior
|
||||||
|
|
|
@ -14,9 +14,4 @@ cryptography==3.4.8
|
||||||
xmlsec
|
xmlsec
|
||||||
segno
|
segno
|
||||||
|
|
||||||
# pyqrcode
|
|
||||||
# pypng
|
|
||||||
# python-escpos
|
# python-escpos
|
||||||
# pyusb
|
|
||||||
# pyserial
|
|
||||||
# qrcode
|
|
||||||
|
|
|
@ -387,6 +387,10 @@ class CFDI(object):
|
||||||
for field in fields:
|
for field in fields:
|
||||||
if field in datos:
|
if field in datos:
|
||||||
attributes[field] = datos[field]
|
attributes[field] = datos[field]
|
||||||
|
|
||||||
|
if not attributes:
|
||||||
|
return
|
||||||
|
|
||||||
node_name = '{}:Impuestos'.format(self._pre)
|
node_name = '{}:Impuestos'.format(self._pre)
|
||||||
impuestos = ET.SubElement(self._cfdi, node_name, attributes)
|
impuestos = ET.SubElement(self._cfdi, node_name, attributes)
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,8 @@ def get_sat_productos(key):
|
||||||
|
|
||||||
|
|
||||||
def now():
|
def now():
|
||||||
return datetime.datetime.now().replace(microsecond=0)
|
n = datetime.datetime.now().replace(microsecond=0)
|
||||||
|
return n
|
||||||
|
|
||||||
|
|
||||||
def today():
|
def today():
|
||||||
|
@ -741,7 +742,12 @@ class LIBO(object):
|
||||||
if pakings:
|
if pakings:
|
||||||
col8.append((pakings[i],))
|
col8.append((pakings[i],))
|
||||||
self._total_cantidades += float(cantidad)
|
self._total_cantidades += float(cantidad)
|
||||||
|
|
||||||
if not count:
|
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
|
return
|
||||||
|
|
||||||
style_5 = self._get_style(cell_5)
|
style_5 = self._get_style(cell_5)
|
||||||
|
@ -1125,6 +1131,7 @@ class LIBO(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _cfdipays(self, data):
|
def _cfdipays(self, data):
|
||||||
|
VERSION2 = '2.0'
|
||||||
version = data['Version']
|
version = data['Version']
|
||||||
|
|
||||||
related = data.pop('related', [])
|
related = data.pop('related', [])
|
||||||
|
@ -1158,7 +1165,8 @@ class LIBO(object):
|
||||||
cell_1 = self._set_cell('{doc.uuid}', uuid)
|
cell_1 = self._set_cell('{doc.uuid}', uuid)
|
||||||
cell_2 = self._set_cell('{doc.serie}', serie)
|
cell_2 = self._set_cell('{doc.serie}', serie)
|
||||||
cell_3 = self._set_cell('{doc.folio}', folio)
|
cell_3 = self._set_cell('{doc.folio}', folio)
|
||||||
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
|
if version != VERSION2:
|
||||||
|
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
|
||||||
cell_5 = self._set_cell('{doc.moneda}', moneda)
|
cell_5 = self._set_cell('{doc.moneda}', moneda)
|
||||||
cell_6 = self._set_cell('{doc.parcialidad}', parcialidad)
|
cell_6 = self._set_cell('{doc.parcialidad}', parcialidad)
|
||||||
cell_7 = self._set_cell('{doc.saldoanterior}', saldo_anterior, value=True)
|
cell_7 = self._set_cell('{doc.saldoanterior}', saldo_anterior, value=True)
|
||||||
|
@ -1168,7 +1176,8 @@ class LIBO(object):
|
||||||
col1.append((uuid,))
|
col1.append((uuid,))
|
||||||
col2.append((serie,))
|
col2.append((serie,))
|
||||||
col3.append((folio,))
|
col3.append((folio,))
|
||||||
col4.append((metodo_pago,))
|
if version != VERSION2:
|
||||||
|
col4.append((metodo_pago,))
|
||||||
col5.append((moneda,))
|
col5.append((moneda,))
|
||||||
col6.append((parcialidad,))
|
col6.append((parcialidad,))
|
||||||
col7.append((float(saldo_anterior),))
|
col7.append((float(saldo_anterior),))
|
||||||
|
@ -1194,8 +1203,9 @@ class LIBO(object):
|
||||||
target2 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
|
target2 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
|
||||||
col = cell_3.getCellAddress().Column
|
col = cell_3.getCellAddress().Column
|
||||||
target3 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
|
target3 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
|
||||||
col = cell_4.getCellAddress().Column
|
if version != VERSION2:
|
||||||
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
|
col = cell_5.getCellAddress().Column
|
||||||
target5 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
|
target5 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
|
||||||
col = cell_6.getCellAddress().Column
|
col = cell_6.getCellAddress().Column
|
||||||
|
@ -1210,7 +1220,8 @@ class LIBO(object):
|
||||||
target1.setFormulaArray(tuple(col1))
|
target1.setFormulaArray(tuple(col1))
|
||||||
target2.setDataArray(tuple(col2))
|
target2.setDataArray(tuple(col2))
|
||||||
target3.setFormulaArray(tuple(col3))
|
target3.setFormulaArray(tuple(col3))
|
||||||
target4.setDataArray(tuple(col4))
|
if version != VERSION2:
|
||||||
|
target4.setDataArray(tuple(col4))
|
||||||
target5.setDataArray(tuple(col5))
|
target5.setDataArray(tuple(col5))
|
||||||
target6.setDataArray(tuple(col6))
|
target6.setDataArray(tuple(col6))
|
||||||
target7.setDataArray(tuple(col7))
|
target7.setDataArray(tuple(col7))
|
||||||
|
@ -1939,11 +1950,14 @@ def _totales(doc, cfdi, version):
|
||||||
for n in list(node):
|
for n in list(node):
|
||||||
tmp = CaseInsensitiveDict(n.attrib.copy())
|
tmp = CaseInsensitiveDict(n.attrib.copy())
|
||||||
if version in CFDI_VERSIONS:
|
if version in CFDI_VERSIONS:
|
||||||
tasa = round(float(tmp['tasaocuota']), DECIMALES)
|
tasa = ''
|
||||||
|
if 'tasaocuota' in tmp:
|
||||||
|
tasa = round(float(tmp['tasaocuota']), DECIMALES)
|
||||||
title = 'Traslado {} {}'.format(tn.get(tmp['impuesto']), tasa)
|
title = 'Traslado {} {}'.format(tn.get(tmp['impuesto']), tasa)
|
||||||
else:
|
else:
|
||||||
title = 'Traslado {} {}'.format(tmp['impuesto'], tmp['tasa'])
|
title = 'Traslado {} {}'.format(tmp['impuesto'], tmp['tasa'])
|
||||||
traslados.append((title, float(tmp['importe'])))
|
if 'importe' in tmp:
|
||||||
|
traslados.append((title, float(tmp['importe'])))
|
||||||
|
|
||||||
node = imp.find('{}Retenciones'.format(PRE[version]))
|
node = imp.find('{}Retenciones'.format(PRE[version]))
|
||||||
if node is not None:
|
if node is not None:
|
||||||
|
@ -2137,15 +2151,16 @@ def _get_info_pays_2(node):
|
||||||
|
|
||||||
|
|
||||||
def _cfdipays(doc, data, version):
|
def _cfdipays(doc, data, version):
|
||||||
#todo: Obtener versión de complemento
|
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
|
||||||
if version == '4.0':
|
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
|
||||||
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
|
node = doc.find(path)
|
||||||
|
if node is None:
|
||||||
|
pre_pays = PRE['PAGOS']['1.0']
|
||||||
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
|
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
|
||||||
node = doc.find(path)
|
node = doc.find(path)
|
||||||
else:
|
|
||||||
node = doc.find('{}Complemento/{}Pagos'.format(PRE[version], PRE['pagos']))
|
|
||||||
|
|
||||||
if node is None:
|
if node is None:
|
||||||
|
log.error('Node pays not found...')
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
if version == '4.0':
|
if version == '4.0':
|
||||||
|
@ -2296,7 +2311,7 @@ def upload_file(rfc, opt, file_obj):
|
||||||
ext = tmp[-1].lower()
|
ext = tmp[-1].lower()
|
||||||
|
|
||||||
versions = ('_3.2.ods',
|
versions = ('_3.2.ods',
|
||||||
'_3.3.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', '_3.3.json',
|
'_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',
|
||||||
'_4.0.ods',
|
'_4.0.ods',
|
||||||
'_4.0_cn_1.2.ods',
|
'_4.0_cn_1.2.ods',
|
||||||
'_4.0_cp_2.0.ods',
|
'_4.0_cp_2.0.ods',
|
||||||
|
|
|
@ -1106,3 +1106,11 @@ def get_qr(data, kind='svg', in_base64=False):
|
||||||
if in_base64:
|
if in_base64:
|
||||||
qr = base64.b64encode(qr.getvalue()).decode()
|
qr = base64.b64encode(qr.getvalue()).decode()
|
||||||
return qr
|
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
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import sqlite3
|
||||||
from peewee import *
|
from peewee import *
|
||||||
from playhouse.fields import PasswordField, ManyToManyField
|
from playhouse.fields import PasswordField, ManyToManyField
|
||||||
from playhouse.shortcuts import case, SQL, cast
|
from playhouse.shortcuts import case, SQL, cast
|
||||||
|
from psycopg2.errors import UniqueViolation
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -226,6 +227,7 @@ def import_invoice():
|
||||||
return {'ok': False, 'msg': msg}
|
return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
obj = Productos.get(Productos.clave==row[0])
|
obj = Productos.get(Productos.clave==row[0])
|
||||||
|
|
||||||
if isinstance(row[2], str):
|
if isinstance(row[2], str):
|
||||||
msg = 'El Precio Unitario debe ser un número, debe ser 0.00, si no quieres cambiarlo'
|
msg = 'El Precio Unitario debe ser un número, debe ser 0.00, si no quieres cambiarlo'
|
||||||
return {'ok': False, 'msg': msg}
|
return {'ok': False, 'msg': msg}
|
||||||
|
@ -247,6 +249,7 @@ def import_invoice():
|
||||||
'id_product': obj.id,
|
'id_product': obj.id,
|
||||||
'delete': '-',
|
'delete': '-',
|
||||||
'clave': obj.clave,
|
'clave': obj.clave,
|
||||||
|
'clave_sat': obj.clave_sat,
|
||||||
'descripcion': description or obj.descripcion,
|
'descripcion': description or obj.descripcion,
|
||||||
'pedimento': pedimento,
|
'pedimento': pedimento,
|
||||||
'unidad': obj.unidad.id,
|
'unidad': obj.unidad.id,
|
||||||
|
@ -323,7 +326,7 @@ def config_main(user):
|
||||||
'timbres': 0,
|
'timbres': 0,
|
||||||
'decimales_precios': DECIMALES,
|
'decimales_precios': DECIMALES,
|
||||||
'pagos': Configuracion.get_bool('chk_config_pagos'),
|
'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')
|
dp = Configuracion.get_bool('chk_config_decimales_precios')
|
||||||
if dp:
|
if dp:
|
||||||
|
@ -365,6 +368,7 @@ def config_timbrar():
|
||||||
'cfdi_folio_custom': Configuracion.get_bool('chk_folio_custom'),
|
'cfdi_folio_custom': Configuracion.get_bool('chk_folio_custom'),
|
||||||
'cfdi_leyendasfiscales': Configuracion.get_bool('chk_config_leyendas_fiscales'),
|
'cfdi_leyendasfiscales': Configuracion.get_bool('chk_config_leyendas_fiscales'),
|
||||||
'cfdi_show_total_cant': Configuracion.get_bool('chk_config_show_total_cant'),
|
'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
|
return conf
|
||||||
|
@ -677,6 +681,7 @@ class Configuracion(BaseModel):
|
||||||
'chk_config_invoice_by_ticket',
|
'chk_config_invoice_by_ticket',
|
||||||
'chk_config_show_total_cant',
|
'chk_config_show_total_cant',
|
||||||
'chk_cancel_invoices_by_admin',
|
'chk_cancel_invoices_by_admin',
|
||||||
|
'chk_config_change_date_invoice',
|
||||||
'chk_cancel_tickets_by_admin',
|
'chk_cancel_tickets_by_admin',
|
||||||
)
|
)
|
||||||
data = (Configuracion
|
data = (Configuracion
|
||||||
|
@ -2221,7 +2226,7 @@ class CuentasBanco(BaseModel):
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
try:
|
try:
|
||||||
obj = CuentasBanco.create(**values)
|
obj = CuentasBanco.create(**values)
|
||||||
except IntegrityError:
|
except (IntegrityError, UniqueViolation):
|
||||||
msg = 'Esta cuenta ya existe'
|
msg = 'Esta cuenta ya existe'
|
||||||
return {'ok': False, 'msg': msg}
|
return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
|
@ -2963,6 +2968,16 @@ class Socios(BaseModel):
|
||||||
fields.pop('accounts', '')
|
fields.pop('accounts', '')
|
||||||
regimenes = fields.pop('regimenes', ())
|
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:
|
try:
|
||||||
q = Socios.update(**fields).where(Socios.id==id)
|
q = Socios.update(**fields).where(Socios.id==id)
|
||||||
q.execute()
|
q.execute()
|
||||||
|
@ -3381,11 +3396,25 @@ class MovimientosBanco(BaseModel):
|
||||||
msg = 'El movimiento esta conciliado, no se puede cancelar'
|
msg = 'El movimiento esta conciliado, no se puede cancelar'
|
||||||
return {'ok': False, 'msg': msg}
|
return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
# ~ filters = (CfdiPagos.movimiento==obj)
|
filters = (
|
||||||
# ~ cp = CfdiPagos.select().where(filters).count()
|
(CfdiPagos.movimiento==obj) &
|
||||||
# ~ if cp > 0:
|
(CfdiPagos.uuid.is_null(False)) &
|
||||||
# ~ msg = 'El movimiento tiene Factura de Pago, no se puede cancelar'
|
(CfdiPagos.cancelada==False)
|
||||||
# ~ return {'ok': False, 'msg': msg}
|
)
|
||||||
|
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}
|
||||||
|
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
obj.cancelado = True
|
obj.cancelado = True
|
||||||
|
@ -4335,6 +4364,14 @@ class Productos(BaseModel):
|
||||||
if count:
|
if count:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
count = (TicketsDetalle
|
||||||
|
.select(fn.COUNT(TicketsDetalle.id)).join(Productos)
|
||||||
|
.where(Productos.id==id)
|
||||||
|
.count()
|
||||||
|
)
|
||||||
|
if count:
|
||||||
|
return False
|
||||||
|
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
obj = Productos.get(Productos.id==id)
|
obj = Productos.get(Productos.id==id)
|
||||||
obj.impuestos.clear()
|
obj.impuestos.clear()
|
||||||
|
@ -5595,6 +5632,15 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
leyendas_fiscales = utils.loads(values.pop('leyendas_fiscales', '[]'))
|
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]
|
emisor = Emisor.select()[0]
|
||||||
values['serie'] = cls._get_serie(cls, user, values['serie'])
|
values['serie'] = cls._get_serie(cls, user, values['serie'])
|
||||||
if Configuracion.get_bool('chk_folio_custom') and folio_custom:
|
if Configuracion.get_bool('chk_folio_custom') and folio_custom:
|
||||||
|
@ -5676,13 +5722,14 @@ class Facturas(BaseModel):
|
||||||
decimales_precios = Configuracion.get_bool('chk_config_decimales_precios')
|
decimales_precios = Configuracion.get_bool('chk_config_decimales_precios')
|
||||||
invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
|
invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
|
||||||
is_global = bool(invoice.periodicidad)
|
is_global = bool(invoice.periodicidad)
|
||||||
|
base_iva_exento = 0.0
|
||||||
|
|
||||||
data_global = {}
|
data_global = {}
|
||||||
if is_global:
|
if is_global:
|
||||||
now = utils.now()
|
values = invoice.periodicidad.split('|')
|
||||||
data_global['Periodicidad'] = invoice.periodicidad
|
data_global['Periodicidad'] = values[0]
|
||||||
data_global['Meses'] = now.strftime('%m')
|
data_global['Meses'] = values[1]
|
||||||
data_global['Año'] = now.strftime('%Y')
|
data_global['Año'] = values[2]
|
||||||
|
|
||||||
frm_vu = FORMAT
|
frm_vu = FORMAT
|
||||||
if decimales_precios:
|
if decimales_precios:
|
||||||
|
@ -5768,6 +5815,10 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
|
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
|
object_tax = '02'
|
||||||
|
if not row.producto is None:
|
||||||
|
object_tax = row.producto.objeto_impuesto
|
||||||
|
|
||||||
if is_global:
|
if is_global:
|
||||||
key_sat = row.clave_sat
|
key_sat = row.clave_sat
|
||||||
key = row.clave
|
key = row.clave
|
||||||
|
@ -5782,6 +5833,7 @@ class Facturas(BaseModel):
|
||||||
'Descripcion': row.descripcion,
|
'Descripcion': row.descripcion,
|
||||||
'ValorUnitario': frm_vu.format(row.valor_unitario),
|
'ValorUnitario': frm_vu.format(row.valor_unitario),
|
||||||
'Importe': FORMAT.format(row.importe),
|
'Importe': FORMAT.format(row.importe),
|
||||||
|
'ObjetoImp': object_tax,
|
||||||
}
|
}
|
||||||
if not is_global:
|
if not is_global:
|
||||||
concepto['Unidad'] = SATUnidades.get(SATUnidades.key==row.unidad).name[:20]
|
concepto['Unidad'] = SATUnidades.get(SATUnidades.key==row.unidad).name[:20]
|
||||||
|
@ -5811,58 +5863,68 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
if invoice.tipo_comprobante != 'T':
|
if invoice.tipo_comprobante != 'T':
|
||||||
if is_global:
|
if is_global:
|
||||||
ticket = (Tickets
|
ticket = None
|
||||||
.get(fn.Concat(Tickets.serie, Tickets.folio)==row.clave)
|
try:
|
||||||
)
|
where = (
|
||||||
product_taxes = (TicketsImpuestos
|
(fn.Concat(Tickets.serie, Tickets.folio)==row.clave) &
|
||||||
.select()
|
(Tickets.estatus=='Facturado')
|
||||||
.where(TicketsImpuestos.ticket==ticket)
|
)
|
||||||
)
|
ticket = (Tickets
|
||||||
|
.get(where)
|
||||||
|
)
|
||||||
|
product_taxes = (TicketsImpuestos
|
||||||
|
.select()
|
||||||
|
.where(TicketsImpuestos.ticket==ticket)
|
||||||
|
)
|
||||||
|
except Tickets.DoesNotExist:
|
||||||
|
product_taxes = row.producto.impuestos
|
||||||
else:
|
else:
|
||||||
product_taxes = row.producto.impuestos
|
product_taxes = row.producto.impuestos
|
||||||
|
|
||||||
for impuesto in product_taxes:
|
if object_tax == '02':
|
||||||
base = float(row.importe - row.descuento)
|
for impuesto in product_taxes:
|
||||||
if is_global:
|
base = float(row.importe - row.descuento)
|
||||||
base = float(impuesto.base)
|
if is_global and not ticket is None:
|
||||||
impuesto = impuesto.impuesto
|
base = float(impuesto.base)
|
||||||
|
impuesto = impuesto.impuesto
|
||||||
|
|
||||||
if impuesto.tipo == 'E':
|
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'
|
||||||
tax = {
|
tax = {
|
||||||
'Base': FORMAT.format(base),
|
"Base": FORMAT.format(base),
|
||||||
'Impuesto': '002',
|
"Impuesto": impuesto.key,
|
||||||
'TipoFactor': 'Exento',
|
"TipoFactor": tipo_factor,
|
||||||
|
"TasaOCuota": str(impuesto.tasa),
|
||||||
|
"Importe": xml_importe,
|
||||||
}
|
}
|
||||||
traslados.append(tax)
|
if impuesto.tipo == 'T':
|
||||||
continue
|
traslados.append(tax)
|
||||||
|
else:
|
||||||
if impuesto.key == '000':
|
retenciones.append(tax)
|
||||||
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:
|
if traslados:
|
||||||
taxes['traslados'] = traslados
|
taxes['traslados'] = traslados
|
||||||
|
@ -5871,15 +5933,6 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
concepto['impuestos'] = taxes
|
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)
|
conceptos.append(concepto)
|
||||||
|
|
||||||
impuestos = {}
|
impuestos = {}
|
||||||
|
@ -5949,6 +6002,14 @@ class Facturas(BaseModel):
|
||||||
}
|
}
|
||||||
retenciones.append(retencion)
|
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['traslados'] = traslados
|
||||||
impuestos['retenciones'] = retenciones
|
impuestos['retenciones'] = retenciones
|
||||||
impuestos['total_locales_trasladados'] = ''
|
impuestos['total_locales_trasladados'] = ''
|
||||||
|
@ -7238,12 +7299,14 @@ class FacturasPagos(BaseModel):
|
||||||
fac = Facturas.get(Facturas.id==int(i))
|
fac = Facturas.get(Facturas.id==int(i))
|
||||||
this_pay = values['this_pay']
|
this_pay = values['this_pay']
|
||||||
importe = values['importe']
|
importe = values['importe']
|
||||||
type_change = round(1 / values['type_change'], 6)
|
|
||||||
|
|
||||||
validate = round(this_pay / type_change, 2)
|
type_change = 1.00
|
||||||
while validate > importe:
|
if mov.moneda != fac.moneda:
|
||||||
type_change += 0.000001
|
type_change = round(1 / values['type_change'], 6)
|
||||||
validate = round(this_pay / type_change, 2)
|
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)
|
mov_ant, numero = cls._movimiento_anterior(cls, mov, fac)
|
||||||
nuevo = {
|
nuevo = {
|
||||||
|
@ -7414,6 +7477,33 @@ class CfdiPagos(BaseModel):
|
||||||
|
|
||||||
return {'ok': result['ok'], 'msg': result['msg'], 'id': last.id}
|
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):
|
def _get_folio(self, serie):
|
||||||
folio = int(Configuracion.get_('txt_config_cfdipay_folio') or '0')
|
folio = int(Configuracion.get_('txt_config_cfdipay_folio') or '0')
|
||||||
start = (CfdiPagos
|
start = (CfdiPagos
|
||||||
|
@ -7556,9 +7646,16 @@ class CfdiPagos(BaseModel):
|
||||||
tipo_factor = 'Cuota'
|
tipo_factor = 'Cuota'
|
||||||
|
|
||||||
import_dr = round(tax.importe * tax_proporcion, 2)
|
import_dr = round(tax.importe * tax_proporcion, 2)
|
||||||
xml_importe = FORMAT.format(import_dr)
|
|
||||||
base_dr = round(tax.base * 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_tax_base = FORMAT.format(base_dr)
|
||||||
|
xml_importe = FORMAT.format(import_dr)
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
"BaseDR": xml_tax_base,
|
"BaseDR": xml_tax_base,
|
||||||
|
@ -7567,6 +7664,7 @@ class CfdiPagos(BaseModel):
|
||||||
"TasaOCuotaDR": str(tax.impuesto.tasa),
|
"TasaOCuotaDR": str(tax.impuesto.tasa),
|
||||||
"ImporteDR": xml_importe,
|
"ImporteDR": xml_importe,
|
||||||
}
|
}
|
||||||
|
|
||||||
tax_key = tax.impuesto.key
|
tax_key = tax.impuesto.key
|
||||||
if tax.impuesto.tipo == 'T':
|
if tax.impuesto.tipo == 'T':
|
||||||
traslados.append(values)
|
traslados.append(values)
|
||||||
|
@ -7594,9 +7692,10 @@ class CfdiPagos(BaseModel):
|
||||||
|
|
||||||
return impuestos
|
return impuestos
|
||||||
|
|
||||||
# ~ Revisar Pagos
|
|
||||||
def _get_related_xml(self, id_mov, currency):
|
def _get_related_xml(self, id_mov, currency):
|
||||||
|
#TAX ToDo
|
||||||
TAX_IVA_16 = '002|0.160000'
|
TAX_IVA_16 = '002|0.160000'
|
||||||
|
TAX_IVA_0 = '002|0.000000'
|
||||||
|
|
||||||
filters = (FacturasPagos.movimiento==id_mov)
|
filters = (FacturasPagos.movimiento==id_mov)
|
||||||
related = tuple(FacturasPagos.select(
|
related = tuple(FacturasPagos.select(
|
||||||
|
@ -7604,8 +7703,7 @@ class CfdiPagos(BaseModel):
|
||||||
Facturas.serie.alias('Serie'),
|
Facturas.serie.alias('Serie'),
|
||||||
Facturas.folio.alias('Folio'),
|
Facturas.folio.alias('Folio'),
|
||||||
Facturas.moneda.alias('MonedaDR'),
|
Facturas.moneda.alias('MonedaDR'),
|
||||||
FacturasPagos.tipo_cambio.alias('TipoCambioDR'),
|
FacturasPagos.tipo_cambio.alias('EquivalenciaDR'),
|
||||||
# ~ Facturas.metodo_pago.alias('MetodoDePagoDR'),
|
|
||||||
FacturasPagos.numero.alias('NumParcialidad'),
|
FacturasPagos.numero.alias('NumParcialidad'),
|
||||||
FacturasPagos.saldo_anterior.alias('ImpSaldoAnt'),
|
FacturasPagos.saldo_anterior.alias('ImpSaldoAnt'),
|
||||||
FacturasPagos.importe.alias('ImpPagado'),
|
FacturasPagos.importe.alias('ImpPagado'),
|
||||||
|
@ -7618,15 +7716,15 @@ class CfdiPagos(BaseModel):
|
||||||
|
|
||||||
for r in related:
|
for r in related:
|
||||||
r['taxes'] = self._get_taxes_by_pay(self, r, taxes_pay)
|
r['taxes'] = self._get_taxes_by_pay(self, r, taxes_pay)
|
||||||
# ~ print('\n\nMONEDA', currency, r['MonedaDR'])
|
|
||||||
r['IdDocumento'] = str(r['IdDocumento'])
|
r['IdDocumento'] = str(r['IdDocumento'])
|
||||||
r['Folio'] = str(r['Folio'])
|
r['Folio'] = str(r['Folio'])
|
||||||
r['NumParcialidad'] = str(r['NumParcialidad'])
|
r['NumParcialidad'] = str(r['NumParcialidad'])
|
||||||
r['TipoCambioDR'] = FORMAT6.format(r['TipoCambioDR'])
|
|
||||||
# ~ r['MetodoDePagoDR'] = DEFAULT_CFDIPAY['WAYPAY']
|
|
||||||
|
|
||||||
# REVISAR
|
equivalencia = r['EquivalenciaDR']
|
||||||
r['EquivalenciaDR'] = '1'
|
if currency == r['MonedaDR']:
|
||||||
|
r['EquivalenciaDR'] = '1'
|
||||||
|
else:
|
||||||
|
r['EquivalenciaDR'] = FORMAT6.format(equivalencia)
|
||||||
|
|
||||||
r['ObjetoImpDR'] = '01'
|
r['ObjetoImpDR'] = '01'
|
||||||
if r['taxes']['traslados'] or r['taxes']['retenciones']:
|
if r['taxes']['traslados'] or r['taxes']['retenciones']:
|
||||||
|
@ -7638,38 +7736,61 @@ class CfdiPagos(BaseModel):
|
||||||
r['ImpSaldoInsoluto'] = '0.00'
|
r['ImpSaldoInsoluto'] = '0.00'
|
||||||
else:
|
else:
|
||||||
r['ImpSaldoInsoluto'] = FORMAT.format(r['ImpSaldoInsoluto'])
|
r['ImpSaldoInsoluto'] = FORMAT.format(r['ImpSaldoInsoluto'])
|
||||||
if currency == r['MonedaDR']:
|
|
||||||
del r['TipoCambioDR']
|
|
||||||
if not r['Serie']:
|
if not r['Serie']:
|
||||||
del r['Serie']
|
del r['Serie']
|
||||||
|
|
||||||
total_tax_iva_16_base = 0
|
total_tax_iva_16_base = 0
|
||||||
|
total_tax_iva_0_base = 0
|
||||||
total_tax_iva_16_importe = 0
|
total_tax_iva_16_importe = 0
|
||||||
total_tax_retenciones_isr_importe = 0
|
total_tax_retenciones_isr_importe = 0
|
||||||
|
total_tax_retenciones_iva_importe = 0
|
||||||
|
|
||||||
for key, importe in taxes_pay['retenciones'].items():
|
for key, importe in taxes_pay['retenciones'].items():
|
||||||
taxes_pay['retenciones'][key] = FORMAT.format(importe)
|
taxes_pay['retenciones'][key] = FORMAT.format(importe)
|
||||||
total_tax_retenciones_isr_importe += importe
|
if key == '002':
|
||||||
|
total_tax_retenciones_iva_importe += importe
|
||||||
|
else:
|
||||||
|
total_tax_retenciones_isr_importe += importe
|
||||||
|
|
||||||
for k, tax in taxes_pay['traslados'].items():
|
for k, tax in taxes_pay['traslados'].items():
|
||||||
tax_type = taxes_pay['traslados'][k]['ImpuestoP']
|
tax_type = taxes_pay['traslados'][k]['ImpuestoP']
|
||||||
tax_tasa = taxes_pay['traslados'][k]['TasaOCuotaP']
|
tax_tasa = taxes_pay['traslados'][k]['TasaOCuotaP']
|
||||||
tax_base = taxes_pay['traslados'][k]['BaseP']
|
tax_base = taxes_pay['traslados'][k]['BaseP']
|
||||||
importe = taxes_pay['traslados'][k]['ImporteP']
|
importe = taxes_pay['traslados'][k]['ImporteP']
|
||||||
if f'{tax_type}|{tax_tasa}' == TAX_IVA_16:
|
|
||||||
|
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)
|
||||||
total_tax_iva_16_base += tax_base
|
total_tax_iva_16_base += tax_base
|
||||||
total_tax_iva_16_importe += importe
|
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]['BaseP'] = FORMAT.format(tax_base)
|
||||||
taxes_pay['traslados'][k]['ImporteP'] = FORMAT.format(importe)
|
taxes_pay['traslados'][k]['ImporteP'] = FORMAT.format(importe)
|
||||||
|
|
||||||
taxes_pay['totales'] = {}
|
taxes_pay['totales'] = {}
|
||||||
|
|
||||||
if taxes_pay['traslados']:
|
if taxes_pay['traslados']:
|
||||||
taxes_pay['totales']['TotalTrasladosBaseIVA16'] = FORMAT.format(total_tax_iva_16_base)
|
if total_tax_iva_16_base:
|
||||||
taxes_pay['totales']['TotalTrasladosImpuestoIVA16'] = FORMAT.format(total_tax_iva_16_importe)
|
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)
|
||||||
|
|
||||||
if taxes_pay['retenciones']:
|
if taxes_pay['retenciones']:
|
||||||
taxes_pay['totales']['TotalRetencionesISR'] = FORMAT.format(total_tax_retenciones_isr_importe)
|
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)
|
||||||
|
|
||||||
return related, taxes_pay
|
return related, taxes_pay
|
||||||
|
|
||||||
|
@ -7891,6 +8012,7 @@ class CfdiPagos(BaseModel):
|
||||||
target = emisor.rfc + '/' + str(obj.fecha)[:7].replace('-', '/')
|
target = emisor.rfc + '/' + str(obj.fecha)[:7].replace('-', '/')
|
||||||
values = cls._get_not_in_xml(cls, obj, emisor)
|
values = cls._get_not_in_xml(cls, obj, emisor)
|
||||||
data = util.get_data_from_xml(obj, values)
|
data = util.get_data_from_xml(obj, values)
|
||||||
|
data.update(utils.CfdiToDict(obj.xml).values)
|
||||||
data['informacion_global'] = {}
|
data['informacion_global'] = {}
|
||||||
|
|
||||||
obj = SATFormaPago.get(SATFormaPago.key==data['pays']['FormaDePagoP'])
|
obj = SATFormaPago.get(SATFormaPago.key==data['pays']['FormaDePagoP'])
|
||||||
|
@ -8109,6 +8231,9 @@ class Tickets(BaseModel):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
order_by = ('fecha',)
|
order_by = ('fecha',)
|
||||||
|
indexes = (
|
||||||
|
(('serie', 'folio'), True),
|
||||||
|
)
|
||||||
|
|
||||||
def _get_folio(self, serie):
|
def _get_folio(self, serie):
|
||||||
inicio = (Tickets
|
inicio = (Tickets
|
||||||
|
@ -8125,7 +8250,9 @@ class Tickets(BaseModel):
|
||||||
return inicio
|
return inicio
|
||||||
|
|
||||||
def _without_tax(self, importe, obj):
|
def _without_tax(self, importe, obj):
|
||||||
|
# ~ todo
|
||||||
# ~ Por ahora se asume que solo tiene IVA trasladado 0.16
|
# ~ Por ahora se asume que solo tiene IVA trasladado 0.16
|
||||||
|
|
||||||
for tax in obj.impuestos:
|
for tax in obj.impuestos:
|
||||||
tasa = 1.0 + float(tax.tasa)
|
tasa = 1.0 + float(tax.tasa)
|
||||||
base = round(importe / tasa, DECIMALES)
|
base = round(importe / tasa, DECIMALES)
|
||||||
|
@ -8189,9 +8316,6 @@ class Tickets(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
for tax in totals_tax.values():
|
for tax in totals_tax.values():
|
||||||
if tax.tipo == 'E':
|
|
||||||
continue
|
|
||||||
|
|
||||||
ticket_tax = {
|
ticket_tax = {
|
||||||
'ticket': ticket.id,
|
'ticket': ticket.id,
|
||||||
'impuesto': tax.id,
|
'impuesto': tax.id,
|
||||||
|
@ -8433,7 +8557,6 @@ class Tickets(BaseModel):
|
||||||
|
|
||||||
descuento_cfdi += details['descuento']
|
descuento_cfdi += details['descuento']
|
||||||
subtotal += details['importe']
|
subtotal += details['importe']
|
||||||
|
|
||||||
FacturasDetalle.create(**details)
|
FacturasDetalle.create(**details)
|
||||||
|
|
||||||
taxes = (TicketsImpuestos
|
taxes = (TicketsImpuestos
|
||||||
|
@ -8448,7 +8571,6 @@ class Tickets(BaseModel):
|
||||||
tax_id = r.impuesto.id
|
tax_id = r.impuesto.id
|
||||||
tasa = r.impuesto.tasa
|
tasa = r.impuesto.tasa
|
||||||
tax_importe = round(tasa * r.base, DECIMALES)
|
tax_importe = round(tasa * r.base, DECIMALES)
|
||||||
|
|
||||||
if tax_id in tax_sum:
|
if tax_id in tax_sum:
|
||||||
tax_sum[tax_id]['base'] += r.base
|
tax_sum[tax_id]['base'] += r.base
|
||||||
tax_sum[tax_id]['importe'] += tax_importe
|
tax_sum[tax_id]['importe'] += tax_importe
|
||||||
|
@ -8495,19 +8617,21 @@ class Tickets(BaseModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
def invoice(cls, values, user):
|
def invoice(cls, values, user):
|
||||||
is_invoice_day = util.get_bool(values['is_invoice_day'])
|
is_invoice_day = util.get_bool(values['is_invoice_day'])
|
||||||
periodicidad = values['periodicidad']
|
periodicidad = values.get('periodicidad', '')
|
||||||
id_client = int(values['client'])
|
id_client = int(values['client'])
|
||||||
tickets = util.loads(values['tickets'])
|
tickets = util.loads(values['tickets'])
|
||||||
invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
|
# ~ invoice_by_ticket = Configuracion.get_bool('chk_config_invoice_by_ticket')
|
||||||
|
invoice_by_ticket = True
|
||||||
|
|
||||||
if is_invoice_day:
|
if is_invoice_day:
|
||||||
filters = (
|
filters = (
|
||||||
Socios.rfc == RFCS['PUBLIC'] and
|
Socios.rfc == RFCS['PUBLIC'] and
|
||||||
Socios.slug == 'publico_en_general')
|
Socios.slug == 'publico_en_general'
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
client = Socios.get(filters)
|
client = Socios.get(filters)
|
||||||
except Socios.DoesNotExist:
|
except Socios.DoesNotExist:
|
||||||
msg = 'No existe el cliente Público en General. Agregalo primero.'
|
msg = 'No existe el cliente PUBLICO EN GENERAL. Agregalo primero.'
|
||||||
data = {'ok': False, 'msg': msg}
|
data = {'ok': False, 'msg': msg}
|
||||||
return data
|
return data
|
||||||
else:
|
else:
|
||||||
|
@ -10803,7 +10927,8 @@ def get_title_app(by=1):
|
||||||
2: '<font color="#610B0B">Bienvenido a {}</font>',
|
2: '<font color="#610B0B">Bienvenido a {}</font>',
|
||||||
3: '<font color="#000000">{}</font>',
|
3: '<font color="#000000">{}</font>',
|
||||||
}
|
}
|
||||||
return html[by].format(TITLE_APP)
|
# ~ return html[by].format(TITLE_APP)
|
||||||
|
return html[by].format(f'Empresa Libre v{VERSION_EMPRESA_LIBRE}')
|
||||||
|
|
||||||
|
|
||||||
def test_correo(values):
|
def test_correo(values):
|
||||||
|
@ -11146,6 +11271,8 @@ def _migrate_tables(rfc=''):
|
||||||
regimen_fiscal = TextField(default='')
|
regimen_fiscal = TextField(default='')
|
||||||
migrations.append(migrator.add_column(table, field, regimen_fiscal))
|
migrations.append(migrator.add_column(table, field, regimen_fiscal))
|
||||||
|
|
||||||
|
# migrations.append(migrator.add_index('tickets', ('serie', 'folio'), True))
|
||||||
|
|
||||||
if migrations:
|
if migrations:
|
||||||
with database_proxy.atomic() as txn:
|
with database_proxy.atomic() as txn:
|
||||||
migrate(*migrations)
|
migrate(*migrations)
|
||||||
|
@ -11172,6 +11299,10 @@ def _migrate_tables(rfc=''):
|
||||||
else:
|
else:
|
||||||
log.info('Valores actualizados...')
|
log.info('Valores actualizados...')
|
||||||
|
|
||||||
|
q = Configuracion.delete().where(Configuracion.clave=='chk_config_tax_decimals')
|
||||||
|
q.execute()
|
||||||
|
log.info('Config Tax Update...')
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
DEBUG = DEBUG
|
DEBUG = DEBUG
|
||||||
VERSION = '2.0.0'
|
VERSION = '2.0.4'
|
||||||
|
|
||||||
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
|
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
|
||||||
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 754 B After Width: | Height: | Size: 380 B |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
|
@ -135,6 +135,7 @@ var controllers = {
|
||||||
$$('chk_config_invoice_by_ticket').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_invoice_by_ticket').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_config_show_total_cant').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_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)
|
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ var bancos_controllers = {
|
||||||
$$('grid_bank_invoice_pay').attachEvent('onItemClick', grid_bank_invoice_pay_click)
|
$$('grid_bank_invoice_pay').attachEvent('onItemClick', grid_bank_invoice_pay_click)
|
||||||
$$('grid_cuentabanco').attachEvent('onItemDblClick', grid_cuentabanco_double_click)
|
$$('grid_cuentabanco').attachEvent('onItemDblClick', grid_cuentabanco_double_click)
|
||||||
$$('cmd_invoice_pay_sat').attachEvent('onItemClick', cmd_invoice_pay_sat_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()
|
init_config_bank()
|
||||||
}
|
}
|
||||||
|
@ -578,13 +579,13 @@ function validate_deposito(values){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if(grid.count() && current_currency!=CURRENCY_MN){
|
//~ if(grid.count() && current_currency!=CURRENCY_MN){
|
||||||
if(type_change <= 1.0){
|
//~ if(type_change <= 1.0){
|
||||||
msg = 'El Tipo de Cambio debe ser mayor a 1.00'
|
//~ msg = 'El Tipo de Cambio debe ser mayor a 1.00'
|
||||||
msg_error(msg)
|
//~ msg_error(msg)
|
||||||
return false
|
//~ return false
|
||||||
}
|
//~ }
|
||||||
}
|
//~ }
|
||||||
|
|
||||||
var today = new Date()
|
var today = new Date()
|
||||||
if(values.deposito_fecha > today){
|
if(values.deposito_fecha > today){
|
||||||
|
@ -1426,3 +1427,83 @@ 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'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ var anticipo = false
|
||||||
var donativo = false
|
var donativo = false
|
||||||
var cfg_invoice = new Object()
|
var cfg_invoice = new Object()
|
||||||
var values_comercioe = null
|
var values_comercioe = null
|
||||||
|
var values_global = ''
|
||||||
|
|
||||||
|
|
||||||
function init_config_invoices(){
|
function init_config_invoices(){
|
||||||
|
@ -33,6 +34,7 @@ function init_config_invoices(){
|
||||||
g.showColumn('total')
|
g.showColumn('total')
|
||||||
g.showColumn('currency')
|
g.showColumn('currency')
|
||||||
}
|
}
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +98,7 @@ var invoices_controllers = {
|
||||||
$$('cmd_carta_copy_from_invoice').attachEvent('onItemClick', cmd_carta_copy_from_invoice_click)
|
$$('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_carta_import_json').attachEvent('onItemClick', cmd_carta_import_json_click)
|
||||||
$$('cmd_import_json_comercioe').attachEvent('onItemClick', cmd_import_json_comercioe_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)
|
webix.extend($$('grid_invoices'), webix.ProgressBar)
|
||||||
|
|
||||||
|
@ -254,7 +257,10 @@ function default_config(){
|
||||||
show('fs_divisas', values.cfdi_divisas)
|
show('fs_divisas', values.cfdi_divisas)
|
||||||
show('txt_folio_custom', values.cfdi_folio_custom)
|
show('txt_folio_custom', values.cfdi_folio_custom)
|
||||||
show('txt_total_cant', values.cfdi_show_total_cant)
|
show('txt_total_cant', values.cfdi_show_total_cant)
|
||||||
|
show('date_invoice', values.cfdi_change_date_invoice)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
values_global = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,6 +302,9 @@ function cmd_new_invoice_click(){
|
||||||
lst.setValue('')
|
lst.setValue('')
|
||||||
lst.getList().clearAll()
|
lst.getList().clearAll()
|
||||||
|
|
||||||
|
$$('date_invoice').setValue(new Date())
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
|
|
||||||
form.focus('search_client_name')
|
form.focus('search_client_name')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +369,21 @@ function cmd_delete_invoice_click(id, e, node){
|
||||||
|
|
||||||
function validate_invoice(values){
|
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()
|
var usar_cartaporte = $$('chk_cfdi_usar_cartaporte').getValue()
|
||||||
if(usar_cartaporte){
|
if(usar_cartaporte){
|
||||||
value = $$('lst_carta_UnidadPeso').getValue()
|
value = $$('lst_carta_UnidadPeso').getValue()
|
||||||
|
@ -509,8 +533,28 @@ 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()
|
var rows = grid.data.getRange()
|
||||||
for (i = 0; i < rows.length; i++) {
|
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']
|
var importe = rows[i]['importe']
|
||||||
if(!importe){
|
if(!importe){
|
||||||
var msg = 'No es posible facturar importes en cero, revisa la línea: ' + (i + 1)
|
var msg = 'No es posible facturar importes en cero, revisa la línea: ' + (i + 1)
|
||||||
|
@ -687,6 +731,7 @@ function guardar_y_timbrar(values){
|
||||||
data['id'] = values.id
|
data['id'] = values.id
|
||||||
data['cliente'] = values.id_partner
|
data['cliente'] = values.id_partner
|
||||||
data['productos'] = rows
|
data['productos'] = rows
|
||||||
|
data['date'] = $$('date_invoice').getValue()
|
||||||
data['serie'] = $$('lst_serie').getText()
|
data['serie'] = $$('lst_serie').getText()
|
||||||
data['forma_pago'] = $$('lst_forma_pago').getValue()
|
data['forma_pago'] = $$('lst_forma_pago').getValue()
|
||||||
data['condiciones_pago'] = $$('txt_condicion_pago').getValue().trim()
|
data['condiciones_pago'] = $$('txt_condicion_pago').getValue().trim()
|
||||||
|
@ -705,6 +750,8 @@ function guardar_y_timbrar(values){
|
||||||
data['folio_custom'] = $$('txt_folio_custom').getValue()
|
data['folio_custom'] = $$('txt_folio_custom').getValue()
|
||||||
data['divisas'] = $$('opt_divisas').getValue()
|
data['divisas'] = $$('opt_divisas').getValue()
|
||||||
data['leyendas_fiscales'] = $$('grid_leyendas_fiscales').getSelectedId(true, true)
|
data['leyendas_fiscales'] = $$('grid_leyendas_fiscales').getSelectedId(true, true)
|
||||||
|
data['periodicidad'] = values_global
|
||||||
|
|
||||||
$$('grid_leyendas_fiscales').unselectAll()
|
$$('grid_leyendas_fiscales').unselectAll()
|
||||||
|
|
||||||
var usar_ine = $$('chk_cfdi_usar_ine').getValue()
|
var usar_ine = $$('chk_cfdi_usar_ine').getValue()
|
||||||
|
@ -798,6 +845,7 @@ function guardar_y_timbrar(values){
|
||||||
}
|
}
|
||||||
|
|
||||||
values_comercioe = null
|
values_comercioe = null
|
||||||
|
values_global = ''
|
||||||
$$('chk_cfdi_usar_comercioe').setValue(false)
|
$$('chk_cfdi_usar_comercioe').setValue(false)
|
||||||
|
|
||||||
table_relaciones.clear()
|
table_relaciones.clear()
|
||||||
|
@ -806,6 +854,7 @@ function guardar_y_timbrar(values){
|
||||||
$$('chk_cfdi_anticipo').setValue(0)
|
$$('chk_cfdi_anticipo').setValue(0)
|
||||||
$$('chk_cfdi_donativo').setValue(0)
|
$$('chk_cfdi_donativo').setValue(0)
|
||||||
$$('chk_cfdi_usar_ine').setValue(0)
|
$$('chk_cfdi_usar_ine').setValue(0)
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
|
|
||||||
$$('form_invoice').setValues({id_partner: 0, lbl_partner: 'Ninguno', notas:''})
|
$$('form_invoice').setValues({id_partner: 0, lbl_partner: 'Ninguno', notas:''})
|
||||||
$$('multi_invoices').setValue('invoices_home')
|
$$('multi_invoices').setValue('invoices_home')
|
||||||
|
@ -822,6 +871,7 @@ function cmd_timbrar_click(id, e, node){
|
||||||
}
|
}
|
||||||
|
|
||||||
var values = form.getValues()
|
var values = form.getValues()
|
||||||
|
|
||||||
if(!validate_invoice(values)){
|
if(!validate_invoice(values)){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -873,6 +923,10 @@ 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>'
|
msg += '¿Estás seguro de timbrar esta factura?<BR><BR>'
|
||||||
|
|
||||||
webix.confirm({
|
webix.confirm({
|
||||||
|
@ -945,6 +999,12 @@ function set_client(row){
|
||||||
}
|
}
|
||||||
lst.setValue(lst.getPopup().getList().getFirstId())
|
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')
|
form.focus('search_product_id')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2903,3 +2963,20 @@ function up_invoice_json_comercioe_on_after_file_add(obj){
|
||||||
}
|
}
|
||||||
$$('win_import_json_comercioe').close()
|
$$('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()
|
||||||
|
}
|
||||||
|
|
|
@ -232,18 +232,9 @@ function cmd_save_product_click(id, e, node){
|
||||||
}
|
}
|
||||||
|
|
||||||
var rows = $$('grid_product_taxes').getSelectedId(true, true)
|
var rows = $$('grid_product_taxes').getSelectedId(true, true)
|
||||||
//~ if (rows.length == 0){
|
|
||||||
//~ msg_error('Selecciona un impuesto')
|
|
||||||
//~ return
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
var values = form.getValues();
|
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)){
|
if(!validate_sat_key_product(values.clave_sat, false)){
|
||||||
msg_error('La clave SAT no existe')
|
msg_error('La clave SAT no existe')
|
||||||
return
|
return
|
||||||
|
@ -254,7 +245,19 @@ function cmd_save_product_click(id, e, node){
|
||||||
return
|
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)
|
values['taxes'] = JSON.stringify(rows)
|
||||||
|
|
||||||
webix.ajax().sync().post('products', values, {
|
webix.ajax().sync().post('products', values, {
|
||||||
error:function(text, data, XmlHttpRequest){
|
error:function(text, data, XmlHttpRequest){
|
||||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||||
|
|
|
@ -149,7 +149,9 @@ function configuracion_inicial_ticket_to_invoice(){
|
||||||
var grid = $$('grid_tickets_active')
|
var grid = $$('grid_tickets_active')
|
||||||
var gridt = $$('grid_tickets_invoice')
|
var gridt = $$('grid_tickets_invoice')
|
||||||
var form = $$('form_ticket_invoice')
|
var form = $$('form_ticket_invoice')
|
||||||
|
var chk = $$('chk_is_invoice_day')
|
||||||
|
|
||||||
|
chk.setValue(false)
|
||||||
get_active_tickets(grid)
|
get_active_tickets(grid)
|
||||||
form.setValues({id_partner: 0, lbl_tclient: 'Ninguno'})
|
form.setValues({id_partner: 0, lbl_tclient: 'Ninguno'})
|
||||||
gridt.attachEvent('onAfterAdd', function(id, index){
|
gridt.attachEvent('onAfterAdd', function(id, index){
|
||||||
|
@ -613,7 +615,12 @@ function chk_is_invoice_day_change(new_value, old_value){
|
||||||
var value = Boolean(new_value)
|
var value = Boolean(new_value)
|
||||||
|
|
||||||
show('fs_ticket_search_client', !value)
|
show('fs_ticket_search_client', !value)
|
||||||
enable('lst_periodicidad', 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -645,6 +652,7 @@ function save_ticket_to_invoice(data){
|
||||||
if(values.ok){
|
if(values.ok){
|
||||||
msg_ok(values.msg)
|
msg_ok(values.msg)
|
||||||
send_timbrar_invoice(values.id)
|
send_timbrar_invoice(values.id)
|
||||||
|
$$('chk_is_invoice_day').setValue(false)
|
||||||
$$('multi_tickets').setValue('tickets_home')
|
$$('multi_tickets').setValue('tickets_home')
|
||||||
}else{
|
}else{
|
||||||
msg_error(values.msg)
|
msg_error(values.msg)
|
||||||
|
@ -681,13 +689,26 @@ function cmd_new_invoice_from_ticket_click(){
|
||||||
})
|
})
|
||||||
|
|
||||||
var data = new Object()
|
var data = new Object()
|
||||||
|
data['opt'] = 'invoice'
|
||||||
|
|
||||||
data['client'] = values.id_partner
|
data['client'] = values.id_partner
|
||||||
data['tickets'] = tickets
|
data['tickets'] = tickets
|
||||||
data['is_invoice_day'] = chk.getValue()
|
data['is_invoice_day'] = chk.getValue()
|
||||||
data['periodicidad'] = $$('lst_periodicidad').getValue()
|
|
||||||
data['opt'] = 'invoice'
|
|
||||||
|
|
||||||
msg = 'Todos los datos son correctos.<BR><BR>¿Estás seguro de generar esta factura?'
|
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?'
|
||||||
|
|
||||||
webix.confirm({
|
webix.confirm({
|
||||||
title: 'Generar Factura',
|
title: 'Generar Factura',
|
||||||
ok: 'Si',
|
ok: 'Si',
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
//~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
var PUBLICO = "Público en general";
|
var PUBLICO = "PUBLICO EN GENERAL";
|
||||||
var RFC_PUBLICO = "XAXX010101000";
|
var RFC_PUBLICO = "XAXX010101000";
|
||||||
var RFC_EXTRANJERO = "XEXX010101000";
|
var RFC_EXTRANJERO = "XEXX010101000";
|
||||||
var PAIS = "México";
|
var PAIS = "México";
|
||||||
|
@ -24,6 +24,7 @@ var DECIMALES = 2;
|
||||||
var DECIMALES_TAX = 4;
|
var DECIMALES_TAX = 4;
|
||||||
var CLAVE_ANTICIPOS = '84111506';
|
var CLAVE_ANTICIPOS = '84111506';
|
||||||
var CURRENCY_MN = 'MXN';
|
var CURRENCY_MN = 'MXN';
|
||||||
|
var KEY_SAT_01 = '01010101';
|
||||||
|
|
||||||
|
|
||||||
var db = new loki('data.db');
|
var db = new loki('data.db');
|
||||||
|
@ -627,3 +628,33 @@ function grid_parse(grid_name, values){
|
||||||
function activate_tab(parent, name){
|
function activate_tab(parent, name){
|
||||||
$$(parent).getTabbar().setValue(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'},
|
||||||
|
]
|
||||||
|
|
|
@ -668,7 +668,7 @@ var options_admin_otros = [
|
||||||
{view: 'checkbox', id: 'chk_config_tax_locales', labelWidth: 0,
|
{view: 'checkbox', id: 'chk_config_tax_locales', labelWidth: 0,
|
||||||
labelRight: 'Impuestos locales, calcular antes del descuento'},
|
labelRight: 'Impuestos locales, calcular antes del descuento'},
|
||||||
{view: 'checkbox', id: 'chk_config_tax_decimals', labelWidth: 0,
|
{view: 'checkbox', id: 'chk_config_tax_decimals', labelWidth: 0,
|
||||||
labelRight: 'Calcular impuestos con 4 decimales'},
|
labelRight: 'Calcular impuestos con 4 decimales', hidden: true},
|
||||||
{view: 'checkbox', id: 'chk_config_price_with_taxes_in_invoice', labelWidth: 0,
|
{view: 'checkbox', id: 'chk_config_price_with_taxes_in_invoice', labelWidth: 0,
|
||||||
labelRight: 'Precio incluye impuestos'},
|
labelRight: 'Precio incluye impuestos'},
|
||||||
{view: 'checkbox', id: 'chk_config_add_same_product', labelWidth: 0,
|
{view: 'checkbox', id: 'chk_config_add_same_product', labelWidth: 0,
|
||||||
|
@ -694,6 +694,11 @@ var options_admin_otros = [
|
||||||
labelRight: 'Solo admins pueden cancelar'},
|
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},
|
{maxHeight: 15},
|
||||||
|
|
||||||
{template: 'Timbrado', type: 'section'},
|
{template: 'Timbrado', type: 'section'},
|
||||||
|
|
|
@ -367,11 +367,13 @@ var toolbar_bank_invoice_pay_filter = [
|
||||||
{view: 'richselect', id: 'filter_invoice_pay_year', label: 'Año',
|
{view: 'richselect', id: 'filter_invoice_pay_year', label: 'Año',
|
||||||
labelAlign: 'right', labelWidth: 50, width: 150, options: []},
|
labelAlign: 'right', labelWidth: 50, width: 150, options: []},
|
||||||
{view: 'richselect', id: 'filter_invoice_pay_month', label: 'Mes',
|
{view: 'richselect', id: 'filter_invoice_pay_month', label: 'Mes',
|
||||||
labelAlign: 'right', labelWidth: 50, width: 200, options: months},
|
labelAlign: 'right', labelWidth: 50, width: 175, options: months},
|
||||||
{view: 'daterangepicker', id: 'filter_invoice_pay_dates', label: 'Fechas',
|
{view: 'daterangepicker', id: 'filter_invoice_pay_dates', label: 'Fechas',
|
||||||
labelAlign: 'right', width: 300},
|
labelAlign: 'right', width: 275},
|
||||||
{view: 'button', id: 'cmd_invoice_pay_sat', label: 'SAT',
|
{view: 'button', id: 'cmd_invoice_pay_sat', label: 'SAT',
|
||||||
type: 'iconButton', autowidth: true, icon: 'check-circle'},
|
type: 'iconButton', autowidth: true, icon: 'check-circle'},
|
||||||
|
{view: 'button', id: 'cmd_invoice_pay_cancel', label: 'Cancelar',
|
||||||
|
type: 'iconButton', autowidth: true, icon: 'ban'},
|
||||||
{},
|
{},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -626,7 +628,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: '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: '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: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
|
||||||
{view: 'label', label: '¿Estás segura de continuar?', autowidth: true, align: 'center'},
|
{view: 'label', label: '¿Estás seguro de continuar?', autowidth: true, align: 'center'},
|
||||||
{cols: [{},
|
{cols: [{},
|
||||||
{view: 'button', id: 'cmd_invoice_cancel_pay', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
|
{view: 'button', id: 'cmd_invoice_cancel_pay', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
|
||||||
{maxWidth: 25},
|
{maxWidth: 25},
|
||||||
|
@ -652,3 +654,35 @@ var win_invoice_cancel_pay = {
|
||||||
$$('cmd_win_cancel_pay_close').attachEvent('onItemClick', cmd_win_cancel_pay_close_click)
|
$$('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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -224,6 +224,8 @@ var toolbar_invoices_generate = {view: 'toolbar', elements: [{},
|
||||||
labelWidth: 0, width: 100, hidden: true},
|
labelWidth: 0, width: 100, hidden: true},
|
||||||
{view: 'checkbox', id: 'chk_cfdi_donativo', labelRight: 'Es Donativo',
|
{view: 'checkbox', id: 'chk_cfdi_donativo', labelRight: 'Es Donativo',
|
||||||
labelWidth: 0, width: 100, hidden: true},
|
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'},
|
||||||
{}]}
|
{}]}
|
||||||
|
|
||||||
|
|
||||||
|
@ -485,8 +487,11 @@ var suggest_students = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var body_comprobante = {rows: [{
|
var body_comprobante = {rows: [
|
||||||
cols: [
|
{view: 'datepicker', id: 'date_invoice', label: 'Fecha', format: '%d-%F-%Y',
|
||||||
|
required: true, invalidMessage: 'Selecciona una fecha', hidden: true
|
||||||
|
},
|
||||||
|
{cols: [
|
||||||
{
|
{
|
||||||
view: 'richselect',
|
view: 'richselect',
|
||||||
id: 'lst_tipo_comprobante',
|
id: 'lst_tipo_comprobante',
|
||||||
|
@ -1425,3 +1430,44 @@ var win_import_json_comercioe = {
|
||||||
$$('up_invoice_json').attachEvent('onAfterFileAdd', up_invoice_json_comercioe_on_after_file_add)
|
$$('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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -153,13 +153,6 @@ var controls_generals = [
|
||||||
width: 500, labelWidth: 150, labelAlign: "right", required: true,
|
width: 500, labelWidth: 150, labelAlign: "right", required: true,
|
||||||
invalidMessage: 'Este campo es requerido', options: opt_tax_object},
|
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: [
|
{cols: [
|
||||||
{view: "currency", type: "text", id: "valor_unitario",
|
{view: "currency", type: "text", id: "valor_unitario",
|
||||||
|
|
|
@ -233,20 +233,13 @@ 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: [{},
|
var toolbar_ticket_invoice = {view: 'toolbar', elements: [{},
|
||||||
{view: 'checkbox', id: 'chk_is_invoice_day', labelWidth: 0, width: 150,
|
{view: 'checkbox', id: 'chk_is_invoice_day', labelWidth: 0, width: 150,
|
||||||
labelRight: 'Es factura del día'},
|
labelRight: 'Es Factura Global'},
|
||||||
{view: 'richselect', id: 'lst_periodicidad', labelWidth: 90, width: 250,
|
{view: 'richselect', id: 'lst_global_periodicidad_2', labelWidth: 90, width: 225,
|
||||||
label: 'Periodicidad:', options: opt_periodicidad, value: '01', disabled: true},
|
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},
|
||||||
{},
|
{},
|
||||||
{view: 'button', id: 'cmd_close_ticket_invoice', label: 'Cerrar',
|
{view: 'button', id: 'cmd_close_ticket_invoice', label: 'Cerrar',
|
||||||
type: 'danger', autowidth: true, align: 'center'}
|
type: 'danger', autowidth: true, align: 'center'}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue