?? tass00_01.pas.svn-base
字號:
unit TasS00_01;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BAS100_01, Menus, StdCtrls, Buttons, ComCtrls, dxExEdtr,
dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms;
type
TTasS00_01Form = class(TBas100_01Form)
PageControl1: TPageControl;
bbtnOk: TBitBtn;
bbtnExit: TBitBtn;
TabSheet1: TTabSheet;
gbUnit: TGroupBox;
lblUnit: TLabel;
cbUnit: TComboBox;
edtDay: TEdit;
lblDay: TLabel;
edtWeek: TEdit;
lblWeek: TLabel;
edtMonth: TEdit;
lblMonth: TLabel;
cbChangeUnit: TCheckBox;
gbPriority: TGroupBox;
lblPriority: TLabel;
edtHight: TEdit;
edtLow: TEdit;
edtDefault: TEdit;
lblDefault: TLabel;
gbOther: TGroupBox;
cbDelete: TCheckBox;
cbStatus: TCheckBox;
TabSheet2: TTabSheet;
Label1: TLabel;
dxDBGrid1: TdxDBGrid;
dsTas120: TDataSource;
adsTas120: TADODataSet;
adsTas120FSel: TBooleanField;
adsTas120FNo: TIntegerField;
adsTas120FName: TStringField;
adsTas120FRemark: TStringField;
dxDBGrid1FSel: TdxDBGridCheckColumn;
dxDBGrid1FName: TdxDBGridMaskColumn;
dxDBGrid1FRemark: TdxDBGridMaskColumn;
qryQuery: TADOQuery;
lblByTotal: TLabel;
lblTotal: TLabel;
cbTotal: TComboBox;
lblByFinish: TLabel;
lblFinish: TLabel;
cbFinish: TComboBox;
cbUpdate: TCheckBox;
cbHours: TCheckBox;
cbItems: TCheckBox;
cbClass: TComboBox;
cbCount: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbtnOkClick(Sender: TObject);
procedure bbtnExitClick(Sender: TObject);
procedure edtDayKeyPress(Sender: TObject; var Key: Char);
procedure edtWeekKeyPress(Sender: TObject; var Key: Char);
procedure edtMonthKeyPress(Sender: TObject; var Key: Char);
procedure edtHightKeyPress(Sender: TObject; var Key: Char);
procedure edtLowKeyPress(Sender: TObject; var Key: Char);
procedure edtDefaultKeyPress(Sender: TObject; var Key: Char);
procedure dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
procedure dxDBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
procedure SetInterface;
{ Private declarations }
public
{ Public declarations }
end;
var
TasS00_01Form: TTasS00_01Form;
implementation
uses SYSDATA, CommFun;
{$R *.dfm}
procedure TTasS00_01Form.SetInterface;
var
S,ANo:String;
ABoolean:Boolean;
begin
Caption:=GetDBString('TASS0001001'); //任務(wù)管理參數(shù)
TabSheet1.Caption:=GetDBString('TASS0001002'); //參數(shù)設(shè)置
gbUnit.Caption:=GetDBString('TASS0001003'); //時間單位
gbPriority.Caption:=GetDBString('TASS0001004'); //優(yōu)先級別
gbOther.Caption:=GetDBString('TASS0001005'); //其他參數(shù)
lblUnit.Caption:=GetDBString('TASS0001006'); //時間單位
lblDay.Caption:=GetDBString('TASS0001007'); //時為一天
lblWeek.Caption:=GetDBString('TASS0001008'); //天為一周
lblMonth.Caption:=GetDBString('TASS0001009'); //天為一月
cbChangeUnit.Caption:=GetDBString('TASS0001010'); //允許單據(jù)錄入時更改時間單位
lblPriority.Caption:=GetDBString('TASS0001011'); //優(yōu)先級別
lblDefault.Caption:=GetDBString('TASS0001012'); //優(yōu)先級缺省值
cbDelete.Caption:=GetDBString('TASS0001013'); //允許刪除狀態(tài)為完成的任務(wù)計劃下的任務(wù)匯報單
bbtnOk.Caption:=GetDBString('TASS0001014'); //確定(&O)
bbtnExit.Caption:=GetDBString('TASS0001015'); //退出(&X)
lblByTotal.Caption:=GetDBString('TASS0001016'); //按照
lblByFinish.Caption:=lblByTotal.Caption; //按照
lblTotal.Caption:=GetDBString('TASS0001017'); //統(tǒng)計任務(wù)計劃的總數(shù)量
lblFinish.Caption:=GetDBString('TASS0001018'); //統(tǒng)計任務(wù)計劃的完成數(shù)量
cbTotal.Clear;
cbTotal.Items.Add(GetDBString('TASS0001019')); //申報日期
cbTotal.Items.Add(GetDBString('TASS0001020')); //需求日期
cbTotal.Items.Add(GetDBString('TASS0001021')); //預(yù)計開始日期
cbTotal.Items.Add(GetDBString('TASS0001022')); //預(yù)計完成日期
cbTotal.Items.Add(GetDBString('TASS0001023')); //實際開始日期
cbTotal.Items.Add(GetDBString('TASS0001024')); //實際完成日期
cbTotal.ItemIndex:=0;
cbUpdate.Caption:=GetDBString('TASS0001025'); //任務(wù)完成時,反寫客戶資料的產(chǎn)品信息(安裝日期、保養(yǎng)日期)
cbHours.Caption:=GetDBString('TASS0001026'); //任務(wù)匯報時,是否錄入詳細的工時信息
cbItems.Caption:=GetDBString('TASS0001027'); //任務(wù)匯報時,是否錄入詳細的零件信息
cbCount.Caption:=GetDBString('TASS0001028'); //計費工時允許為零
cbFinish.Clear;
cbFinish.Items:=cbTotal.Items;
cbFinish.ItemIndex:=5;
S:=GetSysParams('TAS0001');//時間單位 0=時,1=天,2=周,3=月
if S<>'' then cbUnit.ItemIndex:=StrToInt(S);
S:=GetSysParams('TAS0002'); //8時為一天
if S<>'' then edtDay.Text:=S;
S:=GetSysParams('TAS0003'); //5天為一周
if S<>'' then edtWeek.Text:=S;
S:=GetSysParams('TAS0004'); //22天為一月
if S<>'' then edtMonth.Text:=S;
S:=GetSysParams('TAS0005'); //允許單據(jù)錄入時更改時間單位
if S<>'' then cbChangeUnit.Checked:=S='Y';
S:=GetSysParams('TAS0006'); //最高優(yōu)先級別
if S<>'' then edtHight.Text:=S;
S:=GetSysParams('TAS0007'); //最低優(yōu)先級別
if S<>'' then edtLow.Text:=S;
S:=GetSysParams('TAS0008'); //優(yōu)先級缺省值
if S<>'' then edtDefault.Text:=S;
S:=GetSysParams('TAS0009'); //允許刪除狀態(tài)為完成的任務(wù)計劃下的任務(wù)匯報單
if S<>'' then cbDelete.Checked:=S='Y';
S:=GetSysParams('TAS0010'); //使用顏色標明任務(wù)的狀態(tài)。如:計劃=黑色,執(zhí)行=藍色,完成=灰色,返工=紅色
if S<>'' then cbStatus.Checked:=S='Y';
//完成數(shù)量統(tǒng)計中包含下列狀態(tài)
S:=GetSysParams('TAS0011'); //完成數(shù)量統(tǒng)計中包含下列狀態(tài)
if S='' then S:='[3]';
adsTas120.Close;
adsTas120.FieldDefs.Clear;
adsTas120.FieldDefs.Add('FSel',ftBoolean,0);
adsTas120.FieldDefs.Add('FNo',ftInteger,0);
adsTas120.FieldDefs.Add('FName',ftString,50);
adsTas120.FieldDefs.Add('FRemark',ftString,100);
adsTas120.CreateDataSet;
qryQuery.Close;
qryQuery.SQL.Clear;
qryQuery.SQL.Add('select * from TAS120 order by T120_002');
qryQuery.Open;
while not qryQuery.Eof do
begin
ANo:='['+qryQuery.FieldByName('T120_001').AsString+']';
if Pos(ANo,S)<>0 then ABoolean:=True else ABoolean:=False;
adsTas120.Append;
adsTas120.FieldByName('FSel').Value:=ABoolean;
adsTas120.FieldByName('FNo').Value:=qryQuery.FieldByName('T120_001').Value;
adsTas120.FieldByName('FName').Value:=qryQuery.FieldByName('T120_003').Value;
adsTas120.FieldByName('FRemark').Value:=qryQuery.FieldByName('T120_004').Value;
adsTas120.Post;
qryQuery.Next;
end;
//按照"申報日期"統(tǒng)計任務(wù)計劃的總數(shù)量
S:=GetSysParams('TAS0012'); //按照"申報日期"統(tǒng)計任務(wù)計劃的總數(shù)量
if S='' then S:='0';
cbTotal.ItemIndex:=StrToInt(S); //申報日期
//按照"實際完成日期"統(tǒng)計任務(wù)計劃的完成數(shù)量
S:=GetSysParams('TAS0013'); //按照"實際完成日期"統(tǒng)計任務(wù)計劃的完成數(shù)量
if S='' then S:='5';
cbFinish.ItemIndex:=StrToInt(S); //實際完成日期
S:=GetSysParams('TAS0014'); //任務(wù)完成時,反寫客戶資料的產(chǎn)品信息(安裝日期、保養(yǎng)日期)
if S<>'' then cbUpdate.Checked:=S='Y';
S:=GetSysParams('TAS0015'); //任務(wù)匯報時,是否錄入詳細的工時信息
if S<>'' then cbHours.Checked:=S='Y';
S:=GetSysParams('TAS0016'); //任務(wù)匯報時,是否錄入詳細的零件信息
if S<>'' then cbItems.Checked:=S='Y';
S:=GetSysParams('TAS0018'); //計費工時允許為零
if S<>'' then cbCount.Checked:=S='Y';
cbClass.Clear;
qryQuery.Close;
qryQuery.SQL.Clear;
qryQuery.SQL.Add('select T100_001,T100_002 from TAS100 where T100_005<>0');
qryQuery.Open;
while not qryQuery.Eof do
begin
cbClass.Items.Add(qryQuery.FieldByName('T100_002').AsString);
qryQuery.Next;
end;
S:=GetSysParams('TAS0017'); //反寫客戶資料的產(chǎn)品信息(安裝日期、保養(yǎng)日期)的任務(wù)類別
if S='' then S:='-1';
if qryQuery.Locate('T100_001',StrToInt(S),[]) then
S:=qryQuery.FieldByName('T100_002').AsString
else
S:='';
cbClass.ItemIndex:=cbClass.Items.IndexOf(S);
end;
procedure TTasS00_01Form.FormCreate(Sender: TObject);
begin
inherited;
SetInterface;
PageControl1.ActivePageIndex:=0;
end;
procedure TTasS00_01Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
qryQuery.Close;
adsTas120.Close;
end;
procedure TTasS00_01Form.bbtnOkClick(Sender: TObject);
var
S,ANo:string;
begin
inherited;
//確定(&O)
Screen.Cursor:=crHourGlass;
//時間單位 0=時,1=天,2=周,3=月
SetSysParams('TAS0001',IntToStr(cbUnit.ItemIndex));
//8時為一天
SetSysParams('TAS0002',edtDay.Text);
//5天為一周
SetSysParams('TAS0003',edtWeek.Text);
//22天為一月
SetSysParams('TAS0004',edtMonth.Text);
//允許單據(jù)錄入時更改時間單位
if cbChangeUnit.Checked then SetSysParams('TAS0005','Y') else SetSysParams('TAS0005','N');
//最高優(yōu)先級別
SetSysParams('TAS0006',edtHight.Text);
//最低優(yōu)先級別
SetSysParams('TAS0007',edtLow.Text);
//優(yōu)先級缺省值
SetSysParams('TAS0008',edtDefault.Text);
//允許刪除狀態(tài)為完成的任務(wù)計劃下的任務(wù)匯報單
if cbDelete.Checked then SetSysParams('TAS0009','Y') else SetSysParams('TAS0009','N');
//使用顏色標明任務(wù)的狀態(tài)。如:計劃=黑色,執(zhí)行=藍色,完成=灰色,返工=紅色
if cbStatus.Checked then SetSysParams('TAS0010','Y') else SetSysParams('TAS0010','N');
//完成數(shù)量統(tǒng)計中包含下列狀態(tài)
S:='';
adsTas120.First;
while not adsTas120.Eof do
begin
if adsTas120.FieldByName('FSel').AsBoolean then
begin
ANo:='['+adsTas120.FieldByName('FNo').AsString+'],';
S:=S+ANo;
end;
adsTas120.Next;
end;
if S='' then S:='[3]' else Delete(S,Length(S),1); //刪除最后的,號
SetSysParams('TAS0011',S); //完成數(shù)量統(tǒng)計中包含下列狀態(tài)
//完成數(shù)量統(tǒng)計中包含下列狀態(tài)
AStatusNo:=GetSysParams('TAS0011');
if AStatusNo='' then AStatusNo:='[3]';
ReplaceString('[','',AStatusNo);
ReplaceString(']','',AStatusNo);
//按照"申報日期"統(tǒng)計任務(wù)計劃的總數(shù)量
SetSysParams('TAS0012',IntToStr(cbTotal.ItemIndex));
//按照"實際完成日期"統(tǒng)計任務(wù)計劃的完成數(shù)量
SetSysParams('TAS0013',IntToStr(cbFinish.ItemIndex));
case cbTotal.ItemIndex of
0:AByTotal:='T510_006'; //0=申報日期 T510_006
1:AByTotal:='T510_007'; //1=需求日期 T510_007
2:AByTotal:='T510_025'; //2=預(yù)計開始日期 T510_025
3:AByTotal:='T510_026'; //3=預(yù)計完成日期 T510_026
4:AByTotal:='T510_027'; //4=實際開始日期 T510_027
5:AByTotal:='T510_028'; //5=實際完成日期 T510_028
end;
case cbFinish.ItemIndex of
0:AByFinish:='T510_006'; //0=申報日期 T510_006
1:AByFinish:='T510_007'; //1=需求日期 T510_007
2:AByFinish:='T510_025'; //2=預(yù)計開始日期 T510_025
3:AByFinish:='T510_026'; //3=預(yù)計完成日期 T510_026
4:AByFinish:='T510_027'; //4=實際開始日期 T510_027
5:AByFinish:='T510_028'; //5=實際完成日期 T510_028
end;
//任務(wù)完成時,反寫客戶資料的產(chǎn)品信息(安裝日期、保養(yǎng)日期)
if cbUpdate.Checked then SetSysParams('TAS0014','Y') else SetSysParams('TAS0014','N');
//任務(wù)匯報時,是否錄入詳細的工時信息
if cbHours.Checked then SetSysParams('TAS0015','Y') else SetSysParams('TAS0015','N');
//任務(wù)匯報時,是否錄入詳細的零件信息
if cbItems.Checked then SetSysParams('TAS0016','Y') else SetSysParams('TAS0016','N');
//計費工時允許為零
if cbCount.Checked then SetSysParams('TAS0018','Y') else SetSysParams('TAS0018','N');
//反寫客戶資料的產(chǎn)品信息(安裝日期、保養(yǎng)日期)的任務(wù)類別
qryQuery.Close;
qryQuery.SQL.Clear;
qryQuery.SQL.Add('select T100_001 from TAS100 where T100_002='+''''+cbClass.Text+'''');
qryQuery.Open;
S:=qryQuery.FieldByName('T100_001').AsString;
if S='' then S:='-1';
SetSysParams('TAS0017',S);
Screen.Cursor:=crDefault;
ShowMsg('UMS10000051'); //系統(tǒng)參數(shù)設(shè)置成功
Close;
end;
procedure TTasS00_01Form.bbtnExitClick(Sender: TObject);
begin
inherited;
//退出(&X)
Close;
end;
procedure TTasS00_01Form.edtDayKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtWeekKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtMonthKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtHightKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtLowKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtDefaultKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if Key=#32 then //vk_space
begin
adsTas120.Edit;
adsTas120.FieldByName('FSel').AsBoolean:=not adsTas120.FieldByName('FSel').AsBoolean;
adsTas120.Post;
end;
end;
procedure TTasS00_01Form.dxDBGrid1MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if dxDBGrid1.GetColumnAt(X,Y)=nil then Exit;
if dxDBGrid1.GetColumnAt(X,Y).Field.FieldName='FSel' then
begin
adsTas120.Edit;
adsTas120.FieldByName('FSel').AsBoolean:=not adsTas120.FieldByName('FSel').AsBoolean;
adsTas120.Post;
end;
end;
initialization
RegisterClass(TTasS00_01Form);
finalization
UnRegisterClass(TTasS00_01Form);
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -