unit U_YarnOutInput1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
  cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
  cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
  cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, cxSpinEdit,
  StdCtrls, ExtCtrls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
  dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
  U_BaseInput, System.ImageList, Vcl.ImgList, dxSkinWXI, dxScrollbarAnnotations,
  cxContainer, dxCore, cxDateUtils, cxMaskEdit, dxSkinBasic, 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, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
  dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
  dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
  dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
  dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine,
  dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark,
  dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint,
  dxSkinXmas2008Blue, cxPC;

type
  TfrmYarnOutInput1 = class(TfrmBaseInput)
    ToolBar1: TToolBar;
    TBDel: TToolButton;
    TBSave: TToolButton;
    TBClose: TToolButton;
    CDS_1: TClientDataSet;
    ADOQueryCmd: TADOQuery;
    ADOQueryTemp: TADOQuery;
    ToolButton1: TToolButton;
    cxGrid1: TcxGrid;
    TV1: TcxGridDBTableView;
    cxGridDBColumn1: TcxGridDBColumn;
    cxGridDBColumn2: TcxGridDBColumn;
    cxGridDBColumn3: TcxGridDBColumn;
    cxGridDBColumn4: TcxGridDBColumn;
    cxGridDBColumn5: TcxGridDBColumn;
    cxGridDBColumn6: TcxGridDBColumn;
    cxGridDBColumn7: TcxGridDBColumn;
    cxGridDBColumn8: TcxGridDBColumn;
    cxGridDBColumn9: TcxGridDBColumn;
    cxGridDBColumn10: TcxGridDBColumn;
    cxGridDBColumn11: TcxGridDBColumn;
    cxGridDBColumn12: TcxGridDBColumn;
    cxGridDBColumn13: TcxGridDBColumn;
    cxGridDBColumn14: TcxGridDBColumn;
    cxGridDBColumn15: TcxGridDBColumn;
    cxGridDBColumn16: TcxGridDBColumn;
    cxGridDBColumn17: TcxGridDBColumn;
    cxGridDBColumn18: TcxGridDBColumn;
    cxGridDBColumn19: TcxGridDBColumn;
    cxGridDBColumn20: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    DS_1: TDataSource;
    GPM_1: TcxGridPopupMenu;
    ADO_1: TADOQuery;
    TV1Column1: TcxGridDBColumn;
    TV1Column2: TcxGridDBColumn;
    TV1Column3: TcxGridDBColumn;
    TV1Column4: TcxGridDBColumn;
    TV1Column5: TcxGridDBColumn;
    TV1Column6: TcxGridDBColumn;
    TV1Column7: TcxGridDBColumn;
    TV1Column8: TcxGridDBColumn;
    TV1Column9: TcxGridDBColumn;
    TV1Column10: TcxGridDBColumn;
    TV1Column11: TcxGridDBColumn;
    TV1Column12: TcxGridDBColumn;
    TV1Column13: TcxGridDBColumn;
    ToolButton2: TToolButton;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBDelClick(Sender: TObject);
    procedure TBSaveClick(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
    procedure ToolButton2Click(Sender: TObject);
  private
    { Private declarations }
    procedure InitGrid1;
    function SaveCKData(): Boolean;
  public
    { Public declarations }
    FPJID, FStkID, FWBCID, FY_Code: string;
    FToCoNo, FToCoName: string;
  end;

var
  frmYarnOutInput1: TfrmYarnOutInput1;

implementation

uses
  U_DataLink, U_RTFun, U_ZDYHelp, U_YarnStkSel, U_CompanySel;

{$R *.dfm}
procedure TfrmYarnOutInput1.InitGrid1;
begin
  with ADO_1 do
  begin
    Close;
    sql.Clear;
    sql.Add(' exec P_BS_Yarn_Out_WB ');
    sql.Add(' @FPJID=''' + Trim(FPJID) + '''');
    sql.Add(' ,@FStkID=''' + Trim(FStkID) + '''');
//    ShowMessage(sql.Text);
    Open;
  end;

  SCreateCDS(ADO_1, CDS_1);

  with ADO_1 do
  begin
    First;
    while not eof do
    begin
      with Self.CDS_1 do
      begin
        Append;
        FieldByName('IOTime').Value := Now();
        FieldByName('STKID').Value := ADO_1.fieldbyname('STKID').Value;
        FieldByName('IOType').Value := '车间领用';
        FieldByName('FromCoNo').Value := ADO_1.fieldbyname('FromCoNo').Value;  //来自单位
        FieldByName('FromCoName').Value := ADO_1.fieldbyname('FromCoName').Value;

        FieldByName('StkCoNo').Value := ADO_1.fieldbyname('StkCoNo').Value;    //存放单位
        FieldByName('StkCoName').Value := ADO_1.fieldbyname('StkCoName').Value;

        FieldByName('ToCoNo').Value := FToCoNo;     //出到单位
        FieldByName('ToCoName').Value := FToCoName;

        FieldByName('Supplier').Value := ADO_1.fieldbyname('Supplier').Value;

        FieldByName('Y_Code').Value := ADO_1.fieldbyname('Y_Code').Value;
        FieldByName('Y_Name').Value := ADO_1.fieldbyname('Y_Name').Value;

        FieldByName('Y_Type').Value := ADO_1.fieldbyname('Y_Type').Value;
        FieldByName('Brand').Value := ADO_1.fieldbyname('Brand').Value;

        FieldByName('Y_Spec').Value := ADO_1.fieldbyname('Y_Spec').Value;
        FieldByName('Y_Composition').Value := ADO_1.fieldbyname('Y_Composition').Value;

        FieldByName('Y_Color').Value := ADO_1.fieldbyname('Y_Color').Value;
        FieldByName('Y_ColorNo').Value := ADO_1.fieldbyname('Y_ColorNo').Value;

        FieldByName('Denier').Value := ADO_1.fieldbyname('Denier').Value;
        FieldByName('TestDenier').Value := ADO_1.fieldbyname('TestDenier').Value;

        FieldByName('FF').Value := ADO_1.fieldbyname('FF').Value;
        FieldByName('ND').Value := ADO_1.fieldbyname('ND').Value;

        FieldByName('BatchNo').Value := ADO_1.fieldbyname('BatchNo').Value;

        FieldByName('QtyUnit').Value := ADO_1.fieldbyname('QtyUnit').Value;
        FieldByName('StkPosition').Value := ADO_1.fieldbyname('StkPosition').Value;

        FieldByName('Piece').Value := ADO_1.fieldbyname('Piece').Value;
        FieldByName('Qty').Value := ADO_1.fieldbyname('Qty').Value;
        FieldByName('StkQty').Value := ADO_1.fieldbyname('StkQty').Value;

        FieldByName('zjQty').Value := ADO_1.fieldbyname('zjQty').Value;    //实际轴长
        FieldByName('WBCID').Value := ADO_1.fieldbyname('WBCID1').Value;
        FieldByName('WB_YarnDensity').Value := ADO_1.fieldbyname('WB_YarnDensity').Value;
        FieldByName('WB_Width').Value := ADO_1.fieldbyname('WB_Width').Value;
        FieldByName('CycleYarnQty').Value := ADO_1.fieldbyname('CycleYarnQty').Value;
        FieldByName('YarnQty').Value := ADO_1.fieldbyname('YarnQty').Value;
        Post;
      end;
      Next;
    end;
  end;

  FWBCID := ADO_1.fieldbyname('WBCID1').Value;
  FY_Code := ADO_1.fieldbyname('Y_Code').Value;

end;

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

function TfrmYarnOutInput1.SaveCKData(): Boolean;
var
  MBYIOID, Maxno: string;
begin
  try
    ADOQueryCmd.Connection.BeginTrans;
    CDS_1.DisableControls;
    with CDS_1 do
    begin
      First;
      while not eof do
      begin
        with ADOQueryTemp do
        begin
          Close;
          sql.Clear;
          sql.Add('select * from BS_Yarn_IO where BYIOID=''' + Trim(CDS_1.fieldbyname('BYIOID').AsString) + '''');
          Open;
        end;
        MBYIOID := Trim(ADOQueryTemp.fieldbyname('BYIOID').AsString);
        if Trim(MBYIOID) = '' then
        begin
          if not GetLSNo(ADOQueryCmd, Maxno, 'YC', 'BS_Yarn_IO', 3, 1) then
            raise Exception.Create('取染色坯布出库编号失败！');
        end
        else
        begin
          Maxno := Trim(MBYIOID);
        end;
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add('select * from BS_Yarn_IO where BYIOID=''' + Trim(Maxno) + '''');
          Open;
        end;
        with ADOQueryCmd do
        begin
          if Trim(MBYIOID) = '' then
          begin
            Append;
            FieldByName('Filler').Value := Trim(DName)
          end
          else
          begin
            Edit;
            FieldByName('Editer').Value := Trim(DName);
            FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
          end;
          RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_1, 'BS_Yarn_IO', 0);
          FieldByName('STKName').Value := '纱线';
          FieldByName('BYIOID').Value := Trim(Maxno);
          FieldByName('IOFlag').Value := '出库';
          FieldByName('IOQtyFlag').Value := -1;
          FieldByName('STKID').Value := CDS_1.fieldbyname('STKID').Value;
          FieldByName('FromCoNo').Value := CDS_1.fieldbyname('FromCoNo').Value;
          FieldByName('FromCoName').Value := CDS_1.fieldbyname('FromCoName').Value;
          FieldByName('StkCoNo').Value := CDS_1.fieldbyname('StkCoNo').Value;
          FieldByName('ToCoNo').Value := CDS_1.fieldbyname('ToCoNo').Value;
          FieldByName('Supplier').Value := CDS_1.fieldbyname('Supplier').Value;
          Post;
        end;
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add('Update BS_Yarn_IO Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from BS_Yarn_IO A where A.STKID=BS_Yarn_IO.BYIOID)');
          sql.Add(',STKQty=(select Sum(isnull(Qty,0)*IOQtyFlag) from BS_Yarn_IO A where A.STKID=BS_Yarn_IO.BYIOID )');
          sql.Add('where BYIOID=''' + Trim(CDS_1.fieldbyname('STKID').AsString) + '''');
          ExecSQL;
        end;
        with ADOQueryTemp do
        begin
          Close;
          sql.Clear;
          sql.Add('select * from BS_Yarn_IO where BYIOID=''' + Trim(CDS_1.fieldbyname('STKID').AsString) + '''');
          Open;
        end;

        if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
          raise Exception.Create('出库数量大于入库数量不能保存！');

        if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
          raise Exception.Create('出库箱/件数大于入库箱/件数不能保存！');

        with ADOQueryCmd do
        begin
          Close;
          Sql.Clear;
          Sql.Add('exec P_BS_Yarn_Move ');
          Sql.Add(' @BYIOID=' + quotedstr(Trim(Maxno)));
          Open;
        end;
        if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
          raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails)       ');
          sql.Add('values(''纱线出库''    ');
          sql.Add(',' + quotedstr(Maxno));
          sql.Add(',''保存''   ');
          sql.Add(',' + quotedstr(DName));
          sql.Add(',' + quotedstr(trim(self.Caption)));
          sql.Add(',' + quotedstr(Maxno));
          sql.Add(')  ');
          ExecSQL;
        end;
        Edit;
        FieldByName('BYIOID').Value := Trim(Maxno);
        Post;

        Next;
      end;
    end;
    CDS_1.EnableControls;
    ADOQueryCmd.Connection.CommitTrans;
    Result := True;
  except
    Result := False;
    ADOQueryCmd.Connection.RollbackTrans;
    application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
  end;

end;

procedure TfrmYarnOutInput1.TBCloseClick(Sender: TObject);
begin

  Close;
end;

procedure TfrmYarnOutInput1.FormShow(Sender: TObject);
var
  fsj: string;
begin
  inherited;

  ReadCxGrid('纱线出库登记Tv1', Tv1, '纱线仓库');
  InitGrid1();
end;

procedure TfrmYarnOutInput1.TBDelClick(Sender: TObject);
begin
  if CDS_1.IsEmpty then
    Exit;
  if Trim(CDS_1.fieldbyname('BYIOID').AsString) <> '' then
  begin
    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) <> IDYES then
      Exit;
    with ADOQueryTemp do
    begin
      Close;
      sql.Clear;
      sql.Add('exec P_Fin_Flow_Judge ');
      Sql.Add(' @FFIDS=' + quotedstr(Trim(CDS_1.fieldbyname('BYIOID').AsString)));
      Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
      Sql.Add(',@DName=' + quotedstr(Trim(DName)));
      Open;
    end;
    if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
    begin
      Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '提示', 0);
      exit;
    end;
    try
      ADOQueryCmd.Connection.BeginTrans;
      with ADOQueryCmd do
      begin
        Close;
        Sql.Clear;
        sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails)       ');
        sql.Add('values(''纱线出库''    ');
        sql.Add(',' + quotedstr(Trim(CDS_1.fieldbyname('BYIOID').AsString)));
        sql.Add(',''删除''   ');
        sql.Add(',' + quotedstr(DName));
        sql.Add(',' + quotedstr(trim(self.Caption)));
        sql.Add(',' + quotedstr(Trim(CDS_1.fieldbyname('BYIOID').AsString)));
        sql.Add(')  ');

        Sql.Add('exec P_BS_Yarn_Out_Del ');
        Sql.Add(' @BYIOIDS=' + quotedstr(Trim(CDS_1.fieldbyname('BYIOID').AsString)));
        Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
        Sql.Add(',@DName=' + quotedstr(Trim(DName)));
        Open;
      end;
      if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
        raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
      ADOQueryCmd.Connection.CommitTrans;
      CDS_1.Delete;
    except
      ADOQueryCmd.Connection.RollbackTrans;
      application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0);
    end;
  end
  else
    CDS_1.Delete;

end;

procedure TfrmYarnOutInput1.TBSaveClick(Sender: TObject);
begin

  if CDS_1.IsEmpty then
    Exit;
  if CDS_1.Locate('IOTime', null, []) = True then
  begin
    Application.MessageBox('出库时间不能为空!', '提示', 0);
    Exit;
  end;
  if CDS_1.Locate('IOType', null, []) = True then
  begin
    Application.MessageBox('出库类型不能为空!', '提示', 0);
    Exit;
  end;

  if CDS_1.Locate('Qty', null, []) = True then
  begin
    Application.MessageBox('数量不能为空!', '提示', 0);
    Exit;
  end;
  if SaveCKData() then
  begin
    Application.MessageBox('保存成功!', '提示', 0);
    //ModalResult:=1;
  end;
end;

procedure TfrmYarnOutInput1.ToolButton1Click(Sender: TObject);
begin
  WriteCxGrid('纱线出库登记Tv1', Tv1, '纱线仓库');
end;

procedure TfrmYarnOutInput1.ToolButton2Click(Sender: TObject);
begin
//  SaveCKData();

  try
    frmYarnStkSel := TfrmYarnStkSel.Create(Application);
    with frmYarnStkSel do
    begin
      FstkName := '纱线';
      FFY_Code := self.FY_Code;
      if ShowModal = 1 then
      begin
        frmYarnStkSel.CDS_Main.DisableControls;
        with frmYarnStkSel.CDS_Main do
        begin
          First;
          while frmYarnStkSel.CDS_Main.Locate('SSel', True, []) do
          begin

            with ADO_1 do
            begin
              Close;
              sql.Clear;
              sql.Add(' exec P_BS_Yarn_Out_WB2 ');
              sql.Add(' @FPJID=''' + Trim(FWBCID) + Trim(frmYarnStkSel.CDS_Main.fieldbyname('Y_Code').Value) + '''');
              sql.Add(' ,@FStkID=''' + Trim(frmYarnStkSel.CDS_Main.fieldbyname('BYIOID').Value) + '''');
              sql.Add(' ,@YCPiece=' + floattostr(self.Tv1.DataController.Summary.FooterSummaryValues[5]) + '');   //已选出库匹数
              sql.Add(' ,@YCQty=' + floattostr(self.Tv1.DataController.Summary.FooterSummaryValues[6]) + '');   //已选出库数量

//              ShowMessage(sql.Text);
              Open;
            end;

            with ADO_1 do
            begin
              First;
              while not eof do
              begin
                with Self.CDS_1 do
                begin
                  Append;
                  FieldByName('IOTime').Value := Now();
                  FieldByName('STKID').Value := ADO_1.fieldbyname('STKID').Value;
                  FieldByName('IOType').Value := '车间领用';
                  FieldByName('FromCoNo').Value := ADO_1.fieldbyname('FromCoNo').Value;  //来自单位
                  FieldByName('FromCoName').Value := ADO_1.fieldbyname('FromCoName').Value;

                  FieldByName('StkCoNo').Value := ADO_1.fieldbyname('StkCoNo').Value;    //存放单位
                  FieldByName('StkCoName').Value := ADO_1.fieldbyname('StkCoName').Value;

                  FieldByName('ToCoNo').Value := FToCoNo;     //出到单位
                  FieldByName('ToCoName').Value := FToCoName;

                  FieldByName('Supplier').Value := ADO_1.fieldbyname('Supplier').Value;

                  FieldByName('Y_Code').Value := ADO_1.fieldbyname('Y_Code').Value;
                  FieldByName('Y_Name').Value := ADO_1.fieldbyname('Y_Name').Value;

                  FieldByName('Y_Type').Value := ADO_1.fieldbyname('Y_Type').Value;
                  FieldByName('Brand').Value := ADO_1.fieldbyname('Brand').Value;

                  FieldByName('Y_Spec').Value := ADO_1.fieldbyname('Y_Spec').Value;
                  FieldByName('Y_Composition').Value := ADO_1.fieldbyname('Y_Composition').Value;

                  FieldByName('Y_Color').Value := ADO_1.fieldbyname('Y_Color').Value;
                  FieldByName('Y_ColorNo').Value := ADO_1.fieldbyname('Y_ColorNo').Value;

                  FieldByName('Denier').Value := ADO_1.fieldbyname('Denier').Value;
                  FieldByName('TestDenier').Value := ADO_1.fieldbyname('TestDenier').Value;

                  FieldByName('FF').Value := ADO_1.fieldbyname('FF').Value;
                  FieldByName('ND').Value := ADO_1.fieldbyname('ND').Value;

                  FieldByName('BatchNo').Value := ADO_1.fieldbyname('BatchNo').Value;

                  FieldByName('QtyUnit').Value := ADO_1.fieldbyname('QtyUnit').Value;
                  FieldByName('StkPosition').Value := ADO_1.fieldbyname('StkPosition').Value;

                  FieldByName('Piece').Value := ADO_1.fieldbyname('Piece').Value;
                  FieldByName('Qty').Value := ADO_1.fieldbyname('Qty').Value;
                  FieldByName('StkQty').Value := ADO_1.fieldbyname('StkQty').Value;

                  FieldByName('zjQty').Value := ADO_1.fieldbyname('zjQty').Value;    //实际轴长
                  FieldByName('WBCID').Value := ADO_1.fieldbyname('WBCID1').Value;
                  FieldByName('WB_YarnDensity').Value := ADO_1.fieldbyname('WB_YarnDensity').Value;
                  FieldByName('WB_Width').Value := ADO_1.fieldbyname('WB_Width').Value;
                  FieldByName('CycleYarnQty').Value := ADO_1.fieldbyname('CycleYarnQty').Value;
                  FieldByName('YarnQty').Value := ADO_1.fieldbyname('YarnQty').Value;
                  Post;
                end;
                Next;
              end;
            end;

            frmYarnStkSel.CDS_Main.Delete;
          end;
        end;
        frmYarnStkSel.CDS_Main.EnableControls;
      end;
    end;
  finally
    frmYarnStkSel.Free;
  end;
end;

procedure TfrmYarnOutInput1.Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
  try
    frmCompanySel := TfrmCompanySel.Create(Application);
    with frmCompanySel do
    begin
      FCoType := '供应商';
      if ShowModal = 1 then
      begin
        with Self.CDS_1 do
        begin
          Edit;
          FieldByName('ToCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
          FieldByName('ToCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
        end;
      end;
    end;
  finally
    frmCompanySel.Free;
  end;

end;

end.

