home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / kim21.zip / AUSWAHL.INC < prev    next >
Text File  |  1995-07-07  |  10KB  |  366 lines

  1.   rem Modul :  Auswahl eines Datensatzes aus einer Liste
  2.     rem Progr :  Kohle
  3.     rem Datum :  Aug 94 
  4.     
  5.     
  6.     modul dbliste(float rueck,float dbnr,char feld,char format,float anzahl,float rechts)
  7.       
  8.       deffloat a,i,taste,ENTER,_jk01,_breite
  9.       DEFSTRING objekt,old_objekt,merke_str,expr
  10.       dim _feld,1,100
  11.       dim felder,1,10
  12.       dimfloat _jk_feldwahl,1,10    : rem Felder
  13.       dimfloat _jk_format,1,10      : rem Längenformatierung
  14.       dimfloat _jk_dbpos,1,10       : rem Positionen in der DB
  15.       
  16.       rueck=0
  17.       
  18.       select feld,43,felder,1,10
  19.       for i=1 to anzahl
  20.         val felder[i],_jk_feldwahl[i]
  21.       next
  22.       clear felder,1,10
  23.       select format,43,felder,1,10
  24.       for i=1 to anzahl
  25.         val felder[i],_jk_format[i]
  26.         rem ******* H W ***************
  27.         _breite=_breite + _jk_format[i]
  28.         rem ***************************
  29.       next
  30.       
  31.       ENTER=10010
  32.       SET_KEYMAP "ENTER",ENTER,10
  33.       
  34.       call fenster_01() 
  35.       call fuellen_01(1,anzahl,dbnr)
  36.       win_paint "window_01"
  37.       add_item "window_01","input1"
  38.       
  39.       while i<>1000
  40.         win_ev i
  41.         get_item_pos objekt,taste,old_objekt
  42.         if taste=13 or taste=ENTER then
  43.           call ausw_01(objekt,taste,i,old_objekt,anzahl,dbnr,rueck,rechts)
  44.           add_item "window_01","input1"
  45.         endif
  46.       wend
  47.       SET_KEYMAP "F12",ENTER,10
  48.       event_on_item "window_01","end"
  49.       
  50.     endmod
  51.     
  52.     
  53.     MODUL ausw_01(char obj,float taste,float i,char old,float anzahl,float dbnr,float rueck,float rechts)
  54.       
  55.       deffloat flag,a,zahl,i,ENTER
  56.       defstring merke,text,zeichen
  57.       dim teil,1,20
  58.       ENTER=10010
  59.       
  60.       if obj="input1" and taste=ENTER then
  61.         get_item "input1",text
  62.         rem ******* H W ***************
  63.         if rechts=1 then
  64.           rset _jk_format1,text
  65.         endif
  66.         if rechts=2 then
  67.           ucase text
  68.         endif
  69.         rem ***************************
  70.         iread dbnr,a,text,_feld
  71.         call fuellen_01(1,anzahl,dbnr)
  72.         set_item "input1",""
  73.       endif
  74.       
  75.       
  76.       if obj="Push" then 
  77.         i=1000
  78.         rueck=-1
  79.         exitmod
  80.       endif
  81.       if obj="Push2" then
  82.         call fuellen_01(1,anzahl,dbnr)
  83.       endif
  84.       if obj="Push3" then
  85.         call fuellen_01(2,anzahl,dbnr)
  86.       endif
  87.       
  88.       mid obj,zeichen,1,3
  89.       if zeichen="lio" then
  90.         mid obj,zeichen,4,10
  91.         val zeichen,a
  92.         igo_nr dbnr,_jk_dbpos[a] 
  93.         igetrec dbnr,_feld
  94.         rueck=1
  95.         i=1000
  96.       endif
  97.       
  98.       
  99.       
  100.       
  101.     endmod
  102.     
  103.     
  104.     
  105.     MODUL fenster_01()
  106.       deffloat breit_win,breit_list
  107.       
  108.       breit_win=_breite+20
  109.       breit_list=_breite+15
  110.       def_window "window_01",2,2,breit_win,13;"modal","move off"
  111.       def_border "rand_01"
  112.       def_titel "titel_01","Auswahl";"center"
  113.       add_item "window_01","rand_01","titel_01"
  114.       
  115.       DEF_PROMPT "Feldname1",5,2,"Eingabe ";""
  116.       DEF_STRING "input1",21,2,28,"";"border","clear"
  117.       DEF_BUTTON "Push",5,1,13,"","&Abbruch";""
  118.       DEF_BUTTON "Push2",20,1,13,"","&Weiter";""
  119.       DEF_BUTTON "Push3",35,1,13,"","&Zurück";""
  120.       DEF_LIST   "List6",0,2,3,breit_list,7,0,0;"border","c8"
  121.       
  122.       
  123.       
  124.       ADD_ITEM "window_01",..
  125.       "Feldname1",..
  126.       "Push",..
  127.       "Push2",..
  128.       "Push3",..
  129.       "input1",..
  130.       "List6"
  131.       
  132.       
  133.       
  134.     ENDMOD
  135.     
  136.     modul fuellen_01(float flag,float anzahl,float dbnr)
  137.       
  138.       
  139.       defstring id$,zahl$
  140.       deffloat dateizahl,i,zahl,a,x,y,breit_list
  141.       defstring text$
  142.       
  143.       breit_list=_breite+15
  144.       
  145.       if _jk01=1 then
  146.         sub_item "window_01","List6"
  147.         DEF_LIST   "List6",0,2,3,breit_list,7,0,0;"border","c8"
  148.       endif
  149.       
  150.       if flag=2 then
  151.         iskip dbnr,-20
  152.       endif
  153.       
  154.       for i=1 to 10
  155.         igetrec dbnr,_feld
  156.         iget_nr dbnr,_jk_dbpos[i]
  157.         text$="" 
  158.         for x=1 to anzahl 
  159.           y=_jk_feldwahl[x]
  160.           set _jk_format[x],_feld[y]
  161.           text$=text$+" "+_feld[y]
  162.         next
  163.         form i,zahl$,0,1
  164.         id$="lio"+zahl$
  165.         def_string id$,0,i,80,text$
  166.         add_item "List6",id$
  167.         inext dbnr,a,_feld
  168.         if a=3 then i=501 : endif
  169.       next
  170.       if _jk01=1 then 
  171.         add_item "window_01","List6"
  172.         event_on_item "window_01","redisplay" 
  173.       endif
  174.       
  175.       _jk01=1
  176.     endmod
  177.     
  178.     MODUL meldung_speichern(float x,float y,char text1,char text2,float flag)
  179.       deffloat z,t,a
  180.       defstring obj
  181.       
  182.       call meldung_fenster_speichern(x,y)
  183.       win_paint "msg_speichern"
  184.       set_item "msg_pr1",text1
  185.       set_item "msg_pr2",text2
  186.       while z<>1000
  187.         win_ev z
  188.         get_item_pos obj,t
  189.         if t=13 then
  190.           if obj="msg_button1" then z=1000 : flag=0 :endif
  191.           if obj="msg_button2" then z=1000 : flag=1 :endif
  192.           if obj="msg_button3" then z=1000 : flag=2 :endif
  193.         endif
  194.         find_item "msg_speichern",a
  195.         if a=-1 then
  196.           z=1000
  197.         endif
  198.       wend
  199.       if a<>-1 then
  200.         event_on_item "msg_speichern","end"
  201.       endif
  202.     ENDMOD
  203.     
  204.     MODUL meldung_fenster_speichern(float x,float y)
  205.       
  206.       def_window "msg_speichern",x,y, 37,7 ;"move off","modal"
  207.       def_border "msg_border"
  208.       def_titel  "msg_titel","Meldung" ;"center"
  209.       def_button "msg_button1",2,4,9,"","&JA";"auto size"
  210.       def_button "msg_button2",24,4,9,"","&NEIN";"auto size"
  211.       def_button "msg_button3",13,4,9,"","&Abbruch";"auto size"
  212.       def_prompt "msg_pr1",5,1,"                             "
  213.       def_prompt "msg_pr2",5,2,"                             "
  214.       
  215.       add_item "msg_speichern",..
  216.       "msg_border",..
  217.       "msg_titel",..
  218.       "msg_pr1",..
  219.       "msg_pr2",..
  220.       "msg_button1",..
  221.       "msg_button3",..
  222.       "msg_button2"
  223.       
  224.     ENDMOD
  225.     
  226.     MODUL drucker_drv(char was,char steuercode)
  227.       deffloat a,i,schalt
  228.       defstring merke,zeile,teil1,teil2,zeichen
  229.       dim teile,1,50
  230.       
  231.       exist "drucker.drv",a
  232.       if a=-1 then
  233.         msgbox "Druckertreiber nicht vorhanden",0,a,""
  234.         exitmod
  235.       endif
  236.       open 6,"drucker.drv","r"
  237.       gets 6,zeile
  238.       while zeile<>"EOF" and schalt=0
  239.         mid zeile,merke,1,1
  240.         if merke="#" then
  241.           select zeile,61,teil,1,2
  242.           compress teil1
  243.           if teil1=was then
  244.             schalt=1
  245.             clear teile,1,50
  246.             select teil2,44,teile,1,50
  247.             i=1
  248.             steuercode=""
  249.             while teile[i]<>"" and i<=50
  250.               val teile[i],a
  251.               zeichen=""
  252.               stradd zeichen,chr(a)
  253.               steuercode=steuercode+zeichen
  254.               i=i+1
  255.             wend
  256.           endif
  257.         endif
  258.         gets 6,zeile
  259.       wend
  260.       close 6
  261.     ENDMOD
  262.      
  263.     MODUL show_datei(char datei)
  264.       
  265.       defstring objekt,id$,i$,zeile
  266.       deffloat ok,i,taste
  267.       
  268.       
  269.       def_window "win_info",0,2, 91,18 ;"modal"
  270.       def_border "win_info_border"
  271.       def_titel  "win_info_titel","Ausgabe" ;"center"
  272.       def_max_button "win_max_b"
  273.       add_item "win_info","win_info_border","win_max_b","win_info_titel"
  274.       
  275.       DEF_TOOLBAR   "tool_info",0,0,0,0;"region off","border"
  276.       DEF_SCROLLBAR "scroll_info",1,0,0,0,0
  277.       DEF_BUTTON    "PushButton1",3,1,15,"","Quit";""
  278.       DEF_BUTTON    "PushButton2",13,1,15,"","Druck LPT1";""
  279.       DEF_BUTTON    "PushButton3",23,1,15,"","Druck LPT2";""
  280.       DEF_LIST "text_info",0,1,0,87,15,0,0 ;"border","c8","select off"
  281.       
  282.       add_item "text_info","scroll_info"
  283.       add_item "tool_info","PushButton1","PushButton2","PushButton3"
  284.       ADD_ITEM "win_info","tool_info","text_info"
  285.       
  286.       i=1
  287.       open 11,datei,"r"
  288.       
  289.       gets 11,zeile
  290.       gets 11,zeile
  291.       while zeile<>"EOF"
  292.         form i,i$,0,1
  293.         id$="text"+i$
  294.         def_string id$,1,0,80,zeile
  295.         add_item "text_info",id$
  296.         rem event_on_item "text_info","redisplay"
  297.         gets 11,zeile
  298.         i=i+1
  299.       wend
  300.       close 11
  301.       
  302.       call tmp_fenster(0)
  303.       
  304.       win_paint "win_info"
  305.       
  306.       while i<>1000
  307.         win_ev i
  308.         get_item_pos objekt,taste
  309.         if taste=13 and objekt="PushButton1" then
  310.           kill datei
  311.           i=1000
  312.         endif
  313.         if taste=13 and objekt="PushButton2" then
  314.           call info_druck(datei,"lpt1")
  315.           i=1000
  316.         endif
  317.         if taste=13 and objekt="PushButton3" then
  318.           call info_druck(datei,"lpt2")
  319.           i=1000
  320.         endif
  321.         
  322.       wend
  323.       
  324.       event_on_item "win_info","end"
  325.       
  326.     ENDMOD
  327.      
  328.     MODUL info_druck(char datei_send,char datei_empf)
  329.       defstring zeile
  330.       
  331.       call tmp_fenster(1)
  332.       
  333.       open 11,datei_send,"r"
  334.       open 12,datei_empf
  335.       gets 11,zeile
  336.       while zeile <> "EOF"
  337.         puts 12,zeile
  338.         gets 11,zeile
  339.       wend
  340.       close 11
  341.       close 12
  342.       call tmp_fenster(0)
  343.       kill datei_send
  344.     ENDMOD
  345.     
  346.     MODUL tmp_fenster(float flag)
  347.       
  348.       if flag=1 then
  349.         def_window "msg_be",30,7,26,6 ;"move off","modal"
  350.         def_border "msg_border_be"
  351.         def_titel  "msg_titel_be","Meldung" ;"center"
  352.         def_prompt "msg_pr1_be",1,1,"Daten werden gedruckt"
  353.         def_prompt "msg_pr2_be",5,2,"Bitte warten !"
  354.         
  355.         add_item "msg_be",..
  356.         "msg_border_be",..
  357.         "msg_titel_be",..
  358.         "msg_pr1_be",..
  359.         "msg_pr2_be"
  360.         win_paint "msg_be"
  361.       else
  362.         event_on_item "msg_be","end"
  363.       endif
  364.       
  365.     ENDMOD
  366.