forked from elmau/empresa-libre
parent
17a9b00cb5
commit
d795069b38
Binary file not shown.
After Width: | Height: | Size: 712 B |
Binary file not shown.
After Width: | Height: | Size: 476 B |
Binary file not shown.
After Width: | Height: | Size: 704 B |
Binary file not shown.
After Width: | Height: | Size: 483 B |
|
@ -59,7 +59,7 @@ from settings import DEBUG, MV, log, template_lookup, COMPANIES, DB_SAT, \
|
||||||
PATH_XSLT, PATH_XSLTPROC, PATH_OPENSSL, PATH_TEMPLATES, PATH_MEDIA, PRE, \
|
PATH_XSLT, PATH_XSLTPROC, PATH_OPENSSL, PATH_TEMPLATES, PATH_MEDIA, PRE, \
|
||||||
PATH_XMLSEC, TEMPLATE_CANCEL, DEFAULT_SAT_PRODUCTO, DECIMALES, DIR_FACTURAS
|
PATH_XMLSEC, TEMPLATE_CANCEL, DEFAULT_SAT_PRODUCTO, DECIMALES, DIR_FACTURAS
|
||||||
|
|
||||||
from settings import DEBUG, SEAFILE_SERVER, USAR_TOKEN, API
|
from settings import SEAFILE_SERVER, USAR_TOKEN, API, DECIMALES_TAX
|
||||||
from .configpac import AUTH
|
from .configpac import AUTH
|
||||||
|
|
||||||
|
|
||||||
|
@ -2310,7 +2310,9 @@ def get_bool(value):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_float(value):
|
def get_float(value, four=False):
|
||||||
|
if four:
|
||||||
|
return round(float(value), DECIMALES_TAX)
|
||||||
return round(float(value), DECIMALES)
|
return round(float(value), DECIMALES)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1665,7 +1665,7 @@ class CuentasBanco(BaseModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{} ({})'.format(self.banco.name, self.cuenta[-4:])
|
return '{} ({})'.format(self.nombre, self.cuenta[-4:])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def activate(cls, values):
|
def activate(cls, values):
|
||||||
|
@ -1732,13 +1732,14 @@ class CuentasBanco(BaseModel):
|
||||||
rows = (CuentasBanco
|
rows = (CuentasBanco
|
||||||
.select()
|
.select()
|
||||||
.where(CuentasBanco.de_emisor==True, CuentasBanco.activa==True)
|
.where(CuentasBanco.de_emisor==True, CuentasBanco.activa==True)
|
||||||
|
.order_by(CuentasBanco.id)
|
||||||
)
|
)
|
||||||
if not (len(rows)):
|
if not (len(rows)):
|
||||||
return {'ok': False}
|
return {'ok': False}
|
||||||
|
|
||||||
first = rows[0]
|
first = rows[0]
|
||||||
rows = [{'id': r.id, 'value': '{} ({})'.format(
|
rows = [{'id': r.id, 'value': '{} ({})'.format(
|
||||||
r.banco.name, r.cuenta[-4:])} for r in rows]
|
r.nombre, r.cuenta[-4:])} for r in rows]
|
||||||
data = {
|
data = {
|
||||||
'ok': True,
|
'ok': True,
|
||||||
'rows': tuple(rows),
|
'rows': tuple(rows),
|
||||||
|
@ -1917,11 +1918,14 @@ class MovimientosBanco(BaseModel):
|
||||||
else:
|
else:
|
||||||
actualizar = True
|
actualizar = True
|
||||||
hora = values.pop('hora')
|
hora = values.pop('hora')
|
||||||
|
account = CuentasBanco.get(CuentasBanco.id==int(values['cuenta']))
|
||||||
values['fecha'] = '{}T{}'.format(values['fecha'][:10], hora)
|
values['fecha'] = '{}T{}'.format(values['fecha'][:10], hora)
|
||||||
values['cuenta'] = int(values['cuenta'])
|
values['cuenta'] = account
|
||||||
|
values['moneda'] = account.moneda.key
|
||||||
values['retiro'] = util.get_float(values['retiro'])
|
values['retiro'] = util.get_float(values['retiro'])
|
||||||
values['deposito'] = util.get_float(values['deposito'])
|
values['deposito'] = util.get_float(values['deposito'])
|
||||||
values['tipo_cambio'] = util.get_float(values.get('tipo_cambio', 1.00))
|
values['tipo_cambio'] = util.get_float(
|
||||||
|
values.get('tipo_cambio', 1.00), True)
|
||||||
values['forma_pago'] = int(values['forma_pago'])
|
values['forma_pago'] = int(values['forma_pago'])
|
||||||
|
|
||||||
ultimo_saldo = self._ultimo_saldo(
|
ultimo_saldo = self._ultimo_saldo(
|
||||||
|
@ -1959,11 +1963,11 @@ 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 = (CfdiPagos.movimiento==obj)
|
||||||
cp = CfdiPagos.select().where(filters).count()
|
# ~ cp = CfdiPagos.select().where(filters).count()
|
||||||
if cp > 0:
|
# ~ if cp > 0:
|
||||||
msg = 'El movimiento tiene Factura de Pago, no se puede cancelar'
|
# ~ msg = 'El movimiento tiene Factura de Pago, no se puede cancelar'
|
||||||
return {'ok': False, 'msg': msg}
|
# ~ return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
obj.cancelado = True
|
obj.cancelado = True
|
||||||
|
@ -2481,6 +2485,7 @@ class Socios(BaseModel):
|
||||||
auto_round=True)
|
auto_round=True)
|
||||||
web = TextField(default='')
|
web = TextField(default='')
|
||||||
correo_facturas = TextField(default='')
|
correo_facturas = TextField(default='')
|
||||||
|
correo_facturasp = TextField(default='')
|
||||||
forma_pago = ForeignKeyField(SATFormaPago, null=True)
|
forma_pago = ForeignKeyField(SATFormaPago, null=True)
|
||||||
condicion_pago = ForeignKeyField(CondicionesPago, null=True)
|
condicion_pago = ForeignKeyField(CondicionesPago, null=True)
|
||||||
addenda = ForeignKeyField(Addendas, null=True)
|
addenda = ForeignKeyField(Addendas, null=True)
|
||||||
|
@ -2525,6 +2530,7 @@ class Socios(BaseModel):
|
||||||
'correo_facturas', 'plantilla', 'id_fiscal')
|
'correo_facturas', 'plantilla', 'id_fiscal')
|
||||||
for name in ft:
|
for name in ft:
|
||||||
fields[name] = values.get(name, '')
|
fields[name] = values.get(name, '')
|
||||||
|
fields['correo_facturasp'] = values.pop('partner_email_fp', '')
|
||||||
|
|
||||||
if fields['pais'] != 'México':
|
if fields['pais'] != 'México':
|
||||||
fields['pais'] = fields['pais'].upper()
|
fields['pais'] = fields['pais'].upper()
|
||||||
|
@ -2543,6 +2549,7 @@ class Socios(BaseModel):
|
||||||
row['condicion_pago'] = \
|
row['condicion_pago'] = \
|
||||||
str(CondicionesPago.get(id=row['condicion_pago']))
|
str(CondicionesPago.get(id=row['condicion_pago']))
|
||||||
row['partner_balance'] = row.pop('saldo_cliente')
|
row['partner_balance'] = row.pop('saldo_cliente')
|
||||||
|
row['partner_email_fp'] = row.pop('correo_facturasp')
|
||||||
return row
|
return row
|
||||||
|
|
||||||
#~ return {'data': data['rows'][:100], 'pos':0, 'total_count': 1300}
|
#~ return {'data': data['rows'][:100], 'pos':0, 'total_count': 1300}
|
||||||
|
@ -5680,7 +5687,8 @@ class CfdiPagos(BaseModel):
|
||||||
impuestos = {}
|
impuestos = {}
|
||||||
|
|
||||||
mov = invoice.movimiento
|
mov = invoice.movimiento
|
||||||
currency = mov.cuenta.moneda.key
|
# ~ currency = mov.cuenta.moneda.key
|
||||||
|
currency = mov.moneda
|
||||||
related_docs = self._get_related_xml(self, invoice.movimiento, currency)
|
related_docs = self._get_related_xml(self, invoice.movimiento, currency)
|
||||||
pagos = {
|
pagos = {
|
||||||
'FechaPago': mov.fecha.isoformat()[:19],
|
'FechaPago': mov.fecha.isoformat()[:19],
|
||||||
|
@ -5709,6 +5717,7 @@ class CfdiPagos(BaseModel):
|
||||||
def _stamp(self, values):
|
def _stamp(self, values):
|
||||||
id_mov = int(values['id_mov'])
|
id_mov = int(values['id_mov'])
|
||||||
|
|
||||||
|
send_email = util.get_bool(Configuracion.get_('correo_directo'))
|
||||||
auth = Emisor.get_auth()
|
auth = Emisor.get_auth()
|
||||||
filters = (
|
filters = (
|
||||||
(CfdiPagos.movimiento==id_mov) &
|
(CfdiPagos.movimiento==id_mov) &
|
||||||
|
@ -5742,7 +5751,8 @@ class CfdiPagos(BaseModel):
|
||||||
'row': row,
|
'row': row,
|
||||||
}
|
}
|
||||||
if result['ok']:
|
if result['ok']:
|
||||||
self._sync(self, obj.id)
|
self._sync(self, obj.id, send_email)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_related(self, values):
|
def _get_related(self, values):
|
||||||
|
@ -5833,9 +5843,10 @@ class CfdiPagos(BaseModel):
|
||||||
return doc, name
|
return doc, name
|
||||||
|
|
||||||
@util.run_in_thread
|
@util.run_in_thread
|
||||||
def _sync(self, id):
|
def _sync(self, id, send_email=False):
|
||||||
CfdiPagos.get_file_xml(id)
|
files = (CfdiPagos.get_file_xml(id), CfdiPagos.get_file_pdf(id))
|
||||||
CfdiPagos.get_file_pdf(id)
|
if send_email:
|
||||||
|
self._send(self, {'id': id}, files)
|
||||||
return
|
return
|
||||||
|
|
||||||
@util.run_in_thread
|
@util.run_in_thread
|
||||||
|
@ -5848,7 +5859,45 @@ class CfdiPagos(BaseModel):
|
||||||
opt = values.pop('opt')
|
opt = values.pop('opt')
|
||||||
return getattr(cls, '_get_{}'.format(opt))(cls, values)
|
return getattr(cls, '_get_{}'.format(opt))(cls, values)
|
||||||
|
|
||||||
def _send(self, values):
|
def _get_table(self, values):
|
||||||
|
# ~ print('\n\n', values, '\n')
|
||||||
|
if 'start' in values:
|
||||||
|
filters = CfdiPagos.fecha.between(
|
||||||
|
util.get_date(values['start']),
|
||||||
|
util.get_date(values['end'], True))
|
||||||
|
else:
|
||||||
|
if values['year'] == '-1':
|
||||||
|
fy = (CfdiPagos.fecha.year > 0)
|
||||||
|
else:
|
||||||
|
fy = (CfdiPagos.fecha.year == int(values['year']))
|
||||||
|
if values['month'] == '-1':
|
||||||
|
fm = (CfdiPagos.fecha.month > 0)
|
||||||
|
else:
|
||||||
|
fm = (CfdiPagos.fecha.month == int(values['month']))
|
||||||
|
filters = (fy & fm)
|
||||||
|
|
||||||
|
rows = tuple(CfdiPagos.select(
|
||||||
|
CfdiPagos.id,
|
||||||
|
CfdiPagos.serie,
|
||||||
|
CfdiPagos.folio,
|
||||||
|
CfdiPagos.uuid,
|
||||||
|
CfdiPagos.fecha,
|
||||||
|
CfdiPagos.tipo_comprobante,
|
||||||
|
CfdiPagos.estatus,
|
||||||
|
case(MovimientosBanco.cancelado, (
|
||||||
|
(True, 'Cancelado'),
|
||||||
|
(False, 'Activo'),
|
||||||
|
)).alias('movimiento'),
|
||||||
|
MovimientosBanco.deposito.alias('total'),
|
||||||
|
MovimientosBanco.moneda.alias('currency'),
|
||||||
|
(MovimientosBanco.deposito * MovimientosBanco.tipo_cambio).alias('total_mn'),
|
||||||
|
Socios.nombre.alias('cliente'))
|
||||||
|
.join(MovimientosBanco).switch(CfdiPagos)
|
||||||
|
.join(Socios).switch(CfdiPagos)
|
||||||
|
.where(filters).dicts())
|
||||||
|
return {'ok': True, 'rows': rows}
|
||||||
|
|
||||||
|
def _send(self, values, files=()):
|
||||||
id = int(values['id'])
|
id = int(values['id'])
|
||||||
|
|
||||||
values = Configuracion.get_({'fields': 'correo'})
|
values = Configuracion.get_({'fields': 'correo'})
|
||||||
|
@ -5861,11 +5910,12 @@ class CfdiPagos(BaseModel):
|
||||||
msg = 'La factura no esta timbrada'
|
msg = 'La factura no esta timbrada'
|
||||||
return {'ok': False, 'msg': msg}
|
return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
to = obj.socio.correo_facturas
|
to = obj.socio.correo_facturasp or obj.socio.correo_facturas
|
||||||
if not to:
|
if not to:
|
||||||
msg = 'El cliente no tiene configurado el correo para facturas'
|
msg = 'El cliente no tiene configurado el correo para facturas'
|
||||||
return {'ok': False, 'msg': msg}
|
return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
|
if not files:
|
||||||
files = (self.get_file_pdf(id), self.get_file_xml(id))
|
files = (self.get_file_pdf(id), self.get_file_xml(id))
|
||||||
|
|
||||||
fields = util.make_fields(obj.xml)
|
fields = util.make_fields(obj.xml)
|
||||||
|
@ -8142,12 +8192,15 @@ def _migrate_tables(rfc=''):
|
||||||
if not 'id_fiscal' in columns:
|
if not 'id_fiscal' in columns:
|
||||||
id_fiscal = TextField(default='')
|
id_fiscal = TextField(default='')
|
||||||
migrations.append(
|
migrations.append(
|
||||||
migrator.add_column(
|
migrator.add_column('socios', 'id_fiscal', id_fiscal))
|
||||||
'socios', 'id_fiscal', id_fiscal))
|
|
||||||
if not 'plantilla' in columns:
|
if not 'plantilla' in columns:
|
||||||
plantilla = TextField(default='')
|
plantilla = TextField(default='')
|
||||||
migrations.append(
|
migrations.append(
|
||||||
migrator.add_column('socios', 'plantilla', plantilla))
|
migrator.add_column('socios', 'plantilla', plantilla))
|
||||||
|
if not 'correo_facturasp' in columns:
|
||||||
|
correo_facturasp = TextField(default='')
|
||||||
|
migrations.append(
|
||||||
|
migrator.add_column('socios', 'correo_facturasp', correo_facturasp))
|
||||||
|
|
||||||
columns = [c.name for c in database_proxy.get_columns('folios')]
|
columns = [c.name for c in database_proxy.get_columns('folios')]
|
||||||
if not 'plantilla' in columns:
|
if not 'plantilla' in columns:
|
||||||
|
|
|
@ -25,6 +25,7 @@ function init_config_bank(){
|
||||||
var multi_currency = get_config('multi_currency')
|
var multi_currency = get_config('multi_currency')
|
||||||
var g1 = $$('grid_cfdi_por_pagar')
|
var g1 = $$('grid_cfdi_por_pagar')
|
||||||
var g2 = $$('grid_cfdi_este_deposito')
|
var g2 = $$('grid_cfdi_este_deposito')
|
||||||
|
var g3 = $$('grid_bank_invoice_pay')
|
||||||
|
|
||||||
if(multi_currency){
|
if(multi_currency){
|
||||||
g1.showColumn('total')
|
g1.showColumn('total')
|
||||||
|
@ -33,9 +34,11 @@ function init_config_bank(){
|
||||||
g2.showColumn('currency')
|
g2.showColumn('currency')
|
||||||
g2.showColumn('this_pay')
|
g2.showColumn('this_pay')
|
||||||
g2.showColumn('type_change')
|
g2.showColumn('type_change')
|
||||||
|
g3.showColumn('total')
|
||||||
|
g3.showColumn('currency')
|
||||||
}
|
}
|
||||||
show('cmd_complemento_pago', get_config('used_cfdi_pays'))
|
show('cmd_complemento_pago', get_config('used_cfdi_pays'))
|
||||||
//~ show('cmd_show_invoice_pay', get_config('used_cfdi_pays'))
|
show('cmd_show_invoice_pay', get_config('used_cfdi_pays'))
|
||||||
set_year_month()
|
set_year_month()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +55,7 @@ var bancos_controllers = {
|
||||||
$$('cmd_invoice_payed').attachEvent('onItemClick', cmd_invoice_payed_click)
|
$$('cmd_invoice_payed').attachEvent('onItemClick', cmd_invoice_payed_click)
|
||||||
$$('txt_retiro_importe').attachEvent('onChange', txt_retiro_importe_change)
|
$$('txt_retiro_importe').attachEvent('onChange', txt_retiro_importe_change)
|
||||||
$$('txt_deposito_importe').attachEvent('onChange', txt_deposito_importe_change)
|
$$('txt_deposito_importe').attachEvent('onChange', txt_deposito_importe_change)
|
||||||
|
$$('deposit_type_change').attachEvent('onChange', deposit_type_change_change)
|
||||||
$$('grid_cfdi_este_deposito').attachEvent('onAfterDrop', grid_cfdi_este_deposito_after_drop)
|
$$('grid_cfdi_este_deposito').attachEvent('onAfterDrop', grid_cfdi_este_deposito_after_drop)
|
||||||
$$('grid_cfdi_por_pagar').attachEvent('onAfterDrop', grid_cfdi_por_pagar_after_drop)
|
$$('grid_cfdi_por_pagar').attachEvent('onAfterDrop', grid_cfdi_por_pagar_after_drop)
|
||||||
$$('grid_cfdi_este_deposito').attachEvent('onBeforeEditStop', grid_cfdi_este_deposito_before_edit_stop)
|
$$('grid_cfdi_este_deposito').attachEvent('onBeforeEditStop', grid_cfdi_este_deposito_before_edit_stop)
|
||||||
|
@ -66,6 +70,10 @@ var bancos_controllers = {
|
||||||
$$('grid_cfdi_pay').attachEvent('onItemClick', grid_cfdi_pay_click)
|
$$('grid_cfdi_pay').attachEvent('onItemClick', grid_cfdi_pay_click)
|
||||||
$$('grid_cfdi_por_pagar').attachEvent('onItemDblClick', grid_cfdi_por_pagar_double_click)
|
$$('grid_cfdi_por_pagar').attachEvent('onItemDblClick', grid_cfdi_por_pagar_double_click)
|
||||||
$$('grid_cfdi_este_deposito').attachEvent('onItemDblClick', grid_cfdi_este_deposito_double_click)
|
$$('grid_cfdi_este_deposito').attachEvent('onItemDblClick', grid_cfdi_este_deposito_double_click)
|
||||||
|
$$('cmd_show_invoice_pay').attachEvent('onItemClick', cmd_show_invoice_pay_click)
|
||||||
|
$$('filter_invoice_pay_year').attachEvent('onChange', filter_invoice_pay_change)
|
||||||
|
$$('filter_invoice_pay_month').attachEvent('onChange', filter_invoice_pay_change)
|
||||||
|
$$('grid_bank_invoice_pay').attachEvent('onItemClick', grid_bank_invoice_pay_click)
|
||||||
|
|
||||||
init_config_bank()
|
init_config_bank()
|
||||||
}
|
}
|
||||||
|
@ -75,6 +83,7 @@ var bancos_controllers = {
|
||||||
function set_year_month(){
|
function set_year_month(){
|
||||||
var d = new Date()
|
var d = new Date()
|
||||||
var y = $$('filter_cuenta_year')
|
var y = $$('filter_cuenta_year')
|
||||||
|
var y2 = $$('filter_invoice_pay_year')
|
||||||
var m = $$('filter_cuenta_month')
|
var m = $$('filter_cuenta_month')
|
||||||
|
|
||||||
webix.ajax().get('/values/cuentayears', {
|
webix.ajax().get('/values/cuentayears', {
|
||||||
|
@ -85,6 +94,7 @@ function set_year_month(){
|
||||||
success:function(text, data, XmlHttpRequest){
|
success:function(text, data, XmlHttpRequest){
|
||||||
var values = data.json()
|
var values = data.json()
|
||||||
y.getList().parse(values)
|
y.getList().parse(values)
|
||||||
|
y2.getList().parse(values)
|
||||||
y.blockEvent()
|
y.blockEvent()
|
||||||
m.blockEvent()
|
m.blockEvent()
|
||||||
y.setValue(d.getFullYear())
|
y.setValue(d.getFullYear())
|
||||||
|
@ -378,14 +388,22 @@ function cmd_guardar_retiro_click(){
|
||||||
|
|
||||||
|
|
||||||
function txt_retiro_importe_change(new_value, old_value){
|
function txt_retiro_importe_change(new_value, old_value){
|
||||||
if(!isFinite(new_value)){
|
if(!isFinite(new_value) || !new_value){
|
||||||
this.config.value = old_value
|
this.config.value = old_value
|
||||||
this.refresh()
|
this.refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function txt_deposito_importe_change(new_value, old_value){
|
function txt_deposito_importe_change(new_value, old_value){
|
||||||
if(!isFinite(new_value)){
|
if(!isFinite(new_value) || !new_value){
|
||||||
|
this.config.value = old_value
|
||||||
|
this.refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function deposit_type_change_change(new_value, old_value){
|
||||||
|
if(!isFinite(new_value) || !new_value){
|
||||||
this.config.value = old_value
|
this.config.value = old_value
|
||||||
this.refresh()
|
this.refresh()
|
||||||
}
|
}
|
||||||
|
@ -525,7 +543,7 @@ function grid_cfdi_este_deposito_before_edit_stop(state, editor){
|
||||||
function validate_deposito(values){
|
function validate_deposito(values){
|
||||||
var grid = $$('grid_cfdi_este_deposito')
|
var grid = $$('grid_cfdi_este_deposito')
|
||||||
var importe = values.deposito_importe.to_float()
|
var importe = values.deposito_importe.to_float()
|
||||||
var type_change = values.deposit_type_change.to_float()
|
var type_change = values.deposit_type_change.to_float4()
|
||||||
var msg_tc = ''
|
var msg_tc = ''
|
||||||
|
|
||||||
if(!importe){
|
if(!importe){
|
||||||
|
@ -642,7 +660,7 @@ function guardar_deposito(values){
|
||||||
data['numero_operacion'] = values.deposito_referencia.trim()
|
data['numero_operacion'] = values.deposito_referencia.trim()
|
||||||
data['forma_pago'] = $$('lst_deposito_forma_pago').getValue()
|
data['forma_pago'] = $$('lst_deposito_forma_pago').getValue()
|
||||||
data['deposito'] = values.deposito_importe.to_float()
|
data['deposito'] = values.deposito_importe.to_float()
|
||||||
data['tipo_cambio'] = values.deposit_type_change.to_float()
|
data['tipo_cambio'] = values.deposit_type_change.to_float4()
|
||||||
data['retiro'] = 0.0
|
data['retiro'] = 0.0
|
||||||
data['descripcion'] = values.deposito_descripcion
|
data['descripcion'] = values.deposito_descripcion
|
||||||
|
|
||||||
|
@ -768,8 +786,9 @@ function cmd_cancelar_movimiento_click(){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg = '¿Estás seguro de cancelar el movimiento seleccionado?'
|
var msg = '¿Estás seguro de cancelar el movimiento seleccionado?<BR><BR>'
|
||||||
msg += '<BR><BR>ESTA ACCIÓN NO SE PUEDE DESHACER<BR><BR>'
|
msg += 'SI EL MOVIMIENTO TIENE FACTURA DE PAGO, QUEDARÁ HUERFANA<BR><BR>'
|
||||||
|
msg += 'ESTA ACCIÓN NO SE PUEDE DESHACER<BR><BR>'
|
||||||
webix.confirm({
|
webix.confirm({
|
||||||
title: 'Cancelar Movimiento',
|
title: 'Cancelar Movimiento',
|
||||||
ok: 'Si',
|
ok: 'Si',
|
||||||
|
@ -841,6 +860,11 @@ function filter_cuenta_change(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function filter_invoice_pay_change(){
|
||||||
|
get_invoices_pay()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function filter_cuenta_dates_change(range){
|
function filter_cuenta_dates_change(range){
|
||||||
if(range.start != null && range.end != null){
|
if(range.start != null && range.end != null){
|
||||||
get_estado_cuenta(range)
|
get_estado_cuenta(range)
|
||||||
|
@ -955,6 +979,8 @@ function send_stamp_cfdi_pay(id_mov){
|
||||||
var g = $$('grid_cfdi_pay')
|
var g = $$('grid_cfdi_pay')
|
||||||
var data = {'opt': 'stamp', 'id_mov': id_mov}
|
var data = {'opt': 'stamp', 'id_mov': id_mov}
|
||||||
|
|
||||||
|
//~ ToDo Actualizar cantidad de facturas de pago en el movimiento
|
||||||
|
|
||||||
webix.ajax().sync().post('cfdipay', data, {
|
webix.ajax().sync().post('cfdipay', data, {
|
||||||
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'
|
||||||
|
@ -1156,6 +1182,20 @@ function grid_cfdi_pay_click(id, e, node){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function grid_bank_invoice_pay_click(id, e, node){
|
||||||
|
var row = this.getItem(id)
|
||||||
|
|
||||||
|
if(id.column == 'xml'){
|
||||||
|
location = '/doc/xmlpago/' + row.id
|
||||||
|
}else if(id.column == 'pdf'){
|
||||||
|
window.open('/doc/pdfpago/' + row.id, '_blank')
|
||||||
|
}else if(id.column == 'email'){
|
||||||
|
send_cfdi_email(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function grid_cfdi_por_pagar_double_click(id, e, node){
|
function grid_cfdi_por_pagar_double_click(id, e, node){
|
||||||
var grid = $$('grid_cfdi_este_deposito')
|
var grid = $$('grid_cfdi_este_deposito')
|
||||||
|
|
||||||
|
@ -1172,9 +1212,47 @@ function grid_cfdi_este_deposito_double_click(id, e, node){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~ function set_is_mn(){
|
function cmd_show_invoice_pay_click(){
|
||||||
//~ var c = $$('txt_cuenta_moneda').getValue()
|
var y = $$('filter_invoice_pay_year')
|
||||||
//~ if(c!=CURRENCY_MN){
|
var m = $$('filter_invoice_pay_month')
|
||||||
//~ is_mn = false
|
y.blockEvent()
|
||||||
//~ }
|
m.blockEvent()
|
||||||
//~ }
|
y.setValue($$('filter_cuenta_year').getValue())
|
||||||
|
m.setValue($$('filter_cuenta_month').getValue())
|
||||||
|
y.unblockEvent()
|
||||||
|
m.unblockEvent()
|
||||||
|
get_invoices_pay()
|
||||||
|
$$('multi_bancos').setValue('bank_invoice_pay')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_invoices_pay(rango){
|
||||||
|
if(rango == undefined){
|
||||||
|
var filtro = {
|
||||||
|
opt: 'table',
|
||||||
|
year: $$('filter_invoice_pay_year').getValue(),
|
||||||
|
month: $$('filter_invoice_pay_month').getValue(),
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var filtro = {
|
||||||
|
opt: 'table',
|
||||||
|
fechas: rango,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var grid = $$('grid_bank_invoice_pay')
|
||||||
|
|
||||||
|
webix.ajax().get('/cfdipay', filtro, {
|
||||||
|
error:function(text, data, XmlHttpRequest){
|
||||||
|
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||||
|
msg_error(msg)
|
||||||
|
},
|
||||||
|
success:function(text, data, XmlHttpRequest){
|
||||||
|
var values = data.json()
|
||||||
|
grid.clearAll()
|
||||||
|
if (values.ok){
|
||||||
|
grid.parse(values.rows, 'json')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -154,10 +154,20 @@ String.prototype.to_float4 = function(){
|
||||||
|
|
||||||
|
|
||||||
function get_float(value){
|
function get_float(value){
|
||||||
return parseFloat(value.replace('$', '').replace(',', '').trim()).round(DECIMALES)
|
var f = parseFloat(value.replace('$', '').replace(',', '').trim()).round(DECIMALES)
|
||||||
|
if(!f){
|
||||||
|
f = 0.00
|
||||||
|
}
|
||||||
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_float4(value){
|
function get_float4(value){
|
||||||
return parseFloat(value.replace('$', '').replace(',', '').trim()).round(DECIMALES_TAX)
|
var f = parseFloat(value.replace('$', '').replace(',', '').trim()).round(DECIMALES_TAX)
|
||||||
|
if(!f){
|
||||||
|
f = 0.00
|
||||||
|
}
|
||||||
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,10 @@ var toolbar_movimientos_banco = [
|
||||||
{view: 'button', id: 'cmd_agregar_deposito', label: 'Depósito',
|
{view: 'button', id: 'cmd_agregar_deposito', label: 'Depósito',
|
||||||
type: 'iconButton', autowidth: true, icon: 'plus'},
|
type: 'iconButton', autowidth: true, icon: 'plus'},
|
||||||
{},
|
{},
|
||||||
{view: 'button', id: 'cmd_complemento_pago', label: 'Factura de Pago',
|
{view: 'button', id: 'cmd_complemento_pago', label: 'Generar Factura de Pago',
|
||||||
type: 'iconButton', autowidth: true, icon: 'file-code-o'},
|
type: 'iconButton', autowidth: true, icon: 'file-code-o'},
|
||||||
{view: 'button', id: 'cmd_show_invoice_pay', label: 'Ver Facturas de Pago',
|
{view: 'button', id: 'cmd_show_invoice_pay', label: 'Ver Facturas de Pago',
|
||||||
type: 'iconButton', autowidth: true, icon: 'table', hidden: true},
|
type: 'iconButton', autowidth: true, icon: 'table'},
|
||||||
{},
|
{},
|
||||||
{view: 'button', id: 'cmd_cancelar_movimiento', label: 'Cancelar',
|
{view: 'button', id: 'cmd_cancelar_movimiento', label: 'Cancelar',
|
||||||
type: 'iconButton', autowidth: true, icon: 'ban'},
|
type: 'iconButton', autowidth: true, icon: 'ban'},
|
||||||
|
@ -258,6 +258,69 @@ var grid_pay_related = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var grid_bank_invoice_pay_cols = [
|
||||||
|
{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: "data", sort: 'string',
|
||||||
|
template: '{common.subrow()} #serie#'},
|
||||||
|
{id: 'folio', header: ['Folio', {content: 'numberFilter'}], adjust: 'header',
|
||||||
|
sort: 'int', css: 'right', footer: {text: 'Facturas', colspan: 3}},
|
||||||
|
{id: "uuid", header: ["UUID", {content: "textFilter"}], adjust: "data",
|
||||||
|
sort:"string", hidden:true},
|
||||||
|
{id: "fecha", header: ["Fecha y Hora"], width: 135,
|
||||||
|
sort: "string"},
|
||||||
|
{id: "tipo_comprobante", header: ["Tipo"], adjust: 'data',
|
||||||
|
sort: 'string'},
|
||||||
|
{id: "estatus", header: ["Estatus", {content: "selectFilter"}],
|
||||||
|
adjust: "header", sort:"string"},
|
||||||
|
{id: 'movimiento', header: ['Movimiento', {content: "selectFilter"}],
|
||||||
|
adjust: 'data', sort: 'string'},
|
||||||
|
{id: 'total', header: ['Total', {content: 'numberFilter'}],
|
||||||
|
width: 125, sort: 'int', format: webix.i18n.priceFormat, css: 'right',
|
||||||
|
hidden: true},
|
||||||
|
{id: 'currency', header: ['Moneda', {content: 'selectFilter'}],
|
||||||
|
adjust: 'data', sort: 'string', hidden: true},
|
||||||
|
{id: 'total_mn', header: ['Total M.N.', {content: 'numberFilter'}],
|
||||||
|
width: 150, sort: 'int', format: webix.i18n.priceFormat, css: 'right',
|
||||||
|
footer: {content: 'summTimbrada', css: 'right'}},
|
||||||
|
{id: 'cliente', header: ['Razón Social', {content: 'selectFilter'}],
|
||||||
|
fillspace: true, sort: 'string'},
|
||||||
|
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
|
||||||
|
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
||||||
|
//~ {id: 'ods', header: 'ODS', adjust: 'data', template: get_icon('table')},
|
||||||
|
//~ {id: 'zip', header: 'ZIP', adjust: 'data', template: get_icon('zip')},
|
||||||
|
{id: 'email', header: '', adjust: 'data', template: get_icon('email')}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
var grid_bank_invoice_pay = {
|
||||||
|
view: 'datatable',
|
||||||
|
id: 'grid_bank_invoice_pay',
|
||||||
|
//~ subview: sv_grid_invoices,
|
||||||
|
select: 'row',
|
||||||
|
adjust: true,
|
||||||
|
footer: true,
|
||||||
|
resizeColumn: true,
|
||||||
|
headermenu: true,
|
||||||
|
columns: grid_bank_invoice_pay_cols,
|
||||||
|
scheme:{
|
||||||
|
$change:function(item){
|
||||||
|
if (item.estatus == 'Cancelada'){
|
||||||
|
item.$css = 'cancel'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on:{
|
||||||
|
'data->onStoreUpdated':function(){
|
||||||
|
this.data.each(function(obj, i){
|
||||||
|
obj.index = i + 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var toolbar_banco_retiro = [
|
var toolbar_banco_retiro = [
|
||||||
{view: 'label', label: 'Agregar retiro de banco', id: 'title_bank_retiro'},
|
{view: 'label', label: 'Agregar retiro de banco', id: 'title_bank_retiro'},
|
||||||
{view: 'button', id: 'cmd_guardar_retiro', label: 'Guardar Retiro',
|
{view: 'button', id: 'cmd_guardar_retiro', label: 'Guardar Retiro',
|
||||||
|
@ -291,6 +354,25 @@ var toolbar_bank_pay = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
var toolbar_bank_invoice_pay = [
|
||||||
|
{view: 'label', label: 'Administración de Facturas de Pago'},
|
||||||
|
{},
|
||||||
|
{view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
|
||||||
|
icon: 'times-circle'}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
var toolbar_bank_invoice_pay_filter = [
|
||||||
|
{view: 'richselect', id: 'filter_invoice_pay_year', label: 'Año',
|
||||||
|
labelAlign: 'right', labelWidth: 50, width: 150, options: []},
|
||||||
|
{view: 'richselect', id: 'filter_invoice_pay_month', label: 'Mes',
|
||||||
|
labelAlign: 'right', labelWidth: 50, width: 200, options: months},
|
||||||
|
{view: 'daterangepicker', id: 'filter_invoice_pay_dates', label: 'Fechas',
|
||||||
|
labelAlign: 'right', width: 300},
|
||||||
|
{},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
var controls_banco_retiro = [
|
var controls_banco_retiro = [
|
||||||
{view: 'toolbar', elements: toolbar_banco_retiro},
|
{view: 'toolbar', elements: toolbar_banco_retiro},
|
||||||
{cols: [
|
{cols: [
|
||||||
|
@ -401,6 +483,13 @@ var controls_bank_pay = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
var controls_bank_invoice_pay = [
|
||||||
|
{view: 'toolbar', elements: toolbar_bank_invoice_pay},
|
||||||
|
{view: 'toolbar', elements: toolbar_bank_invoice_pay_filter},
|
||||||
|
grid_bank_invoice_pay
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
var form_banco_retiro = {
|
var form_banco_retiro = {
|
||||||
type: 'space',
|
type: 'space',
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
@ -440,6 +529,19 @@ var form_bank_pay = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var form_bank_invoice_pay = {
|
||||||
|
type: 'space',
|
||||||
|
responsive: true,
|
||||||
|
cols: [{
|
||||||
|
view: 'form',
|
||||||
|
id: 'form_bank_invoice_pay',
|
||||||
|
complexData: true,
|
||||||
|
scroll: true,
|
||||||
|
elements: controls_bank_invoice_pay,
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var multi_bancos = {
|
var multi_bancos = {
|
||||||
id: 'multi_bancos',
|
id: 'multi_bancos',
|
||||||
animate: true,
|
animate: true,
|
||||||
|
@ -452,7 +554,8 @@ var multi_bancos = {
|
||||||
]},
|
]},
|
||||||
{id: 'banco_retiro', rows: [form_banco_retiro]},
|
{id: 'banco_retiro', rows: [form_banco_retiro]},
|
||||||
{id: 'banco_deposito', rows: [form_banco_deposito]},
|
{id: 'banco_deposito', rows: [form_banco_deposito]},
|
||||||
{id: 'bank_pay', rows: [form_bank_pay]}
|
{id: 'bank_pay', rows: [form_bank_pay]},
|
||||||
|
{id: 'bank_invoice_pay', rows: [form_bank_invoice_pay]}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,14 @@ var controls_others = [
|
||||||
label: 'Nombre Comercial: '},
|
label: 'Nombre Comercial: '},
|
||||||
{view: 'text', id: 'telefonos', name: 'telefonos', label: 'Teléfonos: '},
|
{view: 'text', id: 'telefonos', name: 'telefonos', label: 'Teléfonos: '},
|
||||||
{view: 'text', id: 'web', name: 'web', label: 'Página Web: '},
|
{view: 'text', id: 'web', name: 'web', label: 'Página Web: '},
|
||||||
|
{cols: [
|
||||||
{view: 'text', id: 'correo_facturas', name: 'correo_facturas',
|
{view: 'text', id: 'correo_facturas', name: 'correo_facturas',
|
||||||
label: 'Correos para Facturas: ', tooltip: 'Separados por comas',
|
label: 'Correos para Facturas: ', tooltip: 'Separados por comas',
|
||||||
bottomLabel: 'Uno o más correos electrónicos separados por comas'},
|
bottomLabel: 'Uno o más correos electrónicos separados por comas'},
|
||||||
|
{view: 'text', id: 'partner_email_fp', name: 'partner_email_fp',
|
||||||
|
label: 'Para Facturas de pago: ', tooltip: 'Separados por comas',
|
||||||
|
bottomLabel: 'Uno o más correos electrónicos separados por comas'},
|
||||||
|
]},
|
||||||
{cols: [
|
{cols: [
|
||||||
{view: 'checkbox', id: 'es_cliente', name: 'es_cliente',
|
{view: 'checkbox', id: 'es_cliente', name: 'es_cliente',
|
||||||
label: 'Es Cliente: ', value: true, width: 180},
|
label: 'Es Cliente: ', value: true, width: 180},
|
||||||
|
|
Loading…
Reference in New Issue