📄 cwa170_02.pas
字号:
unit Cwa170_02;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Bas100_01, dxCntner, dxEditor, dxExEdtr, dxEdLib, StdCtrls,
ExtCtrls, Buttons, Menus;
type
TCwa170_02Form = class(TBas100_01Form)
Label1: TLabel;
edtFromYear: TdxSpinEdit;
edtToYear: TdxSpinEdit;
Label2: TLabel;
Label3: TLabel;
edtMonth: TdxSpinEdit;
Label4: TLabel;
edtDay: TdxSpinEdit;
Label5: TLabel;
bbtnOk: TBitBtn;
bbtnExit: TBitBtn;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
edtSetDay: TdxSpinEdit;
Label6: TLabel;
Bevel1: TBevel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbtnOkClick(Sender: TObject);
procedure bbtnExitClick(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
private
procedure SetMonth(AYear:Integer);
procedure SetInterface;
{ Private declarations }
public
{ Public declarations }
end;
var
Cwa170_02Form: TCwa170_02Form;
implementation
uses CommFun, SYSDATA;
{$R *.dfm}
procedure TCwa170_02Form.SetMonth(AYear:Integer);
var
J:Integer;
AFromDate,AToDate:TDateTime;
AMonth:string;
AMonths:Integer;
begin
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('delete from CWA170 where C170_001='+IntToStr(AYear));
SYSDM.qryQuery.ExecSql;
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('select * from CWA170');
SYSDM.qryQuery.Open;
for J:=1 to 12 do
begin
AFromDate:=0;
AToDate:=0;
//按自然月份
if RadioButton1.Checked then
begin
AMonths:=edtMonth.IntValue+J-1;
if AMonths=12 then
begin
AFromDate:=EncodeDate(AYear,AMonths,edtDay.IntValue);
AToDate:=EncodeDate(AYear+1,1,edtDay.IntValue);
end else
if AMonths>12 then
begin
AFromDate:=EncodeDate(AYear+1,AMonths-12,edtDay.IntValue);
AToDate:=EncodeDate(AYear+1,AMonths-12+1,edtDay.IntValue);
end else
begin
AFromDate:=EncodeDate(AYear,AMonths,edtDay.IntValue);
AToDate:=EncodeDate(AYear,AMonths+1,edtDay.IntValue);
end;
AToDate:=AToDate-1;
end
//按指定日期
else if RadioButton2.Checked then
begin
AMonths:=edtMonth.IntValue+J-1;
if AMonths=12 then
begin
AFromDate:=EncodeDate(AYear,AMonths,edtSetDay.IntValue);
AToDate:=EncodeDate(AYear+1,1,edtSetDay.IntValue);
end else
if AMonths>12 then
begin
AFromDate:=EncodeDate(AYear,AMonths-12,edtSetDay.IntValue);
AToDate:=EncodeDate(AYear+1,AMonths-12+1,edtSetDay.IntValue);
end else
begin
AFromDate:=EncodeDate(AYear,AMonths,edtSetDay.IntValue);
AToDate:=EncodeDate(AYear,AMonths+1,edtSetDay.IntValue);
end;
AToDate:=AToDate-1;
end;
case J of
1 :AMonth:='一月';
2 :AMonth:='二月';
3 :AMonth:='三月';
4 :AMonth:='四月';
5 :AMonth:='五月';
6 :AMonth:='六月';
7 :AMonth:='七月';
8 :AMonth:='八月';
9 :AMonth:='九月';
10:AMonth:='十月';
11:AMonth:='十一月';
12:AMonth:='十二月';
end;
try
SYSDM.qryQuery.Append;
SYSDM.qryQuery.FieldByName('C170_001').Value:=AYear;
SYSDM.qryQuery.FieldByName('C170_002').Value:=J;
SYSDM.qryQuery.FieldByName('C170_003').Value:=AMonth;
SYSDM.qryQuery.FieldByName('C170_004').Value:=AFromDate;
SYSDM.qryQuery.FieldByName('C170_005').Value:=AToDate;
SYSDM.qryQuery.FieldByName('C170_006').Value:='';
SYSDM.qryQuery.Post;
except
ShowMsg(SYSDM.ADOC.Errors[0].Description,1);
Abort;
end;
end;
end;
procedure TCwa170_02Form.SetInterface;
begin
Caption:=GetDBString('CWA17002001'); //设置
Label1.Caption:=GetDBString('CWA17002002'); //年份范围
Label2.Caption:=GetDBString('CWA17002003'); //至
Label3.Caption:=GetDBString('CWA17002004'); //起始日期
Label4.Caption:=GetDBString('CWA17002005'); //月
Label5.Caption:=GetDBString('CWA17002006'); //日
RadioButton1.Caption:=GetDBString('CWA17002007'); //按自然月份
RadioButton2.Caption:=GetDBString('CWA17002008'); //按指定日期
Label6.Caption:=GetDBString('CWA17002009'); //日
end;
procedure TCwa170_02Form.FormCreate(Sender: TObject);
var
yy,mm,dd:Word;
begin
inherited;
DecodeDate(Date,yy,mm,dd);
edtFromYear.IntValue:=yy;
edtToYear.IntValue:=yy;
SetInterface;
end;
procedure TCwa170_02Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
//
end;
procedure TCwa170_02Form.bbtnOkClick(Sender: TObject);
var
I:Integer;
begin
inherited;
//确定
if edtFromYear.IntValue>edtToYear.IntValue then
begin
ShowMsg('UMS10000066'); //起始年份不能大于结束年份
Abort;
end;
for I:=edtFromYear.IntValue to edtToYear.IntValue do
begin
SetMonth(I);
end;
ShowMsg('UMS10000067'); //薪资期段设置成功
Close;
end;
procedure TCwa170_02Form.bbtnExitClick(Sender: TObject);
begin
inherited;
//退出
Close;
end;
procedure TCwa170_02Form.RadioButton1Click(Sender: TObject);
begin
inherited;
edtSetDay.Enabled:=RadioButton2.Checked;
Label6.Enabled:=RadioButton2.Checked;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -