2254 - Incluir Estado de Origem na aba de Impostos
Outra tarefa também vinculada a este painel: 2255 - Criar uma lista para os valores de frete;
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<panel-form xmlns="http://www.davinti.com.br/vitruvio/form/panel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbucket.org/davinTI/vitruvio-xds/raw/master/vitruvio-panel-form.xsd">
|
||||
<form formKey="formCadastroPadrao" height="100%" width="100%">
|
||||
@@ -13,11 +12,12 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
"nome" : "CLIENTES" ,
|
||||
"sequence" : "CLIENTES_SEQ" ,
|
||||
"idTabela" : "CODIGO",
|
||||
"campos" : ["CODIGO", "NOME" ],
|
||||
"camposTable" : ["CODIGO", "DESCRICAO"]
|
||||
"campos" : ["CODIGO", "NOME", "INATIVO" ],
|
||||
"camposTable" : ["CODIGO", "DESCRICAO", "INATIVO"]
|
||||
},
|
||||
"relaciona" : [ ["CODIGO","idChave","Number"] ,
|
||||
["NOME","idDescricao","String"]
|
||||
["NOME","idDescricao","String"] ,
|
||||
["INATIVO","idInativo","Boolean"]
|
||||
] ,
|
||||
"validacaoExclusao" : [ ["SELECT 0 AS CONTAR FROM CLIENTES WHERE CODIGO = ", "Existem registros ligados a esta tabela."],
|
||||
["SELECT COUNT(CHAVE_CLIENTE) AS CONTAR FROM CONTROLE_DESPESAS_OPERACIONAIS WHERE CHAVE_CLIENTE = ", "Existem registros ligados a esta tabela."],
|
||||
@@ -69,6 +69,10 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
engine.getField('socioPercentual').getContainerDataSource().removeAllItems();
|
||||
engine.getField('pracaLista').getContainerDataSource().removeAllItems();
|
||||
engine.getField('pracaPercentual').getContainerDataSource().removeAllItems();
|
||||
|
||||
engine.getField('pracaListaFrete').getContainerDataSource().removeAllItems();
|
||||
engine.getField('pracaFrete').getContainerDataSource().removeAllItems();
|
||||
|
||||
engine.getField('twinUsuario')["setValue(java.lang.Object)"](null);
|
||||
engine.getField('idPesquisaLista')['setValue(java.lang.String)'](null);
|
||||
};
|
||||
@@ -110,6 +114,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
engine.getLayout('pnlTitulo').getRootComposition().setVisible(false);
|
||||
engine.getLayout('pnlInclusao').getRootComposition().setVisible(true);
|
||||
//engine.getWidgetController('btnVoltar').getButton().setVisible(true);
|
||||
engine.getField('idInativo').setValue(false);
|
||||
engine.getField('idPesquisaLista')['setValue(java.lang.String)'](null);
|
||||
engine.getField('listaPrincipal').refresh();
|
||||
|
||||
@@ -142,15 +147,32 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
});
|
||||
engine.getField('twinUsuario').setValue(ids);
|
||||
|
||||
var sql = "Select e.nome, os.chave_estado, os.percentual_impostos from clientes_praca os inner join estados e on e.chave_estado = os.chave_estado where os.chave_cliente = " + id;
|
||||
var containerPercentual = engine.getField("pracaPercentual").getContainerDataSource();
|
||||
var sql = "Select (select nome from estados where chave_estado=os.chave_estado_origem) || ' - ' || (select nome from estados where chave_estado=os.chave_estado) as nome, ";
|
||||
sql += " os.chave_estado, to_char(os.percentual_impostos,'999G999G999D99') as percentual_impostos from clientes_praca os where os.chave_cliente = " + id;
|
||||
var containerSocio = engine.getField("pracaLista").getContainerDataSource();
|
||||
var containerPercentual = engine.getField("pracaPercentual").getContainerDataSource();
|
||||
|
||||
dbVitruvio.query(sql).each(function (r) {
|
||||
if (r.nome) {
|
||||
containerSocio.addItem(r.nome).getItemProperty("caption").setValue(r.nome);
|
||||
containerPercentual.addItem(r.nome).getItemProperty("caption").setValue(String(r.percentual_impostos));
|
||||
}
|
||||
});
|
||||
|
||||
//var sql = "Select chave_frete, descricao, to_char(os.valor_frete,'999G999G999D99') as valor_frete from clientes_frete os where os.chave_cliente = " + id;
|
||||
var sql = "Select chave_frete, descricao, os.valor_frete::varchar from clientes_frete os where os.chave_cliente = " + id;
|
||||
//var sql = "Select chave_frete, descricao, os.valor_frete from clientes_frete os where os.chave_cliente = " + id;
|
||||
//var sql = "Select chave_frete, descricao, ltrim(to_char(os.valor_frete,'999G999G999D99'),' ') as valor_frete from clientes_frete os where os.chave_cliente = " + id;
|
||||
var containerFreteLista = engine.getField("pracaListaFrete").getContainerDataSource();
|
||||
var containerFrete = engine.getField("pracaFrete").getContainerDataSource();
|
||||
|
||||
dbVitruvio.query(sql).each(function (r) {
|
||||
if (r.descricao) {
|
||||
containerFreteLista.addItem(r.descricao).getItemProperty("caption").setValue(r.descricao);
|
||||
//containerFrete.addItem(r.descricao).getItemProperty("caption").setValue(String(r.valor_frete));
|
||||
containerFrete.addItem(r.descricao).getItemProperty("caption").setValue(r.valor_frete);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var telaInicial = function() {
|
||||
@@ -166,7 +188,6 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
botaoSalvar.setVisible(false);
|
||||
botaoExcluir.setVisible(false);
|
||||
botaoVoltar.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
var deletarRegistro = function(id) {
|
||||
@@ -225,7 +246,14 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
engine.getWidgetController('btnRemoverPercentual').getButton().setIcon(FontAwesome.MINUS);
|
||||
engine.getWidgetController('btnPraca').getButton().setIcon(FontAwesome.PLUS);
|
||||
engine.getWidgetController('btnRemoverPraca').getButton().setIcon(FontAwesome.MINUS);
|
||||
engine.getWidgetController('btnFrete').getButton().setIcon(FontAwesome.PLUS);
|
||||
engine.getWidgetController('btnFreteRemover').getButton().setIcon(FontAwesome.MINUS);
|
||||
|
||||
//engine.getFieldLocked('idAjuda', false); // pode ser erro no componente, aberto caso Eduardo = 20108
|
||||
|
||||
engine.getField('valorImpostos').setValue(0);
|
||||
engine.getField('valorFrete').setValue(0);
|
||||
|
||||
telaInicial();
|
||||
|
||||
}
|
||||
@@ -262,12 +290,13 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
"nome" : "clientes" ,
|
||||
"sequence" : "clientes_seq" ,
|
||||
"idTabela" : "CODIGO",
|
||||
"campos" : ["CODIGO", "NOME"],
|
||||
"camposTable" : ["CODIGO", "NOME"]
|
||||
"campos" : ["CODIGO", "NOME", "INATIVO"],
|
||||
"camposTable" : ["CODIGO", "NOME", "INATIVO"]
|
||||
},
|
||||
"relaciona" :
|
||||
[ ["CODIGO","idChave","Number"]
|
||||
, ["NOME","idDescricao","String"]
|
||||
, ["INATIVO","idInativo","Boolean"]
|
||||
] ,
|
||||
"validacaoExclusao" :
|
||||
[ ["SELECT 0 AS CONTAR FROM clientes WHERE CODIGO = ", "Existem registros ligados a esta tabela."],
|
||||
@@ -324,6 +353,10 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
engine.getGlobalVariable('habilitaCampos')(true);
|
||||
engine.getLayout('pnlInclusao').getRootComposition().setVisible(true);
|
||||
engine.getLayout('pnlTitulo').getRootComposition().setVisible(false);
|
||||
|
||||
engine.setGlobalVariable('persistirSocio', 0);
|
||||
engine.setGlobalVariable('persistirImposto', 0);
|
||||
engine.setGlobalVariable('persistirFrete', 0);
|
||||
}
|
||||
|
||||
}, 'pencil');
|
||||
@@ -395,7 +428,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
<datasource>
|
||||
<freeQuery connection-key="vitruvio">
|
||||
<![CDATA[
|
||||
SELECT * FROM clientes
|
||||
SELECT * FROM clientes ORDER BY NOME
|
||||
]]>
|
||||
</freeQuery>
|
||||
</datasource>
|
||||
@@ -403,7 +436,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
<![CDATA[
|
||||
SELECT *
|
||||
FROM clientes
|
||||
nome = ? ORDER BY codigo
|
||||
nome = ? ORDER BY NOME
|
||||
]]>
|
||||
</loadItemQuery>
|
||||
<key-field>CODIGO</key-field>
|
||||
@@ -429,10 +462,11 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
</events>
|
||||
</DBSearchField>
|
||||
<HorizontalLayout spacing="true" width="100%" >
|
||||
<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" />
|
||||
<CheckBox id="idInativo" caption="Inativar" type="boolean" expandRatio="0.1"></CheckBox>
|
||||
</HorizontalLayout>
|
||||
<TabLayout compact="true" width="100%">
|
||||
<TabLayout width="100%">
|
||||
<Tab caption="Sócios">
|
||||
<VerticalLayout spacing="true" width="100%">
|
||||
<Label id="lb1" >
|
||||
@@ -485,6 +519,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
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);
|
||||
engine.setGlobalVariable('persistirSocio', 1);
|
||||
} else {
|
||||
MessageBox.show(MessageBox.BoxType.INFO, 'Atenção', 'Percentual não pode ultrapassar 100%.');
|
||||
}
|
||||
@@ -505,6 +540,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
container.removeItem(texto);
|
||||
var container2 = engine.getField("socioPercentual").getContainerDataSource();
|
||||
container2.removeItem(texto);
|
||||
engine.setGlobalVariable('persistirSocio', 1);
|
||||
} catch(e) {
|
||||
MessageBox.show('Alerta', 'Dados inválidos!');
|
||||
}
|
||||
@@ -534,7 +570,193 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
<Tab caption="Usuários" visible="false">
|
||||
|
||||
<Tab caption="Impostos" visible="true" >
|
||||
<VerticalLayout width="100%" margin="true" spacing="true" >
|
||||
<HorizontalLayout width="100%" spacing="true" margin="false" >
|
||||
<DBComboBox type="string" id="idOrigem" caption="Estado de Origem" width="100%" expandRatio="0.8" allowNullSelection="true">
|
||||
<datasource>
|
||||
<freeQuery connection-key="vitruvio">
|
||||
<![CDATA[
|
||||
Select * from estados ORDER BY NOME
|
||||
]]>
|
||||
</freeQuery>
|
||||
</datasource>
|
||||
<key-field>NOME</key-field>
|
||||
<caption-field>NOME</caption-field>
|
||||
</DBComboBox>
|
||||
|
||||
<DBComboBox type="string" id="idPraca" caption="Estado de Destino" width="100%" expandRatio="0.8" allowNullSelection="true" >
|
||||
<datasource>
|
||||
<freeQuery connection-key="vitruvio">
|
||||
<![CDATA[
|
||||
Select * from estados ORDER BY NOME
|
||||
]]>
|
||||
</freeQuery>
|
||||
</datasource>
|
||||
<key-field>NOME</key-field>
|
||||
<caption-field>NOME</caption-field>
|
||||
</DBComboBox>
|
||||
|
||||
<DecimalField type="decimal" id="valorImpostos" caption="% Impostos" expandRatio="0.4" width="100%" maximumValue="100" maxLength="6" />
|
||||
<!--<DecimalField type="decimal" id="valorFrete" caption="R$ Frete" expandRatio="0.4" width="100%" />-->
|
||||
<ButtonWidget id="btnPraca" description="Adicionar praça" height="25" align="BOTTOM_LEFT" >
|
||||
<onClickScript language="JavaScript">
|
||||
<;
|
||||
engine.getField('idOrigem')['setValue(java.lang.Object)'](null);
|
||||
engine.setGlobalVariable('persistirImposto', 1);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
<ButtonWidget id="btnRemoverPraca" description="Remover praça" 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('pracaLista').getValue();
|
||||
if (texto != '') {
|
||||
try {
|
||||
var container = engine.getField("pracaLista").getContainerDataSource();
|
||||
container.removeItem(texto);
|
||||
var container2 = engine.getField("pracaPercentual").getContainerDataSource();
|
||||
container2.removeItem(texto);
|
||||
engine.setGlobalVariable('persistirImposto', 1);
|
||||
} catch(e) {
|
||||
MessageBox.show('Alerta', 'Dados inválidos!');
|
||||
}
|
||||
}
|
||||
};
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
</HorizontalLayout>
|
||||
|
||||
<HorizontalLayout width="100%" >
|
||||
<ListSelect type="string" id="pracaLista" readOnly="true" width="100%" expandRatio="0.8" allowNullSelection="true" rows="5" caption="Estado de Origem - Destino">
|
||||
<events>
|
||||
<valueChange>
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
function run() {
|
||||
engine.getField('pracaPercentual').setValue(engine.getField('pracaLista').getValue());
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</valueChange>
|
||||
</events>
|
||||
</ListSelect>
|
||||
<ListSelect type="string" id="pracaPercentual" readOnly="true" width="100%" expandRatio="0.2" allowNullSelection="true" rows="5" caption="Imposto (%):">
|
||||
|
||||
</ListSelect>
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
<Tab caption="Frete" visible="true" >
|
||||
<VerticalLayout width="100%" margin="true" spacing="true" >
|
||||
<HorizontalLayout width="100%" spacing="true" margin="false" >
|
||||
<TextField type="string" id="idNomeFrete" caption="Descrição do frete" text-transform="uppercase" expandRatio="1" width="100%"></TextField>
|
||||
<DecimalField type="decimal" id="valorFrete" caption="R$ Frete" expandRatio="1" width="100%" />
|
||||
<ButtonWidget id="btnFrete" description="Adicionar frete" height="25" align="BOTTOM_LEFT" >
|
||||
<onClickScript language="JavaScript">
|
||||
<;
|
||||
engine.getField('valorFrete').setValue(0);
|
||||
engine.setGlobalVariable('persistirFrete', 1);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
<ButtonWidget id="btnFreteRemover" description="Remover frete" 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('pracaListaFrete').getValue();
|
||||
if (texto != '') {
|
||||
try {
|
||||
var container = engine.getField("pracaListaFrete").getContainerDataSource();
|
||||
container.removeItem(texto);
|
||||
var container2 = engine.getField("pracaFrete").getContainerDataSource();
|
||||
container2.removeItem(texto);
|
||||
|
||||
engine.setGlobalVariable('persistirFrete', 1);
|
||||
} catch(e) {
|
||||
MessageBox.show('Alerta', 'Dados inválidos!');
|
||||
}
|
||||
}
|
||||
};
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
</HorizontalLayout>
|
||||
|
||||
<HorizontalLayout width="100%" >
|
||||
<ListSelect type="string" id="pracaListaFrete" readOnly="true" width="100%" expandRatio="0.8" allowNullSelection="true" rows="5" caption="Descrição do Frete">
|
||||
<events>
|
||||
<valueChange>
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
function run() {
|
||||
engine.getField('pracaFrete').setValue(engine.getField('pracaListaFrete').getValue());
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</valueChange>
|
||||
</events>
|
||||
</ListSelect>
|
||||
|
||||
<ListSelect type="string" id="pracaFrete" readOnly="true" width="100%" expandRatio="0.2" allowNullSelection="true" rows="5" caption="Frete (R$):" >
|
||||
</ListSelect>
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
|
||||
<Tab caption="Usuários" visible="false">
|
||||
<VerticalLayout margin="false" width="100%" >
|
||||
<Label id="lb2">
|
||||
<value>
|
||||
@@ -554,98 +776,6 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
</DBTwinColSelect>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
<Tab caption="Impostos" visible="true" >
|
||||
<VerticalLayout width="100%" margin="true" spacing="true" >
|
||||
<HorizontalLayout width="420" spacing="true" margin="false" >
|
||||
<DBComboBox type="string" id="idPraca" caption="Praça" width="100%" expandRatio="0.8" allowNullSelection="true">
|
||||
<datasource>
|
||||
<freeQuery connection-key="vitruvio">
|
||||
<![CDATA[
|
||||
Select * from estados
|
||||
]]>
|
||||
</freeQuery>
|
||||
</datasource>
|
||||
<key-field>NOME</key-field>
|
||||
<caption-field>NOME</caption-field>
|
||||
</DBComboBox>
|
||||
<DecimalField type="decimal" id="valorImpostos" caption="% Impostos" expandRatio="0.2" width="100%" maximumValue="100" maxLength="6" />
|
||||
<ButtonWidget id="btnPraca" description="Adicionar praça" height="25" align="BOTTOM_LEFT" >
|
||||
<onClickScript language="JavaScript">
|
||||
<;
|
||||
engine.getField('idPraca')['setValue(java.lang.Object)'](null);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
<ButtonWidget id="btnRemoverPraca" description="Remover praça" 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('pracaLista').getValue();
|
||||
if (texto != '') {
|
||||
try {
|
||||
var container = engine.getField("pracaLista").getContainerDataSource();
|
||||
container.removeItem(texto);
|
||||
var container2 = engine.getField("pracaPercentual").getContainerDataSource();
|
||||
container2.removeItem(texto);
|
||||
} catch(e) {
|
||||
MessageBox.show('Alerta', 'Dados inválidos!');
|
||||
}
|
||||
}
|
||||
};
|
||||
]]>
|
||||
</onClickScript>
|
||||
</ButtonWidget>
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout width="420" >
|
||||
<ListSelect type="string" id="pracaLista" readOnly="true" width="100%" expandRatio="0.8" allowNullSelection="true" rows="5">
|
||||
<events>
|
||||
<valueChange>
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
function run() {
|
||||
engine.getField('pracaPercentual').setValue(engine.getField('pracaLista').getValue());
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</valueChange>
|
||||
</events>
|
||||
</ListSelect>
|
||||
<ListSelect type="string" id="pracaPercentual" readOnly="true" width="100%" expandRatio="0.2" allowNullSelection="true" rows="5">
|
||||
|
||||
</ListSelect>
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
</TabLayout>
|
||||
</VerticalLayout>
|
||||
</Tab>
|
||||
@@ -655,7 +785,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
<Panel width="100%" margin="false" id="pnlBotoes" >
|
||||
<VerticalLayout width="100%" >
|
||||
<HorizontalLayout margin="true" spacing="true" align="MIDDLE_CENTER" >
|
||||
<ButtonWidget id="btnSalvar" caption="Salvar" expandRatio="0.2" description="Salva os dados das Informações Adicionais do Cargo " align="MIDDLE_CENTER">
|
||||
<ButtonWidget id="btnSalvar" caption="Salvar" expandRatio="0.2" description="Salva os dados" align="MIDDLE_CENTER">
|
||||
<onClickScript language="JavaScript">
|
||||
<![CDATA[
|
||||
importClass(Packages.br.com.davinti.base.vaadin.components.layout.MessageBox);
|
||||
@@ -691,6 +821,11 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
var percentual;
|
||||
var iter2 = ids.iterator();
|
||||
|
||||
var persistirSocio = engine.getGlobalVariable('persistirSocio');
|
||||
var persistirImposto = engine.getGlobalVariable('persistirImposto');
|
||||
var persistirFrete = engine.getGlobalVariable('persistirFrete');
|
||||
|
||||
if(persistirSocio == 1){
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "delete from clientes_socio where codigo_cliente = :cliente";
|
||||
this.update(sql, {
|
||||
@@ -714,7 +849,9 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(persistirImposto == 1){
|
||||
// Para gravação de praças
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "delete from clientes_praca where chave_cliente = :cliente";
|
||||
@@ -727,31 +864,78 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
var ids = engine.getField('pracaLista').getContainerDataSource().getItemIds();
|
||||
var iter = ids.iterator();
|
||||
|
||||
var db = libService.loadScript('db');
|
||||
var dbVitruvio = new db('vitruvio');
|
||||
var sql;
|
||||
var praca;
|
||||
var percentualPraca;
|
||||
var iter3 = ids.iterator();
|
||||
|
||||
while (iter3.hasNext()) {
|
||||
var value = iter3.next();
|
||||
var sql = "Select chave_estado from estados where nome = '" + engine.getField('pracaLista').getContainerDataSource().getItem(value) + "'";
|
||||
var estado = dbVitruvio.queryRow(sql);
|
||||
var praca = estado.chave_estado;
|
||||
var pos = String(engine.getField('pracaLista').getContainerDataSource().getItem(value)).indexOf('-');
|
||||
var tamanhoTotal = String(engine.getField('pracaLista').getContainerDataSource().getItem(value)).length;
|
||||
var sqlOrigem = "Select chave_estado from estados where nome = RTrim('" + String(engine.getField('pracaLista').getContainerDataSource().getItem(value)).substring(0,pos-1) + "')";
|
||||
var estadoOrigem = dbVitruvio.queryRow(sqlOrigem);
|
||||
var pracaOrigem = estadoOrigem.chave_estado;
|
||||
var sqlDestino = "Select chave_estado from estados where nome = LTrim('" + String(engine.getField('pracaLista').getContainerDataSource().getItem(value)).substring(pos+1,tamanhoTotal) + "')";
|
||||
var estadoDestino = dbVitruvio.queryRow(sqlDestino);
|
||||
var pracaDestino = estadoDestino.chave_estado;
|
||||
percentualPraca = parseFloat(String(engine.getField('pracaPercentual').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||
valorFrete = parseFloat(String(engine.getField('pracaFrete').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "insert into clientes_praca (chave_praca,chave_cliente,chave_estado,percentual_impostos) values (" + dbVitruvio.getSequenceNextValSql('clientes_praca_seq') + ",:cliente,:praca,:percentual)";
|
||||
sql = "insert into clientes_praca (chave_praca,chave_cliente,chave_estado,percentual_impostos,chave_estado_origem,descricao_praca) values (" + dbVitruvio.getSequenceNextValSql('clientes_praca_seq') + ",:cliente,:praca,:percentual,:origem,:descricao)";
|
||||
this.update(sql, {
|
||||
cliente: Number(retorno),
|
||||
praca: Number(praca),
|
||||
percentual: percentualPraca
|
||||
praca: Number(pracaDestino),
|
||||
percentual: percentualPraca,
|
||||
origem: Number(pracaOrigem),
|
||||
descricao: String(engine.getField('pracaLista').getContainerDataSource().getItem(value))
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************
|
||||
|
||||
// Para gravação dos fretes
|
||||
if(persistirFrete == 1){
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "delete from clientes_frete where chave_cliente = :cliente";
|
||||
this.update(sql, {
|
||||
cliente: Number(retorno)
|
||||
});
|
||||
});
|
||||
|
||||
var containerFreteLista = engine.getField("pracaListaFrete").getContainerDataSource();
|
||||
var containerFrete = engine.getField("pracaFrete").getContainerDataSource();
|
||||
var ids = engine.getField('pracaListaFrete').getContainerDataSource().getItemIds();
|
||||
var iter3 = ids.iterator();
|
||||
|
||||
while (iter3.hasNext()) {
|
||||
var value = iter3.next();
|
||||
//var valorFrete = parseFloat(String(engine.getField('pracaFrete').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||
//var valorFrete = parseFloat(engine.getField('pracaFrete').getContainerDataSource().getItem(value));
|
||||
//var valorFrete = engine.getField('pracaFrete').getContainerDataSource().getItem(value);
|
||||
//var valorFrete = String(engine.getField('pracaFrete').getContainerDataSource().getItem(value));
|
||||
//var valorFrete2 = String(engine.getField('pracaFrete').getContainerDataSource().getItem(value)).trim();
|
||||
|
||||
var valorFrete = parseFloat(String(engine.getField('pracaFrete').getContainerDataSource().getItem(value)).replace(',','.'));
|
||||
|
||||
/*engine.debug('Separador');
|
||||
engine.debug(parseFloat(String(engine.getField('pracaFrete').getContainerDataSource().getItem(value)).replace(',','.')));
|
||||
engine.debug(parseFloat(engine.getField('pracaFrete').getContainerDataSource().getItem(value)));
|
||||
engine.debug(valorFrete);
|
||||
engine.debug(valorFrete);
|
||||
engine.debug(valorFrete2);*/
|
||||
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "insert into clientes_frete (chave_frete,chave_cliente,descricao,valor_frete) values (" + dbVitruvio.getSequenceNextValSql('clientes_frete_seq') + ",:cliente,:descricao,:frete)";
|
||||
this.update(sql, {
|
||||
cliente: Number(retorno),
|
||||
descricao: String(engine.getField('pracaListaFrete').getContainerDataSource().getItem(value)),
|
||||
frete: parseFloat(valorFrete)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
dbVitruvio.transaction(function() {
|
||||
sql = "delete from clientes_usuario where codigo_cliente = :cliente";
|
||||
@@ -773,6 +957,7 @@ xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbuc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (retorno) {
|
||||
engine.getGlobalVariable('fncLimpaCampos')();
|
||||
|
||||
Reference in New Issue
Block a user