From 98f3d8882b49667c06fbb6593f11ca5473f33736 Mon Sep 17 00:00:00 2001 From: funa <1559646174@qq.com> Date: Tue, 23 Jun 2026 17:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- A09财务通用管理/U_SingleCustStatement.dfm | 42 ++++++- A09财务通用管理/U_SingleCustStatement.pas | 141 +++++++++++++++++++++- 2 files changed, 178 insertions(+), 5 deletions(-) diff --git a/A09财务通用管理/U_SingleCustStatement.dfm b/A09财务通用管理/U_SingleCustStatement.dfm index d499a4a..9fd5c99 100644 --- a/A09财务通用管理/U_SingleCustStatement.dfm +++ b/A09财务通用管理/U_SingleCustStatement.dfm @@ -44,16 +44,32 @@ object frmSingleCustStatement: TfrmSingleCustStatement ImageIndex = 1 OnClick = TBRafreshClick end - object ToolButton3: TToolButton + object TBVerify: TToolButton Left = 71 Top = 0 AutoSize = True + Caption = #26680#23545 + ImageIndex = 12 + OnClick = TBVerifyClick + end + object TBCancelVerify: TToolButton + Left = 142 + Top = 0 + AutoSize = True + Caption = #25764#38144#26680#23545 + ImageIndex = 11 + OnClick = TBCancelVerifyClick + end + object ToolButton3: TToolButton + Left = 237 + Top = 0 + AutoSize = True Caption = #25171#21360 ImageIndex = 21 OnClick = ToolButton3Click end object ToolButton1: TToolButton - Left = 142 + Left = 308 Top = 0 AutoSize = True Caption = #23548#20986 @@ -61,7 +77,7 @@ object frmSingleCustStatement: TfrmSingleCustStatement OnClick = ToolButton1Click end object ToolButton2: TToolButton - Left = 213 + Left = 379 Top = 0 AutoSize = True Caption = #20445#23384#26684#24335 @@ -69,7 +85,7 @@ object frmSingleCustStatement: TfrmSingleCustStatement OnClick = ToolButton2Click end object TBClose: TToolButton - Left = 308 + Left = 474 Top = 0 AutoSize = True Caption = #20851#38381 @@ -610,11 +626,13 @@ object frmSingleCustStatement: TfrmSingleCustStatement Height = 542 Align = alClient TabOrder = 3 + ExplicitTop = 73 object TV11: TcxGridDBTableView Navigator.Buttons.CustomButtons = <> Navigator.Buttons.Delete.Enabled = False Navigator.Buttons.Delete.Visible = False ScrollbarAnnotations.CustomAnnotations = <> + OnCustomDrawCell = TV11CustomDrawCell DataController.DataSource = DS_HZ DataController.Filter.AutoDataSetFilter = True DataController.Options = [dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoImmediatePost] @@ -669,6 +687,17 @@ object frmSingleCustStatement: TfrmSingleCustStatement Styles.Header = DataLink_Financial.Default Styles.Inactive = DataLink_Financial.SHuangSe Styles.Selection = DataLink_Financial.SHuangSe + object TV11ssel: TcxGridDBColumn + Caption = #36873#25321 + DataBinding.FieldName = 'ssel' + DataBinding.IsNullValueType = True + PropertiesClassName = 'TcxCheckBoxProperties' + Properties.ImmediatePost = True + Properties.NullStyle = nssUnchecked + FixedKind = fkLeftDynamic + HeaderAlignmentHorz = taCenter + Width = 66 + end object cxGridDBColumn1: TcxGridDBColumn Caption = #24207#21495 DataBinding.FieldName = 'keyNO' @@ -876,6 +905,11 @@ object frmSingleCustStatement: TfrmSingleCustStatement object TV11Column4: TcxGridDBColumn DataBinding.IsNullValueType = True end + object TV11is_checked: TcxGridDBColumn + DataBinding.FieldName = 'is_checked' + DataBinding.IsNullValueType = True + Visible = False + end end object cxGridLevel2: TcxGridLevel GridView = TV11 diff --git a/A09财务通用管理/U_SingleCustStatement.pas b/A09财务通用管理/U_SingleCustStatement.pas index 3affb44..c7ddd4d 100644 --- a/A09财务通用管理/U_SingleCustStatement.pas +++ b/A09财务通用管理/U_SingleCustStatement.pas @@ -110,6 +110,10 @@ type TV11Column3: TcxGridDBColumn; TV11Column4: TcxGridDBColumn; TV11Column5: TcxGridDBColumn; + TV11is_checked: TcxGridDBColumn; + TV11ssel: TcxGridDBColumn; + TBVerify: TToolButton; + TBCancelVerify: TToolButton; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); @@ -120,10 +124,17 @@ type procedure FormCreate(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure ToolButton2Click(Sender: TObject); + procedure TBVerifyClick(Sender: TObject); + procedure TBCancelVerifyClick(Sender: TObject); + procedure TV11CustomDrawCell(Sender: TcxCustomGridTableView; + ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; + var ADone: Boolean); private { Private declarations } procedure InitGrid(); + + procedure UpdateCheckedStatus(Checked: Boolean); public { Public declarations } FOppCoNo, FOurCoNo, FCurrency: string; @@ -138,6 +149,22 @@ uses U_DataLink, U_RTFun, U_ZDYHelp; {$R *.dfm} +procedure SplitDelimited(const S: string; Delimiter: Char; List: TStrings); +var + i: Integer; + SL: TStringList; +begin + SL := TStringList.Create; + try + SL.StrictDelimiter := True; + SL.Delimiter := Delimiter; + SL.DelimitedText := S; + for i := 0 to SL.Count - 1 do + List.Add(SL[i]); + finally + SL.Free; + end; +end; procedure TfrmSingleCustStatement.InitGrid(); begin @@ -153,7 +180,7 @@ begin sql.Add(' ,@OppCoNo=' + QuotedStr(Trim(FOppCoNo))); sql.Add(' ,@OurCoNo=' + QuotedStr(Trim(FOurCoNo))); sql.Add(' ,@Currency=' + QuotedStr(Trim(FCurrency))); -// showmessage(sql.text); + showmessage(sql.text); Open; end; SCreateCDS(ADOQueryMain, CDS_HZ); @@ -170,6 +197,20 @@ begin Action := caFree; end; +procedure TfrmSingleCustStatement.TBVerifyClick(Sender: TObject); +begin + if CDS_HZ.IsEmpty then Exit; + if MessageDlg('ȷϽѡеļ¼ΪѺ˶', mtConfirmation, [mbYes, mbNo], 0) <> mrYes then Exit; + UpdateCheckedStatus(True); +end; + +procedure TfrmSingleCustStatement.TBCancelVerifyClick(Sender: TObject); +begin + if CDS_HZ.IsEmpty then Exit; + if MessageDlg('ȷϽѡеļ¼ȡ˶', mtConfirmation, [mbYes, mbNo], 0) <> mrYes then Exit; + UpdateCheckedStatus(False); +end; + procedure TfrmSingleCustStatement.TBCloseClick(Sender: TObject); begin @@ -190,6 +231,8 @@ begin InitGrid(); end; + + procedure TfrmSingleCustStatement.P_OrderNo_YSK(Sender: TObject); begin ToolButton2.Click; @@ -238,5 +281,101 @@ begin end; +procedure TfrmSingleCustStatement.TV11CustomDrawCell( + Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; + AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); +var + ARecord: TcxCustomGridRecord; +begin + ARecord := AViewInfo.GridRecord; + if ARecord = nil then + Exit; + + if (not VarIsNull(ARecord.Values[TV11is_checked.Index])) and + (ARecord.Values[TV11is_checked.Index] = 1) then + begin + ACanvas.Brush.Color := $CCFFCC; + end; +end; + +procedure TfrmSingleCustStatement.UpdateCheckedStatus(Checked: Boolean); +var + FlowIDList, InvoiceIDList, TempIDs: string; + FlowIDsAll, InvoiceIDsAll: TStringList; + vBookmark: TBookmark; + targetValue: Integer; +begin + if CDS_HZ.IsEmpty then Exit; + + targetValue := Ord(Checked); + + FlowIDsAll := TStringList.Create; + InvoiceIDsAll := TStringList.Create; + try + CDS_HZ.DisableControls; + vBookmark := CDS_HZ.Bookmark; + try + CDS_HZ.First; + while not CDS_HZ.Eof do + begin + if CDS_HZ.FieldByName('ssel').AsBoolean then + begin + if not CDS_HZ.FieldByName('flow_ids').IsNull then + begin + TempIDs := CDS_HZ.FieldByName('flow_ids').AsString; + SplitDelimited(TempIDs, ',', FlowIDsAll); + end; + if not CDS_HZ.FieldByName('invoice_ids').IsNull then + begin + TempIDs := CDS_HZ.FieldByName('invoice_ids').AsString; + SplitDelimited(TempIDs, ',', InvoiceIDsAll); + end; + end; + CDS_HZ.Next; + end; + finally + CDS_HZ.Bookmark := vBookmark; + CDS_HZ.EnableControls; + end; + + FlowIDsAll.Sorted := True; + FlowIDsAll.Duplicates := dupIgnore; + InvoiceIDsAll.Sorted := True; + InvoiceIDsAll.Duplicates := dupIgnore; + + if FlowIDsAll.Count > 0 then + begin + FlowIDList := FlowIDsAll.CommaText; + ADOQueryCmd.Close; + ADOQueryCmd.SQL.Text := + 'UPDATE FF SET is_checked = :p ' + + 'FROM Finance_Flow FF ' + + 'INNER JOIN dbo.F_Tool_SplitString(:ids, '','') S ON FF.FFID = S.RTValue'; + ADOQueryCmd.Parameters.ParamByName('p').Value := targetValue; + ADOQueryCmd.Parameters.ParamByName('ids').Value := FlowIDList; + ADOQueryCmd.ExecSQL; + end; + + if InvoiceIDsAll.Count > 0 then + begin + InvoiceIDList := InvoiceIDsAll.CommaText; + ADOQueryCmd.Close; + ADOQueryCmd.SQL.Text := + 'UPDATE FI SET is_checked = :p ' + + 'FROM Finance_Invoice FI ' + + 'INNER JOIN dbo.F_Tool_SplitString(:ids, '','') S ON FI.IVId = S.RTValue'; + ADOQueryCmd.Parameters.ParamByName('p').Value := targetValue; + ADOQueryCmd.Parameters.ParamByName('ids').Value := InvoiceIDList; + ADOQueryCmd.ExecSQL; + end; + + finally + FlowIDsAll.Free; + InvoiceIDsAll.Free; + end; + + InitGrid(); +end; + end.