unit U_ClothSCGYChkList;

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, dxSkinsDefaultPainters, dxSkinscxPCPainter;

type
  TfrmClothSCGYChkList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBFind: 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;
    RM1: TRMGridReport;
    RMXLSExport1: TRMXLSExport;
    CDS_PRT: TClientDataSet;
    cxGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    v1OrderNo: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1Column5: TcxGridDBColumn;
    v1PRTMF: TcxGridDBColumn;
    v1PRTKZ: TcxGridDBColumn;
    v1PRTOrderQty: TcxGridDBColumn;
    v1Column4: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    v1Column6: TcxGridDBColumn;
    v1Column7: TcxGridDBColumn;
    v1Column9: TcxGridDBColumn;
    RMDBPRT: TRMDBDataSet;
    v1Column12: TcxGridDBColumn;
    TBView: TToolButton;
    v1Column19: TcxGridDBColumn;
    RMDBPZ: TRMDBDataSet;
    CDS_PZ: TClientDataSet;
    CDS_SJ: TClientDataSet;
    RMDBSJ: TRMDBDataSet;
    v1Column21: TcxGridDBColumn;
    Label10: TLabel;
    C_Code: TEdit;
    v1Column22: TcxGridDBColumn;
    v1Column10: TcxGridDBColumn;
    v1Column15: TcxGridDBColumn;
    v1Column16: TcxGridDBColumn;
    v1Column17: TcxGridDBColumn;
    v1Column20: TcxGridDBColumn;
    v1Column28: TcxGridDBColumn;
    RMDBDataSet1: TRMDBDataSet;
    ClientDataSet1: TClientDataSet;
    CDS_WJG: TClientDataSet;
    RMDBWJG: TRMDBDataSet;
    v1Column18: TcxGridDBColumn;
    v1Column29: TcxGridDBColumn;
    Label6: TLabel;
    GongYiCode: TEdit;
    v1Column31: TcxGridDBColumn;
    v1Column30: TcxGridDBColumn;
    v1Column32: TcxGridDBColumn;
    v1Column33: TcxGridDBColumn;
    cxTabControl1: TcxTabControl;
    tbCheck: TToolButton;
    tbCheckCX: TToolButton;
    v1Column1: TcxGridDBColumn;
    v1Column8: TcxGridDBColumn;
    SCJHD: TComboBox;
    v1Column11: TcxGridDBColumn;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure TBFindClick(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure TBPrintClick(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ConNoChange(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure conPress(Sender: TObject; var Key: Char);
    procedure TBViewClick(Sender: TObject);
    procedure tbCheckClick(Sender: TObject);
    procedure tbCheckCXClick(Sender: TObject);
    procedure cxTabControl1Change(Sender: TObject);
    procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
    procedure FormDestroy(Sender: TObject);
  private
    FInt, PFInt: Integer;
    procedure InitGrid();
    procedure InitForm();
    { Private declarations }
  public
    canshu1, FCheJian: string;
    { Public declarations }
  end;

var
  frmClothSCGYChkList: TfrmClothSCGYChkList;

implementation

uses
  U_DataLink, U_ClothSCGYChkInPut, U_Fun, U_RTFun;

{$R *.dfm}

procedure TfrmClothSCGYChkList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TfrmClothSCGYChkList.TBCloseClick(Sender: TObject);
begin
  if Trim(DName) = 'ADMIN' then
  begin
    WriteCxGridAll(trim(self.Caption), Tv1, ADOQueryCmd, ADOQueryTemp);
  end;

  Close;
end;

procedure TfrmClothSCGYChkList.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered := False;
      Close;
      sql.Clear;
      sql.Add('select A.*,B.* ');
      sql.Add(',FILLTIME1=(select max(FILLTIME)  from CLoth_GY Y  where   Y.GongYiCode= B.GongYiCode) ');
      sql.Add(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.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)) + '''');
      case cxTabControl1.TabIndex of
        0:
          begin
            sql.Add('and  isnull(A.status,''0'')=''1''');
            sql.Add('and GYChkFlag=1 ');
          end;
        1:
          begin
            sql.Add('and  isnull(A.status,''0'')=''2''');
          end;
        2:
          begin
            sql.Add('and  ((isnull(A.status,''0'')=''1'' and GYChkFlag=1) or (isnull(A.status,''0'')=''2'') ) ');
          end;
      end;
      Open;
    end;
    SCreateCDS20(ADOQueryMain, Order_Main);
    SInitCDSData20(ADOQueryMain, Order_Main);
  finally
    ADOQueryMain.EnableControls;
  end;
end;

procedure TfrmClothSCGYChkList.InitForm();
begin
  ReadCxGridAll(trim(self.Caption), Tv1);
  BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 7;
  EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
  InitGrid();
end;

procedure TfrmClothSCGYChkList.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 TfrmClothSCGYChkList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then
    Exit;
  TcxGridToExcel('坯布生产单', cxGrid1);
end;

procedure TfrmClothSCGYChkList.TBPrintClick(Sender: TObject);
var
  fPrintFile: string;
  i, j, k: integer;
begin
  if Order_Main.IsEmpty then
    Exit;
  ExportFtErpFile(Trim(SCJHD.Text) + '.rmf', ADOQueryTemp);
  fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(SCJHD.Text) + '.rmf';

  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select  WeiZhi1=WeiZhi,SPZ1=PZ1,SPZ2=PZ2,SPZ3=PZ3,SPZ4=PZ4,SPZ5=PZ5,SPZ6=PZ6,SPZ7=PZ7,SPZ8=PZ8,SPZ9=PZ9,SPZ10=PZ10, ');
    sql.Add(' SPZ11=PZ11,SPZ12=PZ12,SPZ13=PZ13,SPZ14=PZ14,SPZ15=PZ15,SPZ16=PZ16,SPZ17=PZ17,SPZ18=PZ18,SPZ19=PZ19,SPZ20=PZ20, ');
    sql.Add(' SPZ21=PZ21,SPZ22=PZ22,SPZ23=PZ23,SPZ24=PZ24,SPZ25=PZ25,SPZ26=PZ26,SPZ27=PZ27,SPZ28=PZ28,SPZ29=PZ29,SPZ30=PZ30, ');
    sql.Add(' SPZ31=PZ31,SPZ32=PZ32,SPZ33=PZ33,SPZ34=PZ34,SPZ35=PZ35,SPZ36=PZ36 ');
    sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
    sql.Add(' and RTrim(PZType)=''排针'' ');
    Open;
  end;
  SCreateCDS20(ADOQueryTemp, CDS_PZ);
  SInitCDSData20(ADOQueryTemp, CDS_PZ);
  if CDS_PZ.IsEmpty then
  begin
    CDS_PZ.Append;
    CDS_PZ.Post;
  end;

  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select * from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
    sql.Add(' and RTrim(PZType)=''三角'' ');
    Open;
  end;
  SCreateCDS20(ADOQueryTemp, CDS_SJ);
  SInitCDSData20(ADOQueryTemp, CDS_SJ);

  if CDS_SJ.IsEmpty then
  begin
    CDS_SJ.Append;
    CDS_SJ.Post;
  end;

  with ADOQueryTemp do
  begin
    Filtered := False;
    Close;
    sql.Clear;
    sql.Add('Select A.* ');
    sql.Add(',YLQty=Cast(C_Qty*PBQty*0.01*(1+isnull(ZPSH,0)*0.01) as decimal(18,1))');
    sql.Add(' from Cloth_YCL_PB A');
    sql.Add(' inner join Cloth_Sub B on A.SubId=B.SubId');
    sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
    Open;
  end;
  SCreateCDS20(ADOQueryTemp, CDS_PRT);
  SInitCDSData20(ADOQueryTemp, CDS_PRT);
  if CDS_PRT.IsEmpty then
  begin
    CDS_PRT.Append;
    CDS_PRT.Post;
  end;
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select * from Cloth_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
    Open;
  end;
  SCreateCDS20(ADOQueryTemp, ClientDataSet1);
  SInitCDSData20(ADOQueryTemp, ClientDataSet1);
  if FileExists(fPrintFile) then
  begin
    RM1.LoadFromFile(fPrintFile);
    RMVariables['ZSCPS'] := ClientDataSet1.fieldbyname('ZSCPS').Value;
    RMVariables['ZSCQty'] := ClientDataSet1.fieldbyname('ZSCQty').Value;
    RMVariables['WFJHPSHZ'] := ClientDataSet1.fieldbyname('WFJHPSHZ').Value;
    RMVariables['WFJHQtyHZ'] := ClientDataSet1.fieldbyname('WFJHQtyHZ').Value;
    RMVariables['C_Code'] := Order_Main.fieldbyname('C_Code').Value;
    RMVariables['ConNo'] := Order_Main.fieldbyname('ConNo').Value;
    RMVariables['C_CodeName'] := Order_Main.fieldbyname('C_CodeName').Value;
    RMVariables['DayQty'] := Order_Main.fieldbyname('DayQty').Value;
    RMVariables['CarType'] := Order_Main.fieldbyname('CarType').Value;
    RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
    RMVariables['KZQty'] := Order_Main.fieldbyname('KZQty').Value;
    RMVariables['MFQty'] := Order_Main.fieldbyname('MFQty').Value;
    RMVariables['KZ'] := Order_Main.fieldbyname('KZ').Value;
    RMVariables['MF'] := Order_Main.fieldbyname('MF').Value;
    RMVariables['PiKgQty'] := Order_Main.fieldbyname('PiKgQty').Value;
    RMVariables['ZhuanQty'] := Order_Main.fieldbyname('ZhuanQty').Value;
    RMVariables['PiQty'] := Order_Main.fieldbyname('PiQty').Value;
    RMVariables['C_Qty'] := Order_Main.fieldbyname('C_Qty').Value;
    RMVariables['QDTime'] := Order_Main.fieldbyname('QDTime').Value;
    RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
    RMVariables['DeliveryDate'] := Order_Main.fieldbyname('DeliveryDate').Value;
    RMVariables['ShaChang1'] := Order_Main.fieldbyname('ShaChang').Value;
    RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
    RMVariables['C_Spec'] := Order_Main.fieldbyname('C_Spec').Value;
    RMVariables['C_Color'] := Order_Main.fieldbyname('C_Color').Value;
    RMVariables['C_Note'] := Order_Main.fieldbyname('C_Note').Value;
    RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
    RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
    RMVariables['PiKgQtyFD'] := Order_Main.fieldbyname('PiKgQtyFD').Value;
    RMVariables['BatchNoHZ'] := Order_Main.fieldbyname('BatchNoHZ').Value;
    RMVariables['Zdr'] := Order_Main.fieldbyname('Filler').Value;
    RMVariables['WzPrice'] := Order_Main.fieldbyname('WzPrice').Value;
    RMVariables['BZNote'] := Order_Main.fieldbyname('BZNote').Value;
    RMVariables['ZZYQ'] := Order_Main.fieldbyname('ZZYQ').Value;
    RMVariables['ZZSH'] := Order_Main.fieldbyname('ZZSH').Value;
    RMVariables['MFZZS'] := Order_Main.fieldbyname('MFZZS').Value;
    RMVariables['ALBL'] := Order_Main.fieldbyname('ALBL').Value;
    RMVariables['gongyi'] := Order_Main.fieldbyname('gongyi').Value;
    RMVariables['ZongJieNote'] := Order_Main.fieldbyname('ZongJieNote').Value;
    RMVariables['ZhenCun'] := Order_Main.fieldbyname('ZhenCun').Value;
    RMVariables['Filler'] := Order_Main.fieldbyname('Filler').Value;
    RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
    RMVariables['YWY'] := Order_Main.fieldbyname('YWY').Value;
    RMVariables['KJTS'] := Order_Main.fieldbyname('KJTS').Value;
    RMVariables['PBMF'] := Order_Main.fieldbyname('PBMF').Value;
    RMVariables['PBKZ'] := Order_Main.fieldbyname('PBKZ').Value;
    RMVariables['ZongZhenQty'] := Order_Main.fieldbyname('ZongZhenQty').Value;
    RMVariables['PSNote'] := Order_Main.fieldbyname('PSNote').Value;
    RMVariables['SJNote'] := Order_Main.fieldbyname('SJNote').Value;
    RMVariables['ISYT'] := Order_Main.fieldbyname('ISYT').Value;
    RMVariables['ISKF'] := Order_Main.fieldbyname('ISKF').Value;
    RMVariables['ISCZ'] := Order_Main.fieldbyname('ISCZ').Value;
    RMVariables['FactoryNoName'] := Order_Main.fieldbyname('FactoryNoName').Value;
    RMVariables['PBFactoryNoName'] := Order_Main.fieldbyname('PBFactoryNoName').Value;
    RMVariables['JiTaiType'] := Order_Main.fieldbyname('JiTaiType').Value;
    RMVariables['YGPS'] := Order_Main.fieldbyname('YGPS').Value;
    RMVariables['YGQty'] := Order_Main.fieldbyname('YGQty').Value;
    RMVariables['GongYiCode'] := Order_Main.fieldbyname('GongYiCode').Value;
    RMVariables['FILLTIME1'] := Order_Main.fieldbyname('FILLTIME1').Value;
    RM1.ShowReport;
  end
  else
  begin
    Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0);
  end;
