Interfaz para nómina

This commit is contained in:
Mauricio Baeza 2018-01-15 23:49:33 -06:00
parent 133aed9c85
commit 9c6659193c
9 changed files with 295 additions and 33 deletions

View File

@ -194,10 +194,11 @@ def config_main():
obj = None
punto_de_venta = util.get_bool(Configuracion.get_('chk_usar_punto_de_venta'))
nomina = util.get_bool(Configuracion.get_('chk_usar_nomina'))
data = {
'empresa': get_title_app(3),
'punto_de_venta': punto_de_venta
'nomina': nomina,
}
if not obj is None:
titulo = '{} - <b><font color="#610B0B">{}</font></b>'
@ -322,6 +323,7 @@ class Configuracion(BaseModel):
'chk_ticket_direct_print',
'chk_ticket_edit_cant',
'chk_ticket_total_up',
'chk_usar_nomina',
)
data = (Configuracion
.select()
@ -697,6 +699,7 @@ class Emisor(BaseModel):
obj = obj[0]
row['emisor'] = {
'emisor_rfc': obj.rfc,
'emisor_curp': obj.curp,
'emisor_nombre': obj.nombre,
'emisor_cp': obj.codigo_postal,
'emisor_cp2': obj.cp_expedicion,
@ -720,6 +723,7 @@ class Emisor(BaseModel):
'correo_timbrado': obj.correo_timbrado,
'token_timbrado': obj.token_timbrado,
'token_soporte': obj.token_soporte,
'emisor_registro_patronal': obj.registro_patronal,
'regimenes': [row.id for row in obj.regimenes]
}
else:
@ -754,6 +758,7 @@ class Emisor(BaseModel):
def _clean(self, values):
fields = util.clean(values)
fields['rfc'] = fields.pop('emisor_rfc')
fields['curp'] = fields.pop('emisor_curp', '')
fields['nombre'] = fields.pop('emisor_nombre')
fields['codigo_postal'] = fields.pop('emisor_cp')
fields['cp_expedicion'] = fields.pop('emisor_cp2', '') or fields['codigo_postal']
@ -776,6 +781,7 @@ class Emisor(BaseModel):
fields['fecha_dof'] = fields.pop('ong_fecha_dof', None)
if len(fields['rfc']) == 12:
fields['es_moral'] = True
fields['registro_patronal'] = fields.pop('emisor_registro_patronal', '')
fields['regimenes'] = SATRegimenes.get_(
util.loads(fields['regimenes']))
return fields
@ -5230,6 +5236,7 @@ class Empleados(BaseModel):
estado = ForeignKeyField(SATEstados)
codigo_postal = TextField(default='')
notas = TextField(default='')
correo = TextField(default='')
class Meta:
order_by = ('nombre_completo',)
@ -5658,7 +5665,7 @@ def _migrate_tables():
CfdiNominaRelacionados, CfdiNominaSeparacion, CfdiNominaSubcontratos,
CfdiNominaTotales,
]
log.info('Creando nuevas tablas...')
log.info('Creando tablas nuevas...')
database_proxy.create_tables(tablas, True)
log.info('Tablas creadas correctamente...')

View File

