forked from elmau/empresa-libre
Plantilla Nómina #173
This commit is contained in:
parent
d3419b5878
commit
d622975a89
|
@ -737,7 +737,7 @@ class LIBO(object):
|
|||
|
||||
def _comprobante(self, data):
|
||||
for k, v in data.items():
|
||||
if k in ('total', 'descuento', 'subtotal'):
|
||||
if k.lower() in ('total', 'descuento', 'subtotal', 'totalgravado', 'totalexento'):
|
||||
self._set_cell('{cfdi.%s}' % k, v, value=True)
|
||||
else:
|
||||
self._set_cell('{cfdi.%s}' % k, v)
|
||||
|
@ -750,7 +750,10 @@ class LIBO(object):
|
|||
|
||||
def _receptor(self, data):
|
||||
for k, v in data.items():
|
||||
self._set_cell('{receptor.%s}' % k, v)
|
||||
if k.lower() in ('salariobasecotapor', 'salariodiariointegrado'):
|
||||
self._set_cell('{receptor.%s}' % k, v, value=True)
|
||||
else:
|
||||
self._set_cell('{receptor.%s}' % k, v)
|
||||
return
|
||||
|
||||
def _copy_row(self, cell):
|
||||
|
@ -788,6 +791,7 @@ class LIBO(object):
|
|||
col4 = []
|
||||
col5 = []
|
||||
col6 = []
|
||||
col7 = []
|
||||
count = len(data)-1
|
||||
for concepto in data:
|
||||
key = concepto.get('noidentificacion', '')
|
||||
|
@ -796,6 +800,7 @@ class LIBO(object):
|
|||
cantidad = concepto['cantidad']
|
||||
valor_unitario = concepto['valorunitario']
|
||||
importe = concepto['importe']
|
||||
descuento = concepto.get('descuento', 0.0)
|
||||
if first:
|
||||
first = False
|
||||
cell_1 = self._set_cell('{noidentificacion}', key)
|
||||
|
@ -804,6 +809,7 @@ class LIBO(object):
|
|||
cell_4 = self._set_cell('{cantidad}', cantidad, value=True)
|
||||
cell_5 = self._set_cell('{valorunitario}', valor_unitario, value=True)
|
||||
cell_6 = self._set_cell('{importe}', importe, value=True)
|
||||
cell_7 = self._set_cell('{descuento}', descuento, value=True)
|
||||
if len(data) > 1:
|
||||
row = cell_1.getCellAddress().Row + 1
|
||||
self._sheet.getRows().insertByIndex(row, count)
|
||||
|
@ -816,6 +822,7 @@ class LIBO(object):
|
|||
col4.append((float(cantidad),))
|
||||
col5.append((float(valor_unitario),))
|
||||
col6.append((float(importe),))
|
||||
col7.append((float(descuento),))
|
||||
|
||||
if not count:
|
||||
return
|
||||
|
@ -955,7 +962,11 @@ class LIBO(object):
|
|||
otrospagos = data.pop('otrospagos', [])
|
||||
|
||||
for k, v in data.items():
|
||||
self._set_cell('{nomina.%s}' % k, v)
|
||||
if k.lower() in ('totalpercepciones', 'totaldeducciones',
|
||||
'totalotrospagos', 'subsidiocausado'):
|
||||
self._set_cell('{nomina.%s}' % k, v, value=True)
|
||||
else:
|
||||
self._set_cell('{nomina.%s}' % k, v)
|
||||
|
||||
count = len(percepciones)
|
||||
if len(deducciones) > count:
|
||||
|
@ -1389,6 +1400,8 @@ def _comprobante(doc, options):
|
|||
|
||||
is_nomina = options.get('is_nomina', False)
|
||||
if is_nomina:
|
||||
data['formadepago'] = options['formadepago']
|
||||
data['periodicidaddepago'] = options['periodicidaddepago']
|
||||
return data
|
||||
|
||||
if data['version'] == '3.3':
|
||||
|
@ -1402,6 +1415,7 @@ def _comprobante(doc, options):
|
|||
'C.P. de Expedición: {}'.format(data['lugarexpedicion'])
|
||||
data['metododepago'] = options['metododepago']
|
||||
data['formadepago'] = options['formadepago']
|
||||
|
||||
if 'condicionesdepago' in data:
|
||||
data['condicionesdepago'] = \
|
||||
'Condiciones de pago: {}'.format(data['condicionesdepago'])
|
||||
|
|
|
@ -6420,7 +6420,15 @@ class CfdiNomina(BaseModel):
|
|||
if invoice.version == '3.2':
|
||||
return values
|
||||
|
||||
values['regimenfiscal'] = invoice.regimen_fiscal
|
||||
obj = SATRegimenes.get(SATRegimenes.key==invoice.regimen_fiscal)
|
||||
values['regimenfiscal'] = str(obj)
|
||||
|
||||
obj = SATFormaPago.get(SATFormaPago.key==invoice.forma_pago)
|
||||
values['formadepago'] = '{} ({})'.format(obj.name, obj.key)
|
||||
|
||||
obj = SATPeriodicidadPago.get(SATPeriodicidadPago.id==invoice.empleado.periodicidad_pago)
|
||||
values['periodicidaddepago'] = '{} ({})'.format(obj.name, obj.key)
|
||||
|
||||
values['usocfdi'] = invoice.uso_cfdi
|
||||
values['receptor'] = {}
|
||||
values['fechadof'] = None
|
||||
|
|
Loading…
Reference in New Issue