|
@@ -85,7 +85,7 @@
|
|
|
if (!self.eiruAccountBankUtatementUtility.length)
|
|
|
return [];
|
|
|
|
|
|
- var fields = ['id','name', 'active', 'import_statement_payslip'];
|
|
|
+ var fields = ['id','name', 'active', 'import_statement_payslip', 'import_statement_payslip'];
|
|
|
var domain = [['active', '=', true]];
|
|
|
var statementConfig = new openerp.web.Model('account.bank.statement.config');
|
|
|
return statementConfig.query(fields).filter(domain).all();
|
|
@@ -93,21 +93,10 @@
|
|
|
/* Description: Función para recalcular las faltas */
|
|
|
recomputeSheet: function() {
|
|
|
var self = this;
|
|
|
- var defer = $.Deferred();
|
|
|
var recomputePayslip = new openerp.web.Model('hr.payslip');
|
|
|
-
|
|
|
- recomputePayslip.call('recompute_sheet',[ self.id ], {
|
|
|
+ return recomputePayslip.call('recompute_sheet',[ self.id ], {
|
|
|
context: new openerp.web.CompoundContext()
|
|
|
- }).then(function(results) {
|
|
|
- defer.resolve(results);
|
|
|
});
|
|
|
-
|
|
|
- return defer;
|
|
|
- // var self = this;
|
|
|
- // var recomputePayslip = new openerp.web.Model('hr.payslip');
|
|
|
- // return recomputePayslip.call('recompute_sheet',[ self.id ], {
|
|
|
- // context: new openerp.web.CompoundContext()
|
|
|
- // });
|
|
|
},
|
|
|
/* Description: Función para remover el modal */
|
|
|
removeModal: function() {
|
|
@@ -160,6 +149,7 @@
|
|
|
self.resCurrency = [];
|
|
|
self.payslipInput =[];
|
|
|
},
|
|
|
+
|
|
|
/*******************************************************************************************
|
|
|
Crear Adealnto / comision de Funcionario
|
|
|
_ _ _ _ ____ _ _
|
|
@@ -388,11 +378,8 @@
|
|
|
}).then(function(resultsPayslip){
|
|
|
self.removeModal(e);
|
|
|
defer.resolve(resultsPayslip);
|
|
|
- // results = resultsPayslip;
|
|
|
});
|
|
|
|
|
|
- // defer.resolve(results);
|
|
|
- // console.log(defer);
|
|
|
return defer;
|
|
|
});
|
|
|
/* Close modal */
|
|
@@ -411,9 +398,15 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- /* ---------------------------------------------------------------------
|
|
|
- ** Description: Recalcular Nominas
|
|
|
- ** -------------------------------------------------------------------*/
|
|
|
+ /***********************************************************************************
|
|
|
+ Recalcular Nominas
|
|
|
+ ____ _ _ _ ____ _ _
|
|
|
+ | _ \ ___ ___ __ _| | ___ _ _| | __ _| |_ ___ | _ \ __ _ _ _ ___| (_)_ __
|
|
|
+ | |_) / _ \/ __/ _` | |/ __| | | | |/ _` | __/ _ \ | |_) / _` | | | / __| | | '_ \
|
|
|
+ | _ < __/ (_| (_| | | (__| |_| | | (_| | || __/ | __/ (_| | |_| \__ \ | | |_) |
|
|
|
+ |_| \_\___|\___\__,_|_|\___|\__,_|_|\__,_|\__\___| |_| \__,_|\__, |___/_|_| .__/
|
|
|
+ |___/ |_|
|
|
|
+ ************************************************************************************/
|
|
|
fetchRecomputeSheet: function() {
|
|
|
var self = this;
|
|
|
self.$el.find('.refresh-advancement').attr("disabled", true);
|
|
@@ -424,9 +417,15 @@
|
|
|
self.reloadLine();
|
|
|
});
|
|
|
},
|
|
|
- /* ---------------------------------------------------------------------
|
|
|
- ** Description: Editar/Remover Faltas
|
|
|
- ** -------------------------------------------------------------------*/
|
|
|
+
|
|
|
+ /****************************************************************************
|
|
|
+ Editar/Borrar Comisión
|
|
|
+ _ _ ____ ____ _ _
|
|
|
+ | | | || _ \ / ___|___ _ __ ___ _ __ ___ (_)___ ___(_) ___ _ __ ___
|
|
|
+ | | | || | | | | | / _ \| '_ ` _ \| '_ ` _ \| / __/ __| |/ _ \| '_ \/ __|
|
|
|
+ | |_| || |_| | | |__| (_) | | | | | | | | | | | \__ \__ \ | (_) | | | \__ \
|
|
|
+ \___(_)____(_) \____\___/|_| |_| |_|_| |_| |_|_|___/___/_|\___/|_| |_|___/
|
|
|
+ ****************************************************************************/
|
|
|
/* Description: Funcion Inicial Modify/Unlink Faltas*/
|
|
|
fetchModifyAdvancement: function() {
|
|
|
var self = this;
|
|
@@ -693,9 +692,15 @@
|
|
|
});
|
|
|
return defer;
|
|
|
},
|
|
|
- /* ---------------------------------------------------------------------
|
|
|
- * Description : Imprimir adelanto y comisión de funcionario
|
|
|
- * -------------------------------------------------------------------*/
|
|
|
+
|
|
|
+ /*********************************************************************************************************
|
|
|
+ Imprimir adelanto y comisión de funcionario
|
|
|
+ _ _ _ _
|
|
|
+ / \ __| |_ ____ _ _ __ ___ ___ ___ ___ ___ _ __ ___ _ __ ___ (_)___ ___(_) ___ _ __ ___
|
|
|
+ / _ \ / _` \ \ / / _` | '_ \ / __/ _ \/ __| / __/ _ \| '_ ` _ \| '_ ` _ \| / __/ __| |/ _ \| '_ \/ __|
|
|
|
+ / ___ \ (_| |\ V / (_| | | | | (_| __/\__ \ | (_| (_) | | | | | | | | | | | \__ \__ \ | (_) | | | \__ \
|
|
|
+ /_/ \_\__,_| \_/ \__,_|_| |_|\___\___||___/ \___\___/|_| |_| |_|_| |_| |_|_|___/___/_|\___/|_| |_|___/
|
|
|
+ **********************************************************************************************************/
|
|
|
/* Description : Metodo Inicial de imprecion */
|
|
|
fetchPrintAdvancement: function(type, title) {
|
|
|
var self = this;
|
|
@@ -965,13 +970,19 @@
|
|
|
}
|
|
|
return moneda;
|
|
|
},
|
|
|
- /*---------------------------------------------------------------------
|
|
|
- * Description: Exportar los adelanto en Registro de caja
|
|
|
- * -------------------------------------------------------------------*/
|
|
|
+
|
|
|
+ /***********************************************************************************
|
|
|
+ Exportar los adelanto en Registro de caja
|
|
|
+ _____ _ ____ _ _ _
|
|
|
+ | ____|_ ___ __ ___ _ __| |_ / ___|| |_ __ _| |_ ___ _ __ ___ ___ _ __ | |_
|
|
|
+ | _| \ \/ / '_ \ / _ \| '__| __| \___ \| __/ _` | __/ _ \ '_ ` _ \ / _ \ '_ \| __|
|
|
|
+ | |___ > <| |_) | (_) | | | |_ ___) | || (_| | || __/ | | | | | __/ | | | |_
|
|
|
+ |_____/_/\_\ .__/ \___/|_| \__| |____/ \__\__,_|\__\___|_| |_| |_|\___|_| |_|\__|
|
|
|
+ |_|
|
|
|
+ **********************************************************************************/
|
|
|
/* Description : Metodo Inicial de Exportar adelanto en caja*/
|
|
|
fetchExportCash: function() {
|
|
|
var self = this;
|
|
|
-
|
|
|
self.fetchPayslipInput().then(function(payslipInput) {
|
|
|
return payslipInput;
|
|
|
}).then(function(payslipInput) {
|
|
@@ -988,6 +999,15 @@
|
|
|
return self.fetchResCurrecy();
|
|
|
}).then(function(resCurrency) {
|
|
|
self.resCurrency = resCurrency;
|
|
|
+ return self.fetchVerifyModule('eiru_account_bank_statement_utility');
|
|
|
+ }).then(function(eiruAccountBankUtatementUtility) {
|
|
|
+ self.eiruAccountBankUtatementUtility = eiruAccountBankUtatementUtility;
|
|
|
+ return self.fetchStatementConfig();
|
|
|
+ }).then(function(statementConfig) {
|
|
|
+ self.statementConfig = statementConfig;
|
|
|
+ return self.fetchStatementAvailable();
|
|
|
+ }).then(function(statementAvailable) {
|
|
|
+ self.statementAvailable = statementAvailable;
|
|
|
return self.joinInputAdvancement();
|
|
|
});
|
|
|
},
|
|
@@ -1028,15 +1048,23 @@
|
|
|
showModalAdvancementExportCash: function(payslipInput){
|
|
|
var self = this;
|
|
|
var row_export;
|
|
|
+ var journal = self.accountJournal;
|
|
|
|
|
|
- if (payslipInput.length === 0){
|
|
|
+ if (!!journal) {
|
|
|
+ journal.unshift({
|
|
|
+ 'id': '',
|
|
|
+ 'name': ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (payslipInput.length === 0) {
|
|
|
openerp.web.notification.do_warn("Atención","No existe adelanto para importar en caja");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var modalAdvancementExportCash = QWeb.render('EiruAdvancementExportCash', {
|
|
|
inputAdvancement: payslipInput,
|
|
|
- journal: self.accountJournal
|
|
|
+ journal: journal
|
|
|
});
|
|
|
|
|
|
$('.openerp_webclient_container').after(modalAdvancementExportCash);
|
|
@@ -1046,17 +1074,22 @@
|
|
|
$('.expired-account-modal').on('hidden.bs.modal', function (e) {
|
|
|
self.removeModal(e);
|
|
|
});
|
|
|
- //
|
|
|
+
|
|
|
+ /* Variable */
|
|
|
var advancement_details = $('.expired-account-modal').find('.advancement-details');
|
|
|
var advancement_amount = $('.expired-account-modal').find('.advancement-amount');
|
|
|
- var current_journal = $('.expired-account-modal').find('.current-journal');
|
|
|
- // var journal_ref = $('.expired-account-modal').find('.journal-ref');
|
|
|
+ var current_journal = $('.expired-account-modal').find('.advancement-journal');
|
|
|
+ var advancementStatement = $('.expired-account-modal').find('.advancement-statement');
|
|
|
+ /* bottom*/
|
|
|
var advancement_export = $('.expired-account-modal').find('.advancement-export');
|
|
|
+
|
|
|
+ /* Table */
|
|
|
var tableRow = $('.expired-account-modal').find('.table-tbody').find('tr');
|
|
|
+
|
|
|
// Deshabilitar Campos
|
|
|
current_journal.attr("disabled", true);
|
|
|
- // journal_ref.attr("disabled", true);
|
|
|
advancement_export.attr("disabled", true);
|
|
|
+
|
|
|
/* Seleccionar fila */
|
|
|
tableRow.click(function (e) {
|
|
|
row_export = $(e.target);
|
|
@@ -1069,33 +1102,60 @@
|
|
|
self.row_id_select = parseInt($(e.target).closest('tr').children()[0].textContent);
|
|
|
// Habilitar Campos
|
|
|
current_journal.removeAttr("disabled");
|
|
|
- // journal_ref.removeAttr("disabled");
|
|
|
advancement_export.removeAttr("disabled");
|
|
|
+ /* Limpiar */
|
|
|
+ current_journal.val('');
|
|
|
+ advancementStatement.empty();
|
|
|
current_journal.focus();
|
|
|
});
|
|
|
+
|
|
|
+ /* Journal Selected */
|
|
|
+ current_journal.change(function(e) {
|
|
|
+ $('.expired-account-modal').find('.statement-open').css('display','none');
|
|
|
+ advancementStatement.empty();
|
|
|
+
|
|
|
+ if (!!current_journal.val() && !!self.eiruAccountBankUtatementUtility.length && !!self.statementConfig.length && !!self.statementAvailable.length) {
|
|
|
+ var statement = self.getStatementeJournal(parseInt(current_journal.val()));
|
|
|
+ if (!!statement.length && self.statementConfig[0].import_statement_payslip === 'manual_import') {
|
|
|
+ $('.expired-account-modal').find('.statement-open').css('display','flex');
|
|
|
+ advancementStatement.append('<option value=""></option>');
|
|
|
+ _.each(statement, function(item) {
|
|
|
+ advancementStatement.append('<option value="' + item.id + '">' + item.name+" - "+moment(item.date).format("DD-MM-YYYY")+ '</option>');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
// clic en botón exportar
|
|
|
advancement_export.click(function() {
|
|
|
- if (!current_journal.val()){
|
|
|
- openerp.web.notification.do_warn("Atención","El método de pago es obligatorio");
|
|
|
+ /* Journal Selected */
|
|
|
+ if (!current_journal.val()) {
|
|
|
+ openerp.web.notification.do_warn("Atención","Tiene que seleccionar el método de pago para continuar.");
|
|
|
current_journal.focus();
|
|
|
current_journal.css('border-color','red');
|
|
|
return;
|
|
|
}
|
|
|
current_journal.css('border-color','#ccc');
|
|
|
|
|
|
- self.bankStatementImport(self.row_id_select, parseInt(current_journal.val()), journal_ref.val()).then(function(results){
|
|
|
+ var statement = self.getStatementeJournal(parseInt(current_journal.val()));
|
|
|
+ if (!!statement.length && !!self.eiruAccountBankUtatementUtility.length && !!self.statementConfig.length && !!self.statementAvailable.length) {
|
|
|
+ if (self.statementConfig[0].import_statement_payslip === 'manual_import' && !advancementStatement.val()) {
|
|
|
+ openerp.web.notification.do_warn("Atención","Tiene que seleccionar una caja para continuar.");
|
|
|
+ advancementStatement.focus();
|
|
|
+ advancementStatement.css('border-color','red');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ advancementStatement.css('border-color','#ccc');
|
|
|
+ }
|
|
|
+
|
|
|
+ self.bankStatementImport(self.row_id_select, parseInt(current_journal.val()), parseInt(advancementStatement.val())).then(function(results){
|
|
|
return results;
|
|
|
}).then(function() {
|
|
|
|
|
|
row_export.closest('td').closest('tr').remove();
|
|
|
-
|
|
|
current_journal.attr("disabled", true);
|
|
|
- // journal_ref.attr("disabled", true);
|
|
|
advancement_export.attr("disabled", true);
|
|
|
-
|
|
|
- // journal_ref.val('');
|
|
|
current_journal.val('');
|
|
|
-
|
|
|
+ advancementStatement.empty();
|
|
|
advancement_details.val('');
|
|
|
advancement_amount.val('0');
|
|
|
|
|
@@ -1103,23 +1163,20 @@
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- /* bank_statement_import*/
|
|
|
- bankStatementImport: function(id_imput, journal_id, journal_ref) {
|
|
|
+ /* bank_statement_import */
|
|
|
+ bankStatementImport: function(imputId, journalid, statementId) {
|
|
|
+ var self = this;
|
|
|
var payslip = new openerp.web.Model('hr.payslip');
|
|
|
- var defer = $.Deferred();
|
|
|
- payslip.call('bank_statement_import',
|
|
|
- [
|
|
|
+ return payslip.call('bank_statement_import',[
|
|
|
{
|
|
|
- 'id_imput': id_imput,
|
|
|
- 'journal_id': journal_id,
|
|
|
- // 'journal_ref': journal_ref
|
|
|
+ 'payslipId': self.id,
|
|
|
+ 'imputId': imputId,
|
|
|
+ 'journalid': journalid,
|
|
|
+ 'statementId': statementId
|
|
|
}
|
|
|
],{
|
|
|
- context: new openerp.web.CompoundContext()
|
|
|
- }).then(function(results) {
|
|
|
- defer.resolve(results)
|
|
|
+ context: new openerp.web.CompoundContext()
|
|
|
});
|
|
|
- return defer;
|
|
|
},
|
|
|
});
|
|
|
|