?? yd_acc_gsm.pas
字號:
end;
procedure TFormACC_GSM.TabSheetQTZLShow(Sender: TObject);
begin
// SetFunSTAT;
end;
procedure TFormACC_GSM.SpeedButton3Click(Sender: TObject);
//var
// select_form:TFormSELECTJT;
begin
{ select_form:=TFormSELECTJT.Create(self);
If JTMC<>'' then
begin
select_form.RG_LX.itemindex:=1;
select_form.Addjt;
select_form.ComboBoxJT.itemindex:=select_form.ComboBoxJT.Items.IndexOf(JTMC);
select_form.ComboBoxJT.enabled:=false;
end;
select_form.ShowModal;
select_form.free; }
end;
procedure TFormACC_GSM.DBNavigator1Click(Sender: TObject;
Button: TNavigateBtn);
begin
letdb;
end;
function TFormACC_GSM.let_dict(v1,v2:string):string;
begin
dm_main.Querydict.Close;
dm_main.Querydict.SQL.Clear;
dm_main.Querydict.SQL.Add('select * from dict_field where fld_lb=:lb and fld_val=:val ');
dm_main.Querydict.ParamByName('lb').asstring:=v1;
dm_main.Querydict.ParamByName('val').asstring:=v2;
dm_main.querydict.open;
let_dict:=dm_main.Querydict.fieldbyname('fld_sm').asstring;
end;
function TFormACC_GSM.let_dict_hz(STR1,STR2:STRING):STRING;
begin
dm_main.Querydict.Close;
dm_main.Querydict.SQL.Clear;
dm_main.Querydict.SQL.Add('select * from dict_field where fld_mc=:lb and fld_val=:val ');
dm_main.Querydict.ParamByName('lb').asstring:=str1;
dm_main.Querydict.ParamByName('val').asstring:=str2;
dm_main.querydict.open;
let_dict_hz:=dm_main.Querydict.fieldbyname('fld_sm').asstring;
end;
procedure TFormACC_GSM.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
crypt.UserEnter_Log(Caption,'瀏覽',0,Gh,'登入窗體');
end;
procedure TFormACC_GSM.PageControlMainChange(Sender: TObject);
var
zje,zxzje,zqfje,znj: double;
begin
if PageControlMain.ActivePageIndex <> 3 then Exit;
FormMain.StatusBarMain.Panels[1].Text:='正在查詢該用戶的話單數據...';
ZQFJE:=0;
zje := 0;
zxzje := 0;
znj := 0;
if edacc_sid.Text = '' then
begin
Application.MessageBox('請輸入電話號碼!','嗨',MB_OK);
edacc_sid.SetFocus;
Exit;
end;
with QueryCW_GSM_izd do
begin
Close;
ParamByName('sid').AsString := edacc_sid.Text;
Open;
DisableControls;
while not Eof do
begin
ZJE := ZJE + FieldByName('zzd_je').AsFloat;
ZXZJE := ZXZJE + FieldByName('xz_je').AsFloat;
ZNJ := ZNJ + FieldByName('znj_je').AsFloat;
Next;
end;
First;
EnableControls;
ZQFJE := ZJE - ZXZJE;
LabelZJE.Caption := FormatFloat('¥###,###,##0.00',ZJE);
LabelZXZJE.Caption := FormatFloat('¥###,###,##0.00',ZXZJE);
LabelZQFJE.Caption := FormatFloat('¥###,###,##0.00',ZQFJE);
LabelZNJ.Caption := FormatFloat('¥###,###,##0.00',ZNJ);
edacc_sid.SetFocus;
if not (bof or eof) then
FlatSpeedButton1.Enabled:=true
else
FlatSpeedButton1.enabled:=False;
end;
end;
procedure TFormACC_GSM.FlatSpeedButton1Click(Sender: TObject);
var
xlsapp,WorkBook : Variant;
Row , Tmp : integer;
xlsFileName:string;
OutFileName:TFileName;
OutDir:string;
begin
// EXCEL文件|*.xls| DBF文件|*.dbf| TXT文件|*.txt
FormMain.StatusBarMain.Panels[1].Text := '系統正在導出,請稍后......';
if SaveDialog1.Execute then
begin
xlsFileName:=SaveDialog1.FileName;
if SaveDialog1.FilterIndex=1 then //excel files
begin
if FileExists(xlsFileName) then
if Application.MessageBox('文件已經存在,是否覆蓋?','請注意',MB_YESNO)<>ID_YES then Exit;
try
xlsapp:=CreateOleObject('Excel.Application');
WorkBook:=CreateOleObject('Excel.Sheet');
except
if Application.MessageBox('對不起,你的機器沒有安裝MicroSoft Excel,是否繼續導出?'+#13#13+'導出后在您的機器上不能直接打開,必須安裝Excel到機器上才能打開!','注意',MB_OKCANCEL)=ID_no then
Exit;
end;
try
WorkBook:=xlsapp.WorkBooks.Add;
if Querycw_gsm_izd.RecordCount=0 then
begin
ShowMessage('對不起,請先查詢后再進行導出!');
Exit;
end;
Querycw_gsm_izd.First;
Row:=1;
for Tmp:=0 to 32 do
xlsapp.Cells(Row,Tmp+1):=Querycw_gsm_izd.FieldDefs.Items[Tmp].Name;
while not Querycw_gsm_izd.Eof do
begin
Row:=Row+1;
for Tmp:=0 to 29 do
xlsapp.Cells(Row,Tmp+1):=Querycw_gsm_izd.FieldByName(Querycw_gsm_izd.FieldDefs.Items[Tmp].Name).AsString;
Querycw_gsm_izd.Next;
end;
WorkBook.saveas(xlsFileName);
WorkBook.close;
FormMain.StatusBarMain.Panels[1].Text:='導出完畢!詳細的路徑為:'+SaveDialog1.GetNamePath+'\'+xlsFileName+'...';
except
ShowMessage('對不起,EXCEL文件有問題!');
end;
end
else if SaveDialog1.FilterIndex=2 then //dbf files
begin
OutFileName:=SaveDialog1.FileName;
if FileExists(OutFileName) then
if Application.MessageBox('文件已經存在,是否覆蓋?','請注意',MB_YESNO)<>ID_YES then Exit;
OutDir := '';
while pos('\',OutFileName)<>0 do
begin
OutDir := OutDir + Copy(OutFileName,1,pos('\',OutFileName));
OutFileName := Copy(OutFileName,pos('\',OutFileName)+1,Length(OutFileName));
end;
with Table1 DO
begin
CLOSE;
DatabaseName := OutDir;
TableType := ttFoxPro;
TableName := OutFileName;
with FieldDefs do
begin
Clear;
Add('SID', ftSTRING, 15, false);
end;
CreateTable;
end;
Table1.Open;
Querycw_gsm_izd.First;
while not Querycw_gsm_izd.eof DO
begin
Table1.Append;
Table1.FieldByName('SID').AsString:=Querycw_gsm_izd.fieldbyname('sid').AsString;
Table1.POST;
Querycw_gsm_izd.Next;
end;
Table1.Close;
FormMain.StatusBarMain.Panels[1].Text:='導出完畢!...';
end
else if SaveDialog1.FilterIndex=3 then //txt files
begin
OutFileName:=SaveDialog1.FileName;
if FileExists(OutFileName) then
if MessageDlg('文件已經存在,是否覆蓋?',mtWarning,mbOKCancel,0)=mrCancel then Exit;
AssignFile(Output,OutFileName);
Rewrite(Output);
Writeln('您導出的內容如下:'+OutFileName);
Writeln('');
for Tmp:=0 to 29 do
Write(Querycw_gsm_izd.FieldDefs.Items[Tmp].Name+' ');
Writeln('');
Querycw_gsm_izd.First;
while not Querycw_gsm_izd.Eof do
begin
for Tmp:=0 to 29 do
write(Querycw_gsm_izd.FieldByName(Querycw_gsm_izd.FieldDefs.Items[Tmp].Name).AsString+' ');
Writeln('');
Querycw_gsm_izd.Next;
end;
CloseFile(Output);
end;
end;
FormMain.StatusBarMain.Panels[1].Text := '導出完畢,請到相關的路徑下查詢.....';
end;
procedure TFormACC_GSM.edacc_sidKeyPress(Sender: TObject; var Key: Char);
var
sqlstr:string;
begin
if not (key in ['0'..'9',#8,#13]) then
key:=#0;//只能輸入數字
IF Key=#13 then //觸發回車事件 查詢營業檔案資料
selectrecord;//查詢檔案
end;
procedure TFormACC_GSM.selectrecord;
var
sqlstr:string;
begin //查詢檔案
// if not dm_main.TableACC_MSP.Active then
// dm_main.TableACC_MSP.Open;
if not dm_main.TableJX.Active then
dm_main.TableJX.Active:=true;
sqlstr:='select * from acc_Gsm';
FormMain.StatusBarMain.Panels[1].Text := '系統正在查詢中,請稍候......';
if PageControlMain.ActivePageIndex=3 then //search in actual tel fee!!
begin
PageControlMainChange(nil);
Exit;
end;
// if dm_main.Txtpzb.FieldByName('RIST_HOME').AsString='1' then
begin
if JBDM<>0 then
sqlstr:=sqlstr+' where off_no_home='+IntToStr(JX)
else
sqlstr:=sqlstr+' where (0=0) ';
end ;
// else
// sqlstr:=sqlstr+' where (0=0) ';
if (Length(trim(edacc_sid.Text))=11) or (Length(trim(edacc_sid.Text))=7) then
begin
with dm_main.QueryACC_GSM do
begin
Close;
SQL.Clear;
SQL.Add(sqlstr+' and sid=:sid ');
ParamByName('sid').AsString:=Trim(edacc_sid.Text);
Prepare;
Open;
if eof then
begin
Application.MessageBox('該電話號碼有誤(找不到)!請重新輸入!','錯誤',MB_OK);
edacc_sid.SelectAll;
edacc_sid.SetFocus;
SetNull;
exit;
end
else
letdb;
end;
end
else
begin
Messagebox(handle,'該電話號碼有誤!請重新輸入!','錯誤',MB_OK);
edacc_sid.SelectAll;
edacc_sid.SetFocus;
Fun_ComponentStatus(self,1,False); // 清空輸入框數值
exit;
end;
end;
procedure TFormACC_GSM.Btn_ExitClick(Sender: TObject);
begin
close;
end;
procedure TFormACC_GSM.FlatButton1Click(Sender: TObject);
var
select_form:TFormSELECTJT;
begin
if trim(edacc_sid.text)='' then
begin
showmessage('請先輸入手機號碼!');
edacc_sid.SetFocus;
Exit;
end;
select_form:=TFormSELECTJT.Create(self);
If JTMC<>'' then
begin
select_form.rad_jt.checked:=true;
select_form.Addjt;
select_form.cbjt_jtyhmc.itemindex:=select_form.cbjt_jtyhmc.Items.IndexOf(JTMC);
select_form.cbjt_jtyhmc.enabled:=false;
end;
select_form.ShowModal;
select_form.free;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -