1598 - Validar a partir do lançamento de registros a planilha da TLK
This commit is contained in:
@@ -64,12 +64,15 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
var lib = libService.loadScript('lib_cadastro_padrao');
|
||||
var retorno = lib.fncLimpaCampos(config);
|
||||
engine.getField('percentualSocio')['setValue(java.lang.String)'](null);
|
||||
engine.getField('socios')['setValue(java.lang.Object)'](null);
|
||||
engine.getField('socioLista').getContainerDataSource().removeAllItems();
|
||||
engine.getField('socioPercentual').getContainerDataSource().removeAllItems();
|
||||
engine.getField('twinUsuario')["setValue(java.lang.Object)"](null);
|
||||
engine.getField('idPesquisaLista')['setValue(java.lang.String)'](null);
|
||||
};
|
||||
|
||||
var habilitaCampos = function(lHabilita){
|
||||
|
||||
var botaoNovo = engine.getWidgetController('btnNovo').getButton();
|
||||
var botaoSalvar = engine.getWidgetController('btnSalvar').getButton();
|
||||
var botaoExcluir = engine.getWidgetController('btnExcluir').getButton();
|
||||
@@ -95,7 +98,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
|
||||
engine.getField('idChave').setEnabled(false);
|
||||
|
||||
engine.getField('listaPrincipal').refresh();
|
||||
engine.getField('listaPrincipal').refresh();
|
||||
};
|
||||
|
||||
var novoRegistro = function() {
|
||||
@@ -107,7 +110,6 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
//engine.getWidgetController('btnVoltar').getButton().setVisible(true);
|
||||
engine.getField('idPesquisaLista')['setValue(java.lang.String)'](null);
|
||||
engine.getField('listaPrincipal').refresh();
|
||||
engine.getField('idPesquisa')['setValue(java.lang.Object)'](null);
|
||||
|
||||
engine.getField('idChave').focus();
|
||||
|
||||
@@ -124,13 +126,17 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
var containerPercentual = engine.getField("socioPercentual").getContainerDataSource();
|
||||
var containerSocio = engine.getField("socioLista").getContainerDataSource();
|
||||
dbVitruvio.query(sql).each(function (r) {
|
||||
containerSocio.addItem(r.nome).getItemProperty("caption").setValue(r.nome);
|
||||
containerPercentual.addItem(r.nome).getItemProperty("caption").setValue(String(r.participacao));
|
||||
if (r.nome) {
|
||||
containerSocio.addItem(r.nome).getItemProperty("caption").setValue(r.nome);
|
||||
containerPercentual.addItem(r.nome).getItemProperty("caption").setValue(String(r.participacao));
|
||||
}
|
||||
});
|
||||
sql = "Select codigo_usuario from operacao_usuario where codigo_operacao = " + id;
|
||||
var ids = new java.util.ArrayList();
|
||||
dbVitruvio.query(sql).each(function (r) {
|
||||
ids.add(r.codigo_usuario);
|
||||
if (r.codigo_usuario) {
|
||||
ids.add(r.codigo_usuario);
|
||||
}
|
||||
});
|
||||
engine.getField('twinUsuario').setValue(ids);
|
||||
|
||||
@@ -172,6 +178,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
return false;
|
||||
} else {
|
||||
if (engine.getField('idChave').getValue()) {
|
||||
//engine.getField('idPesquisa')['setValue(java.lang.Object)'](null);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -184,8 +191,8 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
var config = engine.getGlobalVariable('config');
|
||||
var titulo = config['painel'].titulo;
|
||||
var icone = config['painel'].icone;
|
||||
engine.getLabel('Descricaocadastro').setValue('<img align="middle" alt="" src="'+ icone + '" width="68" /><font color="Gray" face="Calibri" size="6" > ' + titulo + '</font>');
|
||||
engine.getLabel('DescricaocadastroDentro').setValue('<img align="middle" alt="" src="'+ icone + '" width="68" /><font color="Gray" face="Calibri" size="6" > ' + titulo + '</font>');
|
||||
engine.getLabel('Descricaocadastro').setValue('<p align="center"><img align="left" alt="" src="'+ icone + '" width="56" /><p align="center"><font color="Gray" face="Calibri" size="6" > ' + titulo + '</font></p></p>');
|
||||
engine.getLabel('DescricaocadastroDentro').setValue('<p align="center"><img align="left" alt="" src="'+ icone + '" width="56" /><p align="center"><font color="Gray" face="Calibri" size="6" > ' + titulo + '</font></p></p>');
|
||||
engine.setGlobalVariable('novoRegistro', novoRegistro);
|
||||
engine.setGlobalVariable('carregarCampos', carregarCampos);
|
||||
engine.setGlobalVariable('habilitaCampos', habilitaCampos);
|
||||
@@ -215,7 +222,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
<VerticalLayout spacing="false" margin="false" height="100%" width="100%" align="TOP_LEFT" >
|
||||
<Panel width="100%" caption="" height="100%" expandRatio="1" margin="false" id="pnlTitulo" align="TOP_LEFT" >
|
||||
<VerticalLayout width="100%" expandRatio="1" margin="true">
|
||||
<Label id="Descricaocadastro" contentMode="HTML" align="MIDDLE_CENTER" > </Label>
|
||||
<Label id="Descricaocadastro" contentMode="HTML" align="MIDDLE_CENTER" width="100%" > </Label>
|
||||
<TextField id="idPesquisaLista" caption="Digite aqui para pesquisar:" type="string" width="100%" visible="true" immediate="true">
|
||||
<events>
|
||||
<valueChange>
|
||||
@@ -367,7 +374,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
|
||||
<Panel width="100%" height="100%" expandRatio="1" caption="" margin="false" id="pnlInclusao">
|
||||
<VerticalLayout width="100%" margin="true">
|
||||
<Label id="DescricaocadastroDentro" contentMode="HTML" align="MIDDLE_CENTER"> </Label>
|
||||
<Label id="DescricaocadastroDentro" contentMode="HTML" align="MIDDLE_CENTER" width="100%" > </Label>
|
||||
<TabLayout height="100%" width="100%">
|
||||
<Tab caption="Dados" >
|
||||
<VerticalLayout width="70%" margin="true" spacing="true">
|
||||
@@ -401,7 +408,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
function run() {
|
||||
engine.getGlobalVariable('fncLimpaCampos')();
|
||||
//engine.getGlobalVariable('fncLimpaCampos')();
|
||||
engine.getGlobalVariable('carregarCampos')(engine.getField('idPesquisa').getValue());
|
||||
}
|
||||
]]>
|
||||
@@ -426,15 +433,12 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
<datasource>
|
||||
<freeQuery connection-key="vitruvio">
|
||||
<![CDATA[
|
||||
Select nome from socios where not exists (Select 1 from operacao_socio where codigo_operacao = ${op}) and despesas_particulares = 0
|
||||
Select nome from socios where codigo > 0
|
||||
]]>
|
||||
</freeQuery>
|
||||
</datasource>
|
||||
<key-field>NOME</key-field>
|
||||
<caption-field>NOME</caption-field>
|
||||
<bind>
|
||||
<parameter value-type="number" defaultValue="-1" parameterName="op" field-ref="idChave" />
|
||||
</bind>
|
||||
</DBComboBox>
|
||||
<DecimalField caption="% Participação" expandRatio="0.2" maximumValue="100" maxLength="6" type="decimal" id="percentualSocio" width="100%" align="TOP_LEFT" description="Percentual de participação do sócio" />
|
||||
<ButtonWidget id="btnPercentual" description="Adicionar percentual" height="25" align="BOTTOM_LEFT" >
|
||||
@@ -467,6 +471,8 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
if (total <= 100.00) {
|
||||
containerSocio.addItem(engine.getField('socios').getValue()).getItemProperty("caption").setValue(engine.getField('socios').getValue());
|
||||
containerPercentual.addItem(engine.getField('socios').getValue()).getItemProperty("caption").setValue(String(engine.getField('percentualSocio').getValue()));
|
||||
engine.getField('percentualSocio')['setValue(java.lang.String)'](null);
|
||||
engine.getField('socios')['setValue(java.lang.Object)'](null);
|
||||
} else {
|
||||
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Percentual não pode ultrapassar 100%.');
|
||||
}
|
||||
@@ -516,7 +522,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
<Tab caption="Usuários">
|
||||
<Tab caption="Usuários" visible="false">
|
||||
<VerticalLayout margin="false" width="100%" >
|
||||
<Label id="lb2">
|
||||
<value>
|
||||
@@ -612,15 +618,17 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
});
|
||||
|
||||
var u = engine.getField('twinUsuario').getValue();
|
||||
var i = u.iterator();
|
||||
while (i.hasNext()) {
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "insert into operacao_usuario (codigo,codigo_operacao,codigo_usuario) values (" + dbVitruvio.getSequenceNextValSql('operacao_usuario_seq') + ",:operacao,:usuario)";
|
||||
this.update(sql, {
|
||||
operacao: Number(retorno),
|
||||
usuario: Number(i.next())
|
||||
});
|
||||
});
|
||||
if (u) {
|
||||
var i = u.iterator();
|
||||
while (i.hasNext()) {
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "insert into operacao_usuario (codigo,codigo_operacao,codigo_usuario) values (" + dbVitruvio.getSequenceNextValSql('operacao_usuario_seq') + ",:operacao,:usuario)";
|
||||
this.update(sql, {
|
||||
operacao: Number(retorno),
|
||||
usuario: Number(i.next())
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (retorno) {
|
||||
@@ -633,13 +641,12 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
<ButtonWidget caption="Novo" id="btnNovo" expandRatio="0.2" description="Descarta os dados atuais e deixa o formulário pronto para receber um novo cadastro" align="MIDDLE_CENTER">
|
||||
<ButtonWidget caption="Novo" id="btnNovo" expandRatio="0.2" description="Novo cadastro" align="MIDDLE_CENTER">
|
||||
<onClickScript language="JavaScript">
|
||||
<![CDATA[
|
||||
function run() {
|
||||
//engine.setGlobalVariable('painelLista',0);
|
||||
//engine.getGlobalVariable('novoRegistro')();
|
||||
engine.debug(engine.getField('twinUsuario').getValue());
|
||||
engine.setGlobalVariable('painelLista',0);
|
||||
engine.getGlobalVariable('novoRegistro')();
|
||||
}
|
||||
]]>
|
||||
</onClickScript>
|
||||
|
||||
Reference in New Issue
Block a user