Admin regimenes
This commit is contained in:
commit
296874a9b1
|
@ -200,6 +200,10 @@ class StorageEngine(object):
|
|||
def _get_allusoscfdi(self, values):
|
||||
return main.SATUsoCfdi.get_all()
|
||||
|
||||
def _get_allregimenes(self, values):
|
||||
filters = {'opt': 'all'}
|
||||
return main.SATRegimenes.get_data(filters, None)
|
||||
|
||||
def _get_allusuarios(self, values, session):
|
||||
return main.Usuarios.get_(session['userobj'])
|
||||
|
||||
|
@ -227,6 +231,9 @@ class StorageEngine(object):
|
|||
def _get_usocfdiupdate(self, values):
|
||||
return main.SATUsoCfdi.actualizar(values)
|
||||
|
||||
def _get_regimenesupdate(self, values):
|
||||
return main.SATRegimenes.actualizar(values)
|
||||
|
||||
def _get_emisorcuentasbanco(self, values):
|
||||
return main.CuentasBanco.emisor()
|
||||
|
||||
|
|
|
@ -947,12 +947,29 @@ class SATRegimenes(BaseModel):
|
|||
rows = (SATRegimenes
|
||||
.select(
|
||||
SATRegimenes.id,
|
||||
SATRegimenes.name.alias('value'))
|
||||
fn.Concat("[", SATRegimenes.key, "] ", SATRegimenes.name).alias('value')
|
||||
)
|
||||
.where(where)
|
||||
.dicts()
|
||||
)
|
||||
return tuple(rows)
|
||||
|
||||
@classmethod
|
||||
def actualizar(self, values):
|
||||
id = int(values['id'])
|
||||
if values['field'] == 'activo':
|
||||
v = {'0': False, '1': True}
|
||||
q = (SATRegimenes
|
||||
.update(**{'activo': v[values['value']]})
|
||||
.where(SATRegimenes.id==id))
|
||||
result = bool(q.execute())
|
||||
return {'ok': result}
|
||||
|
||||
@classmethod
|
||||
def _get_all(cls, filters, user):
|
||||
rows = SATRegimenes.select().dicts()
|
||||
return tuple(rows)
|
||||
|
||||
@classmethod
|
||||
def get_data(cls, filters, user):
|
||||
opt = filters['opt']
|
||||
|
@ -1609,7 +1626,8 @@ class SATFormaPago(BaseModel):
|
|||
if values:
|
||||
field = SATFormaPago.key.alias('id')
|
||||
rows = (SATFormaPago
|
||||
.select(field, SATFormaPago.name.alias('value'))
|
||||
.select(field,
|
||||
fn.Concat("[", SATFormaPago.key, "] ", SATFormaPago.name).alias('value'))
|
||||
.where(SATFormaPago.activo==True)
|
||||
.dicts()
|
||||
)
|
||||
|
@ -2286,7 +2304,7 @@ class SATUsoCfdi(BaseModel):
|
|||
rows = (SATUsoCfdi
|
||||
.select(
|
||||
SATUsoCfdi.key.alias('id'),
|
||||
SATUsoCfdi.name.alias('value'),
|
||||
fn.Concat("[", SATUsoCfdi.key, "] ", SATUsoCfdi.name).alias('value'),
|
||||
SATUsoCfdi.fisica,
|
||||
SATUsoCfdi.moral,
|
||||
)
|
||||
|
@ -3100,7 +3118,10 @@ class SociosRegimenes(BaseModel):
|
|||
|
||||
@classmethod
|
||||
def get_by_key(cls, socio, user=None):
|
||||
fields = (SATRegimenes.key.alias('id'), SATRegimenes.name.alias('value'))
|
||||
fields = (
|
||||
SATRegimenes.key.alias('id'),
|
||||
fn.Concat("[", SATRegimenes.key, "] ", SATRegimenes.name).alias('value')
|
||||
)
|
||||
where = (SociosRegimenes.socio == socio)
|
||||
regimenes = (SociosRegimenes
|
||||
.select(*fields)
|
||||
|
|
|
@ -60,6 +60,7 @@ var controllers = {
|
|||
$$('grid_admin_unidades').attachEvent('onCheck', grid_admin_unidades_on_check)
|
||||
$$('grid_admin_formasdepago').attachEvent('onCheck', grid_admin_formasdepago_on_check)
|
||||
$$('grid_admin_usos_cfdi').attachEvent('onCheck', grid_admin_usos_cfdi_on_check)
|
||||
$$('grid_admin_regimenes_fiscales').attachEvent('onCheck', grid_admin_regimenes_fiscales_on_check)
|
||||
$$('grid_unidad_found').attachEvent('onValueSuggest', grid_unidad_found_click)
|
||||
$$('grid_admin_unidades').attachEvent('onItemClick', grid_admin_unidades_click)
|
||||
$$('grid_moneda_found').attachEvent('onValueSuggest', grid_moneda_found_click)
|
||||
|
@ -440,6 +441,15 @@ function get_admin_usos_cfdi(){
|
|||
}
|
||||
|
||||
|
||||
function get_admin_regimenes_fiscales(){
|
||||
webix.ajax().sync().get('/values/allregimenes', function(text, data){
|
||||
var values = data.json()
|
||||
$$('grid_admin_regimenes_fiscales').clearAll()
|
||||
$$('grid_admin_regimenes_fiscales').parse(values, 'json')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function get_admin_usuarios(){
|
||||
webix.ajax().sync().get('/values/allusuarios', function(text, data){
|
||||
var rows = data.json()
|
||||
|
@ -1254,44 +1264,6 @@ function txt_plantilla_nomina1233_click(e){
|
|||
}
|
||||
|
||||
|
||||
//~ function txt_plantilla_pagos10_click(e){
|
||||
|
||||
//~ var body_elements = [
|
||||
//~ {cols: [{width: 100}, {view: 'uploader', id: 'up_template',
|
||||
//~ autosend: true, link: 'lst_files', value: 'Seleccionar archivo',
|
||||
//~ upload: '/files/txt_plantilla_pagos10', width: 200}, {width: 100}]},
|
||||
//~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
|
||||
//~ borderless: true},
|
||||
//~ {},
|
||||
//~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
|
||||
//~ click:("$$('win_template').close();")}, {}]}
|
||||
//~ ]
|
||||
|
||||
//~ var w = webix.ui({
|
||||
//~ view: 'window',
|
||||
//~ id: 'win_template',
|
||||
//~ modal: true,
|
||||
//~ position: 'center',
|
||||
//~ head: 'Subir Plantilla Factura de Pago',
|
||||
//~ body: {
|
||||
//~ view: 'form',
|
||||
//~ elements: body_elements,
|
||||
//~ }
|
||||
//~ })
|
||||
|
||||
//~ w.show()
|
||||
|
||||
//~ $$('up_template').attachEvent('onUploadComplete', function(response){
|
||||
//~ if(response.ok){
|
||||
//~ $$('txt_plantilla_pagos10').setValue(response.name)
|
||||
//~ msg_ok('Plantilla cargada correctamente')
|
||||
//~ }else{
|
||||
//~ msg_error(response.name)
|
||||
//~ }
|
||||
//~ })
|
||||
//~ }
|
||||
|
||||
|
||||
function tab_options_change(nv, ov){
|
||||
var cv = {
|
||||
tab_admin_templates: 'templates',
|
||||
|
@ -1316,6 +1288,8 @@ function tab_sat_change(nv, ov){
|
|||
get_admin_formasdepago()
|
||||
}else if(nv == 'Usos de CFDI'){
|
||||
get_admin_usos_cfdi()
|
||||
}else if(nv == 'Regimenes Fiscales'){
|
||||
get_admin_regimenes_fiscales()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1415,6 +1389,21 @@ function grid_admin_usos_cfdi_on_check(row, column, state){
|
|||
}
|
||||
|
||||
|
||||
function grid_admin_regimenes_fiscales_on_check(row, column, state){
|
||||
var values = {
|
||||
id: row,
|
||||
field: column,
|
||||
value: state,
|
||||
}
|
||||
webix.ajax().get('/values/regimenesupdate', values, {
|
||||
error: function(text, data, xhr) {
|
||||
},
|
||||
success: function(text, data, xhr) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function emisor_cuenta_saldo_inicial_change(new_value, old_value){
|
||||
if(!isFinite(new_value)){
|
||||
this.config.value = old_value
|
||||
|
|
|
@ -361,7 +361,7 @@ function opt_tipo_change(new_value, old_value){
|
|||
show('id_fiscal', new_value == 4)
|
||||
|
||||
$$('lst_receptor_regimenes_fiscales').clearAll()
|
||||
var regimen_616 = {id: 11, value: 'Sin obligaciones fiscales'}
|
||||
var regimen_616 = {id: 11, value: '[616] Sin obligaciones fiscales'}
|
||||
|
||||
if (new_value == 1 || new_value == 2){
|
||||
$$("rfc").define("value", "")
|
||||
|
|
|
@ -1136,6 +1136,19 @@ var grid_admin_usos_cfdi_cols = [
|
|||
]
|
||||
|
||||
|
||||
var grid_admin_regimenes_fiscales_cols = [
|
||||
{id: 'id', header: 'ID', hidden: true},
|
||||
{id: 'key', header: 'Clave', adjust: 'header'},
|
||||
{id: 'name', header: 'Nombre', width: 500},
|
||||
{id: 'fisica', header: 'Físicas', adjust: 'header',
|
||||
template: format_bool_fisica},
|
||||
{id: 'moral', header: 'Morales', adjust: 'header',
|
||||
template: format_bool_moral},
|
||||
{id: 'activo', header: 'Activa', template: '{common.checkbox()}',
|
||||
editor: 'checkbox', adjust: 'header'},
|
||||
]
|
||||
|
||||
|
||||
var grid_admin_formasdepago = {
|
||||
view: 'datatable',
|
||||
id: 'grid_admin_formasdepago',
|
||||
|
@ -1148,6 +1161,18 @@ var grid_admin_formasdepago = {
|
|||
}
|
||||
|
||||
|
||||
var grid_admin_regimenes_fiscales = {
|
||||
view: 'datatable',
|
||||
id: 'grid_admin_regimenes_fiscales',
|
||||
select: 'cell',
|
||||
adjust: true,
|
||||
autowidth: true,
|
||||
headermenu: true,
|
||||
footer: true,
|
||||
columns: grid_admin_regimenes_fiscales_cols,
|
||||
}
|
||||
|
||||
|
||||
var grid_admin_usos_cfdi = {
|
||||
view: 'datatable',
|
||||
id: 'grid_admin_usos_cfdi',
|
||||
|
@ -1319,6 +1344,16 @@ var sat_usos_cfdi = [
|
|||
]
|
||||
|
||||
|
||||
var msg_regimenes_fiscales = 'Administrar Regimenes Fiscales.'
|
||||
var sat_regimenes_fiscales = [
|
||||
{maxHeight: 20},
|
||||
{cols: [{maxWidth: 15}, {view: 'label', label: msg_regimenes_fiscales}, {}]},
|
||||
{maxHeight: 20},
|
||||
{cols: [{maxWidth: 15}, grid_admin_regimenes_fiscales, {}]},
|
||||
{maxHeight: 20},
|
||||
]
|
||||
|
||||
|
||||
var suggest_sat_unidades_peso = {
|
||||
view: 'gridsuggest',
|
||||
id: 'grid_unidadpeso_found',
|
||||
|
@ -1416,6 +1451,7 @@ var tab_sat = {
|
|||
{id: 'Unidades', rows: sat_unidades},
|
||||
{id: 'Formas de Pago', rows: sat_formasdepago},
|
||||
{id: 'Usos de CFDI', rows: sat_usos_cfdi},
|
||||
{id: 'Regimenes Fiscales', rows: sat_regimenes_fiscales},
|
||||
{id: 'Carta Porte', rows: tab_sat_carta_porte},
|
||||
],
|
||||
}
|
||||
|
|
|
@ -516,8 +516,8 @@ var body_comprobante = {rows: [{
|
|||
|
||||
|
||||
var opt_metodo_pago = [
|
||||
{id: 'PUE', value: 'Pago en una sola exhibición'},
|
||||
{id: 'PPD', value: 'Pago en parcialidades o diferido'}
|
||||
{id: 'PUE', value: '[PUE] Pago en una sola exhibición'},
|
||||
{id: 'PPD', value: '[PPD] Pago en parcialidades o diferido'}
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue