Results 1 to 2 of 2

Thread: Need help with clipper!

  1. #1

    Thread Starter
    Member Matias's Avatar
    Join Date
    Jun 2005
    Location
    Buenos Aires, Argentina.
    Posts
    43

    Need help with clipper!

    Hi guys, i'm trying to use a tbrowse object to show/add/del items to a database.

    So far, everything works ok. But i don't know what i have to do, so changes made on the database, reflect themselves on the tbrowse.

    For example. If a delete and item, the change is not reflected on the tbrowse 'till i press a key again.

    Also, don't know why this line:

    Code:
    @ 11,35 get vcant picture "999999" valid vcant >= 0 .AND. vcant <= xmesal read
    doesn't allow me to enter more than one digit. Ones you enter a number, the program goes on, like if i hit enter or something.

    well thanks in advance, hope u can help me.

    Matias.-

    this is the code:

    Code:
    #include "inkey.ch"
    
    public vserv
    public sinon
    private vcod
    private vfech
    private conf
    private vcant
    private vmed
    private aux
    private ren
    vconti := .t.
    rest from depura additive
    
    select 1
    use xmedica
    set index to xmedica, xmedesc
    
    select 2
    use ypartida
    set index to ypartida
    
    select 3
    use ymovim
    set index to ymcod, ymfe, ymser, ymtd, ymsmf, ytip, ymoli, ymremito, ymfech
    
    select 4
    use zsinoni
    set index to zsinini
    
    select 5
    use zserv
    set index to zsenom
    
    select 6
    use rtemp
    
    @ 5,1  clear to  5,58
    @ 5,71 clear to  5,78
    @ 7,1  clear to 19,78
    
    centrat("SALIDA DE MEDICAMENTOS","1.3.2")
    
    vremito := 0
    select ymovim
    set order to 8
    go bottom
    while remito = 0 .and. !bof()
            go(recno() - 1)
    end do
    vremito := remito
    set order to 1
    
    do while .T.
    
       auxiliar := .T.
    
       centrat("SALIDA DE MEDICAMENTOS          REMITO : "+str(vremito+1),"1.3.2")
       centram("[ESC] FINALIZAR")
    
       vmed  := space(20)
       vserv := space(6)
       vfech := date()
    
       @ 7,1 clear to 8,78
    
       select ZSERV
       set key - 1 to buscoari
       @ 7,4  say "SERVICIO [F2] : " get vserv picture "######" valid ex_sern(vserv) .AND. .NOT. empty(vserv)
       @ 7,40 say "NOMBRE : "                                                                                                
       read
       vcodserv := vserv
       set key - 1 to
    
       if lastkey() = 27 .or. empty(vserv)
          exit
       endif
    
       select ZSERV
       set index to ZSERV,ZSENOM
       seek vserv
       if found()
          @  7,50 say substr(ZSENOM,1,25)         
       endif
       set index to ZSENOM,ZSERV
       @  8,4 say  "FECHA                   : " get vfech valid (vfech <= date())       
       @  8,43 say "RESPONSABLE: " get vmed picture "@!"       
       read
    
       @  9,1 to 9,78
       @ 10,1  say "Descripcion [F2]"         
       @ 10,35 say "Cantidad"         
    
      SAVE SCREEN TO hola
      tbr2()
      RESTORE SCREEN FROM hola
    
      select rtemp
      zap
    
    enddo
    
    close all
    
    return
    
    *+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
    *+
    procedure impsaldo
    local cant
    
    select xmedica
    cant := xmedica->xmesal
    
    select rtemp
    go top
    do while .NOT. eof()
       if rtemp->codigo = vcod
          cant := cant - rtemp->cant
       endif
       skip
    enddo
    
    @ 22,10 say "Existencia farmacia: "+strtran(str(cant,9,0)," ","0") color "W+/B"
    
    return  
    
    *+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
    *+
    FUNCTION Tbr2()
       LOCAL oBrow, oCol, nKey
    
       USE rtemp
    
       //SETCOLOR("N/W")
       //SCROLL()
       //SETCOLOR("W+/BG,GR+/B")
       //SCROLL( 2, 6, 22, 72 )
       //@ 2, 6 TO 22,72 DOUBLE
    
       oBrow := TBROWSEDB( 12, 1, 19, 45 )
       oBrow:headSep := CHR(205) + CHR(209) + CHR(205) // ÍÑÍ
       oBrow:colSep  := CHR(32) + CHR(179) + CHR(32)   //  ³
    
       oCol := TBCOLUMNNEW( "DESCRIPCION", {|| rtemp->droga} )
       oBrow:addColumn( oCol )
       oCol := TBCOLUMNNEW( "CANTIDAD", {|| rtemp->cant} )
       oBrow:addColumn( oCol )
    
       WHILE .T.
    
          oBrow:refreshAll()
    
          WHILE ( !oBrow:stabilize() )
             nKey := INKEY()
             IF ( nKey != 0 )
                EXIT // abort stabilization if a key is waiting
    
             ENDIF
    
          END
    
          IF ( oBrow:stable )
             nKey := INKEY(0)
    
          ENDIF
    
          DO CASE  
          CASE nKey == K_DOWN 
             oBrow:down()
    
          CASE nKey == K_UP
             oBrow:up()
    
          CASE nKey == K_F2
    
             vcod  := space(14)
             sinon := space(25)
             vcant := 0
    
             select XMEDICA
             do busaricod
             
             select XMEDICA
             seek vcod
             @ 11,1  say substr(XMEDESC,1,25) COLOR "W/B"
    
             do impsaldo
             select XMEDICA
             @ 11,35 get vcant picture "999999" valid vcant >= 0 .AND. vcant <= xmedica->xmesal COLOR "W/B"
             read
    
             select RTEMP
             append blank
             rtemp->droga := substr(XMEDICA->XMEDESC,1,25)
             rtemp->cant := vcant
             rtemp->codigo := vcod
    
             do impsaldo
    
             oBrow:goTop()
    
          CASE nKey == K_DEL
             DELETE
    
             oBrow:refreshCurrent()
    
          CASE nKey == K_ESC
             valert := alert("QUE DESEA HACER?",{"CONTINUAR","NO GUARDAR","GUARDAR"})
    
             DO CASE
                CASE valert == 1
                     
                CASE valert == 2
                     exit 
    
                CASE valert == 3
    
                     select rtemp
                     go top
    
                     do while .NOT. eof()
    
                        vcod := rtemp->codigo
                        vcant := rtemp->cant
    
                        if auxiliar = .T.
                           vremito  := vremito+1
                           auxiliar := .F.
                        end if
    
                        select xmedica
                        seek vcod
                        field->xmesal := xmesal - vcant
    
                        select ymovim
                        append blank
                        field->codigo  := vcod
                        field->ymofech := vfech
                        field->ymotipo := "S"
                        field->ymocant := vcant
                        field->coserv  := vcodserv
                        field->ymonom  := vmed
                        field->remito  := vremito
    
                        select ypartida
                        seek vcod
                        do while vcant > 0
                           if ypasal > vcant
                              field->ypasal := ypasal - vcant
                              vcant         := 0
                           else
                              temp          := ypasal
                              field->ypasal := 0
                              vcant         -= temp
                              skip
                           endif
                        enddo
    
                        select rtemp
                        skip
           
                     enddo
                     exit
             ENDCASE
    
          ENDCASE
    
       END
    
    RETURN (NIL)
    ... and the rivers shall open for the righteous, and the rivers shall open for the righteous, and rivers shall open for the righteous, someday ....

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Need help with clipper!

    I know absolutely nothing about this language, but have you tried refreshing the oBrow object after you update the database?
    Code:
    oBrow:refreshAll()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width