unit MyTaxPhoneUnit;
interface
uses
windows, messages,Classes, DMFAXLib_TLB, SysUtils, Dialogs,MConnect,ActiveX;
type
TMyTaxPhone = class(TThread)
private
MyChannelsNo: integer;
MyDMFax: TDMFAX;
MyDCOMConnection:TDCOMConnection;
MyMainHandle: Thandle;
MyResult:integer;
TaxNo:string;
AccountNo:string;
Password:string;
NewPassword:string;
protected
procedure Execute;
override;
procedure PlayMoney(MyMoney:do
uble);
procedure PlayDate(MyDate: Tdatetime);
procedure PlayTime(MyTime: Tdatetime);
procedure PlayInteger(MyInteger: Integer);
function AccountNoAndPass(): integer;
function InputDate(): integer;
function IsBusyDate(): Boolean;
function PlayVoc(VocCode: string;
KeyDownStop: integer): integer;
function PlayVocGetDTFM(VocCode: string;
KeyDownStop: integer;
KeyConform: Boolean;
var MyDTFM: string): integer;
public
constructor Create(MainHandle: Thandle;
DMFax: TDMFAX;
ChannelsNo: integer);
destructor Destroy;
override;
end;
implementation
uses TelTaxPublicUnit;
constructor TMyTaxPhone.Create(MainHandle: Thandle;
DMFax: TDMFAX;
ChannelsNo: integer);
begin
MyChannelsNo := ChannelsNo;
MyDMFax := DMFax;
MyMainHandle := MainHandle;
MyDCOMConnection := TDCOMConnection.Create(Nil);
MyDCOMConnection.ServerName := 'TaxServer.Mypooler';
MyDCOMConnection.ComputerName := 'Lcg';
MyDCOMConnection.Connected := False;
inherited Create(FALSE);
end;
destructor TMyTaxPhone.Destroy;
begin
MyDCOMConnection.Connected := False;
MyDCOMConnection.Free;
inherited Destroy;
end;
procedure TMyTaxPhone.Execute;
label
MainSelect, TaxDeclare, ChangePass, TaxQuery, ExitStep, DeclareQuery;
label
OrganIntroduce, TaxIntroduce, TaxKnowledge,
TaxKnowledgeTax, TaxKnowledgeAdd;
var
ReceptDTMF :string;
begin
FreeOnTerminate := True;
//第一步:播放欢迎词
SendMessage(MyMainHandle,CM_CHANNELSTATUS,MyChannelsNo,1);
if PlayVoc('Index50',0) = 3 then
goto ExitStep;
//第二步:播放最新通知
SendMessage(MyMainHandle,CM_CHANNELSTATUS,MyChannelsNo,2);
if PlayVoc('Index51',0) = 3 then
goto ExitStep;
MainSelect:
//第三步:提示输入选择功能,接收选择功能(1-报税,2-申报查询,3-更改密码,4-咨询)
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,3);
if PlayVocGetDTFM('Index52', 1, False,ReceptDTMF) = 3 then
goto ExitStep;
if ReceptDTMF = '1' then
goto TaxDeclare;
//税务申报
if ReceptDTMF = '2' then
goto DeclareQuery;
//税务申报查询
if ReceptDTMF = '3' then
goto ChangePass;
//更改密码
if ReceptDTMF = '4' then
goto TaxQuery //税务咨询
else
goto ExitStep;
//退出
TaxDeclare: //税务申报
//提示输入接收税号,密码
if AccountNoAndPass() <> 1 then
goto Exitstep;
//应申报的总金额
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,11);
PlayVoc('Index40', 0);
Sleep(1000);
//取税金,播放税金,
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,12);
PlayMoney(2342.00);
Sleep(1000);
//确认接收功能(0 -取消,1-确定)
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,13);
if PlayVocGetDTFM('Index44', 0, False, ReceptDTMF) = 3 then
goto ExitStep;
if ReceptDTMF = '1' then
begin
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,14);
//播放等待语,银行下帐
PlayVoc('Index34', 0);
Sleep(2000);
//播放下帐成功与否
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,16);
PlayVoc('Index67', 0);
//取凭证
PlayVoc('Index68', 0);
end else
begin
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,15);
PlayVoc('Index72', 0);
end;
Goto MainSelect;
function TMyTaxPhone.AccountNoAndPass(): integer;
var
ReceptDTMF:string;
IsValidNo :Boolean;
begin
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,4);
if PlayVocGetDTFM('Index45', 0, True, ReceptDTMF) = 3 then
begin
Result := 3;
exit;
end;
TaxNo := ReceptDTMF;
try
CoInitializeEx(nil,COINIT_APARTMENTTHREADED);
MyDCOMConnection.Connected := True;
MyDCOMConnection.AppServer.CheckPassword(TaxNo,Password,AccountNo,MyResult);
MyDCOMConnection.Connected := False;
finally
CoUninitialize;
end;
if MyResult = 1 then
begin
end
else
if MyResult = 2 then
begin
//提示输入税号错误,重新输入
if PlayVocGetDTFM('Index48', 0, True, ReceptDTMF) = 3 then
begin
Result := 3;
exit;
end;
TaxNo := ReceptDTMF;
try
CoInitializeEx(nil,COINIT_APARTMENTTHREADED);
MyDCOMConnection.Connected := True;
MyDCOMConnection.AppServer.CheckPassword(TaxNo,Password,AccountNo,MyResult);
MyDCOMConnection.Connected := False;
finally
CoUninitialize;
end;
if MyResult <> 0 then
begin
if PlayVocGetDTFM('Index48', 0, True, ReceptDTMF)= 3 then
begin
Result := 3;
exit;
end;
TaxNo := ReceptDTMF;
try
CoInitializeEx(nil,COINIT_APARTMENTTHREADED);
MyDCOMConnection.Connected := True;
MyDCOMConnection.AppServer.CheckPassword(TaxNo,Password,AccountNo,MyResult);
MyDCOMConnection.Connected := False;
finally
CoUninitialize;
end;
if MyResult <> 0 then
begin
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,7);
PlayVoc('Index32', 0);
Result := 3;
exit;
end;
end;
end;
//判断是否是合法用税户
// Password := '123456';
IsValidNo := True;
if not IsValidNo then
begin
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,6);
PlayVoc('Index63',0);
Result := 3;
Exit;
end;
//提示输入密码,接收密码
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,5);
if PlayVocGetDTFM('Index46', 0, True, ReceptDTMF) = 3 then
begin
Result := 3;
exit;
end;
if ReceptDTMF <> PassWord then
begin
if PlayVocGetDTFM('Index47', 0, True, ReceptDTMF) = 3 then
begin
Result := 3;
exit;
end;
if ReceptDTMF <> PassWord then
begin
if PlayVocGetDTFM('Index47', 0, True, ReceptDTMF) = 3 then
begin
Result := 3;
exit;
end;
if ReceptDTMF <> PassWord then
begin
SendMessage(MyMainHandle, CM_CHANNELSTATUS,MyChannelsNo,7);
PlayVoc('Index32', 0);
Result := 3;
exit;
end;
end;
end;
Result := 1;
end;
end.