unit u_ch_fee_check_sealocal; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, dxDBTLCl, dxGrClms, StdCtrls, DBCtrls, RxLookup, wwdbdatetimepicker, bsSkinCtrls, Mask, u_fee_check, ComCtrls, bsSkinTabs, dxDBGrid, dxTL, dxDBCtrl, dxCntner, XPMenu, Menus, wwdblook, wwdbedit, Wwdotdot, Wwdbcomb; type Tfrm_ch_fee_check_sealocal = class(TForm) bsSkinPanel1: TbsSkinPanel; t_op_state: TADOQuery; t_op_state1: TDataSource; t_op_airtruck1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; fra_fee_check1: Tfra_fee_check; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu1: TXPMenu; PopupMenu3: TPopupMenu; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridColumn; dxDBGrid1Column2: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; dxDBGrid1Column10: TdxDBGridColumn; dxDBGrid1Column11: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid1Column26: TdxDBGridColumn; t_op_airtruck: TADOQuery; bsSkinPanel3: TbsSkinPanel; bsSkinButton10: TbsSkinButton; t_code_ctn_status: TADOQuery; t_code_ctn_status1: TDataSource; bsSkinButton7: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; Label47: TLabel; Edit3: TEdit; Label81: TLabel; Edit2: TEdit; Label80: TLabel; Edit1: TEdit; Label213: TLabel; RxDBLookupCombo57: TRxDBLookupCombo; Label51: TLabel; wwDBDateTimePicker11: TwwDBDateTimePicker; Label53: TLabel; wwDBDateTimePicker13: TwwDBDateTimePicker; Label217: TLabel; Label218: TLabel; Label14: TLabel; Label19: TLabel; wwDBLookupCombo26: TwwDBLookupCombo; Edit8: TEdit; Edit9: TEdit; Edit11: TEdit; Label1: TLabel; Edit4: TEdit; dxDBGrid1Column12: TdxDBGridColumn; procedure FormShow(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton10Click(Sender: TObject); procedure dxDBGrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure dxDBGrid1Column3CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure bsSkinButton7Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure bsSkinButton1Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N8Click(Sender: TObject); procedure dxDBGrid1Column25CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure fra_fee_check1bsSkinButton4Click(Sender: TObject); procedure fra_fee_check1bsSkinButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_ch_fee_check_sealocal: Tfrm_ch_fee_check_sealocal; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_ch_fee_check_sealocal.FormShow(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.sql.Text:='select * from t_op_sealocal where 主编号=编号 ' +' and 主编号 in (select distinct 主编号 from t_op_sealocal where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+'))) ' +' Order by 委托编号'; t_op_airtruck.open; loadreggrid(dxdbgrid1,false,caption); loadwwgrid(fra_fee_check1.wwDBGrid1,'内贸经理审核应收'); loadwwgrid(fra_fee_check1.wwDBGrid2,'内贸经理审核应付'); bsSkinPageControl1.Align:=alClient; fra_fee_check1.limited_str.text:='0009'; fra_fee_check1.chk_accept.Text:='FALSE'; fra_fee_check1.chk_pay.text:='FALSE'; fra_fee_check1.ywlb.Text:='内贸' ; fra_fee_check1.t_ch_accept.DataSource:=t_op_airtruck1; fra_fee_check1.t_ch_accept.open; fra_fee_check1.a_shen_delete.open; fra_fee_check1.a_shen_modify_old.open; fra_fee_check1.a_shen_modify_new.open; fra_fee_check1.bsSkinPanel3.visible:=true; fra_fee_check1.t_ch_pay.DataSource:=t_op_airtruck1; fra_fee_check1.t_ch_pay.open; fra_fee_check1.p_shen_delete.open; fra_fee_check1.p_shen_modify_old.open; fra_fee_check1.p_shen_modify_new.open; fra_fee_check1.bsSkinPanel5.visible:=true; if fra_fee_check1.bsSkinPanel3.visible and fra_fee_check1.bsSkinPanel5.visible then begin fra_fee_check1.Panel3.Visible:=true; fra_fee_check1.t_op_gain.DataSource:=t_op_airtruck1; fra_fee_check1.t_op_gain.open; fra_fee_check1.bsSkinPanel9.Visible:=false; fra_fee_check1.Panel3.Height:=20; end else begin fra_fee_check1.Panel3.Visible:=false; end; if strtobool(get_parameters_value(150,'false')) then fra_fee_check1.bsSkinPanel10.Visible:=true else fra_fee_check1.bsSkinPanel10.Visible:=False; end; procedure Tfrm_ch_fee_check_sealocal.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_ch_fee_check_sealocal.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); savewwgrid(fra_fee_check1.wwDBGrid1,'内贸经理审核应收'); savewwgrid(fra_fee_check1.wwDBGrid2,'内贸经理审核应付'); frm_ch_fee_check_sealocal.Hide; frm_ch_fee_check_sealocal.ManualFloat(frm_ch_fee_check_sealocal.BoundsRect ); frm_main.freeTabs('frm_ch_fee_check_sealocal'); action:=cafree; frm_ch_fee_check_sealocal:=nil; end; procedure Tfrm_ch_fee_check_sealocal.bsSkinButton10Click(Sender: TObject); VAR str:widestring; begin str:='where 1=1'; if Edit3.text<>''then str:=str+' and 主提单号 like '+''''+'%'+Edit3.text+'%'+''''; str:=query_tiaojian(1,str,'开船日期','大于',wwDBDateTimePicker11.text); str:=query_tiaojian(1,str,'开船日期','小于',wwDBDateTimePicker13.text); str:=query_tiaojian(1,str,'船名','模糊',wwDBLookupCombo26.text); str:=query_tiaojian(1,str,'航次','模糊',Edit8.text); str:=query_tiaojian(1,str,'船公司','模糊',Edit9.text); str:=query_tiaojian(1,str,'目的港','模糊',Edit11.text); str:=query_tiaojian(1,str,'箱号','模糊',Edit2.text); str:=query_tiaojian(1,str,'封号','模糊',Edit1.text); str:=query_tiaojian(1,str,'委托编号','模糊',Edit4.text); str:=query_tiaojian(1,str,'委托单位','等于',RxDBLookupCombo57.DisplayValues[1]); t_op_airtruck.close; t_op_airtruck.sql.clear; t_op_airtruck.sql.add('select * from t_op_sealocal '+str+' order by 委托编号'); t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.dxDBGrid1Column2CustomDraw( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin AColor:=dxgrid_color('海运出口',ANode.Strings[dxDBGrid1Column2.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_sealocal.dxDBGrid1Column3CustomDraw( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid1Column3.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_sealocal.bsSkinButton7Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.sql.Text:='select * from t_op_sealocal where 主编号=编号 ' +' and 主编号 in (select distinct 主编号 from t_op_sealocal where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+'))) ' +' Order by 委托编号'; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_ch_fee_check_sealocal.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_ch_fee_check_sealocal.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,61); end; procedure Tfrm_ch_fee_check_sealocal.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_ch_fee_check_sealocal.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin // Column_sort_pro(Column,t_op_airtruck,'箱号'); end; procedure Tfrm_ch_fee_check_sealocal.bsSkinButton1Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_fee_check_sealocal.N17Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1 ' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态=' +''''+'录入状态'+''''+') '; t_op_airtruck.open end; procedure Tfrm_ch_fee_check_sealocal.N34Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+')) '; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.N36Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) '; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.N2Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1' +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')'; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.N4Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1' +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')'; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.N5Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1' +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee )'; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.N8Click(Sender: TObject); begin t_op_airtruck.Close; t_op_airtruck.SQL.text:='select * from t_op_ctnmg_detail where 1=1' +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')'; t_op_airtruck.open; end; procedure Tfrm_ch_fee_check_sealocal.dxDBGrid1Column25CustomDraw( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid1Column25.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_sealocal.fra_fee_check1bsSkinButton4Click( Sender: TObject); begin fra_fee_check1.bsSkinButton4Click(Sender); end; procedure Tfrm_ch_fee_check_sealocal.fra_fee_check1bsSkinButton1Click( Sender: TObject); begin fra_fee_check1.bsSkinButton1Click(Sender); end; end.