⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ggjs.pas

📁 2004090611144625767.rar 资源名称:通用工资管理
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      i_record:=i_record-1;
      datamodule1.ggjss.next;
      datamodule1.ggjs.next;
      end;
  end;
end
               else//重写公式
begin
//找上月数据
   str:='select *from ggjs where Extract(year from a_date)=';
   str:=str+edit1.text+' and extract(month from a_date)=';
   str:=str+a_month;
   with datamodule1.ggjss do
   begin
   close;
   sql.clear;
   sql.add(str);
   prepare;
   open;
   end;
      if datamodule1.ggjss.eof then //如果找不到上月数据
 begin //根据最新看过的数据进行
  button3.click;
 datamodule1.ggjsn.close;
 datamodule1.ggjsn.open;
     while not datamodule1.ggjsn.eof do
     begin
     with datamodule1.ggjss do  //开始复制
     begin
     append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjsn.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjsn.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
//fieldbyname('a_jsgs').asstring:=datamodule1.ggjsn.fieldbyname('a_jsgs').asstring;
      post;
      end;
      datamodule1.ggjsn.next;
      end;
 end
                       else //有上月数据
 begin
      while i_record>0 do
      begin
      with datamodule1.ggjs do //开始复制上月数据
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjss.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjss.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
//fieldbyname('a_jsgs').asstring:=datamodule1.ggjss.fieldbyname('a_jsgs').asstring;
      post;
      end;
      i_record:=i_record-1;
      datamodule1.ggjss.next;
      datamodule1.ggjs.Next;
      end;
      end;
 end;
end;
end;

str:='select *from ggjs where extract(year from a_date)=';
str:=str+edit1.text+' and extract(month from a_date)=';
str:=str+edit2.text;
with datamodule1.ggjss do
begin
close;
sql.clear;
sql.add(str);
prepare;
open;
end;
end;
procedure Tggjsb.UpDown2MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
str:string;
a_month:string;
i_record:integer;
begin
button3.click;
i_record:=20;
if strtoint(edit2.text)=0 then
a_month:='12'
else
a_month:=inttostr(strtoint(edit2.text)-1);
button3.click;
str:='select *from ggjs where Extract(year from a_date)=';
str:=str+edit1.text+' and extract(month from a_date)=';
str:=str+edit2.text;
with datamodule1.ggjss do
begin
close;
sql.clear;
sql.add(str);
prepare;
open;
end;
if datamodule1.ggjss.eof then  //还没有录入公式
   if application.messagebox('本月还未输入公式要输入公式吗?','程序执行确认',mb_yesno+mb_defbutton2+mb_iconstop+mb_applmodal)=idyes then
                if application.messagebox('要带入上月数据吗?','程序执行确认',mb_yesno+mb_defbutton2+mb_iconstop+mb_applmodal)=idyes then
                      begin       //找到上月数据
   str:='select *from ggjs where Extract(year from a_date)=';
   str:=str+edit1.text+' and extract(month from a_date)=';
   str:=str+a_month;
   with datamodule1.ggjss do
   begin
   close;
   sql.clear;
   sql.add(str);
   prepare;
   open;
   end;
      if datamodule1.ggjss.eof then //如果没有上月数据
      begin //根据最新看过的数据进行
   while not datamodule1.ggjsn.eof do
    begin
      with datamodule1.ggjss do  //开始复制
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjsn.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjsn.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
fieldbyname('a_jsgs').asstring:=datamodule1.ggjsn.fieldbyname('a_jsgs').asstring;
      post;
      end;
      datamodule1.ggjsn.next;
      end;
                       end
                       else //有上月数据
      begin
      while i_record>0 do
      begin
      with datamodule1.ggjss do //开始复制上月数据
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjss.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjss.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
fieldbyname('a_jsgs').asstring:=datamodule1.ggjss.fieldbyname('a_jsgs').asstring;
      post;
      end;
      i_record:=i_record-1;
      end;
      end;
               end
               else//不带上月数据
                  begin       //找上月数据
   str:='select *from ggjs where Extract(year from a_date)=';
   str:=str+edit1.text+' and extract(month from a_date)=';
   str:=str+a_month;
   with datamodule1.ggjss do
   begin
   close;
   sql.clear;
   sql.add(str);
   prepare;
   open;
   end;
      if datamodule1.ggjss.eof then //如果找不到上月数据
      begin //根据最新看过的数据进行
   datamodule1.ggjsn.close;
   datamodule1.ggjsn.open;
   while not datamodule1.ggjsn.eof do
    begin
      with datamodule1.ggjss do  //开始复制
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjsn.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjsn.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
//fieldbyname('a_jsgs').asstring:=datamodule1.ggjsn.fieldbyname('a_jsgs').asstring;
      post;
      end;
      datamodule1.ggjsn.next;
      end;
                       end
                       else //有上月数据
      begin
      while i_record>0 do
      begin
      with datamodule1.ggjss do //开始复制上月数据
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjss.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjss.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
//fieldbyname('a_jsgs').asstring:=datamodule1.ggjss.fieldbyname('a_jsgs').asstring;
      post;
      end;
      i_record:=i_record-1;
      end;
      end;
               end;
       datasource1.dataset.close;
       datasource1.dataset.open;
       end;

procedure Tggjsb.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if datamodule1.ggjss.State in [dsinsert,dsedit] then
datamodule1.ggjss.Post;
self.release;
end;

