Merge branch 'develop'

Error #282
This commit is contained in:
Mauricio Baeza 2018-09-27 00:37:29 -05:00
commit 2e98d69685
12 changed files with 104 additions and 26 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]
----------------------
- Fix - Al generar factura de pago con documentos relacionados en otras monedas

View File

@ -1 +1 @@
1.17.0
1.18.0

View File

@ -102,7 +102,7 @@ botón de comando ***Solo marcar pagada***.
![Nuevo retiro](img/03/bancos_010.png)
* No captures ningún dato del formulario, solo selecciona la factura a marcar como pagada.
* **IMPORTANTE**: Solo marca facturas pagadas que **estes 100% seguro que NO requeriras generarle Factura de pago**
* **IMPORTANTE**: Solo marca facturas pagadas que **estes 100% seguro que NO requeriras generarle Factura de pago** y que no esten relacionadas con ningún depósito.
Al dar clic en el botón de comando ***Solo marcar pagada***, debes confirmar la
acción.
@ -231,7 +231,7 @@ personalizar completamente esta plantilla.
### Facturas de pago con facturas en otras monedas
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)
@ -265,5 +265,36 @@ Ahora si, puedes generar la ***Factura de Pago*** de este depósito.
![Factura de pago](img/03/bancos_027.png)
<BR>
### Cuenta de banco y facturas relacionadas en otras monedas
Cuando la cuenta de banco no este en M.N (MXN) y los documentos relacionados
esten en la misma moneda de la cuenta de banco, el procedimiento para generar
la factura de pago es:
Los campos que debes de modificar en la tabla ***Facturas a pagar en este depósito*** son:
* **Este pago**: Si el valor pagado es el total de la factura, no lo modifiques, si es parcial, captura el valor pagado **en la moneda del documento**, en este ejemplo, en UDS. Este valor se usa para el estado de cuenta de la factura.
* **Este Pago USD**: Captura el valor pagado en la moneda de la cuenta bancaria. En este ejemplo, sería el valor **real** del depósito. Este valor se usará para la ***Factura de pago***.
* **T.C.**: Siempre debe ser 1.00 al ser la misma moneda de la cuente bancaria y del documento.
Ahora, el tipo de cambio del movimiento, **si debes de capturarlo**, es el tipo de
cambio de la moneda de la cuenta en relación con la M.N (MXN). Este valor se usará
para la ***Factura de pago***.
![Factura de pago](img/03/bancos_028.png)
Guarda con el botón de comando ***+ Guardar Depósito***. Se te preguntara para
confirmar la acción. **Asegurate que todos los datos sean correctos** y de que
la cantidad y las facturas relacionadas son correctas.
Si todo esta bien, el nuevo movimiento será agregado a la cuenta y actualizado
el saldo de la misma.
Ahora si, puedes generar la ***Factura de Pago*** de este depósito.
![Factura de pago](img/03/bancos_029.png)
[1]: /administracion/#agregar-cuenta-bancaria
[2]: /administracion/#complementos

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -6,8 +6,11 @@ siempre actualizado.** Solo se da soporte sobre la ultima versión de **Empresa
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]
----------------------
- Fix - Al generar factura de pago con documentos relacionados en otras monedas
- Fix - Al generar factura de pago sin serie en documentos relacionados
- 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, \
CANCEL_SIGNATURE, PUBLIC, DEFAULT_SERIE_TICKET, CURRENT_CFDI_NOMINA, \
DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP, MV, DECIMALES_PRECIOS, \
DEFAULT_CFDIPAY
DEFAULT_CFDIPAY, CURRENCY_MN
FORMAT = '{0:.2f}'
@ -1921,6 +1921,7 @@ class MovimientosBanco(BaseModel):
values['cuenta'] = int(values['cuenta'])
values['retiro'] = util.get_float(values['retiro'])
values['deposito'] = util.get_float(values['deposito'])
values['tipo_cambio'] = util.get_float(values['tipo_cambio'])
values['forma_pago'] = int(values['forma_pago'])
ultimo_saldo = self._ultimo_saldo(
@ -5688,6 +5689,8 @@ class CfdiPagos(BaseModel):
'Monto': FORMAT.format(mov.deposito),
'relacionados': related_docs,
}
if currency != CURRENCY_MN:
pagos['TipoCambioP'] = FORMAT_TAX.format(mov.tipo_cambio)
complementos = {'pagos': pagos}
data = {

View File

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

View File

@ -17,7 +17,6 @@
var msg = ''
var msg_importe = ''
//~ var is_mn = true
var current_currency = ''
var current_way_payment = ''
@ -36,6 +35,7 @@ function init_config_bank(){
g2.showColumn('type_change')
}
show('cmd_complemento_pago', get_config('used_cfdi_pays'))
//~ show('cmd_show_invoice_pay', get_config('used_cfdi_pays'))
set_year_month()
}
@ -237,6 +237,8 @@ function get_facturas_por_pagar(){
function cmd_agregar_retiro_click(){
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')
}
@ -248,6 +250,9 @@ function cmd_agregar_deposito_click(){
var g = $$('grid_cfdi_este_deposito')
g.config.columns[g.getColumnIndex('importe')].header = 'Este Pago ' + current_currency
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')
}
@ -401,20 +406,14 @@ function actualizar_deposito(grid){
descripcion += 'Pago de la factura: ' + obj.serie + obj.folio + ' del '
descripcion += 'cliente: ' + obj.cliente + '\n'
if(obj.importe == undefined){
//~ if(is_mn){
//~ obj.importe = obj.total_mn
//~ }else{
obj.importe = obj.saldo
obj.this_pay = obj.saldo
}
suma += obj.importe.to_float()
if(obj.type_change == undefined){
if(obj.currency==CURRENCY_MN){
if(obj.currency==CURRENCY_MN || obj.currency==current_currency){
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){
var grid = $$('grid_cfdi_este_deposito')
var importe = values.deposito_importe.to_float()
var type_change = values.deposit_type_change.to_float()
var msg_tc = ''
if(!importe){
@ -546,6 +546,14 @@ function validate_deposito(values){
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()
if(values.deposito_fecha > today){
msg = 'Fecha inválida, es una fecha futura'
@ -588,7 +596,7 @@ function validate_deposito(values){
}
suma += tmp
if(obj.currency!='MXN'){
if(obj.currency!=CURRENCY_MN && obj.currency!=current_currency){
if(obj.type_change==undefined){
msg_tc = 'Captura el Tipo de Cambio'
}else{
@ -634,6 +642,7 @@ function guardar_deposito(values){
data['numero_operacion'] = values.deposito_referencia.trim()
data['forma_pago'] = $$('lst_deposito_forma_pago').getValue()
data['deposito'] = values.deposito_importe.to_float()
data['tipo_cambio'] = values.deposit_type_change.to_float()
data['retiro'] = 0.0
data['descripcion'] = values.deposito_descripcion
@ -642,7 +651,6 @@ function guardar_deposito(values){
if(grid.count()){
var ids = new Object()
grid.data.each(function(obj){
//~ ids[obj.id] = obj.importe.to_float()
ids[obj.id] = {
'this_pay': obj.this_pay.to_float(),
'importe': obj.importe.to_float(),
@ -650,7 +658,6 @@ function guardar_deposito(values){
}
})
data['ids'] = ids
//~ showvar(data['ids'])
}
webix.ajax().post('/movbanco', data, {

View File

@ -145,8 +145,6 @@ Number.prototype.round = function(decimals){
String.prototype.is_number = function(){
return /^\d+$/.test(this)
}
String.prototype.to_float = function(){
return get_float(this)
}
@ -212,7 +210,6 @@ webix.protoUI({
$setValue:function(value, raw){
this.config.raw = value
if(!raw){
//~ value = webix.i18n.priceFormat(value)
value = format_currency(value)
}
this.getInputNode().value = value
@ -220,6 +217,31 @@ webix.protoUI({
}, 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({
refresh:function(master, node, value){
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',
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',
type: 'iconButton', autowidth: true, icon: 'ban'},
@ -257,8 +259,7 @@ var grid_pay_related = {
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',
type: 'iconButton', autowidth: true, icon: 'minus'},
{view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
@ -267,8 +268,7 @@ var toolbar_banco_retiro = [
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',
type: 'iconButton', autowidth: true, icon: 'plus'},
{view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
@ -343,7 +343,11 @@ var controls_banco_deposito = [
{view: 'currency', type: 'text', id: 'txt_deposito_importe',
name: 'deposito_importe', label: 'Importe', labelAlign: 'right',
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: [
{view: 'textarea', id: 'deposito_descripcion', label: 'Descripción',

View File

@ -60,6 +60,7 @@ var menu_user = {
var link_forum = "<a class='link_forum' target='_blank' href='https://gitlab.com/mauriciobaeza/empresa-libre/issues'>Foro de Soporte</a>";
var link_doc = "<a class='link_doc' target='_blank' href='https://doc.empresalibre.net'><b>?</b> </a>";
var ui_main = {
@ -72,10 +73,11 @@ var ui_main = {
},
{view: 'label', id: 'lbl_title_main', label: '<b>Empresa Libre</b>'},
{view: 'label', id: 'lbl_forum', label: link_forum, align: 'right'},
{view: 'label', id: 'lbl_doc', label: link_doc, align: 'left', width: 25},
menu_user,
{view: 'button', id: 'cmd_update_timbres', type: 'icon', width: 45,
css: 'app_button', icon: 'bell-o', badge: 0},
{view: 'button', type: 'icon', width: 45, css: 'app_button',
{view: 'button', type: 'icon', width: 30, css: 'app_button',
icon: 'cogs', id: 'cmd_ir_al_admin', hidden: true,
click: 'cmd_ir_al_admin_click'}
]