|
|
unit u_info_plan_add;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, bsSkinCtrls, StdCtrls, wwdbdatetimepicker, BusinessSkinForm,DateUtils;
|
|
|
|
|
|
type
|
|
|
Tfrm_info_plan_add = class(TForm)
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
|
|
|
bsSkinGroupBox2: TbsSkinGroupBox;
|
|
|
Notebook1: TbsSkinNotebook;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
Edit1: TEdit;
|
|
|
Edit3: TEdit;
|
|
|
Label3: TLabel;
|
|
|
Edit2: TEdit;
|
|
|
Edit4: TEdit;
|
|
|
Label4: TLabel;
|
|
|
Edit5: TEdit;
|
|
|
Label5: TLabel;
|
|
|
Edit6: TEdit;
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
Edit7: TEdit;
|
|
|
Label6: TLabel;
|
|
|
Label7: TLabel;
|
|
|
Edit8: TEdit;
|
|
|
Label8: TLabel;
|
|
|
Label9: TLabel;
|
|
|
procedure bsSkinCheckRadioBox1Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinCheckRadioBox2Click(Sender: TObject);
|
|
|
procedure bsSkinCheckRadioBox3Click(Sender: TObject);
|
|
|
procedure Edit6Change(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure Edit1Change(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_info_plan_add: Tfrm_info_plan_add;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function, u_info_plan_individual;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_info_plan_add.bsSkinCheckRadioBox1Click(Sender: TObject);
|
|
|
begin
|
|
|
Notebook1.PageIndex:=0;
|
|
|
wwDBDateTimePicker1.Date:=DATE;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
Notebook1.PageIndex:=0;
|
|
|
wwDBDateTimePicker1.Date:=DATE;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.bsSkinCheckRadioBox2Click(Sender: TObject);
|
|
|
begin
|
|
|
Notebook1.PageIndex:=1;
|
|
|
Edit7.text:=inttostr(YearOf(Date));
|
|
|
Edit1.Text:=inttostr(WeekofYear(Date));
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.bsSkinCheckRadioBox3Click(Sender: TObject);
|
|
|
begin
|
|
|
Notebook1.PageIndex:=2;
|
|
|
Edit8.text:=inttostr(YearOf(Date));
|
|
|
Edit6.Text:=inttostr(MonthOf(Date));
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.Edit6Change(Sender: TObject);
|
|
|
begin
|
|
|
if (Edit6.Text='')or(Edit8.Text='') then
|
|
|
begin
|
|
|
Edit4.Text:='';
|
|
|
Edit5.Text:='';
|
|
|
exit;
|
|
|
end;
|
|
|
try
|
|
|
strtoint(Edit6.Text);
|
|
|
strtoint(Edit8.Text);
|
|
|
except
|
|
|
Edit4.Text:='';
|
|
|
Edit5.Text:='';
|
|
|
exit;
|
|
|
end;
|
|
|
if (strtoint(Edit6.Text)<1)or(strtoint(Edit6.Text)>12)
|
|
|
or (strtoint(Edit8.text)<2006)or(strtoint(Edit8.text)>2020) then
|
|
|
begin
|
|
|
Edit4.Text:='';
|
|
|
Edit5.Text:='';
|
|
|
exit;
|
|
|
end;
|
|
|
IF(strtoint(Edit6.Text)=12) THEN
|
|
|
BEGIN
|
|
|
Edit4.Text:=Edit8.text+'-'+Edit6.Text+'-'+'01';
|
|
|
Edit5.Text:=datetostr(strtodatetime(inttostr(strtoint(Edit8.text)+1)+'-'+'01'+'-'+'01')-1);
|
|
|
END
|
|
|
ELSE
|
|
|
begin
|
|
|
Edit4.Text:=Edit8.text+'-'+Edit6.Text+'-'+'01';
|
|
|
Edit5.Text:=datetostr(strtodatetime(Edit8.text+'-'+inttostr(strtoint(Edit6.Text)+1)+'-'+'01')-1);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.Edit1Change(Sender: TObject);
|
|
|
begin
|
|
|
if (Edit7.text='')or(Edit1.text='') then
|
|
|
begin
|
|
|
Edit3.text:='';
|
|
|
Edit2.text:='';
|
|
|
exit;
|
|
|
end;
|
|
|
try
|
|
|
strtoint(Edit7.text);
|
|
|
strtoint(Edit1.text);
|
|
|
except
|
|
|
Edit3.text:='';
|
|
|
Edit2.text:='';
|
|
|
exit;
|
|
|
end;
|
|
|
if (strtoint(Edit7.text)<2006)or(strtoint(Edit7.text)>2020)
|
|
|
or (strtoint(Edit1.text)<1) or(strtoint(Edit1.text)>54) then
|
|
|
begin
|
|
|
Edit3.text:='';
|
|
|
Edit2.text:='';
|
|
|
exit;
|
|
|
end;
|
|
|
Edit3.text:=datetostr(dayofW(Edit7.text,strtoint(Edit1.Text)));
|
|
|
Edit2.text:=datetostr(dayofW(Edit7.text,strtoint(Edit1.Text))+6);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_info_plan_add.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.checked then
|
|
|
begin
|
|
|
if wwDBDateTimePicker1.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
if bsSkinCheckRadioBox2.checked then
|
|
|
begin
|
|
|
if Edit1.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
if bsSkinCheckRadioBox3.checked then
|
|
|
begin
|
|
|
if Edit6.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
try
|
|
|
modify_all:=true;
|
|
|
frm_info_plan_individual.t_info_plan.insert;
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD>״̬']:='¼<><C2BC>״̬';
|
|
|
if bsSkinCheckRadioBox1.checked then
|
|
|
begin
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:=wwDBDateTimePicker1.text;
|
|
|
frm_info_plan_individual.t_info_plan['<27><>']:=inttostr(yearof(wwDBDateTimePicker1.date));
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD>ƻ<EFBFBD>';
|
|
|
frm_info_plan_individual.t_info_plan.post;
|
|
|
frm_info_plan_individual.t_info_plan_detail.insert;
|
|
|
frm_info_plan_individual.t_info_plan_detail['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>';
|
|
|
frm_info_plan_individual.t_info_plan_detail['ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=wwDBDateTimePicker1.date;
|
|
|
frm_info_plan_individual.t_info_plan_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
frm_info_plan_individual.t_info_plan_detail['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
|
|
|
frm_info_plan_individual.t_info_plan_detail.post;
|
|
|
end;
|
|
|
if bsSkinCheckRadioBox2.checked then
|
|
|
begin
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27><>'+Edit1.text+'<27><>';
|
|
|
frm_info_plan_individual.t_info_plan['<27><>']:=Edit7.text;
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27>ܼƻ<DCBC>';
|
|
|
frm_info_plan_individual.t_info_plan.post;
|
|
|
for i:=0 to round(strtodate(Edit2.text)-strtodate(Edit3.text)) do
|
|
|
begin
|
|
|
frm_info_plan_individual.t_info_plan_detail.insert;
|
|
|
frm_info_plan_individual.t_info_plan_detail['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>';
|
|
|
frm_info_plan_individual.t_info_plan_detail['ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=strtodate(Edit3.text)+i;
|
|
|
frm_info_plan_individual.t_info_plan_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
frm_info_plan_individual.t_info_plan_detail['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
|
|
|
frm_info_plan_individual.t_info_plan_detail.post;
|
|
|
end;
|
|
|
end;
|
|
|
if bsSkinCheckRadioBox3.checked then
|
|
|
begin
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:=Edit6.text+'<27><>';
|
|
|
frm_info_plan_individual.t_info_plan['<27><>']:=Edit8.text;
|
|
|
frm_info_plan_individual.t_info_plan['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27>¼ƻ<C2BC>';
|
|
|
frm_info_plan_individual.t_info_plan.post;
|
|
|
for i:=0 to round(strtodate(Edit5.text)-strtodate(Edit4.text)) do
|
|
|
begin
|
|
|
frm_info_plan_individual.t_info_plan_detail.insert;
|
|
|
frm_info_plan_individual.t_info_plan_detail['<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>';
|
|
|
frm_info_plan_individual.t_info_plan_detail['ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=strtodate(Edit4.text)+i;
|
|
|
frm_info_plan_individual.t_info_plan_detail['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
frm_info_plan_individual.t_info_plan_detail['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
|
|
|
frm_info_plan_individual.t_info_plan_detail.post;
|
|
|
end;
|
|
|
end;
|
|
|
close;
|
|
|
finally
|
|
|
modify_all:=false;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|