Currency 數(shù)據(jù)類型 Currency 變量存儲(chǔ)為 64 位(8 個(gè)字節(jié))整型的數(shù)值形式,然后除以 10,000 給出一個(gè)定點(diǎn)數(shù),其小數(shù)點(diǎn)左邊有 15 位數(shù)字,右邊有 4 位數(shù)字。這種表示法的范圍可以從 -922,337,203,685,477.5808 到 922,337,203,685,477.5807。Currency 的類型聲明字符為at號(hào) (@)。Currency數(shù)據(jù)類型在貨幣計(jì)算與定點(diǎn)計(jì)算中很有用,在這種場(chǎng)合精度特別重要。
DataSet.FieldByName('WareSum').AsCurrency := DataSet.FieldByName('WarePrice').AsCurrency * DataSet.FieldByName('WareCount').AsInteger; ADOLookup.Append; // 給數(shù)據(jù)集中添加數(shù)據(jù) ADOLookup.FieldByName('WareID').AsString := '1'; ADOLookup.FieldByName('WareCode').AsString := '0001'; ADOLookup.FieldByName('WareName').AsString := '西紅市'; ADOLookup.FieldByName('WareSpell').AsString := 'XHS'; ADOLookup.FieldByName('WareSpace').AsString := '斤/筐'; ADOLookup.FieldByName('WareUnit').AsString := '斤'; ADOLookup.FieldByName('WarePrice').AsString := '30'; ADOLookup.Post; if ADOLookup.IsEmpty then Exit; if Assigned(FOnSelect) then FOnSelect(ADOLookup); Close; TSelectEvent = procedure (DataSet:TDataSet) of object; FOnSelect:TSelectEvent; property OnSelect:TSelectEvent read FOnSelect write FOnSelect; Result := InplaceEditor.EditText; // 返回可編輯單元的內(nèi)容 function TMyDBGrid.GetCellRect: TRect; begin Result := CellRect(Col,Row); end; function TMyDBGrid.GetText: string; begin Result := InplaceEditor.EditText; end; procedure TFrmStockOrder.FormDestroy(Sender: TObject); begin FrmLookup.Free; end; |
|