Fórum Erro: DELPHI32 causou uma falha de página inválida. blablabl #244746
28/07/2004
0
o erro é
[color=red:7802e0ce7e] DELPHI32 causou uma falha de página inválida no
módulo USER.EXE em 0004:00006001.DELPHI32 causou uma falha de página inválida no
módulo USER.EXE em 0004:00006001.[/color:7802e0ce7e]
//começo do codigo
unit ULancpag;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComObj, ActiveX, StdCtrls, DBCtrls, DB, Printers, DBTables, Mask, Buttons;
type
TfmLancpag = class(TForm)
Panel1: TPanel;
Label27: TLabel;
Label19: TLabel;
Label29: TLabel;
Image1: TImage;
Label18: TLabel;
Label21: TLabel;
Label1: TLabel;
Label2: TLabel;
Label20: TLabel;
Label28: TLabel;
Label3: TLabel;
TBLancpag: TTable;
DSLancpag: TDataSource;
SpeedButton8: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton10: TSpeedButton;
TBLancpagCodigo: TAutoIncField;
TBLancpagNome: TStringField;
TBLancpagEndereco: TStringField;
TBLancpagBairro: TStringField;
TBLancpagCEP: TStringField;
TBLancpagCidade: TStringField;
TBLancpagEstado: TStringField;
TBLancpagNacional: TStringField;
TBLancpagNatural: TStringField;
TBLancpagIdentidade: TStringField;
TBLancpagCPF: TStringField;
TBLancpagDtNasc: TDateField;
TBLancpagPai: TStringField;
TBLancpagMae: TStringField;
TBLancpagFoneres: TStringField;
TBLancpagFonecom: TStringField;
TBLancpagCelular: TStringField;
TBLancpagEmail: TStringField;
TBLancpagProf: TStringField;
TBLancpagLoctrab: TStringField;
TBLancpagEstcivil: TStringField;
TBLancpagHorario: TStringField;
TBLancpagObs: TMemoField;
TBLancpagTipopagto: TStringField;
TBLancpagValorcurso: TCurrencyField;
TBLancpagDtmatric: TDateField;
TBLancpagTurma: TStringField;
TBLancpagEscolaridade: TStringField;
TBLancpagNivel: TStringField;
TBLancpagNFilhos: TStringField;
TBLancpagNomEmpresa: TStringField;
TBLancpagObservacoes: TMemoField;
TBNivel: TTable;
DSNivel: TDataSource;
TBNivelCodigo: TAutoIncField;
TBNivelNome: TStringField;
DSCurso: TDataSource;
TBCurso: TTable;
TBCursoProfessor: TStringField;
TBConvenio: TTable;
DSConvenio: TDataSource;
TBConvenioNome: TStringField;
TBConvenioCodigo: TAutoIncField;
TBConvenioDesc: TFloatField;
TBNivelRegular: TFloatField;
TBNivelIntensivo: TFloatField;
TBNivelSemiIntensivo: TFloatField;
TBLancpagLivro: TStringField;
TBLancpagCDs: TStringField;
TBCursoNome: TStringField;
TBLancpagCurso: TStringField;
TBLancpagConvenio: TStringField;
TBCursoValor: TCurrencyField;
Panel2: TPanel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
SpeedButton1: TSpeedButton;
TBCadban: TTable;
DSCadban: TDataSource;
TBCadbanNome: TStringField;
TBCadbanCodigo: TAutoIncField;
TBCadbanNConta: TStringField;
TBCadbanAgencia: TStringField;
TBCadbanSaldo: TCurrencyField;
TBCadbanSaldoReal: TCurrencyField;
TBCadbanPlancontabil: TStringField;
DSCadlan: TDataSource;
TBCadlan: TTable;
TBCadlanDatalan: TDateField;
TBCadlanDocumento: TStringField;
TBCadlanHistorico: TStringField;
TBCadlanValor: TCurrencyField;
TBCadlanTipo: TStringField;
TBCadlanLoclan: TStringField;
CBLodep: TComboBox;
TBLanc: TTable;
DSLanc: TDataSource;
TBLancDatalan: TDateField;
TBLancDocumento: TStringField;
TBLancHistorico: TStringField;
TBLancValor: TCurrencyField;
TBLancTipo: TStringField;
TBLancLoclan: TStringField;
Ednuche: TEdit;
Edlocch: TEdit;
TBLancpagForPagto: TStringField;
Panel3: TPanel;
Label4: TLabel;
SpeedButton2: TSpeedButton;
RadioGroup1: TRadioGroup;
Label9: TLabel;
Edparc: TEdit;
EdDipag: TEdit;
Label10: TLabel;
DSMensa: TDataSource;
TBMensa: TTable;
TBMensaNumero: TStringField;
TBMensaAluno: TStringField;
TBMensaDtlan: TDateField;
TBMensaDtvenc: TDateField;
TBMensaValor: TCurrencyField;
TBMensaTipo: TStringField;
TBMensaLocal: TStringField;
TBMensaVrjuros: TCurrencyField;
TBMensaDiatraz: TStringField;
TBMensaDtpagto: TDateField;
TBMensaValpago: TCurrencyField;
TBMensaDesconto: TCurrencyField;
TBLancpagTFilho: TStringField;
Label11: TLabel;
Ednucont: TEdit;
Panel4: TPanel;
Lbpesq1: TLabel;
LBpesq2: TLabel;
Lbpesq3: TLabel;
Lbpesq4: TLabel;
Lbpesq5: TLabel;
TBConfig: TTable;
DSConfig: TDataSource;
TBConfigPesquisa1: TStringField;
TBConfigPesquisa2: TStringField;
TBConfigPesquisa3: TStringField;
TBConfigPesquisa4: TStringField;
TBConfigPesquisa5: TStringField;
SpeedButton3: TSpeedButton;
RGpes1: TRadioGroup;
RGpes2: TRadioGroup;
RGpes3: TRadioGroup;
RGpes4: TRadioGroup;
RGpes5: TRadioGroup;
Label8: TLabel;
TBLancpagDesc: TFloatField;
DSAlcur: TDataSource;
TBAlcur: TTable;
TBAlcurAluno: TStringField;
TBAlcurNivel: TStringField;
TBAlcurCurso: TStringField;
TBAlcurTurma: TStringField;
TBAlcurHorario: TStringField;
TBAlcurValor: TCurrencyField;
TBAlcurDtMat: TDateField;
TBAlcurDtterm: TDateField;
TBAlcurDesc: TFloatField;
TBAlcurConvenio: TStringField;
TBAlcurTipoPagto: TStringField;
TBAlcurForpagto: TStringField;
TBAlcurLivro: TStringField;
TBAlcurSitu: TStringField;
MaskEdit1: TMaskEdit;
MaskEdit2: TMaskEdit;
MaskEdit3: TMaskEdit;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
RadioGroup2: TRadioGroup;
RadioGroup3: TRadioGroup;
RadioGroup4: TRadioGroup;
ComboBox5: TComboBox;
DSCargah: TDataSource;
TBCargah: TTable;
TBCargahNome: TStringField;
TBCargahCHora: TFloatField;
TBCargahTempo: TFloatField;
TBCargahDias: TFloatField;
procedure FormCreate(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure DBRadioGroup1Click(Sender: TObject);
procedure DBLookupComboBox4Exit(Sender: TObject);
procedure Panel2Resize(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure imprimicont(Para:String);
procedure SpeedButton3Click(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ComboBox5Exit(Sender: TObject);
procedure RadioGroup3Click(Sender: TObject);
procedure RadioGroup4Click(Sender: TObject);
procedure ComboBox2Click(Sender: TObject);
private
vTipen:String;
vParce:Currency;
Parametro1 : String;
vCodpag: String;
vForpag: String;
vLivro: String;
toth:Integer;
totc:Integer;
totdias:Integer;
{ Private declarations }
public
constructor Create(AOwner : TComponent; pParm1: String);
{ Public declarations }
end;
var
fmLancpag: TfmLancpag;
Word2k: Variant;
implementation
uses UEntrada, UCadAlu;
{$R *.dfm}
Constructor TfmLancpag.Create(AOwner : TComponent; pParm1 : String);
begin
inherited Create(AOwner);
Parametro1 := pParm1;
end;
procedure TfmLancpag.FormCreate(Sender: TObject);
begin
Image1.Stretch :=true;
TBLancpag.Open;
TBNivel.open;
TBConfig.Open;
TBConvenio.Open;
TBCargah.Open;
TBCurso.Open;
TBLanc.Open;
// TBAlcur.Open;
TBLancpag.IndexFieldNames := ´Nome´;
TBLancpag.Locate(´Nome´,Parametro1,[loPartialKey]);
end;
procedure TfmLancpag.SpeedButton10Click(Sender: TObject);
begin
close;
end;
procedure TfmLancpag.SpeedButton12Click(Sender: TObject);
begin
fmGessystem.Mensagem(´Rotina não disponivel, aguarde...´, mtInformation, [mbOK]);
end;
procedure TfmLancpag.SpeedButton6Click(Sender: TObject);
begin
DSLancpag.AutoEdit:= True;
TBLancpag.Delete;
end;
procedure TfmLancpag.SpeedButton7Click(Sender: TObject);
begin
TBLancpag.Cancel;
end;
procedure TfmLancpag.SpeedButton11Click(Sender: TObject);
begin
TBLancpag.Edit;
end;
procedure TfmLancpag.SpeedButton9Click(Sender: TObject);
begin
TBLancpag.Insert;
DSLancpag.AutoEdit:= True;
RadioGroup2.Itemindex := 0;
end;
procedure TfmLancpag.SpeedButton8Click(Sender: TObject);
var
teste:String;
I:Integer;
Diapag, vEntrada: String;
vNumes:Integer;
vMes:TDate;
vAno, vNMes, vDia:Word;
vConparc, Tes:Currency;
begin
//Checar cadastro de curso no arquivo Alucur
TBAlCur.Open;
TBAlCur.Locate(´Aluno´,Parametro1,[loPartialKey]);
if (TBAlcur.FieldByName(´Aluno´).AsString = Parametro1) and (TBAlcur.FieldByName(´Nivel´).AsString = ComboBox1.Text) and (TBAlcur.FieldByName(´Curso´).AsString = ComboBox2.Text) then
Begin
fmGessystem.Mensagem(´JÁ EXISTE UM CADASTRO DO ALUNO ´ + Parametro1 + #13 + ´ NO ´+ ComboBox1.Text + ´ DO CURSO ´+ ComboBox2.Text, mtError, [mbOK]);
exit;
end
else
begin
TBAlCur.Open;
TBAlCur.Insert;
TBAlCur.FieldByName(´Aluno´).AsString := Parametro1;
TBAlCur.FieldByName(´Nivel´).AsString := ComboBox1.Text;
TBAlCur.FieldByName(´Curso´).AsString := ComboBox2.Text;
TBAlCur.FieldByName(´Turma´).AsString := Edit1.Text;
TBAlCur.FieldByName(´Horario´).AsString := Edit2.Text;
TBAlCur.FieldByName(´Valor´).AsCurrency := strtocurr(MaskEdit3.Text);
TBAlcur.FieldByName(´Dtmat´).AsString := MaskEdit1.Text;
// TBAlCurDtterm.AsString :=
TBAlcur.FieldByName(´Desc´).AsString := MaskEdit2.Text;
TBAlCur.FieldByName(´Convenio´).AsString := ComboBox5.Text;
TBAlCur.FieldByName(´Tipopagto´).AsString := vCodpag;
TBAlCur.FieldByName(´Forpagto´).AsString := vForpag;
TBAlCur.FieldByName(´Livro´).AsString := vLivro;
TBAlcur.Post;
//Lançar dados no caixa referente ao
//pagto do aluno em caso de a vista com cheque
if RadioGroup2.ItemIndex = 0 then
Begin
if RadioGroup3.ItemINDEX = 1 then
Begin
vTipen:= ´CHEQUE´;
TBLanc.Insert;
TBLanc.FieldByName(´Datalan´).AsString := Maskedit1.Text;
TBLanc.FieldByName(´Documento´).AsString := Ednucont.Text;
TBLanc.FieldByName(´Historico´).AsString := ´Pag Curso com cheque ´+ Parametro1;
TBLanc.FieldByName(´Valor´).AsCurrency := strtocurr(Maskedit3.Text);
TBLanc.FieldByName(´Tipo´).AsString := ´C´;
TBLanc.FieldByName(´Loclan´).AsString := CBLodep.Text;
TBlanc.Post;
end;
//Pagamento a vista em dinheiro
if RadioGroup3.ItemIndex = 0 then
begin
vTipen:= ´DINHEIRO´;
TBLanc.Insert;
TBLanc.FieldByName(´Datalan´).AsString := maskedit1.Text;
TBLanc.FieldByName(´Documento´).AsString := Ednucont.Text;
TBLanc.FieldByName(´Historico´).AsString := ´Pag Curso em Dinheiro ´+ Parametro1;
TBLanc.FieldByName(´Valor´).AsCurrency := strtocurr(maskedit3.Text);
TBLanc.FieldByName(´Tipo´).AsString := ´C´;
TBLanc.FieldByName(´Loclan´).AsString := CBLodep.Text;
TBlanc.Post;
end;
end;
// Lançamento valores a prazo
if RadioGroup2.ItemIndex = 1 then
Begin
if RadioGroup3.ItemIndex = 0 then
Begin
if RadioGroup1.ItemIndex = 0 then //Lançamentos a prazo com entrada
begin
vTipen:= ´CHEQUE´;
vMes:=StrToDate(Maskedit1.Text);
DecodeDate(vMes, vAno, vNMes, vDia);
vNumes:=(strtoint(Edparc.Text) - 1);
vParce:= strtocurr(MaskEdit3.Text)/strtoint(Edparc.Text);
vConparc:= vParce*strtoint(Edparc.Text);
vEntrada := ´Entrada´+ ´/´ + TBLancpag.FieldByName(´Codigo´).AsString;
if vConparc < vParce then
begin
tes:= vParce - vConparc;
end;
//lança um valor no arquivo de mensalidade com cheque e data pagto quitada
//TBMensa.Open;
TBMensa.Insert;
TBMensaNumero.Value := Ednucont.Text;
TBMensaAluno.Value := Parametro1;
TBMensaDtlan.value := strtodate(Maskedit1.Text);
TBMensaDtvenc.Value := strtodate(MaskEDit1.Text);
TBMensaDtpagto.Value := strtodate(MaskEdit1.Text);
TBMensaValor.Value := vParce;
TBMensaValpago.Value := vParce;
TBMensaTipo.Value := ´C´;
TBMensaLocal.Value := CBLodep.Text;
TBMensa.Post;
// Lança um valor no arquivo de caixa com cheque
//TBLanc.Open;
TBLanc.Insert;
TBLancDatalan.Value := strtodate(MaskEdit1.Text);
TBLancDocumento.Value := Ednucont.Text;
TBLancHistorico.Value := ´Recebimento entrada com Cheque ´+Parametro1;
TBLancValor.Value := vParce;
TBLancTipo.Value := ´C´;
TBLancLoclan.Value := CBLodep.Text;
TBLanc.Post;
for I:= 1 to vNumes do
begin
Diapag:= EdDipag.Text +´/´+ IntToStr(VNMes+I)+´/´+ IntToStr(vAno);
//TBMensa.Open;
TBMensa.Insert;
TBMensaNumero.Value := Ednucont.Text +´/´+ inttostr(I);
TBMensaAluno.Value := Parametro1;
TBMensaDTLan.Value := strtodate(MaskEdit1.Text);
TBMensaDtvenc.Value := strtodate(Diapag);
if I >= vNumes then
begin
TBMensaValor.Value := vParce + tes;
end
else
begin
TBMensaValor.Value := vParce;
end;
TBMensaLocal.Value := Edlocch.Text;
TBMensaTipo.Value := ´A´;
TBMensa.Post;
end;
fmGessystem.Aviso(´Mensalidades Lançadas com sucesso!´,2000);
end;
if RadioGroup1.ItemIndex = 1 then //Lançamentos a prazo sem entrada com cheque
begin
vTipen:= ´NOTA PROMISSORA´;
vMes:=StrToDate(MaskEdit1.Text);
DecodeDate(vMes, vAno, vNMes, vDia);
vNumes:=strtoint(Edparc.Text);
vParce:= strtocurr(MaskEdit3.Text)/strtoint(Edparc.Text);
vConparc:= vParce*strtoint(Edparc.Text);
vEntrada := ´Entrada´+ ´/´ + TBLancpag.FieldByName(´Codigo´).AsString;
if vConparc < vParce then
begin
tes:= vParce - vConparc;
end;
for I:= 1 to vNumes do
begin
Diapag:= EdDipag.Text +´/´+ IntToStr(VNMes+I)+´/´+ IntToStr(vAno);
TBMensa.Open;
TBMensa.Insert;
TBMensaNumero.Value := Ednucont.Text +´/´+ inttostr(I);
TBMensaAluno.Value := Parametro1;
TBMensaDTLan.Value := strtodate(MaskEdit1.Text);
TBMensaDtvenc.Value := strtodate(Diapag);
if I >= vNumes then
begin
TBMensaValor.Value := vParce + tes;
end
else
begin
TBMensaValor.Value := vParce;
end;
TBMensaLocal.Value := Edlocch.Text;
TBMensaTipo.Value := ´A´;
TBMensa.Post;
end;
fmGessystem.Aviso(´Mensalidades Lançadas com sucesso!´,2000);
end;
end;
if RadioGroup3.ItemIndex = 1 then
Begin
if RadioGroup1.ItemIndex = 0 then //Lançamentos a prazo com entrada
begin
vTipen:= ´CHEQUE´;
vMes:=StrToDate(MaskEdit1.Text);
DecodeDate(vMes, vAno, vNMes, vDia);
vNumes:=(strtoint(Edparc.Text) - 1);
vParce:= strtocurr(MaskEdit3.Text)/strtoint(Edparc.Text);
vConparc:= vParce*strtoint(Edparc.Text);
vEntrada := ´Entrada´+ ´/´ + TBLancpag.FieldByName(´Codigo´).AsString;
if vConparc < vParce then
begin
tes:= vParce - vConparc;
end;
//lança um valor no arquivo de mensalidade com NP e data pagto quitada
TBMensa.Open;
TBMensa.Insert;
TBMensaNumero.Value := Ednucont.Text;
TBMensaAluno.Value := Parametro1;
TBMensaDtlan.value := strtodate(MaskEdit1.Text);
TBMensaDtvenc.Value := strtodate(MaskEdit1.Text);
TBMensaDtpagto.Value := strtodate(MaskEdit1.Text);
TBMensaValor.Value := vParce;
TBMensaValpago.Value := vParce;
TBMensaTipo.Value := ´C´;
TBMensaLocal.Value := ´Em Carteira NP´;
TBMensa.Post;
// Lança um valor no arquivo de caixa com NP
TBLanc.Open;
TBLanc.Insert;
TBLancDatalan.Value := strtodate(MaskEdit1.Text);
TBLancDocumento.Value := Ednucont.Text;
TBLancHistorico.Value := ´Recebimento entrada com NP ´+Parametro1;
TBLancValor.Value := vParce;
TBLancTipo.Value := ´C´;
TBLancLoclan.Value := ´Em Carteira NP´;
TBLanc.Post;
for I:= 1 to vNumes do
begin
Diapag:= EdDipag.Text +´/´+ IntToStr(VNMes+I)+´/´+ IntToStr(vAno);
TBMensa.Open;
TBMensa.Insert;
TBMensaNumero.Value := Ednucont.Text +´/´ + inttostr(I);
TBMensaAluno.Value := Parametro1;
TBMensaDTLan.Value := strtodate(MasKedit1.Text);
TBMensaDtvenc.Value := strtodate(Diapag);
if I >= vNumes then
begin
TBMensaValor.Value := vParce + tes;
end
else
begin
TBMensaValor.Value := vParce;
end;
TBMensaLocal.Value := Edlocch.Text;
TBMensaTipo.Value := ´A´;
TBMensa.Post;
end;
fmGessystem.Aviso(´Mensalidades Lançadas com sucesso!´,2000);
end;
if RadioGroup1.ItemIndex = 1 then //Lançamentos a prazo sem entrada com NP
begin
vTipen:= ´NOTA PROMISSORA´;
vMes:=StrToDate(MaskEdit1.Text);
DecodeDate(vMes, vAno, vNMes, vDia);
vNumes:=strtoint(Edparc.Text);
vParce:= strtocurr(MaskEdit3.Text)/strtoint(Edparc.Text);
vConparc:= vParce*strtoint(Edparc.Text);
vEntrada := ´Entrada´+ ´/´ + TBLancpag.FieldByName(´Codigo´).AsString;
if vConparc < vParce then
begin
tes:= vParce - vConparc;
end;
for I:= 1 to vNumes do
begin
Diapag:= EdDipag.Text +´/´+ IntToStr(VNMes+I)+´/´+ IntToStr(vAno);
TBMensa.Open;
TBMensa.Insert;
TBMensaNumero.Value := Ednucont.Text +´/´ + inttostr(I);
TBMensaAluno.Value := Parametro1;
TBMensaDTLan.Value := strtodate(MaskEdit1.Text);
TBMensaDtvenc.Value := strtodate(Diapag);
if I >= vNumes then
begin
TBMensaValor.Value := vParce + tes;
end
else
begin
TBMensaValor.Value := vParce;
end;
TBMensaLocal.Value := ´Em Carteira NP´;
TBMensaTipo.Value := ´A´;
TBMensa.Post;
end;
fmGessystem.Aviso(´Mensalidades Lançadas com sucesso!´,2000);
end;
end;
end;
//Atualiza o arquivo de Alunos
TBLancpag.Open;
TBLancpag.Edit;
TBLancpagCDs.Value := ´MATRICULADO´;
TBLancpag.Post;
//Imprimir o Contrato de aluno
fmGessystem.Mensagem(´Gostaria de Imprimir o contrato agora?´, mtConfirmation, [mbYes, mbNo]);
if fmGessystem.pSim = True then
imprimicont(Parametro1);
//fim da impressão
TBLancpag.Refresh;
TBLancpag.Close;
TBCargah.Close;
TBNivel.Close;
TBConvenio.Close;
TBCurso.Close;
TBLanc.Close;
TBAlCur.Close;
Close;
end;
end;
procedure TfmLancpag.DBRadioGroup1Click(Sender: TObject);
begin
if RadioGroup2.ItemIndex = 0 Then
begin
with RadioGroup3 do
begin
items.Clear;
Items.Add(´DINHEIRO´);
Items.Add(´CHEQUE´);
Columns:= 2
end;
RadioGroup3.Visible:= True;
RadioGroup3.Width:= 361;
RadioGroup3.Enabled := True;
TBConfig.Open;
//TBConfig.Last;
Lbpesq1.Caption := TBConfig.FieldByName(´Pesquisa1´).AsString;
Lbpesq2.Caption := TBConfig.FieldByName(´Pesquisa2´).AsString;
Lbpesq3.Caption := TBConfig.FieldByName(´Pesquisa3´).AsString;
Lbpesq4.Caption := TBConfig.FieldByName(´Pesquisa4´).AsString;
Lbpesq5.Caption := TBConfig.FieldByName(´Pesquisa5´).AsString;
end;
if RadioGroup2.ItemIndex = 1 Then
begin
with RadioGroup3 do
begin
items.Clear;
Items.Add(´CHEQUE´);
Items.Add(´NOTA PROMISSORA´);
Columns:= 2
end;
RadioGroup3.Visible:= True;
RadioGroup3.Width:= 361;
RadioGroup3.Enabled := True;
TBConfig.Open;
//TBConfig.Last;
Lbpesq1.Caption := TBConfig.FieldByName(´Pesquisa1´).AsString;
Lbpesq2.Caption := TBConfig.FieldByName(´Pesquisa2´).AsString;
Lbpesq3.Caption := TBConfig.FieldByName(´Pesquisa3´).AsString;
Lbpesq4.Caption := TBConfig.FieldByName(´Pesquisa4´).AsString;
Lbpesq5.Caption := TBConfig.FieldByName(´Pesquisa5´).AsString;
end;
end;
procedure TfmLancpag.DBLookupComboBox4Exit(Sender: TObject);
Var
vValor : Currency;
vDescont : Currency;
vTotal : Currency;
begin
vValor:= TBCurso.FieldByName(´Valor´).AsCurrency;
TBConvenio.Locate(´Nome´,ComboBox5.Text,[LoPartialKey]);
vDescont:= strtocurr(MaskEDit2.Text);
vTotal:= (vValor*vDescont)/100;
MaskEdit3.Text := Formatfloat(´,0.00´,(vValor-vTotal));
end;
procedure TfmLancpag.Panel2Resize(Sender: TObject);
begin
TBCadban.Open;
CBLodep.Items.clear;
TBCadban.First;
While not TBCadban.Eof do begin
CBLodep.Items.add(TBCadban.Fieldbyname(´Nome´).asstring);
TBCadban.Next;
End;
Ednuche.SetFocus;
end;
procedure TfmLancpag.SpeedButton1Click(Sender: TObject);
begin
if CBLodep.Text <> ´Clic para escolher o banco deposito´ then
Panel2.Visible := False;
Panel4.Visible := True;
end;
procedure TfmLancpag.SpeedButton2Click(Sender: TObject);
begin
Panel3.Visible := False;
Panel4.Visible:= True;
if RadioGroup2.ItemIndex = 1 then
begin
If RadioGroup3.ItemIndex = 0 then
begin
Panel2.Visible := True;
end;
end;
end;
procedure TfmLancpag.imprimicont(Para:String);
var
Doc: Variant;
begin
TBLancpag.Refresh;
//TBLancpag.Locate(´Nome´,Parametro1,[loPartialKey]);
Word2k := fmGessystem.CrieObjeto(´Word.Application´);
Doc := Word2k.Documents.Open(´C:\Gesitale\Contratolu.doc´);
// Contratante
Doc.Content.Find.Execute(FindText := ´@001´, ReplaceWith := TBLancpagConvenio.Value);
Doc.Content.Find.Execute(FindText := ´@002´, ReplaceWith := TBLancpagNome.Value);
Doc.Content.Find.Execute(FindText := ´@003´, ReplaceWith := TBLancpagEndereco.Value);
Doc.Content.Find.Execute(FindText := ´@004´, ReplaceWith := TBLancpagBairro.Value);
Doc.Content.Find.Execute(FindText := ´@005´, ReplaceWith := TBLancpagCEP.Value);
Doc.Content.Find.Execute(FindText := ´@006´, ReplaceWith := TBLancpagCidade.Value);
Doc.Content.Find.Execute(FindText := ´@007´, ReplaceWith := TBLancpagEstado.Value);
Doc.Content.Find.Execute(FindText := ´@008´, ReplaceWith := TBLancpagFoneres.Value);
Doc.Content.Find.Execute(FindText := ´@009´, ReplaceWith := TBLancpagCelular.Value);
Doc.Content.Find.Execute(FindText := ´@010´, ReplaceWith := TBLancpagEmail.Value);
Doc.Content.Find.Execute(FindText := ´@011´, ReplaceWith := TBLancpagNatural.Value);
Doc.Content.Find.Execute(FindText := ´@013´, ReplaceWith := TBLancpagDtNasc.Value);
Doc.Content.Find.Execute(FindText := ´@014´, ReplaceWith := TBLancpagPai.Value);
Doc.Content.Find.Execute(FindText := ´@015´, ReplaceWith := TBLancpagMae.Value);
Doc.Content.Find.Execute(FindText := ´@016´, ReplaceWith := TBLancpagIdentidade.Value);
Doc.Content.Find.Execute(FindText := ´@017´, ReplaceWith := TBLancpagCPF.Value);
Doc.Content.Find.Execute(FindText := ´@018´, ReplaceWith := TBLancpagEstcivil.Value);
Doc.Content.Find.Execute(FindText := ´@019´, ReplaceWith := TBLancpagTFilho.Value);
Doc.Content.Find.Execute(FindText := ´@020´, ReplaceWith := TBLancpagNFilhos.Value);
Doc.Content.Find.Execute(FindText := ´@021´, ReplaceWith := TBLancpagProf.Value);
Doc.Content.Find.Execute(FindText := ´@022´, ReplaceWith := TBLancpagLoctrab.Value);
Doc.Content.Find.Execute(FindText := ´@023´, ReplaceWith := TBLancpagFonecom.Value);
Doc.Content.Find.Execute(FindText := ´@024´, ReplaceWith := TBLancpagNivel.Value);
Doc.Content.Find.Execute(FindText := ´@025´, ReplaceWith := TBLancpagTurma.Value);
Doc.Content.Find.Execute(FindText := ´@026´, ReplaceWith := TBLancpagHorario.Value);
Doc.Content.Find.Execute(FindText := ´@028´, ReplaceWith := TBLancpagCurso.Value);
Doc.Content.Find.Execute(FindText := ´@054´, ReplaceWith := TrimRight(TBLancpagNome.Value));
Doc.Content.Find.Execute(FindText := ´@029´, ReplaceWith := TBLancpagTipopagto.Value);
Doc.Content.Find.Execute(FindText := ´@030´, ReplaceWith := Formatcurr(´#,0.00´,TBLancpagValorcurso.Value));
Doc.Content.Find.Execute(FindText := ´@031´, ReplaceWith := TBLancpagForPagto.Value);
Doc.Content.Find.Execute(FindText := ´@027´, ReplaceWith := Ednucont.Text);
{ if TBLancpagForPagto.Value = ´Cheque´ then
begin
Word2k.Insert(´Nº Cheque´+ Ednucont.Text);
end;}
//Pesquisa cultural
Doc.Content.Find.Execute(FindText := ´@063´, ReplaceWith := LBpesq1.Caption);
if RGpes1.Items[RGpes1.ItemIndex] = ´Sim´ then
begin
Doc.Content.Find.Execute(FindText := ´@045´, ReplaceWith := ´Sim´);
end
else
begin
Doc.Content.Find.Execute(FindText := ´@045´, ReplaceWith := ´Não´);
end;
Doc.Content.Find.Execute(FindText := ´@064´, ReplaceWith := Lbpesq2.Caption);
if RGpes2.Items[RGpes2.ItemIndex] = ´Sim´ then
begin
Doc.Content.Find.Execute(FindText := ´@046´, ReplaceWith := ´Sim´);
end
else
begin
Doc.Content.Find.Execute(FindText := ´@046´, ReplaceWith := ´Não´);
end;
Doc.Content.Find.Execute(FindText := ´@065´, ReplaceWith := Lbpesq3.Caption);
if RGpes3.Items[RGpes3.ItemIndex] = ´Sim´ then
begin
Doc.Content.Find.Execute(FindText := ´@047´, ReplaceWith := ´Sim´);
end
else
begin
Doc.Content.Find.Execute(FindText := ´@047´, ReplaceWith := ´Não´);
end;
Doc.Content.Find.Execute(FindText := ´@066´, ReplaceWith := Lbpesq4.Caption);
if RGpes4.Items[RGpes4.ItemIndex] = ´Sim´ then
begin
Doc.Content.Find.Execute(FindText := ´@048´, ReplaceWith := ´Sim´);
end
else
begin
Doc.Content.Find.Execute(FindText := ´@048´, ReplaceWith := ´Não´);
end;
Doc.Content.Find.Execute(FindText := ´@067´, ReplaceWith := Lbpesq5.Caption);
if RGpes5.Items[RGpes5.ItemIndex] = ´Sim´ then
begin
Doc.Content.Find.Execute(FindText := ´@049´, ReplaceWith := ´Sim´);
end
else
begin
Doc.Content.Find.Execute(FindText := ´@049´, ReplaceWith := ´Não´);
end;
//Aqui começa a rotina para testa o caso de tipi pagamento a prazo
Doc.Content.Find.Execute(FindText := ´@033´, ReplaceWith := vParce);
// começo do segundo relatorio
Doc.Content.Find.Execute(FindText := ´@055´, ReplaceWith := TrimRight(TBLancpagNome.Value));
Doc.Content.Find.Execute(FindText := ´@056´, ReplaceWith := TBLancpagEndereco.Value);
Doc.Content.Find.Execute(FindText := ´@057´, ReplaceWith := TBLancpagBairro.Value);
Doc.Content.Find.Execute(FindText := ´@058´, ReplaceWith := TBLancpagCEP.Value);
Doc.Content.Find.Execute(FindText := ´@059´, ReplaceWith := TBLancpagCidade.Value);
Doc.Content.Find.Execute(FindText := ´@060´, ReplaceWith := TBLancpagEstado.Value);
Doc.Content.Find.Execute(FindText := ´@061´, ReplaceWith := TBLancpagIdentidade.Value);
Doc.Content.Find.Execute(FindText := ´@062´, ReplaceWith := TBLancpagCPF.Value);
Doc.Content.Find.Execute(FindText := ´@012´, ReplaceWith := TrimRight(TBLancpagNome.Value));
Printer.Title := ´Contrato do Aluno ´+ Parametro1;
//Word2k.Visible := True;
Word2k.ActiveDocument.PrintOut(Copies := 1);
{fmGessystem.Mensagem(´Impressão do relatório terminou?´ + #13 + ´Click no botão OK´, mtConfirmation, [mbYes]);
if fmGessystem.pSim = True then
begin
Word2k.Quit;
end
else
fmGessystem.Aviso(´O Microsoft Word sera inicialidado com o relatório em aberto faça suas alterações e utilize a opção Salvar como´+13+´ Renomear o relátório, não Utilize o nome Contratoalu´+´ Entre em Contato com a assistencia tecnica´, 2000);
Word2k.Visible := True;
end;}
end;
procedure TfmLancpag.SpeedButton3Click(Sender: TObject);
begin
Panel4.Visible:=False;
end;
procedure TfmLancpag.RadioGroup2Click(Sender: TObject);
begin
if RadioGroup2.ItemIndex = 0 Then
begin
vCodpag:= ´A VISTA´;
with RadioGroup3 do
begin
items.Clear;
Items.Add(´DINHEIRO´);
Items.Add(´CHEQUE´);
Columns:= 2
end;
RadioGroup3.Font.Name := ´Arial´;
RadioGroup3.Font.Size := 9;
RadioGroup3.Visible:= True;
RadioGroup3.Width:= 361;
RadioGroup3.Enabled := True;
TBConfig.Open;
//TBConfig.Last;
Lbpesq1.Caption := TBConfig.FieldByName(´Pesquisa1´).AsString;
Lbpesq2.Caption := TBConfig.FieldByName(´Pesquisa2´).AsString;
Lbpesq3.Caption := TBConfig.FieldByName(´Pesquisa3´).AsString;
Lbpesq4.Caption := TBConfig.FieldByName(´Pesquisa4´).AsString;
Lbpesq5.Caption := TBConfig.FieldByName(´Pesquisa5´).AsString;
end;
if RadioGroup2.ItemIndex = 1 Then
begin
vCodpag:= ´A PRAZO´;
with RadioGroup3 do
begin
items.Clear;
Items.Add(´CHEQUE´);
Items.Add(´NOTA PROMISSORA´);
Columns:= 2
end;
RadioGroup3.Font.Name := ´Arial´;
RadioGroup3.Font.Size := 9;
RadioGroup3.Visible:= True;
RadioGroup3.Width:= 361;
RadioGroup3.Enabled := True;
TBConfig.Open;
//TBConfig.Last;
Lbpesq1.Caption := TBConfig.FieldByName(´Pesquisa1´).AsString;
Lbpesq2.Caption := TBConfig.FieldByName(´Pesquisa2´).AsString;
Lbpesq3.Caption := TBConfig.FieldByName(´Pesquisa3´).AsString;
Lbpesq4.Caption := TBConfig.FieldByName(´Pesquisa4´).AsString;
Lbpesq5.Caption := TBConfig.FieldByName(´Pesquisa5´).AsString;
end;
end;
procedure TfmLancpag.FormShow(Sender: TObject);
begin
TBNivel.Open;
ComboBox1.Items.clear;
TBNivel.First;
While not TBNivel.Eof do begin
ComboBox1.Items.add(TBNivel.Fieldbyname(´Nome´).asstring);
TBNivel.Next;
End;
TBConvenio.Open;
ComboBox5.Items.clear;
TBNivel.First;
While not TBConvenio.Eof do begin
ComboBox5.Items.add(TBConvenio.Fieldbyname(´Nome´).asstring);
TBConvenio.Next;
End;
TBCargah.Open;
ComboBox2.Items.clear;
TBCargah.First;
While not TBCargah.Eof do begin
ComboBox2.Items.add(TBCargah.Fieldbyname(´Nome´).asstring);
TBCargah.Next;
End;
end;
procedure TfmLancpag.ComboBox5Exit(Sender: TObject);
Var
vValor : Currency;
vDescont : Currency;
vTotal : Currency;
begin
vValor:= TBCurso.FieldByName(´Valor´).AsCurrency;
TBConvenio.Locate(´Nome´,ComboBox5.Text,[LoPartialKey]);
vDescont:= strtocurr(MaskEdit2.Text);
vTotal:= (vValor*vDescont)/100;
MaskEdit3.Text := Formatfloat(´,0.00´,(vValor-vTotal));
end;
procedure TfmLancpag.RadioGroup3Click(Sender: TObject);
begin
if RadioGroup2.ItemIndex = 0 then
begin
if RadioGroup3.ItemIndex = 0 then
begin
vForpag := ´DINHEIRO´;
panel4.Visible := True;
end;
If RadioGroup3.ItemIndex = 1 then
begin
vForpag:= ´CHEQUE´;
Panel2.Visible := True;
end;
end;
if RadioGroup2.ItemIndex = 1 Then
Begin
Panel3.Visible := True;
end;
end;
procedure TfmLancpag.RadioGroup4Click(Sender: TObject);
begin
if RadioGroup4.ItemIndex = 0 then
vLivro := ´SIM´;
if RadioGroup4.ItemIndex = 1 then
vLivro := ´NÃO´;
end;
procedure TfmLancpag.ComboBox2Click(Sender: TObject);
var
vTotal:Integer;
begin
TBCargah.Locate(´Nome´,ComboBox2.Text,[loCaseInsensitive,loPartialKey]);
if TBCargah.FieldByname(´Nome´).AsString = ComboBox2.Text then
begin
toth:= TBCargah.FieldByname(´CHora´).AsInteger;
totc:= TBCargah.FieldByname(´Tempo´).AsInteger;
//totdias:= TBcargah.FieldByname(´Dias´).AsInteger;
totdias:= toth + totc;
end;
end;
end.Dpinho
Curtir tópico
+ 0Posts
30/07/2004
Dpinho
Gostei + 0
30/07/2004
Vinicius2k
Percebo q vc está utilizando controles ActiveX e interações com o Word... não tenho nenhuma experiência nisso...
Mas se vale uma tentativa, na sua posição eu editaria manualmente esta unit com o NotePad, retiraria na lista de uses as units ComObj e ActiveX e comentaria, temporariamente todas as rotinas relacionadas à esta interação... Depois abriria o Delphi salvaria e tentaria recompilar o projeto... se o erro for extinto vc terá isolado o problema e reabilitaria, uma a uma, as rotinas de interação para descobrir qual está causando esta falha...
Para mim parece claro que é alguma tentativa de leitura de objetos exportados pelo Windows...
Espero ter ajudado...
T+
Gostei + 0
30/07/2004
Nildo
e
Quanto a sua dúvida, E se você remover todas as referencias a utilização de ActiveX de sua Unit? Será que continua dando erro?
Gostei + 0
30/07/2004
Nildo
.Find.Execute
está correto? Ignore as linhas que contém esse comando. Provavelmente não dará mais erro.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)