From f18886276aef6384fab449762cd9ca8ac95d00e1 Mon Sep 17 00:00:00 2001 From: sgwp <63001967@qq.com> Date: Thu, 14 Nov 2024 11:29:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E6=9C=9F=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public10/ThreeFun/Fun/U_Fun.pas | 134 +++++++++++++++++++++++++++++- public10/ThreeFun/Fun/U_RTFun.pas | 4 +- 2 files changed, 135 insertions(+), 3 deletions(-) diff --git a/public10/ThreeFun/Fun/U_Fun.pas b/public10/ThreeFun/Fun/U_Fun.pas index 0690f1f..b6ba4e6 100644 --- a/public10/ThreeFun/Fun/U_Fun.pas +++ b/public10/ThreeFun/Fun/U_Fun.pas @@ -1920,7 +1920,7 @@ begin else if Controls[i] is TcxDateEdit then begin if not IsEmpty and not fieldByName(mfield).IsNull then - TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString; + TcxDateEdit(Controls[i]).date :=fieldByName(mfield).AsDateTime; end else if Controls[i] is TcxTimeEdit then begin @@ -4037,5 +4037,137 @@ begin ClientDataSet1.Delete; end; +procedure LSCSHData(ADOQueryTmp: TADOQuery; mParent: TdxLayoutControl; FTag: Integer); +var + i, idx: Integer; + mfield, mfieldCode: string; + ma: TA; +begin + with ADOQueryTmp do + begin + if isEmpty then + exit; + with mParent do + begin + for i := 0 to ControlCount - 1 do + begin + if Controls[i] is TLabel then + continue; + if Controls[i].Tag <> FTag then + continue; + mfield := Controls[i].Name; + + if Controls[i] is TEdit then + begin + if Trim(fieldByName(mfield).AsString) <> '' then + TEdit(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is TcxTextEdit then + begin + if Trim(fieldByName(mfield).AsString) <> '' then + TcxTextEdit(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is TRTComboBox then + begin + idx := TRTComboBox(Controls[i]).IndexOfItem2(Trim(fieldByName(mfield).AsString)); + TComboBox(Controls[i]).ItemIndex := idx; + end + else if Controls[i] is TRichEdit then + begin + if Trim(fieldByName(mfield).AsString) <> '' then + TRichEdit(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is TcxRichEdit then + begin + if Trim(fieldByName(mfield).AsString) <> '' then + TcxRichEdit(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is TComboBox then + begin + if TComboBox(Controls[i]).Items.Count > 0 then + begin + idx := TComboBox(Controls[i]).Items.IndexOf(Trim(fieldByName(mfield).AsString)); + end + else + idx := -1; + TComboBox(Controls[i]).ItemIndex := idx; + end + else if Controls[i] is TcxComboBox then + begin + if TcxComboBox(Controls[i]).Properties.Items.Count > 0 then + begin + idx := TcxComboBox(Controls[i]).Properties.Items.IndexOf(Trim(fieldByName(mfield).AsString)); + end + else + idx := -1; + TcxComboBox(Controls[i]).ItemIndex := idx; + end + else if Controls[i] is TBtnEditA then + begin + if Trim(TBtnEditA(Controls[i]).Hint) <> '' then + begin + TBtnEditA(TBtnEditA(Controls[i])).TxtCode := Trim(fieldByName(mfield).AsString); + TBtnEditA(Controls[i]).Text := Trim(fieldByName(Trim(TBtnEditA(Controls[i]).Hint)).AsString); + end + else + begin + TBtnEditA(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end; + + end + else if Controls[i] is TBtnEditC then + begin + TBtnEditC(TBtnEditA(Controls[i])).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is TDateTimePicker then + begin + if Trim(fieldByName(mfield).AsString) = '' then + begin + TDateTimePicker(Controls[i]).Checked := false; + end + else + TDateTimePicker(Controls[i]).DateTime := fieldByName(mfield).AsDateTime; + end + else if Controls[i] is Tmemo then + begin + Tmemo(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is Tcxmemo then + begin + Tcxmemo(Controls[i]).Text := Trim(fieldByName(mfield).AsString); + end + else if Controls[i] is TcxDateEdit then + begin + if not isEmpty and not fieldByName(mfield).IsNull then + TcxDateEdit(Controls[i]).date := fieldByName(mfield).AsDateTime; + end + else if Controls[i] is TcxTimeEdit then + begin + if not isEmpty and (fieldByName(mfield).AsString <> '') then + TcxTimeEdit(Controls[i]).Text := fieldByName(mfield).AsString; + end + else if Controls[i] is TcxCurrencyEdit then + begin + TcxCurrencyEdit(Controls[i]).Text := fieldByName(mfield).AsString; + end + else if Controls[i] is TcheckBox then + begin + TcheckBox(Controls[i]).Checked := fieldByName(mfield).asBoolean; + end + else if Controls[i] is TcxButtonEdit then + begin + TcxButtonEdit(Controls[i]).Text := Trim(fieldByName(mfield).AsString); +// if TcxButtonEdit(Controls[i]).ParentShowHint = false then +// begin +// mfieldCode := Trim(Copy(mfield, 1, Length(mfield) - 4)); +// TcxButtonEdit(Controls[i]).Hint := Trim(fieldByName(mfieldCode).AsString); +// end; + end; + end; // end for + end; // end with + end; // end for with + +end; + end. diff --git a/public10/ThreeFun/Fun/U_RTFun.pas b/public10/ThreeFun/Fun/U_RTFun.pas index e50b2dd..cef92e4 100644 --- a/public10/ThreeFun/Fun/U_RTFun.pas +++ b/public10/ThreeFun/Fun/U_RTFun.pas @@ -985,7 +985,7 @@ begin else if Controls[i] is TcxDateEdit then begin if not isEmpty and not fieldByName(mfield).IsNull then - TcxDateEdit(Controls[i]).Text := fieldByName(mfield).AsString; + TcxDateEdit(Controls[i]).date := fieldByName(mfield).AsDateTime; end else if Controls[i] is TcxTimeEdit then begin @@ -3523,7 +3523,7 @@ begin else if Controls[i] is TcxDateEdit then begin if not isEmpty and not fieldByName(mfield).IsNull then - TcxDateEdit(Controls[i]).Text := fieldByName(mfield).AsString; + TcxDateEdit(Controls[i]).date := fieldByName(mfield).AsDateTime; end else if Controls[i] is TcxTimeEdit then begin