1609 - DRE
This commit is contained in:
@@ -44,6 +44,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
importClass(Packages.java.util.Calendar);
|
importClass(Packages.java.util.Calendar);
|
||||||
importClass(Packages.br.com.davinti.base.vaadin.components.layout.MessageBox);
|
importClass(Packages.br.com.davinti.base.vaadin.components.layout.MessageBox);
|
||||||
importClass(Packages.com.vaadin.ui.Notification);
|
importClass(Packages.com.vaadin.ui.Notification);
|
||||||
|
importClass(Packages.com.vaadin.server.FontAwesome);
|
||||||
|
|
||||||
|
|
||||||
var getDataAtual = function() {
|
var getDataAtual = function() {
|
||||||
@@ -62,6 +63,10 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
var lib = libService.loadScript('lib_cadastro_padrao');
|
var lib = libService.loadScript('lib_cadastro_padrao');
|
||||||
var retorno = lib.fncLimpaCampos(config);
|
var retorno = lib.fncLimpaCampos(config);
|
||||||
|
engine.getField('percentualSocio')['setValue(java.lang.String)'](null);
|
||||||
|
engine.getField('socioLista').getContainerDataSource().removeAllItems();
|
||||||
|
engine.getField('socioPercentual').getContainerDataSource().removeAllItems();
|
||||||
|
engine.getField('twinUsuario')["setValue(java.lang.Object)"](null);
|
||||||
};
|
};
|
||||||
|
|
||||||
var habilitaCampos = function(lHabilita){
|
var habilitaCampos = function(lHabilita){
|
||||||
@@ -113,6 +118,21 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
var lib = libService.loadScript('lib_cadastro_padrao');
|
var lib = libService.loadScript('lib_cadastro_padrao');
|
||||||
var sql = lib.fncCarregarCampos(config, id);
|
var sql = lib.fncCarregarCampos(config, id);
|
||||||
|
var sql = "Select s.nome, os.participacao from operacao_socio os inner join operacao o on o.codigo = os.codigo_operacao inner join socios s on s.codigo = os.codigo_socio where os.codigo_operacao = " + id;
|
||||||
|
var db = libService.loadScript('db');
|
||||||
|
var dbVitruvio = new db('vitruvio');
|
||||||
|
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));
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
engine.getField('twinUsuario').setValue(ids);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,10 +168,14 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
var db = libService.loadScript('db');
|
var db = libService.loadScript('db');
|
||||||
var dbVitruvio = new db('vitruvio');
|
var dbVitruvio = new db('vitruvio');
|
||||||
var row = dbVitruvio.queryRow(sql);
|
var row = dbVitruvio.queryRow(sql);
|
||||||
if (row.ct == 0) {
|
if (row.ct == 0 ) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true
|
if (engine.getField('idChave').getValue()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +194,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
engine.setGlobalVariable('deletarRegistro', deletarRegistro);
|
engine.setGlobalVariable('deletarRegistro', deletarRegistro);
|
||||||
engine.setGlobalVariable('validarDuplicidade', validarDuplicidade);
|
engine.setGlobalVariable('validarDuplicidade', validarDuplicidade);
|
||||||
engine.setGlobalVariable('painelLista',1);
|
engine.setGlobalVariable('painelLista',1);
|
||||||
|
engine.getField('socioPercentual').setEnabled(false);
|
||||||
|
|
||||||
//fncLimpaCampos();
|
//fncLimpaCampos();
|
||||||
habilitaCampos(false);
|
habilitaCampos(false);
|
||||||
@@ -178,6 +203,8 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
engine.getWidgetController('btnNovo').getButton().setIcon(IconFactory.instance().getIconAsResource(IconLibraryAPISmall.CRIAR));
|
engine.getWidgetController('btnNovo').getButton().setIcon(IconFactory.instance().getIconAsResource(IconLibraryAPISmall.CRIAR));
|
||||||
engine.getWidgetController('btnExcluir').getButton().setIcon(IconFactory.instance().getIconAsResource(IconLibraryAPISmall.REMOVER));
|
engine.getWidgetController('btnExcluir').getButton().setIcon(IconFactory.instance().getIconAsResource(IconLibraryAPISmall.REMOVER));
|
||||||
engine.getWidgetController('btnVoltar').getButton().setIcon(IconFactory.instance().getIconAsResource(IconLibraryAPISmall.VOLTAR));
|
engine.getWidgetController('btnVoltar').getButton().setIcon(IconFactory.instance().getIconAsResource(IconLibraryAPISmall.VOLTAR));
|
||||||
|
engine.getWidgetController('btnPercentual').getButton().setIcon(FontAwesome.PLUS);
|
||||||
|
engine.getWidgetController('btnRemoverPercentual').getButton().setIcon(FontAwesome.MINUS);
|
||||||
//engine.getFieldLocked('idAjuda', false); // pode ser erro no componente, aberto caso Eduardo = 20108
|
//engine.getFieldLocked('idAjuda', false); // pode ser erro no componente, aberto caso Eduardo = 20108
|
||||||
telaInicial();
|
telaInicial();
|
||||||
|
|
||||||
@@ -386,11 +413,134 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
<TextField type="number" id="idChave" width="100%" caption="Código" expandRatio="0.08" />
|
<TextField type="number" id="idChave" width="100%" caption="Código" expandRatio="0.08" />
|
||||||
<TextField type="string" id="idDescricao" text-transform="uppercase" caption="Descrição" required="true" width="100%" expandRatio="1" />
|
<TextField type="string" id="idDescricao" text-transform="uppercase" caption="Descrição" required="true" width="100%" expandRatio="1" />
|
||||||
</HorizontalLayout>
|
</HorizontalLayout>
|
||||||
|
<TabLayout compact="true" width="100%">
|
||||||
|
<Tab caption="Sócios">
|
||||||
|
<VerticalLayout spacing="true" width="100%">
|
||||||
|
<Label id="lb1" >
|
||||||
|
<value>
|
||||||
|
|
||||||
|
</value>
|
||||||
|
</Label>
|
||||||
|
<HorizontalLayout spacing="true" width="420">
|
||||||
|
<DBComboBox type="string" id="socios" caption="Sócio" width="100%" expandRatio="0.8" description="Selecione um sócio" allowNullSelection="true" searchCaption="Digite para localizar...">
|
||||||
|
<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
|
||||||
|
]]>
|
||||||
|
</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" >
|
||||||
|
<onClickScript language="JavaScript">
|
||||||
|
<![CDATA[
|
||||||
|
importClass(Packages.br.com.davinti.base.vaadin.components.layout.MessageBox);
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
var containerPercentual = engine.getField("socioPercentual").getContainerDataSource();
|
||||||
|
var containerSocio = engine.getField("socioLista").getContainerDataSource();
|
||||||
|
var ids = engine.getField('socioLista').getContainerDataSource().getItemIds();
|
||||||
|
var iter = ids.iterator();
|
||||||
|
var total = 0.00;
|
||||||
|
var definido = 0;
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
var value = iter.next();
|
||||||
|
if (engine.getField('socios').getValue() == value) {
|
||||||
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'O sócio já possui percentual definido.');
|
||||||
|
definido = 1;
|
||||||
|
}
|
||||||
|
total = parseFloat(total) + parseFloat(String(engine.getField('socioPercentual').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||||
|
}
|
||||||
|
if (engine.getField('socioPercentual').getContainerDataSource().getItem(value)) {
|
||||||
|
var valor = String(engine.getField('percentualSocio').getValue());
|
||||||
|
total = (parseFloat(total) + parseFloat(engine.getField('percentualSocio').getConvertedValue()));
|
||||||
|
} else {
|
||||||
|
total = engine.getField('percentualSocio').getConvertedValue();
|
||||||
|
}
|
||||||
|
if (definido == 0) {
|
||||||
|
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()));
|
||||||
|
} else {
|
||||||
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Percentual não pode ultrapassar 100%.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</onClickScript>
|
||||||
|
</ButtonWidget>
|
||||||
|
<ButtonWidget id="btnRemoverPercentual" description="Remover percentual" height="25" align="BOTTOM_LEFT" >
|
||||||
|
<onClickScript language="JavaScript">
|
||||||
|
<![CDATA[
|
||||||
|
importClass(Packages.br.com.davinti.base.vaadin.components.layout.MessageBox);
|
||||||
|
function run() {
|
||||||
|
var texto = engine.getField('socioLista').getValue();
|
||||||
|
if (texto != '') {
|
||||||
|
try {
|
||||||
|
var container = engine.getField("socioLista").getContainerDataSource();
|
||||||
|
container.removeItem(texto);
|
||||||
|
var container2 = engine.getField("socioPercentual").getContainerDataSource();
|
||||||
|
container2.removeItem(texto);
|
||||||
|
} catch(e) {
|
||||||
|
MessageBox.show('Alerta', 'Dados inválidos!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
]]>
|
||||||
|
</onClickScript>
|
||||||
|
</ButtonWidget>
|
||||||
|
</HorizontalLayout>
|
||||||
|
<HorizontalLayout width="420" >
|
||||||
|
<ListSelect type="string" id="socioLista" readOnly="true" width="100%" expandRatio="0.8" allowNullSelection="true" rows="5">
|
||||||
|
<events>
|
||||||
|
<valueChange>
|
||||||
|
<script language="JavaScript">
|
||||||
|
<![CDATA[
|
||||||
|
function run() {
|
||||||
|
engine.getField('socioPercentual').setValue(engine.getField('socioLista').getValue());
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
</valueChange>
|
||||||
|
</events>
|
||||||
|
</ListSelect>
|
||||||
|
<ListSelect type="string" id="socioPercentual" readOnly="true" width="100%" expandRatio="0.2" allowNullSelection="true" rows="5">
|
||||||
|
|
||||||
|
</ListSelect>
|
||||||
|
</HorizontalLayout>
|
||||||
|
</VerticalLayout>
|
||||||
|
</Tab>
|
||||||
|
<Tab caption="Usuários">
|
||||||
|
<VerticalLayout margin="false" width="100%" >
|
||||||
|
<Label id="lb2">
|
||||||
|
<value>
|
||||||
|
|
||||||
|
</value>
|
||||||
|
</Label>
|
||||||
|
<DBTwinColSelect type="number" id="twinUsuario" allowNullSelection="true" multivalue="true" width="70%" align="TOP_LEFT" >
|
||||||
|
<datasource>
|
||||||
|
<freeQuery connection-key="vitruvio">
|
||||||
|
<![CDATA[
|
||||||
|
Select usuario_id, nome from nauth.usuario where ativo = true
|
||||||
|
]]>
|
||||||
|
</freeQuery>
|
||||||
|
</datasource>
|
||||||
|
<key-field>USUARIO_ID</key-field>
|
||||||
|
<caption-field>NOME</caption-field>
|
||||||
|
</DBTwinColSelect>
|
||||||
|
</VerticalLayout>
|
||||||
|
</Tab>
|
||||||
|
</TabLayout>
|
||||||
</VerticalLayout>
|
</VerticalLayout>
|
||||||
</Tab>
|
</Tab>
|
||||||
</TabLayout>
|
</TabLayout>
|
||||||
</VerticalLayout>
|
</VerticalLayout>
|
||||||
|
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel width="100%" margin="false" id="pnlBotoes" >
|
<Panel width="100%" margin="false" id="pnlBotoes" >
|
||||||
<VerticalLayout width="100%" >
|
<VerticalLayout width="100%" >
|
||||||
@@ -404,17 +554,82 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
if (engine.getGlobalVariable('validarDuplicidade')(engine.getField('idDescricao').getValue())) {
|
if (engine.getGlobalVariable('validarDuplicidade')(engine.getField('idDescricao').getValue())) {
|
||||||
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe uma operação cadastrada com este nome.');
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe uma operação cadastrada com este nome.');
|
||||||
} else {
|
} else {
|
||||||
|
var containerSocio = engine.getField("socioLista").getContainerDataSource();
|
||||||
|
var containerPercentual = engine.getField("socioPercentual").getContainerDataSource();
|
||||||
|
var ids = engine.getField('socioLista').getContainerDataSource().getItemIds();
|
||||||
|
var iter = ids.iterator();
|
||||||
|
var total = 0.00;
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
var value = iter.next();
|
||||||
|
total = parseFloat(total) + parseFloat(String(engine.getField('socioPercentual').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (total != 100.00) {
|
||||||
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Percentual deve ser igual a 100%.');
|
||||||
|
} else {
|
||||||
|
|
||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
var id = engine.getField('idChave').getConvertedValue();
|
var id = engine.getField('idChave').getConvertedValue();
|
||||||
var lib = libService.loadScript('lib_cadastro_padrao');
|
var lib = libService.loadScript('lib_cadastro_padrao');
|
||||||
var retorno = lib.fncGravarRegistro(config, id);
|
var retorno = lib.fncGravarRegistro(config, id);
|
||||||
|
|
||||||
|
var db = libService.loadScript('db');
|
||||||
|
var dbVitruvio = new db('vitruvio');
|
||||||
|
var sql;
|
||||||
|
var socio;
|
||||||
|
var percentual;
|
||||||
|
var iter2 = ids.iterator();
|
||||||
|
|
||||||
|
dbVitruvio.transaction(function() {
|
||||||
|
sql = "delete from operacao_socio where codigo_operacao = :operacao";
|
||||||
|
this.update(sql, {
|
||||||
|
operacao: Number(retorno)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
while (iter2.hasNext()) {
|
||||||
|
var value = iter2.next();
|
||||||
|
var row = dbVitruvio.queryRow("Select codigo from socios where nome = '" + String(engine.getField('socioLista').getContainerDataSource().getItem(value)) + "'");
|
||||||
|
if (row.codigo) {
|
||||||
|
socio = row.codigo
|
||||||
|
}
|
||||||
|
percentual = parseFloat(String(engine.getField('socioPercentual').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||||
|
dbVitruvio.transaction(function() {
|
||||||
|
sql = "insert into operacao_socio (codigo,codigo_operacao,codigo_socio,participacao) values (" + dbVitruvio.getSequenceNextValSql('operacao_socios_seq') + ",:operacao,:socio,:participacao)";
|
||||||
|
this.update(sql, {
|
||||||
|
operacao: Number(retorno),
|
||||||
|
socio: Number(socio),
|
||||||
|
participacao: percentual
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dbVitruvio.transaction(function() {
|
||||||
|
sql = "delete from operacao_usuario where codigo_operacao = :operacao";
|
||||||
|
this.update(sql, {
|
||||||
|
operacao: Number(retorno)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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 (retorno) {
|
if (retorno) {
|
||||||
engine.getGlobalVariable('fncLimpaCampos')();
|
engine.getGlobalVariable('fncLimpaCampos')();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
]]>
|
]]>
|
||||||
</onClickScript>
|
</onClickScript>
|
||||||
</ButtonWidget>
|
</ButtonWidget>
|
||||||
@@ -422,8 +637,9 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
<onClickScript language="JavaScript">
|
<onClickScript language="JavaScript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
function run() {
|
function run() {
|
||||||
engine.setGlobalVariable('painelLista',0);
|
//engine.setGlobalVariable('painelLista',0);
|
||||||
engine.getGlobalVariable('novoRegistro')();
|
//engine.getGlobalVariable('novoRegistro')();
|
||||||
|
engine.debug(engine.getField('twinUsuario').getValue());
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
</onClickScript>
|
</onClickScript>
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
"nome" : "socios" ,
|
"nome" : "socios" ,
|
||||||
"sequence" : "socio_seq" ,
|
"sequence" : "socio_seq" ,
|
||||||
"idTabela" : "CODIGO",
|
"idTabela" : "CODIGO",
|
||||||
"campos" : ["CODIGO", "NOME" ],
|
"campos" : ["CODIGO", "NOME", "PERCENTUAL_PARTICIPACAO" ],
|
||||||
"camposTable" : ["CODIGO", "NOME" ]
|
"camposTable" : ["CODIGO", "NOME", "PERCENTUAL_PARTICIPACAO" ],
|
||||||
|
"condicao" : "CODIGO > 0"
|
||||||
|
|
||||||
},
|
},
|
||||||
"relaciona" : [ ["CODIGO","idChave","Number"] ,
|
"relaciona" : [ ["CODIGO","idChave","Number"] ,
|
||||||
["NOME","idDescricao","String"]
|
["NOME","idDescricao","String"],
|
||||||
|
["PERCENTUAL_PARTICIPACAO","idParticipacao","Number" ]
|
||||||
] ,
|
] ,
|
||||||
"validacaoExclusao" : [ ["SELECT 0 AS CONTAR FROM SOCIOS WHERE CODIGO = ", "Existem registros ligados a esta tabela"],
|
"validacaoExclusao" : [ ["SELECT 0 AS CONTAR FROM SOCIOS WHERE CODIGO = ", "Existem registros ligados a esta tabela"],
|
||||||
["SELECT COUNT(CHAVE_RESPONSAVEL) AS CONTAR FROM CONTROLE_DESPESAS_PESSOAIS WHERE CHAVE_RESPONSAVEL = ", "Existem registros ligados a esta tabela."]
|
["SELECT COUNT(CHAVE_RESPONSAVEL) AS CONTAR FROM CONTROLE_DESPESAS_PESSOAIS WHERE CHAVE_RESPONSAVEL = ", "Existem registros ligados a esta tabela."]
|
||||||
@@ -153,6 +155,18 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var validarPercentual = function(id) {
|
||||||
|
var sql = "Select sum(percentual_participacao) ct from socios where codigo <> " + id;
|
||||||
|
var db = libService.loadScript('db');
|
||||||
|
var dbVitruvio = new db('vitruvio');
|
||||||
|
var row = dbVitruvio.queryRow(sql);
|
||||||
|
if ((parseFloat(row.ct) + parseFloat(engine.getField('idParticipacao').getValue())) > 100) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
@@ -168,6 +182,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
engine.setGlobalVariable('deletarRegistro', deletarRegistro);
|
engine.setGlobalVariable('deletarRegistro', deletarRegistro);
|
||||||
engine.setGlobalVariable('validarDuplicidade', validarDuplicidade);
|
engine.setGlobalVariable('validarDuplicidade', validarDuplicidade);
|
||||||
engine.setGlobalVariable('painelLista',1);
|
engine.setGlobalVariable('painelLista',1);
|
||||||
|
engine.setGlobalVariable('validarPercentual',validarPercentual);
|
||||||
|
|
||||||
habilitaCampos(false);
|
habilitaCampos(false);
|
||||||
|
|
||||||
@@ -212,11 +227,14 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
"nome" : "socios" ,
|
"nome" : "socios" ,
|
||||||
"sequence" : "socio_seq" ,
|
"sequence" : "socio_seq" ,
|
||||||
"idTabela" : "CODIGO",
|
"idTabela" : "CODIGO",
|
||||||
"campos" : ["CODIGO", "NOME" ],
|
"campos" : ["CODIGO", "NOME", "PERCENTUAL_PARTICIPACAO" ],
|
||||||
"camposTable" : ["CODIGO", "NOME" ]
|
"camposTable" : ["CODIGO", "NOME", "PERCENTUAL_PARTICIPACAO" ],
|
||||||
|
"condicao" : "CODIGO > 0"
|
||||||
|
|
||||||
},
|
},
|
||||||
"relaciona" : [ ["CODIGO","idChave","Number"] ,
|
"relaciona" : [ ["CODIGO","idChave","Number"] ,
|
||||||
["NOME","idDescricao","String"]
|
["NOME","idDescricao","String"],
|
||||||
|
["PERCENTUAL_PARTICIPACAO","idParticipacao","Number"]
|
||||||
] ,
|
] ,
|
||||||
|
|
||||||
"validacaoExclusao" :
|
"validacaoExclusao" :
|
||||||
@@ -343,7 +361,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
<datasource>
|
<datasource>
|
||||||
<freeQuery connection-key="vitruvio">
|
<freeQuery connection-key="vitruvio">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
SELECT * FROM socios
|
SELECT * FROM socios WHERE CODIGO > 0
|
||||||
]]>
|
]]>
|
||||||
</freeQuery>
|
</freeQuery>
|
||||||
</datasource>
|
</datasource>
|
||||||
@@ -351,7 +369,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM socios
|
FROM socios
|
||||||
nome = ? ORDER BY codigo
|
nome = ? WHERE CODIGO > 0 ORDER BY codigo
|
||||||
]]>
|
]]>
|
||||||
</loadItemQuery>
|
</loadItemQuery>
|
||||||
<key-field>CODIGO</key-field>
|
<key-field>CODIGO</key-field>
|
||||||
@@ -380,7 +398,9 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
<HorizontalLayout spacing="true" width="100%">
|
<HorizontalLayout spacing="true" width="100%">
|
||||||
<TextField id="idChave" type="number" caption="Código" width="100%" expandRatio="0.08" />
|
<TextField id="idChave" type="number" caption="Código" width="100%" expandRatio="0.08" />
|
||||||
<TextField id="idDescricao" type="string" text-transform="uppercase" caption="Nome" required="true" width="100%" expandRatio="1" />
|
<TextField id="idDescricao" type="string" text-transform="uppercase" caption="Nome" required="true" width="100%" expandRatio="1" />
|
||||||
|
<DecimalField type="decimal" id="idParticipacao" caption="% Participação" maximumValue="100" maxLength="6" width="100%" expandRatio="0.15" />
|
||||||
</HorizontalLayout>
|
</HorizontalLayout>
|
||||||
|
<TextField id="idRateio" type="number" visible="false" />
|
||||||
</VerticalLayout>
|
</VerticalLayout>
|
||||||
</Tab>
|
</Tab>
|
||||||
</TabLayout>
|
</TabLayout>
|
||||||
@@ -400,6 +420,11 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
if ((engine.getGlobalVariable('validarDuplicidade')(engine.getField('idDescricao').getValue())) && (!engine.getField('idChave').getValue())) {
|
if ((engine.getGlobalVariable('validarDuplicidade')(engine.getField('idDescricao').getValue())) && (!engine.getField('idChave').getValue())) {
|
||||||
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe um sócio cadastrado com este nome.');
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe um sócio cadastrado com este nome.');
|
||||||
} else {
|
} else {
|
||||||
|
var socio = engine.getField('idChave').getValue();
|
||||||
|
if (!socio) {
|
||||||
|
socio = 0;
|
||||||
|
}
|
||||||
|
if (engine.getGlobalVariable('validarPercentual')(socio)) {
|
||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
var id = engine.getField('idChave').getConvertedValue();
|
var id = engine.getField('idChave').getConvertedValue();
|
||||||
var lib = libService.loadScript('lib_cadastro_padrao');
|
var lib = libService.loadScript('lib_cadastro_padrao');
|
||||||
@@ -408,6 +433,9 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
if (retorno) {
|
if (retorno) {
|
||||||
engine.getGlobalVariable('fncLimpaCampos')();
|
engine.getGlobalVariable('fncLimpaCampos')();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Percentual de participação dos sócios ultrapassa 100%.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
function run() {
|
function run() {
|
||||||
if (engine.isValid()) {
|
if (engine.isValid()) {
|
||||||
if (engine.getGlobalVariable('validarDuplicidade')(engine.getField('idDescricao').getValue())) {
|
if (engine.getGlobalVariable('validarDuplicidade')(engine.getField('idDescricao').getValue())) {
|
||||||
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe uma operação cadastrada com este nome.');
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe uma sub-categoria cadastrada com este nome.');
|
||||||
} else {
|
} else {
|
||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
var id = engine.getField('idChave').getConvertedValue();
|
var id = engine.getField('idChave').getConvertedValue();
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
|||||||
function run() {
|
function run() {
|
||||||
if (engine.isValid()) {
|
if (engine.isValid()) {
|
||||||
if (engine.getGlobalVariable('validarDuplicidade')(engine.getField('idPlaca').getValue())) {
|
if (engine.getGlobalVariable('validarDuplicidade')(engine.getField('idPlaca').getValue())) {
|
||||||
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe uma operação cadastrada com este nome.');
|
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Já existe um veículo cadastrado com este nome.');
|
||||||
} else {
|
} else {
|
||||||
var config = engine.getGlobalVariable('config');
|
var config = engine.getGlobalVariable('config');
|
||||||
var id = engine.getField('idChave').getConvertedValue();
|
var id = engine.getField('idChave').getConvertedValue();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -272,7 +272,7 @@
|
|||||||
</freeQuery>
|
</freeQuery>
|
||||||
</datasource>
|
</datasource>
|
||||||
<key-field>CODIGO</key-field>
|
<key-field>CODIGO</key-field>
|
||||||
<caption-field>NOME</caption-field>
|
<caption-field>RAZAO_SOCIAL</caption-field>
|
||||||
</DBComboBox>
|
</DBComboBox>
|
||||||
<DecimalField type="decimal" id="valor" caption="Valor (R$)" format="#,##0.00" required="true" description="Valor da despesa" width="100%" expandRatio="0.2" />
|
<DecimalField type="decimal" id="valor" caption="Valor (R$)" format="#,##0.00" required="true" description="Valor da despesa" width="100%" expandRatio="0.2" />
|
||||||
</HorizontalLayout>
|
</HorizontalLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user