unit u_op_seae_trace; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, RxMemDS, DB, ADODB, Menus, XPMenu, bsSkinCtrls, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, ComCtrls,DateUtils, bsSkinTabs, ExtCtrls, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, kbmMemTable, kbmMemBinaryStreamFormat, wwdbdatetimepicker, RxLookup,IniFiles, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxGridBandedTableView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid; type Tfrm_op_seae_trace = class(TForm) Panel1: TPanel; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu2: TXPMenu; bsSkinPanel1: TbsSkinPanel; t_op_seae_trace1: TDataSource; t_op_seae_trace: TADOQuery; dxdbgrid1: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridDateColumn4: TdxDBGridDateColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; dxDBGridMaskColumn15: TdxDBGridMaskColumn; dxDBGridMaskColumn16: TdxDBGridMaskColumn; dxDBGridMaskColumn17: TdxDBGridMaskColumn; dxDBGridMaskColumn18: TdxDBGridMaskColumn; dxDBGridMaskColumn19: TdxDBGridMaskColumn; dxDBGridMaskColumn20: TdxDBGridMaskColumn; dxdbgrid1Column18: TdxDBGridColumn; dxdbgrid1Column19: TdxDBGridColumn; dxdbgrid1Column20: TdxDBGridColumn; dxdbgrid1Column21: TdxDBGridColumn; dxdbgrid1Column22: TdxDBGridColumn; dxdbgrid1Column23: TdxDBGridColumn; dxdbgrid1Column24: TdxDBGridColumn; dxdbgrid1Column25: TdxDBGridColumn; dxdbgrid1Column26: TdxDBGridColumn; dxdbgrid1Column27: TdxDBGridColumn; dxdbgrid1Column28: TdxDBGridColumn; dxdbgrid1Column29: TdxDBGridColumn; dxdbgrid1Column30: TdxDBGridColumn; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; Label131: TLabel; Edit2: TEdit; Label210: TLabel; wwDBDateTimePicker18: TwwDBDateTimePicker; wwDBDateTimePicker19: TwwDBDateTimePicker; RxDBLookupCombo57: TRxDBLookupCombo; Label213: TLabel; Label1: TLabel; Label2: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label3: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; bsSkinButton1: TbsSkinButton; Edit1: TEdit; Label4: TLabel; cxGrid1DBTableView1: TcxGridDBTableView; cxGrid1Level1: TcxGridLevel; cxGrid1: TcxGrid; cxGrid1DBTableView1DBColumn1: TcxGridDBColumn; cxGrid1Level2: TcxGridLevel; cxGrid1DBTableView1DBColumn2: TcxGridDBColumn; cxGrid1DBTableView1DBColumn3: TcxGridDBColumn; cxGrid1DBTableView1DBColumn4: TcxGridDBColumn; cxGrid1DBTableView1DBColumn5: TcxGridDBColumn; cxGrid1DBTableView1DBColumn6: TcxGridDBColumn; cxGrid1DBTableView1DBColumn7: TcxGridDBColumn; cxGrid1DBTableView1DBColumn8: TcxGridDBColumn; cxGrid1DBTableView1DBColumn9: TcxGridDBColumn; cxGrid1DBTableView1DBColumn10: TcxGridDBColumn; cxGrid1DBTableView1DBColumn11: TcxGridDBColumn; cxGrid1DBTableView1DBColumn12: TcxGridDBColumn; cxGrid1DBTableView1DBColumn13: TcxGridDBColumn; cxGrid1DBTableView1DBColumn14: TcxGridDBColumn; cxGrid1DBTableView1DBColumn15: TcxGridDBColumn; cxGrid1DBTableView1DBColumn16: TcxGridDBColumn; cxGrid1DBTableView1DBColumn17: TcxGridDBColumn; cxGrid1DBTableView1DBColumn18: TcxGridDBColumn; cxGrid1DBTableView1DBColumn19: TcxGridDBColumn; cxGrid1DBTableView1DBColumn20: TcxGridDBColumn; cxGrid1DBTableView1DBColumn21: TcxGridDBColumn; cxGrid1DBTableView1DBColumn22: TcxGridDBColumn; cxGrid1DBTableView1DBColumn23: TcxGridDBColumn; cxGrid1DBTableView1DBColumn24: TcxGridDBColumn; cxGrid1DBTableView1DBColumn25: TcxGridDBColumn; cxGrid1DBTableView1DBColumn26: TcxGridDBColumn; cxGrid1DBTableView1DBColumn27: TcxGridDBColumn; cxGrid1DBTableView1DBColumn28: TcxGridDBColumn; cxGrid1DBTableView1DBColumn29: TcxGridDBColumn; cxGrid1DBTableView1DBColumn30: TcxGridDBColumn; cxGrid1BandedTableView1: TcxGridBandedTableView; cxGrid1BandedTableView1BandedColumn1: TcxGridBandedColumn; t_op_seae_trace_ctn: TADOQuery; t_op_seae_trace_ctn1: TDataSource; cxGrid1DBTableView2: TcxGridDBTableView; cxGrid1DBTableView2DBColumn1: TcxGridDBColumn; cxGrid1DBTableView2DBColumn2: TcxGridDBColumn; cxGrid1DBTableView2DBColumn3: TcxGridDBColumn; cxGrid1DBTableView2DBColumn4: TcxGridDBColumn; cxGrid1DBTableView2DBColumn5: TcxGridDBColumn; cxGrid1DBTableView2DBColumn6: TcxGridDBColumn; cxGrid1DBTableView1DBColumn31: TcxGridDBColumn; cxGrid1DBTableView1DBColumn32: TcxGridDBColumn; cxGrid1DBTableView1DBColumn33: TcxGridDBColumn; cxGrid1DBTableView1DBColumn34: TcxGridDBColumn; Button1: TButton; btn1: TButton; bsSkinButton9: TbsSkinButton; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure t_op_seae_traceBeforePost(DataSet: TDataSet); procedure t_op_seae_traceBeforeDelete(DataSet: TDataSet); procedure Button1Click(Sender: TObject); procedure btn1Click(Sender: TObject); private function GetBetwMonth(aBe, aEe: TDate): Integer; procedure Getcq; procedure Getlx; procedure GetProfit; procedure GetProfitSum; function GetSALEprofit(SALE: string; aMonth: Integer; profit: Double; tuo: boolean): Double; function gettotalprofit(sale: string): double; function issameMonth(aBe, aEe: TDate): Boolean; { Private declarations } public sqlstr:WideString; mblno:string; procedure GetData; { Public declarations } end; var frm_op_seae_trace: Tfrm_op_seae_trace; rp_rp_total_open:boolean; implementation uses u_main, my_sys_function, u_rp_query, u_sys_progress, u_data_share, u_op_seae; {$R *.dfm} procedure Tfrm_op_seae_trace.bsSkinButton5Click(Sender: TObject); begin close; end; function Tfrm_op_seae_trace.GetSALEprofit(SALE:string;aMonth:Integer;profit:Double;tuo:boolean):Double; begin end; procedure Tfrm_op_seae_trace.FormClose(Sender: TObject; var Action: TCloseAction); begin // savecxgridview(cxGrid1DBTableView1,'cx'+caption+'1'); // savecxgridview(cxGrid1DBTableView3,'cx'+caption+'3'); // savereggrid(dxdbgrid1,caption+'1'); savecxgridview(cxGrid1DBTableView1,'cx'+caption+'1111'); frm_op_seae_trace.Hide; frm_op_seae_trace.ManualFloat(frm_op_seae_trace.BoundsRect ); frm_main.freeTabs('frm_op_seae_trace'); action:=cafree; frm_op_seae_trace:=nil; end; procedure Tfrm_op_seae_trace.FormShow(Sender: TObject); begin // loadreggrid(dxdbgrid1,false,caption+'1'); loadcxgridview(cxGrid1DBTableView1,'cx'+caption+'1111'); end; procedure Tfrm_op_seae_trace.bsSkinButton9Click(Sender: TObject); begin sys_print('货物运踪',2,nil,nil,nil,t_op_seae_trace1,t_op_seae_trace_ctn1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_trace.N10Click(Sender: TObject); begin { update_grid_view_no(dxdbgrid1); exit; } cxGrid1DBTableView1.Columns[cxGrid1DBTableView1.DataController.FocusedRowIndex].Visible:=false; end; procedure Tfrm_op_seae_trace.N14Click(Sender: TObject); var i:integer; begin for i:=0 to cxGrid1DBTableView1.ColumnCount-1 do begin cxGrid1DBTableView1.Columns[i].Visible:=true; end; { update_grid_view_all(dxdbgrid1); exit; } end; procedure Tfrm_op_seae_trace.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,211); exit; end; procedure Tfrm_op_seae_trace.N16Click(Sender: TObject); begin cxgrid_save_xls(cxGrid1); // grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seae_trace.GetProfit; begin end; procedure Tfrm_op_seae_trace.GetProfitSum; begin end; procedure Tfrm_op_seae_trace.Getlx; begin end; function Tfrm_op_seae_trace.GetBetwMonth(aBe, aEe: TDate): Integer; begin end; function Tfrm_op_seae_trace.issameMonth(aBe, aEe: TDate): Boolean; begin end; procedure Tfrm_op_seae_trace.Getcq; begin end; function Tfrm_op_seae_trace.gettotalprofit(sale: string): double; begin end; procedure Tfrm_op_seae_trace.bsSkinButton1Click(Sender: TObject); var str,ctnstr: widestring; begin str := ''; str := query_tiaojian(1, str, 't_op_seae.主提单号', '模糊', Edit2.text); str := query_tiaojian(1, str, 't_op_seae.开船日期', '大于', wwDBDateTimePicker18.text); str := query_tiaojian(1, str, 't_op_seae.开船日期', '小于', wwDBDateTimePicker19.text); str := query_tiaojian(1, str, 't_op_seae.委托单位', '等于', RxDBLookupCombo57.DisplayValues[1]); str := query_tiaojian(1, str, 't_op_seae.预抵日期', '大于', wwDBDateTimePicker1.text); str := query_tiaojian(1, str, 't_op_seae.预抵日期', '小于', wwDBDateTimePicker2.text); str := query_tiaojian(1, str, 't_op_seae.真提单号', '模糊', Edit1.text); if trim(str)='' then begin str:='where ('+open_data('0001','t_op_seae.录入人','t_op_seae.操作员','t_op_seae.客服员','t_op_seae.单证员','no','no')+' or t_op_seae.航线操作='''+employee+''' or '+open_data('0021','t_op_seae.揽货人','no','no','no','no')+')'; end else begin str:=str+' and ('+open_data('0001','t_op_seae.录入人','t_op_seae.操作员','t_op_seae.客服员','t_op_seae.单证员','no','no')+' or t_op_seae.航线操作='''+employee+''' or '+open_data('0021','t_op_seae.揽货人','no','no','no','no')+')'; end; ctnstr:='select t_op_seae_trace_ctn.* from t_op_seae_trace_ctn left join t_op_seae on (t_op_seae_trace_ctn.编号=t_op_seae.编号) ' + str + default_sort(53, 't_op_seae', '', 'desc'); str := 'select t_op_seae_trace.*,t_op_seae.主提单号,t_op_seae.船公司,t_op_seae.委托单位,t_op_seae.揽货人,t_op_seae.开船日期,t_op_seae.真提单号,t_op_seae.预抵日期,t_op_seae.卸货港,t_op_seae.目的地,t_op_seae.ETD,t_op_seae.集装箱 ' +' from t_op_seae left join t_op_seae_trace on (t_op_seae_trace.编号=t_op_seae.编号) ' + str + default_sort(53, 't_op_seae', '', 'desc'); t_op_seae_trace.close; t_op_seae_trace.sql.clear; t_op_seae_trace.sql.add(str); t_op_seae_trace.Open; if t_op_seae_trace.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; t_op_seae_trace_ctn.Close; t_op_seae_trace_ctn.SQL.Clear; t_op_seae_trace_ctn.SQL.Add(ctnstr); t_op_seae_trace_ctn.Open; end; procedure Tfrm_op_seae_trace.bsSkinButton10Click(Sender: TObject); begin query_seae(101,'0001'); end; procedure Tfrm_op_seae_trace.GetData; begin Edit2.text:=''; Edit1.text:=''; wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.Clear; wwDBDateTimePicker18.Clear; wwDBDateTimePicker19.Clear; RxDBLookupCombo57.ClearValue; Edit2.text:=mblno; bsSkinButton1.OnClick(nil); end; procedure Tfrm_op_seae_trace.t_op_seae_traceBeforePost(DataSet: TDataSet); begin abort; end; procedure Tfrm_op_seae_trace.t_op_seae_traceBeforeDelete( DataSet: TDataSet); begin abort; end; procedure Tfrm_op_seae_trace.Button1Click(Sender: TObject); begin if assigned(frm_op_seae) then begin frm_op_seae.t_op_seae.close; frm_op_seae.t_op_seae.sql.clear; frm_op_seae.t_op_seae.sql.add('select * from t_op_seae where 主编号=编号 and 编号 in (select 主编号 from t_op_seae where 主提单号='''+t_op_seae_trace.fieldbyname('主提单号').AsString+''') order by 开船日期 DESC,船名,航次,主提单号'); frm_op_seae.t_op_seae.Open; frm_op_seae.ManualDock(frm_main.SearchTabs('frm_op_seae',frm_op_seae.caption),nil,alClient); frm_op_seae.show; end; end; procedure Tfrm_op_seae_trace.btn1Click(Sender: TObject); begin cxGrid1DBTableView1.ViewData.Expand(True); end; end.