{$INCLUDE t_main.inc} unit u_op_seai; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, ComCtrls, bsSkinTabs, DB, ADODB, RxLookup, StdCtrls, Mask, DBCtrls, wwdblook, wwdbdatetimepicker,IniFiles, wwdbedit, Wwdotdot, Wwdbcomb, u_fee, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, XPMenu, Menus, bsdbctrls, u_op_card, u_op_letter_free, Grids, DBGrids, u_op_sate,shellapi; type Tfrm_op_seai = 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_seai: TADOQuery; t_op_seai1: TDataSource; bsSkinPanel1: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label37: TLabel; Label5: TLabel; Label38: TLabel; Label4: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit8: TDBEdit; DBEdit4: TDBEdit; DBEdit9: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; Label9: TLabel; DBEdit7: TDBEdit; Label125: TLabel; wwDBLookupCombo49: TwwDBLookupCombo; Label126: TLabel; DBEdit63: TDBEdit; Label10: TLabel; wwDBLookupCombo3: TwwDBLookupCombo; Label124: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; Label26: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; Label11: TLabel; DBEdit10: TDBEdit; Label12: TLabel; DBEdit11: TDBEdit; Label13: TLabel; DBEdit12: TDBEdit; Label22: TLabel; wwDBComboBox2: TwwDBComboBox; Label164: TLabel; RxDBLookupCombo11: TRxDBLookupCombo; Label14: TLabel; DBEdit13: TDBEdit; DBEdit81: TDBEdit; wwDBLookupCombo61: TwwDBLookupCombo; DBEdit82: TDBEdit; DBEdit83: TDBEdit; Label15: TLabel; Label16: TLabel; Label18: TLabel; Label20: TLabel; Label73: TLabel; RxDBLookupCombo20: TRxDBLookupCombo; RxDBLookupCombo10: TRxDBLookupCombo; Label21: TLabel; Label23: TLabel; RxDBLookupCombo7: TRxDBLookupCombo; RxDBLookupCombo6: TRxDBLookupCombo; Label24: TLabel; Label25: TLabel; RxDBLookupCombo9: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; Label27: TLabel; Label33: TLabel; RxDBLookupCombo19: TRxDBLookupCombo; DBMemo1: TDBMemo; Label28: TLabel; Label29: TLabel; DBMemo2: TDBMemo; fra_fee1: Tfra_fee; bsSkinTabSheet3: TbsSkinTabSheet; PopupMenu1: TPopupMenu; N31: TMenuItem; XPMenu1: TXPMenu; t_ch_fee: TADOQuery; fra_op_state1: Tfra_op_state; Label30: TLabel; DBEdit14: TDBEdit; DBEdit15: TDBEdit; Label31: TLabel; Label32: TLabel; wwDBComboBox3: TwwDBComboBox; Label65: TLabel; DBEdit18: TDBEdit; Label6: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label34: TLabel; DBEdit16: TDBEdit; Label7: TLabel; wwDBComboBox1: TwwDBComboBox; Label8: TLabel; DBEdit5: TDBEdit; DBMemo3: TDBMemo; Label35: TLabel; DBMemo4: TDBMemo; Label36: TLabel; Label39: TLabel; RxDBLookupCombo29: TRxDBLookupCombo; RxDBLookupCombo30: TRxDBLookupCombo; Label42: TLabel; bsSkinTabSheet4: TbsSkinTabSheet; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; bsSkinGroupBox5: TbsSkinGroupBox; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox4: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox5: TbsSkinDBCheckRadioBox; fra_op_card1: Tfra_op_card; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; N20: TMenuItem; N21: TMenuItem; N22: TMenuItem; bsSkinTabSheet5: TbsSkinTabSheet; fra_op_letter_free1: Tfra_op_letter_free; N23: TMenuItem; N24: TMenuItem; N25: TMenuItem; N26: TMenuItem; N27: TMenuItem; N28: TMenuItem; N29: TMenuItem; N30: TMenuItem; bsSkinPanel2: TbsSkinPanel; bsSkinDBText2: TbsSkinDBText; bsSkinTabSheet6: TbsSkinTabSheet; bsSkinGroupBox7: TbsSkinGroupBox; bsSkinPanel7: TbsSkinPanel; Label100: TLabel; Label101: TLabel; Label102: TLabel; DBEdit31: TDBEdit; DBEdit32: TDBEdit; DBEdit33: TDBEdit; bsSkinButton38: TbsSkinButton; Label80: TLabel; RxDBLookupCombo32: TRxDBLookupCombo; Label81: TLabel; RxDBLookupCombo33: TRxDBLookupCombo; t_op_seai_fen: TADOQuery; t_op_seai_fen1: TDataSource; PopupMenu4: TPopupMenu; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; N61: TMenuItem; N76: TMenuItem; N77: TMenuItem; N78: TMenuItem; Label40: TLabel; DBMemo5: TDBMemo; RxDBLookupCombo14: TRxDBLookupCombo; wwDBLookupCombo1: TwwDBLookupCombo; Label43: TLabel; RxDBLookupCombo15: TRxDBLookupCombo; wwDBLookupCombo4: TwwDBLookupCombo; DBMemo6: TDBMemo; DBMemo7: TDBMemo; Label44: TLabel; RxDBLookupCombo16: TRxDBLookupCombo; wwDBLookupCombo7: TwwDBLookupCombo; N32: TMenuItem; N33: TMenuItem; N39: TMenuItem; N40: TMenuItem; N41: TMenuItem; N42: TMenuItem; N43: TMenuItem; N44: TMenuItem; N45: TMenuItem; t_op_seai2: TDataSource; N46: TMenuItem; N47: TMenuItem; Label41: TLabel; RxDBLookupCombo31: TRxDBLookupCombo; Label19: TLabel; RxDBLookupCombo12: TRxDBLookupCombo; Label45: TLabel; Label46: TLabel; RxDBLookupCombo18: TRxDBLookupCombo; DBText1: TDBText; N48: TMenuItem; N49: TMenuItem; N50: TMenuItem; N51: TMenuItem; bsSkinPageControl2: TbsSkinPageControl; tabsheet1: TbsSkinTabSheet; Label122: TLabel; Label121: TLabel; Label123: TLabel; DBMemo33: TDBMemo; DBMemo34: TDBMemo; DBMemo35: TDBMemo; wwDBLookupCombo5: TwwDBLookupCombo; RxDBLookupCombo4: TRxDBLookupCombo; wwDBLookupCombo2: TwwDBLookupCombo; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo5: TRxDBLookupCombo; wwDBLookupCombo6: TwwDBLookupCombo; tabsheet2: TbsSkinTabSheet; Panel1: TPanel; bsSkinButton31: TbsSkinButton; bsSkinButton32: TbsSkinButton; bsSkinButton33: TbsSkinButton; bsSkinButton34: TbsSkinButton; bsSkinButton36: TbsSkinButton; 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; N52: TMenuItem; N53: TMenuItem; bsSkinPanel3: TbsSkinPanel; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column67: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column62: TdxDBGridColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridDateColumn; dxDBGrid1Column61: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridDateColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid11: TdxDBGridMaskColumn; dxDBGrid12: TdxDBGridMaskColumn; dxDBGrid13: TdxDBGridMaskColumn; dxDBGrid14: TdxDBGridMaskColumn; dxDBGrid15: TdxDBGridMaskColumn; dxDBGrid16: TdxDBGridMaskColumn; dxDBGrid17: TdxDBGridMaskColumn; dxDBGrid18: TdxDBGridMaskColumn; dxDBGrid19: TdxDBGridMaskColumn; dxDBGrid110: TdxDBGridMaskColumn; dxDBGrid1Column39: TdxDBGridMaskColumn; dxDBGrid1TEU: TdxDBGridMaskColumn; dxDBGrid1Column41: TdxDBGridMaskColumn; dxDBGrid1Column42: TdxDBGridMaskColumn; dxDBGrid1Column43: TdxDBGridMaskColumn; dxDBGrid1Column44: TdxDBGridColumn; dxDBGrid1Column45: TdxDBGridColumn; dxDBGrid1Column46: TdxDBGridMaskColumn; dxDBGrid1Column47: TdxDBGridMaskColumn; dxDBGrid1Column48: TdxDBGridDateColumn; dxDBGrid1Column49: TdxDBGridMaskColumn; dxDBGrid1Column50: TdxDBGridMaskColumn; dxDBGrid1Column51: TdxDBGridMaskColumn; dxDBGrid1Column52: TdxDBGridMaskColumn; dxDBGrid1Column53: TdxDBGridMaskColumn; dxDBGrid1Column54: TdxDBGridMaskColumn; dxDBGrid1Column55: TdxDBGridMaskColumn; dxDBGrid1Column56: TdxDBGridMaskColumn; dxDBGrid1Column57: TdxDBGridMaskColumn; dxDBGrid1Column58: TdxDBGridColumn; dxDBGrid1Column59: TdxDBGridCheckColumn; dxDBGrid1Column60: TdxDBGridColumn; dxDBGrid1Column63: TdxDBGridColumn; dxDBGrid1Column64: TdxDBGridColumn; dxDBGrid1Column65: TdxDBGridColumn; dxDBGrid1Column66: TdxDBGridColumn; dxDBGrid1Column68: TdxDBGridColumn; dxDBGrid1Column69: TdxDBGridColumn; dxDBGrid1Column70: TdxDBGridColumn; bsSkinPanel9: TbsSkinPanel; Label116: TLabel; Label130: TLabel; Label131: TLabel; Label132: TLabel; Edit1: TEdit; Edit4: TEdit; Edit2: TEdit; Edit3: TEdit; bsSkinButton44: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinGroupBox1: TbsSkinGroupBox; Label47: TLabel; wwDBLookupCombo8: TwwDBLookupCombo; Label48: TLabel; DBEdit6: TDBEdit; Label49: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label50: TLabel; wwDBLookupCombo9: TwwDBLookupCombo; RxDBLookupCombo22: TRxDBLookupCombo; Label52: TLabel; Label53: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label54: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; Label55: TLabel; wwDBDateTimePicker5: TwwDBDateTimePicker; Label56: TLabel; wwDBLookupCombo21: TwwDBLookupCombo; bsSkinTabSheet7: TbsSkinTabSheet; bsSkinButton21: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton14: TbsSkinButton; bsSkinButton15: TbsSkinButton; DBMemo8: TDBMemo; Label58: TLabel; Label59: TLabel; DBMemo9: TDBMemo; dxDBGrid1Column71: TdxDBGridColumn; dxDBGrid1Column72: TdxDBGridColumn; bsSkinPanel10: TbsSkinPanel; lblhbl: TLabel; bsSkinPanel4: TbsSkinPanel; lblwt: TLabel; Label17: TLabel; RxDBLookupCombo13: TRxDBLookupCombo; Label133: TLabel; DBEdit41: TDBEdit; bsSkinPanel12: TbsSkinPanel; lbldc: TLabel; bsSkinSpeedButton1: TbsSkinSpeedButton; bsSkinButton16: TbsSkinButton; wwDBComboBox9: TwwDBComboBox; N54: TMenuItem; N55: TMenuItem; Label51: TLabel; RxDBLookupCombo28: TRxDBLookupCombo; Label57: TLabel; wwDBDateTimePicker6: TwwDBDateTimePicker; Label60: TLabel; wwDBDateTimePicker7: TwwDBDateTimePicker; N56: TMenuItem; EDI1: TMenuItem; EDI2: TMenuItem; N57: TMenuItem; N58: TMenuItem; N59: TMenuItem; N60: TMenuItem; Label61: TLabel; RxDBLookupCombo21: TRxDBLookupCombo; RxDBLookupCombo17: TRxDBLookupCombo; Label62: TLabel; dxDBGrid1Column73: TdxDBGridColumn; dxDBGrid1Column74: TdxDBGridColumn; dxDBGrid2Column17: TdxDBGridColumn; dxDBGrid1Column75: TdxDBGridColumn; dxDBGrid1Column76: TdxDBGridCheckColumn; bsSkinButton45: TbsSkinButton; N62: TMenuItem; N63: TMenuItem; bsSkinGroupBox2: TbsSkinGroupBox; wwDBDateTimePicker8: TwwDBDateTimePicker; Label63: TLabel; Label64: TLabel; DBEdit17: TDBEdit; Label66: TLabel; DBEdit19: TDBEdit; DBEdit20: TDBEdit; Label67: TLabel; Label68: TLabel; DBEdit21: TDBEdit; bsSkinGroupBox3: TbsSkinGroupBox; Label69: TLabel; Label70: TLabel; Label74: TLabel; Label75: TLabel; Label76: TLabel; Label77: TLabel; Label82: TLabel; Label154: TLabel; wwDBDateTimePicker9: TwwDBDateTimePicker; DBEdit22: TDBEdit; DBEdit24: TDBEdit; wwDBDateTimePicker10: TwwDBDateTimePicker; DBEdit25: TDBEdit; DBEdit26: TDBEdit; DBEdit28: TDBEdit; DBEdit50: TDBEdit; t_op_file: TADOQuery; dsrFuJian: TDataSource; 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; dxDBGrid1Column77: TdxDBGridColumn; Label71: TLabel; DBEdit23: TDBEdit; Label72: TLabel; DBEdit29: TDBEdit; dxDBGrid1Column78: TdxDBGridColumn; bsSkinButton17: TbsSkinButton; dxDBGrid1Column79: TdxDBGridCheckColumn; dxDBGrid1Column80: TdxDBGridCheckColumn; bsSkinPanel5: TbsSkinPanel; Label79: TLabel; wwDBDateTimePicker11: TwwDBDateTimePicker; Label83: TLabel; wwDBDateTimePicker12: TwwDBDateTimePicker; Label84: TLabel; DBEdit30: TDBEdit; bsSkinButton18: TbsSkinButton; bsSkinButton19: TbsSkinButton; bsSkinDBCheckRadioBox6: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox7: TbsSkinDBCheckRadioBox; Label85: TLabel; DBEdit34: TDBEdit; Label112: TLabel; RxDBLookupCombo43: TRxDBLookupCombo; Label111: TLabel; DBEdit40: TDBEdit; Label86: TLabel; DBEdit35: TDBEdit; t_op_seae_danwei: TADOQuery; t_op_seae_danwei1: TDataSource; Label182: TLabel; RxDBLookupCombo23: TRxDBLookupCombo; N64: TMenuItem; N65: TMenuItem; N66: TMenuItem; N67: TMenuItem; N68: TMenuItem; N69: TMenuItem; N70: TMenuItem; bsSkinButton60: TbsSkinButton; N71: TMenuItem; N72: TMenuItem; N1231: TMenuItem; N4561: TMenuItem; N73: TMenuItem; Label78: TLabel; wwDBLookupCombo10: TwwDBLookupCombo; Label87: TLabel; DBEdit27: TDBEdit; Label88: TLabel; wwDBLookupCombo11: TwwDBLookupCombo; Label89: TLabel; wwDBLookupCombo12: TwwDBLookupCombo; dxDBGrid1Column81: TdxDBGridColumn; dxDBGrid1Column82: TdxDBGridColumn; dxDBGrid1Column83: TdxDBGridColumn; N74: TMenuItem; N75: TMenuItem; t_op_ctn_edi: TADOQuery; strngfld_op_ctnDSDesigner2: TStringField; strngfld_op_ctnDSDesigner6: TStringField; strngfld_op_ctnDSDesigner7: TStringField; strngfld_op_ctnDSDesigner8: TStringField; intgrfld_op_ctnDSDesigner9: TIntegerField; strngfld_op_ctnDSDesigner10: TStringField; bcdfld_op_ctnDSDesigner11: TBCDField; bcdfld_op_ctnDSDesigner12: TBCDField; strngfld_op_ctnDSDesigner14: TStringField; t_op_ctn_ediDSDesigner: TStringField; t_op_ctn_ediPO: TStringField; t_op_ctn_ediSKU: TStringField; t_op_ctn_ediSKU2: TStringField; t_op_ctn_ediUN: TStringField; t_op_ctn_ediHTS: TStringField; t_op_ctn_ediDSDesigner2: TStringField; t_op_ctn_ediDSDesigner3: TBCDField; intgrfld_op_ctnDSDesigner5: TIntegerField; intgrfld_op_ctnTEU: TIntegerField; strngfld_op_ctnDSDesigner4: TStringField; strngfld_op_ctnDSDesigner3: TStringField; atncfld_op_ctnctn_id: TAutoIncField; strngfld_op_ctnDSDesigner: TStringField; t_op_seae_edi: TADOQuery; t_op_ctn_detail_edi: TADOQuery; t_op_ctn_detail_edictn_id: TIntegerField; t_op_ctn_detail_ediDSDesigner: TIntegerField; t_op_ctn_detail_ediDSDesigner2: TStringField; t_op_ctn_detail_ediDSDesigner3: TBCDField; t_op_ctn_detail_ediDSDesigner4: TBCDField; t_op_ctn_detail_ediUN: TStringField; t_op_ctn_detail_ediHTS: TStringField; t_op_ctn_detail_ediDSDesigner5: TBCDField; N79: TMenuItem; N80: TMenuItem; Label90: TLabel; wwDBComboBox4: TwwDBComboBox; dxDBGrid1Column84: TdxDBGridColumn; dxDBGrid1Column85: TdxDBGridColumn; N81: TMenuItem; N82: TMenuItem; N1: TMenuItem; bsSkinDBCheckRadioBox16: TbsSkinDBCheckRadioBox; bsSkinButton35: TbsSkinButton; bsSkinDBCheckRadioBox13: TbsSkinDBCheckRadioBox; Label91: TLabel; wwDBDateTimePicker13: TwwDBDateTimePicker; bsSkinButton43: TbsSkinButton; Label92: TLabel; DBEdit36: TDBEdit; dxDBGrid1Column86: TdxDBGridColumn; wwDBLookupCombo13: TwwDBLookupCombo; Label93: TLabel; Label94: TLabel; RxDBLookupCombo24: TRxDBLookupCombo; Label95: TLabel; wwDBLookupCombo14: TwwDBLookupCombo; Label96: TLabel; RxDBLookupCombo25: TRxDBLookupCombo; 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_seaiBeforeEdit(DataSet: TDataSet); procedure t_op_seaiBeforePost(DataSet: TDataSet); procedure DBEdit13Click(Sender: TObject); 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 RxDBLookupCombo12KeyPress(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 DBEdit5KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo49KeyPress(Sender: TObject; var Key: Char); procedure DBEdit63KeyPress(Sender: TObject; var Key: Char); procedure DBEdit6KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7KeyPress(Sender: TObject; var Key: Char); procedure DBEdit10KeyPress(Sender: TObject; var Key: Char); procedure DBEdit14KeyPress(Sender: TObject; var Key: Char); procedure DBEdit11KeyPress(Sender: TObject; var Key: Char); procedure DBEdit12KeyPress(Sender: TObject; var Key: Char); procedure DBEdit15KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox2KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3Change(Sender: TObject); procedure RxDBLookupCombo4Change(Sender: TObject); procedure RxDBLookupCombo5Change(Sender: TObject); procedure DBEdit18KeyPress(Sender: TObject; var Key: Char); procedure DBEdit16KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo9KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo19KeyPress(Sender: TObject; var Key: Char); procedure DBEdit81KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo61KeyPress(Sender: TObject; var Key: Char); procedure DBEdit82KeyPress(Sender: TObject; var Key: Char); procedure DBEdit83KeyPress(Sender: TObject; var Key: Char); procedure DBEdit81Change(Sender: TObject); procedure DBEdit2Change(Sender: TObject); procedure DBEdit3Change(Sender: TObject); procedure wwDBLookupCombo2Enter(Sender: TObject); procedure wwDBLookupCombo5Enter(Sender: TObject); procedure wwDBLookupCombo6Enter(Sender: TObject); procedure wwDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo2Change(Sender: TObject); procedure wwDBLookupCombo5Change(Sender: TObject); procedure wwDBLookupCombo6Change(Sender: TObject); procedure wwDBLookupCombo2Exit(Sender: TObject); procedure wwDBLookupCombo5Exit(Sender: TObject); procedure wwDBLookupCombo6Exit(Sender: TObject); procedure RxDBLookupCombo29KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo30KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo12Change(Sender: TObject); procedure RxDBLookupCombo2Change(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 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 RxDBLookupCombo1Enter(Sender: TObject); procedure RxDBLookupCombo3Enter(Sender: TObject); procedure RxDBLookupCombo4Enter(Sender: TObject); procedure RxDBLookupCombo5Enter(Sender: TObject); procedure RxDBLookupCombo9Enter(Sender: TObject); procedure RxDBLookupCombo6Enter(Sender: TObject); procedure RxDBLookupCombo19Enter(Sender: TObject); procedure RxDBLookupCombo10Enter(Sender: TObject); procedure RxDBLookupCombo7Enter(Sender: TObject); procedure RxDBLookupCombo8Enter(Sender: TObject); procedure RxDBLookupCombo1Exit(Sender: TObject); procedure RxDBLookupCombo3Exit(Sender: TObject); procedure RxDBLookupCombo4Exit(Sender: TObject); procedure RxDBLookupCombo5Exit(Sender: TObject); procedure RxDBLookupCombo9Exit(Sender: TObject); procedure RxDBLookupCombo8Exit(Sender: TObject); procedure RxDBLookupCombo6Exit(Sender: TObject); procedure RxDBLookupCombo7Exit(Sender: TObject); procedure RxDBLookupCombo19Exit(Sender: TObject); procedure RxDBLookupCombo10Exit(Sender: TObject); procedure RxDBLookupCombo20Enter(Sender: TObject); procedure RxDBLookupCombo20Exit(Sender: TObject); procedure RxDBLookupCombo11Enter(Sender: TObject); procedure RxDBLookupCombo11Exit(Sender: TObject); procedure N2Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure Label4Click(Sender: TObject); procedure Label122Click(Sender: TObject); procedure Label121Click(Sender: TObject); procedure Label123Click(Sender: TObject); procedure Label33Click(Sender: TObject); procedure Label25Click(Sender: TObject); procedure Label24Click(Sender: TObject); procedure Label27Click(Sender: TObject); procedure Label23Click(Sender: TObject); procedure Label21Click(Sender: TObject); procedure wwDBLookupCombo2DblClick(Sender: TObject); procedure Label125Click(Sender: TObject); procedure Label16Click(Sender: TObject); procedure Label10Click(Sender: TObject); procedure Label73Click(Sender: TObject); procedure Label164Click(Sender: TObject); procedure N22Click(Sender: TObject); procedure N9Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure RxDBLookupCombo31KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo31Enter(Sender: TObject); procedure RxDBLookupCombo31Exit(Sender: TObject); procedure wwDBLookupCombo52Change(Sender: TObject); procedure N24Click(Sender: TObject); procedure N26Click(Sender: TObject); procedure N31Click(Sender: TObject); procedure t_op_seaiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_op_seaiBeforeDelete(DataSet: TDataSet); procedure t_op_seaiBeforeCancel(DataSet: TDataSet); procedure N27Click(Sender: TObject); procedure N30Click(Sender: TObject); procedure dxDBGrid1Column67CustomDraw(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 bsSkinPageControl1Change(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure t_op_seai_fenAfterInsert(DataSet: TDataSet); procedure t_op_seai_fenBeforeCancel(DataSet: TDataSet); procedure t_op_seai_fenBeforeDelete(DataSet: TDataSet); procedure t_op_seai_fenBeforeEdit(DataSet: TDataSet); procedure t_op_seai_fenBeforePost(DataSet: TDataSet); procedure bsSkinButton33Click(Sender: TObject); procedure bsSkinButton34Click(Sender: TObject); procedure bsSkinButton36Click(Sender: TObject); procedure MenuItem1Click(Sender: TObject); procedure MenuItem3Click(Sender: TObject); procedure RxDBLookupCombo14KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); procedure N39Click(Sender: TObject); procedure N41Click(Sender: TObject); procedure N43Click(Sender: TObject); procedure N45Click(Sender: TObject); procedure wwDBComboBox2Change(Sender: TObject); procedure bsSkinButton32Click(Sender: TObject); procedure N47Click(Sender: TObject); procedure RxDBLookupCombo17KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo18KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton44Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure N50Click(Sender: TObject); procedure N51Click(Sender: TObject); procedure N53Click(Sender: TObject); procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker3KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo21KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker5KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo21KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo22KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo10KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); procedure DBEdit13KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton21Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton14Click(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); procedure Notebook1PageChanged(Sender: TObject); procedure RxDBLookupCombo16Change(Sender: TObject); procedure RxDBLookupCombo16Enter(Sender: TObject); procedure RxDBLookupCombo16Exit(Sender: TObject); procedure RxDBLookupCombo15Change(Sender: TObject); procedure RxDBLookupCombo15Enter(Sender: TObject); procedure RxDBLookupCombo15Exit(Sender: TObject); procedure RxDBLookupCombo11Change(Sender: TObject); procedure DBEdit16DblClick(Sender: TObject); procedure DBEdit16Exit(Sender: TObject); procedure t_op_seai_fenPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure wwDBDateTimePicker4KeyPress(Sender: TObject; var Key: Char); procedure DBEdit8DblClick(Sender: TObject); procedure DBEdit8Exit(Sender: TObject); procedure DBEdit41KeyPress(Sender: TObject; var Key: Char); procedure DBEdit41Exit(Sender: TObject); procedure DBEdit41DblClick(Sender: TObject); procedure bsSkinSpeedButton1Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); procedure wwDBComboBox9KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox9DropDown(Sender: TObject); procedure RxDBLookupCombo31Change(Sender: TObject); procedure N55Click(Sender: TObject); procedure RxDBLookupCombo28KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker6KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker7KeyPress(Sender: TObject; var Key: Char); procedure EDI2Click(Sender: TObject); procedure N58Click(Sender: TObject); procedure N60Click(Sender: TObject); procedure bsSkinButton45Click(Sender: TObject); procedure N63Click(Sender: TObject); procedure t_op_fileBeforeEdit(DataSet: TDataSet); procedure bsSkinButton48Click(Sender: TObject); procedure bsSkinButton49Click(Sender: TObject); procedure bsSkinButton50Click(Sender: TObject); procedure bsSkinButton51Click(Sender: TObject); procedure fra_op_state1bsSkinButton11Click(Sender: TObject); procedure fra_op_state1bsSkinButton7Click(Sender: TObject); procedure dxDBGrid1Column77CustomDraw(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 bsSkinButton17Click(Sender: TObject); procedure wwDBDateTimePicker4Change(Sender: TObject); procedure bsSkinButton18Click(Sender: TObject); procedure bsSkinButton19Click(Sender: TObject); procedure RxDBLookupCombo23Enter(Sender: TObject); procedure FormCreate(Sender: TObject); procedure N66Click(Sender: TObject); procedure N68Click(Sender: TObject); procedure N70Click(Sender: TObject); procedure bsSkinButton60Click(Sender: TObject); procedure N1231Click(Sender: TObject); procedure N73Click(Sender: TObject); procedure fra_op_letter_free1bsSkinButton1Click(Sender: TObject); procedure N75Click(Sender: TObject); procedure N80Click(Sender: TObject); procedure fra_fee1bsSkinButton1Click(Sender: TObject); procedure fra_fee1bsSkinButton10Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure bsSkinButton35Click(Sender: TObject); procedure bsSkinButton43Click(Sender: TObject); private frm_op_seai_create:Boolean; Letter_flag:Integer; procedure setconcolor; procedure UpLoadPro(fname:string); //fname包含完整路径、文件名 procedure DownLoadPro(fname:string); //从数据库的表中下载 function UpdateopseaeStatus(bsNO,Salas:string):Boolean; { Private declarations } public seaipsqlstr:widestring; procedure CreateCustomLIST(Sender: TObject); procedure CreateCustom(Sender: TObject); { Public declarations } end; var frm_op_seai: Tfrm_op_seai; edi_addseai:boolean; implementation uses u_main,my_sys_function, u_op_seai_add, u_op_ctn, u_data_share, u_sys_progress, u_op_seai_double, u_ch_piliang_seai, u_op_date_change, {$IFDEF DLFENZHANG}u_op_seae_fenzhang,{$ENDIF} u_op_add_seai, u_sys_tab_sort, u_op_seai_assistant, u_ch_fee_zhupiao, u_op_seai_edi_yd, u_op_seae_state_up, u_op_letter, u_crm_query, u_sys_dep_emp_module; {$R *.dfm} procedure Tfrm_op_seai.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_op_seai); end; procedure Tfrm_op_seai.bsSkinButton6Click(Sender: TObject); begin table_next(t_op_seai); end; procedure Tfrm_op_seai.bsSkinButton2Click(Sender: TObject); begin if t_op_seai1.DataSet=nil then Exit; if t_op_seai1.DataSet.State in [dsedit,dsinsert] then t_op_seai1.DataSet.Post; end; procedure Tfrm_op_seai.bsSkinButton4Click(Sender: TObject); begin if t_op_seai1.DataSet=nil then exit; if t_op_seai1.DataSet.IsEmpty then exit; t_ch_fee.close; t_ch_fee.Parameters[0].value:=t_op_seai1.DataSet.fieldbyname('编号').asstring; t_ch_fee.open; if not t_ch_fee.IsEmpty then begin showmessage('对不起业务存在费用信息,不能删除!!'); exit; end; if t_op_seai1.DataSet.FieldByName('装运方式').asstring='拼箱主票'then begin if not t_op_seai_fen.IsEmpty then begin showmessage('对不起主票存在分票信息,不能删除!!'); exit; end; end; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)=IDOK then t_op_seai1.DataSet.delete; end; procedure Tfrm_op_seai.bsSkinButton3Click(Sender: TObject); begin if t_op_seai1.DataSet=nil then exit; if (t_op_seai1.DataSet.State=dsinsert)or(t_op_seai1.DataSet.State=dsedit) then t_op_seai1.DataSet.cancel; end; procedure Tfrm_op_seai.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seai.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); savereggrid(dxdbgrid2,caption+'2'); savewwgrid(fra_fee1.wwDBGrid1,'海运进口应收'); savewwgrid(fra_fee1.wwDBGrid2,'海运进口应付'); {$IFDEF DLFENZHANG} if assigned(frm_op_seae_fenzhang) then begin FreeAndNil(frm_op_seae_fenzhang); end; {$ENDIF} if assigned(frm_op_seai_assistant) then frm_op_seai_assistant.close; if assigned(frm_op_seae_state_up) then begin frm_op_seae_state_up.close; frm_op_seae_state_up.free; frm_op_seae_state_up:=nil; end; frm_op_seai.Hide; frm_op_seai.ManualFloat(frm_op_seai.BoundsRect ); frm_main.freeTabs('frm_op_seai'); frm_op_seai_create:=false; action:=cafree; frm_op_seai:=nil; end; procedure Tfrm_op_seai.bsSkinButton9Click(Sender: TObject); begin sys_print('海运进口单证',2,t_op_seai1,nil,nil,nil,t_op_seai_fen1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seai.FormShow(Sender: TObject); var inifile1,seabandini:Tinifile; i,j,n:integer; sl:TStrings; begin frm_op_seai_create:=false; Notebook1.PageIndex:=0; 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:=28; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; Label130.Caption:=Logininfo.seaiwtno; Label37.Caption:=Logininfo.seaiwtno; Label133.Caption:=Logininfo.seaedcno; dxDBGrid1Column4.Caption:=Logininfo.seaiwtno; edi_addseai:=false; bsSkinDBCheckRadioBox6.visible:=strtobool(get_parameters_value(160,'false')); bsSkinDBCheckRadioBox7.Visible:=strtobool(get_parameters_value(160,'false')); bsSkinButton18.visible:=strtobool(get_parameters_value(160,'false')); bsSkinButton19.visible:=strtobool(get_parameters_value(160,'false')); // DBEdit9.EditMask:=get_parameters_value(189,''); //根据委托编号规则 if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then begin DBEdit8.Width:=110; 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:=90; 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:=110; bsSkinSpeedButton1.Visible:=false; end; t_op_seai_fen.Close; t_op_seai.Close; t_op_seai.SQL.clear; if strtobool(get_parameters_value(132,'true')) then begin //最近100票自己的业务 t_op_seai.SQL.Add('select top 100 * from t_op_seai where 主编号=编号 and 装运方式<>''三废'' and ' +'(录入人='+''''+employee+''''+' or 操作员='+''''+employee+'''' +' or 客服员='+''''+employee+''''+' or 报关操作='+''''+employee+'''' +' or 报检操作='+''''+employee+''''+')' +default_sort(54,'t_op_seai','','desc')); end else begin //本月权限范围内的业务 t_op_seai.SQL.Add('select * from t_op_seai where 主编号=编号 and 装运方式<>''三废'' and ' +' SUBSTRING(CONVERT(char(15),进口日期,111),1,7)='''+FormatDateTime('YYYY',Date)+'/'+FormatDateTime('MM',Date)+''' and ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +default_sort(54,'t_op_seai','','desc')); end; t_op_seai.open; t_op_seai_fen.open; seaipsqlstr:=''; 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_seai1; 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; fra_op_card1.t_op_card.DataSource:=t_op_seai1; fra_op_card1.t_op_card.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; loadreggrid(dxdbgrid1,true,caption); loadreggrid(dxdbgrid2,true,caption+'2'); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //费用信息 if if_open('295') or if_open('296') then begin fra_fee1.edit_type.text:='2'; fra_fee1.edit_data.text:='0002'; fra_fee1.edit_report.text:='海运进口'; fra_fee1.t_ch_accept.DataSource:=t_op_seai1; if strtobool(get_parameters_value(150,'false')) then fra_fee1.bsSkinPanel3.Visible:=true; fra_fee1.DBEdit48.DataSource:=t_op_seai1; if if_open('295') then begin fra_fee1.t_ch_accept.DataSource:=t_op_seai1; if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('207')=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('207')=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('296') then begin fra_fee1.t_ch_pay.DataSource:=t_op_seai1; if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('207')=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('207')=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('227') 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_seai1; 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; if if_reg(195) then begin fra_op_state1.edit_state.text:='2'; fra_op_state1.t_op_state.DataSource:=t_op_seai1; fra_op_state1.t_op_state.open; end; 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_ship.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_changzhan.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_truck.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_huodai.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_crm_client_other.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_vessel.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_disport.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_loaport.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_goods.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_trade.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_source.requery; bsSkinTabSheet2.TabVisible:=if_open('295') or if_open('296'); inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); bsSkinPanel9.Visible:=inifile1.Readbool('other','sidisp',false); if bsSkinPanel9.Visible then begin bsSkinPanel9.Visible:=true; bsSkinButton13.Top:=3+bsSkinPanel9.Height; end else begin bsSkinButton13.Top:=3; end; inifile1.free; //页面顺序保存 seabandini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'bandno.ini'); sl:=TStringList.Create; try seabandini.ReadSection('seaimp',sl); for j:=0 to sl.Count-1 do begin n:=seabandini.Readinteger('seaimp',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 bsSkinTabSheet6.TabVisible:=false; end; {$ELSE} bsSkinTabSheet6.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 bsSkinTabSheet6.TabVisible:=true; end else begin bsSkinTabSheet6.TabVisible:=false; end; //是否启用费用封帐 if strtobool(get_parameters_value(143,'false')) then begin N54.Visible:=true; N55.Visible:=true; end else begin N54.Visible:=FALSE; N55.Visible:=FALSE; end; if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('出号规则').Asstring)='自动取号' then begin if frm_data_share.t_sys_noset_hblno.fieldbyname('是否允许手动编辑').AsBoolean then begin DBEdit16.ReadOnly:=false; end else begin DBEdit16.ReadOnly:=true; end; end else if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('出号规则').Asstring)='手动取号' then begin if frm_data_share.t_sys_noset_hblno.fieldbyname('是否允许手动编辑').AsBoolean then begin DBEdit16.ReadOnly:=false; end else begin DBEdit16.ReadOnly:=true; end; end else if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('出号规则').Asstring)='手动编辑' then begin DBEdit16.ReadOnly:=false; end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; frm_op_seai_create:=true; end; procedure Tfrm_op_seai.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_seai.State=dsinsert)or(t_op_seai.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_seai.post; end; if answer=mrNo then begin t_op_seai.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; if bsSkinButton11.Caption='返回主票' then begin if (t_op_seai_fen.State=dsinsert)or(t_op_seai_fen.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_seai_fen.post; end; if answer=mrNo then begin t_op_seai_fen.cancel; end; if answer=mrCancel then begin exit; end; END; bsSkinButton11.Caption:='返回列表'; try t_op_seai1.Enabled:=false; t_op_seai1.DataSet:=t_op_seai; finally t_op_seai1.Enabled:=true; end; Notebook1.PageIndex:=1; exit; end; end; procedure Tfrm_op_seai.bsSkinButton8Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton8.ClientToScreen(Point(0,bsSkinButton8.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seai.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; bsSkinButton17.Left:=Panel2.Width-bsSkinButton13.Width-bsSkinButton17.Width-20; end; procedure Tfrm_op_seai.bsSkinButton1Click(Sender: TObject); begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; if (t_op_seai_fen.State=dsinsert)or(t_op_seai_fen.State=dsedit) then t_op_seai_fen.post; try frm_op_seai_add:=tfrm_op_seai_add.Create (self); if t_op_seai1.DataSet=t_op_seai then begin frm_op_seai_add.data1.Enabled:=false; frm_op_seai_add.data1.DataSet:=t_op_seai; frm_op_seai_add.data1.Enabled:=true; // frm_op_seai_add.bsSkinCheckRadioBox3.Checked:=true; // frm_op_seai_add.bsSkinCheckRadioBox2.Enabled:=false; // frm_op_seai_add.bsSkinCheckRadioBox4.Enabled:=false; frm_op_seai_add_num:=1; end else begin frm_op_seai_add.data1.Enabled:=false; frm_op_seai_add.data1.DataSet:=t_op_seai_fen; frm_op_seai_add.data1.Enabled:=true; frm_op_seai_add.bsSkinCheckRadioBox3.Checked:=true; frm_op_seai_add.bsSkinCheckRadioBox2.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox4.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox1.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox5.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox6.Enabled:=false; frm_op_seai_add_num:=2; end; frm_op_seai_add.ShowModal; finally frm_op_seai_add.Free end; end; procedure Tfrm_op_seai.t_op_seaiBeforeEdit(DataSet: TDataSet); begin op_befor_post(t_op_seai,'0002'); end; procedure Tfrm_op_seai.t_op_seaiBeforePost(DataSet: TDataSet); var code_trade,code_source,bstype:string; stl,s_shipper,s_cons,s_notify,s_marks,s_descrip:string; begin //必填项EDI导入不检查 if not edi_addseai then begin table_before_post(t_op_seai,'委托单位'); table_before_post(t_op_seai,'操作员'); table_before_post(t_op_seai,'客服员'); table_before_post(t_op_seai,'主提单号'); table_before_post(t_op_seai,'进口日期'); table_before_post(t_op_seai,'装运方式'); { table_before_post(t_op_seai,'船名'); table_before_post(t_op_seai,'航次'); } table_before_post(t_op_seai,'装货港'); table_before_post(t_op_seai,'卸货港'); table_before_post(t_op_seai,'业务来源'); if pos('指定',t_op_seai.FieldByName('业务来源').AsString)>0 then begin end else begin table_before_post(t_op_seai,'揽货人'); table_before_post(t_op_seai,'销售部门'); end; table_before_post(t_op_seai,'操作部门'); //委托编号生成 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_seai.FieldByName('委托编号').IsNull or (trim(t_op_seai.fieldByName('委托编号').AsString)='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai['会计期间']) else t_op_seai['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai['进口日期']); end; end else begin if (trim(t_op_seai.fieldbyname('装运方式').asstring)='其他') then begin end else begin if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_seai.FieldByName('委托编号').IsNull or (trim(t_op_seai.fieldByName('委托编号').AsString)='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai['会计期间']) else t_op_seai['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai['进口日期']); end; end; { if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_seai.FieldByName('委托编号').IsNull or (trim(t_op_seai['委托编号'])='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai['会计期间']) else t_op_seai['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai['进口日期']); } if op_empty('t_op_seai',t_op_seai) then abort; //月末结账 if t_op_seai.fieldbyname('进口日期').oldvalue<>t_op_seai.fieldbyname('进口日期').asdatetime then if (t_op_seai.fieldbyname('业务类型').asstring<>'更改单') and (Logininfo.endday>=t_op_seai.fieldbyname('进口日期').asdatetime) then begin showmessage('此进口日期所在期间已月末结账,不能添加修改业务!!'); abort; end; if t_op_seai.FieldByName('委托单位').OldValue<>t_op_seai.FieldByName('委托单位').asstring then begin if frm_data_share.t_crm_client_all.Locate('客户简称',t_op_seai.FieldByName('委托单位').asstring,[])then begin if frm_data_share.t_crm_client_all.fieldbyname('客户状态').asstring='封存客户'then begin showmessage('当前业务委托单位已经封存,不能再进行业务合作,如需合作请进行恢复客户操作!'); abort; end; end; end; end; if t_op_seai.State=dsinsert then begin if t_op_seai.fieldbyname('业务编号').asstring=''then begin t_op_seai['业务编号']:=get_no(t_op_seai.fieldbyname('会计期间').AsDateTime,getbsno(Logininfo.SeaImpBsNo,'SI')); t_op_seai['编号']:=get_id; end; t_op_seai['业务状态']:='接受委托'; t_op_seai['封帐前状态']:='接受委托'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai['费用状态']:='录入状态'; end else begin if t_op_seai.FieldByName('装运方式').asstring='整箱' then begin if (Trim(t_op_seai.fieldbyname('业务类型').asstring)<>'更改单') then table_before_post(t_op_seai,'集装箱'); end; end; if frm_data_share.t_code_free.Locate('付费方式',trim(t_op_seai.fieldbyname('付费方式').asstring),[]) then begin stl:=frm_data_share.t_code_free.fieldbyname('中文名称').Asstring; end; if frm_data_share.t_sys_noset_hblno.Locate('编号类型','分提单号',[]) and (frm_data_share.t_sys_noset_hblno.fieldbyname('海运进口').AsString<>'') then begin if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('出号规则').Asstring)='自动取号' then begin if strtobool(get_parameters_value(311,'false')) then begin code_trade:=t_op_seai.fieldByName('航线').AsString; code_source:=t_op_seai.fieldByName('业务来源').AsString; bstype:=t_op_seai.fieldByName('装运方式').AsString; if t_op_seai.FieldByName('分提单号').IsNull or (trim(t_op_seai.fieldByName('分提单号').AsString)='') then if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai['分提单号']:=gethblno_custom(2,subComp,department,employee,code_trade,code_source,bstype,t_op_seai['会计期间']) else t_op_seai['分提单号']:=gethblno_custom(2,subComp,department,employee,code_trade,code_source,bstype,t_op_seai['进口日期']); end else begin if t_op_seai.FieldByName('分提单号').IsNull or (trim(t_op_seai.fieldByName('分提单号').AsString)='') then if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai['分提单号']:=gethblno(2,subComp,department,employee,stl,t_op_seai['会计期间']) else t_op_seai['分提单号']:=gethblno(2,subComp,department,employee,stl,t_op_seai['进口日期']); end; end; end; if strtobool(get_parameters_value(34,'false')) then begin if (t_op_seai.fieldbyname('主提单号').asstring='') or (Trim(t_op_seai.fieldbyname('业务类型').asstring)='更改单') or (t_op_seai.fieldbyname('装运方式').asstring='拼箱主票') or (t_op_seai.fieldbyname('装运方式').asstring='拼箱分票') then begin t_op_seai['主提单标准']:=t_op_seai['编号']; end else begin t_op_seai['主提单标准']:=Logininfo.subcompcode+t_op_seai['主提单号']; end; end else begin t_op_seai['主提单标准']:=t_op_seai['编号']; end; if strtobool(get_parameters_value(35,'false')) then begin if (t_op_seai.fieldbyname('分提单号').asstring='') or (Trim(t_op_seai.fieldbyname('业务类型').asstring)='更改单') then begin t_op_seai['分提单标准']:=t_op_seai['编号']; end else begin t_op_seai['分提单标准']:=Logininfo.subcompcode+t_op_seai['分提单号']; end; end else begin t_op_seai['分提单标准']:=t_op_seai['编号']; end; if strtobool(get_parameters_value(36,'false')) then begin if (t_op_seai.fieldbyname('委托编号').asstring='')) then begin t_op_seai['委托标准']:=t_op_seai['编号']; end else begin t_op_seai['委托标准']:=t_op_seai['委托编号']; end; end else begin t_op_seai['委托标准']:=t_op_seai['编号']; end; if strtobool(get_parameters_value(60,'false')) then begin if (trim(t_op_seai.fieldbyname('报关单号').asstring)='') or (Trim(t_op_seai.fieldbyname('业务类型').asstring)='更改单') then begin t_op_seai['报关标准']:=t_op_seai['编号']; end else begin t_op_seai['报关标准']:=t_op_seai['报关单号']; end; end else begin t_op_seai['报关标准']:=t_op_seai['编号']; end; if strtobool(get_parameters_value(61,'false')) then begin if (trim(t_op_seai.fieldbyname('报检单号').asstring)='') or (Trim(t_op_seai.fieldbyname('业务类型').asstring)='更改单') then begin t_op_seai['报检标准']:=t_op_seai['编号']; end else begin t_op_seai['报检标准']:=t_op_seai['报检单号']; end; end else begin t_op_seai['报检标准']:=t_op_seai['编号']; end; // t_op_seai['Upload']:=1; end; procedure Tfrm_op_seai.DBEdit13Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if (t_op_seai.State=dsinsert)then t_op_seai.post; try frm_op_ctn:=tfrm_op_ctn.Create (self); frm_op_ctn.t_op_ctn.DataSource:=t_op_seai1; frm_op_ctn_type:=true; op_ctn_limited:='0002'; frm_op_ctn.ShowModal; finally frm_op_ctn.Free; end; end; procedure Tfrm_op_seai.bsSkinButton10Click(Sender: TObject); begin query_seai(1,'0002'); end; procedure Tfrm_op_seai.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_seai.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_seai.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit2); end; procedure Tfrm_op_seai.DBEdit2KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit3); end; procedure Tfrm_op_seai.DBEdit3KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_op_seai.DBEdit4KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit18); end; procedure Tfrm_op_seai.RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo12); end; procedure Tfrm_op_seai.RxDBLookupCombo12KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit8); end; procedure Tfrm_op_seai.RxDBLookupCombo13KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo2); end; procedure Tfrm_op_seai.DBEdit8KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit9); end; procedure Tfrm_op_seai.DBEdit9KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit16); end; procedure Tfrm_op_seai.DBEdit5KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit82); end; procedure Tfrm_op_seai.wwDBLookupCombo49KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit63); end; procedure Tfrm_op_seai.DBEdit63KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo52); end; procedure Tfrm_op_seai.DBEdit6KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo52); end; procedure Tfrm_op_seai.wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo3); end; procedure Tfrm_op_seai.wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo20); end; procedure Tfrm_op_seai.DBEdit7KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit11); end; procedure Tfrm_op_seai.DBEdit10KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit14); end; procedure Tfrm_op_seai.DBEdit14KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit12); end; procedure Tfrm_op_seai.DBEdit11KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit15); end; procedure Tfrm_op_seai.DBEdit12KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo3); end; procedure Tfrm_op_seai.DBEdit15KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo8); end; procedure Tfrm_op_seai.wwDBComboBox2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker6); end; procedure Tfrm_op_seai.RxDBLookupCombo3Change(Sender: TObject); begin if (t_op_seai1.DataSet.State=dsinsert)or(t_op_seai1.DataSet.State=dsedit)then begin if TRxDBLookupCombo(Sender).DisplayValue<>'' then t_op_seai1.DataSet['发货人代码']:=frm_data_share.t_crm_client_shiper.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seai.RxDBLookupCombo4Change(Sender: TObject); begin if (t_op_seai1.DataSet.State=dsinsert)or(t_op_seai1.DataSet.State=dsedit)then begin if RxDBLookupCombo4.DisplayValue<>'' then t_op_seai1.DataSet['收货人代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seai.RxDBLookupCombo5Change(Sender: TObject); begin if (t_op_seai1.DataSet.State=dsinsert)or(t_op_seai1.DataSet.State=dsedit)then begin if RxDBLookupCombo5.DisplayValue<>'' then t_op_seai1.DataSet['通知人代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seai.DBEdit18KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo1); end; procedure Tfrm_op_seai.DBEdit16KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit41); end; procedure Tfrm_op_seai.wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo29); end; procedure Tfrm_op_seai.wwDBComboBox3KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox1); end; procedure Tfrm_op_seai.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit13); end; procedure Tfrm_op_seai.RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker2); end; procedure Tfrm_op_seai.RxDBLookupCombo9KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo8); end; procedure Tfrm_op_seai.RxDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo6); end; procedure Tfrm_op_seai.RxDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo9); end; procedure Tfrm_op_seai.RxDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo22); end; procedure Tfrm_op_seai.RxDBLookupCombo19KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo10); end; procedure Tfrm_op_seai.DBEdit81KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo61); end; procedure Tfrm_op_seai.wwDBLookupCombo61KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit5); end; procedure Tfrm_op_seai.DBEdit82KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit83); end; procedure Tfrm_op_seai.DBEdit83KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo4); end; procedure Tfrm_op_seai.DBEdit81Change(Sender: TObject); begin if (t_op_seai.state=dsedit)or(t_op_seai.state=dsinsert)then begin try t_op_seai['件数大写'] :='SAY:'+ntoc(strtoint(DBEdit81.text),true) +wwDBLookupCombo61.text+' ONLY.'; except ; end; end; end; procedure Tfrm_op_seai.DBEdit2Change(Sender: TObject); begin DBEdit2.Color:=dxgrid_color('海运进口',DBEdit2.text); end; procedure Tfrm_op_seai.DBEdit3Change(Sender: TObject); begin DBEdit3.Color:=dxgrid_color_fee(DBEdit3.text); end; procedure Tfrm_op_seai.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_seai.wwDBLookupCombo5Enter(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_seai.wwDBLookupCombo6Enter(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_seai.wwDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo33); end; procedure Tfrm_op_seai.wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo34); end; procedure Tfrm_op_seai.wwDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo35); end; procedure Tfrm_op_seai.RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo2); end; procedure Tfrm_op_seai.RxDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo5); end; procedure Tfrm_op_seai.RxDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo6); end; procedure Tfrm_op_seai.wwDBLookupCombo2Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',TwwDBLookupCombo(Sender).text,[]) then begin t_op_seai.edit; t_op_seai['发货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seai.wwDBLookupCombo5Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',TwwDBLookupCombo(Sender).text,[]) then begin t_op_seai.edit; t_op_seai['收货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seai.wwDBLookupCombo6Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',TwwDBLookupCombo(Sender).text,[]) then begin t_op_seai.edit; t_op_seai['通知人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seai.wwDBLookupCombo2Exit(Sender: TObject); begin TwwDBLookupCombo(Sender).Clear; end; procedure Tfrm_op_seai.wwDBLookupCombo5Exit(Sender: TObject); begin TwwDBLookupCombo(Sender).Clear; end; procedure Tfrm_op_seai.wwDBLookupCombo6Exit(Sender: TObject); begin TwwDBLookupCombo(Sender).Clear; end; procedure Tfrm_op_seai.RxDBLookupCombo29KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo11); end; procedure Tfrm_op_seai.RxDBLookupCombo30KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit81); end; procedure Tfrm_op_seai.RxDBLookupCombo12Change(Sender: TObject); begin if (t_op_seai.state=dsinsert)or(t_op_seai.state=dsedit)then begin if RxDBLookupCombo12.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo12.DisplayValue,[]) then t_op_seai['销售部门']:=frm_data_share.t_sys_employee['部门名称']; end; end; procedure Tfrm_op_seai.RxDBLookupCombo2Change(Sender: TObject); begin if (t_op_seai.state=dsinsert)or(t_op_seai.state=dsedit)then begin if RxDBLookupCombo2.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo2.DisplayValue,[]) then t_op_seai['操作部门']:=frm_data_share.t_sys_employee['部门名称']; end; end; procedure Tfrm_op_seai.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_op_seai); CanClose:=frm_close_query(fra_op_card1.t_op_card); end; procedure Tfrm_op_seai.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_seai.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_seai.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,35); end; procedure Tfrm_op_seai.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seai.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_seai,'业务编号'); end; procedure Tfrm_op_seai.bsSkinButton13Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton13.ClientToScreen(Point(0,bsSkinButton13.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seai.N17Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态=' +''''+'录入状态'+''''+') ' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.N34Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+')) ' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.N36Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) ' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.N37Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 编号 in (select distinct 编号 from t_op_state where 是否完成<>1) ' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.RxDBLookupCombo1Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo1); end; procedure Tfrm_op_seai.RxDBLookupCombo3Enter(Sender: TObject); begin RxLookupComboEnter(TRxDBLookupCombo(Sender)); end; procedure Tfrm_op_seai.RxDBLookupCombo4Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo4); end; procedure Tfrm_op_seai.RxDBLookupCombo5Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo5); end; procedure Tfrm_op_seai.RxDBLookupCombo9Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo9); end; procedure Tfrm_op_seai.RxDBLookupCombo6Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo6); end; procedure Tfrm_op_seai.RxDBLookupCombo19Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo19); end; procedure Tfrm_op_seai.RxDBLookupCombo10Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo10); end; procedure Tfrm_op_seai.RxDBLookupCombo7Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo7); end; procedure Tfrm_op_seai.RxDBLookupCombo8Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo8); end; procedure Tfrm_op_seai.RxDBLookupCombo1Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo1); end; procedure Tfrm_op_seai.RxDBLookupCombo3Exit(Sender: TObject); begin RxLookupComboExit(TRxDBLookupCombo(Sender)); end; procedure Tfrm_op_seai.RxDBLookupCombo4Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo4); end; procedure Tfrm_op_seai.RxDBLookupCombo5Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo5); end; procedure Tfrm_op_seai.RxDBLookupCombo9Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo9); end; procedure Tfrm_op_seai.RxDBLookupCombo8Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo8); end; procedure Tfrm_op_seai.RxDBLookupCombo6Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo6); end; procedure Tfrm_op_seai.RxDBLookupCombo7Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo7); end; procedure Tfrm_op_seai.RxDBLookupCombo19Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo19); end; procedure Tfrm_op_seai.RxDBLookupCombo10Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo10); end; procedure Tfrm_op_seai.RxDBLookupCombo20Enter(Sender: TObject); begin RxDBLookupCombo20.LookupDisplay:='航线代码;航线'; end; procedure Tfrm_op_seai.RxDBLookupCombo20Exit(Sender: TObject); begin RxDBLookupCombo20.LookupDisplay:='航线'; end; procedure Tfrm_op_seai.RxDBLookupCombo11Enter(Sender: TObject); begin RxDBLookupCombo11.LookupDisplay:='代码;货物名称'; end; procedure Tfrm_op_seai.RxDBLookupCombo11Exit(Sender: TObject); begin RxDBLookupCombo11.LookupDisplay:='货物名称'; end; procedure Tfrm_op_seai.N2Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; bsSkinTabSheet2.show; end; procedure Tfrm_op_seai.N4Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; bsSkinTabSheet3.show; end; procedure Tfrm_op_seai.Label4Click(Sender: TObject); begin try frm_crm_query:=Tfrm_crm_query.Create(application); frm_crm_query.DataSource1:=t_op_seai1; frm_crm_query.Top:= Screen.height-750; frm_crm_query.ShowModal; finally frm_crm_query.Free; frm_crm_query:=nil; end; //client_view(t_op_seai.fieldbyname('委托单位').asstring,frm_data_share.t_crm_client_weituo); end; procedure Tfrm_op_seai.Label122Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('发货人').asstring,frm_data_share.t_crm_client_shiper); end; procedure Tfrm_op_seai.Label121Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('收货人').asstring,frm_data_share.t_crm_client_shouhuo); end; procedure Tfrm_op_seai.Label123Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('通知人').asstring,frm_data_share.t_crm_client_tongzhi); end; procedure Tfrm_op_seai.Label33Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('代理').asstring,frm_data_share.t_crm_client_daili); end; procedure Tfrm_op_seai.Label25Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('场站').asstring,frm_data_share.t_crm_client_changzhan); end; procedure Tfrm_op_seai.Label24Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('船公司').asstring,frm_data_share.t_crm_client_ship); end; procedure Tfrm_op_seai.Label27Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('货代公司').asstring,frm_data_share.t_crm_client_daili); end; procedure Tfrm_op_seai.Label23Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('报关行').asstring,frm_data_share.t_crm_client_baoguan); end; procedure Tfrm_op_seai.Label21Click(Sender: TObject); begin client_view(t_op_seai.fieldbyname('承运车队').asstring,frm_data_share.t_crm_client_truck); end; procedure Tfrm_op_seai.wwDBLookupCombo2DblClick(Sender: TObject); begin open_code_edit('016'); end; procedure Tfrm_op_seai.Label125Click(Sender: TObject); begin open_code_edit('097'); end; procedure Tfrm_op_seai.Label16Click(Sender: TObject); begin open_code_edit('013'); end; procedure Tfrm_op_seai.Label10Click(Sender: TObject); begin open_code_edit('011'); end; procedure Tfrm_op_seai.Label73Click(Sender: TObject); begin open_code_edit('012'); end; procedure Tfrm_op_seai.Label164Click(Sender: TObject); begin open_code_edit('007'); end; procedure Tfrm_op_seai.N22Click(Sender: TObject); var str:widestring; begin if t_op_seai.IsEmpty then exit; if if_open('295') and if_open('296') then begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try frm_ch_piliang_seai:=tfrm_ch_piliang_seai.Create (self); t_op_seai.DisableControls; t_op_seai.first; while not t_op_seai.eof do begin if str='' then str:=''''+t_op_seai.fieldbyname('编号').AsString+'''' else str:=str+','+''''+t_op_seai.fieldbyname('编号').AsString+''''; t_op_seai.next; end; str:='('+str+')'; str:='select * from t_op_seai where 编号 in '+str+default_sort(54,'t_op_seai','','desc'); frm_ch_piliang_seai.t_op_seai.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_seai.t_op_seai.open; frm_ch_piliang_seai.ShowModal; finally t_op_seai.EnableControls; frm_ch_piliang_seai.Free; frm_ch_piliang_seai:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_seai.N9Click(Sender: TObject); var str:widestring; begin if t_op_seai.IsEmpty then exit; if if_open('295') and if_open('296') then begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try frm_ch_piliang_seai:=tfrm_ch_piliang_seai.Create (self); str:='select * from t_op_seai where 编号=' +''''+t_op_seai.fieldbyname('编号').AsString+''''; frm_ch_piliang_seai.t_op_seai.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_seai.t_op_seai.open; frm_ch_piliang_seai.ShowModal; finally frm_ch_piliang_seai.Free; frm_ch_piliang_seai:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_seai.N20Click(Sender: TObject); var str:widestring; i:integer; begin if t_op_seai.IsEmpty then exit; if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要打印的业务帐单!!'); exit; end; if if_open('295') and if_open('296') then begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try frm_ch_piliang_seai:=tfrm_ch_piliang_seai.Create (self); t_op_seai.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if str='' then str:=''''+t_op_seai.fieldbyname('编号').AsString+'''' else str:=str+','+''''+t_op_seai.fieldbyname('编号').AsString+''''; end; str:='('+str+')'; str:='select * from t_op_seai where 编号 in '+str+default_sort(54,'t_op_seai','','desc'); frm_ch_piliang_seai.t_op_seai.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_seai.t_op_seai.open; frm_ch_piliang_seai.ShowModal; finally t_op_seai.EnableControls; frm_ch_piliang_seai.Free; frm_ch_piliang_seai:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_seai.RxDBLookupCombo31KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox9); end; procedure Tfrm_op_seai.RxDBLookupCombo31Enter(Sender: TObject); begin RxDBLookupCombo31.LookupDisplay:='代码;业务来源'; end; procedure Tfrm_op_seai.RxDBLookupCombo31Exit(Sender: TObject); begin RxDBLookupCombo31.LookupDisplay:='业务来源'; end; procedure Tfrm_op_seai.wwDBLookupCombo52Change(Sender: TObject); begin if (t_op_seai.state=dsedit)or(t_op_seai.state=dsinsert)then begin if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then begin t_op_seai['航线']:=frm_data_share.t_code_disport['航线']; end; end; end; procedure Tfrm_op_seai.N24Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and not exists (select distinct 编号 from t_ch_fee where t_ch_fee.编号=t_op_seai.编号 and 类型='+''''+'收'+''''+')' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.N26Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and not exists (select distinct 编号 from t_ch_fee where t_ch_fee.编号=t_op_seai.编号 and 类型='+''''+'付'+''''+')' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.N31Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if not do_data('0002',t_op_seai.FieldByName('录入人').asstring ,t_op_seai.FieldByName('操作员').asstring ,t_op_seai.FieldByName('揽货人').asstring ,t_op_seai.FieldByName('客服员').asstring ,t_op_seai.FieldByName('报关操作').asstring ,t_op_seai.FieldByName('报检操作').asstring) then begin showmessage('对不起你无权修改此数据!'); abort; end; if t_op_seai.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('此票业务状态已经为业务封帐状态,不能修改!'); abort; end; if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try frm_op_date_change:=tfrm_op_date_change.Create (self); frm_op_date_change.DataSource1.DataSet:=t_op_seai; frm_op_date_change.BSTYPE:='T_OP_SEAI'; frm_op_date_change.ShowModal; finally frm_op_date_change.Free; frm_op_date_change:=nil; end; end; procedure Tfrm_op_seai.t_op_seaiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); var str:widestring; begin update_wenti(E); 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_seai where 主提单标准='+''''+t_op_seai['主提单标准']+''''; double_seai(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 分提单标准='+''''+t_op_seai['分提单标准']+''''; double_seai(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 委托标准='+''''+t_op_seai['委托标准']+''''; double_seai(str,3); abort; end; if pos('报关标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 报关标准='+''''+t_op_seai['报关标准']+''''; double_seai(str,4); abort; end; if pos('报检标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 报检标准='+''''+t_op_seai['报检标准']+''''; double_seai(str,5); abort; end; end; procedure Tfrm_op_seai.t_op_seaiBeforeDelete(DataSet: TDataSet); begin op_befor_post(t_op_seai,'0002'); delete_add(2,t_op_seai); if not t_op_seai.FieldByName('委托编号').IsNull then delwtno(t_op_seai['委托编号']); if not t_op_seai.FieldByName('分提单号').IsNull then delhblno(t_op_seai['分提单号']); end; procedure Tfrm_op_seai.t_op_seaiBeforeCancel(DataSet: TDataSet); begin delete_no(t_op_seai); if t_op_seai.State=dsinsert then if not t_op_seai.FieldByName('委托编号').IsNull then delwtno(t_op_seai['委托编号']); end; procedure Tfrm_op_seai.N27Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and not exists (select distinct 编号 from t_ch_fee where t_ch_fee.编号=t_op_seai.编号)' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.N30Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.dxDBGrid1Column67CustomDraw(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[dxDBGrid1Column67.Index])='更改单' then AColor:=clred; AFont.Color:=clblack; end; procedure Tfrm_op_seai.bsSkinPageControl1Change(Sender: TObject); var inifile1:Tinifile; begin if frm_op_seai_create=false then exit; if bsSkinPageControl1.ActivePage=bsSkinTabSheet7 then begin if not assigned(frm_op_seai_assistant) then begin frm_op_seai_assistant:=tfrm_op_seai_assistant.Create (self); frm_op_seai_assistant.t_op_seae_assistant.DataSource:=t_op_seai1; frm_op_seai_assistant.ManualDock(bsSkinTabSheet7,nil,alClient); frm_op_seai_assistant.show; end; exit; end; {$IFDEF DLFENZHANG} if bsSkinPageControl1.ActivePage=bsSkinTabSheet6 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_seai1; 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_seai1; 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_seai1; 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_seae_assistant where 编号=:编号 order by 主提单号 '; frm_op_seae_fenzhang.t_op_seae_assistant.DataSource:=t_op_seai1; 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_seai1; 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.t_ch_fee_cm.Close; frm_op_seae_fenzhang.t_ch_fee_cm.DataSource:=t_op_seai1; frm_op_seae_fenzhang.t_ch_fee_cm.open; frm_op_seae_fenzhang.t_ch_fee_agentdc.Close; frm_op_seae_fenzhang.t_ch_fee_agentdc.DataSource:=t_op_seai1; frm_op_seae_fenzhang.t_ch_fee_agentdc.open; frm_op_seae_fenzhang.t_ch_fee_agentdc_detail.Close; frm_op_seae_fenzhang.t_ch_fee_agentdc_detail.DataSource:=frm_op_seae_fenzhang.t_ch_fee_agentdc1; frm_op_seae_fenzhang.t_ch_fee_agentdc_detail.open; frm_op_seae_fenzhang.ManualDock(bsSkinTabSheet6,nil,alClient); frm_op_seae_fenzhang.show; exit; end; if bsSkinPageControl1.ActivePage<>bsSkinTabSheet6 then begin if assigned(frm_op_seae_fenzhang) then begin FreeAndNil(frm_op_seae_fenzhang); end; end; {$ENDIF} if bsSkinPageControl1.ActivePage=bsSkinTabSheet2 then begin 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; 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; fra_fee1.t_ch_accept.Refresh; fra_fee1.t_ch_pay.Refresh; exit; end; if bsSkinPageControl1.ActivePage=bsSkinTabSheet4 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; { if t_op_seai1.DataSet.state in [dsedit,dsinsert] then t_op_seai1.DataSet.post; if bsSkinPageControl1.ActivePage=bsSkinTabSheet5 then begin if Letter_flag=0 then begin frm_op_letter:=tfrm_op_letter.Create (self); frm_op_letter.bsTypeid:=0; frm_op_letter.t_op_letter.DataSource:=t_op_seai1; frm_op_letter.ManualDock(bsSkinTabSheet5,nil,alClient); frm_op_letter.show; end; exit; end; } end; procedure Tfrm_op_seai.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_op_seai1.DataSet.GetBookmark; t_op_seai1.DataSet.Refresh; t_op_seai1.DataSet.GotoBookmark(book1); end; procedure Tfrm_op_seai.t_op_seai_fenAfterInsert(DataSet: TDataSet); begin t_op_seai_fen['场站']:=t_op_seai['场站']; t_op_seai_fen['船名']:=t_op_seai['船名']; t_op_seai_fen['航次']:=t_op_seai['航次']; t_op_seai_fen['进口日期']:=t_op_seai['进口日期']; t_op_seai_fen['装货港']:=t_op_seai['装货港']; t_op_seai_fen['卸货港']:=t_op_seai['卸货港']; t_op_seai_fen['提单份数']:=t_op_seai['提单份数']; t_op_seai_fen['唛头']:=t_op_seai['唛头']; t_op_seai_fen['箱号封号']:=t_op_seai['箱号封号']; t_op_seai_fen['航线']:=t_op_seai['航线']; t_op_seai_fen['船公司']:=t_op_seai['船公司']; t_op_seai_fen['货代公司']:=t_op_seai['货代公司']; end; procedure Tfrm_op_seai.t_op_seai_fenBeforeCancel(DataSet: TDataSet); begin delete_no(t_op_seai_fen); if t_op_seai_fen.State=dsinsert then if not t_op_seai_fen.FieldByName('委托编号').IsNull then delwtno(t_op_seai_fen['委托编号']); end; procedure Tfrm_op_seai.t_op_seai_fenBeforeDelete(DataSet: TDataSet); begin op_befor_post(t_op_seai_fen,'0002'); delete_add(2,t_op_seai_fen); if not t_op_seai_fen.FieldByName('委托编号').IsNull then delwtno(t_op_seai_fen['委托编号']); end; procedure Tfrm_op_seai.t_op_seai_fenBeforeEdit(DataSet: TDataSet); begin op_befor_post(t_op_seai_fen,'0002'); end; procedure Tfrm_op_seai.t_op_seai_fenBeforePost(DataSet: TDataSet); begin //拼箱分票 table_before_post(t_op_seai_fen,'委托单位'); table_before_post(t_op_seai_fen,'操作员'); table_before_post(t_op_seai_fen,'客服员'); table_before_post(t_op_seai_fen,'主提单号'); table_before_post(t_op_seai_fen,'进口日期'); table_before_post(t_op_seai_fen,'装运方式'); table_before_post(t_op_seai_fen,'船名'); table_before_post(t_op_seai_fen,'航次'); table_before_post(t_op_seai_fen,'装货港'); table_before_post(t_op_seai_fen,'卸货港'); table_before_post(t_op_seai_fen,'业务来源'); if pos('指定',t_op_seai_fen.FieldByName('业务来源').AsString)>0 then begin end else begin table_before_post(t_op_seai_fen,'揽货人'); table_before_post(t_op_seai_fen,'销售部门'); end; table_before_post(t_op_seai_fen,'操作部门'); if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='自动取号' then if t_op_seai_fen.FieldByName('委托编号').IsNull or (trim(t_op_seai_fen['委托编号'])='') then if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai_fen['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai_fen['会计期间']) else t_op_seai_fen['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai_fen['进口日期']); if op_empty('t_op_seai',t_op_seai_fen) then Abort; if t_op_seai_fen.fieldbyname('进口日期').oldvalue<>t_op_seai_fen.fieldbyname('进口日期').asdatetime then if (t_op_seai_fen.fieldbyname('业务类型').asstring<>'更改单') and (Logininfo.endday>=t_op_seai_fen.fieldbyname('进口日期').asdatetime) then begin showmessage('此进口日期所在期间已月末结账,不能添加修改业务!!'); abort; end; if t_op_seai_fen.FieldByName('委托单位').OldValue<>t_op_seai_fen.FieldByName('委托单位').asstring then begin if frm_data_share.t_crm_client_all.Locate('客户简称',t_op_seai_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_seai_fen.State=dsinsert then begin if t_op_seai_fen.fieldbyname('业务编号').asstring=''then begin t_op_seai_fen['业务编号']:=get_no(t_op_seai_fen.fieldbyname('会计期间').AsDateTime,getbsno(Logininfo.SeaImpBsNo,'SI')); t_op_seai_fen['编号']:=get_id; end; t_op_seai_fen['业务状态']:='接受委托'; t_op_seai_fen['封帐前状态']:='接受委托'; t_op_seai_fen['主编号']:=t_op_seai['编号']; t_op_seai_fen['费用状态']:='录入状态'; end else begin if t_op_seai_fen.FieldByName('装运方式').asstring='整箱' then begin table_before_post(t_op_seai_fen,'集装箱'); end; end; if strtobool(get_parameters_value(34,'false')) then begin if (t_op_seai_fen.fieldbyname('主提单号').asstring='') or (t_op_seai_fen.fieldbyname('业务类型').asstring='更改单') or (t_op_seai_fen.fieldbyname('装运方式').asstring='拼箱分票') then begin t_op_seai_fen['主提单标准']:=t_op_seai_fen['编号']; end else begin t_op_seai_fen['主提单标准']:=Logininfo.subcompcode+t_op_seai_fen['主提单号']; end; end else begin t_op_seai_fen['主提单标准']:=t_op_seai_fen['编号']; end; if strtobool(get_parameters_value(35,'false')) then begin if (t_op_seai_fen.fieldbyname('分提单号').asstring='') or (t_op_seai_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_seai_fen['分提单标准']:=t_op_seai_fen['编号']; end else begin t_op_seai_fen['分提单标准']:=Logininfo.subcompcode+t_op_seai_fen['分提单号']; end; end else begin t_op_seai_fen['分提单标准']:=t_op_seai_fen['编号']; end; if strtobool(get_parameters_value(36,'false')) then begin if (t_op_seai_fen.fieldbyname('委托编号').asstring='') or (t_op_seai_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_seai_fen['委托标准']:=t_op_seai_fen['编号']; end else begin t_op_seai_fen['委托标准']:=t_op_seai_fen['委托编号']; end; end else begin t_op_seai_fen['委托标准']:=t_op_seai_fen['编号']; end; if strtobool(get_parameters_value(60,'false')) then begin if (trim(t_op_seai_fen.fieldbyname('报关单号').asstring)='') or (t_op_seai_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_seai_fen['报关标准']:=t_op_seai_fen['编号']; end else begin t_op_seai_fen['报关标准']:=t_op_seai_fen['报关单号']; end; end else begin t_op_seai_fen['报关标准']:=t_op_seai_fen['编号']; end; if strtobool(get_parameters_value(61,'false')) then begin if (trim(t_op_seai_fen.fieldbyname('报检单号').asstring)='') or (t_op_seai_fen.fieldbyname('业务类型').asstring='更改单') then begin t_op_seai_fen['报检标准']:=t_op_seai_fen['编号']; end else begin t_op_seai_fen['报检标准']:=t_op_seai_fen['报检单号']; end; end else begin t_op_seai_fen['报检标准']:=t_op_seai_fen['编号']; end; // t_op_seai_fen['Upload']:=1; end; procedure Tfrm_op_seai.bsSkinButton33Click(Sender: TObject); begin bsSkinButton11.Caption:='返回主票'; try t_op_seai1.Enabled:=false; t_op_seai1.DataSet:=t_op_seai_fen; finally t_op_seai1.Enabled:=true; end; end; procedure Tfrm_op_seai.bsSkinButton34Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton34.ClientToScreen(Point(0,bsSkinButton34.Height)); PopupMenu4.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seai.bsSkinButton36Click(Sender: TObject); begin if (t_op_seai_fen.State=dsinsert)or(t_op_seai_fen.State=dsedit) then t_op_seai_fen.post; end; procedure Tfrm_op_seai.MenuItem1Click(Sender: TObject); begin if t_op_seai_fen.IsEmpty then exit; t_op_seai_fen.edit; t_op_seai_fen['主编号']:=t_op_seai_fen['编号']; t_op_seai_fen.post; t_op_seai_fen.Requery(); end; procedure Tfrm_op_seai.MenuItem3Click(Sender: TObject); begin if t_op_seai_fen.IsEmpty then exit; t_op_seai_fen.edit; t_op_seai_fen['主编号']:=t_op_seai_fen['编号']; t_op_seai_fen['装运方式']:='拼箱单票'; t_op_seai_fen.post; t_op_seai_fen.Requery(); end; procedure Tfrm_op_seai.RxDBLookupCombo14KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo1); end; procedure Tfrm_op_seai.wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo5); end; procedure Tfrm_op_seai.wwDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo7); end; procedure Tfrm_op_seai.wwDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo6); end; procedure Tfrm_op_seai.N39Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱单票' then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱主票'then begin if not t_op_seai_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为单票!!'); exit; end; end; t_op_seai.edit; t_op_seai['装运方式']:='拼箱单票'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai.post; end; procedure Tfrm_op_seai.N41Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱主票' then exit; t_op_seai.edit; t_op_seai['装运方式']:='拼箱主票'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai.post; end; procedure Tfrm_op_seai.N43Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱分票' then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱主票'then begin if not t_op_seai_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为分票!!'); exit; end; end; t_op_seai.edit; t_op_seai['装运方式']:='拼箱分票'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai.post; end; procedure Tfrm_op_seai.N45Click(Sender: TObject); begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try frm_op_add_seai:=tfrm_op_add_seai.Create (self); frm_op_add_seai.ShowModal; finally frm_op_add_seai.Free; end; end; procedure Tfrm_op_seai.wwDBComboBox2Change(Sender: TObject); begin if t_op_seai1.DataSet=nil then exit; if wwDBComboBox2.text='拼箱主票' then begin bsSkinPageControl2.Visible:=true; bsSkinButton16.Visible:=true; if strtobool(get_parameters_value(131,'false')) then begin end else begin DBEdit16.Color:=clBtnFace; DBEdit16.ReadOnly:=true; END; end else begin bsSkinPageControl2.Visible:=false; DBEdit16.Color:=clWindow; DBEdit16.ReadOnly:=false; bsSkinButton16.Visible:=false; end; end; procedure Tfrm_op_seai.bsSkinButton32Click(Sender: TObject); begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai_fen.post; try frm_op_seai_add:=tfrm_op_seai_add.Create (self); frm_op_seai_add.data1.Enabled:=false; frm_op_seai_add.data1.DataSet:=t_op_seai_fen; frm_op_seai_add.data1.Enabled:=true; frm_op_seai_add.bsSkinCheckRadioBox3.Checked:=true; frm_op_seai_add.bsSkinCheckRadioBox2.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox4.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox1.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox5.Enabled:=false; frm_op_seai_add.bsSkinCheckRadioBox6.Enabled:=false; frm_op_seai_add_num:=3; frm_op_seai_add.ShowModal; finally frm_op_seai_add.Free end; end; procedure Tfrm_op_seai.N47Click(Sender: TObject); begin if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.Close; t_op_seai.SQL.clear; t_op_seai.SQL.Add('select * from t_op_seai where ' +open_data('0002','录入人','操作员','客服员','报关操作','报检操作') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 金额<>开票金额 and 类型='''+'收'+''''+' )' +default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai.RxDBLookupCombo17KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo2); end; procedure Tfrm_op_seai.RxDBLookupCombo18KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox2); end; procedure Tfrm_op_seai.bsSkinButton44Click(Sender: TObject); var str:widestring; begin str:=''; str:=query_tiaojian(1,str,'t_op_seai.业务编号','模糊',Edit1.text); str:=query_tiaojian(1,str,'t_op_seai.委托编号','模糊',Edit4.text); str:=query_tiaojian(1,str,'t_op_seai.主提单号','模糊',Edit2.text); str:=query_tiaojian(1,str,'t_op_seai.分提单号','模糊',Edit3.text); if trim(str)='' then begin str:='where '+open_data('0002','t_op_seai.录入人', 't_op_seai.操作员','t_op_seai.客服员','t_op_seai.报关操作','t_op_seai.报检操作'); end else begin str:=str+' and '+open_data('0002','t_op_seai.录入人', 't_op_seai.操作员','t_op_seai.客服员','t_op_seai.报关操作','t_op_seai.报检操作'); end; // str:='select * from t_op_seai where 主编号=编号 and 装运方式<>''报关'' '+' and 编号 in (select 主编号 from t_op_seai ' str:='select * from t_op_seai where 主编号=编号 and 装运方式<>''三废'' and 编号 in (select 主编号 from t_op_seai ' +str+')'+default_sort(54,'t_op_seai','','desc'); if (not t_op_seai.IsEmpty) and (t_op_seai.sql.Text<>'') then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.close; t_op_seai.sql.clear; t_op_seai.sql.add(str); t_op_seai.Open; if t_op_seai.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; procedure Tfrm_op_seai.Edit1KeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_op_seai.N50Click(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','sidisp',bsSkinPanel9.Visible); inifile1.free; end; procedure Tfrm_op_seai.N51Click(Sender: TObject); var inifile1:Tinifile; begin bsSkinPanel9.Visible:=false; bsSkinButton13.Top:=3; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); inifile1.WriteBool('other','sidisp',bsSkinPanel9.Visible); inifile1.free; end; procedure Tfrm_op_seai.N53Click(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('seaimp',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_seai.wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker4); end; procedure Tfrm_op_seai.wwDBDateTimePicker3KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker5); end; procedure Tfrm_op_seai.wwDBLookupCombo21KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo1); end; procedure Tfrm_op_seai.wwDBDateTimePicker5KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo18); end; procedure Tfrm_op_seai.RxDBLookupCombo21KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo22); end; procedure Tfrm_op_seai.RxDBLookupCombo22KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo19); end; procedure Tfrm_op_seai.RxDBLookupCombo10KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo7); end; procedure Tfrm_op_seai.RxDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit10); end; procedure Tfrm_op_seai.DBEdit13KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo30); end; procedure Tfrm_op_seai.bsSkinButton21Click(Sender: TObject); begin frm_main.view_momo(t_op_seai1,'唛头'); end; procedure Tfrm_op_seai.bsSkinButton12Click(Sender: TObject); begin frm_main.view_momo(t_op_seai1,'货物描述'); end; procedure Tfrm_op_seai.bsSkinButton14Click(Sender: TObject); begin frm_main.view_momo(t_op_seai1,'箱号封号'); end; procedure Tfrm_op_seai.bsSkinButton15Click(Sender: TObject); begin frm_main.view_momo(t_op_seai1,'备注'); end; procedure Tfrm_op_seai.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_seai'''; 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_seai1.DataSet.FindField('装运方式')<>nil then begin if pos('主票',t_op_seai1.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_seai.Notebook1PageChanged(Sender: TObject); begin // setconcolor; if Notebook1.PageIndex<>0 then begin setconcolor; {$IFDEF ZTGENGZONG} if assigned(frm_op_seae_state_up) then frm_op_seae_state_up.Hide; {$ENDIF} end; end; procedure Tfrm_op_seai.RxDBLookupCombo16Change(Sender: TObject); begin if (t_op_seai1.DataSet.State=dsinsert)or(t_op_seai1.DataSet.State=dsedit)then begin if RxDBLookupCombo16.DisplayValue<>'' then t_op_seai1.DataSet['通知人代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seai.RxDBLookupCombo16Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo16); end; procedure Tfrm_op_seai.RxDBLookupCombo16Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo5); end; procedure Tfrm_op_seai.RxDBLookupCombo15Change(Sender: TObject); begin if (t_op_seai1.DataSet.State=dsinsert)or(t_op_seai1.DataSet.State=dsedit)then begin if RxDBLookupCombo15.DisplayValue<>'' then t_op_seai1.DataSet['收货人代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seai.RxDBLookupCombo15Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo15); end; procedure Tfrm_op_seai.RxDBLookupCombo15Exit(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo15); end; procedure Tfrm_op_seai.RxDBLookupCombo11Change(Sender: TObject); begin if t_op_seai1.DataSet=nil then exit; if (t_op_seai1.DataSet.state=dsinsert)or(t_op_seai1.DataSet.state=dsedit)then begin if RxDBLookupCombo11.DisplayValue='' then exit; t_op_seai1.DataSet.fieldbyname('货物描述').asstring:=t_op_seai1.DataSet.fieldbyname('货物描述').asstring+#13#10+frm_data_share.t_code_goods['货物描述']; t_op_seai1.DataSet.fieldbyname('商品编码').asstring:=frm_data_share.t_code_goods['商品编码']; // if trim(t_op_seae2.DataSet.fieldbyname('货物描述').asstring)=''then // DBMemo39.Lines.Append(frm_data_share.t_code_goods['货物描述']); // TMemoField(t_op_seae2.Fieldbyname('货物描述')). // :=frm_data_share.t_code_goods['货物描述']; end; end; procedure Tfrm_op_seai.DBEdit16DblClick(Sender: TObject); begin with frm_data_share.P_GetMaxHblno do begin close; Parameters.ParamByName('@hblhead').value:=DBEdit16.text+'%'; open; if (not IsEmpty) and (FieldByName('分提单号').AsString<>'') then begin lblhbl.Caption:=FieldByName('分提单号').AsString; bsSkinPanel10.Visible:=true; end; end; end; procedure Tfrm_op_seai.DBEdit16Exit(Sender: TObject); begin bsSkinPanel10.Visible:=false; end; procedure Tfrm_op_seai.t_op_seai_fenPostError(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_seai where 主提单标准='+''''+t_op_seai_fen['主提单标准']+''''; double_seai(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 分提单标准='+''''+t_op_seai_fen['分提单标准']+''''; double_seai(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 委托标准='+''''+t_op_seai_fen['委托标准']+''''; double_seai(str,3); abort; end; if pos('报关标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 报关标准='+''''+t_op_seai_fen['报关标准']+''''; double_seai(str,4); abort; end; if pos('报检标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 报检标准='+''''+t_op_seai_fen['报检标准']+''''; double_seai(str,5); abort; end; end; procedure Tfrm_op_seai.wwDBDateTimePicker4KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker3); end; procedure Tfrm_op_seai.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_seai.DBEdit8Exit(Sender: TObject); begin bsSkinPanel4.Visible:=false; end; procedure Tfrm_op_seai.DBEdit41KeyPress(Sender: TObject; var Key: Char); begin if bsSkinPageControl2.Visible then key_RxDBLookupCombo(Key,RxDBLookupCombo3) else key_RxDBLookupCombo(Key,RxDBLookupCombo14); end; procedure Tfrm_op_seai.DBEdit41Exit(Sender: TObject); begin bsSkinPanel12.Visible:=false; end; procedure Tfrm_op_seai.DBEdit41DblClick(Sender: TObject); begin with frm_data_share.P_GetMaxDCno do begin close; Parameters.ParamByName('@hblhead').value:=DBEdit41.text+'%'; open; if (not IsEmpty) and (FieldByName('订舱单号').AsString<>'') then begin lbldc.Caption:=FieldByName('订舱单号').AsString; bsSkinPanel12.Visible:=true; end; end; end; procedure Tfrm_op_seai.bsSkinSpeedButton1Click(Sender: TObject); begin if (t_op_seai1.DataSet.FieldByName('委托编号').IsNull) or (t_op_seai1.DataSet['委托编号']='') then begin t_op_seai1.DataSet.Edit; if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='会计期间' then t_op_seai1.DataSet['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai1.DataSet['会计期间']) else t_op_seai1.DataSet['委托编号']:=getwtno(2,subComp,department,employee,t_op_seai1.DataSet['进口日期']); end; end; procedure Tfrm_op_seai.bsSkinButton16Click(Sender: TObject); begin if not (if_open('295') or if_open('296')) 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_seai_fen; with frm_ch_fee_zhupiao do begin if if_open('295') then begin fra_fee_zhu1.t_ch_accept.close; fra_fee_zhu1.t_ch_accept.Parameters[1].value:=t_op_seai.fieldbyname('编号').asstring; fra_fee_zhu1.t_ch_accept.open; fra_fee_zhu1.zhupiao1.DataSet:=t_op_seai; fra_fee_zhu1.dxDBGrid1.FullExpand; fra_fee_zhu1.bsSkinPanel3.visible:=true; end else fra_fee_zhu1.bsSkinPanel3.visible:=false; if if_open('296') then begin fra_fee_zhu1.t_ch_pay.close; fra_fee_zhu1.t_ch_pay.Parameters[1].value:=t_op_seai.fieldbyname('编号').asstring; fra_fee_zhu1.t_ch_pay.open; fra_fee_zhu1.zhupiao1.DataSet:=t_op_seai; 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_seai.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_seai.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_seai.wwDBComboBox9KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo2); end; procedure Tfrm_op_seai.wwDBComboBox9DropDown(Sender: TObject); var aQuery:TAdoQuery; begin wwDBComboBox9.Items.Clear; if t_op_seai1.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_seai1.DataSet.FieldByName('业务来源').AsString+''' order by 来源明细'); open; first; while not eof do begin wwDBComboBox9.Items.Add(FieldByName('来源明细').AsString); next; end; end; finally FreeAndNil(aQuery); end; end; procedure Tfrm_op_seai.RxDBLookupCombo31Change(Sender: TObject); begin t_op_seai1.DataSet.FieldByName('来源明细').AsString:=''; end; procedure Tfrm_op_seai.N55Click(Sender: TObject); var can_do:boolean; gdo,xdo:smallint; begin //操作封帐 if t_op_seai1.DataSet=nil then exit; if t_op_seai1.DataSet.IsEmpty then exit; if not do_data('0002',t_op_seai1.DataSet.FieldByName('录入人').asstring ,t_op_seai1.DataSet.FieldByName('操作员').asstring ,t_op_seai1.DataSet.FieldByName('揽货人').asstring ,t_op_seai1.DataSet.FieldByName('客服员').asstring ,t_op_seai1.DataSet.FieldByName('报关操作').asstring ,t_op_seai1.DataSet.FieldByName('报检操作').asstring) then begin showmessage('对不起你无权修改此数据!'); abort; end; if t_op_seai1.DataSet.FieldByName('费用状态').asstring='费用封帐' then begin showmessage('此票业务状态已经为费用封帐状态!'); abort; end; t_ch_fee.close; t_ch_fee.Parameters[0].value:=t_op_seai1.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_seai1.DataSet.edit; t_op_seai1.DataSet['费用状态']:='费用封帐'; t_op_seai1.DataSet['费用封帐日期']:=Now; //更改会计期间 if (gdo<>0) or (xdo<>0) then begin if trim(t_op_seai1.DataSet.fieldbyname('业务类型').AsString)='普通货' then begin if gdo=1 then begin if t_op_seai1.DataSet['进口日期']>Logininfo.endday then t_op_seai1.DataSet['会计期间']:=t_op_seai1.DataSet['进口日期']; end; end else if trim(t_op_seai1.DataSet.fieldbyname('业务类型').asstring)='更改单' then begin if xdo=1 then begin if t_op_seai1.DataSet['录入日期']>Logininfo.endday then t_op_seai1.DataSet['会计期间']:=t_op_seai1.DataSet['录入日期']; end; end; end; t_op_seai1.DataSet.post; finally prnlist:=false; end; end; end; procedure Tfrm_op_seai.RxDBLookupCombo28KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo21); end; procedure Tfrm_op_seai.wwDBDateTimePicker6KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker7); end; procedure Tfrm_op_seai.wwDBDateTimePicker7KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo28); end; procedure Tfrm_op_seai.EDI2Click(Sender: TObject); begin {$IFDEF EDI} if t_op_seai.isempty then begin showmessage('对不起,没有托单信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seai_edi_yd) then frm_op_seai_edi_yd:=tfrm_op_seai_edi_yd.Create(application); frm_op_seai_edi_yd.ShowModal; finally frm_op_seai_edi_yd.free; frm_op_seai_edi_yd:=nil; end; {$ENDIF} end; procedure Tfrm_op_seai.N58Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱单票' then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱主票'then begin if not t_op_seai_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为单票!!'); exit; end; end; t_op_seai.edit; t_op_seai['装运方式']:='整箱'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai.post; end; procedure Tfrm_op_seai.N60Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱单票' then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱主票'then begin if not t_op_seai_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为单票!!'); exit; end; end; t_op_seai.edit; t_op_seai['装运方式']:='报关'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai.post; end; procedure Tfrm_op_seai.bsSkinButton45Click(Sender: TObject); var tempstr:widestring; begin if seaipsqlstr<>'' then begin tempstr:=seaipsqlstr; t_op_seai.close; if t_op_seai.sql.Text<>'' then seaipsqlstr:=t_op_seai.sql.Text; t_op_seai.sql.clear; t_op_seai.sql.add(tempstr); t_op_seai.Open; end; end; procedure Tfrm_op_seai.N63Click(Sender: TObject); begin if t_op_seai.IsEmpty then exit; if t_op_seai.FieldByName('装运方式').asstring='其他' then exit; if t_op_seai.FieldByName('装运方式').asstring='拼箱主票'then begin if not t_op_seai_fen.IsEmpty then begin showmessage('当前主票含有分票信息,不能更改为单票!!'); exit; end; end; t_op_seai.edit; t_op_seai['装运方式']:='其他'; t_op_seai['主编号']:=t_op_seai['编号']; t_op_seai.post; end; procedure Tfrm_op_seai.t_op_fileBeforeEdit(DataSet: TDataSet); begin op_befor_post(t_op_seai,'0002'); end; procedure Tfrm_op_seai.bsSkinButton48Click(Sender: TObject); var FileStream:TFileStream; fsize:double; begin op_befor_post(t_op_seai,'0002'); 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_seai.bsSkinButton49Click(Sender: TObject); begin if SaveDialog1.Execute then begin DownLoadPro(Savedialog1.FileName+t_op_file.fieldbyname('类型').asstring); end else exit ; end; procedure Tfrm_op_seai.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_seai.bsSkinButton51Click(Sender: TObject); begin op_befor_post(t_op_seai,'0002'); if application.MessageBox('您确定要删除附件吗?','警告:',MB_OKCANCEL)=IDOK then t_op_file.delete ; end; procedure Tfrm_op_seai.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_seai.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_seai.fra_op_state1bsSkinButton11Click(Sender: TObject); begin fra_op_state1.bsSkinButton11Click(Sender); end; procedure Tfrm_op_seai.fra_op_state1bsSkinButton7Click(Sender: TObject); begin fra_op_state1.bsSkinButton7Click(Sender); end; procedure Tfrm_op_seai.dxDBGrid1Column77CustomDraw(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[dxDBGrid1Column77.Index]); AFont.Color:=clblack; end; procedure Tfrm_op_seai.bsSkinButton17Click(Sender: TObject); begin if not assigned(frm_op_seae_state_up) then frm_op_seae_state_up:=tfrm_op_seae_state_up.Create (self); frm_op_seae_state_up.t_op_state.DataSource:=frm_op_seai.t_op_seai1; frm_op_seae_state_up.DBEdit8.DataSource:=frm_op_seai.t_op_seai1; frm_op_seae_state_up.DBEdit9.DataSource:=frm_op_seai.t_op_seai1; frm_op_seae_state_up.show; frm_op_seae_state_up.Left:=bsSkinButton17.left+Notebook1.left+2; frm_op_seae_state_up.top:=70+Notebook1.top; end; procedure Tfrm_op_seai.wwDBDateTimePicker4Change(Sender: TObject); begin if not wwDBDateTimePicker4.Focused then exit; if (strtoint(get_parameters_value(158,'0'))=1) and (Trim(t_op_seai.FieldByName('业务类型').AsString)='更改单') then wwDBDateTimePicker4.ReadOnly:=true; end; procedure Tfrm_op_seai.bsSkinButton18Click(Sender: TObject); var aQuery:TADOQuery; book1:Tbookmark; begin if t_op_seai=nil then exit; if t_op_seai.IsEmpty then exit; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('update t_op_seai set FEE=1 where 编号='''+t_op_seai['编号']+''''); ExecSQL; end; finally FreeAndNil(aQuery); end; book1:=t_op_seai.GetBookmark; t_op_seai.Requery(); t_op_seai.GotoBookmark(book1); end; procedure Tfrm_op_seai.bsSkinButton19Click(Sender: TObject); var aQuery:TADOQuery; book1:Tbookmark; begin if t_op_seai=nil then exit; if t_op_seai.IsEmpty then exit; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('update t_op_seai set FEE2=1 where 编号='''+t_op_seai['编号']+''''); ExecSQL; end; finally FreeAndNil(aQuery); end; book1:=t_op_seai.GetBookmark; t_op_seai.Requery(); t_op_seai.GotoBookmark(book1); end; procedure Tfrm_op_seai.RxDBLookupCombo23Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo23); end; procedure Tfrm_op_seai.FormCreate(Sender: TObject); begin Letter_flag:=0; end; procedure Tfrm_op_seai.N66Click(Sender: TObject); var i:integer; aAdoQuery:TAdoQuery; begin //批量选择打印帐单 if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要打印的业务帐单!!'); exit; end; if not if_open('055') then begin showmessage('对不起你无权修改此数据!'); abort; end; aAdoQuery:=CreateAdoQuery; try with aAdoQuery do begin Close;Sql.Clear; Sql.Add('Select * from t_ch_fee'); Sql.Add('Where 编号=:bsno and 费用状态=''录入状态'''); end; t_op_seai.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('bsno').value:=t_op_seai.FieldByName('编号').AsString; aAdoQuery.Open; fee_update_all_pl('2',t_op_seai.FieldByName('揽货人').AsString,t_op_seai.FieldByName('销售部门').AsString,'收',aAdoQuery); end; finally t_op_seai.EnableControls; aAdoQuery.Free; end; end; procedure Tfrm_op_seai.N68Click(Sender: TObject); var i:integer; aAdoQuery:TAdoQuery; begin //批量选择打印帐单 if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要打印的业务帐单!!'); exit; end; if not if_open('055') then begin showmessage('对不起你无权修改此数据!'); abort; end; aAdoQuery:=CreateAdoQuery; try with aAdoQuery do begin Close;Sql.Clear; Sql.Add('Select * from t_ch_fee'); Sql.Add('Where 编号=:bsno and 费用状态=''录入状态'' and 类型=''收'''); end; t_op_seai.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('bsno').value:=t_op_seai.FieldByName('编号').AsString; aAdoQuery.Open; fee_update_all_pl('2',t_op_seai.FieldByName('揽货人').AsString,t_op_seai.FieldByName('销售部门').AsString,'收',aAdoQuery); end; finally t_op_seai.EnableControls; aAdoQuery.Free; end; end; procedure Tfrm_op_seai.N70Click(Sender: TObject); var i:integer; aAdoQuery:TAdoQuery; begin //批量选择打印帐单 if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要打印的业务帐单!!'); exit; end; if not if_open('055') then begin showmessage('对不起你无权修改此数据!'); abort; end; aAdoQuery:=CreateAdoQuery; try with aAdoQuery do begin Close;Sql.Clear; Sql.Add('Select * from t_ch_fee'); Sql.Add('Where 编号=:bsno and 费用状态=''录入状态'' and 类型=''付'''); end; t_op_seai.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('bsno').value:=t_op_seai.FieldByName('编号').AsString; aAdoQuery.Open; fee_update_all_pl('2',t_op_seai.FieldByName('揽货人').AsString,t_op_seai.FieldByName('销售部门').AsString,'收',aAdoQuery); end; finally t_op_seai.EnableControls; aAdoQuery.Free; end; end; function Tfrm_op_seai.UpdateopseaeStatus(bsNO,Salas:string):Boolean; var aAdoQuery,aAdoQueryUpdate:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; aAdoQueryUpdate:=CreateAdoQuery; with aAdoQueryUpdate do begin Close;Sql.Clear; SQL.Add('Update t_ch_fee set 费用状态=:feestatus,审核人=:CheckName,审核日期=:CheckDate,提交日期=:AppDate'); SQL.Add('where 编号=:编号 and CH_ID=:CH_ID And 费用状态=''录入状态'''); Parameters.ParamByName('编号').Value:=BsNo; Parameters.ParamByName('feestatus').Value:='审核通过'; Parameters.ParamByName('CheckName').Value:=employee; Parameters.ParamByName('CheckDate').Value:=now; Parameters.ParamByName('AppDate').Value:=now; end; with aAdoQuery do try Close;Sql.Clear; SQL.Add('Update t_op_seai set 费用状态=''提交财务'''); SQL.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=BsNo; ExecSQL; if Salas='公司货111' then begin Close;Sql.Clear; SQL.Add('Select * from t_ch_fee'); SQL.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=BsNo; Open;First; while not eof do begin aAdoQueryUpdate.Close; aAdoQueryUpdate.Parameters.ParamByName('CH_ID').Value:=FieldByName('CH_ID').AsInteger; aAdoQueryUpdate.ExecSQL; Next; end; end; finally aAdoQuery.Free; end; end; procedure Tfrm_op_seai.bsSkinButton60Click(Sender: TObject); var i:integer; begin if t_op_seai.IsEmpty then exit; if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; try t_op_seai.DisableControls; if (t_op_seai.FieldByName('费用状态').AsString='录入状态') or (t_op_seai.FieldByName('费用状态').AsString='录入费用') or (t_op_seai.FieldByName('费用状态').AsString='提交审核') or (t_op_seai.FieldByName('费用状态').AsString='提交财务') then begin fee_update_all('2','收',frm_op_seai.fra_fee1.t_ch_accept); fee_update_all('2','付',frm_op_seai.fra_fee1.t_ch_Pay); UpdateopseaeStatus(t_op_seai.FieldByName('编号').AsString,'公司货111'); { if GetopseaeStatus(t_op_seai.FieldByName('编号').AsString,Trim(t_op_seai.FieldByName('揽货人').AsString)) then begin ShowMessage('费用状态为:<录入状态>或<提交审核>或<驳回提交>或<申请删除>或<申请修改>的费用不能提交财务'); end else begin UpdateopseaeStatus(t_op_seai.FieldByName('编号').AsString,'公司货111'); end; } end else begin ShowMessage('费用状态为:'+t_op_seai.FieldByName('费用状态').AsString+',不能提交财务'); end; finally t_op_seai.EnableControls; t_op_seai.Refresh; end; end; procedure Tfrm_op_seai.N1231Click(Sender: TObject); var k:integer; begin //网上查询单独数据库,提交数据 if application.MessageBox('您确定要此票业务提交客户网上查询吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try if frm_op_seai.dxdbgrid1.SelectedCount>0 then begin for k:=0 to frm_op_seai.dxdbgrid1.SelectedCount-1 do begin frm_op_seai.t_op_seai.GotoBookmark(pointer(frm_op_seai.dxdbgrid1.selectedrows[k])); SubmitToWebMasterBills(frm_op_seai.t_op_seai.fieldbyname('编号').AsString,'t_op_seai'); SubmitToWebCustomerBills(frm_op_seai.t_op_seai.fieldbyname('编号').AsString,'t_op_seai','t_op_seai_assistant'); SubmitToWebFee(frm_op_seai.t_op_seai.fieldbyname('编号').AsString); SubmitToWebState(frm_op_seai.t_op_seai.fieldbyname('编号').AsString); end; end else begin SubmitToWebMasterBills(frm_op_seai.t_op_seai.fieldbyname('编号').AsString,'t_op_seai'); SubmitToWebCustomerBills(frm_op_seai.t_op_seai.fieldbyname('编号').AsString,'t_op_seai','t_op_seai_assistant'); SubmitToWebFee(frm_op_seai.t_op_seai.fieldbyname('编号').AsString); SubmitToWebState(frm_op_seai.t_op_seai.fieldbyname('编号').AsString); end; finally end; end; procedure Tfrm_op_seai.N73Click(Sender: TObject); var aAdoQuery:TAdoQuery; k:integer; begin //网上查询单独数据库,取消提交数据 //if application.MessageBox('您确定要取消此票业务客户网上查询吗?','警告:',MB_OKCANCEL)<>IDOK then exit; if frm_op_seai.dxdbgrid1.SelectedCount>0 then begin for k:=0 to frm_op_seai.dxdbgrid1.SelectedCount-1 do begin frm_op_seai.t_op_seai.GotoBookmark(pointer(frm_op_seai.dxdbgrid1.selectedrows[k])); DelWebData(frm_op_seai.t_op_seai.fieldbyname('编号').AsString,'t_op_seai','t_op_seai_assistant'); end; end else begin DelWebData(frm_op_seai.t_op_seai.fieldbyname('编号').AsString,'t_op_seai','t_op_seai_assistant'); end; end; procedure Tfrm_op_seai.fra_op_letter_free1bsSkinButton1Click( Sender: TObject); begin fra_op_letter_free1.bsSkinButton1Click(Sender); end; procedure Tfrm_op_seai.CreateCustom(Sender: TObject); var str,strbsno:widestring; i:integer; id:string; TempStr:TStringlist; aQuery,aQuery2,aQuerycuststr,aQueryCtnDetail,aQueryShipper:TADOQuery; function getcustedi(cust:string):string; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; result:=''; try aQuery.Close; aQuery.SQL.Text:='select EDI代码 from t_crm_client where 客户简称='''+cust+''''; aQuery.Open; if not aQuery.IsEmpty then result:=aQuery.fieldbyname('EDI代码').AsString; finally FreeAndNil(aQuery); end; end; function GetvesselEdi(avessel: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 船舶呼号 from t_code_vessel where 英文船名='''+avessel+''''); Open; if IsEmpty then Result:='a' else Result:=FieldByName('船舶呼号').AsString; end; finally FreeAndNil(aQuery); end; end; begin if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; if MessageDlg('确实要将此票业务生成EDI数据吗?',mtWarning,[mbyes,mbno],0)=mryes then begin if not t_op_seae_edi.active then t_op_seae_edi.Open; if not t_op_ctn_detail_edi.active then t_op_ctn_detail_edi.Open; try try TempStr:=TStringList.Create; aQuery:=CreateAdoQuery; aQuery2:=CreateAdoQuery; aQueryCtnDetail:=CreateAdoQuery; aQueryShipper:=CreateAdoQuery; aQuery.sql.Text:='select * from t_op_ctn where 编号=:编号'; t_op_ctn_edi.close; t_op_ctn_edi.sql.Text:='select * from t_op_ctn_edi where 编号=:编号'; aQueryCtnDetail.sql.Text:='select * from t_op_ctn_detail where ctn_id=:ctn_id'; aQuerycuststr:=CreateAdoQuery; aQuerycuststr.sql.text:=' select 电话,国家,洲,城市 from t_crm_client where 客户简称=:客户简称'; aQueryShipper.sql.Text:='select * from t_code_edicode where 客户简称=:客户简称'; id:=get_id; t_op_seae_edi.Insert; t_op_seae_edi['编号']:=id; t_op_seae_edi['主编号']:=t_op_seai1.DataSet['编号']; if TMenuItem(Sender).tag=1 then t_op_seae_edi['EDI类型']:='AFR' else if TMenuItem(Sender).tag=2 then t_op_seae_edi['EDI类型']:='AMR'; t_op_seae_edi['EDI状态']:='未发送'; t_op_seae_edi['录入人']:=employee; t_op_seae_edi['录入日期']:=Date; t_op_seae_edi['业务编号']:=t_op_seai1.DataSet['业务编号']; t_op_seae_edi['主提单号']:=t_op_seai1.DataSet['主提单号']; t_op_seae_edi['分提单号']:=t_op_seai1.DataSet['分提单号']; t_op_seae_edi['付费方式']:=t_op_seai1.DataSet['付费方式']; t_op_seae_edi['签单地点']:='QINGDAO'; t_op_seae_edi['发货人代码']:=t_op_seai1.DataSet['发货人代码']; t_op_seae_edi['船公司代码']:=getcustedi(t_op_seai1.DataSet.fieldbyname('船公司').AsString); TempStr.Text:=t_op_seai1.DataSet.fieldbyname('发货人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['发货人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['发货人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['发货人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['发货人地址3']:=TempStr.Strings[3]; t_op_seae_edi['发货人']:=t_op_seai1.DataSet.FieldByName('发货人').AsString; if t_op_seai1.DataSet.FieldByName('发货人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seai1.DataSet.FieldByName('发货人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('发货人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('发货人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('发货人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('发货人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('发货人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('发货人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('发货人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('发货人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('发货人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('发货人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seai1.DataSet.FieldByName('发货人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['发货人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['发货人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['发货人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['发货人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; TempStr.Text:=t_op_seai1.DataSet.fieldbyname('收货人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['收货人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['收货人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['收货人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['收货人地址3']:=TempStr.Strings[3]; t_op_seae_edi['收货人']:=t_op_seai1.DataSet.FieldByName('收货人').AsString; t_op_seae_edi['收货人代码']:=t_op_seai1.DataSet['收货人代码']; if t_op_seai1.DataSet.FieldByName('收货人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seai1.DataSet.FieldByName('收货人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('收货人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('收货人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('收货人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('收货人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('收货人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('收货人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('收货人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('收货人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('收货人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('收货人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seai1.DataSet.FieldByName('收货人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['收货人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['收货人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['收货人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['收货人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; TempStr.Text:=t_op_seai1.DataSet.fieldbyname('通知人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['通知人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['通知人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['通知人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['通知人地址3']:=TempStr.Strings[3]; t_op_seae_edi['通知人']:=t_op_seai1.DataSet.FieldByName('通知人').AsString; t_op_seae_edi['通知人代码']:=t_op_seai1.DataSet['通知人代码']; if t_op_seai1.DataSet.FieldByName('通知人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seai1.DataSet.FieldByName('通知人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('通知人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('通知人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('通知人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('通知人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('通知人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('通知人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('通知人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('通知人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('通知人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('通知人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seai1.DataSet.FieldByName('通知人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['通知人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['通知人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['通知人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['通知人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; t_op_seae_edi['船名']:=t_op_seai1.DataSet['船名']; t_op_seae_edi['船舶IMO']:=GetvesselEdi(t_op_seai1.DataSet.fieldbyname('船名').AsString); t_op_seae_edi['航次']:=t_op_seai1.DataSet['航次']; t_op_seae_edi['开船日期']:=t_op_seai1.DataSet['开船日期']; t_op_seae_edi['预抵日期']:=t_op_seai1.DataSet['进口日期']; t_op_seae_edi['装货港']:=t_op_seai1.DataSet['装货港']; t_op_seae_edi['装港代码']:=t_op_seai1.DataSet['装港代码']; t_op_seae_edi['卸货港']:=t_op_seai1.DataSet['卸货港']; t_op_seae_edi['卸货代码']:=t_op_seai1.DataSet['卸货代码']; t_op_seae_edi['交货地点']:=t_op_seai1.DataSet['装货港']; t_op_seae_edi['交货代码']:=t_op_seai1.DataSet['装港代码']; t_op_seae_edi['目的地']:=t_op_seai1.DataSet['目的地']; t_op_seae_edi['目的代码']:=t_op_seai1.DataSet['目的地代码']; t_op_seae_edi['运输条款']:=t_op_seai1.DataSet['运输条款']; t_op_seae_edi['唛头']:=t_op_seai1.DataSet['唛头']; t_op_seae_edi['货物描述']:=t_op_seai1.DataSet['货物描述']; t_op_seae_edi['件数']:=t_op_seai1.DataSet['件数']; t_op_seae_edi['包装']:=t_op_seai1.DataSet['包装']; t_op_seae_edi['重量']:=t_op_seai1.DataSet['重量']; t_op_seae_edi['尺码']:=t_op_seai1.DataSet['尺码']; t_op_seae_edi['危险品分类']:=t_op_seai1.DataSet['危险品分类']; t_op_seae_edi['危险品编号']:=t_op_seai1.DataSet['危险品编号']; t_op_seae_edi['冷藏通风量']:=t_op_seai1.DataSet['冷藏通风量']; t_op_seae_edi['温度单位']:=t_op_seai1.DataSet['温度单位']; t_op_seae_edi['设置温度']:=t_op_seai1.DataSet['设置温度']; t_op_seae_edi['最低温度']:=t_op_seai1.DataSet['最低温度']; t_op_seae_edi['最高温度']:=t_op_seai1.DataSet['最高温度']; t_op_seae_edi['货物标识']:=t_op_seai1.DataSet['货物标识']; t_op_seae_edi['运费协议号']:=t_op_seai1.DataSet['运费协议号']; t_op_seae_edi['湿度']:=t_op_seai1.DataSet['湿度']; t_op_seae_edi['订舱号码']:=t_op_seai1.DataSet['订舱单号']; t_op_seae_edi['传输目的']:='A'; if Pos('拼箱', t_op_seai1.DataSet.FieldByName('装运方式').AsString)>0 then begin t_op_seae_edi['装运类型']:='LCL'; t_op_seae_edi['是否最后分票']:=0; end else begin t_op_seae_edi['装运类型']:='FCL'; t_op_seae_edi['是否最后分票']:=1; end; t_op_seae_edi['运输方式']:='PortToPort'; if TMenuItem(Sender).tag=1 then t_op_seae_edi['文件类型']:='House' else if TMenuItem(Sender).tag=2 then t_op_seae_edi['文件类型']:='Master'; t_op_seae_edi.Post; aQuery.Close; aQuery.Parameters.ParamByName('编号').Value:=t_op_seai1.DataSet.fieldbyname('编号').AsString; aQuery.Open; t_op_ctn_edi.Close; t_op_ctn_edi.Parameters.ParamByName('编号').Value:=id; t_op_ctn_edi.Open; if aQuery.IsEmpty then begin aQuery.Close; aQuery.Parameters.ParamByName('编号').Value:=t_op_seai1.DataSet.fieldbyname('主编号').AsString; aQuery.Open; end; aQuery.First; while not aQuery.Eof do begin t_op_ctn_edi.Insert; t_op_ctn_edi['编号']:=id; t_op_ctn_edi['代码']:=aQuery['代码']; t_op_ctn_edi['尺寸']:=aQuery['尺寸']; t_op_ctn_edi['箱型']:=aQuery['箱型']; t_op_ctn_edi['数量']:=1; t_op_ctn_edi['表现形式']:=aQuery['表现形式']; t_op_ctn_edi['箱号']:=aQuery['箱号']; t_op_ctn_edi['封号']:=aQuery['封号']; // t_op_ctn_edi['件数']:=aQuery['件数']; // t_op_ctn_edi['包装']:=aQuery['包装']; // t_op_ctn_edi['重量']:=aQuery['重量']; // t_op_ctn_edi['尺码']:=aQuery['尺码']; t_op_ctn_edi['货描']:=aQuery['货物描述']; t_op_ctn_edi['唛头']:=aQuery['唛头']; if frm_data_share.t_code_ctn.Locate('代码',t_op_ctn_edi.fieldbyname('代码').asstring,[]) then begin if frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='20'then t_op_ctn_edi['TEU']:=1; if (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='40')OR (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='45')then t_op_ctn_edi['TEU']:=2; end; t_op_ctn_edi.Post; aQueryCtnDetail.close; aQueryCtnDetail.Parameters.ParamByName('ctn_id').Value:=aQuery.fieldbyname('ctn_id').Asinteger; aQueryCtnDetail.Open; if aQueryCtnDetail.isempty then begin t_op_ctn_detail_edi.Insert; t_op_ctn_detail_edi['ctn_id']:=t_op_ctn_edi['ctn_id']; t_op_ctn_detail_edi['件数']:=aQuery['件数']; t_op_ctn_detail_edi['包装']:=aQuery['包装']; t_op_ctn_detail_edi['重量']:=aQuery['重量']; t_op_ctn_detail_edi['尺码']:=aQuery['尺码']; t_op_ctn_detail_edi.Post; end else begin t_op_ctn_detail_edi.Insert; t_op_ctn_detail_edi['ctn_id']:=t_op_ctn_edi['ctn_id']; t_op_ctn_detail_edi['件数']:=aQueryCtnDetail['件数']; t_op_ctn_detail_edi['包装']:=aQueryCtnDetail['包装']; t_op_ctn_detail_edi['重量']:=aQueryCtnDetail['重量']; t_op_ctn_detail_edi['尺码']:=aQueryCtnDetail['尺码']; t_op_ctn_detail_edi.Post; end; aQuery.Next; end; ShowMessage('生成成功,请到EDI通信模块查看!'); except ShowMessage('发生错误,刷新后重试!'); end; finally FreeAndNil(TempStr); FreeAndNil(aQuery); FreeAndNil(aQuery2); FreeAndNil(aQuerycuststr); FreeAndNil(aQueryCtnDetail); FreeAndNil(aQueryShipper); end; end; end; procedure Tfrm_op_seai.CreateCustomLIST(Sender: TObject); var str,strbsno:widestring; i:integer; id:string; TempStr:TStringlist; aQuery,aQuery2,aQuerycuststr,aQueryCtnDetail,aQueryShipper:TADOQuery; function getcustedi(cust:string):string; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; result:=''; try aQuery.Close; aQuery.SQL.Text:='select EDI代码 from t_crm_client where 客户简称='''+cust+''''; aQuery.Open; if not aQuery.IsEmpty then result:=aQuery.fieldbyname('EDI代码').AsString; finally FreeAndNil(aQuery); end; end; function GetvesselEdi(avessel: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 船舶呼号 from t_code_vessel where 英文船名='''+avessel+''''); Open; if IsEmpty then Result:='a' else Result:=FieldByName('船舶呼号').AsString; end; finally FreeAndNil(aQuery); end; end; begin if t_op_seai.IsEmpty then exit; if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要生成EDI数据的业务!!'); exit; end; if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then t_op_seai.post; if MessageDlg('确实要将选中的'+inttostr(dxDBGrid1.SelectedCount)+'票业务生成EDI数据吗?',mtWarning,[mbyes,mbno],0)=mryes then begin if not t_op_seae_edi.active then t_op_seae_edi.Open; if not t_op_ctn_detail_edi.active then t_op_ctn_detail_edi.Open; try try TempStr:=TStringList.Create; aQuery:=CreateAdoQuery; aQuery2:=CreateAdoQuery; aQueryCtnDetail:=CreateAdoQuery; aQueryShipper:=CreateAdoQuery; aQuery.sql.Text:='select * from t_op_ctn where 编号=:编号'; t_op_ctn_edi.close; t_op_ctn_edi.sql.Text:='select * from t_op_ctn_edi where 编号=:编号'; aQueryCtnDetail.sql.Text:='select * from t_op_ctn_detail where ctn_id=:ctn_id'; aQuerycuststr:=CreateAdoQuery; aQuerycuststr.sql.text:=' select 电话,国家,洲,城市 from t_crm_client where 客户简称=:客户简称'; aQueryShipper.sql.Text:='select * from t_code_edicode where 客户简称=:客户简称'; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); id:=get_id; t_op_seae_edi.Insert; t_op_seae_edi['编号']:=id; t_op_seae_edi['主编号']:=t_op_seai['编号']; if TMenuItem(Sender).tag=1 then t_op_seae_edi['EDI类型']:='AFR' else if TMenuItem(Sender).tag=2 then t_op_seae_edi['EDI类型']:='AMR'; t_op_seae_edi['EDI状态']:='未发送'; t_op_seae_edi['录入人']:=employee; t_op_seae_edi['录入日期']:=Date; t_op_seae_edi['业务编号']:=t_op_seai['业务编号']; t_op_seae_edi['主提单号']:=t_op_seai['主提单号']; t_op_seae_edi['分提单号']:=t_op_seai['分提单号']; t_op_seae_edi['付费方式']:=t_op_seai['付费方式']; t_op_seae_edi['签单地点']:='QINGDAO'; t_op_seae_edi['发货人代码']:=t_op_seai['发货人代码']; t_op_seae_edi['船公司代码']:=getcustedi(t_op_seai.fieldbyname('船公司').AsString); TempStr.Text:=t_op_seai.fieldbyname('发货人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['发货人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['发货人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['发货人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['发货人地址3']:=TempStr.Strings[3]; t_op_seae_edi['发货人']:=t_op_seai.FieldByName('发货人').AsString; if t_op_seai.FieldByName('发货人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seai.FieldByName('发货人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('发货人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('发货人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('发货人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('发货人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('发货人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('发货人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('发货人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('发货人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('发货人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('发货人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seai.FieldByName('发货人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['发货人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['发货人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['发货人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['发货人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; TempStr.Text:=t_op_seai.fieldbyname('收货人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['收货人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['收货人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['收货人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['收货人地址3']:=TempStr.Strings[3]; t_op_seae_edi['收货人']:=t_op_seai.FieldByName('收货人').AsString; t_op_seae_edi['收货人代码']:=t_op_seai['收货人代码']; if t_op_seai.FieldByName('收货人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seai.FieldByName('收货人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('收货人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('收货人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('收货人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('收货人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('收货人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('收货人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('收货人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('收货人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('收货人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('收货人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seai.FieldByName('收货人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['收货人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['收货人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['收货人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['收货人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; TempStr.Text:=t_op_seai.fieldbyname('通知人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['通知人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['通知人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['通知人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['通知人地址3']:=TempStr.Strings[3]; t_op_seae_edi['通知人']:=t_op_seai.FieldByName('通知人').AsString; t_op_seae_edi['通知人代码']:=t_op_seai['通知人代码']; if t_op_seai.FieldByName('通知人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seai.FieldByName('通知人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('通知人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('通知人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('通知人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('通知人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('通知人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('通知人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('通知人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('通知人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('通知人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('通知人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seai.FieldByName('通知人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['通知人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['通知人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['通知人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['通知人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; t_op_seae_edi['船名']:=t_op_seai['船名']; t_op_seae_edi['船舶IMO']:=GetvesselEdi(t_op_seai.fieldbyname('船名').AsString); t_op_seae_edi['航次']:=t_op_seai['航次']; t_op_seae_edi['开船日期']:=t_op_seai['开船日期']; t_op_seae_edi['预抵日期']:=t_op_seai['进口日期']; t_op_seae_edi['装货港']:=t_op_seai['装货港']; t_op_seae_edi['装港代码']:=t_op_seai['装港代码']; t_op_seae_edi['卸货港']:=t_op_seai['卸货港']; t_op_seae_edi['卸货代码']:=t_op_seai['卸货代码']; t_op_seae_edi['交货地点']:=t_op_seai['装货港']; t_op_seae_edi['交货代码']:=t_op_seai['装港代码']; t_op_seae_edi['目的地']:=t_op_seai['卸货港']; t_op_seae_edi['目的代码']:=t_op_seai['卸货代码']; t_op_seae_edi['运输条款']:=t_op_seai['运输条款']; t_op_seae_edi['唛头']:=t_op_seai['唛头']; t_op_seae_edi['货物描述']:=t_op_seai['货物描述']; t_op_seae_edi['件数']:=t_op_seai['件数']; t_op_seae_edi['包装']:=t_op_seai['包装']; t_op_seae_edi['重量']:=t_op_seai['重量']; t_op_seae_edi['尺码']:=t_op_seai['尺码']; // t_op_seae_edi['危险品分类']:=t_op_seai['危险品分类']; // t_op_seae_edi['危险品编号']:=t_op_seai['危险品编号']; // t_op_seae_edi['冷藏通风量']:=t_op_seai['冷藏通风量']; // t_op_seae_edi['温度单位']:=t_op_seai['温度单位']; // t_op_seae_edi['设置温度']:=t_op_seai['设置温度']; // t_op_seae_edi['最低温度']:=t_op_seai['最低温度']; // t_op_seae_edi['最高温度']:=t_op_seai['最高温度']; // t_op_seae_edi['货物标识']:=t_op_seai['货物标识']; // t_op_seae_edi['运费协议号']:=t_op_seai['运费协议号']; // t_op_seae_edi['湿度']:=t_op_seai['湿度']; // t_op_seae_edi['订舱号码']:=t_op_seai['订舱单号']; t_op_seae_edi['传输目的']:='A'; t_op_seae_edi['装运类型']:=t_op_seai['财务凭证2']; t_op_seae_edi['是否最后分票']:=1; t_op_seae_edi['运输方式']:='PortToPort'; t_op_seae_edi['文件类型']:='Master'; t_op_seae_edi.Post; aQuery.Close; aQuery.Parameters.ParamByName('编号').Value:=t_op_seai.fieldbyname('编号').AsString; aQuery.Open; aQuery.First; t_op_ctn_edi.Close; t_op_ctn_edi.Parameters.ParamByName('编号').Value:=id; t_op_ctn_edi.Open; while not aQuery.Eof do begin t_op_ctn_edi.Insert; t_op_ctn_edi['编号']:=id; t_op_ctn_edi['代码']:=aQuery['代码']; t_op_ctn_edi['尺寸']:=aQuery['尺寸']; t_op_ctn_edi['箱型']:=aQuery['箱型']; t_op_ctn_edi['数量']:=1; t_op_ctn_edi['表现形式']:=aQuery['表现形式']; t_op_ctn_edi['箱号']:=aQuery['箱号']; t_op_ctn_edi['封号']:=aQuery['封号']; t_op_ctn_edi['件数']:=aQuery['件数']; t_op_ctn_edi['包装']:=aQuery['包装']; t_op_ctn_edi['重量']:=aQuery['重量']; t_op_ctn_edi['尺码']:=aQuery['尺码']; t_op_ctn_edi['货描']:=aQuery['货物描述']; t_op_ctn_edi['唛头']:=aQuery['唛头']; if frm_data_share.t_code_ctn.Locate('代码',t_op_ctn_edi.fieldbyname('代码').asstring,[]) then begin if frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='20'then t_op_ctn_edi['TEU']:=1; if (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='40')OR (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='45')then t_op_ctn_edi['TEU']:=2; end; t_op_ctn_edi.Post; aQueryCtnDetail.close; aQueryCtnDetail.Parameters.ParamByName('ctn_id').Value:=aQuery.fieldbyname('ctn_id').Asinteger; aQueryCtnDetail.Open; if aQueryCtnDetail.isempty then begin t_op_ctn_detail_edi.Insert; t_op_ctn_detail_edi['ctn_id']:=t_op_ctn_edi['ctn_id']; t_op_ctn_detail_edi['件数']:=aQuery['件数']; t_op_ctn_detail_edi['包装']:=aQuery['包装']; t_op_ctn_detail_edi['重量']:=aQuery['重量']; t_op_ctn_detail_edi['尺码']:=aQuery['尺码']; t_op_ctn_detail_edi.Post; end else begin t_op_ctn_detail_edi.Insert; t_op_ctn_detail_edi['ctn_id']:=t_op_ctn_edi['ctn_id']; t_op_ctn_detail_edi['件数']:=aQueryCtnDetail['件数']; t_op_ctn_detail_edi['包装']:=aQueryCtnDetail['包装']; t_op_ctn_detail_edi['重量']:=aQueryCtnDetail['重量']; t_op_ctn_detail_edi['尺码']:=aQueryCtnDetail['尺码']; t_op_ctn_detail_edi.Post; end; aQuery.Next; end; end; ShowMessage('生成成功,请到EDI通信模块查看!'); except on e:exception do begin ShowMessage('发生错误,刷新后重试!'+e.Message); end; end; finally FreeAndNil(TempStr); FreeAndNil(aQuery); FreeAndNil(aQuery2); FreeAndNil(aQuerycuststr); FreeAndNil(aQueryCtnDetail); FreeAndNil(aQueryShipper); end; end; end; procedure Tfrm_op_seai.N75Click(Sender: TObject); begin if Notebook1.pageindex=0 then CreateCustomLIST(Sender) else begin if t_op_seai1.DataSet.FieldByName('装运方式').AsString='拼箱主票' then begin MessageDlg('拼箱主票无法生成AFR!',mtWarning,[mbYes],0); end else // CreateCustom(Sender); end; end; procedure Tfrm_op_seai.N80Click(Sender: TObject); begin if Notebook1.pageindex=0 then CreateCustomLIST(Sender) else begin end; end; procedure Tfrm_op_seai.fra_fee1bsSkinButton1Click(Sender: TObject); begin if strtobool(get_parameters_value(307,'false')) then begin if (trim(frm_op_seai.t_op_seai1.DataSet.FieldByName('业务类型').AsString)='更改单') and (frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then begin if frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString='提交审核' then begin showmessage('已经提交审核,审核通过后可以录入费用'); exit; end else begin if MessageDlg('更改单需要先提交审核才可以录入费用,是否提交',mtWarning,[mbYes,mbNo],0)=mrYes then begin frm_op_seai.t_op_seai1.DataSet.Edit; frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString:='提交审核'; frm_op_seai.t_op_seai1.DataSet.Post; end else begin showmessage('更改单必须审核通过,才能录入费用'); exit; end; end; end; end; if strtobool(get_parameters_value(307,'false')) then begin if (trim(frm_op_seai.t_op_seai1.DataSet.FieldByName('业务类型').AsString)='更改单') and (frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString='审核通过') then begin end else if (trim(frm_op_seai.t_op_seai1.DataSet.FieldByName('业务类型').AsString)='更改单') and (frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then begin showmessage('没有审核通过,不能录入费用'); exit; end; end; fra_fee1.bsSkinButton1Click(Sender); end; procedure Tfrm_op_seai.fra_fee1bsSkinButton10Click(Sender: TObject); begin if strtobool(get_parameters_value(307,'false')) then begin if (trim(frm_op_seai.t_op_seai1.DataSet.FieldByName('业务类型').AsString)='更改单') and (frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then begin if frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString='提交审核' then begin showmessage('已经提交审核,审核通过后可以录入费用'); exit; end else begin if MessageDlg('更改单需要先提交审核才可以录入费用,是否提交',mtWarning,[mbYes,mbNo],0)=mrYes then begin frm_op_seai.t_op_seai1.DataSet.Edit; frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString:='提交审核'; frm_op_seai.t_op_seai1.DataSet.Post; end else begin showmessage('更改单必须审核通过,才能录入费用'); exit; end; end; end; end; if strtobool(get_parameters_value(307,'false')) then begin if (trim(frm_op_seai.t_op_seai1.DataSet.FieldByName('业务类型').AsString)='更改单') and (frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString='审核通过') then begin end else if (trim(frm_op_seai.t_op_seai1.DataSet.FieldByName('业务类型').AsString)='更改单') and (frm_op_seai.t_op_seai1.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then begin showmessage('没有审核通过,不能录入费用'); exit; end; end; fra_fee1.bsSkinButton10Click(Sender); end; procedure Tfrm_op_seai.N1Click(Sender: TObject); begin try frm_sys_dep_emp_module:=tfrm_sys_dep_emp_module.Create (self); frm_sys_dep_emp_module.moduleNames:=frm_op_seai.caption; frm_sys_dep_emp_module.ShowModal; finally frm_sys_dep_emp_module.Free; loadreggrid(dxdbgrid1,true,caption); end; end; procedure Tfrm_op_seai.bsSkinButton35Click(Sender: TObject); begin //请求派车 if t_op_seai1.DataSet=nil then exit; if t_op_seai1.DataSet.IsEmpty then exit; if t_op_seai1.DataSet.FieldByName('是否派车').asboolean then begin showmessage('业务已经派车!!'); exit; end; if t_op_seai1.DataSet.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前业务已经封帐!!'); exit; end; if t_op_seai1.DataSet.FieldByName('请求派车').asboolean then begin if application.MessageBox('业务已经请求派车,你要取消请求吗?','警告:',MB_OKCANCEL)=IDOK then begin t_op_seai1.DataSet.edit; t_op_seai1.DataSet['请求派车']:=0; t_op_seai1.DataSet.post; end; end else begin if application.MessageBox('您确定要请求派车吗?','警告:',MB_OKCANCEL)=IDOK then begin t_op_seai1.DataSet.edit; t_op_seai1.DataSet['请求派车']:=1; t_op_seai1.DataSet.post; { Send_invocie_check_shen('申请调度派车,业务编号:'+t_op_seai1.DataSet.fieldbyname('业务编号').AsString +',主提单号:'+t_op_seai1.DataSet.fieldbyname('主提单号').AsString,'161','37',t_op_seai1.DataSet.fieldbyname('业务编号').AsString); } end; end; end; procedure Tfrm_op_seai.bsSkinButton43Click(Sender: TObject); begin if not if_open('161') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if t_op_seai1.DataSet=nil then exit; if t_op_seai1.DataSet.IsEmpty then exit; if t_op_seai1.DataSet.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前业务已经封帐!!'); exit; end; if t_op_seai1.DataSet.FieldByName('是否派车').asboolean then begin if application.MessageBox('业务已经派车,你要取消派车吗?','警告:',MB_OKCANCEL)=IDOK then begin t_op_seai1.DataSet.edit; t_op_seai1.DataSet['是否派车']:=0; t_op_seai1.DataSet['派车日期']:=null; t_op_seai1.DataSet.post; end; end else begin if application.MessageBox('您确定要派车吗?','警告:',MB_OKCANCEL)=IDOK then begin t_op_seai1.DataSet.edit; t_op_seai1.DataSet['是否派车']:=1; t_op_seai1.DataSet['派车日期']:=date; t_op_seai1.DataSet.post; end; end; end; end.