end;

procedure TfrmClothSCGYChkList.TBRafreshClick(Sender: TObject);
begin
  InitGrid();
end;

procedure TfrmClothSCGYChkList.ConNoChange(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 TfrmClothSCGYChkList.FormShow(Sender: TObject);
begin
  InitForm();
end;

procedure TfrmClothSCGYChkList.conPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    if Length(Trim(ConNo.Text)) < 4 then
      Exit;
    try
      ADOQueryMain.DisableControls;
      with ADOQueryMain do
      begin
        Filtered := False;
        Close;
        sql.Clear;
        sql.Add('select *  ');
        sql.Add(',FILLTIME1=(select max(FILLTIME)  from CLoth_GY Y  where   Y.GongYiCode= B.GongYiCode) ');
        sql.Add('  from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId');

        sql.Add(' where A.ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
        case cxTabControl1.TabIndex of
          0:
            begin
              sql.Add('and  isnull(A.status,''0'')=''1''');
            end;
          1:
            begin
              sql.Add('and  isnull(A.status,''0'')=''2''');
            end;
          2:
            begin
              sql.Add('and  isnull(A.status,''0'') in (''1'',''2'')');
            end;
        end;
        Open;
      end;
      SCreateCDS20(ADOQueryMain, Order_Main);
      SInitCDSData20(ADOQueryMain, Order_Main);
    finally
      ADOQueryMain.EnableControls;
    end;
  end;
end;

procedure TfrmClothSCGYChkList.TBViewClick(Sender: TObject);
begin
  try
    frmClothSCGYChkInPut := TfrmClothSCGYChkInPut.Create(Application);
    with frmClothSCGYChkInPut do
    begin
      PState := 1;
      FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
      FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
      FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
      TBSave.Visible := False;
      ToolBar3.Visible := False;
      ScrollBox1.Enabled := False;
      if ShowModal = 1 then
      begin

      end;
    end;
  finally
    frmClothSCGYChkInPut.Free;
  end;
end;

procedure TfrmClothSCGYChkList.tbCheckClick(Sender: TObject);
begin
  if Order_Main.IsEmpty then
    exit;
  if cxTabControl1.TabIndex <> 0 then
    Exit;
  try
    frmClothSCGYChkInPut := TfrmClothSCGYChkInPut.Create(Application);
    with frmClothSCGYChkInPut do
    begin
      PState := 1;
      FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
      FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
      ChkStatus := '审核';
      if ShowModal = 1 then
      begin
        InitGrid();
        Self.Order_Main.Locate('MainId', frmClothSCGYChkInPut.FMainId, []);
      end;
    end;
  finally
    frmClothSCGYChkInPut.Free;
  end;

end;

procedure TfrmClothSCGYChkList.tbCheckCXClick(Sender: TObject);
begin
  if Order_Main.IsEmpty then
    Exit;
  if cxTabControl1.TabIndex <> 1 then
    Exit;
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    SQL.Add('select A.* from Cloth_Main A  where ');
    sql.Add('  mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
    sql.Add('  and DATEDIFF(DD,A.Filltime,GETDATE())>30  ');
    Open;
  end;
  if ADOQueryTemp.IsEmpty = False then
  begin
    Application.MessageBox('数据已锁定无法撤销审核!', '提示', 0);
    Exit;
  end;
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select * from JYCon_Sub_AnPai where Mainid=''' + trim(Order_Main.fieldbyname('mainID').AsString) + '''');
    Open;
  end;
  if ADOQueryTemp.IsEmpty = False then
  begin
    Application.MessageBox('已打印布票，不能撤销审核!', '提示', 0);
    Exit;
  end;
  if Application.MessageBox('确定要撤销数据吗？', '提示', 32 + 4) <> IDYes then
    Exit;
  try
    with ADOQueryCmd do
    begin
      close;
      sql.Clear;
      sql.Add('update  Cloth_Main SET status=''1'' ,chker1=null,Chktime1=null ');
      sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));

      sql.Add('update  Cloth_Sub SET GongYiCode=Null ');
      sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));

      sql.Add('insert into Cloth_YCL_PB_DelLog select * from Cloth_YCL_PB where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
      sql.Add('delete Cloth_YCL_PB where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));

      sql.Add('insert into Cloth_PaiZhen_DelLog select * from Cloth_PaiZhen where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
      sql.Add('delete Cloth_PaiZhen where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));

      sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
      sql.Add(' ' + quotedstr(trim(DName)));
      sql.Add(',getdate() ');
      sql.Add(',' + quotedstr(trim(self.Caption)));
      sql.Add(',' + quotedstr(trim('坯布生产工艺单撤销审核')));
      sql.Add(',' + quotedstr(trim('订单号：' + trim(Order_Main.FieldByName('orderNO').AsString))));
      sql.Add(',' + quotedstr(trim('成功')));
      sql.Add(')');
      execsql;
    end;
    application.MessageBox('订单撤销审核成功！', '提示信息');
    TBRafresh.Click;
  except
    application.MessageBox('订单撤销审核失败！', '提示信息', 0);
  end;
end;

procedure TfrmClothSCGYChkList.cxTabControl1Change(Sender: TObject);
begin
  InitGrid();
end;

procedure TfrmClothSCGYChkList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
  if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('status').Index] = null then
    Exit;
  if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('status').Index]) <> 2 then
  begin
    ACanvas.Brush.Color := $507FFF;
  end;
end;

procedure TfrmClothSCGYChkList.FormDestroy(Sender: TObject);
begin
  frmClothSCGYChkList := nil;
end;

end.