@ -74,6 +74,7 @@ var controllers = {
$$('chk_ticket_edit_cant').attachEvent('onItemClick', chk_config_item_click)
$$('chk_ticket_total_up').attachEvent('onItemClick', chk_config_item_click)
$$('txt_ticket_printer').attachEvent('onKeyPress', txt_ticket_printer_key_press)
$$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click)
$$('cmd_subir_bdfl').attachEvent('onItemClick', cmd_subir_bdfl_click)
$$('up_bdfl').attachEvent('onUploadComplete', up_bdfl_upload_complete)
@ -197,6 +198,9 @@ function get_emisor(){
if(emisor.regimenes){
$$('lst_emisor_regimen').select(emisor.regimenes)
}
if(emisor.emisor_rfc.length == 12){
show('emisor_curp', false)
}
}else{
msg_error(values.msg)
}
@ -1013,8 +1017,8 @@ function txt_plantilla_donataria_click(e){
function tab_options_change(nv, ov){
var cv = {
Plantillas: 'templates',
Otros: 'configotros',
tab_admin_templates: 'templates',
tab_admin_otros: 'configotros',
}
get_config_values(cv[nv])
}

View File

@ -9,13 +9,21 @@ function configuracion_inicial(){
webix.ajax().get('/values/main', function(text, data){
var values = data.json()
$$('lbl_title_main').setValue(values.empresa)
//~ showvar()
var pos = 4
if(values.nomina){
var node = {
id: 'app_nomina',
icon: 'users',
value: 'Nómina'}
$$('main_sidebar').add(node, pos)
pos += 1
}
if(values.punto_de_venta){
var node = {
id: 'app_tickets',
icon: 'money',
value: 'Punto de venta'}
$$('main_sidebar').add(node, 4)
$$('main_sidebar').add(node, pos)
}
})
@ -45,6 +53,7 @@ var controllers = {
products_controllers.init()
bancos_controllers.init()
invoices_controllers.init()
nomina_controllers.init()
tickets_controllers.init()
}
}
@ -145,6 +154,14 @@ function multi_change(prevID, nextID){
return
}
if(nextID == 'app_nomina'){
active = $$('multi_nomina').getActiveId()
if(active == 'nomina_home'){
default_config_nomina()
}
return
}
if(nextID == 'app_invoices'){
active = $$('multi_invoices').getActiveId()
if(active == 'invoices_home'){

View File

@ -0,0 +1,52 @@
var query = []
var cfg_nomina = new Object()
var nomina_controllers = {
init: function(){
$$('cmd_empleados').attachEvent('onItemClick', cmd_empleados_click)
$$('cmd_close_empleados').attachEvent('onItemClick', cmd_close_empleados_click)
$$('cmd_import_empleados').attachEvent('onItemClick', cmd_import_empleados_click)
webix.extend($$('grid_nomina'), webix.ProgressBar)
}
}
function default_config_nomina(){
}
function current_dates_nomina(){
var fy = $$('filter_year_nomina')
var fm = $$('filter_month_nomina')
var d = new Date()
fy.blockEvent()
fm.blockEvent()
fm.setValue(d.getMonth() + 1)
webix.ajax().sync().get('/values/filteryearsnomina', function(text, data){
var values = data.json()
fy.getList().parse(values)
fy.setValue(d.getFullYear())
})
fy.unblockEvent()
fm.unblockEvent()
}
function cmd_empleados_click(){
$$('multi_nomina').setValue('nomina_empleados')
}
function cmd_close_empleados_click(){
$$('multi_nomina').setValue('nomina_home')
}
function cmd_import_empleados_click(){
showvar('Importar')
}

View File

@ -16,6 +16,7 @@ var table_series = db.addCollection('series')
var table_usocfdi = db.addCollection('usocfdi')
var table_relaciones = db.addCollection('relaciones')
var msg = ''
var months = [
{id: -1, value: 'Todos'},

View File

@ -78,9 +78,14 @@ var sidebar_admin = {
var emisor_datos_fiscales = [
{template: 'Datos SAT', type: 'section'},
{cols: [{view: 'text', id: 'emisor_rfc', name: 'emisor_rfc', label: 'RFC: ',
width: 300, required: true, invalidMessage: 'RFC inválido',
readonly: true, attributes: {maxlength: 13}}, {}]},
{cols: [
{view: 'text', id: 'emisor_rfc', name: 'emisor_rfc', label: 'RFC: ',
width: 300, required: true, invalidMessage: 'RFC inválido',
readonly: true, attributes: {maxlength: 13}},
{view: 'text', id: 'emisor_curp', name: 'emisor_curp', label: 'CURP: ',
width: 350, labelWidth: 100, attributes: {maxlength: 18},
placeholder: 'Solo si timbran nómina'},
{}]},
{view: 'text', id: 'emisor_nombre', name: 'emisor_nombre',
label: 'Razón Social: ', required: true,
invalidMessage: 'La Razón Social es requerida'},
@ -116,16 +121,25 @@ var emisor_datos_fiscales = [
var emisor_otros_datos= [
{template: 'Generales', type: 'section'},
{view: 'search', id: 'emisor_logo', icon: 'file-image-o',
name: 'emisor_logo', label: 'Logotipo: '},
{view: 'text', id: 'emisor_nombre_comercial',
name: 'emisor_nombre_comercial', label: 'Nombre comercial: '},
{view: 'text', id: 'emisor_telefono', name: 'emisor_telefono',
label: 'Teléfonos: '},
{view: 'text', id: 'emisor_correo', name: 'emisor_correo',
label: 'Correos: '},
{view: 'text', id: 'emisor_web', name: 'emisor_web',
label: 'Página Web: '},
{cols: [
{view: 'search', id: 'emisor_logo', icon: 'file-image-o',
name: 'emisor_logo', label: 'Logotipo: '},
{view: 'text', id: 'emisor_nombre_comercial',
name: 'emisor_nombre_comercial', label: 'Nombre comercial: '},
]},
{cols: [
{view: 'text', id: 'emisor_telefono', name: 'emisor_telefono',
label: 'Teléfonos: '},
{view: 'text', id: 'emisor_correo', name: 'emisor_correo',
label: 'Correos: '},
]},
{cols: [
{view: 'text', id: 'emisor_registro_patronal', attributes: {maxlength: 20},
name: 'emisor_registro_patronal', label: 'Registro Patronal: ',
placeholder: 'Solo para timbrado de nómina'},
{view: 'text', id: 'emisor_web', name: 'emisor_web',
label: 'Página Web: '},
]},
{template: 'Escuela', type: 'section'},
{cols: [{view: 'checkbox', id: 'chk_escuela', name: 'es_escuela',
label: 'Es Escuela'},
@ -407,7 +421,6 @@ var controls_folios = [
{
view: 'tabview',
id: 'tab_folios',
//~ tabbar: {options: ['Folios']},
animate: true,
cells: [
{id: 'Folios', rows: emisor_folios},
@ -431,7 +444,6 @@ var controls_correo = [
var form_folios = {
type: 'space',
//~ responsive: true,
cols: [{
view: 'form',
id: 'form_folios',
@ -462,7 +474,6 @@ var form_correo = {
labelWidth: 150,
labelAlign: 'right'
},
//~ autoheight: true
}],
}
@ -563,23 +574,25 @@ var options_admin_otros = [
{view: 'checkbox', id: 'chk_ticket_total_up', labelWidth: 0,
labelRight: 'Mostrar total arriba'},
{}]},
{maxHeight: 20},
{template: 'Nómina', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_usar_nomina', labelWidth: 0,
labelRight: 'Usar timbrado de Nómina'},
{}]},
{}]
var body_admin_otros = {
view: 'scrollview', body: {rows: options_admin_otros},
}
var tab_options = {
view: 'tabview',
id: 'tab_options',
animate: true,
cells: [
{id: 'Plantillas', rows: options_templates},
{id: 'Otros', rows: options_admin_otros},
],
{header: 'Plantillas', body: {id: 'tab_admin_templates',
rows: options_templates}},
{header: 'Otros', body: {id: 'tab_admin_otros', view: 'scrollview',
body: {rows: options_admin_otros}}},
]
}
@ -659,7 +672,6 @@ var grid_admin_taxes = {
view: 'datatable',
id: 'grid_admin_taxes',
select: 'cell',
//~ multiselect: true,
adjust: true,
autoheight: true,
autowidth: true,

View File

@ -2,7 +2,7 @@
var menu_data = [
{id: 'app_home', icon: 'dashboard', value: 'Inicio'},
{id: 'app_partners', icon: 'users', value: 'Clientes y Proveedores'},
{id: 'app_partners', icon: 'address-book-o', value: 'Clientes y Proveedores'},
{id: 'app_products', icon: 'server', value: 'Productos y Servicios'},
{id: 'app_bancos', icon: 'university', value: 'Bancos'},
{id: 'app_invoices', icon: 'file-code-o', value: 'Facturas'},
@ -37,6 +37,7 @@ var multi_main = {
app_partners,
app_products,
app_bancos,
app_nomina,
app_tickets,
app_invoices,
],

View File

@ -0,0 +1,166 @@
var toolbar_nomina = [
{view: 'button', id: 'cmd_empleados', label: 'Empleados', type: 'iconButton',
autowidth: true, icon: 'users'},
{},
{view: 'button', id: 'cmd_nomina_report', label: 'Reporte', type: 'iconButton',
autowidth: true, icon: 'table'},
{},
{view: 'button', id: 'cmd_nomina_delete', label: 'Eliminar',
type: 'iconButton', autowidth: true, icon: 'minus'},
]
var toolbar_nomina_util = [
{view: 'button', id: 'cmd_nomina_import', label: 'Importar',
type: 'iconButton', autowidth: true, icon: 'upload'},
{view: 'button', id: 'cmd_nomina_timbrar', label: 'Timbrar',
type: 'iconButton', autowidth: true, icon: 'ticket'},
{view: 'button', id: 'cmd_nomina_sat', label: 'SAT',
type: 'iconButton', autowidth: true, icon: 'check-circle'},
{},
{view: 'button', id: 'cmd_nomina_cancel', label: 'Cancelar',
type: 'iconButton', autowidth: true, icon: 'ban'},
]
var toolbar_nomina_filter = [
{view: 'richselect', id: 'filter_year_nomina', label: 'Año',
labelAlign: 'right', labelWidth: 50, width: 150, options: []},
{view: 'richselect', id: 'filter_month_nomina', label: 'Mes',
labelAlign: 'right', labelWidth: 50, width: 200, options: months},
{view: 'daterangepicker', id: 'filter_dates_nomina', label: 'Fechas',
labelAlign: 'right', width: 300},
]
var grid_cols_nomina = [
{id: 'index', header: '#', adjust: 'data', css: 'right',
footer: {content: 'countRows', colspan: 3, css: 'right'}},
{id: "id", header:"ID", hidden:true},
{id: "serie", header: ["Serie"], adjust: "header"},
{id: 'folio', header: ['Folio', {content: 'numberFilter'}], adjust: 'header',
sort: 'int', css: 'right', footer: {text: 'Recibos', colspan: 3}},
{id: "fecha", header: ["Fecha y Hora"], adjust: "data", sort: "string"},
{id: "estatus", header: ["Estatus", {content: "selectFilter"}],
adjust: "data", sort:"string"},
{id: "fecha_pago", header: ["Fecha de Pago"], adjust: "data", sort: "string"},
{id: 'total', header: ['Total', {content: 'numberFilter'}], width: 150,
sort: 'int', format: webix.i18n.priceFormat, css: 'right',
footer: {content: 'summActive', css: 'right'}},
{id: "empleado", header: ["Empleado", {content: "selectFilter"}],
fillspace:true, sort:"string"},
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
]
var grid_nomina = {
view: 'datatable',
id: 'grid_nomina',
select: 'row',
multiselect: true,
scrollY: true,
adjust: true,
footer: true,
resizeColumn: true,
headermenu: true,
columns: grid_cols_nomina,
scheme:{
$change:function(item){
if (item.estatus == 'Cancelado'){
item.$css = 'cancel'
}
}
},
on:{
'data->onStoreUpdated':function(){
this.data.each(function(obj, i){
obj.index = i + 1
})
}
},
}
var rows_nomina_home = [
{view: 'toolbar', elements: toolbar_nomina},
{view: 'toolbar', elements: toolbar_nomina_util},
{view: 'toolbar', elements: toolbar_nomina_filter},
grid_nomina,
]
var toolbar_nomina_empleados = [
{view: 'button', id: 'cmd_new_empleado', label: 'Nuevo', type: 'iconButton',
autowidth: true, icon: 'user-plus'},
{view: 'button', id: 'cmd_edit_empleado', label: 'Editar', type: 'iconButton',
autowidth: true, icon: 'user'},
{view: 'button', id: 'cmd_delete_empleado', label: 'Eliminar', type: 'iconButton',
autowidth: true, icon: 'user-times'},
{},
{view: 'button', id: 'cmd_import_empleados', label: 'Importar',
type: 'iconButton', autowidth: true, icon: 'upload'},
{},
{view: 'button', id: 'cmd_close_empleados', label: 'Cerrar', type: 'iconButton',
autowidth: true, icon: 'times-circle-o'},
]
var grid_cols_empleados = [
{id: 'index', header: '#', adjust: 'data', css: 'right',
footer: {content: 'countRows', colspan: 3, css: 'right'}},
{id: "id", header:"ID", hidden:true},
{id: "num_empleado", header: ["No Empleado"], adjust: "header"},
{id: "rfc", header: ["RFC", {content: 'textFilter'}], adjust: "data"},
{id: "curp", header: ["CURP"], adjust: "data", hidden:true},
{id: "nombre_completo", header: ["Empleado", {content: 'textFilter'}],
adjust: "data", fillspace: true},
{id: "fecha_ingreso", header: ["Fecha de Ingreso"], adjust: "data",
sort: "string"},
]
var grid_empleados = {
view: 'datatable',
id: 'grid_empleados',
select: 'row',
scrollY: true,
adjust: true,
footer: true,
resizeColumn: true,
headermenu: true,
columns: grid_cols_empleados,
on:{
'data->onStoreUpdated':function(){
this.data.each(function(obj, i){
obj.index = i + 1
})
}
},
}
var rows_nomina_empleados = [
{view: 'toolbar', elements: toolbar_nomina_empleados},
grid_empleados,
]
var multi_nomina = {
id: 'multi_nomina',
view: 'multiview',
animate: true,
cells:[
{id: 'nomina_home', rows: rows_nomina_home},
{id: 'nomina_empleados', rows: rows_nomina_empleados},
],
}
var app_nomina = {
id: 'app_nomina',
rows:[
{view: 'template', type: 'header', template: 'Timbrado de Nómina'},
multi_nomina
],
}

View File

@ -8,6 +8,7 @@
<script src="/static/js/ui/partners.js" type="text/javascript" ></script>
<script src="/static/js/ui/products.js" type="text/javascript" ></script>
<script src="/static/js/ui/bancos.js" type="text/javascript" ></script>
<script src="/static/js/ui/nomina.js" type="text/javascript" ></script>
<script src="/static/js/ui/tickets.js" type="text/javascript" ></script>
<script src="/static/js/ui/invoices.js" type="text/javascript" ></script>
<script src="/static/js/ui/main.js" type="text/javascript" ></script>
@ -15,6 +16,7 @@
<script src="/static/js/controller/partners.js" type="text/javascript" ></script>
<script src="/static/js/controller/products.js" type="text/javascript" ></script>
<script src="/static/js/controller/bancos.js" type="text/javascript" ></script>
<script src="/static/js/controller/nomina.js" type="text/javascript" ></script>
<script src="/static/js/controller/tickets.js" type="text/javascript" ></script>
<script src="/static/js/controller/invoices.js" type="text/javascript" ></script>
<script src="/static/js/controller/main.js" type="text/javascript" ></script>