controle financeiro de alugueis
Ola pessoa boa tarde tenho uma dúvida, estou criando um sistema de controle de alugueis, agora estou implementando o módulo de pagamento. Tenho as tabelas de locatários, contrato, pagamento e lançamento. Assim que um contrato é inserido no sistema, automaticamente é inserida na tabela de lançamentos a quantidade de parcelas informada no cadastro de contrato. Quando o usuário cadastra um pagamento, automaticamente o valor é atualizado na tabela de lançamento e alterado o status para "Pago". Até aí tudo bem está funcionando perfeitamente, mas teria problemas caso o usuário edite as informações de contrato como por exemplo: data do primeiro vencimento, prazo e valor, impactando assim na tabela de lançamento, ahi no caso teria que mudar tudo novamente. Tenho muito medo que alguem edite essas informações e bagunce com a tabela de lançamento , ahi vai virar o "samba do criollo doido". Existe alguma solução para quando alterar dados do contrato e atlerar tudo da tabela de lançamento? Segue as tabelas abaixo:
TB_LOCATARIO
PK_INT_LOCATARIO int(11) NO PRI auto_increment
LOT_STR_NOME varchar(250) YES
LOT_STR_CPF varchar(15) YES
LOT_STR_RG varchar(30) YES
LOT_STR_ENDERECO varchar(250) YES
LOT_DAT_DATANASC date YES
LOT_STR_ORGAOEXP varchar(10) YES
FK_INT_ESTADOCIVIL int(11) YES MUL
LOT_STR_PROFISSAO varchar(45) YES
LOT_STR_NATURALIDADE varchar(45) YES
LOT_STR_UF varchar(5) YES
LOT_STR_BAIRRO varchar(45) YES
LOT_STR_CEP varchar(10) YES
LOT_INT_DISPONIVEL int(11) YES 1
LOT_STR_CELULAR varchar(15) YES
LOT_STR_EMAIL varchar(200) YES
TB_CONTRATO
'PK_INT_ALUGUEL', 'int(11)', 'NO', 'PRI', NULL, 'auto_increment'
'ALU_DEC_VALOR', 'decimal(9,2)', 'YES', '', NULL, ''
'ALU_DAT_DATAENTREGA', 'date', 'YES', '', NULL, ''
'ALU_DAT_VENCIMENTO', 'date', 'YES', '', NULL, ''
'ALU_INT_NUMQUARTO', 'int(11)', 'YES', '', NULL, ''
'FK_INT_LOCATARIO', 'int(11)', 'NO', 'MUL', NULL, ''
'ALU_DAT_INICIO', 'date', 'YES', '', NULL, ''
'ALU_DAT_FIM', 'date', 'YES', '', NULL, ''
'ALU_INT_PRAZO', 'int(11)', 'YES', '', NULL, ''
'FK_INT_STATUS', 'int(11)', 'YES', 'MUL', NULL, ''
'FK_INT_QUARTO', 'int(11)', 'YES', 'MUL', NULL, ''
TB_PAGAMENTO
'PK_INT_PAGAMENTO', 'int(11)', 'NO', 'PRI', NULL, 'auto_increment'
'PAG_DAT_DATAPAGAMENTO', 'date', 'YES', '', NULL, ''
'PAG_STR_RECIBO', 'varchar(30)', 'NO', '', NULL, ''
'PAG_DEC_VALORTOTAL', 'decimal(9,2)', 'YES', '', NULL, ''
'FK_INT_MES', 'int(11)', 'YES', 'MUL', NULL, ''
'FK_INT_LOCATARIO', 'int(11)', 'YES', 'MUL', NULL, ''
'PAG_DEC_DESCONTO', 'decimal(9,2)', 'YES', '', '0.00', ''
'PAG_DEC_VALOR', 'decimal(9,2)', 'YES', '', NULL, ''
'PAG_DAT_INICIO', 'date', 'YES', '', NULL, ''
'PAG_DAT_FIM', 'date', 'YES', '', NULL, ''
TB_LANCAMENTO
'PK_INT_LANCAMENTO', 'int(11)', 'NO', 'PRI', NULL, 'auto_increment'
'FK_INT_MES', 'int(11)', 'YES', 'MUL', NULL, ''
'FK_INT_LOCATARIO', 'int(11)', 'YES', 'MUL', NULL, ''
'FK_INT_STATUS', 'int(11)', 'YES', 'MUL', NULL, ''
'LAN_DEC_VALOR', 'decimal(9,2)', 'YES', '', '0.00', ''
'LAN_DAT_VENCIMENTO', 'date', 'YES', '', NULL, ''
'LAN_DEC_VALORPAGO', 'decimal(9,2)', 'YES', '', '0.00', ''
'LAN_INT_ANO', 'int(11)', 'YES', '', NULL, ''
'LAN_DAT_PAGAMENTO', 'date', 'YES', '', NULL, ''
Discussão (1)
Carregando comentários...