{$INCLUDE t_main.inc} Unit u_op_airi; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, XPMenu, Menus, DB, ADODB, dxExEdtr, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, RxLookup, StdCtrls, Mask, DBCtrls, ComCtrls, bsSkinTabs, u_fee,inifiles, wwdbdatetimepicker, wwdbedit, Wwdotdot, Wwdbcomb, u_op_letter_free, wwdblook, bsdbctrls, u_op_card,u_op_sate, DBCtrlsEh,shellapi,IdFTP,IdFTPCommon; type Tfrm_op_airi = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; Notebook1: TNotebook; t_op_airi: TADOQuery; t_op_airi1: TDataSource; PopupMenu1: TPopupMenu; N31: TMenuItem; t_ch_fee: TADOQuery; XPMenu1: TXPMenu; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column5: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridDateColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridColumn; bsSkinPanel1: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label37: TLabel; Label5: TLabel; Label38: TLabel; Label4: TLabel; Label36: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit8: TDBEdit; DBEdit4: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; DBEdit7: TDBEdit; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinTabSheet3: TbsSkinTabSheet; fra_fee1: Tfra_fee; fra_op_state1: Tfra_op_state; dxDBGrid1Column27: TdxDBGridColumn; Label65: TLabel; DBEdit18: TDBEdit; dxDBGrid1Column28: TdxDBGridColumn; bsSkinButton13: TbsSkinButton; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; bsSkinTabSheet4: TbsSkinTabSheet; fra_op_letter_free1: Tfra_op_letter_free; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; N20: TMenuItem; N21: TMenuItem; N22: TMenuItem; N23: TMenuItem; N24: TMenuItem; dxDBGrid1Column29: TdxDBGridColumn; bsSkinPanel2: TbsSkinPanel; bsSkinDBText1: TbsSkinDBText; N25: TMenuItem; N26: TMenuItem; N27: TMenuItem; N28: TMenuItem; Label19: TLabel; RxDBLookupCombo12: TRxDBLookupCombo; bsSkinTabSheet5: TbsSkinTabSheet; bsSkinPanel9: TbsSkinPanel; Label116: TLabel; Label130: TLabel; Label131: TLabel; Label132: TLabel; Edit1: TEdit; Edit4: TEdit; Edit2: TEdit; Edit3: TEdit; bsSkinButton44: TbsSkinButton; N29: TMenuItem; N30: TMenuItem; N32: TMenuItem; N33: TMenuItem; N39: TMenuItem; N40: TMenuItem; bsSkinTabSheet6: TbsSkinTabSheet; t_op_seae_danwei: TADOQuery; t_op_seae_danwei1: TDataSource; bsSkinPanel3: TbsSkinPanel; Label85: TLabel; Label86: TLabel; Label9: TLabel; Label10: TLabel; Label96: TLabel; Label97: TLabel; Label25: TLabel; Label6: TLabel; Label8: TLabel; Label11: TLabel; Label12: TLabel; Label164: TLabel; Label23: TLabel; Label109: TLabel; Label110: TLabel; Label111: TLabel; Label13: TLabel; Label27: TLabel; Label42: TLabel; Label41: TLabel; Label14: TLabel; RxDBLookupCombo6: TRxDBLookupCombo; RxDBLookupCombo7: TRxDBLookupCombo; DBEdit30: TDBEdit; DBEdit31: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker1: TwwDBDateTimePicker; DBEdit6: TDBEdit; DBEdit10: TDBEdit; RxDBLookupCombo2: TRxDBLookupCombo; RxDBLookupCombo11: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; DBMemo17: TDBMemo; DBMemo18: TDBMemo; DBMemo19: TDBMemo; wwDBComboBox3: TwwDBComboBox; RxDBLookupCombo29: TRxDBLookupCombo; RxDBLookupCombo30: TRxDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; wwDBLookupCombo1: TwwDBLookupCombo; RxDBLookupCombo31: TRxDBLookupCombo; fra_op_card1: Tfra_op_card; Label15: TLabel; RxDBLookupCombo5: TRxDBLookupCombo; bsSkinPanel10: TbsSkinPanel; lblhbl: TLabel; Label17: TLabel; RxDBLookupCombo13: TRxDBLookupCombo; bsSkinSpeedButton1: TbsSkinSpeedButton; Label16: TLabel; DBEdit5: TDBEdit; bsSkinPanel4: TbsSkinPanel; lblwt: TLabel; bsSkinPanel12: TbsSkinPanel; lbldc: TLabel; DBMemo1: TDBMemo; DBMemo5: TDBMemo; RxDBLookupCombo16: TRxDBLookupCombo; wwDBLookupCombo2: TwwDBLookupCombo; RxDBLookupCombo17: TRxDBLookupCombo; wwDBLookupCombo7: TwwDBLookupCombo; RxDBLookupCombo18: TRxDBLookupCombo; wwDBLookupCombo8: TwwDBLookupCombo; DBMemo6: TDBMemo; Label7: TLabel; Label18: TLabel; Label20: TLabel; Label21: TLabel; DBEdit12: TDBEdit; bsSkinTabSheet7: TbsSkinTabSheet; wwDBComboBox1: TwwDBComboBox; RxDBLookupCombo15: TRxDBLookupCombo; Label22: TLabel; t_op_airi_fen: TADOQuery; t_op_airi_fen1: TDataSource; t_op_airi2: TDataSource; bsSkinPageControl2: TbsSkinPageControl; bsskintabsheet_1: TbsSkinTabSheet; bsskintabsheet_2: TbsSkinTabSheet; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridMaskColumn; dxDBGrid2Column3: TdxDBGridMaskColumn; dxDBGrid2Column4: TdxDBGridMaskColumn; dxDBGrid2Column5: TdxDBGridMaskColumn; dxDBGrid2Column6: TdxDBGridMaskColumn; dxDBGrid2Column7: TdxDBGridDateColumn; dxDBGrid2Column8: TdxDBGridMaskColumn; dxDBGrid2Column9: TdxDBGridMaskColumn; dxDBGrid2Column10: TdxDBGridMaskColumn; dxDBGrid2Column11: TdxDBGridColumn; dxDBGrid2Column12: TdxDBGridColumn; dxDBGrid2Column13: TdxDBGridMaskColumn; dxDBGrid2Column14: TdxDBGridMaskColumn; dxDBGrid2Column15: TdxDBGridMaskColumn; dxDBGrid2Column16: TdxDBGridMaskColumn; Panel1: TPanel; bsSkinButton31: TbsSkinButton; bsSkinButton32: TbsSkinButton; bsSkinButton33: TbsSkinButton; bsSkinButton34: TbsSkinButton; bsSkinButton36: TbsSkinButton; Label24: TLabel; Label26: TLabel; Label28: TLabel; DBMemo7: TDBMemo; DBMemo8: TDBMemo; RxDBLookupCombo3: TRxDBLookupCombo; wwDBLookupCombo3: TwwDBLookupCombo; RxDBLookupCombo4: TRxDBLookupCombo; wwDBLookupCombo4: TwwDBLookupCombo; RxDBLookupCombo19: TRxDBLookupCombo; wwDBLookupCombo5: TwwDBLookupCombo; DBMemo9: TDBMemo; wwDBComboBox2: TwwDBComboBox; Label29: TLabel; dxDBGrid1Column30: TdxDBGridColumn; PopupMenu4: TPopupMenu; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; N61: TMenuItem; N76: TMenuItem; N77: TMenuItem; N78: TMenuItem; N41: TMenuItem; N42: TMenuItem; N43: TMenuItem; N44: TMenuItem; N45: TMenuItem; N46: TMenuItem; N47: TMenuItem; N48: TMenuItem; N49: TMenuItem; DBEdit9: TDBEditEh; N50: TMenuItem; N51: TMenuItem; wwDBLookupCombo15: TwwDBLookupCombo; wwDBLookupCombo9: TwwDBLookupCombo; Label30: TLabel; Label31: TLabel; Label32: TLabel; DBEdit13: TDBEdit; bsSkinButton38: TbsSkinButton; Label33: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; RxDBLookupCombo20: TRxDBLookupCombo; Label39: TLabel; dxDBGrid2Column17: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; dxDBGrid1Column33: TdxDBGridCheckColumn; bsSkinPanel5: TbsSkinPanel; bsSkinButton14: TbsSkinButton; bsSkinButton45: TbsSkinButton; t_op_file: TADOQuery; dsrFuJian: TDataSource; bsSkinPanel6: TbsSkinPanel; Label34: TLabel; Label35: TLabel; Label40: TLabel; Label43: TLabel; Label44: TLabel; Label45: TLabel; Label46: TLabel; Label47: TLabel; Label48: TLabel; Label49: TLabel; Label50: TLabel; Label51: TLabel; Label165: TLabel; Label166: TLabel; Label167: TLabel; Label52: TLabel; Label55: TLabel; Label56: TLabel; Label53: TLabel; Label54: TLabel; Label57: TLabel; Label58: TLabel; wwDBLookupCombo6: TwwDBLookupCombo; DBEdit11: TDBEdit; DBEdit19: TDBEdit; DBEdit20: TDBEdit; DBEdit21: TDBEdit; wwDBDateTimePicker6: TwwDBDateTimePicker; DBEdit23: TDBEdit; wwDBDateTimePicker7: TwwDBDateTimePicker; DBEdit24: TDBEdit; RxDBLookupCombo9: TRxDBLookupCombo; DBMemo39: TDBMemo; DBMemo2: TDBMemo; DBMemo40: TDBMemo; DBMemo41: TDBMemo; DBMemo42: TDBMemo; DBMemo3: TDBMemo; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox7: TbsSkinDBCheckRadioBox; wwDBDateTimePicker10: TwwDBDateTimePicker; DBMemo4: TDBMemo; RxDBLookupCombo10: TRxDBLookupCombo; RxDBLookupCombo14: TRxDBLookupCombo; DBEdit25: TDBEdit; DBEdit26: TDBEdit; bsSkinGroupBox13: TbsSkinGroupBox; bsSkinPanel14: TbsSkinPanel; bsSkinButton48: TbsSkinButton; bsSkinButton49: TbsSkinButton; bsSkinButton50: TbsSkinButton; bsSkinButton51: TbsSkinButton; dxDBGrid3: TdxDBGrid; dxDBGrid2fid: TdxDBGridMaskColumn; dxDBGrid2rl_id: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn3: TdxDBGridColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGridColumn5: TdxDBGridColumn; OpenDialog1: TOpenDialog; SaveDialog1: TSaveDialog; N52: TMenuItem; N53: TMenuItem; dxDBGrid1Column34: TdxDBGridColumn; dxDBGrid1Column35: TdxDBGridColumn; bsSkinTabSheet8: TbsSkinTabSheet; t_ch_fee_web_dr: TADOQuery; t_ch_fee_webdr1: TDataSource; t_ch_fee_web_sum: TADOQuery; t_ch_fee_web_sum1: TDataSource; t_ch_fee_web_cr1: TDataSource; t_ch_fee_web_cr: TADOQuery; Splitter1: TSplitter; dxDBGrid4: TdxDBGrid; dxDBGrid4Column1: TdxDBGridColumn; dxDBGrid4Column2: TdxDBGridColumn; dxDBGrid4Column3: TdxDBGridColumn; dxDBGrid4Column4: TdxDBGridColumn; dxDBGrid4Column5: TdxDBGridColumn; dxDBGrid4Column6: TdxDBGridColumn; dxDBGrid4Column7: TdxDBGridColumn; dxDBGrid4Column8: TdxDBGridColumn; dxDBGrid5: TdxDBGrid; dxDBGridColumn6: TdxDBGridColumn; dxDBGridColumn7: TdxDBGridColumn; dxDBGridColumn8: TdxDBGridColumn; dxDBGridColumn9: TdxDBGridColumn; dxDBGridColumn10: TdxDBGridColumn; dxDBGridColumn11: TdxDBGridColumn; dxDBGridColumn12: TdxDBGridColumn; dxDBGridColumn13: TdxDBGridColumn; dxDBGrid6: TdxDBGrid; dxDBGridColumn14: TdxDBGridColumn; dxDBGridColumn15: TdxDBGridColumn; dxDBGridColumn16: TdxDBGridColumn; N54: TMenuItem; N55: TMenuItem; dxDBGrid1Column36: TdxDBGridColumn; N56: TMenuItem; N57: TMenuItem; N58: TMenuItem; N59: TMenuItem; procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton9Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure t_op_airiBeforeEdit(DataSet: TDataSet); procedure t_op_airiBeforePost(DataSet: TDataSet); procedure bsSkinButton10Click(Sender: TObject); 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 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 DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure DBEdit3KeyPress(Sender: TObject; var Key: Char); procedure DBEdit4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo13KeyPress(Sender: TObject; var Key: Char); procedure DBEdit8KeyPress(Sender: TObject; var Key: Char); procedure DBEdit9KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit5KeyPress(Sender: TObject; var Key: Char); procedure DBEdit10KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit30KeyPress(Sender: TObject; var Key: Char); procedure DBEdit31KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); procedure DBEdit18KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2Change(Sender: TObject); procedure DBEdit3Change(Sender: TObject); procedure RxDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo30KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo12Change(Sender: TObject); procedure RxDBLookupCombo8Change(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 bsSkinButton13Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N37Click(Sender: TObject); procedure N7Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure RxDBLookupCombo31KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); procedure N9Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure t_op_airiBeforeDelete(DataSet: TDataSet); procedure t_op_airiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_op_airiBeforeCancel(DataSet: TDataSet); procedure N21Click(Sender: TObject); procedure N24Click(Sender: TObject); procedure dxDBGrid1Column29CustomDraw(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 N26Click(Sender: TObject); procedure N28Click(Sender: TObject); procedure RxDBLookupCombo12KeyPress(Sender: TObject; var Key: Char); procedure bsSkinPageControl1Change(Sender: TObject); procedure bsSkinButton44Click(Sender: TObject); procedure N32Click(Sender: TObject); procedure N33Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure N40Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure wwDBLookupCombo6Change(Sender: TObject); procedure DBEdit11KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure Notebook1PageChanged(Sender: TObject); procedure DBEdit7DblClick(Sender: TObject); procedure DBEdit7Exit(Sender: TObject); procedure bsSkinSpeedButton1Click(Sender: TObject); procedure DBEdit8DblClick(Sender: TObject); procedure DBEdit5DblClick(Sender: TObject); procedure DBEdit8Exit(Sender: TObject); procedure DBEdit5Exit(Sender: TObject); procedure RxDBLookupCombo16Change(Sender: TObject); procedure RxDBLookupCombo17Change(Sender: TObject); procedure RxDBLookupCombo18Change(Sender: TObject); procedure wwDBLookupCombo2Change(Sender: TObject); procedure wwDBLookupCombo7Change(Sender: TObject); procedure wwDBLookupCombo8Change(Sender: TObject); procedure RxDBLookupCombo16Enter(Sender: TObject); procedure RxDBLookupCombo17Enter(Sender: TObject); procedure RxDBLookupCombo18Enter(Sender: TObject); procedure RxDBLookupCombo16Exit(Sender: TObject); procedure RxDBLookupCombo17Exit(Sender: TObject); procedure RxDBLookupCombo18Exit(Sender: TObject); procedure wwDBLookupCombo2Enter(Sender: TObject); procedure wwDBLookupCombo7Enter(Sender: TObject); procedure wwDBLookupCombo8Enter(Sender: TObject); procedure wwDBLookupCombo7Exit(Sender: TObject); procedure wwDBLookupCombo2Exit(Sender: TObject); procedure wwDBLookupCombo8Exit(Sender: TObject); procedure RxDBLookupCombo16KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo17KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo18KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit12KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox1DropDown(Sender: TObject); procedure RxDBLookupCombo31Change(Sender: TObject); procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo15KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3Enter(Sender: TObject); procedure RxDBLookupCombo4Enter(Sender: TObject); procedure RxDBLookupCombo19Enter(Sender: TObject); procedure RxDBLookupCombo4Exit(Sender: TObject); procedure RxDBLookupCombo3Exit(Sender: TObject); procedure RxDBLookupCombo19Exit(Sender: TObject); procedure wwDBLookupCombo3Exit(Sender: TObject); procedure wwDBLookupCombo4Exit(Sender: TObject); procedure wwDBLookupCombo5Exit(Sender: TObject); procedure wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo19KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox2Change(Sender: TObject); procedure dxDBGrid2DblClick(Sender: TObject); procedure t_op_airi_fenAfterInsert(DataSet: TDataSet); procedure t_op_airi_fenBeforeCancel(DataSet: TDataSet); procedure t_op_airi_fenBeforeDelete(DataSet: TDataSet); procedure t_op_airi_fenBeforePost(DataSet: TDataSet); procedure bsSkinButton32Click(Sender: TObject); procedure bsSkinButton33Click(Sender: TObject); procedure bsSkinButton34Click(Sender: TObject); procedure MenuItem1Click(Sender: TObject); procedure MenuItem3Click(Sender: TObject); procedure N76Click(Sender: TObject); procedure N78Click(Sender: TObject); procedure bsSkinButton36Click(Sender: TObject); procedure N42Click(Sender: TObject); procedure N44Click(Sender: TObject); procedure N46Click(Sender: TObject); procedure N49Click(Sender: TObject); procedure N51Click(Sender: TObject); procedure wwDBLookupCombo9KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo15KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo9Change(Sender: TObject); procedure wwDBLookupCombo15Change(Sender: TObject); procedure RxDBLookupCombo11Change(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure wwDBDateTimePicker3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1Enter(Sender: TObject); procedure RxDBLookupCombo1Exit(Sender: TObject); procedure bsSkinButton14Click(Sender: TObject); procedure bsSkinButton45Click(Sender: TObject); procedure bsSkinButton48Click(Sender: TObject); procedure bsSkinButton49Click(Sender: TObject); procedure bsSkinButton50Click(Sender: TObject); procedure bsSkinButton51Click(Sender: TObject); procedure t_op_fileBeforeEdit(DataSet: TDataSet); procedure wwDBDateTimePicker2Change(Sender: TObject); procedure N53Click(Sender: TObject); procedure N55Click(Sender: TObject); procedure Label4Click(Sender: TObject); procedure N57Click(Sender: TObject); procedure N59Click(Sender: TObject); private procedure setconcolor; procedure UpLoadPro(fname:string); //fname包含完整路径、文件名 procedure DownLoadPro(fname:string); //从数据库的表中下载 { Private declarations } public airipsqlstr:widestring; { Public declarations } end; var frm_op_airi: Tfrm_op_airi; frm_op_airi_create:boolean; implementation uses u_main, my_sys_function, u_op_airi_add, u_data_share, u_sys_progress, u_ch_piliang_airi, u_op_date_change, {$IFDEF DLFENZHANG}u_op_seae_fenzhang,{$ENDIF} u_sys_tab_sort, u_op_airi_assistant, u_op_add_airi, u_ch_fee_zhupiao, u_crm_query, u_sys_dep_emp_module; {$R *.dfm} procedure Tfrm_op_airi.bsSkinButton7Click(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if not t_op_airi1.DataSet.Bof then t_op_airi1.DataSet.Prior; end; procedure Tfrm_op_airi.bsSkinButton6Click(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if not t_op_airi1.DataSet.eof then t_op_airi1.DataSet.next; end; procedure Tfrm_op_airi.bsSkinButton2Click(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit) then t_op_airi1.DataSet.post; end; procedure Tfrm_op_airi.bsSkinButton4Click(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if t_op_airi1.DataSet.IsEmpty then exit; t_ch_fee.close; t_ch_fee.Parameters[0].value:=t_op_airi1.DataSet.fieldbyname('编号').asstring; t_ch_fee.open; if not t_ch_fee.IsEmpty then begin showmessage('对不起业务存在费用信息,不能删除!!'); exit; end; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)=IDOK then t_op_airi1.DataSet.delete; end; procedure Tfrm_op_airi.bsSkinButton3Click(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit) then t_op_airi1.DataSet.cancel; end; procedure Tfrm_op_airi.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_airi.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); savereggrid(dxdbgrid2,caption+'2'); savewwgrid(fra_fee1.wwDBGrid1,'空运进口应收'); savewwgrid(fra_fee1.wwDBGrid2,'空运进口应付'); frm_op_airi_create:=false; {$IFDEF DLFENZHANG} if assigned(frm_op_seae_fenzhang) then begin FreeAndNil(frm_op_seae_fenzhang); end; {$ENDIF} if assigned(frm_op_airi_assistant) then frm_op_airi_assistant.close; frm_op_airi.Hide; frm_op_airi.ManualFloat(frm_op_airi.BoundsRect ); frm_main.freeTabs('frm_op_airi'); action:=cafree; frm_op_airi:=nil; end; procedure Tfrm_op_airi.bsSkinButton9Click(Sender: TObject); begin sys_print('空运进口单证',2,t_op_airi1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_airi.FormShow(Sender: TObject); var inifile1,seabandini:Tinifile; i,j,n:integer; sl:TStrings; begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=20; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; Notebook1.PageIndex:=0; //委托编号规则 if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then begin DBEdit8.Width:=122; bsSkinSpeedButton1.Visible:=false; if frm_data_share.t_sys_noset.fieldbyname('是否允许手动编辑').AsBoolean then begin DBEdit8.ReadOnly:=false; end else begin DBEdit8.ReadOnly:=true; end; end else if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='手动取号' then begin DBEdit8.Width:=102; bsSkinSpeedButton1.Visible:=true; if frm_data_share.t_sys_noset.fieldbyname('是否允许手动编辑').AsBoolean then begin DBEdit8.ReadOnly:=false; end else begin DBEdit8.ReadOnly:=true; end; end else if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='手动编辑' then begin DBEdit8.ReadOnly:=false; DBEdit8.Width:=122; bsSkinSpeedButton1.Visible:=false; end; DBEdit9.EditMask:=get_parameters_value(189,''); t_op_airi_fen.Close; t_op_airi.Close; t_op_airi.SQL.clear; if strtobool(get_parameters_value(132,'true')) then begin //本人的最近50票业务 t_op_airi.SQL.Add('select top 50 * from t_op_airi where 主编号=编号 and ' +'(录入人='+''''+employee+'''' +' or 操作员='+''''+employee+'''' +' or 客服员='+''''+employee+''''+')' +default_sort(56,'t_op_airi','','desc')); end else begin //本人权限范围的本月业务 t_op_airi.SQL.Add('select * from t_op_airi where 主编号=编号 and ' +' SUBSTRING(CONVERT(char(15),进口日期,111),1,7)='''+FormatDateTime('YYYY',Date)+'/'+FormatDateTime('MM',Date)+''' and ' +open_data('0004','录入人','操作员','客服员','no','no') +default_sort(56,'t_op_airi','','desc')); end; t_op_airi.open; t_op_airi_fen.open; airipsqlstr:=''; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_op_letter_free1.op_type.Text:='空运进口'; fra_op_letter_free1.t_op_letter.DataSource:=t_op_airi1; fra_op_letter_free1.t_op_letter.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_op_letter_free1.t_op_letter_free_detail.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; loadreggrid(dxdbgrid1,false,caption); loadreggrid(dxdbgrid2,false,caption+'2'); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //费用信息 if if_open('299') or if_open('300') then begin fra_fee1.edit_type.text:='4'; fra_fee1.edit_data.text:='0004'; fra_fee1.edit_report.text:='空运进口'; fra_fee1.t_ch_accept.DataSource:=t_op_airi1; if strtobool(get_parameters_value(150,'false')) then fra_fee1.bsSkinPanel3.Visible:=true; fra_fee1.DBEdit48.DataSource:=t_op_airi1; if if_open('299') then begin fra_fee1.t_ch_accept.DataSource:=t_op_airi1; if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('209')=false) then begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) and '+open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end else begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and ' +open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end; fra_fee1.t_ch_accept.open; end else begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('209')=false) then begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; fra_fee1.t_ch_accept.open; end; fra_fee1.a_shen_delete.open; fra_fee1.a_shen_modify_old.open; fra_fee1.a_shen_modify_new.open; fra_fee1.Panel3.visible:=true; end else fra_fee1.Panel3.visible:=false; if if_open('300') then begin fra_fee1.t_ch_pay.DataSource:=t_op_airi1; if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('208')=false) then begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) and '+open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end else begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and ' +open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end; fra_fee1.t_ch_pay.open; end else begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('209')=false) then begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; fra_fee1.t_ch_pay.open; end; fra_fee1.p_shen_delete.open; fra_fee1.p_shen_modify_old.open; fra_fee1.p_shen_modify_new.open; fra_fee1.Panel1.visible:=true; end else fra_fee1.Panel1.visible:=false; if fra_fee1.Panel1.visible and fra_fee1.Panel3.visible then begin if if_open('229') then begin fra_fee1.Panel8.Visible:=true; fra_fee1.Panel8.Height:=20; end else fra_fee1.Panel8.Visible:=false; fra_fee1.t_op_gain.DataSource:=t_op_airi1; fra_fee1.t_op_gain.open; fra_fee1.Panel9.Visible:=false; end else begin fra_fee1.Panel8.Visible:=false; end; end else begin fra_fee1.Visible:=false; end; loadwwgrid(fra_fee1.wwDBGrid1,'空运进口应收'); loadwwgrid(fra_fee1.wwDBGrid2,'空运进口应付'); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; {$IFDEF ZTGENGZONG} if if_reg(195) then begin fra_op_state1.edit_state.text:='4'; fra_op_state1.t_op_state.DataSource:=t_op_airi1; fra_op_state1.t_op_state.open; end; {$ENDIF} fra_op_card1.t_op_card.DataSource:=t_op_airi1; fra_op_card1.t_op_card.open; t_op_seae_danwei.Open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_hangkong.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_baoguan.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_weituo.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_daili.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_shiper.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_shouhuo.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_tongzhi.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_source.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_sys_employee.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_code.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_fee.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_currency.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_port_air.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; bsSkinTabSheet2.TabVisible:=if_open('299') or if_open('300'); inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); bsSkinPanel9.Visible:=inifile1.Readbool('other','aidisp',false); if bsSkinPanel9.Visible then begin bsSkinPanel9.Visible:=true; bsSkinButton13.Top:=3+bsSkinPanel9.Height; end; inifile1.free; seabandini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'bandno.ini'); sl:=TStringList.Create; try seabandini.ReadSection('airimp',sl); for j:=0 to sl.Count-1 do begin n:=seabandini.Readinteger('airimp',sl[j],0); for i:=0 to bsSkinPageControl1.PageCount-1 do begin if bsSkinPageControl1.Pages[i].Name=sl[j] then begin bsSkinPageControl1.Pages[i].PageIndex:=n; end; end; end; finally freeandnil(seabandini); freeandnil(sl); end; //代理帐单 {$IFDEF DLFENZHANG} if not if_reg(194) then begin bsSkinTabSheet5.TabVisible:=false; end; {$ELSE} bsSkinTabSheet5.TabVisible:=false; {$ENDIF} //状态跟踪 {$IFDEF ZTGENGZONG} if not if_reg(195) then begin bsSkinTabSheet3.TabVisible:=false; end; {$ELSE} bsSkinTabSheet3.TabVisible:=false; {$ENDIF} if if_open('304') then begin bsSkinTabSheet5.TabVisible:=true; end else begin bsSkinTabSheet5.TabVisible:=false; end; //操作自己封帐 if strtobool(get_parameters_value(143,'false')) then begin N50.Visible:=true; N51.Visible:=true; end else begin N50.Visible:=FALSE; N51.Visible:=FALSE; end; if strtobool(get_parameters_value(196,'false')) then begin bsSkinTabSheet8.TabVisible:=True; N53.Visible:=true; N55.Visible:=true; t_ch_fee_web_dr.Close; t_ch_fee_web_dr.Open; t_ch_fee_web_cr.Close; t_ch_fee_web_cr.Open; t_ch_fee_web_sum.Close; t_ch_fee_web_sum.Open; end else begin bsSkinTabSheet8.TabVisible:=false; N53.Visible:=false; N55.Visible:=false; t_ch_fee_web_dr.Close; t_ch_fee_web_cr.Close; t_ch_fee_web_sum.Close; end; frm_op_airi_create:=true; frm_sys_progress.close; frm_sys_progress:=nil; end; procedure Tfrm_op_airi.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; exit; end; if bsSkinButton11.Caption='返回列表' then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_airi.post; end; if answer=mrNo then begin t_op_airi.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; if bsSkinButton11.Caption='返回主票' then begin if (t_op_airi_fen.State=dsinsert)or(t_op_airi_fen.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_airi_fen.post; end; if answer=mrNo then begin t_op_airi_fen.cancel; end; if answer=mrCancel then begin exit; end; END; bsSkinButton11.Caption:='返回列表'; try t_op_airi1.Enabled:=false; t_op_airi1.DataSet:=t_op_airi; finally t_op_airi1.Enabled:=true; end; Notebook1.PageIndex:=1; exit; end; end; procedure Tfrm_op_airi.bsSkinButton8Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton8.ClientToScreen(Point(0,bsSkinButton8.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_airi.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/12); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton9.Width:=i; bsSkinButton10.Width:=i; bsSkinButton1.Width:=i; bsSkinButton11.Width:=i; bsSkinButton8.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; bsSkinButton13.Left:=Panel2.Width-bsSkinButton13.Width-20; end; procedure Tfrm_op_airi.bsSkinButton1Click(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit) then t_op_airi1.DataSet.post; try frm_op_airi_add:=tfrm_op_airi_add.Create (self); if t_op_airi1.DataSet=t_op_airi then begin frm_op_airi_add.data1.Enabled:=false; frm_op_airi_add.data1.DataSet:=t_op_airi; frm_op_airi_add.data1.Enabled:=true; frm_op_airi_add_num:=1; end else begin frm_op_airi_add.data1.Enabled:=false; frm_op_airi_add.data1.DataSet:=t_op_airi_fen; frm_op_airi_add.data1.Enabled:=true; frm_op_airi_add.bsSkinCheckRadioBox3.Checked:=true; frm_op_airi_add.bsSkinCheckRadioBox2.Enabled:=false; frm_op_airi_add.bsSkinCheckRadioBox4.Enabled:=true; frm_op_airi_add_num:=2; end; if frm_op_airi_add.ShowModal<>mrCancel then begin if not frm_op_airi.bsSkinTabSheet1.Showing then frm_op_airi.bsSkinTabSheet1.Show; end; finally frm_op_airi_add.Free; end; end; procedure Tfrm_op_airi.t_op_airiBeforeEdit(DataSet: TDataSet); begin op_befor_post(t_op_airi,'0004'); end; procedure Tfrm_op_airi.t_op_airiBeforePost(DataSet: TDataSet); begin //必填项 table_before_post(t_op_airi,'委托单位'); table_before_post(t_op_airi,'操作员'); table_before_post(t_op_airi,'客服员'); table_before_post(t_op_airi,'主运单号'); table_before_post(t_op_airi,'进口日期'); table_before_post(t_op_airi,'航班号'); table_before_post(t_op_airi,'始发港'); table_before_post(t_op_airi,'目的港'); // table_before_post(t_op_airi,'业务来源'); if pos('指定',t_op_airi.FieldByName('业务来源').AsString)>0 then begin end else begin table_before_post(t_op_airi,'揽货人'); table_before_post(t_op_airi,'销售部门'); end; table_before_post(t_op_airi,'操作部门'); //委托编号生成 if strtobool(get_parameters_value(185,'false')) then begin if frm_data_share.t_sys_noset.Locate('编号类型','委托编号',[]) then begin if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_airi.FieldByName('委托编号').IsNull or (trim(t_op_airi.fieldByName('委托编号').AsString)='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_airi['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi['会计期间']) else t_op_airi['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi['进口日期']); end; end else begin if (trim(t_op_airi.fieldbyname('装运方式').asstring)='其他') then begin end else begin if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_airi.FieldByName('委托编号').IsNull or (trim(t_op_airi.fieldByName('委托编号').AsString)='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_airi['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi['会计期间']) else t_op_airi['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi['进口日期']); end; end; { if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_airi.FieldByName('委托编号').IsNull or (trim(t_op_airi['委托编号'])='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_airi['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi['会计期间']) else t_op_airi['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi['进口日期']); } if op_empty('t_op_airi',t_op_airi) then abort; //月末结账 if t_op_airi.fieldbyname('进口日期').oldvalue<>t_op_airi.fieldbyname('进口日期').asdatetime then if (t_op_airi.fieldbyname('业务类型').asstring<>'更改单') and (Logininfo.endday>=t_op_airi.fieldbyname('进口日期').asdatetime) then begin showmessage('此进口日期所在期间已月末结账,不能添加修改业务!!'); abort; end; if t_op_airi.FieldByName('委托单位').OldValue<>t_op_airi.FieldByName('委托单位').asstring then begin if frm_data_share.t_crm_client_all.Locate('客户简称',t_op_airi.FieldByName('委托单位').asstring,[])then begin if frm_data_share.t_crm_client_all.fieldbyname('客户状态').asstring='封存客户'then begin showmessage('当前业务委托单位已经封存,不能再进行业务合作,如需合作请进行恢复客户操作!'); abort; end; end; end; if t_op_airi.State=dsinsert then begin if t_op_airi.fieldbyname('业务编号').asstring=''then begin t_op_airi['业务编号']:=get_no(t_op_airi.fieldbyname('会计期间').AsDateTime,getbsno(Logininfo.AirImpBsNo,'AI')); t_op_airi['编号']:=get_id; end; t_op_airi['主编号']:=t_op_airi['编号']; t_op_airi['业务状态']:='接受委托'; t_op_airi['费用状态']:='录入状态'; end; if strtobool(get_parameters_value(43,'false')) then begin if (trim(t_op_airi.fieldbyname('主运单号').asstring)='') or (trim(t_op_airi.fieldbyname('业务类型').asstring)='更改单') then begin t_op_airi['主提单标准']:=t_op_airi['编号']; end else begin t_op_airi['主提单标准']:=Logininfo.subcompcode+t_op_airi['主运单号']; end; end else begin t_op_airi['主提单标准']:=t_op_airi['编号']; end; if strtobool(get_parameters_value(44,'false')) then begin if (trim(t_op_airi.fieldbyname('分运单号').asstring)='') or (t_op_airi.fieldbyname('业务类型').asstring='更改单') then begin t_op_airi['分提单标准']:=t_op_airi['编号']; end else begin t_op_airi['分提单标准']:=Logininfo.subcompcode+t_op_airi['分运单号']; end; end else begin t_op_airi['分提单标准']:=t_op_airi['编号']; end; if strtobool(get_parameters_value(45,'false')) then begin if (trim(t_op_airi.fieldbyname('委托编号').asstring)='') or (t_op_airi.fieldbyname('业务类型').asstring='更改单') then begin t_op_airi['委托标准']:=t_op_airi['编号']; end else begin t_op_airi['委托标准']:=t_op_airi['委托编号']; end; end else begin t_op_airi['委托标准']:=t_op_airi['编号']; end; t_op_airi['upload']:=1; end; procedure Tfrm_op_airi.bsSkinButton10Click(Sender: TObject); begin query_airi(1,'0004'); end; procedure Tfrm_op_airi.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_op_airi.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_op_airi.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit2); end; procedure Tfrm_op_airi.DBEdit2KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit3); end; procedure Tfrm_op_airi.DBEdit3KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_op_airi.DBEdit4KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_op_airi.RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo12); end; procedure Tfrm_op_airi.RxDBLookupCombo13KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit8); end; procedure Tfrm_op_airi.DBEdit8KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; DBEdit9.SetFocus; end; end; procedure Tfrm_op_airi.DBEdit9KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit7); end; procedure Tfrm_op_airi.DBEdit7KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit5); end; procedure Tfrm_op_airi.wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker1); end; procedure Tfrm_op_airi.wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit6); end; procedure Tfrm_op_airi.DBEdit6KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo2); end; procedure Tfrm_op_airi.DBEdit5KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo16); end; procedure Tfrm_op_airi.DBEdit10KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo7); end; procedure Tfrm_op_airi.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo9); end; procedure Tfrm_op_airi.RxDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker3); end; procedure Tfrm_op_airi.DBEdit30KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit31); end; procedure Tfrm_op_airi.DBEdit31KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit12); end; procedure Tfrm_op_airi.RxDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo18); end; procedure Tfrm_op_airi.RxDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo20); end; procedure Tfrm_op_airi.DBEdit18KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo1); end; procedure Tfrm_op_airi.DBEdit2Change(Sender: TObject); begin DBEdit2.Color:=dxgrid_color('空运进口',DBEdit2.text); end; procedure Tfrm_op_airi.DBEdit3Change(Sender: TObject); begin DBEdit3.Color:=dxgrid_color_fee(DBEdit3.text); end; procedure Tfrm_op_airi.RxDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo30); end; procedure Tfrm_op_airi.RxDBLookupCombo30KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo29); end; procedure Tfrm_op_airi.wwDBComboBox3KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo19); end; procedure Tfrm_op_airi.RxDBLookupCombo12Change(Sender: TObject); begin if (t_op_airi.state=dsinsert)or(t_op_airi.state=dsedit)then begin if RxDBLookupCombo12.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo12.DisplayValue,[]) then t_op_airi['销售部门']:=frm_data_share.t_sys_employee['部门名称']; end; end; procedure Tfrm_op_airi.RxDBLookupCombo8Change(Sender: TObject); begin if (t_op_airi.state=dsinsert)or(t_op_airi.state=dsedit)then begin if RxDBLookupCombo8.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo8.DisplayValue,[]) then t_op_airi['操作部门']:=frm_data_share.t_sys_employee['部门名称']; end; end; procedure Tfrm_op_airi.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_airi.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_airi.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,59); end; procedure Tfrm_op_airi.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_airi.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_airi,'业务编号'); end; procedure Tfrm_op_airi.bsSkinButton13Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton13.ClientToScreen(Point(0,bsSkinButton13.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_airi.N17Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态=' +''''+'录入状态'+''''+') ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N34Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+')) ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N36Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N37Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_op_state where 是否完成<>1) ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N7Click(Sender: TObject); var str:widestring; begin if t_op_airi.IsEmpty then exit; if if_open('299') and if_open('300') then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self); t_op_airi.DisableControls; t_op_airi.first; while not t_op_airi.eof do begin if str='' then str:=''''+t_op_airi.fieldbyname('编号').AsString+'''' else str:=str+','+''''+t_op_airi.fieldbyname('编号').AsString+''''; t_op_airi.next; end; str:='('+str+')'; str:='select * from t_op_airi where 编号 in '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_airi.t_op_airi.open; frm_ch_piliang_airi.ShowModal; finally t_op_airi.EnableControls; frm_ch_piliang_airi.Free; frm_ch_piliang_airi:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_airi.N5Click(Sender: TObject); var str:widestring; i:integer; begin if t_op_airi.IsEmpty then exit; if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要打印的业务帐单!!'); exit; end; if if_open('299') and if_open('300') then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self); t_op_airi.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_airi.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if str='' then str:=''''+t_op_airi.fieldbyname('编号').AsString+'''' else str:=str+','+''''+t_op_airi.fieldbyname('编号').AsString+''''; end; str:='('+str+')'; str:='select * from t_op_airi where 编号 in '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_airi.t_op_airi.open; frm_ch_piliang_airi.ShowModal; finally t_op_airi.EnableControls; frm_ch_piliang_airi.Free; frm_ch_piliang_airi:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_airi.N3Click(Sender: TObject); var str:widestring; begin if t_op_airi.IsEmpty then exit; if if_open('299') and if_open('300') then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self); str:='select * from t_op_airi where 编号=' +''''+t_op_airi.fieldbyname('编号').AsString+''''; frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_airi.t_op_airi.open; frm_ch_piliang_airi.ShowModal; finally frm_ch_piliang_airi.Free; frm_ch_piliang_airi:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_airi.RxDBLookupCombo31KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox1); end; procedure Tfrm_op_airi.wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo15); end; procedure Tfrm_op_airi.N9Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N20Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.t_op_airiBeforeDelete(DataSet: TDataSet); begin op_befor_post(t_op_airi,'0004'); delete_add(4,t_op_airi); if not t_op_airi.FieldByName('委托编号').IsNull then delwtno(t_op_airi['委托编号']); end; procedure Tfrm_op_airi.t_op_airiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); var str:widestring; begin if pos('SOME VALUES MAY HAVE BEEN CHANGED',UpperCase(E.Message))<>0 then begin showmessage('数据已经被其它用户修改,当前修改不能保存'+#13#10+'请刷新数据后重新录入'); abort; end; if pos('主提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_airi where 主提单标准='+''''+t_op_airi['主提单标准']+''''; double_airi(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_airi where 分提单标准='+''''+t_op_airi['分提单标准']+''''; double_airi(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_airi where 委托标准='+''''+t_op_airi['委托标准']+''''; double_airi(str,3); abort; end; end; procedure Tfrm_op_airi.t_op_airiBeforeCancel(DataSet: TDataSet); begin delete_no(t_op_airi); if t_op_airi.State=dsinsert then if not t_op_airi.FieldByName('委托编号').IsNull then delwtno(t_op_airi['委托编号']); end; procedure Tfrm_op_airi.N21Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee )' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N24Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.dxDBGrid1Column29CustomDraw(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 if Trim(ANode.Strings[dxDBGrid1Column29.Index])='更改单' then AColor:=clred; AFont.Color:=clblack; end; procedure Tfrm_op_airi.N26Click(Sender: TObject); begin if t_op_airi1.DataSet.IsEmpty then exit; if not do_data('0004',t_op_airi1.DataSet.FieldByName('录入人').asstring ,t_op_airi1.DataSet.FieldByName('操作员').asstring ,t_op_airi1.DataSet.FieldByName('揽货人').asstring ,t_op_airi1.DataSet.FieldByName('客服员').asstring ,'','') then begin showmessage('对不起你无权修改此数据!'); abort; end; if t_op_airi1.DataSet.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('此票业务状态已经为业务封帐状态,不能修改!'); abort; end; if t_op_airi1=nil then exit; if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit) then t_op_airi1.DataSet.post; try frm_op_date_change:=tfrm_op_date_change.Create (self); frm_op_date_change.DataSource1.Enabled:=false; frm_op_date_change.DataSource1.DataSet:=t_op_airi1.DataSet; frm_op_date_change.DataSource1.Enabled:=true; frm_op_date_change.BSTYPE:='T_OP_AIRI'; frm_op_date_change.ShowModal; finally frm_op_date_change.Free; frm_op_date_change:=nil; end; end; procedure Tfrm_op_airi.N28Click(Sender: TObject); begin if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 金额<>开票金额 and 类型='''+'收'+''''+' )' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.RxDBLookupCombo12KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit8); end; procedure Tfrm_op_airi.bsSkinPageControl1Change(Sender: TObject); var inifile1:Tinifile; begin if frm_op_airi_create=false then exit; if bsSkinPageControl1.ActivePage=bsSkinTabSheet7 then begin if not assigned(frm_op_airi_assistant) then begin frm_op_airi_assistant:=tfrm_op_airi_assistant.Create (self); frm_op_airi_assistant.t_op_aire_assistant.DataSource:=t_op_airi1; frm_op_airi_assistant.t_op_aire_assistant.open; frm_op_airi_assistant.ManualDock(bsSkinTabSheet7,nil,alClient); frm_op_airi_assistant.show; end; exit; end; if bsSkinPageControl1.ActivePage=bsSkinTabSheet2 then begin if strtobool(get_parameters_value(190,'false')) then begin fra_fee1.bsSkinButton20.Visible:=true; fra_fee1.bsSkinButton21.Visible:=true; end else begin fra_fee1.bsSkinButton20.Visible:=False; fra_fee1.bsSkinButton21.Visible:=False; end; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); if strtoint(get_parameters_value(197,'0'))<>0 then fra_fee1.bsSkinComboBox1.ItemIndex:=strtoint(get_parameters_value(197,'0'))-1 else fra_fee1.bsSkinComboBox1.ItemIndex:=inifile1.ReadInteger('FEE','FEEVAT',0); inifile1.Free; end; {$IFDEF DLFENZHANG} if bsSkinPageControl1.ActivePage=bsSkinTabSheet5 then begin if not assigned(frm_op_seae_fenzhang) then begin frm_op_seae_fenzhang:=tfrm_op_seae_fenzhang.Create (self); end; frm_op_seae_fenzhang.t_ch_fee_fenzhang.Close; frm_op_seae_fenzhang.t_ch_fee.Close; frm_op_seae_fenzhang.t_ch_fee_fenzhang.DataSource:=t_op_airi1; frm_op_seae_fenzhang.t_ch_fee_fenzhang.open; frm_op_seae_fenzhang.t_ch_fee_fenzhango.Close; frm_op_seae_fenzhang.t_ch_fee_fenzhango.DataSource:=t_op_airi1; frm_op_seae_fenzhang.t_ch_fee_fenzhango.open; frm_op_seae_fenzhang.t_ch_fee.open; frm_op_seae_fenzhang.t_op_fenzhang.DataSource:=t_op_airi1; frm_op_seae_fenzhang.t_op_fenzhang.open; frm_op_seae_fenzhang.t_op_seae_assistant.Close; frm_op_seae_fenzhang.t_op_seae_assistant.sql.Text:='select * from t_op_aire_assistant where 编号=:编号 order by 主运单号 '; frm_op_seae_fenzhang.t_op_seae_assistant.DataSource:=t_op_airi1; frm_op_seae_fenzhang.t_op_seae_assistant.Open; frm_op_seae_fenzhang.t_ch_fee_pl.Close; frm_op_seae_fenzhang.t_ch_fee_pl.DataSource:=t_op_airi1; frm_op_seae_fenzhang.t_ch_fee_pl.open; frm_op_seae_fenzhang.t_ch_fee_pl_detail.open; frm_op_seae_fenzhang.t_ch_fee_pl_detailf.open; frm_op_seae_fenzhang.ManualDock(bsSkinTabSheet5,nil,alClient); frm_op_seae_fenzhang.show; exit; end; {$ENDIF} if bsSkinPageControl1.ActivePage=bsSkinTabSheet6 then begin if not t_op_file.Active then t_op_file.open; end else begin if t_op_file.State in [dsedit,dsinsert] then t_op_file.Post; t_op_file.close; end; end; procedure Tfrm_op_airi.bsSkinButton44Click(Sender: TObject); var str:widestring; begin str:=''; str:=query_tiaojian(1,str,'t_op_airi.业务编号','模糊',Edit1.text); str:=query_tiaojian(1,str,'t_op_airi.委托编号','模糊',Edit4.text); str:=query_tiaojian(1,str,'t_op_airi.主运单号','模糊',Edit2.text); str:=query_tiaojian(1,str,'t_op_airi.分运单号','模糊',Edit3.text); if trim(str)='' then begin str:='where '+open_data('0004','t_op_airi.录入人', 't_op_airi.操作员','t_op_airi.客服员','no','no'); end else begin str:=str+' and '+open_data('0004','t_op_airi.录入人', 't_op_airi.操作员','t_op_airi.客服员','no','no'); end; // str:='select * from t_op_airi where 主编号=编号 and 装运方式<>''报关'' and 编号 in (select 编号 from t_op_airi ' str:='select * from t_op_airi where 主编号=编号 and 编号 in (select 编号 from t_op_airi ' +str+')'+default_sort(56,'t_op_airi','','desc'); if (not t_op_airi.IsEmpty) and (t_op_airi.sql.Text<>'') then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.close; t_op_airi.sql.clear; t_op_airi.sql.add(str); t_op_airi.Open; if t_op_airi.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; procedure Tfrm_op_airi.N32Click(Sender: TObject); var inifile1:Tinifile; begin bsSkinPanel9.Visible:=true; bsSkinButton13.Top:=3+bsSkinPanel9.Height; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); inifile1.WriteBool('other','aidisp',bsSkinPanel9.Visible); inifile1.free; end; procedure Tfrm_op_airi.N33Click(Sender: TObject); var inifile1:Tinifile; begin bsSkinPanel9.Visible:=false; bsSkinButton13.Top:=3; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); inifile1.WriteBool('other','aidisp',bsSkinPanel9.Visible); inifile1.free; end; procedure Tfrm_op_airi.Edit1KeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_op_airi.N40Click(Sender: TObject); var i,j,l:integer; s:string; seabandini:tinifile ; begin //页面排序 seabandini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'bandno.ini'); frm_sys_tab_sort:=tfrm_sys_tab_sort.create(self); try frm_sys_tab_sort.ListBox2.Clear; for i:=0 to bsSkinPageControl1.PageCount-1 do begin frm_sys_tab_sort.ListBox2.Items.Add(bsSkinPageControl1.Pages[i].Caption+':'+bsSkinPageControl1.Pages[i].Name); end; frm_sys_tab_sort.ShowModal; if frm_sys_tab_sort.ModalResult=mrOk then begin for j:=0 to frm_sys_tab_sort.ListBox2.Items.Count-1 do begin s:=frm_sys_tab_sort.ListBox2.Items[j]; l:=pos(':',s)+1; for i:=0 to bsSkinPageControl1.PageCount-1 do begin if bsSkinPageControl1.Pages[i].Name=copy(s,l,length(s)-l+1) then begin bsSkinPageControl1.Pages[i].PageIndex:=j; seabandini.Writeinteger('airimp',copy(s,l,length(s)-l+1),j); end; end; end; end; finally FreeAndNil(frm_sys_tab_sort); freeandnil(seabandini); end; end; procedure Tfrm_op_airi.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(fra_op_card1.t_op_card); end; procedure Tfrm_op_airi.wwDBLookupCombo6Change(Sender: TObject); var aQuery:TAdoQuery; begin if (t_op_airi1.DataSet.State in [dsedit,dsinsert]) then begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select 海关编码 from t_crm_client where 客户全称 like ''%'+wwDBLookupCombo6.Text+'%'' or 客户简称 like ''%'+wwDBLookupCombo6.Text+'%'''); Open; if not IsEmpty then begin if t_op_airi1.DataSet.FieldByName('单位代码').AsString='' then t_op_airi1.DataSet.FieldByName('单位代码').AsString:=fieldbyname('海关编码').AsString end; end; finally FreeAndNil(aQuery); end; end; end; procedure Tfrm_op_airi.DBEdit11KeyPress(Sender: TObject; var Key: Char); var aQuery:TAdoQuery; begin if (key=#13) and (t_op_airi1.DataSet.State in [dsedit,dsinsert]) and (t_op_airi1.DataSet.FieldByName('经营单位').AsString='') then begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select 客户全称,客户简称 from t_crm_client where 海关编码='''+DBEdit11.Text+''''); Open; if not IsEmpty then begin if fieldbyname('客户全称').AsString<>'' then t_op_airi1.DataSet.FieldByName('经营单位').AsString:=fieldbyname('客户全称').AsString else t_op_airi1.DataSet.FieldByName('经营单位').AsString:=fieldbyname('客户简称').AsString; end; end; finally FreeAndNil(aQuery); end; end; end; procedure Tfrm_op_airi.RxDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo31); end; procedure Tfrm_op_airi.setconcolor; procedure consetcolor(fielname:String); var i:integer; scolor:string; begin scolor:=get_parameters_value(144,'clInfoBk'); with bsSkinTabSheet1 do begin for i:=0 to ControlCount-1 do begin if Controls[i] is TwwDBComboBox then begin if TwwDBComboBox(Controls[i]).DataField=fielname then begin TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TwwDBLookupCombo then begin if TwwDBLookupCombo(Controls[i]).DataField=fielname then begin TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBEdit then begin if TDBEdit(Controls[i]).DataField=fielname then begin TDBEdit(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TwwDBDateTimePicker then begin if TwwDBDateTimePicker(Controls[i]).DataField=fielname then begin TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBMemo then begin if TDBMemo(Controls[i]).DataField=fielname then begin TDBMemo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TRxDBLookupCombo then begin if TRxDBLookupCombo(Controls[i]).DataField=fielname then begin TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end; end; end; with bsSkinPanel1 do begin for i:=0 to ControlCount-1 do begin if Controls[i] is TDBEdit then begin if TDBEdit(Controls[i]).DataField=fielname then begin TDBEdit(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TRxDBLookupCombo then begin if TRxDBLookupCombo(Controls[i]).DataField=fielname then begin TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end; end; end; end; begin //必填项颜色 frm_data_share.t_code_empty.Filtered:=false; frm_data_share.t_code_empty.Filter:='表=''t_op_airi'''; frm_data_share.t_code_empty.Filtered:=true; frm_data_share.t_code_empty.First; while not frm_data_share.t_code_empty.Eof do begin if (frm_data_share.t_code_empty.fieldbyname('字段名称').asstring='分提单号') or (frm_data_share.t_code_empty.fieldbyname('字段名称').asstring='分提单号') then begin if t_op_airi1.DataSet.FindField('装运方式')<>nil then begin if pos('主票',t_op_airi1.DataSet.FieldByName('装运方式').asstring)>0 then begin end else begin consetcolor(frm_data_share.t_code_empty.fieldbyname('字段名称').asstring); end; end else begin consetcolor(frm_data_share.t_code_empty.fieldbyname('字段名称').asstring); end; end else begin consetcolor(frm_data_share.t_code_empty.fieldbyname('字段名称').asstring); end; frm_data_share.t_code_empty.next; end; end; procedure Tfrm_op_airi.Notebook1PageChanged(Sender: TObject); begin setconcolor; end; procedure Tfrm_op_airi.DBEdit7DblClick(Sender: TObject); begin with frm_data_share.P_GetMaxHblno do begin close; Parameters.ParamByName('@hblhead').value:=DBEdit7.text+'%'; open; if (not IsEmpty) and (FieldByName('分提单号').AsString<>'') then begin lblhbl.Caption:=FieldByName('分提单号').AsString; bsSkinPanel10.Visible:=true; end; end; end; procedure Tfrm_op_airi.DBEdit7Exit(Sender: TObject); begin bsSkinPanel10.Visible:=false; end; procedure Tfrm_op_airi.bsSkinSpeedButton1Click(Sender: TObject); begin if t_op_airi1.DataSet.FieldByName('委托编号').IsNull or (t_op_airi1.DataSet['委托编号']='') then begin t_op_airi1.DataSet.edit; if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_airi1.DataSet['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi1.DataSet['会计期间']) else t_op_airi1.DataSet['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi1.DataSet['进口日期']); end; end; procedure Tfrm_op_airi.DBEdit8DblClick(Sender: TObject); begin with frm_data_share.P_GetMaxWTno do begin close; Parameters.ParamByName('@hblhead').value:=DBEdit8.text+'%'; open; if (not IsEmpty) and (FieldByName('委托编号').AsString<>'') then begin lblwt.Caption:=FieldByName('委托编号').AsString; bsSkinPanel4.Visible:=true; end; end; end; procedure Tfrm_op_airi.DBEdit5DblClick(Sender: TObject); begin with frm_data_share.P_GetMaxDCno do begin close; Parameters.ParamByName('@hblhead').value:=DBEdit5.text+'%'; open; if (not IsEmpty) and (FieldByName('订舱单号').AsString<>'') then begin lbldc.Caption:=FieldByName('订舱单号').AsString; bsSkinPanel12.Visible:=true; end; end; end; procedure Tfrm_op_airi.DBEdit8Exit(Sender: TObject); begin bsSkinPanel4.Visible:=false; end; procedure Tfrm_op_airi.DBEdit5Exit(Sender: TObject); begin bsSkinPanel12.Visible:=false; end; procedure Tfrm_op_airi.RxDBLookupCombo16Change(Sender: TObject); begin if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit)then begin if RxDBLookupCombo16.DisplayValue<>'' then t_op_airi1.DataSet['发货人代码']:=frm_data_share.t_crm_client_shiper.fieldbyname('空运快捷代码').asstring; end; end; procedure Tfrm_op_airi.RxDBLookupCombo17Change(Sender: TObject); begin if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit)then begin if RxDBLookupCombo17.DisplayValue<>'' then t_op_airi1.DataSet['收货人代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('空运快捷代码').asstring; end; end; procedure Tfrm_op_airi.RxDBLookupCombo18Change(Sender: TObject); begin if (t_op_airi1.DataSet.State=dsinsert)or(t_op_airi1.DataSet.State=dsedit)then begin if RxDBLookupCombo18.DisplayValue<>'' then t_op_airi1.DataSet['通知人代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('空运快捷代码').asstring; end; end; procedure Tfrm_op_airi.wwDBLookupCombo2Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo2.text,[]) then begin t_op_airi1.DataSet.edit; t_op_airi1.DataSet['发货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_airi.wwDBLookupCombo7Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo7.text,[]) then begin t_op_airi1.DataSet.edit; t_op_airi1.DataSet['收货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_airi.wwDBLookupCombo8Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo8.text,[]) then begin t_op_airi1.DataSet.edit; t_op_airi1.DataSet['通知人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_airi.RxDBLookupCombo16Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo16); end; procedure Tfrm_op_airi.RxDBLookupCombo17Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo17); end; procedure Tfrm_op_airi.RxDBLookupCombo18Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo18); end; procedure Tfrm_op_airi.RxDBLookupCombo16Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo16); end; procedure Tfrm_op_airi.RxDBLookupCombo17Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo17); end; procedure Tfrm_op_airi.RxDBLookupCombo18Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo18); end; procedure Tfrm_op_airi.wwDBLookupCombo2Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='发货人=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_airi.wwDBLookupCombo7Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='收货人=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_airi.wwDBLookupCombo8Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='通知人=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_airi.wwDBLookupCombo7Exit(Sender: TObject); begin wwDBLookupCombo7.Clear; end; procedure Tfrm_op_airi.wwDBLookupCombo2Exit(Sender: TObject); begin wwDBLookupCombo2.Clear; end; procedure Tfrm_op_airi.wwDBLookupCombo8Exit(Sender: TObject); begin wwDBLookupCombo8.Clear; end; procedure Tfrm_op_airi.RxDBLookupCombo16KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo2); end; procedure Tfrm_op_airi.RxDBLookupCombo17KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo7); end; procedure Tfrm_op_airi.RxDBLookupCombo18KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo8); end; procedure Tfrm_op_airi.wwDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo6); end; procedure Tfrm_op_airi.wwDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo1); end; procedure Tfrm_op_airi.wwDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo5); end; procedure Tfrm_op_airi.wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit30); end; procedure Tfrm_op_airi.DBEdit12KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo17); end; procedure Tfrm_op_airi.RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo3); end; procedure Tfrm_op_airi.wwDBComboBox1DropDown(Sender: TObject); var aQuery:TAdoQuery; begin wwDBComboBox1.Items.Clear; if t_op_airi1.DataSet.FieldByName('业务来源').AsString='' then begin exit; end; aQuery:=CreateAdoQuery; try with aQuery do begin close;sql.Clear; sql.Add('select 来源明细 from t_code_source_dl where 业务来源='''+t_op_airi1.DataSet.FieldByName('业务来源').AsString+''' order by 来源明细'); open; first; while not eof do begin wwDBComboBox1.Items.Add(FieldByName('来源明细').AsString); next; end; end; finally FreeAndNil(aQuery); end; end; procedure Tfrm_op_airi.RxDBLookupCombo31Change(Sender: TObject); begin t_op_airi1.DataSet.FieldByName('来源明细').AsString:=''; end; procedure Tfrm_op_airi.wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo15); end; procedure Tfrm_op_airi.RxDBLookupCombo15KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo8); end; procedure Tfrm_op_airi.RxDBLookupCombo3Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo3); end; procedure Tfrm_op_airi.RxDBLookupCombo4Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo4); end; procedure Tfrm_op_airi.RxDBLookupCombo19Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo19); end; procedure Tfrm_op_airi.RxDBLookupCombo4Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo4); end; procedure Tfrm_op_airi.RxDBLookupCombo3Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo3); end; procedure Tfrm_op_airi.RxDBLookupCombo19Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo19); end; procedure Tfrm_op_airi.wwDBLookupCombo3Exit(Sender: TObject); begin wwDBLookupCombo3.Clear; end; procedure Tfrm_op_airi.wwDBLookupCombo4Exit(Sender: TObject); begin wwDBLookupCombo4.Clear; end; procedure Tfrm_op_airi.wwDBLookupCombo5Exit(Sender: TObject); begin wwDBLookupCombo5.Clear; end; procedure Tfrm_op_airi.wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo9); end; procedure Tfrm_op_airi.RxDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo4); end; procedure Tfrm_op_airi.wwDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo7); end; procedure Tfrm_op_airi.RxDBLookupCombo19KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo5); end; procedure Tfrm_op_airi.wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo8); end; procedure Tfrm_op_airi.wwDBComboBox2Change(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if wwDBComboBox2.text='空运主票' then begin bsSkinPageControl2.Visible:=true; bsSkinPanel5.Visible:=true; if strtobool(get_parameters_value(131,'false')) then begin end else begin DBEdit7.Color:=clBtnFace; DBEdit7.ReadOnly:=true; end; end else begin bsSkinPageControl2.Visible:=false; bsSkinPanel5.Visible:=false; DBEdit7.Color:=clWindow; DBEdit7.ReadOnly:=false; end; end; procedure Tfrm_op_airi.dxDBGrid2DblClick(Sender: TObject); begin bsSkinButton11.Caption:='返回主票'; try t_op_airi1.Enabled:=false; t_op_airi1.DataSet:=t_op_airi_fen; finally t_op_airi1.Enabled:=true; end; end; procedure Tfrm_op_airi.t_op_airi_fenAfterInsert(DataSet: TDataSet); begin t_op_airi_fen['航空公司']:=t_op_airi['航空公司']; t_op_airi_fen['航班号']:=t_op_airi['航班号']; t_op_airi_fen['目的港']:=t_op_airi['目的港']; t_op_airi_fen['始发港']:=t_op_airi['始发港']; t_op_airi_fen['进口日期']:=t_op_airi['进口日期']; t_op_airi_fen['卸货代理']:=t_op_airi['卸货代理']; end; procedure Tfrm_op_airi.t_op_airi_fenBeforeCancel(DataSet: TDataSet); begin delete_no(t_op_airi_fen); if t_op_airi_fen.State=dsinsert then if not t_op_airi_fen.FieldByName('委托编号').IsNull then delwtno(t_op_airi_fen['委托编号']); end; procedure Tfrm_op_airi.t_op_airi_fenBeforeDelete(DataSet: TDataSet); begin op_befor_post(t_op_airi_fen,'0004'); delete_add(4,t_op_airi_fen); if not t_op_airi_fen.FieldByName('委托编号').IsNull then delwtno(t_op_airi_fen['委托编号']); end; procedure Tfrm_op_airi.t_op_airi_fenBeforePost(DataSet: TDataSet); begin table_before_post(t_op_airi_fen,'委托单位'); table_before_post(t_op_airi_fen,'操作员'); table_before_post(t_op_airi_fen,'客服员'); table_before_post(t_op_airi_fen,'主运单号'); table_before_post(t_op_airi_fen,'分运单号'); table_before_post(t_op_airi_fen,'进口日期'); table_before_post(t_op_airi_fen,'航班号'); table_before_post(t_op_airi_fen,'始发港'); table_before_post(t_op_airi_fen,'目的港'); table_before_post(t_op_airi_fen,'业务来源'); if pos('指定',t_op_airi_fen.FieldByName('业务来源').AsString)>0 then begin end else begin table_before_post(t_op_airi_fen,'揽货人'); table_before_post(t_op_airi_fen,'销售部门'); end; table_before_post(t_op_airi_fen,'操作部门'); if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_airi_fen.FieldByName('委托编号').IsNull or (trim(t_op_airi_fen['委托编号'])='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_airi_fen['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi_fen['会计期间']) else t_op_airi_fen['委托编号']:=getwtno(4,subComp,department,employee,t_op_airi_fen['进口日期']); if op_empty('t_op_airi',t_op_airi_fen) then Abort; if t_op_airi_fen.fieldbyname('进口日期').oldvalue<>t_op_airi_fen.fieldbyname('进口日期').asdatetime then if (t_op_airi_fen.fieldbyname('业务类型').asstring<>'更改单') and (Logininfo.endday>=t_op_airi_fen.fieldbyname('进口日期').asdatetime) then begin showmessage('此进口日期所在期间已月末结账,不能添加修改业务!!'); abort; end; if t_op_airi_fen.FieldByName('委托单位').OldValue<>t_op_airi_fen.FieldByName('委托单位').asstring then begin if frm_data_share.t_crm_client_all.Locate('客户简称',t_op_airi_fen.FieldByName('委托单位').asstring,[])then begin if frm_data_share.t_crm_client_all.fieldbyname('客户状态').asstring='封存客户'then begin showmessage('当前业务委托单位已经封存,不能再进行业务合作,如需合作请进行恢复客户操作!'); abort; end; end; end; if t_op_airi_fen.State=dsinsert then begin if t_op_airi_fen.fieldbyname('业务编号').asstring=''then begin t_op_airi_fen['业务编号']:=get_no(t_op_airi_fen.fieldbyname('会计期间').AsDateTime,getbsno(Logininfo.AirImpBsNo,'AI')); t_op_airi_fen['编号']:=get_id; end; t_op_airi_fen['主编号']:=t_op_airi['编号']; t_op_airi_fen['业务状态']:='接受委托'; t_op_airi_fen['费用状态']:='录入状态'; end; if strtobool(get_parameters_value(43,'false')) then begin if (trim(t_op_airi_fen.fieldbyname('主运单号').asstring)='') or (t_op_airi_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_airi_fen['主提单标准']:=t_op_airi_fen['编号']; end else begin t_op_airi_fen['主提单标准']:=Logininfo.subcompcode+t_op_airi_fen['主运单号']; end; end else begin t_op_airi_fen['主提单标准']:=t_op_airi_fen['编号']; end; if strtobool(get_parameters_value(44,'false')) then begin if (trim(t_op_airi_fen.fieldbyname('分运单号').asstring)='') or (t_op_airi_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_airi_fen['分提单标准']:=t_op_airi_fen['编号']; end else begin t_op_airi_fen['分提单标准']:=Logininfo.subcompcode+t_op_airi_fen['分运单号']; end; end else begin t_op_airi_fen['分提单标准']:=t_op_airi_fen['编号']; end; if strtobool(get_parameters_value(45,'false')) then begin if (trim(t_op_airi_fen.fieldbyname('委托编号').asstring)='') or (t_op_airi_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_airi_fen['委托标准']:=t_op_airi_fen['编号']; end else begin t_op_airi_fen['委托标准']:=t_op_airi_fen['委托编号']; end; end else begin t_op_airi_fen['委托标准']:=t_op_airi_fen['编号']; end; //t_op_airi_fen['upload']:=1; end; procedure Tfrm_op_airi.bsSkinButton32Click(Sender: TObject); begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; if (t_op_airi_fen.State=dsinsert)or(t_op_airi_fen.State=dsedit) then t_op_airi_fen.post; try frm_op_airi_add:=tfrm_op_airi_add.Create (self); frm_op_airi_add.data1.Enabled:=false; frm_op_airi_add.data1.DataSet:=t_op_airi_fen; frm_op_airi_add.data1.Enabled:=true; frm_op_airi_add.bsSkinCheckRadioBox3.Checked:=true; frm_op_airi_add.bsSkinCheckRadioBox2.Enabled:=false; frm_op_airi_add.bsSkinCheckRadioBox4.Enabled:=true; frm_op_airi_add_num:=3; frm_op_airi_add.ShowModal; finally frm_op_airi_add.Free end; end; procedure Tfrm_op_airi.bsSkinButton33Click(Sender: TObject); begin bsSkinButton11.Caption:='返回主票'; try t_op_airi1.Enabled:=false; t_op_airi1.DataSet:=t_op_airi_fen; finally t_op_airi1.Enabled:=true; end; end; procedure Tfrm_op_airi.bsSkinButton34Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton34.ClientToScreen(Point(0,bsSkinButton34.Height)); PopupMenu4.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_airi.MenuItem1Click(Sender: TObject); begin if t_op_airi_fen.IsEmpty then exit; t_op_airi_fen.edit; t_op_airi_fen['主编号']:=t_op_airi_fen['编号']; t_op_airi_fen.post; t_op_airi_fen.Requery(); end; procedure Tfrm_op_airi.MenuItem3Click(Sender: TObject); begin if t_op_airi_fen.IsEmpty then exit; t_op_airi_fen.edit; t_op_airi_fen['主编号']:=t_op_airi_fen['编号']; t_op_airi_fen['装运方式']:='空运单票'; t_op_airi_fen.post; t_op_airi_fen.Requery(); end; procedure Tfrm_op_airi.N76Click(Sender: TObject); begin update_grid_view_no(dxdbgrid2); end; procedure Tfrm_op_airi.N78Click(Sender: TObject); begin update_grid_view_all(dxdbgrid2); end; procedure Tfrm_op_airi.bsSkinButton36Click(Sender: TObject); begin if (t_op_airi_fen.State=dsinsert)or(t_op_airi_fen.State=dsedit) then t_op_airi_fen.post; end; procedure Tfrm_op_airi.N42Click(Sender: TObject); begin if t_op_airi.IsEmpty then exit; if t_op_airi.FieldByName('装运方式').asstring='空运单票' then exit; if t_op_airi.FieldByName('装运方式').asstring='空运主票'then begin if not t_op_airi_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为单票!!'); exit; end; end; t_op_airi.edit; t_op_airi['装运方式']:='空运单票'; t_op_airi['主编号']:=t_op_airi['编号']; t_op_airi.post; end; procedure Tfrm_op_airi.N44Click(Sender: TObject); begin if t_op_airi.IsEmpty then exit; if t_op_airi.FieldByName('装运方式').asstring='空运主票' then exit; t_op_airi.edit; t_op_airi['装运方式']:='空运主票'; t_op_airi['主编号']:=t_op_airi['编号']; t_op_airi.post; end; procedure Tfrm_op_airi.N46Click(Sender: TObject); begin if t_op_airi.IsEmpty then exit; if t_op_airi.FieldByName('装运方式').asstring='空运分票' then exit; if t_op_airi.FieldByName('装运方式').asstring='空运主票'then begin if not t_op_airi_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为分票!!'); exit; end; end; t_op_airi.edit; t_op_airi['装运方式']:='空运分票'; t_op_airi['主编号']:=t_op_airi['编号']; t_op_airi.post; end; procedure Tfrm_op_airi.N49Click(Sender: TObject); begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_op_add_airi:=tfrm_op_add_airi.Create (self); frm_op_add_airi.ShowModal; finally frm_op_add_airi.Free; end; end; procedure Tfrm_op_airi.N51Click(Sender: TObject); var can_do:boolean; gdo,xdo:smallint; begin if t_op_airi1.DataSet=nil then exit; if t_op_airi1.DataSet.IsEmpty then exit; if not do_data('0004',t_op_airi1.DataSet.FieldByName('录入人').asstring ,t_op_airi1.DataSet.FieldByName('操作员').asstring ,t_op_airi1.DataSet.FieldByName('揽货人').asstring ,t_op_airi1.DataSet.FieldByName('客服员').asstring ,'' ,'') then begin showmessage('对不起你无权修改此数据!'); abort; end; if t_op_airi1.DataSet.FieldByName('费用状态').asstring='费用封帐' then begin showmessage('此票业务状态已经为费用封帐状态!'); abort; end; t_ch_fee.close; t_ch_fee.Parameters[0].value:=t_op_airi1.DataSet.fieldbyname('编号').asstring; t_ch_fee.open; can_do:=true; t_ch_fee.first; while not t_ch_fee.eof do begin if can_do then begin if (t_ch_fee.FieldByName('费用状态').asstring<>'审核通过') and (t_ch_fee.FieldByName('费用状态').asstring<>'部分结算') and (t_ch_fee.FieldByName('费用状态').asstring<>'结算完毕') and (t_ch_fee.FieldByName('费用状态').asstring<>'禁止删除') and (t_ch_fee.FieldByName('费用状态').asstring<>'禁止修改')then begin can_do:=false; showmessage('此票业务中的费用状态,不能费用封帐!'); exit; end; end; t_ch_fee.next; end; gdo:=strtoint(get_parameters_value(137,'0')); xdo:=strtoint(get_parameters_value(138,'0')); t_ch_fee.close; if can_do then begin prnlist:=true; try t_op_airi1.DataSet.edit; t_op_airi1.DataSet['费用状态']:='费用封帐'; t_op_airi1.DataSet['费用封帐日期']:=Now; if (gdo<>0) or (xdo<>0) then begin if trim(t_op_airi1.DataSet.fieldbyname('业务类型').AsString)='普通货' then begin if gdo=1 then begin if t_op_airi1.DataSet['进口日期']>Logininfo.endday then t_op_airi1.DataSet['会计期间']:=t_op_airi1.DataSet['进口日期']; end; end else if trim(t_op_airi1.DataSet.fieldbyname('业务类型').asstring)='更改单' then begin if xdo=1 then begin if t_op_airi1.DataSet['录入日期']>Logininfo.endday then t_op_airi1.DataSet['会计期间']:=t_op_airi1.DataSet['录入日期']; end; end; end; t_op_airi1.DataSet.post; finally prnlist:=false; end; end; end; procedure Tfrm_op_airi.wwDBLookupCombo9KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo52); end; procedure Tfrm_op_airi.wwDBLookupCombo15KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo1); end; procedure Tfrm_op_airi.wwDBLookupCombo9Change(Sender: TObject); begin if (t_op_airi1.DataSet.state=dsinsert)or(t_op_airi1.DataSet.state=dsedit)then begin if wwDBLookupCombo9.text='' then exit; if frm_data_share.t_code_port_air.locate('代码',wwDBLookupCombo9.text,[]) then begin t_op_airi1.DataSet['始发港']:=frm_data_share.t_code_port_air['英文名']; end; end; end; procedure Tfrm_op_airi.wwDBLookupCombo15Change(Sender: TObject); begin if (t_op_airi1.DataSet.state=dsinsert)or(t_op_airi1.DataSet.state=dsedit)then begin if wwDBLookupCombo15.text='' then exit; if frm_data_share.t_code_port_air.locate('代码',wwDBLookupCombo15.text,[]) then begin t_op_airi1.DataSet['目的港']:=frm_data_share.t_code_port_air['英文名']; end; end; end; procedure Tfrm_op_airi.RxDBLookupCombo11Change(Sender: TObject); begin if t_op_airi1.DataSet=nil then exit; if (t_op_airi1.DataSet.state=dsinsert)or(t_op_airi1.DataSet.state=dsedit)then begin if RxDBLookupCombo11.DisplayValue='' then exit; t_op_airi1.DataSet.fieldbyname('货物描述').asstring:=t_op_airi1.DataSet.fieldbyname('货物描述').asstring+#13#10+frm_data_share.t_code_goods['货物描述']; end; end; procedure Tfrm_op_airi.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_op_airi1.DataSet.GetBookmark; t_op_airi1.DataSet.Refresh; t_op_airi1.DataSet.GotoBookmark(book1); end; procedure Tfrm_op_airi.wwDBDateTimePicker3KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit10); end; procedure Tfrm_op_airi.RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo5); end; procedure Tfrm_op_airi.RxDBLookupCombo1Enter(Sender: TObject); begin RxLookupComboEnter(TRxDBLookupCombo(Sender)); end; procedure Tfrm_op_airi.RxDBLookupCombo1Exit(Sender: TObject); begin RxLookupComboExit(TRxDBLookupCombo(Sender)); end; procedure Tfrm_op_airi.bsSkinButton14Click(Sender: TObject); begin if not (if_open('299') or if_open('300')) then begin showmessage('对不起,你无权操作费用!!'); exit; end; if not assigned(frm_ch_fee_zhupiao) then frm_ch_fee_zhupiao:=tfrm_ch_fee_zhupiao.Create (self); frm_ch_fee_zhupiao.fra_fee_zhu1.fenpiao1.DataSet:=t_op_airi_fen; with frm_ch_fee_zhupiao do begin if if_open('299') then begin fra_fee_zhu1.t_ch_accept.close; fra_fee_zhu1.t_ch_accept.Parameters[1].value:=t_op_airi.fieldbyname('编号').asstring; fra_fee_zhu1.t_ch_accept.open; fra_fee_zhu1.zhupiao1.DataSet:=t_op_airi; fra_fee_zhu1.dxDBGrid1.FullExpand; fra_fee_zhu1.bsSkinPanel3.visible:=true; end else fra_fee_zhu1.bsSkinPanel3.visible:=false; if if_open('300') then begin fra_fee_zhu1.t_ch_pay.close; fra_fee_zhu1.t_ch_pay.Parameters[1].value:=t_op_airi.fieldbyname('编号').asstring; fra_fee_zhu1.t_ch_pay.open; fra_fee_zhu1.zhupiao1.DataSet:=t_op_airi; fra_fee_zhu1.dxDBGrid2.FullExpand; fra_fee_zhu1.bsSkinPanel4.visible:=true; end else fra_fee_zhu1.bsSkinPanel4.visible:=false; if fra_fee_zhu1.bsSkinPanel3.visible and fra_fee_zhu1.bsSkinPanel4.visible then begin fra_fee_zhu1.t_op_gain.close; fra_fee_zhu1.t_op_gain.Parameters[1].value:=t_op_airi.fieldbyname('编号').asstring; fra_fee_zhu1.t_op_gain.open; fra_fee_zhu1.t_op_gain_fen.close; fra_fee_zhu1.t_op_gain_fen.Parameters[1].value:=t_op_airi.fieldbyname('编号').asstring; fra_fee_zhu1.t_op_gain_fen.open; end else begin fra_fee_zhu1.t_op_gain.close; fra_fee_zhu1.t_op_gain_fen.close; fra_fee_zhu1.bsSkinTabSheet2.TabVisible:=false; end; fra_fee_zhu1.dxDBGrid3.FullExpand; end; frm_ch_fee_zhupiao.ShowModal; end; procedure Tfrm_op_airi.bsSkinButton45Click(Sender: TObject); var tempstr:widestring; begin if airipsqlstr<>'' then begin tempstr:=airipsqlstr; t_op_airi.close; if t_op_airi.sql.Text<>'' then airipsqlstr:=t_op_airi.sql.Text; t_op_airi.sql.clear; t_op_airi.sql.add(tempstr); t_op_airi.Open; end; end; procedure Tfrm_op_airi.bsSkinButton48Click(Sender: TObject); var FileStream:TFileStream; fsize:double; begin op_befor_post(t_op_airi,'0004'); if OpenDialog1.Execute then begin FileStream:=TFileStream.Create(Opendialog1.FileName,fmopenRead); //打开文件 try fsize:=FileStream.size; finally freeandnil(FileStream); end; if fsize>500000 then begin MessageDlg('文件不能超过500K!!',mtWarning,[mbyes],0); end else UpLoadPro(Opendialog1.FileName); end else exit ; end; procedure Tfrm_op_airi.bsSkinButton49Click(Sender: TObject); begin if SaveDialog1.Execute then begin DownLoadPro(Savedialog1.FileName+t_op_file.fieldbyname('类型').asstring); end else exit ; end; procedure Tfrm_op_airi.bsSkinButton50Click(Sender: TObject); var arr: array[0..MAX_PATH] of Char; num: DWORD; tmpfile:string ; begin try GetTempPath(MAX_PATH, arr); tmpfile:=arr+t_op_file.fieldbyname('名称').asstring ; DownLoadPro(tmpfile) ; ShellExecute(Handle, nil, pchar(tmpfile), nil, nil, SW_NORMAL); except showmessage('不能打开文件,请检查网络连接等错误!'); end ; end; procedure Tfrm_op_airi.bsSkinButton51Click(Sender: TObject); begin op_befor_post(t_op_airi,'0004'); if application.MessageBox('您确定要删除附件吗?','警告:',MB_OKCANCEL)=IDOK then t_op_file.delete ; end; procedure Tfrm_op_airi.t_op_fileBeforeEdit(DataSet: TDataSet); begin op_befor_post(t_op_airi,'0004'); end; procedure Tfrm_op_airi.DownLoadPro(fname: string); const MaxBufSize=$F000; var myfilename:string;//保存文件的路径和文件名 myfileStream,exeBlobStream:TStream; Count,BufSize,N: Integer; Buffer:PChar; begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.Update; myfilename:=FName ; with t_op_file do begin myfilename:=myfilename ; //+fieldbyname('类型').asstring ; myfileStream :=TFileStream.Create(myfilename,fmCreate);//创建文件 try //SaveToStream(Stream); ExeBlobStream:=CreateBlobStream(FieldByName('内容'),bmRead); //从数据库中取得记录 Count:=0; try if Count=0 then begin ExeBlobStream.Position:=0; Count:=ExeBlobStream.Size;//showmessage(inttostr(count)); end; if Count>MaxBufSize then BufSize:=MaxBufSize else BufSize:=Count; GetMem(Buffer,BufSize); frm_sys_progress.bsSkinGauge1.MaxValue:=(Count div BufSize)+2; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; try while Count<>0 do begin if Count>BufSize then N:=BufSize else N:=Count; ExeBlobStream.ReadBuffer(Buffer^,N);//从数据库表中取数据流 MyFileStream.WriteBuffer(Buffer^,N);//将数据流写入文件 Dec(Count,N); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; end; finally FreeMem(Buffer,BufSize); end; finally ExeBlobStream.Free; end; finally myfileStream.Free; end; end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; end; procedure Tfrm_op_airi.UpLoadPro(fname: string); const BufSize=$F000; var Counter, N: Integer; Buffer: PAnsiChar; FieldStrm: TStream; ExeFileStream:TFileStream; size_tmp: Double; filename,fileExt:string ; begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.Update; filename:=ExtractFileName(fname) ; fileExt:=ExtractFileExt(filename) ; ExeFileStream:=TFileStream.Create(fname,fmopenRead); //打开文件 with t_op_file do begin Open; append; try FieldStrm := CreateBlobStream(FieldByName('内容'),bmWrite); GetMem(Buffer,BufSize); try Counter := ExeFileStream.Size; size_tmp :=ExeFileStream.Size; frm_sys_progress.bsSkinGauge1.MaxValue:=(Counter div BufSize)+2; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; while Counter<>0 do begin if Counter>BufSize then N :=BufSize else N:=Counter; ExeFileStream.ReadBuffer(Buffer^,N); FieldStrm.WriteBuffer(Buffer^, N); Dec(Counter, N); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; // Application.ProcessMessages; end; finally FreeMem(Buffer,BufSize); FieldStrm.Free; end; FieldByName('名称').AsString:=filename; FieldByName('大小').AsFloat:=size_tmp; FieldByName('上传日期').AsDateTime:=now(); FieldByName('所有者').Asstring:=employee; FieldByName('类型').Asstring:=fileExt; Post; Application.MessageBox('程序上传至服务器成功!','提示',MB_OK+MB_IconInformation); finally frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; ExeFileStream.Free; end; end; end; procedure Tfrm_op_airi.wwDBDateTimePicker2Change(Sender: TObject); begin if not wwDBDateTimePicker2.Focused then exit; if (strtoint(get_parameters_value(158,'0'))=1) and (Trim(t_op_airi1.dataset.FieldByName('业务类型').AsString)='更改单') then wwDBDateTimePicker2.ReadOnly:=true; end; procedure Tfrm_op_airi.N53Click(Sender: TObject); var i:integer; aAdoQuery,aAdoQueryUpdate:TAdoQuery; IdFTP1:TIdFTP; str:widestring; str_file:widestring; inifile1:Tinifile; FTPHost,FTPUsername,FTPPassword,FTPPATH,ScriptPath:String; begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'Ftptrans.ini'); FTPHost:=inifile1.ReadString('BJHX','FTPHost',''); FTPUsername:=inifile1.ReadString('BJHX','FTPUsername',''); FTPPassword:=inifile1.ReadString('BJHX','FTPPassword','/'); FTPPATH:=inifile1.ReadString('BJHX','FTPPATH',''); if t_op_airi1.DataSet.IsEmpty then exit; if trim(FTPHost)='' then exit; aAdoQueryUpdate:=CreateAdoQuery; with aAdoQueryUpdate do begin close; sql.clear; Close;sql.Clear; SQL.Add('update t_OP_airi set 财务凭证2=''是'''); SQL.Add('where 编号=:编号'); end; aAdoQuery:=CreateAdoQuery; with aAdoQuery do begin close; sql.clear; Close;sql.Clear; SQL.Add('select t_OP_airi.主运单号,''空运进口'' as YWZL,t_OP_airi.业务类型,t_ch_fee.* from t_ch_fee'); SQL.Add('left Join t_OP_airi on t_ch_fee.编号=t_OP_airi.编号'); SQL.Add('where t_OP_airi.编号=:编号 and t_OP_airi.主运单号<>'''''); SQL.Add('and t_ch_fee.客户名称 in(''青岛航迅'', ''北京航迅'')'); end; try IdFTP1:=TIdFTP.Create(application); with idftp1 do begin Host:=FTPHost; Username:=FTPUsername; Password:=FTPPassword; Connect; end; idftp1.ChangeDir(FTPPATH); idftp1.TransferType:=ftBinary; finally end; t_op_airi1.DataSet.DisableControls; ScriptPath:=ExtractFilePath(ParamStr(0))+'FTPFILE\'; if not DirectoryExists(ScriptPath) then CreateDir(ScriptPath); if dxDBGrid1.SelectedCount>=1 then for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_airi1.DataSet.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //4 aAdoQueryUpdate.Close; aAdoQueryUpdate.Parameters.ParamByName('编号').Value:=t_op_airi1.DataSet.FieldByName('编号').Value; aAdoQueryUpdate.ExecSQL; aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('编号').Value:=t_op_airi1.DataSet.FieldByName('编号').Value; aAdoQuery.Open; if not aAdoQuery.IsEmpty then begin aAdoQuery.SaveToFile(ScriptPath+aAdoQuery.FieldByName('主运单号').AsString+'.ds',pfADTG); str_file:=aAdoQuery.FieldByName('主运单号').AsString+'.ds'; str:=ScriptPath+aAdoQuery.FieldByName('主运单号').AsString+'.ds'; if idftp1.Connected then begin idftp1.Put(str,str_file); end; end; end; try finally frm_sys_progress.close; frm_sys_progress:=nil; aAdoQueryUpdate.Free; aAdoQuery.Free; t_op_airi1.DataSet.EnableControls; if idftp1.Connected then idftp1.Disconnect; end; end; procedure Tfrm_op_airi.N55Click(Sender: TObject); var i:integer; aAdoQuery,aAdoQueryUpdate:TAdoQuery; IdFTP1:TIdFTP; str,str_file:widestring; inifile1:Tinifile; FTPHost,FTPUsername,FTPPassword,FTPPATH,ScriptPath:String; begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'Ftptrans.ini'); FTPHost:=inifile1.ReadString('BJHX','FTPHost',''); FTPUsername:=inifile1.ReadString('BJHX','FTPUsername',''); FTPPassword:=inifile1.ReadString('BJHX','FTPPassword','/'); FTPPATH:=inifile1.ReadString('BJHX','FTPPATH2',''); if t_op_airi1.DataSet.IsEmpty then exit; if trim(FTPHost)='' then exit; aAdoQuery:=CreateAdoQuery; with aAdoQuery do begin close; sql.clear; Close;sql.Clear; SQL.Add('select t_OP_airi.主运单号,''空运出口'' as YWZL,t_OP_airi.业务类型,t_ch_fee.* from t_ch_fee'); SQL.Add('left Join t_OP_airi on t_ch_fee.编号=t_OP_airi.编号'); SQL.Add('where t_OP_airi.编号=:编号 and t_OP_airi.主运单号<>'''''); SQL.Add('and t_ch_fee.客户名称 not in (''青岛航迅'', ''北京航迅'')'); end; try IdFTP1:=TIdFTP.Create(application); with idftp1 do begin Host:=FTPHost; Username:=FTPUsername; Password:=FTPPassword; Connect; end; idftp1.ChangeDir(FTPPATH); idftp1.TransferType:=ftBinary; finally end; ScriptPath:=ExtractFilePath(ParamStr(0))+'FTPFILE\'; if not DirectoryExists(ScriptPath) then CreateDir(ScriptPath); t_op_airi1.DataSet.DisableControls; if dxDBGrid1.SelectedCount>=1 then for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_airi1.DataSet.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //4 if t_op_airi1.DataSet.FieldByName('费用状态').AsString='费用封帐' then begin aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('编号').Value:=t_op_airi1.DataSet.FieldByName('编号').Value; aAdoQuery.Open; if not aAdoQuery.IsEmpty then begin aAdoQuery.SaveToFile(ScriptPath+aAdoQuery.FieldByName('主运单号').AsString+'.ds',pfADTG); str_file:=aAdoQuery.FieldByName('主运单号').AsString+'.ds'; str:=ScriptPath+aAdoQuery.FieldByName('主运单号').AsString+'.ds'; if idftp1.Connected then begin idftp1.Put(str,str_file); end; end; end; end; try finally aAdoQueryUpdate.Free; aAdoQuery.Free; frm_sys_progress.close; frm_sys_progress:=nil; t_op_airi1.DataSet.EnableControls; if idftp1.Connected then idftp1.Disconnect; end; end; procedure Tfrm_op_airi.Label4Click(Sender: TObject); begin try frm_crm_query:=Tfrm_crm_query.Create(application); frm_crm_query.DataSource1:=t_op_airi1; frm_crm_query.Top:= Screen.height-750; frm_crm_query.ShowModal; finally frm_crm_query.Free; frm_crm_query:=nil; end; end; procedure Tfrm_op_airi.N57Click(Sender: TObject); begin try frm_sys_dep_emp_module:=tfrm_sys_dep_emp_module.Create (self); frm_sys_dep_emp_module.moduleNames:=frm_op_airi.caption; frm_sys_dep_emp_module.ShowModal; finally frm_sys_dep_emp_module.Free; loadreggrid(dxdbgrid1,true,caption); end; end; procedure Tfrm_op_airi.N59Click(Sender: TObject); begin UpdateUpCase(t_op_airi1); if assigned(frm_op_airi_assistant) then UpdateUpCase(frm_op_airi_assistant.t_op_aire_assistant1); end; end.