unit u_ch_delete_do; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, bsSkinTabs, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, Menus, StdCtrls, XPMenu; type Tfra_ch_delete_do = class(TFrame) bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinTabSheet3: TbsSkinTabSheet; bsSkinTabSheet4: TbsSkinTabSheet; v_fee_do_seae: TADOQuery; v_fee_do_seae1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridDateColumn; dxDBGrid1Column10: TdxDBGridDateColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; do_ban1: TDataSource; p_fee_do_delete_one: TADOStoredProc; PopupMenu1: TPopupMenu; N1: TMenuItem; bs_text: TEdit; XPMenu1: TXPMenu; v_fee_do_seai: TADOQuery; v_fee_do_seai1: TDataSource; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridDateColumn2: TdxDBGridDateColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGridColumn3: TdxDBGridColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; dxDBGridMaskColumn15: TdxDBGridMaskColumn; v_fee_do_aire: TADOQuery; v_fee_do_aire1: TDataSource; v_fee_do_airi1: TDataSource; v_fee_do_airi: TADOQuery; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn16: TdxDBGridMaskColumn; dxDBGridMaskColumn17: TdxDBGridMaskColumn; dxDBGridMaskColumn18: TdxDBGridMaskColumn; dxDBGridMaskColumn19: TdxDBGridMaskColumn; dxDBGridMaskColumn20: TdxDBGridMaskColumn; dxDBGridColumn5: TdxDBGridColumn; dxDBGridColumn6: TdxDBGridColumn; dxDBGridMaskColumn21: TdxDBGridMaskColumn; dxDBGridDateColumn3: TdxDBGridDateColumn; dxDBGridDateColumn4: TdxDBGridDateColumn; dxDBGridMaskColumn23: TdxDBGridMaskColumn; dxDBGridMaskColumn25: TdxDBGridMaskColumn; dxDBGridMaskColumn26: TdxDBGridMaskColumn; dxDBGridColumn7: TdxDBGridColumn; dxDBGridColumn8: TdxDBGridColumn; dxDBGridMaskColumn28: TdxDBGridMaskColumn; dxDBGridMaskColumn29: TdxDBGridMaskColumn; dxDBGridMaskColumn30: TdxDBGridMaskColumn; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn22: TdxDBGridMaskColumn; dxDBGridMaskColumn24: TdxDBGridMaskColumn; dxDBGridMaskColumn27: TdxDBGridMaskColumn; dxDBGridMaskColumn31: TdxDBGridMaskColumn; dxDBGridMaskColumn32: TdxDBGridMaskColumn; dxDBGridColumn9: TdxDBGridColumn; dxDBGridColumn10: TdxDBGridColumn; dxDBGridMaskColumn33: TdxDBGridMaskColumn; dxDBGridDateColumn5: TdxDBGridDateColumn; dxDBGridDateColumn6: TdxDBGridDateColumn; dxDBGridMaskColumn34: TdxDBGridMaskColumn; dxDBGridMaskColumn35: TdxDBGridMaskColumn; dxDBGridMaskColumn36: TdxDBGridMaskColumn; dxDBGridColumn11: TdxDBGridColumn; dxDBGridColumn12: TdxDBGridColumn; dxDBGridMaskColumn37: TdxDBGridMaskColumn; dxDBGridMaskColumn38: TdxDBGridMaskColumn; dxDBGridMaskColumn39: TdxDBGridMaskColumn; dxDBGrid2Column22: TdxDBGridColumn; dxDBGrid5: TdxDBGrid; v_fee_do_seae_sum: TADOQuery; v_fee_do_seae_sum1: TDataSource; v_fee_do_seai_sum: TADOQuery; v_fee_do_seai_sum1: TDataSource; v_fee_do_aire_sum: TADOQuery; v_fee_do_aire_sum1: TDataSource; v_fee_do_airi_sum: TADOQuery; v_fee_do_airi_sum1: TDataSource; dxDBGrid5Column1: TdxDBGridMaskColumn; dxDBGrid5Column3: TdxDBGridColumn; dxDBGrid6: TdxDBGrid; dxDBGridMaskColumn40: TdxDBGridMaskColumn; dxDBGridColumn13: TdxDBGridColumn; dxDBGrid7: TdxDBGrid; dxDBGridMaskColumn41: TdxDBGridMaskColumn; dxDBGridColumn14: TdxDBGridColumn; dxDBGrid8: TdxDBGrid; dxDBGridMaskColumn42: TdxDBGridMaskColumn; dxDBGridColumn15: TdxDBGridColumn; dxDBGrid5Column4: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid6Column4: TdxDBGridColumn; dxDBGrid2Column23: TdxDBGridColumn; dxDBGrid7Column4: TdxDBGridColumn; dxDBGrid3Column19: TdxDBGridColumn; dxDBGrid4Column19: TdxDBGridColumn; dxDBGrid8Column4: TdxDBGridColumn; dxDBGrid5Column2: TdxDBGridColumn; dxDBGridDateColumn7: TdxDBGridColumn; dxDBGridDateColumn8: TdxDBGridColumn; dxDBGridDateColumn9: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid2Column24: TdxDBGridColumn; dxDBGrid3Column20: TdxDBGridColumn; dxDBGrid4Column20: TdxDBGridColumn; dxDBGrid5Column5: TdxDBGridColumn; dxDBGrid5Column6: TdxDBGridColumn; dxDBGrid6Column5: TdxDBGridColumn; dxDBGrid6Column6: TdxDBGridColumn; dxDBGrid7Column5: TdxDBGridColumn; dxDBGrid7Column6: TdxDBGridColumn; dxDBGrid8Column5: TdxDBGridColumn; dxDBGrid8Column6: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid2Column25: TdxDBGridColumn; dxDBGrid3Column21: TdxDBGridColumn; dxDBGrid4Column21: TdxDBGridColumn; procedure N1Click(Sender: TObject); procedure bs_textChange(Sender: TObject); procedure dxDBGrid1DblClick(Sender: TObject); procedure dxDBGrid2DblClick(Sender: TObject); procedure dxDBGrid3DblClick(Sender: TObject); procedure dxDBGrid4DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfra_ch_delete_do.N1Click(Sender: TObject); var i:integer; delete_num:real; begin if bs_text.Text='3'then if (v_fee_do_seae.DataSource.DataSet.FieldByName('结算类别').asstring='流程')then begin if (v_fee_do_seae.DataSource.DataSet.FieldByName('帐单状态').asstring<>'确认核销')then begin showmessage('当前业务操作的状态不允许更改'); exit; end; end; v_fee_do_seae.DataSource.DataSet.Edit; if bsSkinPageControl1.ActivePage=bsSkinTabSheet1 then begin if v_fee_do_seae.IsEmpty then exit; if_ch_delete_do:=true; delete_do_type_num:=1; if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin v_fee_do_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_seae.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_seae.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_seae.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seae.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_seae.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seae.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_seae.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; end else begin case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_seae.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_seae.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_seae.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seae.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_seae.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_seae.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seae.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_seae.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; if (bs_text.Text='1')or(bs_text.Text='2')then begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实际金额']:=do_ban1.DataSet['实际金额']-delete_num; do_ban1.DataSet.post; end; end else begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实结金额']:=do_ban1.DataSet['实结金额']-delete_num; do_ban1.DataSet.post; end; end; end; if bsSkinPageControl1.ActivePage=bsSkinTabSheet2 then begin if v_fee_do_seai.IsEmpty then exit; if_ch_delete_do:=true; delete_do_type_num:=2; if dxDBGrid2.SelectedCount>=1 then begin for i:=0 to dxDBGrid2.SelectedCount-1 do begin v_fee_do_seai.GotoBookmark(pointer(dxDBGrid2.selectedrows[i])); case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_seai.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_seai.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_seai.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seai.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_seai.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seai.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_seai.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; end else begin case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_seai.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_seai.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_seai.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seai.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_seai.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_seai.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_seai.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_seai.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; if (bs_text.Text='1')or(bs_text.Text='2')then begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实际金额']:=do_ban1.DataSet['实际金额']-delete_num; do_ban1.DataSet.post; end; end else begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实结金额']:=do_ban1.DataSet['实结金额']-delete_num; do_ban1.DataSet.post; end; end; end; if bsSkinPageControl1.ActivePage=bsSkinTabSheet3 then begin if v_fee_do_aire.IsEmpty then exit; if_ch_delete_do:=true; delete_do_type_num:=3; if dxDBGrid3.SelectedCount>=1 then begin for i:=0 to dxDBGrid3.SelectedCount-1 do begin v_fee_do_aire.GotoBookmark(pointer(dxDBGrid3.selectedrows[i])); case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_aire.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_aire.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_aire.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_aire.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_aire.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_aire.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_aire.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; end else begin case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_aire.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_aire.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_aire.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_aire.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_aire.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_aire.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_aire.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_aire.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; if (bs_text.Text='1')or(bs_text.Text='2')then begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实际金额']:=do_ban1.DataSet['实际金额']-delete_num; do_ban1.DataSet.post; end; end else begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实结金额']:=do_ban1.DataSet['实结金额']-delete_num; do_ban1.DataSet.post; end; end; end; if bsSkinPageControl1.ActivePage=bsSkinTabSheet4 then begin if v_fee_do_airi.IsEmpty then exit; if_ch_delete_do:=true; delete_do_type_num:=4; if dxDBGrid4.SelectedCount>=1 then begin for i:=0 to dxDBGrid4.SelectedCount-1 do begin v_fee_do_airi.GotoBookmark(pointer(dxDBGrid4.selectedrows[i])); case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_airi.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_airi.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_airi.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_airi.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_airi.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_airi.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_airi.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; end else begin case strtoint(bs_text.Text) of 1: begin delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat; end; 2: begin if v_fee_do_airi.FieldByName('类型').asstring='收' then delete_num:=delete_num-v_fee_do_airi.fieldbyname('金额').asfloat else delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat; end; 3: begin if v_fee_do_airi.FieldByName('类型').asstring='收' then delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_airi.fieldbyname('金额').asfloat; end; 4: begin if v_fee_do_airi.FieldByName('类型').asstring='付' then delete_num:=delete_num+v_fee_do_airi.fieldbyname('金额').asfloat else delete_num:=delete_num-v_fee_do_airi.fieldbyname('金额').asfloat; end; end; p_fee_do_delete_one.Parameters[1].value:=v_fee_do_airi.fieldbyname('DO_ID').asinteger; p_fee_do_delete_one.ExecProc; end; if (bs_text.Text='1')or(bs_text.Text='2')then begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实际金额']:=do_ban1.DataSet['实际金额']-delete_num; do_ban1.DataSet.post; end; end else begin if delete_num<>0 then begin do_ban1.DataSet.edit; do_ban1.DataSet['实结金额']:=do_ban1.DataSet['实结金额']-delete_num; do_ban1.DataSet.post; end; end; end; end; procedure Tfra_ch_delete_do.bs_textChange(Sender: TObject); begin case strtoint(bs_text.text) of 1: begin dxDBGrid5Column4.Visible:=false; dxDBGrid1Column22.Visible:=false; dxDBGrid6Column4.Visible:=false; dxDBGrid2Column23.Visible:=false; dxDBGrid7Column4.Visible:=false; dxDBGrid3Column19.Visible:=false; dxDBGrid4Column19.Visible:=false; dxDBGrid8Column4.Visible:=false; dxDBGrid1Column6.Caption:='申请金额'; dxDBGridColumn1.Caption:='申请金额'; dxDBGridColumn5.Caption:='申请金额'; dxDBGridColumn9.Caption:='申请金额'; end; 2: begin dxDBGrid5Column4.Visible:=true; dxDBGrid1Column22.Visible:=true; dxDBGrid6Column4.Visible:=true; dxDBGrid2Column23.Visible:=true; dxDBGrid7Column4.Visible:=true; dxDBGrid3Column19.Visible:=true; dxDBGrid4Column19.Visible:=true; dxDBGrid8Column4.Visible:=true; dxDBGrid1Column6.Caption:='申请金额'; dxDBGridColumn1.Caption:='申请金额'; dxDBGridColumn5.Caption:='申请金额'; dxDBGridColumn9.Caption:='申请金额'; end; 3,4: begin dxDBGrid5Column4.Visible:=true; dxDBGrid1Column22.Visible:=true; dxDBGrid6Column4.Visible:=true; dxDBGrid2Column23.Visible:=true; dxDBGrid7Column4.Visible:=true; dxDBGrid3Column19.Visible:=true; dxDBGrid4Column19.Visible:=true; dxDBGrid8Column4.Visible:=true; dxDBGrid1Column6.Caption:='结算金额'; dxDBGridColumn1.Caption:='结算金额'; dxDBGridColumn5.Caption:='结算金额'; dxDBGridColumn9.Caption:='结算金额'; end; end; end; procedure Tfra_ch_delete_do.dxDBGrid1DblClick(Sender: TObject); begin fee_view(v_fee_do_seae.fieldbyname('编号').asstring); end; procedure Tfra_ch_delete_do.dxDBGrid2DblClick(Sender: TObject); begin fee_view(v_fee_do_seai.fieldbyname('编号').asstring); end; procedure Tfra_ch_delete_do.dxDBGrid3DblClick(Sender: TObject); begin fee_view(v_fee_do_aire.fieldbyname('编号').asstring); end; procedure Tfra_ch_delete_do.dxDBGrid4DblClick(Sender: TObject); begin fee_view(v_fee_do_airi.fieldbyname('编号').asstring); end; end.