diff --git a/source/app/models/main.py b/source/app/models/main.py
index b7112b8..8c72e33 100644
--- a/source/app/models/main.py
+++ b/source/app/models/main.py
@@ -1933,11 +1933,13 @@ class MovimientosBanco(BaseModel):
.select(
MovimientosBanco.id,
MovimientosBanco.fecha,
+ SATFormaPago.name.alias('way_payment'),
MovimientosBanco.numero_operacion,
MovimientosBanco.descripcion,
MovimientosBanco.retiro,
MovimientosBanco.deposito,
MovimientosBanco.saldo)
+ .join(SATFormaPago).switch(MovimientosBanco)
.where(filtros)
.dicts()
)
diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js
index 09e7656..21ca59a 100644
--- a/source/static/js/controller/bancos.js
+++ b/source/static/js/controller/bancos.js
@@ -1,3 +1,20 @@
+//~ Empresa Libre
+//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
+//~
+//~ This program is free software: you can redistribute it and/or modify
+//~ it under the terms of the GNU General Public License as published by
+//~ the Free Software Foundation, either version 3 of the License, or
+//~ (at your option) any later version.
+//~
+//~ This program is distributed in the hope that it will be useful,
+//~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+//~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//~ GNU General Public License for more details.
+//~
+//~ You should have received a copy of the GNU General Public License
+//~ along with this program. If not, see .
+
+
var msg = ''
var msg_importe = ''
@@ -7,6 +24,7 @@ var bancos_controllers = {
$$('lst_cuentas_banco').attachEvent('onChange', lst_cuentas_banco_change)
$$('cmd_agregar_retiro').attachEvent('onItemClick', cmd_agregar_retiro_click)
$$('cmd_agregar_deposito').attachEvent('onItemClick', cmd_agregar_deposito_click)
+ $$('cmd_complemento_pago').attachEvent('onItemClick', cmd_complemento_pago_click)
$$('cmd_guardar_retiro').attachEvent('onItemClick', cmd_guardar_retiro_click)
$$('cmd_guardar_deposito').attachEvent('onItemClick', cmd_guardar_deposito_click)
$$('cmd_cancelar_movimiento').attachEvent('onItemClick', cmd_cancelar_movimiento_click)
@@ -666,8 +684,50 @@ function filter_cuenta_change(){
get_estado_cuenta()
}
+
function filter_cuenta_dates_change(range){
if(range.start != null && range.end != null){
get_estado_cuenta(range)
}
-}
\ No newline at end of file
+}
+
+
+function set_data_pay(row){
+ var form = $$('form_banco_pagos')
+ var dt = row.fecha.split(' ')
+
+ set_way_payment('pay_way_payment')
+ var wp = table_waypayment.findOne({'value': row.way_payment})
+
+ form.setValues({
+ id_mov: row.id,
+ pay_date: dt[0],
+ pay_time: dt[1],
+ pay_reference: row.numero_operacion,
+ pay_way_payment: wp.id,
+ pay_import: row.deposito,
+ pay_description: row.descripcion
+ })
+}
+
+
+function cmd_complemento_pago_click(){
+ var grid = $$('grid_cuentabanco')
+
+ var row = grid.getSelectedItem()
+ if(row == undefined){
+ msg_error('Selecciona un movimiento de depósito')
+ return
+ }
+ if(row.descripcion == 'Saldo inicial'){
+ msg_error('No es posible generar un pago del Saldo Inicial')
+ return
+ }
+ if(row.deposito == 0){
+ msg_error('Selecciona un movimiento de depósito')
+ return
+ }
+
+ set_data_pay(row)
+ $$('multi_bancos').setValue('banco_pagos')
+}
diff --git a/source/static/js/controller/main.js b/source/static/js/controller/main.js
index 004011f..de96b83 100644
--- a/source/static/js/controller/main.js
+++ b/source/static/js/controller/main.js
@@ -39,6 +39,8 @@ function configuracion_inicial(){
add_config({'key': 'decimales_precios', 'value': values.decimales_precios})
})
+ get_way_payment()
+
}
diff --git a/source/static/js/controller/util.js b/source/static/js/controller/util.js
index 7340349..822a985 100644
--- a/source/static/js/controller/util.js
+++ b/source/static/js/controller/util.js
@@ -1,3 +1,20 @@
+//~ Empresa Libre
+//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
+//~
+//~ This program is free software: you can redistribute it and/or modify
+//~ it under the terms of the GNU General Public License as published by
+//~ the Free Software Foundation, either version 3 of the License, or
+//~ (at your option) any later version.
+//~
+//~ This program is distributed in the hope that it will be useful,
+//~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+//~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//~ GNU General Public License for more details.
+//~
+//~ You should have received a copy of the GNU General Public License
+//~ along with this program. If not, see .
+
+
var PUBLICO = "Público en general";
var RFC_PUBLICO = "XAXX010101000";
var RFC_EXTRANJERO = "XEXX010101000";
@@ -16,6 +33,7 @@ var table_totals = db.addCollection('totals', {unique: ['tax']})
var table_series = db.addCollection('series')
var table_usocfdi = db.addCollection('usocfdi')
var table_relaciones = db.addCollection('relaciones')
+var table_waypayment = db.addCollection('waypayment')
var msg = ''
@@ -408,6 +426,21 @@ function get_forma_pago(control){
}
+function get_way_payment(){
+ webix.ajax().get('/values/formapago', {key: true}, function(text, data){
+ var values = data.json()
+ table_waypayment.clear()
+ table_waypayment.insert(values)
+ })
+}
+
+
+function set_way_payment(control){
+ var values = table_waypayment.chain().data()
+ $$(control).getList().parse(values)
+}
+
+
function validate_regexp(value, pattern){
re = new RegExp(pattern, 'i');
if(value.match(re)){
@@ -443,3 +476,7 @@ function pause(milliseconds) {
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
+
+
+//~ Revisado
+
diff --git a/source/static/js/ui/bancos.js b/source/static/js/ui/bancos.js
index b97128b..5d778b5 100644
--- a/source/static/js/ui/bancos.js
+++ b/source/static/js/ui/bancos.js
@@ -1,3 +1,18 @@
+//~ Empresa Libre
+//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
+//~
+//~ This program is free software: you can redistribute it and/or modify
+//~ it under the terms of the GNU General Public License as published by
+//~ the Free Software Foundation, either version 3 of the License, or
+//~ (at your option) any later version.
+//~
+//~ This program is distributed in the hope that it will be useful,
+//~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+//~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//~ GNU General Public License for more details.
+//~
+//~ You should have received a copy of the GNU General Public License
+//~ along with this program. If not, see .
var toolbar_banco = [
@@ -26,6 +41,9 @@ var toolbar_movimientos_banco = [
{view: 'button', id: 'cmd_agregar_deposito', label: 'Depósito',
type: 'iconButton', autowidth: true, icon: 'plus'},
{},
+ {view: 'button', id: 'cmd_complemento_pago', label: 'Complemento de Pago',
+ type: 'iconButton', autowidth: true, icon: 'file-code-o'},
+ {},
{view: 'button', id: 'cmd_cancelar_movimiento', label: 'Cancelar',
type: 'iconButton', autowidth: true, icon: 'ban'},
]
@@ -35,6 +53,7 @@ var grid_cuentabanco_cols = [
{id: 'id', header:'ID', hidden: true},
{id: 'fecha', header: 'Fecha', width: 150},
{id: 'numero_operacion', header: 'Referencia'},
+ {id: 'way_payment', header: 'Forma de Pago', hidden: true},
{id: 'descripcion', header: ['Descripción', {content: 'textFilter'}],
fillspace:true},
{id: 'retiro', header: ['Retiro', {content: 'numberFilter'}],
@@ -95,6 +114,51 @@ var grid_cfdi_este_deposito_cols = [
]
+var grid_cfdi_pago_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'], adjust: 'data',
+ sort: 'int', css: 'right', footer: {text: 'Facturas', colspan: 3}},
+ {id: "uuid", header: ["UUID"], adjust: "data",
+ sort:"string", hidden:true},
+ {id: "fecha", header: ["Fecha y Hora"],
+ adjust: "data", sort: "string"},
+ {id: "tipo_comprobante", header: ["Tipo"],
+ adjust: 'header', sort: 'string'},
+ {id: "estatus", header: ["Estatus"],
+ adjust: "data", sort:"string"},
+ {id: 'total_mn', header: ['Total M.N.'], width: 150, sort: 'int',
+ format: webix.i18n.priceFormat, css: 'right'},
+ {id: 'cliente', header: ['Razón Social'],
+ fillspace: true, sort: 'string', footer: {text: '$ 0.00', colspan: 2}},
+ {id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
+ {id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
+ {id: 'email', header: '', adjust: 'data', template: get_icon('email')}
+]
+
+
+var grid_pago_relacionadas_cols = [
+ {id: 'index', header: '#', adjust: 'data', css: 'right'},
+ {id: 'id', header: 'ID', hidden: true},
+ {id: 'serie', header: 'Serie', adjust: 'data'},
+ {id: 'folio', header: 'Folio', adjust: 'data', css: 'right'},
+ {id: 'uuid', header: 'UUID', width: 250, hidden: true},
+ {id: 'fecha', header: 'Fecha y Hora', width: 150, sort: 'date'},
+ {id: 'tipo_comprobante', header: 'Tipo', adjust: 'data'},
+ {id: 'estatus', header: 'Estatus', adjust: 'header'},
+ {id: 'cliente', header: ['Razón Social'], fillspace: true},
+ {id: 'total', header: ['Total'], width: 125, sort: 'int',
+ format: webix.i18n.priceFormat, css: 'right'},
+ {id: 'saldo', header: ['Saldo'], width: 125, sort: 'int',
+ format: webix.i18n.priceFormat, css: 'right'},
+ {id: 'importe', header: ['Este pago'], width: 125, sort: 'int',
+ format: webix.i18n.priceFormat, css: 'right', editor: 'text'},
+]
+
+
var grid_cfdi_por_pagar = {
view: 'datatable',
id: 'grid_cfdi_por_pagar',
@@ -139,6 +203,46 @@ var grid_cfdi_este_deposito = {
}
+var grid_cfdi_pago = {
+ view: 'datatable',
+ id: 'grid_cfdi_pago',
+ select: 'row',
+ autoConfig: false,
+ adjust: true,
+ autoheight: true,
+ resizeColumn: true,
+ headermenu: true,
+ columns: grid_cfdi_pago_cols,
+ on:{
+ 'data->onStoreUpdated':function(){
+ this.data.each(function(obj, i){
+ obj.index = i + 1
+ })
+ }
+ },
+}
+
+
+var grid_pago_relacionadas = {
+ view: 'datatable',
+ id: 'grid_pago_relacionadas',
+ select: 'row',
+ autoConfig: false,
+ adjust: true,
+ autoheight: true,
+ resizeColumn: true,
+ headermenu: true,
+ columns: grid_pago_relacionadas_cols,
+ on:{
+ 'data->onStoreUpdated':function(){
+ this.data.each(function(obj, i){
+ obj.index = i + 1
+ })
+ }
+ },
+}
+
+
var toolbar_banco_retiro = [
{view: 'label', label: 'Agregar retiro de banco'},
{},
@@ -159,6 +263,19 @@ var toolbar_banco_deposito = [
]
+var toolbar_banco_pagos = [
+ {view: 'label', label: 'Factura de pago'},
+ {},
+ {view: 'button', id: 'cmd_pago_timbrar', label: 'Timbrar',
+ type: 'iconButton', autowidth: true, icon: 'ticket'},
+ {view: 'button', id: 'cmd_pago_cancelar', label: 'Cancelar',
+ type: 'iconButton', autowidth: true, icon: 'ban'},
+ {},
+ {view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
+ icon: 'times-circle'}
+]
+
+
var controls_banco_retiro = [
{view: 'toolbar', elements: toolbar_banco_retiro},
{cols: [
@@ -229,6 +346,41 @@ var controls_banco_deposito = [
]
+var controls_banco_pagos = [
+ {view: 'toolbar', elements: toolbar_banco_pagos},
+ {view: 'label', label: 'Este depósito: '},
+ {cols: [
+ {view: 'datepicker', id: 'pay_date', name: 'pay_date',
+ label: 'Fecha', format: '%d-%M-%Y', labelAlign: 'right',
+ required: true, invalidMessage: 'Selecciona una fecha',
+ labelWidth: 125, readonly: true},
+ {view: 'search', id: 'pay_time', name: 'pay_time', label: 'Hora',
+ icon: 'clock-o', labelAlign: 'right', required: true,
+ readonly: true,
+ invalidMessage: 'Captura una hora'},
+ {view: 'text', id: 'pay_reference', name: 'pay_reference',
+ label: 'Referencia', labelAlign: 'right', readonly: true},
+ ]},
+ {cols: [
+ {view: 'richselect', id: 'pay_way_payment', readonly: false,
+ name: 'pay_way_payment', label: 'Forma de Pago', required: true,
+ options: [], labelWidth: 125, labelAlign: 'right'},
+ {view: 'currency', type: 'text', id: 'pay_import', name: 'pay_import',
+ label: 'Importe', labelAlign: 'right', required: true, readonly: true,
+ invalidMessage: 'Captura un valor númerico', inputAlign: 'right'}
+ ]},
+ {cols: [
+ {view: 'textarea', id: 'pay_description', label: 'Descripción',
+ name: 'pay_description', labelAlign: 'right', required: true,
+ labelWidth: 125, height: 70, readonly: true},
+ ]},
+ {view: 'label', label: 'Facturas de pago de este depósito: '},
+ grid_cfdi_pago,
+ {view: 'label', label: 'Facturas relacionadas en este pago: '},
+ grid_pago_relacionadas
+]
+
+
var form_banco_retiro = {
type: 'space',
responsive: true,
@@ -255,6 +407,19 @@ var form_banco_deposito = {
}
+var form_banco_pagos = {
+ type: 'space',
+ responsive: true,
+ cols: [{
+ view: 'form',
+ id: 'form_banco_pagos',
+ complexData: true,
+ scroll: true,
+ elements: controls_banco_pagos,
+ }],
+}
+
+
var multi_bancos = {
id: 'multi_bancos',
animate: true,
@@ -266,7 +431,8 @@ var multi_bancos = {
grid_cuentabanco,
]},
{id: 'banco_retiro', rows: [form_banco_retiro]},
- {id: 'banco_deposito', rows: [form_banco_deposito]}
+ {id: 'banco_deposito', rows: [form_banco_deposito]},
+ {id: 'banco_pagos', rows: [form_banco_pagos]}
],
}
diff --git a/source/static/js/ui/invoices.js b/source/static/js/ui/invoices.js
index af3e8e8..516bdc2 100644
--- a/source/static/js/ui/invoices.js
+++ b/source/static/js/ui/invoices.js
@@ -1,5 +1,5 @@
//~ Empresa Libre
-//~ Copyright (C) 2018 Mauricio Baeza Servin (web@correolibre.net)
+//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
//~
//~ This program is free software: you can redistribute it and/or modify
//~ it under the terms of the GNU General Public License as published by