procedure Tggjsb.Button3Click(Sender: TObject);
var
i_record:integer;
str:string;
begin
i_record:=20;
str:='select *from ggjs where a_date<';
str:=str+''''+(edit2.text+'/'+'15'+'/'+edit1.text)+'''';
with datamodule1.ggjss do
begin
close;
sql.clear;
sql.add(str);
prepare;
open;
end;
datamodule1.ggjsn.close;
datamodule1.ggjsn.open;
while i_record>0 do
begin
with datamodule1.ggjsn do
begin
edit;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjss.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjss.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=datamodule1.ggjss.fieldbyname('a_date').asdatetime;
fieldbyname('a_jsgs').asstring:=datamodule1.ggjss.fieldbyname('a_jsgs').asstring;
post;
end;
i_record:=i_record-1;
datamodule1.ggjsn.next;
datamodule1.ggjss.next;
end;

end;
procedure Tggjsb.Button4Click(Sender: TObject);
var
str:string;
a_month:string;
i_record:integer;
begin
i_record:=20;
if strtoint(edit2.text)=0 then
a_month:='12'
else
a_month:=inttostr(strtoint(edit2.text)-1);
button3.click;
str:='select *from ggjs where Extract(year from a_date)=';
str:=str+edit1.text+' and extract(month from a_date)=';
str:=str+edit2.text;
with datamodule1.ggjss do
begin
close;
sql.clear;
sql.add(str);
prepare;
open;
end;
if datamodule1.ggjss.eof then  //还没有录入公式
   begin
  // if application.messagebox('本月还未输入公式要输入公式吗?','程序执行确认',mb_yesno+mb_defbutton2+mb_iconstop+mb_applmodal)=idyes then
                      //begin
                       if application.messagebox('要重新输入公式吗?','程序执行确认',mb_yesno+mb_defbutton2+mb_iconstop+mb_applmodal)<>idyes then
begin// 不重新输入公式
                          //找上月数据
   str:='select *from ggjs where Extract(year from a_date)=';
   str:=str+edit1.text+' and extract(month from a_date)=';
   str:=str+a_month;
   with datamodule1.ggjss do
   begin
   close;
   sql.clear;
   sql.add(str);
   prepare;
   open;
   end;
      if datamodule1.ggjss.eof then //如果没有上月数据
 begin //根据最新看过的数据进行
       button3.click;
       if datamodule1.ggjsn.state in [dsinsert,dsedit] then
       datamodule1.ggjsn.post;
       datamodule1.ggjsn.close;
       datamodule1.ggjsn.open;
     // showmessage(inttostr(datamodule1.ggjsn.recordcount));
      while not datamodule1.ggjsn.eof do
      begin
      with datamodule1.ggjss do  //开始复制
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjsn.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjsn.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
fieldbyname('a_jsgs').asstring:=datamodule1.ggjsn.fieldbyname('a_jsgs').asstring;
      post;
      end;
      datamodule1.ggjsn.next;
      end;
 end
                       else //有上月数据
  begin
     // showmessage('有上月数据');
      while i_record>0 do
      begin
      datamodule1.ggjs.close;
      datamodule1.ggjs.open;
      with datamodule1.ggjs do //开始复制上月数据
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjss.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjss.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
fieldbyname('a_jsgs').asstring:=datamodule1.ggjss.fieldbyname('a_jsgs').asstring;
      post;
      end;
      i_record:=i_record-1;
      datamodule1.ggjss.next;
      datamodule1.ggjs.next;
      end;
  end;
end
               else//重写公式
begin
//找上月数据
   str:='select *from ggjs where Extract(year from a_date)=';
   str:=str+edit1.text+' and extract(month from a_date)=';
   str:=str+a_month;
   with datamodule1.ggjss do
   begin
   close;
   sql.clear;
   sql.add(str);
   prepare;
   open;
   end;
      if datamodule1.ggjss.eof then //如果找不到上月数据
 begin //根据最新看过的数据进行
  button3.click;
 datamodule1.ggjsn.close;
 datamodule1.ggjsn.open;
     while not datamodule1.ggjsn.eof do
     begin
     with datamodule1.ggjss do  //开始复制
     begin
     append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjsn.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjsn.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
//fieldbyname('a_jsgs').asstring:=datamodule1.ggjsn.fieldbyname('a_jsgs').asstring;
      post;
      end;
      datamodule1.ggjsn.next;
      end;
 end
                       else //有上月数据
 begin
      while i_record>0 do
      begin
      with datamodule1.ggjs do //开始复制上月数据
      begin
      append;
fieldbyname('a_gzcm').asstring:=datamodule1.ggjss.fieldbyname('a_gzcm').asstring;
fieldbyname('a_smdm').asstring:=datamodule1.ggjss.fieldbyname('a_smdm').asstring;
fieldbyname('a_date').asdatetime:=strtodate(edit1.text+'-'+edit2.text+'-'+'15');
//fieldbyname('a_jsgs').asstring:=datamodule1.ggjss.fieldbyname('a_jsgs').asstring;
      post;
      end;
      i_record:=i_record-1;
      datamodule1.ggjss.next;
      datamodule1.ggjs.Next;
      end;
      end;
 end;
//end;
end;
str:='select *from ggjs where extract(year from a_date)=';
str:=str+edit1.text+' and extract(month from a_date)=';
str:=str+edit2.text;
with datamodule1.ggjss do
begin
close;
sql.clear;
sql.add(str);
prepare;
open;
end;
datasource1.dataset.close;
datasource1.dataset.open;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -