unit U_ClothContractList_TP; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC, cxCheckBox, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter; type TfrmClothContractList_Tp = class(TForm) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBAdd: TToolButton; TBEdit: TToolButton; TBDel: TToolButton; TBPrint: TToolButton; TBClose: TToolButton; Panel1: TPanel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; Label1: TLabel; Label2: TLabel; cxGridPopupMenu1: TcxGridPopupMenu; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; Label3: TLabel; ConNo: TEdit; Label5: TLabel; C_CodeName: TEdit; TBExport: TToolButton; Order_Main: TClientDataSet; Label4: TLabel; C_Color: TEdit; ScrollBox1: TScrollBox; cxGrid1: TcxGrid; Tv1: TcxGridDBTableView; v1OrderNo: TcxGridDBColumn; v1Column2: TcxGridDBColumn; v1DeliveryDate: TcxGridDBColumn; v1FactoryNo1Name: TcxGridDBColumn; v1PRTSpec: TcxGridDBColumn; v1PRTMF: TcxGridDBColumn; v1PRTKZ: TcxGridDBColumn; v1PRTOrderQty: TcxGridDBColumn; v1OrderUnit: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; ClientDataSet3: TClientDataSet; DataSource2: TDataSource; DataSource3: TDataSource; ClientDataSet2: TClientDataSet; v1Qty1: TcxGridDBColumn; RM1: TRMGridReport; RMDBMain: TRMDBDataSet; RMXLSExport1: TRMXLSExport; v1Column4: TcxGridDBColumn; v1Column5: TcxGridDBColumn; v1Column3: TcxGridDBColumn; v1Column6: TcxGridDBColumn; CDS_PRT: TClientDataSet; Label6: TLabel; FactoryNoName: TEdit; cxTabControl1: TcxTabControl; v1C_Unit: TcxGridDBColumn; v1Column7: TcxGridDBColumn; v1Column8: TcxGridDBColumn; Tchk: TToolButton; TNochk: TToolButton; ToolButton1: TToolButton; v1Qty2: TcxGridDBColumn; v1C_Color: TcxGridDBColumn; v1H_gs: TcxGridDBColumn; v1Column9: TcxGridDBColumn; cxStyleRepository1: TcxStyleRepository; cxStyle1: TcxStyle; cxStyle2: TcxStyle; cxStyle_gridRow: TcxStyle; cxStyle_gridFoot: TcxStyle; cxStyle_gridHead: TcxStyle; cxStyle_gridGroupBox: TcxStyle; cxStyle_yellow: TcxStyle; cxStyle_Red: TcxStyle; cxStyle_fontBlack: TcxStyle; cxStyle_fontclFuchsia: TcxStyle; cxStyle_fontclPurple: TcxStyle; cxStyle_fontclGreen: TcxStyle; cxStyle_fontclBlue: TcxStyle; cxStyle_fontclTeal: TcxStyle; cxStyle_fontclOlive: TcxStyle; v1Ssel: TcxGridDBColumn; v1Column10: TcxGridDBColumn; v1Column11: TcxGridDBColumn; v1Column12: TcxGridDBColumn; v1Column13: TcxGridDBColumn; v1Column14: TcxGridDBColumn; v1Column15: TcxGridDBColumn; v1Column1: TcxGridDBColumn; ToolButton2: TToolButton; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure TBFindClick(Sender: TObject); procedure TBEditClick(Sender: TObject); procedure TBDelClick(Sender: TObject); procedure TBExportClick(Sender: TObject); procedure TBPrintClick(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure TBAddClick(Sender: TObject); procedure ConNoChange(Sender: TObject); procedure FormShow(Sender: TObject); procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ToolButton5Click(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure v2Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure cxTabControl1Change(Sender: TObject); procedure TchkClick(Sender: TObject); procedure TNochkClick(Sender: TObject); procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); procedure ToolButton1Click(Sender: TObject); procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); procedure Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean); procedure ToolButton2Click(Sender: TObject); private FInt, PFInt: Integer; procedure InitGrid(); procedure InitForm(); function DelData(): Boolean; { Private declarations } public fDParameters1: string; { Public declarations } end; var frmClothContractList_Tp: TfrmClothContractList_Tp; implementation uses U_DataLink, U_ClothContractInPut_TP, U_Fun, U_ProductOrderList, U_ZDYHelp; {$R *.dfm} procedure TfrmClothContractList_Tp.FormDestroy(Sender: TObject); begin frmClothContractList_Tp := nil; end; procedure TfrmClothContractList_Tp.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; procedure TfrmClothContractList_Tp.FormCreate(Sender: TObject); begin ScrollBox1.Align := alClient; end; procedure TfrmClothContractList_Tp.TBCloseClick(Sender: TObject); begin Close; WriteCxGrid(self.Caption, Tv1, 'ָʾ������'); end; procedure TfrmClothContractList_Tp.InitGrid(); var strwhere: string; begin strwhere := ''; if cxTabControl1.TabIndex < 2 then // strwhere := strwhere + ' and isnull(A.status,''''0'''')=''''' + inttostr(cxTabControl1.TabIndex) + ''''''; strwhere := strwhere + ' and isnull(B.C_status,''''0'''')=''''' + inttostr(cxTabControl1.TabIndex) + ''''''; if (trim(fDParameters1) = '��ѯ') then strwhere := strwhere + ' and A.Filler=''''' + Trim(DName) + ''''' '; try ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered := False; Close; sql.Clear; sql.Add('exec P_Get_Contract_TG'); sql.Add('@begdate=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' '); sql.Add(',@enddate=''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + ''' '); // sql.Add(',@conType= '''+TconType+''' '); sql.Add(',@status=''' +strwhere + ''' '); // ShowMessage(sql.text); Open; end; SCreateCDS20(ADOQueryMain, Order_Main); SInitCDSData20(ADOQueryMain, Order_Main); finally ADOQueryMain.EnableControls; end; end; procedure TfrmClothContractList_Tp.InitForm(); begin // if fDParameters1 = '��ѯ' then // begin // TBADD.Visible := false; // TBEdit.Visible := false; // TBDel.Visible := false; // Tchk.Visible := false; // TNochk.Visible := false; // // Tth.Visible:=false; // //ToolButton1.Visible:=false; // end; TBEdit.Enabled := false; TBDel.Enabled := false; Tchk.Enabled := false; TNochk.Enabled := false; if cxTabControl1.TabIndex = 0 then begin TBEdit.Enabled := true; TBDel.Enabled := true; Tchk.Enabled := true; end; if cxTabControl1.TabIndex = 1 then begin TNochk.Enabled := true; end; end; procedure TfrmClothContractList_Tp.TBFindClick(Sender: TObject); begin if ADOQueryMain.Active = False then Exit; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS20(ADOQueryMain, Order_Main); SInitCDSData20(ADOQueryMain, Order_Main); end; procedure TfrmClothContractList_Tp.TBEditClick(Sender: TObject); begin if Order_Main.IsEmpty then Exit; try frmClothContractInPut_Tp := TfrmClothContractInPut_Tp.Create(Application); with frmClothContractInPut_Tp do begin PState := 1; FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString); FConType := Trim(Self.Order_Main.fieldbyname('ConType').AsString); if ShowModal = 1 then begin TBRafresh.Click; end; end; finally frmClothContractInPut_Tp.Free; TBRafresh.Click; end; end; procedure TfrmClothContractList_Tp.TBDelClick(Sender: TObject); begin if Order_Main.IsEmpty then Exit; with ADOQueryCmd do begin close; sql.Clear; sql.Add('select * from JYOrder_Sub_AnPai '); sql.Add('where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''''); open; end; if not ADOQueryCmd.IsEmpty then begin Application.MessageBox('�ѻز֣�����ɾ��Ͷ���ƻ���', '��ʾ', 0); Exit; end; if Application.MessageBox('ȷ��Ҫɾ��������', '��ʾ', 32 + 4) <> IDYES then Exit; if trim(Order_Main.FieldByName('mainID').AsString) = 'CM001' then exit; if DelData() then begin Order_Main.Delete; end; end; function TfrmClothContractList_Tp.DelData(): Boolean; begin try Result := false; ADOQueryCmd.Connection.BeginTrans; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete YF_Money_CR where MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + ''''); ExecSQL; end; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)'); sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)'); // sql.Add(' where CRID='+CRID); ExecSQL; end; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete Contract_Sub where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + ''''); ExecSQL; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from Contract_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''''); Open; end; if ADOQueryTemp.IsEmpty then begin with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete Contract_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''''); ExecSQL; end; end; if Trim(Order_Main.fieldbyname('SubId').AsString) = '' then begin with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete Contract_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''''); ExecSQL; end; end; ADOQueryCmd.Connection.CommitTrans; Result := True; except ADOQueryCmd.Connection.RollbackTrans; Result := False; Application.MessageBox('����ɾ���쳣��', '��ʾ', 0); end; end; procedure TfrmClothContractList_Tp.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then Exit; TcxGridToExcel('������ͬ�����б�', cxGrid1); end; procedure TfrmClothContractList_Tp.TBPrintClick(Sender: TObject); var fPrintFile, FConNoM: string; begin if Order_Main.IsEmpty then Exit; fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\����Ͷ����.rmf'; with ADOQueryTemp do begin Filtered := False; Close; sql.Clear; sql.Add('select *,fromConNo=(select Top 1 conNo from Contract_Main X where X.MainID=A.fromMainID) '); sql.Add('from Contract_Main A'); sql.Add('inner join Contract_sub B on B.MainID=A.mainID '); sql.Add('where A.FillTime>= ''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' '); sql.Add('and A.FillTime< ''' + Trim(FormatDateTime('yyyy-MM-dd', endDate.DateTime + 1)) + ''' '); sql.Add('and A.mainID=' + quotedstr(trim(Order_Main.fieldbyname('MainID').AsString))); Open; end; SCreateCDS20(ADOQueryTemp, CDS_PRT); SInitCDSData20(ADOQueryTemp, CDS_PRT); if FileExists(fPrintFile) then begin RMVariables['dtxz'] := formatdateTime('yyyy-MM-dd', Now); RMVariables['zdr'] := Trim(dName); RM1.LoadFromFile(fPrintFile); RM1.ShowReport; end else begin Application.MessageBox(PChar('û����' + ExtractFilePath(Application.ExeName) + 'Report\����Ͷ����.rmf'), '��ʾ', 0); end; end; procedure TfrmClothContractList_Tp.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmClothContractList_Tp.TBAddClick(Sender: TObject); begin try frmClothContractInPut_Tp := TfrmClothContractInPut_Tp.Create(Application); with frmClothContractInPut_Tp do begin PState := 0; FMainId := ''; FConType := '����ԤͶ��'; if ShowModal = 1 then begin TBRafresh.Click; end; end; finally frmClothContractInPut_Tp.Free; TBRafresh.Click; end; end; procedure TfrmClothContractList_Tp.ConNoChange(Sender: TObject); var str1: string; begin if ADOQueryMain.Active = False then Exit; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS20(ADOQueryMain, Order_Main); SInitCDSData20(ADOQueryMain, Order_Main); end; procedure TfrmClothContractList_Tp.FormShow(Sender: TObject); begin InitForm(); ReadCxGrid(self.Caption, Tv1, 'ָʾ������'); BegDate.DateTime := SGetServerDate10(ADOQueryTemp); EndDate.DateTime := SGetServerDate10(ADOQueryTemp); InitGrid(); end; procedure TfrmClothContractList_Tp.Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin FInt := 2; end; procedure TfrmClothContractList_Tp.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin FInt := 1; end; procedure TfrmClothContractList_Tp.ToolButton5Click(Sender: TObject); var maxno: string; begin if ClientDataSet3.IsEmpty then Exit; if ClientDataSet2.IsEmpty then Exit; if Trim(ClientDataSet2.fieldbyname('MXId').AsString) = '' then begin Application.MessageBox('��������δȷ����', '��ʾ', 0); Exit; end; if ClientDataSet3.Locate('OrderNo', null, []) then begin Application.MessageBox('ָ��������Ų���Ϊ�գ�', '��ʾ', 0); Exit; end; BegDate.SetFocus; try ADOQueryCmd.Connection.BeginTrans; //����ȥ��� with ClientDataSet3 do begin First; while not eof do begin if Trim(ClientDataSet3.fieldbyname('ToId').AsString) = '' then begin if GetLSNo(ADOQueryCmd, maxno, 'To', 'Contract_Sub_MxTo', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('ȡȥ����ˮ��ʧ�ܣ�', '��ʾ', 0); Exit; end; end else begin maxno := Trim(ClientDataSet3.fieldbyname('ToId').AsString); end; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('select * from Contract_Sub_MxTo where ToId=''' + Trim(ClientDataSet3.fieldbyname('ToId').AsString) + ''''); Open; end; with ADOQueryCmd do begin if Trim(ClientDataSet3.fieldbyname('ToId').AsString) = '' then Append else Edit; FieldByName('MxId').Value := Trim(ClientDataSet2.fieldbyname('MxId').AsString); FieldByName('ToId').Value := Trim(maxno); FieldByName('OrdSubId').Value := Trim(ClientDataSet3.fieldbyname('OrdSubId').AsString); FieldByName('TPDate').Value := ClientDataSet3.fieldbyname('TPDate').Value; FieldByName('TPPerson').Value := ClientDataSet3.fieldbyname('TPPerson').Value; FieldByName('TPNote').Value := ClientDataSet3.fieldbyname('TPNote').Value; if Trim(ClientDataSet3.fieldbyname('TPQty').AsString) <> '' then FieldByName('TPQty').Value := ClientDataSet3.fieldbyname('TPQty').Value else FieldByName('TPQty').Value := 0; if Trim(ClientDataSet3.fieldbyname('Qty1').AsString) <> '' then FieldByName('Qty1').Value := ClientDataSet3.fieldbyname('Qty1').Value else FieldByName('Qty1').Value := 0; if Trim(ClientDataSet3.fieldbyname('Qty2').AsString) <> '' then FieldByName('Qty2').Value := ClientDataSet3.fieldbyname('Qty2').Value else FieldByName('Qty2').Value := 0; if Trim(ClientDataSet3.fieldbyname('Qty3').AsString) <> '' then FieldByName('Qty3').Value := ClientDataSet3.fieldbyname('Qty3').Value else FieldByName('Qty3').Value := 0; Post; end; with ClientDataSet3 do begin Edit; FieldByName('ToId').Value := Trim(maxno); Post; end; Next; end; end; ADOQueryCmd.Connection.CommitTrans; Application.MessageBox('�����ɹ���', '��ʾ', 0); except ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('�����쳣��', '��ʾ', 0); end; end; procedure TfrmClothContractList_Tp.ToolButton3Click(Sender: TObject); begin if FInt = 2 then begin if ClientDataSet2.IsEmpty then Exit; if ClientDataSet3.IsEmpty = false then begin Application.MessageBox('�Ѳ��������������ݣ�����ɾ��������¼��', '��ʾ', 0); Exit; end; if Trim(ClientDataSet2.fieldbyname('MxId').AsString) <> '' then begin if Application.MessageBox('ȷ��Ҫɾ��������', '��ʾ', 32 + 4) <> IDYES then Exit; end; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete Contract_Sub_Mx where MxId=''' + Trim(ClientDataSet2.fieldbyname('MxId').AsString) + ''''); ExecSQL; end; ClientDataSet2.Delete; end else if FInt = 3 then begin if ClientDataSet3.IsEmpty then Exit; if Trim(ClientDataSet3.fieldbyname('ToId').AsString) <> '' then begin if Application.MessageBox('ȷ��Ҫɾ��������', '��ʾ', 32 + 4) <> IDYES then Exit; end; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete Contract_Sub_MxTo where ToId=''' + Trim(ClientDataSet3.fieldbyname('ToId').AsString) + ''''); ExecSQL; end; ClientDataSet3.Delete; with ClientDataSet2 do begin Edit; if ClientDataSet3.IsEmpty = False then // FieldByName('KCSL').Value:=ClientDataSet2.fieldbyname('MxQty').Value-tv3.DataController.Summary.FooterSummaryValues[0] else FieldByName('KCSL').Value := ClientDataSet2.fieldbyname('MxQty').Value; Post; end; end; end; procedure TfrmClothContractList_Tp.v2Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'RKPlace'; flagname := '���ص�'; if ShowModal = 1 then begin with ClientDataSet2 do begin Edit; FieldByName('RKPlace').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractList_Tp.cxTabControl1Change(Sender: TObject); begin initForm(); InitGrid(); end; procedure TfrmClothContractList_Tp.TchkClick(Sender: TObject); begin if Order_Main.IsEmpty then exit; if Order_Main.Locate('ssel', true, []) = false then begin Application.MessageBox('û��ѡ������!', '��ʾ', 0); Exit; end; try ADOQueryCmd.Connection.BeginTrans; with Order_Main do begin DisableControls; First; while not eof do begin if Fieldbyname('ssel').AsBoolean then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Contract_sub SET C_status=''1'' '); sql.Add('where mainID =' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString))); sql.Add('and subID =' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString))); execsql; end; end; next; end; First; EnableControls; end; InitGrid(); ADOQueryCmd.Connection.CommitTrans; except ADOQueryCmd.Connection.RollbackTrans; application.MessageBox('����ʧ�ܣ�', '��ʾ��Ϣ', 0); end; end; procedure TfrmClothContractList_Tp.TNochkClick(Sender: TObject); begin if Order_Main.IsEmpty then exit; if Order_Main.Locate('ssel', true, []) = false then begin Application.MessageBox('û��ѡ������!', '��ʾ', 0); Exit; end; try ADOQueryCmd.Connection.BeginTrans; with Order_Main do begin DisableControls; First; while not eof do begin if Fieldbyname('ssel').AsBoolean then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Contract_sub SET C_status=''0'' '); sql.Add('where mainID =' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString))); sql.Add('and subID =' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString))); execsql; end; end; next; end; First; EnableControls; end; InitGrid(); ADOQueryCmd.Connection.CommitTrans; except ADOQueryCmd.Connection.RollbackTrans; application.MessageBox('����ʧ�ܣ�', '��ʾ��Ϣ', 0); end; end; procedure TfrmClothContractList_Tp.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); begin ToolButton1.Click; end; procedure TfrmClothContractList_Tp.ToolButton1Click(Sender: TObject); begin if Order_Main.IsEmpty then Exit; try frmClothContractInPut_Tp := TfrmClothContractInPut_Tp.Create(Application); with frmClothContractInPut_Tp do begin PState := 1; tbsave.Enabled := false; FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString); if ShowModal = 1 then begin end; end; finally frmClothContractInPut_Tp.Free; end; end; procedure TfrmClothContractList_Tp.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); begin { IF AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('N_Qty').Index]=0 then begin ACanvas.Brush.Color:=clSkyBlue; end; } if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('IsZt').Index] = 0 then begin ACanvas.Brush.Color := Clred; end; end; procedure TfrmClothContractList_Tp.Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean); var FValue: string; FBounds: TRect; begin FBounds := AViewInfo.Bounds; if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then begin ACanvas.FillRect(FBounds); ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1); FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1); InflateRect(FBounds, -1, -1); ACanvas.Font.Color := clBlack; ACanvas.Brush.Style := bsClear; ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop); ADone := True; end; end; procedure TfrmClothContractList_Tp.ToolButton2Click(Sender: TObject); begin try frmClothContractInPut_Tp := TfrmClothContractInPut_Tp.Create(Application); with frmClothContractInPut_Tp do begin PState := 0; FMainId := ''; FConType := '��ɫ�ƻ�'; if ShowModal = 1 then begin TBRafresh.Click; end; end; finally frmClothContractInPut_Tp.Free; TBRafresh.Click; end; end; end.