This commit is contained in:
Mauricio Baeza 2018-09-26 23:22:29 -05:00
parent 43a50b833f
commit a7d0339660
9 changed files with 69 additions and 24 deletions

View File

@ -1,3 +1,8 @@
v 1.18.0 [27-sep-2018]
----------------------
- Fix #282 Factura de pago en otras monedas
v 1.17.0 [25-sep-2018] v 1.17.0 [25-sep-2018]
---------------------- ----------------------
- Fix - Al generar factura de pago con documentos relacionados en otras monedas - Fix - Al generar factura de pago con documentos relacionados en otras monedas

View File

@ -1 +1 @@
1.17.0 1.18.0

View File

@ -231,7 +231,7 @@ personalizar completamente esta plantilla.
### Facturas de pago con facturas en otras monedas ### Facturas de pago con facturas en otras monedas
Cuando el sistema detecta que se están usando más de una moneda, automáticamente Cuando el sistema detecta que se están usando más de una moneda, automáticamente
te mostrarás las columnas del ***Total*** y la ***Moneda*** respectiva. te mostrará las columnas del ***Total*** y la ***Moneda*** respectiva.
![Factura de pago](img/03/bancos_023.png) ![Factura de pago](img/03/bancos_023.png)

View File

@ -6,8 +6,11 @@ siempre actualizado.** Solo se da soporte sobre la ultima versión de **Empresa
Libre**. Libre**.
### 1.18.0 [27-sep-2018]
- Fix [#282](https://gitlab.com/mauriciobaeza/empresa-libre/issues/282) Factura de pago en otras monedas
### 1.17.0 [25-sep-2018] ### 1.17.0 [25-sep-2018]
----------------------
- Fix - Al generar factura de pago con documentos relacionados en otras monedas - Fix - Al generar factura de pago con documentos relacionados en otras monedas
- Fix - Al generar factura de pago sin serie en documentos relacionados - Fix - Al generar factura de pago sin serie en documentos relacionados
- Fix [#278](https://gitlab.com/mauriciobaeza/empresa-libre/issues/278) - Fix [#278](https://gitlab.com/mauriciobaeza/empresa-libre/issues/278)

View File

@ -35,7 +35,7 @@ from settings import log, DEBUG, VERSION, PATH_CP, COMPANIES, PRE, CURRENT_CFDI,
INIT_VALUES, DEFAULT_PASSWORD, DECIMALES, IMPUESTOS, DEFAULT_SAT_PRODUCTO, \ INIT_VALUES, DEFAULT_PASSWORD, DECIMALES, IMPUESTOS, DEFAULT_SAT_PRODUCTO, \
CANCEL_SIGNATURE, PUBLIC, DEFAULT_SERIE_TICKET, CURRENT_CFDI_NOMINA, \ CANCEL_SIGNATURE, PUBLIC, DEFAULT_SERIE_TICKET, CURRENT_CFDI_NOMINA, \
DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP, MV, DECIMALES_PRECIOS, \ DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP, MV, DECIMALES_PRECIOS, \
DEFAULT_CFDIPAY DEFAULT_CFDIPAY, CURRENCY_MN
FORMAT = '{0:.2f}' FORMAT = '{0:.2f}'
@ -1921,6 +1921,7 @@ class MovimientosBanco(BaseModel):
values['cuenta'] = int(values['cuenta']) values['cuenta'] = int(values['cuenta'])
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['tipo_cambio'])
values['forma_pago'] = int(values['forma_pago']) values['forma_pago'] = int(values['forma_pago'])
ultimo_saldo = self._ultimo_saldo( ultimo_saldo = self._ultimo_saldo(
@ -5688,6 +5689,8 @@ class CfdiPagos(BaseModel):
'Monto': FORMAT.format(mov.deposito), 'Monto': FORMAT.format(mov.deposito),
'relacionados': related_docs, 'relacionados': related_docs,
} }
if currency != CURRENCY_MN:
pagos['TipoCambioP'] = FORMAT_TAX.format(mov.tipo_cambio)
complementos = {'pagos': pagos} complementos = {'pagos': pagos}
data = { data = {

View File

@ -47,7 +47,7 @@ except ImportError:
DEBUG = DEBUG DEBUG = DEBUG
VERSION = '1.17.0' VERSION = '1.18.0'
EMAIL_SUPPORT = ('soporte@empresalibre.net',) EMAIL_SUPPORT = ('soporte@empresalibre.net',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
@ -181,3 +181,4 @@ DEFAULT_SAT_NOMINA = {
API = 'https://api.empresalibre.net{}' API = 'https://api.empresalibre.net{}'
CURRENCY_MN = 'MXN'

View File

@ -17,7 +17,6 @@
var msg = '' var msg = ''
var msg_importe = '' var msg_importe = ''
//~ var is_mn = true
var current_currency = '' var current_currency = ''
var current_way_payment = '' var current_way_payment = ''
@ -36,6 +35,7 @@ function init_config_bank(){
g2.showColumn('type_change') g2.showColumn('type_change')
} }
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'))
set_year_month() set_year_month()
} }
@ -237,6 +237,8 @@ function get_facturas_por_pagar(){
function cmd_agregar_retiro_click(){ function cmd_agregar_retiro_click(){
get_bancos_forma_pago(true) get_bancos_forma_pago(true)
var title = 'Agregar retiro de banco a la cuenta ' + $$('lst_cuentas_banco').getText() + ' en ' + $$('txt_cuenta_moneda').getValue()
$$('title_bank_retiro').setValue(title)
$$('multi_bancos').setValue('banco_retiro') $$('multi_bancos').setValue('banco_retiro')
} }
@ -248,6 +250,9 @@ function cmd_agregar_deposito_click(){
var g = $$('grid_cfdi_este_deposito') var g = $$('grid_cfdi_este_deposito')
g.config.columns[g.getColumnIndex('importe')].header = 'Este Pago ' + current_currency g.config.columns[g.getColumnIndex('importe')].header = 'Este Pago ' + current_currency
g.refreshColumns() g.refreshColumns()
show('deposit_type_change', current_currency!=CURRENCY_MN)
var title = 'Agregar depósito de banco a la cuenta ' + $$('lst_cuentas_banco').getText() + ' en ' + $$('txt_cuenta_moneda').getValue()
$$('title_bank_deposit').setValue(title)
$$('multi_bancos').setValue('banco_deposito') $$('multi_bancos').setValue('banco_deposito')
} }
@ -401,20 +406,14 @@ function actualizar_deposito(grid){
descripcion += 'Pago de la factura: ' + obj.serie + obj.folio + ' del ' descripcion += 'Pago de la factura: ' + obj.serie + obj.folio + ' del '
descripcion += 'cliente: ' + obj.cliente + '\n' descripcion += 'cliente: ' + obj.cliente + '\n'
if(obj.importe == undefined){ if(obj.importe == undefined){
//~ if(is_mn){
//~ obj.importe = obj.total_mn
//~ }else{
obj.importe = obj.saldo obj.importe = obj.saldo
obj.this_pay = obj.saldo obj.this_pay = obj.saldo
} }
suma += obj.importe.to_float() suma += obj.importe.to_float()
if(obj.type_change == undefined){ if(obj.type_change == undefined){
if(obj.currency==CURRENCY_MN){ if(obj.currency==CURRENCY_MN || obj.currency==current_currency){
obj.type_change = 1.00 obj.type_change = 1.00
} }
//~ else{
//~ obj.type_change = get_type_change(obj.currency)
//~ }
} }
}) })
@ -526,6 +525,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 msg_tc = '' var msg_tc = ''
if(!importe){ if(!importe){
@ -546,6 +546,14 @@ function validate_deposito(values){
return false return false
} }
if(grid.count() && current_currency!=CURRENCY_MN){
if(type_change <= 1.0){
msg = 'El Tipo de Cambio debe ser mayor a 1.00'
msg_error(msg)
return false
}
}
var today = new Date() var today = new Date()
if(values.deposito_fecha > today){ if(values.deposito_fecha > today){
msg = 'Fecha inválida, es una fecha futura' msg = 'Fecha inválida, es una fecha futura'
@ -588,7 +596,7 @@ function validate_deposito(values){
} }
suma += tmp suma += tmp
if(obj.currency!='MXN'){ if(obj.currency!=CURRENCY_MN && obj.currency!=current_currency){
if(obj.type_change==undefined){ if(obj.type_change==undefined){
msg_tc = 'Captura el Tipo de Cambio' msg_tc = 'Captura el Tipo de Cambio'
}else{ }else{
@ -634,6 +642,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['retiro'] = 0.0 data['retiro'] = 0.0
data['descripcion'] = values.deposito_descripcion data['descripcion'] = values.deposito_descripcion
@ -642,7 +651,6 @@ function guardar_deposito(values){
if(grid.count()){ if(grid.count()){
var ids = new Object() var ids = new Object()
grid.data.each(function(obj){ grid.data.each(function(obj){
//~ ids[obj.id] = obj.importe.to_float()
ids[obj.id] = { ids[obj.id] = {
'this_pay': obj.this_pay.to_float(), 'this_pay': obj.this_pay.to_float(),
'importe': obj.importe.to_float(), 'importe': obj.importe.to_float(),
@ -650,7 +658,6 @@ function guardar_deposito(values){
} }
}) })
data['ids'] = ids data['ids'] = ids
//~ showvar(data['ids'])
} }
webix.ajax().post('/movbanco', data, { webix.ajax().post('/movbanco', data, {

View File

@ -145,8 +145,6 @@ Number.prototype.round = function(decimals){
String.prototype.is_number = function(){ String.prototype.is_number = function(){
return /^\d+$/.test(this) return /^\d+$/.test(this)
} }
String.prototype.to_float = function(){ String.prototype.to_float = function(){
return get_float(this) return get_float(this)
} }
@ -212,7 +210,6 @@ webix.protoUI({
$setValue:function(value, raw){ $setValue:function(value, raw){
this.config.raw = value this.config.raw = value
if(!raw){ if(!raw){
//~ value = webix.i18n.priceFormat(value)
value = format_currency(value) value = format_currency(value)
} }
this.getInputNode().value = value this.getInputNode().value = value
@ -220,6 +217,31 @@ webix.protoUI({
}, webix.ui.text) }, webix.ui.text)
webix.protoUI({
$cssName: "text",
name: "currency4",
$init:function(){
this.attachEvent("onItemClick", function(){
this.$setValue(this.config.raw, true)
this.getInputNode().select()
})
this.attachEvent("onBlur", function(){
this.$setValue(this.config.value)
})
},
$render:function(){
this.$setValue(this.config.value)
},
$setValue:function(value, raw){
this.config.raw = value
if(!raw){
value = format_currency4(value)
}
this.getInputNode().value = value
}
}, webix.ui.text)
webix.ui.datafilter.countRows = webix.extend({ webix.ui.datafilter.countRows = webix.extend({
refresh:function(master, node, value){ refresh:function(master, node, value){
node.firstChild.innerHTML = master.count(); node.firstChild.innerHTML = master.count();

View File

@ -43,6 +43,8 @@ var toolbar_movimientos_banco = [
{}, {},
{view: 'button', id: 'cmd_complemento_pago', label: 'Factura de Pago', {view: 'button', id: 'cmd_complemento_pago', label: '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',
type: 'iconButton', autowidth: true, icon: 'table', hidden: true},
{}, {},
{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'},
@ -257,8 +259,7 @@ var grid_pay_related = {
var toolbar_banco_retiro = [ var toolbar_banco_retiro = [
{view: 'label', label: 'Agregar retiro de banco'}, {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',
type: 'iconButton', autowidth: true, icon: 'minus'}, type: 'iconButton', autowidth: true, icon: 'minus'},
{view: 'icon', click: '$$("multi_bancos").setValue("banco_home")', {view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
@ -267,8 +268,7 @@ var toolbar_banco_retiro = [
var toolbar_banco_deposito = [ var toolbar_banco_deposito = [
{view: 'label', label: 'Agregar depósito de banco'}, {view: 'label', label: 'Agregar depósito de banco', id: 'title_bank_deposit'},
{},
{view: 'button', id: 'cmd_guardar_deposito', label: 'Guardar Depósito', {view: 'button', id: 'cmd_guardar_deposito', label: 'Guardar Depósito',
type: 'iconButton', autowidth: true, icon: 'plus'}, type: 'iconButton', autowidth: true, icon: 'plus'},
{view: 'icon', click: '$$("multi_bancos").setValue("banco_home")', {view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
@ -343,7 +343,11 @@ var controls_banco_deposito = [
{view: 'currency', type: 'text', id: 'txt_deposito_importe', {view: 'currency', type: 'text', id: 'txt_deposito_importe',
name: 'deposito_importe', label: 'Importe', labelAlign: 'right', name: 'deposito_importe', label: 'Importe', labelAlign: 'right',
required: true, invalidMessage: 'Captura un valor númerico', required: true, invalidMessage: 'Captura un valor númerico',
inputAlign: 'right', value: ''} inputAlign: 'right', value: ''},
{view: 'currency4', type: 'text', id: 'deposit_type_change',
name: 'deposit_type_change', label: 'T.C.', labelAlign: 'right',
required: false, invalidMessage: 'Captura un valor númerico',
inputAlign: 'right', value: '1.0000', width: 175, hidden: true}
]}, ]},
{cols: [ {cols: [
{view: 'textarea', id: 'deposito_descripcion', label: 'Descripción', {view: 'textarea', id: 'deposito_descripcion', label: 'Descripción',