unit u_tmain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ImgList, bsSkinData, BusinessSkinForm, DB, ADODB, bsSkinCtrls, dxsbar, ComCtrls, bsSkinTabs, ExtCtrls, StdCtrls, Menus, AppEvnts,dxBar, jpeg, cxControls, cxContainer, cxEdit, cxTextEdit, cxHyperLinkEdit, cxDBEdit, cxLookAndFeelPainters, cxButtons, fcLabel, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, Mask, DBCtrls, NMUDP,ShellApi, RxCombos, bsSkinBoxCtrls, RxMemDS,Winsock, wwdbedit, Wwdotdot, Wwdbcomb,IdFTP, RxLookup; type Tfrm_tmain = class(TForm) db: TADOConnection; bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinData1: TbsSkinData; bsStoredSkin1: TbsStoredSkin; ApplicationEvents1: TApplicationEvents; imglMain: TImageList; MainPageControl: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; Panel1: TPanel; Panel2: TPanel; dxbar_main: TdxSideBar; PanelTitle: TPanel; Image1: TImage; Image3: TImage; Panel4: TPanel; bsSkinGroupBox1: TbsSkinGroupBox; bsSkinGroupBox2: TbsSkinGroupBox; bsSkinGroupBox3: TbsSkinGroupBox; dxDBGrid1: TdxDBGrid; dxDBGrid2: TdxDBGrid; dxDBGrid3: TdxDBGrid; t_info_bulletin: TADOQuery; t_info_bulletin1: TDataSource; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; t_info_plan: TADOQuery; t_info_plan1: TDataSource; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridDateColumn; t_info_tell: TADOQuery; t_info_tell1: TDataSource; dxDBGrid3Column1: TdxDBGridMaskColumn; dxDBGrid3Column2: TdxDBGridDateColumn; Timer1: TTimer; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; ChatMsgRichEdit: TRichEdit; t_chat_man: TRxMemoryData; t_chat_man1: TDataSource; dxDBGrid4: TdxDBGrid; dxDBGrid4Column1: TdxDBGridMaskColumn; dxDBGrid4Column2: TdxDBGridMaskColumn; NMUDP: TNMUDP; bsSkinGroupBox4: TbsSkinGroupBox; dxDBGrid5: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; t_info_leaveword: TADOQuery; t_info_leaveword1: TDataSource; dxDBGridDateColumn1: TdxDBGridColumn; bsSkinPanel4: TbsSkinPanel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Panel3: TPanel; Image4: TImage; bsSkinGroupBox5: TbsSkinGroupBox; dxDBGrid6: TdxDBGrid; t_sum_ctn: TRxMemoryData; bsSkinPanel3: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinPanel2: TbsSkinPanel; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; Memo1: TMemo; t_sys_message_no: TADOQuery; t_sys_message_yes: TADOQuery; t_sys_message_yes1: TDataSource; dxDBGrid6Column2: TdxDBGridMaskColumn; dxDBGrid4Column3: TdxDBGridColumn; t_do_shenhe_fee: TADOQuery; t_do_shenhe_other: TADOQuery; Label2: TLabel; Label3: TLabel; qryTmp: TADOQuery; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; dxDBGrid4Column4: TdxDBGridCheckColumn; function SearchTabs(formName:string;formcaption:string):TtabSheet; procedure freeTabs(formName:string); procedure dxbar_mainItemClick(Sender: TObject; Item: TdxSideBarItem); procedure view_momo(DataSource1:TDataSource;fi:string); procedure FormResize(Sender: TObject); procedure dxDBGrid1DblClick(Sender: TObject); procedure dxDBGrid2DblClick(Sender: TObject); procedure dxDBGrid3DblClick(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure NMUDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer); procedure dxDBGrid4Click(Sender: TObject); procedure dxDBGrid5DblClick(Sender: TObject); procedure ApplicationEvents1Exception(Sender: TObject; E: Exception); procedure FormShow(Sender: TObject); procedure dbBeforeConnect(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure Memo1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure dxDBGrid6DblClick(Sender: TObject); procedure Panel3Resize(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure dxDBGrid4Exit(Sender: TObject); private { Private declarations } procedure showRpitem; public { Public declarations } end; var frm_tmain: Tfrm_tmain; employee,department,subComp:string; modify_all:boolean; if_ch_delete_do:boolean; delete_do_type_num:integer; con_net:boolean; if_log:boolean; LocalIP: String; BroadCastIP: String; G_ZWCHK : String; //税务稽查 109:TRUE 隐藏帐务 FALSE 显示帐务 G_Arrivdate : String; //审核检查 110:true 检查审核时到达日期不为空 false 到达日期可以为空 backstate,orderState:string ; //订舱 退舱 业务状态 showprice:booLean ; //客户信誉返回特加 implementation uses u_sys_about, my_sys_function, u_sys_company, u_sys_bank, u_sys_dep_emp, u_sys_employee, u_open_operation, u_open_code, u_sys_limited, u_data_share, u_op_memo, u_open_info, u_open_report, u_rp_tell, u_sys_computer, u_sys_ask, u_sys_close, u_sys_leave, u_info_plan_individual, u_info_tell_manage, u_info_render, u_info_leaveword_manage, u_sys_report_manage, u_info_bulletin, u_info_plan, u_info_tell, u_info_leaveword, u_sys_progress, u_sys_login, u_info_yijian, my_sys_chat, u_sys_message_pri, u_sys_update; {$R *.DFM} procedure Tfrm_tmain.view_momo(DataSource1:TDataSource;fi:string); //编辑字段内容 begin if DataSource1.DataSet.IsEmpty then exit; try frm_op_memo:=Tfrm_op_memo.Create(self); frm_op_memo.DBMemo1.DataSource:=DataSource1; frm_op_memo.DBMemo1.DataField:=fi; frm_op_memo.caption:=fi; frm_op_memo.ShowModal; finally frm_op_memo.free; end; end; function Tfrm_tmain.SearchTabs(formName:string;formcaption:string):TtabSheet; //查找 相应tab var i:integer; TabSheet: TbsSkinTabSheet; begin for i:=0 to MainPageControl.PageCount -1 do begin if MainPageControl.Pages[i].Hint=formName then begin MainPageControl.ActivePageIndex :=i; result:=MainPageControl.Pages[ MainPageControl.ActivePageIndex] ; exit; end; end; TabSheet:=TbsSkinTabSheet.create(self); TabSheet.PageControl:=MainPageControl; MainPageControl.ActivePageIndex :=MainPageControl.PageCount-1; MainPageControl.Pages[MainPageControl.ActivePageIndex].Hint:=formName; mainPageControl.Pages[MainPageControl.ActivePageIndex].caption:=formcaption; result:=MainPageControl.Pages[ MainPageControl.ActivePageIndex] ; end; procedure Tfrm_tmain.freeTabs(formName:string); var i:integer; begin for i:=0 to MainPageControl.PageCount -1 do begin if MainPageControl.Pages[i].Hint=formName then begin MainPageControl.Pages[i].free; break; end; end; end; procedure Tfrm_tmain.dxbar_mainItemClick(Sender: TObject; Item: TdxSideBarItem); begin if Item.Caption = '业务信息管理' then begin if not assigned(frm_open_operation) then frm_open_operation:=tfrm_open_operation.Create (self); frm_open_operation.Width:=Panel3.Width; frm_open_operation.Height:=Panel3.Height; frm_open_operation.ManualDock(Panel3,nil,alClient); frm_open_operation.show; exit; end; if Item.Caption = '代码字典维护' then begin if not assigned(frm_open_code) then frm_open_code:=tfrm_open_code.Create (self); frm_open_code.ManualDock(Panel3,nil,alClient); frm_open_code.show; exit; end; if Item.Caption = '信息资源管理' then begin if not assigned(frm_open_info) then frm_open_info:=tfrm_open_info.Create (self); frm_open_info.ManualDock(Panel3,nil,alClient); frm_open_info.show; exit; end; if Item.Caption = '统计报表分析' then begin if not assigned(frm_open_report) then frm_open_report:=tfrm_open_report.Create (self); frm_open_report.ManualDock(Panel3,nil,alClient); frm_open_report.show; exit; end; if Item.Caption = '业务计时提醒' then begin if not assigned(frm_rp_tell) then frm_rp_tell:=tfrm_rp_tell.Create (self); frm_rp_tell.ManualDock(frm_main.SearchTabs('frm_rp_tell',frm_rp_tell.caption),nil,alClient); frm_rp_tell.show; exit; end; if Item.Caption = '电脑信息' then begin try frm_sys_computer:=tfrm_sys_computer.Create (self); frm_sys_computer.ShowModal; finally frm_sys_computer.Free; end; exit; end; if Item.Caption = '关于系统' then begin if not assigned(frm_sys_about) then frm_sys_about:=tfrm_sys_about.Create (self); frm_sys_about.Show; exit; end; if Item.Caption = '升级说明' then begin try frm_sys_update:=Tfrm_sys_update.Create(self); frm_sys_update.ShowModal; finally frm_sys_update.Free; end; exit; end; { if Item.Caption = '系统帮助' then begin ShellExecute(Application.Handle,nil,PChar(ExtractFilePath(Application.ExeName)+'\Help.chm'),nil,nil,SW_NORMAL); exit; end; } if Item.Caption = '退出系统' then begin try frm_sys_close:=Tfrm_sys_close.Create(self); frm_sys_close.ShowModal; finally frm_sys_close.Free; end; exit; end; if Item.Caption = '暂时离开' then begin try frm_sys_leave:=Tfrm_sys_leave.Create(self); frm_sys_leave.ShowModal; finally frm_sys_leave.Free; end; exit; end; if Item.Caption = '企业信息维护' then begin if not if_open('003') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; try frm_sys_company:=tfrm_sys_company.Create (self); frm_sys_company.ShowModal; finally frm_sys_company.Free; end; exit; end; if Item.Caption = '部门人员设置' then begin if not if_open('002') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; try frm_sys_dep_emp:=tfrm_sys_dep_emp.Create (self); frm_sys_dep_emp.ShowModal; finally frm_sys_dep_emp.Free; end; exit; end; if Item.Caption = '银行信息维护' then begin if not if_open('004') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; try frm_sys_bank:=tfrm_sys_bank.Create (self); frm_sys_bank.ShowModal; finally frm_sys_bank.Free; end; exit; end; if Item.Caption = '个人资料维护' then begin try frm_sys_employee:=tfrm_sys_employee.Create (self); frm_sys_employee.ShowModal; finally frm_sys_employee.Free; end; exit; end; if Item.Caption = '个人计划安排' then begin if not assigned(frm_info_plan_individual) then frm_info_plan_individual:=tfrm_info_plan_individual.Create (self); frm_info_plan_individual.ManualDock(frm_main.SearchTabs('frm_info_plan_individual',frm_info_plan_individual.caption),nil,alClient); frm_info_plan_individual.show; exit; end; if Item.Caption = '个人计时提醒' then begin if not assigned(frm_info_tell_manage) then frm_info_tell_manage:=tfrm_info_tell_manage.Create (self); frm_info_tell_manage.ManualDock(frm_main.SearchTabs('frm_info_tell_manage',frm_info_tell_manage.caption),nil,alClient); frm_info_tell_manage.show; exit; end; if Item.Caption = '个人工作报告' then begin if not assigned(frm_info_render) then frm_info_render:=tfrm_info_render.Create (self); frm_info_render.ManualDock(frm_main.SearchTabs('frm_info_render',frm_info_render.caption),nil,alClient); frm_info_render.show; exit; end; if Item.Caption = '个人留言管理' then begin if not assigned(frm_info_leaveword_manage) then frm_info_leaveword_manage:=tfrm_info_leaveword_manage.Create (self); frm_info_leaveword_manage.ManualDock(frm_main.SearchTabs('frm_info_leaveword_manage',frm_info_leaveword_manage.caption),nil,alClient); frm_info_leaveword_manage.show; exit; end; if Item.Caption = '反馈意见建议' then begin try frm_info_yijian:=tfrm_info_yijian.Create (self); frm_info_yijian.ShowModal; finally frm_info_yijian.Free; frm_info_yijian:=nil; end; exit; end; if Item.Caption = '权限信息设置' then begin if not if_open('001') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if not assigned(frm_sys_limited) then frm_sys_limited:=tfrm_sys_limited.Create (self); frm_sys_limited.ManualDock(frm_main.SearchTabs('frm_sys_limited',frm_sys_limited.caption),nil,alClient); frm_sys_limited.show; exit; end; if Item.Caption = '系统报表管理' then begin if not if_open('139') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if not assigned(frm_sys_report_manage) then frm_sys_report_manage:=tfrm_sys_report_manage.Create (self); frm_sys_report_manage.ManualDock(frm_main.SearchTabs('frm_sys_report_manage',frm_sys_report_manage.caption),nil,alClient); frm_sys_report_manage.show; exit; end; end; procedure Tfrm_tmain.FormResize(Sender: TObject); var i:integer; begin if G_ZWCHK<>'TRUE' then begin i:=round((Panel4.Height-24)/5); bsSkinGroupBox3.Height:=i; bsSkinGroupBox4.Height:=i; bsSkinGroupBox2.Height:=i; bsSkinGroupBox1.Height:=i; end else begin i:=round((Panel4.Height-24)/3); bsSkinGroupBox3.Height:=i; bsSkinGroupBox4.Height:=i; bsSkinGroupBox2.Height:=i-10; bsSkinGroupBox1.Height:=5; bsSkinGroupBox5.Height:=5; end; end ; procedure Tfrm_tmain.dxDBGrid1DblClick(Sender: TObject); begin if t_info_bulletin.IsEmpty then exit; try frm_info_bulletin:=tfrm_info_bulletin.Create (self); frm_info_bulletin.ShowModal; finally frm_info_bulletin.Free; frm_info_bulletin:=nil; end; end; procedure Tfrm_tmain.dxDBGrid2DblClick(Sender: TObject); begin if t_info_plan.IsEmpty then exit; try frm_info_plan:=tfrm_info_plan.Create (self); frm_info_plan.ShowModal; finally frm_info_plan.Free; end; t_info_plan.Requery(); end; procedure Tfrm_tmain.dxDBGrid3DblClick(Sender: TObject); begin if t_info_tell.IsEmpty then exit; try frm_info_tell:=tfrm_info_tell.Create (self); frm_info_tell.ShowModal; finally frm_info_tell.Free; frm_info_tell:=nil; end; t_info_tell.Requery(); end; procedure Tfrm_tmain.Timer1Timer(Sender: TObject); var now_str,tel_str:string; get_str,do_str:integer; begin if t_info_tell.IsEmpty then begin Timer1.enabled:=false; exit; end; do_str:=86400; t_info_tell.first; now_str:=FormatDateTime('yyyy',now) +FormatDateTime('mm',now) +FormatDateTime('dd',now) +FormatDateTime('hh',now) +FormatDateTime('nn',now); while not t_info_tell.eof do begin tel_str:=FormatDateTime('yyyy',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('mm',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('dd',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('hh',t_info_tell.fieldbyname('提醒时间').asdatetime) +FormatDateTime('nn',t_info_tell.fieldbyname('提醒时间').asdatetime); if tel_str=now_str then begin try Timer1.enabled:=false; frm_info_tell:=tfrm_info_tell.Create (self); frm_info_tell.ShowModal; finally frm_info_tell.Free; frm_info_tell:= nil; Timer1.Interval:=10000; Timer1.enabled:=true; end; end else begin if (FormatDateTime('yyyy',t_info_tell.fieldbyname('提醒时间').asdatetime)=FormatDateTime('yyyy',now)) and(FormatDateTime('mm',t_info_tell.fieldbyname('提醒时间').asdatetime)=FormatDateTime('mm',now)) and(FormatDateTime('dd',t_info_tell.fieldbyname('提醒时间').asdatetime)=FormatDateTime('dd',now)) then begin get_str:=(strtoint(FormatDateTime('hh',t_info_tell.fieldbyname('提醒时间').asdatetime))- strtoint(FormatDateTime('hh',now)))*60*60+ (strtoint(FormatDateTime('nn',t_info_tell.fieldbyname('提醒时间').asdatetime))- strtoint(FormatDateTime('nn',now)))*60; if (get_str0) then do_str:=get_str; end; end; t_info_tell.next; end; if do_str=86400 then begin Timer1.enabled:=false; end else if do_str<>0 then begin Timer1.enabled:=false; Timer1.Interval:=1000*(do_str-1); Timer1.enabled:=true; end else begin Timer1.enabled:=false; end; end; procedure Tfrm_tmain.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin try frm_sys_close:=Tfrm_sys_close.Create(self); frm_sys_close.ShowModal; if frm_sys_close.ModalResult = mrOk then CanClose:=True else CanClose:=False; finally frm_sys_close.Free; end; end; procedure Tfrm_tmain.NMUDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer); var msg:array[1..255] of Char; from_ip,from_type,from_emp:wideString; i:integer; tell_str:string; begin if not if_log then exit; if employee='' then exit; NMUDP.ReadBuffer(msg,i); from_ip:=Trim(Copy(Msg,1,16)); from_type:=Trim(Copy(Msg,17,2)); from_emp:=Trim(Copy(Msg,19,10)); tell_str:=Copy(Msg,29,i-28); try strtoint(from_type); except exit; end; case strtoint(from_type) of 1: begin if (from_ip<>LocalIP) and (from_emp=employee)then begin showmessage('对不起,你的帐号在别的电脑上登陆,你将被逐出系统!!'); application.Terminate; exit; end; if (from_ip<>LocalIP) and (from_emp<>employee)then begin if t_chat_man.locate('在线职员',from_emp,[]) then begin t_chat_man.edit; t_chat_man['所在电脑']:=from_ip; t_chat_man.post; end else begin t_chat_man.insert; t_chat_man['在线职员']:=from_emp; t_chat_man['所在电脑']:=from_ip; t_chat_man['发布']:=false; if frm_data_share.t_sys_employee.locate('姓名',from_emp,[]) then begin t_chat_man['所属部门']:=frm_data_share.t_sys_employee.fieldbyname('部门名称').asstring; end; t_chat_man.post; end; Sendlogtell(from_ip); exit; end; if (from_ip=LocalIP) and (from_emp=employee)then begin Sendlogtell(from_ip); exit; end; end; 2: begin if t_chat_man.locate('在线职员',from_emp,[]) then begin t_chat_man.edit; t_chat_man['所在电脑']:=from_ip; t_chat_man.post; end else begin t_chat_man.insert; t_chat_man['在线职员']:=from_emp; if frm_data_share.t_sys_employee.locate('姓名',from_emp,[]) then begin t_chat_man['所属部门']:=frm_data_share.t_sys_employee.fieldbyname('部门名称').asstring; end; t_chat_man['所在电脑']:=from_ip; t_chat_man.post; end; end; 3: begin if t_chat_man.locate('在线职员',from_emp,[]) then begin t_chat_man.delete; end; end; 4,5: begin if from_emp<>employee then begin ChatMsgRichEdit.lines.add(from_emp+'对您说:('+datetimetostr(now)+')'+tell_str); if bsSkinTabSheet2.Showing then begin t_sys_message_no.insert; t_sys_message_no['类型']:='聊天信息'; t_sys_message_no['发送方']:=from_emp; t_sys_message_no['发送地址']:=from_ip; t_sys_message_no['接收方']:=employee; t_sys_message_no['事件描述']:=tell_str; t_sys_message_no['是否知道']:=1; t_sys_message_no['时间']:=now; t_sys_message_no.post; end else begin t_sys_message_yes.insert; t_sys_message_yes['类型']:='聊天信息'; t_sys_message_yes['发送方']:=from_emp; t_sys_message_yes['发送地址']:=from_ip; t_sys_message_yes['接收方']:=employee; t_sys_message_yes['事件描述']:=tell_str; t_sys_message_yes['是否知道']:=0; t_sys_message_yes['时间']:=now; t_sys_message_yes.post; tell_message(from_emp+'对您说:'+tell_str); end; end; end; 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34, 35,36,37,38,39,40,41,42,43,44,45,46,47,50,61: begin t_sys_message_yes.insert; case strtoint(from_type)of 6: begin t_sys_message_yes['类型']:='费用提交审核'; end; 7: begin t_sys_message_yes['类型']:='费用申请修改'; end; 8: begin t_sys_message_yes['类型']:='费用申请删除'; end; 9: begin t_sys_message_yes['类型']:='费用审核通过'; end; 10: begin t_sys_message_yes['类型']:='费用驳回提交'; end; 11: begin t_sys_message_yes['类型']:='费用批准修改'; end; 12: begin t_sys_message_yes['类型']:='费用禁止修改'; end; 13: begin t_sys_message_yes['类型']:='费用批准删除'; end; 14: begin t_sys_message_yes['类型']:='费用禁止删除'; end; 15: begin t_sys_message_yes['类型']:='申请业务发票'; end; 16: begin t_sys_message_yes['类型']:='申请修改发票'; end; 17: begin t_sys_message_yes['类型']:='申请支付费用'; end; 18: begin t_sys_message_yes['类型']:='申请修改支付'; end; 19: begin t_sys_message_yes['类型']:='批准开出发票'; end; 20: begin t_sys_message_yes['类型']:='批准支付费用'; end; 21: begin t_sys_message_yes['类型']:='批准开出发票'; end; 22: begin t_sys_message_yes['类型']:='驳回申请发票'; end; 23: begin t_sys_message_yes['类型']:='批准修改发票'; end; 24: begin t_sys_message_yes['类型']:='禁止修改发票'; end; 25: begin t_sys_message_yes['类型']:='申请发票开出'; end; 26: begin t_sys_message_yes['类型']:='批准支付费用'; end; 27: begin t_sys_message_yes['类型']:='驳回申请支付'; end; 28: begin t_sys_message_yes['类型']:='批准修改支付'; end; 29: begin t_sys_message_yes['类型']:='禁止修改支付'; end; 30: begin t_sys_message_yes['类型']:='收费核销通知'; end; 31: begin t_sys_message_yes['类型']:='收费核销完毕'; end; 32: begin t_sys_message_yes['类型']:='收费核销完毕'; end; 33: begin t_sys_message_yes['类型']:='收费核销审核'; end; 34: begin t_sys_message_yes['类型']:='申请发送快递'; end; 35: begin t_sys_message_yes['类型']:='快递确认发出'; end; 36: begin t_sys_message_yes['类型']:='驳回快递申请'; end; 37: begin t_sys_message_yes['类型']:='申请调度派车'; end; 38: begin t_sys_message_yes['类型']:='调度确认派车'; end; 39: begin t_sys_message_yes['类型']:='海运退税确认'; end; 40: begin t_sys_message_yes['类型']:='海运签单确认'; end; 41: begin t_sys_message_yes['类型']:='业务信息封帐'; end; 42: begin t_sys_message_yes['类型']:='费用信息封帐'; end; 43: begin t_sys_message_yes['类型']:='业务信息解封'; end; 44: begin t_sys_message_yes['类型']:='费用信息解封'; end; 45: begin t_sys_message_yes['类型']:='客户申请转正'; end; 46: begin t_sys_message_yes['类型']:='客户转正通过'; end; 47: begin t_sys_message_yes['类型']:='驳回客户转正'; end; 50: begin t_sys_message_yes['类型']:='海运费用解锁'; end; 61: begin t_sys_message_yes['类型']:='费用超期提醒'; end ; end; t_sys_message_yes['发送方']:=from_emp; t_sys_message_yes['发送地址']:=from_ip; t_sys_message_yes['接收方']:=employee; t_sys_message_yes['事件描述']:=tell_str; t_sys_message_yes['是否知道']:=0; t_sys_message_yes['时间']:=now; t_sys_message_yes.post; tell_message(from_emp+'对您说:'+tell_str); end; 48: begin tell_message(from_emp+'发布公告:'+tell_str); t_info_bulletin.Requery(); end; 49: begin tell_message(from_emp+'给你留言:'+tell_str); t_info_leaveword.Requery(); end; 51: begin if not strtobool(get_parameters_value(4,'false')) then tell_message(from_emp+'更改客户:'+tell_str); with frm_data_share do begin t_crm_client.Requery(); t_crm_client_all.Requery(); t_crm_client_ship.Requery(); t_crm_client_changzhan.Requery(); t_crm_client_truck.Requery(); t_crm_client_hangkong.Requery(); t_crm_client_baoguan.Requery(); t_crm_client_weituo.Requery(); t_crm_client_daili.Requery(); t_crm_client_huodai.Requery(); t_crm_client_shiper.Requery(); t_crm_client_shouhuo.Requery(); t_crm_client_tongzhi.Requery(); t_crm_client_other.Requery(); end; end; 52: begin tell_message(from_emp+'升级软件:'+tell_str); end; 53: begin if not strtobool(get_parameters_value(4,'false')) then tell_message(from_emp+'客户通告:'+tell_str); with frm_data_share do begin t_crm_client.Requery(); t_crm_client_all.Requery(); t_crm_client_ship.Requery(); t_crm_client_changzhan.Requery(); t_crm_client_truck.Requery(); t_crm_client_hangkong.Requery(); t_crm_client_baoguan.Requery(); t_crm_client_weituo.Requery(); t_crm_client_daili.Requery(); t_crm_client_huodai.Requery(); t_crm_client_shiper.Requery(); t_crm_client_shouhuo.Requery(); t_crm_client_tongzhi.Requery(); t_crm_client_other.Requery(); end; end; 54: begin with frm_data_share do begin t_crm_client.Requery(); t_crm_client_all.Requery(); t_crm_client_ship.Requery(); t_crm_client_changzhan.Requery(); t_crm_client_truck.Requery(); t_crm_client_hangkong.Requery(); t_crm_client_baoguan.Requery(); t_crm_client_weituo.Requery(); t_crm_client_daili.Requery(); t_crm_client_huodai.Requery(); t_crm_client_shiper.Requery(); t_crm_client_shouhuo.Requery(); t_crm_client_tongzhi.Requery(); t_crm_client_other.Requery(); end; end; 55: begin frm_data_share.t_sys_parameters_value.requery; end; 56: begin frm_data_share.t_code_fee.requery; end; 57: begin frm_data_share.t_code_currency.requery; end; 58: begin frm_data_share.t_code_ctn.requery; frm_data_share.t_code_ctn_de.requery; frm_data_share.t_code_ctn_kind.requery; end; 59: begin frm_data_share.t_sys_code_emp.Requery(); frm_data_share.t_sys_code_data.Requery(); end; 60: begin tell_message(from_emp+'退舱提醒:'+tell_str); t_sys_message_no.Requery(); end ; end; end; procedure Tfrm_tmain.dxDBGrid4Click(Sender: TObject); begin { if not t_chat_man.IsEmpty then begin RxDBLookupCombo1.DisplayValue:=t_chat_man.fieldbyname('在线职员').asstring; end else begin RxDBLookupCombo1.ClearValue; end; } end; procedure Tfrm_tmain.dxDBGrid5DblClick(Sender: TObject); begin if t_info_leaveword.IsEmpty then exit; try frm_info_leaveword:=tfrm_info_leaveword.Create (self); frm_info_leaveword.ShowModal; finally frm_info_leaveword.Free; frm_info_leaveword:=nil; end; t_info_leaveword.Requery(); end; procedure Tfrm_tmain.ApplicationEvents1Exception(Sender: TObject; E: Exception); begin if pos('PRIM',UpperCase(E.Message))<>0 then begin showmessage('主键重复,不能保存,请刷新数据后重新录入'); // exit; end; if pos('唯一索引',UpperCase(E.Message))<>0 then begin showmessage('主键重复,不能保存,请刷新数据后重新录入'); // exit; end; if pos('NULL',UpperCase(E.Message))<>0 then begin showmessage('数据项不能为空,当前修改不能保存'+#13#10+'请重新录入'); // exit; end; if pos('SOME VALUES MAY HAVE BEEN CHANGED',UpperCase(E.Message))<>0 then begin showmessage('数据已经被其它用户修改,当前修改不能保存'+#13#10+'请刷新数据后重新录入'); // exit; end; if (pos('connection', lowercase(E.Message))<>0) or (pos('dbnmp', lowercase(E.Message))<>0) then begin showmessage('数据库连接错误,请重新启动程序!!'); application.Terminate; // exit; end; update_wenti(E); end; procedure Tfrm_tmain.FormShow(Sender: TObject); var i,j:integer ; begin // bsSkinData1.LoadFromFile(ExtractFilePath(ParamStr(0))+'skins\skin.ini'); if not if_log then begin try frm_sys_login:=tfrm_sys_login.Create (application); frm_sys_login.ShowModal; finally frm_sys_login.Free; frm_sys_login:=NIL; end; end; if not if_log then exit; try t_chat_man.open; t_sys_message_no.open; t_sys_message_yes.Parameters[0].value:=employee; t_sys_message_yes.open; t_do_shenhe_fee.Parameters[0].value:=employee; t_do_shenhe_fee.open; t_do_shenhe_other.open; finally LocalIp:=GetLocalIP; SetBroadCastIP; SendlogIn(); end; Image4.Picture.LoadFromFile(ExtractFilePath(ParamStr(0))+'wall.jpg'); begin { if not if_open('003') then begin dxbar_main.Groups[2].Items[0].Enabled:=false; end; if not if_open('002') then begin dxbar_main.Groups[2].Items[1].Enabled:=false; end; if not if_open('001') then begin dxbar_main.Groups[2].Items[2].Enabled:=false; end; if not if_open('004') then begin dxbar_main.Groups[2].Items[3].Enabled:=false; end; if not if_open('139') then begin dxbar_main.Groups[2].Items[4].Enabled:=false; end; } end; G_ZWCHK:=get_parameters_value(109,'FALSE') ; G_Arrivdate:=get_parameters_value(110,'false') ; orderState:=get_parameters_value(114,'订舱') ; backstate:=get_parameters_value(113,'退舱') ; showRpitem ; for i:=0 to dxbar_main.GroupCount-1 do begin for j:=0 to dxbar_main.Groups[i].ItemCount-1 do begin if dxbar_main.Groups[i].Items[j].Caption='企业信息维护' then if not if_open('003') then dxbar_main.Groups[i].Items[j].Enabled:=false ; if dxbar_main.Groups[i].Items[j].Caption='部门人员设置' then if not if_open('002') then dxbar_main.Groups[i].Items[j].Enabled:=false; if dxbar_main.Groups[i].Items[j].Caption='权限信息设置' then if not if_open('001') then dxbar_main.Groups[i].Items[j].Enabled:=false; if dxbar_main.Groups[i].Items[j].Caption='银行信息维护' then if not if_open('004') then dxbar_main.Groups[i].Items[j].Enabled:=false; if dxbar_main.Groups[i].Items[j].Caption='系统报表管理' then if not if_open('139') then dxbar_main.Groups[i].Items[j].Enabled:=false; end ; end ; end; procedure Tfrm_tmain.dbBeforeConnect(Sender: TObject); begin db.ConnectionString:=connect_string('main.ini'); end; procedure Tfrm_tmain.bsSkinButton1Click(Sender: TObject); var i,ChartMan :integer ; Mybook :TBookmark ; empMsg:string ; begin if trim(Memo1.text)=''then exit; empmsg:='' ; MYbook:=t_chat_man.GetBookmark ; t_chat_man.DisableControls ; t_chat_man.First ; while not t_chat_man.Eof do begin if t_chat_man.FieldByName('发布').AsBoolean then ChartMan:=ChartMan+1 ; t_chat_man.next ; end ; if bsSkinCheckRadioBox1.Checked then begin if ChartMan<=0 then begin showmessage('你选择了私聊,请选择相应的聊天对象!!'); t_chat_man.GotoBookmark(myBook); t_chat_man.FreeBookmark(MyBook); t_chat_man.EnableControls ; exit; end; t_chat_man.First ; while not t_chat_man.eof do begin if t_chat_man.fieldbyname('发布').asBoolean then begin SendMsg_pri(t_chat_man.fieldbyname('所在电脑').asstring,trim(Memo1.text)); empmsg:=empmsg+' '+'['+t_chat_man.fieldbyname('在线职员').asstring+']' ; end; t_chat_man.next; end; ChatMsgRichEdit.lines.add('您对'+empmsg+'说:(' +datetimetostr(now)+')'+trim(Memo1.text)); end else begin SendMsg_all(trim(Memo1.text)); ChatMsgRichEdit.lines.add('您对所有人说:('+datetimetostr(now)+')'+trim(Memo1.text)); end; t_chat_man.GotoBookmark(myBook); t_chat_man.FreeBookmark(MyBook); t_chat_man.EnableControls ; Memo1.text:=''; end; procedure Tfrm_tmain.Memo1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_main.bsSkinButton1Click(Sender); end; end; procedure Tfrm_tmain.RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; Memo1.SetFocus; end; end; procedure Tfrm_tmain.dxDBGrid6DblClick(Sender: TObject); begin try frm_sys_message_pri:=tfrm_sys_message_pri.Create (self); frm_sys_message_pri.ShowModal; finally frm_sys_message_pri.Free; frm_sys_message_pri:=nil; end; end; procedure Tfrm_tmain.Panel3Resize(Sender: TObject); begin Label2.Top:=Panel3.height-40; Label3.Top:=Panel3.height-22; Label2.left:=Panel3.Width-Label2.Width-10; Label3.left:=Panel3.Width-Label2.Width-10+(Label2.Width-Label3.Width); end; procedure Tfrm_tmain.showRpitem; var MItem: TdxSideBarItem ; Mgroup:TdxSideGroup ; begin if G_ZWCHK='FALSE' then try Mgroup:=dxbar_main.Groups.Items[0] ; MItem:=Mgroup.Items.Add ; MItem.Caption:='统计报表分析' ; MItem.LargeImage:=36 ; MItem.Index:=1 ; Mgroup:=dxbar_main.Groups.Items[0] ; MItem:=Mgroup.Items.Add ; MItem.Caption:='业务计时提醒' ; MItem.LargeImage:=23 ; MItem.Index:=2 ; Mgroup:=dxbar_main.Groups.Items[2] ; MItem:=Mgroup.Items.Add ; MItem.Caption:='权限信息设置' ; MItem.LargeImage:=24 ; MItem.Index:=2 ; Except showmessage('动态创建统计报表分析失败! '); end; bsSkinGroupBox5.Visible:=G_ZWCHK<>'TRUE' ; bsSkinGroupBox1.Visible:=G_ZWCHK<>'TRUE' ; end; procedure Tfrm_tmain.N1Click(Sender: TObject); var mybook:tbookmark ; begin mybook:=t_chat_man.GetBookmark ; t_chat_man.DisableControls ; t_chat_man.First ; while not t_chat_man.Eof do begin if t_chat_man.FieldByName('发布').asboolean=true then begin t_chat_man.Edit ; t_chat_man.FieldByName('发布').asboolean:=false ; t_chat_man.Post ; end ; t_chat_man.Next ; end ; t_chat_man.GotoBookmark(mybook); t_chat_man.FreeBookmark(mybook); t_chat_man.EnableControls ; end; procedure Tfrm_tmain.N2Click(Sender: TObject); begin ChatMsgRichEdit.Text :='' ; end; procedure Tfrm_tmain.dxDBGrid4Exit(Sender: TObject); begin if t_chat_man.State in [dsedit,dsinsert] then t_chat_man.post ; end; end.