Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Formulário master-detalhe com várias datagrids Bom dia, Tenho a seguinte estrutura: CREATE TABLE `banco` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `nome` varchar(35) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `nome` (`nome`) ) ENGINE=InnoDB AUTO_INCREMENT=741 DEFAULT CHARSET=utf8; CREATE TABLE `convenio` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `nome` varchar(30) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY ...
CJ
Formulário master-detalhe com várias datagrids  
Bom dia,

Tenho a seguinte estrutura:
CREATE TABLE `banco` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `nome` varchar(35) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `nome` (`nome`) ) ENGINE=InnoDB AUTO_INCREMENT=741 DEFAULT CHARSET=utf8; CREATE TABLE `convenio` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `nome` varchar(30) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `nome` (`nome`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; CREATE TABLE `corretor` ( `id` int(11) NOT NULL, `nome` varchar(100) NOT NULL, `active` char(1) DEFAULT NULL, `taxa` char(1) NOT NULL DEFAULT 'N', `telefone` text, `obs` text, `data_adm` date DEFAULT NULL, `cpf` varchar(14) DEFAULT NULL, `endereco` varchar(40) DEFAULT NULL, `numero` varchar(5) DEFAULT NULL, `complem` varchar(35) DEFAULT NULL, `bairro` varchar(25) DEFAULT NULL, `cidade` varchar(40) DEFAULT NULL, `uf` varchar(2) DEFAULT NULL, `cep` varchar(9) DEFAULT NULL PRIMARY KEY (`id`), UNIQUE KEY `nome` (`nome`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `corretor_banco` ( `id` int(11) NOT NULL AUTO_INCREMENT, `corretor_id` int(11) NOT NULL, `banco_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `corretor_banco_idx1` (`corretor_id`,`banco_id`), KEY `banco_id` (`banco_id`) USING BTREE, KEY `corretor_id` (`corretor_id`) USING BTREE, CONSTRAINT `corretor_banco_fk1` FOREIGN KEY (`corretor_id`) REFERENCES `corretor` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `corretor_banco_fk2` FOREIGN KEY (`banco_id`) REFERENCES `banco` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8; CREATE TABLE `corretor_convenio` ( `id` int(11) NOT NULL AUTO_INCREMENT, `corretor_id` int(11) NOT NULL, `banco_id` bigint(20) NOT NULL, `convenio_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `corretor_convenio_idx1` (`corretor_id`,`banco_id`,`convenio_id`) ) ENGINE=InnoDB AUTO_INCREMENT=71 DEFAULT CHARSET=utf8; CREATE TABLE `corretor_data` ( `id` int(11) NOT NULL AUTO_INCREMENT, `corretor_id` int(11) NOT NULL, `banco_id` bigint(20) NOT NULL, `convenio_id` bigint(20) NOT NULL, `data_taxa` date NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `corretor_data_idx1` (`corretor_id`,`banco_id`,`convenio_id`,`data_taxa`) ) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8; CREATE TABLE `taxa` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `banco_id` bigint(20) NOT NULL, `convenio_id` bigint(20) NOT NULL, `data_taxa` date NOT NULL, `parcela` int(11) NOT NULL, `novotx` float(9,2) NOT NULL DEFAULT '0.00', `refin` float(9,2) NOT NULL DEFAULT '0.00', `compra` float(9,2) NOT NULL DEFAULT '0.00', `corretor_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `taxas_idx1` (`banco_id`,`convenio_id`,`data_taxa`,`parcela`,`corretor_id`), KEY `banco_id` (`banco_id`) USING BTREE, KEY `convenio_id` (`convenio_id`) USING BTREE, KEY `corretor_id` (`corretor_id`) USING BTREE, CONSTRAINT `taxa_fk1` FOREIGN KEY (`corretor_id`) REFERENCES `corretor` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `taxas_fk1` FOREIGN KEY (`banco_id`) REFERENCES `banco` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `taxas_fk2` FOREIGN KEY (`convenio_id`) REFERENCES `convenio` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=154 DEFAULT CHARSET=utf8;


Queria implementar um formulário master-detalhe com várias tabelas vinculadas entre si. Onde ao selecionar um corretor, mostrasse os bancos relacionados a ele, onde eu teria a opção de inserir novos bancos ou excluir os bancos associados. Da mesma forma, ao selecionar um banco, mostrasse os convênios relacionados à esse banco, com as mesmas operações de inserção ou exclusão. E ao selecionar um convênio, mostrasse as datas. E ao selecionar uma data, as taxas para a data selecionada.

Já tentei de várias formas, sem êxito. Alguém poderia me ajudar?

Obrigado

Pacotão Dominando o Adianti Framework 7
O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado! Versão 7.4


Dominando o Adianti 7 Quero me inscrever agora!

Comentários (2)


FS

Bom dia Carlos.

Caso você não conheça, segue abaixo um link do Tutor 5.5

adianti.com.br/framework_files/tutor/index.php?class=HomeView

Em especial a parte de Apresentação e Organização, acredito que lá possa ter exemplos para ajudar a na escolha da solução.

Só como ideia, e se você criasse vários TNotebook ou TPage e ir adicionando as Grid dentro deles ?

Abraço e boa sorte.

Att,

Fernando.
CJ

Boa tarde Fernando.

Obrigado por me responder, primeiramente.

Na verdade tentei utilizar o exemplo do Tutor - Form mestre-detalhe de venda III, utilizando adianti_target_container, mas tipo ao selecionar um banco automaticamente deve exibir os convenios deste banco e aí onde o bicho pega, pois não conheço uma forma de exibir ou não formulários no Adianti.