📄 paydeclare.pas
字号:
end;
filehandle:=FileCreate(SaveDialog1.FileName);
fileclose(filehandle);
assignfile(txtfile,SaveDialog1.FileName);
rewrite(txtfile);
with datashare_form.Query1 do
begin
close;
sql.Clear;
ls_sql:='select opid,manid,psseno,cpseno,year,ttwage,months,rewage,opcode,opdate,procflg,opseno from pswgcase where year='+FE_year.Text+' and procflg='+chr(39)+'1'+chr(39);
//ls_sql:='select a.manid manid,a.iscode iscode,a.psname psname,a.agcardno agcardno';
//ls_sql:=ls_sql+',a.psseno psseno,b.year year,b.ttwage ttwage,b.months months,b.rewage rewage,b.opcode opcode,b.opdate opdate from psarch a,pswgcase b where a.manid=b.manid and b.year='+FE_year.Text+' and b.procflg='+chr(39)+'1'+chr(39);
sql.Add(ls_sql);
prepare;
open;
while not eof do
begin
//ls_line:=fieldbyname('manid').AsString+' '+fieldbyname('iscode').AsString+' '+fieldbyname('psname').AsString+' '+fieldbyname('agcardno').AsString+' ';
//ls_line:=ls_line+fieldbyname('psseno').AsString +' '+fieldbyname('year').AsString+' '+fieldbyname('ttwage').AsString+' '+fieldbyname('months').AsString+' '+fieldbyname('rewage').AsString+' '+fieldbyname('opcode').AsString+' '+fieldbyname('opdate').AsString;
ls_line:=fieldbyname('opid').AsString+chr(9)+fieldbyname('manid').AsString+chr(9)+fieldbyname('psseno').AsString+chr(9);
ls_line:=ls_line+fieldbyname('cpseno').AsString+chr(9)+fieldbyname('year').AsString+chr(9)+fieldbyname('ttwage').AsString+chr(9)+fieldbyname('months').AsString+chr(9)+fieldbyname('rewage').AsString+chr(9);
ls_line:=ls_line+fieldbyname('opcode').AsString+chr(9)+fieldbyname('opdate').AsString+chr(9)+fieldbyname('procflg').AsString+chr(9)+fieldbyname('opseno').AsString;
writeln(txtfile,ls_line);
next;
end;
end;
closefile(txtfile);
application.MessageBox('缴费工资申报数据已经成功导出!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
end;
//application.MessageBox(pchar(SaveDialog1.FileName),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
except
on e:exception do
begin
application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
end;
end;
end;
procedure Tpaydeclare_form.FE_yearKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if key=13 then
begin
FE_yearExit(self);
end;
end;
procedure Tpaydeclare_form.DBGrid1ColEnter(Sender: TObject);
begin
inherited;
if dbgrid1.SelectedIndex in [0..2] then
dbgrid1.SelectedIndex:=3;
end;
procedure Tpaydeclare_form.DBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if key=13 then
begin
if dbgrid1.SelectedIndex=6 then
begin
if not rmd.Eof then
begin
dbgrid1.SelectedIndex:=3;
rmd.Next;
end;
end
else
dbgrid1.SelectedIndex:=dbgrid1.SelectedIndex+1;
end;
if key=45 then
begin
key:=0;
RMD.Cancel;
exit;
end;
end;
procedure Tpaydeclare_form.DBGrid1Enter(Sender: TObject);
begin
inherited;
if dbgrid1.SelectedIndex in [0..2] then
dbgrid1.SelectedIndex:=3;
end;
procedure Tpaydeclare_form.TreeViewCP1Changing(Sender: TObject;
Node: TTreeNode; var AllowChange: Boolean);
var
ret:integer;
begin
inherited;
if IsModified then
begin
ret:=Application.MessageBox('职工缴费工资信息已经被修改,是否要保存?','保存确认',MB_YESNOCANCEL+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal);
if ret=IDYES then
begin
if not save then
begin
AllowChange:=false;
exit;
end;
AllowChange:=true;
exit;
end
else
if ret=IDNO then
begin
cancel_butExecute(nil);
AllowChange:=true;
exit;
end
else
begin
AllowChange:=false;
exit;
end;
end;
end;
procedure Tpaydeclare_form.TreeViewCP1Change(Sender: TObject;
Node: TTreeNode);
var
ls_ids,ls_sql:string;
begin
inherited;
if trim(FE_year.Text)='' then
exit;
rmd.Close;
rmd.Open;
ls_ids:=treeviewcp1.GenerateOrganIds(treeviewcp1.Selected,main_form.user.operid);
ls_sql:='select a.cpseno cpseno,a.psseno psseno,a.manid manid,a.iscode iscode,a.psname psname,a.agcardno agcardno,a.organid organid,b.ttwage ttwage,b.months months,b.rewage rewage,b.lockflg lockflg,a.rewage currewage ';
ls_sql:=ls_sql+' from {oj psarch a left outer join pswgcase b on (a.manid=b.manid and b.year='+FE_year.Text+' and b. procflg='+chr(39)+'1'+chr(39)+')} where a.status='+chr(39)+'1'+chr(39)+' and a.organid in ('+ls_ids+')';
if priorColumn<>nil then
begin
if IsAsc then
begin
ls_sql:=ls_sql+' order by '+priorcolumn.FieldName+' asc';
end else
begin
ls_sql:=ls_sql+' order by '+priorcolumn.FieldName+' desc';
end;
end else
begin
ls_sql:=ls_sql+' order by a.agcardno asc';
end;
RMDDisplay(ls_sql);
IsModified:=false;
InfoUpdate;
end;
procedure Tpaydeclare_form.FE_yearExit(Sender: TObject);
var
ls_sql:string;
year,month,day:word;
ret:integer;
begin
inherited;
if not IsYearModified then
exit;
try
DecodeDate(strtodateTime(FE_year.Text+'-01-01'),year,month,day);
except
on e:exception do
begin
application.MessageBox('非法年度!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
FE_year.SetFocus;
exit;
end;
end;
if IsModified then
begin
ret:=Application.MessageBox('职工缴费工资信息已经被修改,是否要保存?','保存确认',MB_YESNOCANCEL+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal);
if ret=IDYES then
begin
if not save then
begin
FE_year.SetFocus;
exit;
end;
end
else
if ret=IDNO then
begin
IsModified:=false;
//cancel_butExecute(nil);
end
else
begin
FE_year.SetFocus;
exit;
end;
end;
IsYearModified:=false;
if treeviewcp1.Selected=nil then
begin
application.MessageBox('请先选择一个单位或部门!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
end;
rmd.Close;
if treeviewcp1.Selected=nil then
begin
ls_sql:='select a.cpseno cpseno,a.psseno psseno,a.manid manid,a.iscode iscode,a.psname psname,a.agcardno agcardno,a.organid organid,b.ttwage ttwage,b.months months,b.rewage rewage,b.lockflg lockflg,a.rewage currewage ';
ls_sql:=ls_sql+' from {oj psarch a left outer join pswgcase b on (a.manid=b.manid and b.year='+FE_year.Text+' and b. procflg='+chr(39)+'1'+chr(39)+')} where a.status='+chr(39)+'1'+chr(39);
end
else
begin
ls_sql:='select a.cpseno cpseno,a.psseno psseno,a.manid manid,a.iscode iscode,a.psname psname,a.agcardno agcardno,a.organid organid,b.ttwage ttwage,b.months months,b.rewage rewage,b.lockflg lockflg,a.rewage currewage ';
ls_sql:=ls_sql+' from {oj psarch a left outer join pswgcase b on (a.manid=b.manid and b.year='+FE_year.Text+' and b. procflg='+chr(39)+'1'+chr(39)+')} where a.status='+chr(39)+'1'+chr(39)+' and a.organid in ('+treeviewcp1.GenerateOrganIds(treeviewcp1.Selected,main_form.user.operid)+')';
end;
if priorColumn<>nil then
begin
if IsAsc then
begin
ls_sql:=ls_sql+' order by '+priorcolumn.FieldName+' asc';
end else
begin
ls_sql:=ls_sql+' order by '+priorcolumn.FieldName+' desc';
end;
end else
begin
ls_sql:=ls_sql+' order by a.agcardno asc';
end;
rmd.Open;
RMDDisplay(ls_sql);
infoupdate;
end;
procedure Tpaydeclare_form.FE_yearChange(Sender: TObject);
begin
inherited;
if not IsYearModified then
IsYearModified:=true;
end;
procedure Tpaydeclare_form.FormClose(Sender: TObject;
var Action: TCloseAction);
var
i:integer;
begin
inherited;
for i:=0 to treeviewCP1.Items.Count-1 do
Dispose(treeviewCP1.Items[i].Data); //释放Data指针所指的内存
end;
procedure Tpaydeclare_form.DBGrid1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
{if (key=40) or (key=9) then
begin
if RMD.Eof then
begin
RMD.Cancel;
// RMD.Last;
end;
exit;
end; }
end;
procedure Tpaydeclare_form.help_butExecute(Sender: TObject);
begin
inherited;
if (HHCtrlHandle = 0) then
application.MessageBox('帮助文件不存在!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal)
else
FHelpSystemHook.HelpContext(1030200);
end;
procedure Tpaydeclare_form.BB_searchClick(Sender: TObject);
var
ls_keyfield,ls_cond:string;
begin
inherited;
if treeviewcp1.Selected=nil then
begin
application.MessageBox('请先选择一个单位或部门!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
end;
ls_cond:=trim(E_cond.Text);
if ls_cond='' then
begin
application.MessageBox('请输入查找内容!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
E_cond.SetFocus;
exit;
end;
try
if RMD.Locate('agcardno',ls_cond,[loPartialKey]) then
exit;
except
end;
try
if RMD.Locate('iscode',ls_cond,[loPartialKey]) then
exit;
except
end;
try
if not RMD.Locate('psname',ls_cond,[loPartialKey]) then
application.MessageBox('找不到符合条件的人!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
except
end;
end;
procedure Tpaydeclare_form.E_condKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if key=#13 then
BB_searchClick(self);
end;
procedure Tpaydeclare_form.RMDttwageSetText(Sender: TField;
const Text: String);
begin
inherited;
try
strtofloat(text);
sender.Value:=text;
except
on e:exception do
begin
application.MessageBox('非法数值!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
end;
procedure Tpaydeclare_form.RMDmonthsSetText(Sender: TField;
const Text: String);
begin
inherited;
try
strtoint(text);
sender.Value:=text;
except
on e:exception do
begin
application.MessageBox('非法数值!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
end;
procedure Tpaydeclare_form.RMDrewageSetText(Sender: TField;
const Text: String);
begin
inherited;
try
strtofloat(text);
sender.Value:=text;
except
on e:exception do
begin
application.MessageBox('非法数值!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end;
end;
procedure Tpaydeclare_form.DBGrid1TitleClick(Column: TColumn);
var
ret:integer;
begin
inherited;
if (lowercase(column.FieldName)='iscode') or (lowercase(column.FieldName)='psname') or (lowercase(column.FieldName)='agcardno') then
begin
if treeviewcp1.Selected=nil then
begin
application.MessageBox('请先选择一个单位或部门!','恩普软件',MB_OK+MB_ICONINFORMATION+MB_SystemModal);
exit;
end;
{if IsModified then
begin
ret:=Application.MessageBox('职工缴费工资信息已经被修改,是否要保存?','保存确认',MB_YESNOCANCEL+MB_DEFBUTTON1+MB_IconQuestion+MB_SystemModal);
if ret=IDYES then
begin
if not save then
begin
exit;
end;
end
else
if ret=IDNO then
begin
cancel_butExecute(nil);
end
else
begin
exit;
end;
end;}
sort(column,dbgrid1,PriorColumn,IsAsc);
end;
end;
procedure Tpaydeclare_form.DataSource1DataChange(Sender: TObject;
Field: TField);
begin
inherited;
if RMD.Eof then
begin
RMD.Cancel;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -