Konstantin, muito bom esse exemplo que você anexou. Parabéns e muito obrigado.
JRGA
76 2023-08-25 16:38:45
Re: Query and locate text in memo field using Ctrl-F (5 replies, posted in General)
77 2023-08-25 11:54:45
Re: Query and locate text in memo field using Ctrl-F (5 replies, posted in General)
yes, please
78 2023-08-23 10:17:23
Topic: Query and locate text in memo field using Ctrl-F (5 replies, posted in General)
Can anyone help me? I have version 5.6 and would like to press Ctrl-F inside a memo field to search and find a word? Thanks.
79 2023-08-21 13:49:31
Re: Changed record - how to know if data has been modified (3 replies, posted in General)
Thanks Derek! I'll use his suggestion. I also asked thinking that the MVD had some native function that identifies that the record has been modified, as it happens in Access and other languages. Hugs.
80 2023-08-19 18:56:05
Topic: Changed record - how to know if data has been modified (3 replies, posted in General)
which MVD function can I use to identify that a record has changed, preventing the form from being closed and data loss occurring?.
81 2023-08-17 13:46:01
Re: BookLib - библиотека (36 replies, posted in Russian)
properties / Additional / Cursor = crHandPoint on five buttons
82 2023-08-14 01:05:58
Re: My Visual Database and RAD (9 replies, posted in General)
I can work with views created in the database via script. Does anyone know if I can include a view, after being created in sqlite, in the "Database tables" tab of Myvisualdatabase. This would dramatically increase development on the MVD.
83 2023-08-12 18:35:57
Re: BookLib - библиотека (36 replies, posted in Russian)
Poderia mudar o cursor quando o mouse se movesse sobre os botões de leitura e os demais ao lado
84 2023-08-12 18:16:02
Re: BookLib - библиотека (36 replies, posted in Russian)
Excelente programa! Tem como alterar idioma para o inglês?
85 2020-01-26 23:59:24
Topic: please help - record button is triggered strangely (4 replies, posted in FAQ)
In a form in my application, the record record button is activated unconditionally. I put a confirmation message on that record button. When another button, for example printing, is clicked on this form, the save confirmation message is displayed. I have already examined the script and everything is correct.
Did MVD always record the record in this type of situation and was that evident when I put the confirmation message? Has anyone ever experienced this?
86 2020-01-09 16:30:56
Topic: Valor monetário por extenso (NumberToWords) (1 replies, posted in Script)
adaptei do Delphi para o MVD. (I adapted from Delphi to MVD.)
créditos:
Prof. Omero Francisco Bertol (http://www.pb.utfpr.edu.br/omero/)
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
showmessage(valorPorExtenso(Form1.tb_valor.value));
end;
function valorPorExtenso(vlr: real): string;
var
unidade: array[1..19] of string;
centena: array[1..9] of string;
dezena: array[2..9] of string;
qualificaS: array[0..4] of string;
qualificaP: array[0..4] of string;
inteiro: integer; //Int64;
resto: real;
vlrS, s, saux, vlrP, centavos: string;
n, unid, dez, cent, tam, i: integer;
umReal, tem: boolean;
begin
unidade[1] := 'um';
unidade[2] := 'dois';
unidade[3] := 'três';
unidade[4] := 'quatro';
unidade[5] := 'cinco';
unidade[6] := 'seis';
unidade[7] := 'sete';
unidade[8] := 'oito';
unidade[9] := 'nove';
unidade[10] := 'dez';
unidade[11] := 'onze';
unidade[12] := 'doze';
unidade[13] := 'treze';
unidade[14] := 'quatorze';
unidade[15] := 'quinze';
unidade[16] := 'dezesseis';
unidade[17] := 'dezessete';
unidade[18] := 'dezoito';
unidade[19] := 'dezenove';
centena[1] := 'cento';
centena[2] := 'duzentos';
centena[3] := 'trezentos';
centena[4] := 'quatrocentos';
centena[5] := 'quinhentos';
centena[6] := 'seiscentos';
centena[7] := 'setecentos';
centena[8] := 'oitocentos';
centena[9] := 'novecentos';
dezena[2] := 'vinte';
dezena[3] := 'trinta';
dezena[4] := 'quarenta';
dezena[5] := 'cinquenta';
dezena[6] := 'sessenta';
dezena[7] := 'setenta';
dezena[8] := 'oitenta';
dezena[9] := 'noventa';
qualificaS[0] := '';
qualificaS[1] := 'mil';
qualificaS[2] := 'milhão';
qualificaS[3] := 'bilhão';
qualificaS[4] := 'trilhão';
qualificaP[0] := '';
qualificaP[1] := 'mil';
qualificaP[2] := 'milhões';
qualificaP[3] := 'bilhões';
qualificaP[4] := 'trilhões';
if (vlr = 0)
then begin
Result := 'zero';
exit;
end;
inteiro := trunc(vlr); // parte inteira do valor
resto := vlr - inteiro; // parte fracionária do valor
vlrS := inttostr(inteiro);
if (length(vlrS) > 15)
then begin
Result := 'Erro: valor superior a 999 trilhões.';
exit;
end;
s := '';
centavos := inttostr(round(resto * 100));
// definindo o extenso da parte inteira do valor
i := 0;
umReal := false; tem := false;
while (vlrS <> '0') do
begin
tam := length(vlrS);
// retira do valor a 1a. parte, 2a. parte, por exemplo, para 123456789:
// 1a. parte = 789 (centena)
// 2a. parte = 456 (mil)
// 3a. parte = 123 (milhões)
if (tam > 3)
then begin
vlrP := copy(vlrS, tam-2, tam);
vlrS := copy(vlrS, 1, tam-3);
end
else begin // última parte do valor
vlrP := vlrS;
vlrS := '0';
end;
if (vlrP <> '000')
then begin
saux := '';
if (vlrP = '100')
then saux := 'cem'
else begin
n := strtoint(vlrP); // para n = 371, tem-se:
cent := n div 100; // cent = 3 (centena trezentos)
dez := (n mod 100) div 10; // dez = 7 (dezena setenta)
unid := (n mod 100) mod 10; // unid = 1 (unidade um)
if (cent <> 0)
then saux := centena[cent];
if ((dez <> 0) or (unid <> 0))
then begin
if ((n mod 100) <= 19)
then begin
if (length(saux) <> 0)
then saux := saux + ' e ' + unidade[n mod 100]
else saux := unidade[n mod 100];
end
else begin
if (length(saux) <> 0)
then saux := saux + ' e ' + dezena[dez]
else saux := dezena[dez];
if (unid <> 0)
then if (length(saux) <> 0)
then saux := saux + ' e ' + unidade[unid]
else saux := unidade[unid];
end;
end;
end;
if ((vlrP = '1') or (vlrP = '001'))
then begin
if (i = 0) // 1a. parte do valor (um real)
then umReal := true
else saux := saux + ' ' + qualificaS[i];
end
else if (i <> 0)
then saux := saux + ' ' + qualificaP[i];
if (length(s) <> 0)
then s := saux + ', ' + s
else s := saux;
end;
if (((i = 0) or (i = 1)) and (length(s) <> 0))
then tem := true; // tem centena ou mil no valor
i := i + 1; // próximo qualificador: 1- mil, 2- milhão, 3- bilhão, ...
end;
if (length(s) <> 0)
then begin
if (umReal)
then s := s + ' real'
else if (tem)
then s := s + ' reais'
else s := s + ' de reais';
end;
// definindo o extenso dos centavos do valor
if (centavos <> '0') // valor com centavos
then begin
if (length(s) <> 0) // se não é valor somente com centavos
then s := s + ' e ';
if (centavos = '1')
then s := s + 'um centavo'
else begin
n := strtoint(centavos);
if (n <= 19)
then s := s + unidade[n]
else begin // para n = 37, tem-se:
unid := n mod 10; // unid = 37 % 10 = 7 (unidade sete)
dez := n div 10; // dez = 37 / 10 = 3 (dezena trinta)
s := s + dezena[dez];
if (unid <> 0)
then s := s + ' e ' + unidade[unid];
end;
s := s + ' centavos';
end;
end;
Result := s;
end;
begin
end.
87 2020-01-08 17:02:57
Topic: Funções que validam CPF e CNPJ, utilizados no Brasil (1 replies, posted in Script)
Retirei da Internet - código foi escrito em Pascal e funciona no MVD
function ValidaCPF(num: string): boolean;
var
n1,n2,n3,n4,n5,n6,n7,n8,n9: integer;
d1,d2: integer;
digitado, calculado: string;
begin
if (Length(num)<>11) then
begin
Result:=False;
end
else
begin
n1:=StrToInt(num[1]);
n2:=StrToInt(num[2]);
n3:=StrToInt(num[3]);
n4:=StrToInt(num[4]);
n5:=StrToInt(num[5]);
n6:=StrToInt(num[6]);
n7:=StrToInt(num[7]);
n8:=StrToInt(num[8]);
n9:=StrToInt(num[9]);
d1:=n9*2+n8*3+n7*4+n6*5+n5*6+n4*7+n3*8+n2*9+n1*10;
d1:=11-(d1 mod 11);
if d1>=10 then d1:=0;
d2:=d1*2+n9*3+n8*4+n7*5+n6*6+n5*7+n4*8+n3*9+n2*10+n1*11;
d2:=11-(d2 mod 11);
if d2>=10 then d2:=0;
calculado:=inttostr(d1)+inttostr(d2);
digitado:=num[10]+num[11];
if calculado=digitado then
Result :=true
else
Result :=false;
end;
end;
function ValidaCNPJ(num: string): boolean;
var
n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12: integer;
d1,d2: integer;
digitado, calculado: string;
begin
if (Length(num)<>14) then
begin
Result:=False;
end
else
begin
n1:=StrToInt(num[1]);
n2:=StrToInt(num[2]);
n3:=StrToInt(num[3]);
n4:=StrToInt(num[4]);
n5:=StrToInt(num[5]);
n6:=StrToInt(num[6]);
n7:=StrToInt(num[7]);
n8:=StrToInt(num[8]);
n9:=StrToInt(num[9]);
n10:=StrToInt(num[10]);
n11:=StrToInt(num[11]);
n12:=StrToInt(num[12]);
d1:=n12*2+n11*3+n10*4+n9*5+n8*6+n7*7+n6*8+n5*9+n4*2+n3*3+n2*4+n1*5;
d1:=11-(d1 mod 11);
if d1>=10 then d1:=0;
d2:=d1*2+n12*3+n11*4+n10*5+n9*6+n8*7+n7*8+n6*9+n5*2+n4*3+n3*4+n2*5+n1*6;
d2:=11-(d2 mod 11);
if d2>=10 then d2:=0;
calculado:=inttostr(d1)+inttostr(d2);
digitado:=num[13]+num[14];
if calculado=digitado then
Result:=true
else
Result:=false;
end;
end;
88 2019-11-19 19:53:56
Re: color rows alternately on a tablegrid when there are many records (3 replies, posted in Script)
thank you
89 2019-11-10 23:25:46
Topic: color rows alternately on a tablegrid when there are many records (3 replies, posted in Script)
I use the procedure below to alternately color the lines of a tablegrid. This routine, I found here in this forum.
However, navigation slows down on a 22 row tablegrid because it is linked to a table with 4000 records. I noticed that using the tablegrid dblimit of 22 lines, the browsing speed is good. But,
As you scroll down the tablegrid, the colors fade. Can anyone help?
procedure ColorRowGrid (Grid:TdbStringGridEx;ColorEven,ColorOdd:TColor;ajusta:boolean);
//**** alterna cores de linhas numa tablegrid
var
iRow ,c: integer;
q, iCol: integer;
begin
c := Grid.RowCount - 1;
q := Grid.Columns.Count-1;
for iRow := 0 to c do
for iCol := 0 to q do
begin
if iRow mod 2 = 0 then Grid.Cell[iCol,iRow].Color := ColorEven
else
Grid.Cell[iCol,iRow].Color := ColorOdd;
end;
if ajusta then Grid.BestFitColumns(bfBoth); //ajusta conteúdo no tablegrid
end;
90 2019-10-27 13:26:10
Topic: to capture image (jpg) of the Internet (1 replies, posted in Script)
How can I capture automatically an image (jpg) of the Internet straightly for a DBImage1?
91 2019-06-20 01:18:38
Re: [SOLVED] it does not lose data while closing the form (5 replies, posted in General)
One more applications program developed with the MVD. It calculates profits in an application of fixed income. The calculator, besides financial calculations, to do taxes conversion.
92 2019-06-17 12:40:29
Re: How To Use Cal Power(2,3) ??? (7 replies, posted in Script)
Hello community MVD. It follows down script what I created to do financial calculations (financial mathematics).
procedure calculo_juros_composto;
var
PMT, FV, PV, i, n: real;
inicio: integer;
p1, p2: real;
calculou: boolean = false;
begin
PMT := frmCalc.edPMT.value;
FV := frmCalc.edFV.value;
PV := frmCalc.edPV.value;
i := frmCalc.edi.value/100;
n := frmCalc.edn.value;
inicio := strtoint(frmCalc.chk_begin.sqlValue);
if (frmCalc.edPMT.text = '') and (frmCalc.edFV.value = 0) then //calcula PMT com FV = 0
begin
calculou := true;
p1 := power((i + 1),n)-1;
p2 := power((1 + i),(n - inicio)) * i;
PMT := PV/(p1/p2);
frmCalc.edPMT.text := Formatfloat('###,###,#0.00',PMT);
exit;
end;
if (frmCalc.edPV.text = '') and (frmCalc.edFV.value = 0) then //calcula PV com FV = 0
begin
calculou := true;
p1 := power((i + 1),n)-1;
p2 := power((1 + i),(n - inicio)) * i;
PV := PMT/(p2/p1);
frmCalc.edPV.text := Formatfloat('###,###,#0.00',PV);
exit;
end;
if (frmCalc.edFV.text = '') and (frmCalc.edPV.value = 0) then //calcula FV com PV = 0
begin
calculou := true;
p1 := power((i + 1),n)-1;
p2 := i;
FV := PMT * (p1/p2);
frmCalc.edFV.text := Formatfloat('###,###,#0.00',FV);
exit;
end;
if (frmCalc.edPMT.text = '') and (frmCalc.edPV.value = 0) then //calcula PMT com PV = 0
begin
calculou := true;
p1 := power((i + 1),n)-1;
p2 := i;
PMT := FV / (p1/p2);
frmCalc.edPMT.text := Formatfloat('###,###,#0.00',PMT);
exit;
end;
if (frmCalc.edi.text = '') and (frmCalc.edPMT.value = 0) then //calcula i com PMT = 0
begin
calculou := true;
p1 := FV/PV;
p2 := power(p1,(1/n));
i := (p2 - 1)*100;
frmCalc.edi.text := Formatfloat('###,###,#0.00',i);
exit;
end;
if (frmCalc.edn.text = '') and (frmCalc.edPMT.value = 0) then //calcula n com PMT = 0
begin
calculou := true;
p1 := FV/PV;
p2 := i + 1;
n := ln(p1)/ln(p2);
frmCalc.edn.text := Formatfloat('##0',n);
exit;
end;
.......................................................................
if calculou = false then showmessage('o campo a ser calculado deve estar em branco e deve haver um campo com valor = 0 (zero)');
end;
93 2019-06-05 00:26:34
Re: How will it print more than a tablegrid in different reports? (3 replies, posted in General)
Solved. I used your example. Tank you.
94 2019-06-01 19:39:47
Re: How will it print more than a tablegrid in different reports? (3 replies, posted in General)
Dmitry obliged by the help, but I would like of each one prints the tablegrids in a report. Is it possible to create a function so that it can be in use in some tablegrid?
95 2019-05-30 14:53:58
Re: Using Grid Results in Report (11 replies, posted in Reports)
Dmitry, thank you, but I wanted to print each tablegrid in a different report, in other words, there are 2 reports. Is it possible? The ideal is if there was a function to call any tablegrid to criterion of a user
96 2019-05-27 01:08:53
Topic: How will it print more than a tablegrid in different reports? (3 replies, posted in General)
I used the script of the link down and it gave right, but I do not manage to print other tablegrids in other reports. The ideal is that there would be a function that could be used in any tablegrid case if it will be printed in a report. Can anybody help me?
97 2019-05-25 16:09:45
Re: Using Grid Results in Report (11 replies, posted in Reports)
Dmitry, please, how can I use the routine above if I have 2 tablegrids?
98 2019-04-30 12:20:03
Re: Using Grid Results in Report (11 replies, posted in Reports)
Dmitry, I used the script above that you published and worked, but I do not manage to use the same thing to produce another report. I want to print the tablegrid in 2 reports. How can I use the same routine?
99 2019-04-30 00:46:32
Re: [SOLVED] it does not lose data while closing the form (5 replies, posted in General)
Mais um aplicativo concluído - ver no link abaixo - que desenvolvi com MVD 3.1.
100 2019-04-13 18:07:24
Re: Вопрос по DecimalSeparator (1 replies, posted in Russian)
eu consegui resolver com um quebra-galho. O validfloat não funcionou para mim.
numa consulta SQL usei:
select (valor as real) as valor from table.
Estou usando o MVD 3.1 e estou tendo muitas dificuldades com o ponto decimal