Umain.pas
上传用户:jiete_yjc
上传日期:2010-02-11
资源大小:422k
文件大小:11k
源码类别:

医药行业

开发平台:

Delphi

  1. unit Umain;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, Menus, XPMenu, ComCtrls, ToolWin, ExtCtrls,  dxsbar, ImgList,  Buttons,
  6.   jpeg,udm,uypzdk,uxl,udj, Uypzdk2,uyg,urk,uxstj, ukctj,ulogin, StdCtrls,uty,ubs,upd,ukl,ukc,upf,uls,uac,ucr,uback,uuser;
  7. type userinfo=record
  8.        name:string;
  9.        qx:int64;
  10.        id:int64;
  11.        end;
  12. type
  13.   Tfmain = class(TForm)
  14.     MainMenu1: TMainMenu;
  15.     yp: TMenuItem;
  16.     ch: TMenuItem;
  17.     dm: TMenuItem;
  18.     exit: TMenuItem;
  19.     tj: TMenuItem;
  20.     pd1: TMenuItem;
  21.     N18: TMenuItem;
  22.     kclist1: TMenuItem;
  23.     yplist1: TMenuItem;
  24.     ypprice: TMenuItem;
  25.     ypadd: TMenuItem;
  26.     N24: TMenuItem;
  27.     bm1: TMenuItem;
  28.     xstj: TMenuItem;
  29.     xs: TMenuItem;
  30.     pf1: TMenuItem;
  31.     ls1: TMenuItem;
  32.     bs1: TMenuItem;
  33.     rk1: TMenuItem;
  34.     ty1: TMenuItem;
  35.     N12: TMenuItem;
  36.     crlist1: TMenuItem;
  37.     N14: TMenuItem;
  38.     djsearch: TMenuItem;
  39.     support: TMenuItem;
  40.     company1: TMenuItem;
  41.     xl1: TMenuItem;
  42.     N29: TMenuItem;
  43.     mm: TMenuItem;
  44.     user1: TMenuItem;
  45.     relogin: TMenuItem;
  46.     quit: TMenuItem;
  47.     N36: TMenuItem;
  48.     N37: TMenuItem;
  49.     back1: TMenuItem;
  50.     yg1: TMenuItem;
  51.     XPMenu1: TXPMenu;
  52.     ypedit: TMenuItem;
  53.     help: TMenuItem;
  54.     about: TMenuItem;
  55.     CoolBar1: TCoolBar;
  56.     scroll1: TPageScroller;
  57.     ToolBar1: TToolBar;
  58.     ToolButton1: TToolButton;
  59.     ToolButton2: TToolButton;
  60.     ToolButton3: TToolButton;
  61.     ToolButton4: TToolButton;
  62.     ToolButton5: TToolButton;
  63.     ToolButton6: TToolButton;
  64.     ToolButton8: TToolButton;
  65.     ToolButton7: TToolButton;
  66.     ToolButton10: TToolButton;
  67.     ToolButton9: TToolButton;
  68.     ToolButton11: TToolButton;
  69.     ToolButton12: TToolButton;
  70.     ToolButton13: TToolButton;
  71.     ToolButton14: TToolButton;
  72.     ToolButton15: TToolButton;
  73.     ToolButton16: TToolButton;
  74.     ToolButton17: TToolButton;
  75.     ToolButton18: TToolButton;
  76.     ToolButton19: TToolButton;
  77.     StatusBar1: TStatusBar;
  78.     kctj: TMenuItem;
  79.     systemhelp: TMenuItem;
  80.     N41: TMenuItem;
  81.     Image1: TImage;
  82.     Timer1: TTimer;
  83.     procedure quitClick(Sender: TObject);
  84.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  85.     procedure yplist1Click(Sender: TObject);
  86.     procedure ypaddClick(Sender: TObject);
  87.     procedure ypeditClick(Sender: TObject);
  88.     procedure yppriceClick(Sender: TObject);
  89.     procedure yg1Click(Sender: TObject);
  90.     procedure bm1Click(Sender: TObject);
  91.     procedure company1Click(Sender: TObject);
  92.     procedure rk1Click(Sender: TObject);
  93.     procedure ty1Click(Sender: TObject);
  94.     procedure bs1Click(Sender: TObject);
  95.     procedure pd1Click(Sender: TObject);
  96.     procedure kclist1Click(Sender: TObject);
  97.     procedure pf1Click(Sender: TObject);
  98.     procedure FormCreate(Sender: TObject);
  99.     procedure aboutClick(Sender: TObject);
  100.     procedure systemhelpClick(Sender: TObject);
  101.     procedure supportClick(Sender: TObject);
  102.     procedure ls1Click(Sender: TObject);
  103.     procedure crlist1Click(Sender: TObject);
  104.     procedure back1Click(Sender: TObject);
  105.     procedure user1Click(Sender: TObject);
  106.     procedure FormShow(Sender: TObject);
  107.     procedure Timer1Timer(Sender: TObject);
  108.     procedure xl1Click(Sender: TObject);
  109.     procedure reloginClick(Sender: TObject);
  110.     procedure mmClick(Sender: TObject);
  111.     procedure xstjClick(Sender: TObject);
  112.     procedure djsearchClick(Sender: TObject);
  113.     procedure kctjClick(Sender: TObject);
  114.   private
  115.    FClientInstance,
  116.    FPrevClientProc : TFarProc;
  117.    PROCEDURE ClientWndProc(VAR Message: TMessage);
  118.   public
  119.     auser:userinfo;{ Public declarations }
  120.     operid:int64;
  121.   end;
  122. var
  123.   fmain: Tfmain;
  124.   ypzdk:tfypzdk;
  125.   ypzdk2:tfypzdk2;
  126.   yg:tfyg;
  127.   rk:tfrk;
  128.   ty:tfty;
  129.   bs:tfbs ;
  130.   pd:tfpd;
  131.   kc:tfkc;
  132.   pf:tfpf ;
  133.   ls:tfls;
  134.   ac:tfac;
  135.   cr:tfcr;
  136.   back:tfback;
  137.   user:tfuser;
  138.   xl:tfxl;
  139.   kl:tfkl;
  140.   xstj1:tfxstj ;
  141.   dj:tfdj;
  142.   kctj1:tfkctj;
  143. implementation
  144. {$R *.dfm}
  145. PROCEDURE TFmain.ClientWndProc(VAR Message: TMessage); 
  146. VAR 
  147.   MyDC : hDC; 
  148.   Ro, Co : Word; 
  149. begin 
  150.    with Message do
  151.     case Msg of
  152.       WM_ERASEBKGND:
  153.         begin
  154.           MyDC := TWMEraseBkGnd(Message).DC;
  155.           FOR Ro := 0 TO ClientHeight DIV Image1.Picture.Height DO
  156.             FOR Co := 0 TO ClientWIDTH DIV Image1.Picture.Width DO
  157.               BitBlt(MyDC, Co*Image1.Picture.Width, Ro*Image1.Picture.Height,
  158.                 Image1.Picture.Width, Image1.Picture.Height,
  159.                 Image1.Picture.Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
  160.           Result := 1;
  161.         end;
  162.     else
  163.        Result := CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam, lParam);
  164.     end;
  165. end; 
  166.     
  167. procedure Tfmain.quitClick(Sender: TObject);
  168. begin
  169. close;
  170. end;
  171. procedure Tfmain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  172. begin
  173. canclose:=application.MessageBox('你真的要退出吗?','退出',mb_yesno)=idyes ;
  174. if canclose then
  175. begin
  176.   try
  177.   adodm.tcr.close;
  178.   adodm.tdw.close;
  179.   adodm.tbm.close;
  180.   adodm.tyg.close;
  181.   adodm.tuser.Close;
  182.   adodm.tkc.Close;
  183.   adodm.ydconn.Close;
  184.   except
  185.   end;
  186. end;
  187. end;
  188. procedure Tfmain.yplist1Click(Sender: TObject);
  189. begin
  190. if application.FindComponent('fypzdk')=nil then
  191. begin
  192. ypzdk:=tfypzdk.create(application) ;
  193. ypzdk.Show;
  194. end
  195. else
  196. if not ypzdk.Showing then
  197. ypzdk.Show;
  198. end;
  199. procedure Tfmain.ypaddClick(Sender: TObject);
  200. begin
  201. yplist1.Click;
  202. ypzdk.BitBtn2.Click;
  203. end;
  204. procedure Tfmain.ypeditClick(Sender: TObject);
  205. begin
  206. yplist1.Click;
  207. ypzdk.search.SetFocus;
  208. end;
  209. procedure Tfmain.yppriceClick(Sender: TObject);
  210. begin
  211. if not fypzdk2.Showing then
  212. fypzdk2.Show;
  213. fypzdk2.sp1.Show;
  214. fypzdk2.look1.Show;
  215. fypzdk2.btadd.Visible:=false;
  216. fypzdk2.ls.Enabled:=true;
  217. fypzdk2.pf.Enabled:=true;
  218. end;
  219. procedure Tfmain.yg1Click(Sender: TObject);
  220. begin
  221. if application.FindComponent('fyg')=nil then
  222. begin
  223. yg:=tfyg.create(application) ;
  224. yg.Show;
  225. end
  226. else
  227. if not yg.Showing then
  228. yg.Show;
  229. yg.TabSheet1.Show;
  230. end;
  231. procedure Tfmain.bm1Click(Sender: TObject);
  232. begin
  233. if application.FindComponent('fyg')=nil then
  234. begin
  235. yg:=tfyg.create(application) ;
  236. yg.Show;
  237. end
  238. else
  239. if not yg.Showing then
  240. yg.Show;
  241. yg.TabSheet2.Show;
  242. end;
  243. procedure Tfmain.company1Click(Sender: TObject);
  244. begin
  245. if application.FindComponent('fyg')=nil then
  246. begin
  247. yg:=tfyg.create(application) ;
  248. yg.Show;
  249. end
  250. else
  251. if not yg.Showing then
  252. yg.Show;
  253. yg.TabSheet3.Show;
  254. end;
  255. procedure Tfmain.rk1Click(Sender: TObject);
  256. begin
  257. if application.FindComponent('frk')=nil then
  258. begin
  259. rk:=tfrk.create(application) ;
  260. rk.Show;
  261. end
  262. else
  263. if not rk.Showing then
  264. rk.Show;
  265. rk.Edit1.Text:=auser.name;
  266. end;
  267. procedure Tfmain.ty1Click(Sender: TObject);
  268. begin
  269.  if application.FindComponent('fty')=nil then
  270. begin
  271. ty:=tfty.create(application) ;
  272. ty.Show;
  273. end
  274. else
  275. if not ty.Showing then
  276. ty.Show;
  277. ty.Edit1.Text:=auser.name;
  278. end;
  279. procedure Tfmain.bs1Click(Sender: TObject);
  280. begin
  281. if application.FindComponent('fbs')=nil then
  282. begin
  283. bs:=tfbs.create(application) ;
  284. bs.Show;
  285. end
  286. else
  287. if not bs.Showing then
  288. bs.Show;
  289. bs.Edit1.Text:=auser.name;
  290. end;
  291. procedure Tfmain.pd1Click(Sender: TObject);
  292. begin
  293. if application.FindComponent('fpd')=nil then
  294. begin
  295. pd:=tfpd.create(application) ;
  296. pd.Show;
  297. end
  298. else
  299. if not pd.Showing then
  300. pd.Show;
  301. pd.Edit1.Text:=auser.name;
  302. end;
  303. procedure Tfmain.kclist1Click(Sender: TObject);
  304. begin
  305. if application.FindComponent('fkc')=nil then
  306. begin
  307. kc:=tfkc.create(application) ;
  308. kc.Show;
  309. end
  310. else
  311. if not kc.Showing then
  312. kc.Show;
  313. end;
  314. procedure Tfmain.pf1Click(Sender: TObject);
  315. begin
  316. if application.FindComponent('fpf')=nil then
  317. begin
  318. pf:=tfpf.create(application) ;
  319. pf.Show;
  320. end
  321. else
  322. if not pf.Showing then
  323. pf.Show;
  324. pf.Edit1.Text:=auser.name;
  325. end;
  326. procedure Tfmain.FormCreate(Sender: TObject);
  327. begin
  328.    FClientInstance := MakeObjectInstance(ClientWndProc);
  329.    FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC)); 
  330.    SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
  331. end;
  332. procedure Tfmain.aboutClick(Sender: TObject);
  333. begin
  334.  if application.FindComponent('fac')=nil then
  335. begin
  336. ac:=tfac.create(application) ;
  337. ac.Label4.Caption:='欢迎使用本公司的软件产品!' ;
  338. ac.ShowModal;
  339. end
  340. else
  341. if not ac.Showing then
  342. ac.Show;
  343. end;
  344. procedure Tfmain.systemhelpClick(Sender: TObject);
  345. begin
  346. //showmessage('本软件是测试版本,不包括此项功能!');
  347. end;
  348. procedure Tfmain.supportClick(Sender: TObject);
  349. begin
  350. //showmessage('本软件是测试版本,不包括此项功能!');
  351. end;
  352. procedure Tfmain.ls1Click(Sender: TObject);
  353. begin
  354. if application.FindComponent('fls')=nil then
  355. begin
  356. ls:=tfls.create(application) ;
  357. ls.Show;
  358. end
  359. else
  360. if not ls.Showing then
  361. ls.Show;
  362. ls.Edit1.Text:=auser.name;
  363. end;
  364. procedure Tfmain.crlist1Click(Sender: TObject);
  365. begin
  366. if application.FindComponent('fcr')=nil then
  367. begin
  368. cr:=tfcr.create(application) ;
  369. cr.Show;
  370. end
  371. else
  372. if not cr.Showing then
  373. cr.Show;
  374. end;
  375. procedure Tfmain.back1Click(Sender: TObject);
  376. begin
  377. if application.FindComponent('fback')=nil then
  378. begin
  379. back:=tfback.create(application) ;
  380. back.Show;
  381. end
  382. else
  383. if not back.Showing then
  384. back.Show;
  385. end;
  386. procedure Tfmain.user1Click(Sender: TObject);
  387. begin
  388. if application.FindComponent('fuser')=nil then
  389. begin
  390. user:=tfuser.create(application) ;
  391. user.Show;
  392. end
  393. else
  394. if not user.Showing then
  395. user.Show;
  396. end;
  397. procedure Tfmain.FormShow(Sender: TObject);
  398. begin
  399. //flogin.Edit2.Text:='';
  400. //flogin.Show;
  401. end;
  402. procedure Tfmain.Timer1Timer(Sender: TObject);
  403. begin
  404. statusbar1.Panels[0].Text:='当前时间:'+datetimetostr(now);
  405. end;
  406. procedure Tfmain.xl1Click(Sender: TObject);
  407. begin
  408. if application.FindComponent('fxl')=nil then
  409. begin
  410. xl:=tfxl.create(application) ;
  411. xl.Show;
  412. end
  413. else
  414. if not xl.Showing then
  415. xl.Show;
  416. end;
  417. procedure Tfmain.reloginClick(Sender: TObject);
  418. begin
  419. adodm.toper.Open;
  420. if adodm.toper.Locate('operid',operid,[]) then
  421.     begin
  422.           adodm.toper.edit;
  423.           adodm.toper.FieldByName('退出时间').AsDateTime:=now;
  424.           adodm.toper.Post;
  425.     end;
  426. flogin.ShowModal;
  427. end;
  428. procedure Tfmain.mmClick(Sender: TObject);
  429. begin
  430. if application.FindComponent('fkl')=nil then
  431. begin
  432. kl:=tfkl.create(application) ;
  433. kl.Show;
  434. end
  435. else
  436. if not kl.Showing then
  437. kl.Show;
  438. end;
  439. procedure Tfmain.xstjClick(Sender: TObject);
  440. begin
  441. if application.FindComponent('fxstj')=nil then
  442. begin
  443. xstj1:=tfxstj.create(application) ;
  444. xstj1.Show;
  445. end
  446. else
  447. if not xstj1.Showing then
  448. xstj1.Show;
  449. end;
  450. procedure Tfmain.djsearchClick(Sender: TObject);
  451. begin
  452. if application.FindComponent('fdj')=nil then
  453. begin
  454. dj:=tfdj.create(application) ;
  455. dj.Show;
  456. end
  457. else
  458. if not dj.Showing then
  459. dj.Show;
  460. end;
  461. procedure Tfmain.kctjClick(Sender: TObject);
  462. begin
  463.  if application.FindComponent('fkctj')=nil then
  464. begin
  465. kctj1:=tfkctj.create(application) ;
  466. kctj1.Show;
  467. end
  468. else
  469. if not kctj1.Showing then
  470. kctj1.Show;
  471. end;
  472. end.