Need help in migrating to 32 bits. Strange thing happening!

Need help in migrating to 32 bits. Strange thing happening!

Postby hag » Tue Aug 05, 2008 2:15 am

1. using a dll developed using rc2dll32. Works ok but seems to be loosing focus. I sometimes i get a message "can't open resource". But if i put a set resources to "---.dll" at top or prg it opens it. Resource was originally opened at top of the program. Why do I need to keep setting it. Whats going on?

2. shellexec doesn't work.

3. winexec opens "calc" but can't find Excel

4. Need to switch between data bases in a browse. Doesn't work with xbrowse. I can get the first one in but switching to the second one displays the top record over and over as if there is no filter or index. Works perfectly on tcbrowse no good in xbrowse.

Please need help.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Antonio Linares » Tue Aug 05, 2008 4:21 am

Harvey,

>
1. using a dll developed using rc2dll32. Works ok but seems to be loosing focus. I sometimes i get a message "can't open resource". But if i put a set resources to "---.dll" at top or prg it opens it. Resource was originally opened at top of the program. Why do I need to keep setting it. Whats going on?
>

SET RESOURCES TO <YourDLL.DLL> is also required in 32 bits applications.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Aug 05, 2008 4:22 am

Harvey,

> 2. shellexec doesn't work.

Please post the code to see how you are using it, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Aug 05, 2008 4:25 am

Harvey,

> 3. winexec opens "calc" but can't find Excel

This code is properly working here:
Code: Select all  Expand view
function Main()

   WinExec( "c:\Program Files\Microsoft Office\Office12\Excel" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Aug 05, 2008 4:26 am

Harvey,

>
4. Need to switch between data bases in a browse. Doesn't work with xbrowse. I can get the first one in but switching to the second one displays the top record over and over as if there is no filter or index. Works perfectly on tcbrowse no good in xbrowse.
>

Please provide a small and self contained example that shows how you are doing it, so we can test it here. Thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby hag » Tue Aug 05, 2008 6:01 pm

Antonio:


4. Need to switch between data bases in a browse. Doesn't work with xbrowse. I can get the first one in but switching to the second one displays the top record over and over as if there is no filter or index. Works perfectly on tcbrowse no good in xbrowse.

You asked me to send code regarding this issue.

I'll explain what is happening. The are 2 oBrw's on the screen at the same time..(no problem) ...oBrw and oBrw1
oBrw is working fine. oBrw1 loads the original data base fine but when I go to switch to another data base ( ID 106 ) calls Newfilter() the all goes wrong. It lists in the oBrw1 the first record of the new data base over and over. Its as is there is no filter or index. The code worked perfectly in 16 bit.
Then I hit ID 107 to restore the original data base and nothing happens.
All worked great in 16bits.

Code: Select all  Expand view
static function getdata()
   local oDlg, oBrw, oCol, oDbf, oFont, obrw1, oDlg1
   local oFont1, oDbc   
   local oFont2   
   local oFont3   
   local msize := 0   
   local mId    //:= 105
   local oBar   
   local oCursor   
   local oLbx   
   local oBtn   
   local otmr,osay1,osay2,osay3,oSay4   
   local mGlaccount   
   local oBtn1,oBtn2,oBtn3,oBtn4,oBtn5,oBtn6   
   local oBtn7,oBtn8,oBtn9,oBtn10,oBtn11   
   local nTop := 0,nBottom := 0,nLeft := 0,nRight := 0   
   local oGet   
   local nNetInc  := 0   
   local nAccount := gl->(recno())   
   local bFont,hFont   
   local nUnMap   := 0

   field title

   select (cAlias)      
   set order to 3

   gl->(dbseek("7130"))   
   if gl->a13 == 2
      (cAlias)->(dbseek("0047"))
      nNetInc := (cAlias)->otherdata
   else       
      (cAlias)->(dbseek("0038"))
      nNetInc := (cAlias)->otherdata
   endif   

   select (cAlias)      
   set order to 2

   mfilterset := 1 // SET TO DEFAULT DEPT ONLY

   if mFilterset == 1
      cDisplay := "Dept. 4 only."
   else       
      cDisplay := "All Depts."
   endif       

   mCurrec := 1   

   select perm

   perm->(dbgotop())      

   if nUsing == 3      
      index on perm->title to rec   
   else
      index on perm->account to rec   
   endif
   set index to rec      

   getcoors(ownd1:nTop,ownd1:nLeft,ownd1:nBottom,ownd1:nRight)

   bFont := getFontInfo(hFont)   

   DEFINE FONT oFont1 NAME "Arial"         SIZE 0,-14 //BOLD
   DEFINE FONT oFont2 NAME "Ms Sans Serif" SIZE 0,-10
   DEFINE FONT oFont3 NAME "Ms Sans Serif" SIZE 0,-12 //BOLD

    if bFont[1]   > 16 .OR. oWnd1:nRight > 850
      define dialog oDlg resource "LRG2browseTest2" of oWnd1 help mhelp font ofont3;
      TITLE "Importing Data"   
   else
      define dialog oDlg resource "LRG2browseTest2" of oWnd1 help mhelp font ofont3;
      TITLE "Importing Data"   
   endif      
   if nfp == .T.
      if bFont[1]   > 16 .OR. oWnd1:nRight > 850
         define dialog oDlg resource "nfpLRG2browseTest2" of oWnd1 help mhelp font ofont3;
         TITLE "Importing Data"   
      else
         define dialog oDlg resource "nfpLRG2browseTest2" of oWnd1 help mhelp font ofont3;
         TITLE "Importing Data"   
      endif      
   endif

   redefine column xbrowse oBrw ID 101 of oDlg;
   LINES CELL;
   FASTEDIT;
   AUTOCOLS

  oBrw:nMARQueesTYLE := MARQSTYLE_HIGHLROW   
      
   database oDbf       
   oDbf:GoTop()   
   oBrw:SetoDbf(oDbf)      
#xtranslate oDbf:perm: => oDbf:

   // PRESS ENTER AND REACT LIKE ON LEFT DBLCLICK   // 1/17/96

oBrw:bLDblClick := { | nRow, nCol | obrw1:refresh(),oBrw1:setfocus()}



   oBrw:nFreeze := 3       // FREEZE FIRST TWO COLS
   msize := 76   

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| oBrw:oDbf:perm:Combined };
   SIZE 35 LEFT HEADER "Group" COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| oBrw:oDbf:perm:Account };
   SIZE 65 LEFT HEADER "Account" COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| oBrw:oDbf:perm:Title };
   SIZE 170 LEFT HEADER "Titles" COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| trans(oBrw:oDbf:perm:debit1, '999,999,999') };
   SIZE 64 RIGHT HEADER "Debit" COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| trans(oBrw:oDbf:perm:credit1, '999,999,999') };
   SIZE 64  RIGHT HEADER "Credit" COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| oBrw:oDbf:perm:glaccount };
   SIZE 55 CENTER HEADER "Mapped to" COLOR CLR_BLACK, CLR_HGRAY

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| oBrw:oDbf:perm:nametogl };
   SIZE 120 LEFT HEADER "Mapped To Title" COLOR CLR_BLACK,   CLR_HGRAY

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| oBrw:oDbf:perm:SalesAcNo };
   SIZE 50 center HEADER "Prod. No." COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| trans(oBrw:oDbf:perm:relation, '9999,999,999') };
   SIZE 80 RIGHT HEADER "Sub-total" COLOR CLR_BLACK, CLR_WHITE

   ADD COLUMN TO xbrowse oBrw;
   DATA {|| trans(oBrw:oDbf:perm:pcnt, "999999.99") };
   SIZE 35 RIGHT HEADER "% of sales" COLOR CLR_BLACK, CLR_WHITE

   redefine button oBtn1 id 102 of oDlg ;
   action(accntorder(2),obrw:refresh(),oBrw:setfocus())

   redefine button id 103 of oDlg ;
   action(printtrial())

   redefine button oBtn2 id 104 of odlg ;
   action(accntorder(1),obrw:refresh(),oBrw:setfocus())

   [b]redefine button oBtn3 id 106 of odlg action(newfilter(2,oBrw,oBrw1,oDbf,oDlg),oBrw1:refresh),oBrw1:setfocus())[/b]

   redefine button oBtn4 id 109 of oDlg ;
   action(caspace1(),redofilter(.f.,"","",oDlg),gl->(dbsetOrder(3));   
   ,accntorder(1),gl->(dbgotop()),(cAlias)->(dbgotop()),oBrw1:refresh(),perm->(dbgotop()),oBrw:refresh(),oBrw:setfocus(),newfilter(mwhichOne,oBrw,oBrw1,oDbf,oDlg))

   redefine button oBtn5 id 111 of oDlg    

   redefine button oBtn6 id 112 of oDlg ;   // DISPLAY BALANCE SHEET
   action(caspace1(),gl->(dbsetfilter(1)),gl->(dbsetorder(1)),begbal(),redofilter(.f.,"","",oDlg),gl->(dbgotop()),;
   (cAlias)->(dbgotop()),oBrw1:refresh(),accntorder(1),perm->(dbgotop()),newfilter(mwhichOne,oBrw,oBrw1,oDbf,oDlg),oBrw:refresh(),oBrw:setfocus(),cData := "(cAlias)")

   perm->(dbgotop())

   getRidDup()   

   select (cAlias)      
   cData := (cAlias)

   DEFINE FONT oFont1 NAME "Arial"         SIZE 0,-14 //BOLD
   DEFINE FONT oFont2 NAME "Ms Sans Serif" SIZE 0,-10
   DEFINE FONT oFont3 NAME "Ms Sans Serif" SIZE 0,-12 //BOLD

   (cAlias)->(dbsetorder(3))

   redefine column xbrowse oBrw1 ID 105 of oDlg;
   LINES CELL

      oBrw1:nMARQueesTYLE := MARQSTYLE_HIGHLROW   
       
    newfilter(1,oBrw,oBrw1,oDbf)
    skip
    skip -1

     select (cAlias)   
       
    (cAlias)->(dbsetorder(3))
         
    database oDbf       
    oDbf:GoTop()   
    oBrw1:SetoDbf(oDbf)      
       
#xtranslate oDbf:(cAlias): => oDbf:

   oBrw1:nFreeze := 3       // freeze first two cols
   msize := 76   

   ADD COLUMN TO xbrowse oBrw1;
    DATA {|| if( (cAlias)->title == repli("-",30), repli(" ",30),;
    oBrw1:oDbf:(cAlias):account) };
    SIZE 45 LEFT HEADER "Account" COLOR CLR_BLACK, CLR_WHITE
      
   ADD COLUMN TO xbrowse oBrw1;
   DATA {|| if((cAlias)->title == repli("-", 30),repli(" ",30),;
   if(title == repli("-",20),repli(" ",20),;
   oBrw1:oDbf:(cAlias):title )) };
    SIZE 126 LEFT HEADER "Up Your Cash Flow(tm) Titles"  COLOR    CLR_BLACK, CLR_WHITE
      
   redefine say oSAy1 prompt mgetAssets id 200 of odlg picture "999,999,999"   update
   redefine say oSAy2 prompt mgetLia    id 201 of odlg picture "999,999,999"   update
   redefine say oSAy3 prompt mgetDif    id 203 of odlg picture "999,999,999"   update
   redefine say oSAy4 prompt cDisplay  id 204 of odlg Update

   redefine get oGet var nNetInc id 118 of oDlg picture "999,999,999"    Update Valid   (placeNet(oDlg,nNetInc),newfilter(mwhichOne,oBrw,oBrw1,oDbf,oDlg),.t.)

   redefine button oBtn7 id 107 of odlg ;
   action(newfilter(2,oBrw,oBrw1,oDbf,oDlg),oBrw1:refresh(),oBrw1:setfocus())

   redefine button oBtn9 id 110 of oDlg ;
   action(findOne())

   redefine button oBtn11 id 116 of oDlg ;
   action(LstName(oBrw,oBrw1,oDbf,odlg))


   redefine button oBtn8 id 113 of oDlg ;
   action(mfilterset:= 2,newfilter(1,oBrw,oBrw1,oDbf,oDlg),mfilterset:= 2,gl->(dbsetOrder(3)),obrw1:refresh(),oBrw1:setfocus())

   redefine button oBtn10 id 114 of oDlg ;
   action(mfilterset:= 1,newfilter(1,oBrw,oBrw1,oDbf,oDlg),mfilterset:= 1,redofilter(.t.,oDbf,oBrw1,odlg),gl->(dbsetOrder(3)),obrw1:refresh(),oBrw1:setfocus())

   redefine button id 117 of oDlg ;
   action(automap(),gettotalvalue(2,odlg),setpercent(),giveitNames(),;
   newfilter(2,oBrw,oBrw1,oDbf,oDlg),(cAlias)->(dbsetorder(1)),oBrw1:refresh(),oBrw:refresh(),oBrw:setFocus())

   redefine button id 4002 of oDlg ;
   action (CheckPL(odlg,oBrw1),(cAlias)->(dbgotop()),oBrw1:refresh(),oBrw1:setfocus())

   if nfp == .T.
      oGet:cTooltip := " When working on the statement of financial position you must enter Net Income. "+CRLF+;
      " This is necessary because the trial balance does not disclose   "+CRLF+;
      " the amount of net asset change for the trial balance period.  If you  "+CRLF+;
      " do not do this the opening financial position may be out of balance. "   

      oBtn1:cToolTip := "List the accounting data in the order"+CRLF+"of the account numbers mapped to in Up Your Cash Flow."      
      oBtn2:cToolTip := "List the accounting data in trial balance order."

      oBtn3:cToolTip := "Display Up Your Cash Flow acitvities accounts."

      oBtn4:cToolTip := "Transfer account balances as a percent of revenue to Up Your Cash Flow."

      oBtn5:cToolTip := "Read these instruction before brginning the mapping process."

      oBtn6:cToolTip := "Review Up Your Cash Flow opening financial position"+CRLF+"after you have mapped the fiancial position accounts."

      oBtn7:cToolTip := "Display Up Your Cash Flow financial position accounts."

      oBtn8:cToolTip := "Display all the expense departments available in"+CRLF+"Up Your Cash Flow activities."

      oBtn9:cToolTip := "An explanation of how expense departments "+CRLF+"are utilized in Up Your Cash Flow."

      oBtn10:cToolTip := "Display department 4 for mapping purposes."

      oBtn11:cToolTip := "Search Up Your Cash Flow data base for an expense listing."

   else   

      oGet:cTooltip := " When working on the balance sheet you must enter Net Income.    "+CRLF+;
      " This is necessary because the trial balance does not disclose   "+CRLF+;
      " the amount of net income for the trial balance period.  If you  "+CRLF+;
      " do not do this the opening balance sheet may be out of balance. "   

      oBtn1:cToolTip := "List the accounting data in the order"+CRLF+"of the account numbers mapped to in Up Your Cash Flow."      
      oBtn2:cToolTip := "List the accounting data in trial balance order."

      oBtn3:cToolTip := "Display Up Your Cash Flow profit and loss accounts."

      oBtn4:cToolTip := "Transfer account balances as a percent of sales to Up Your Cash Flow."

      oBtn5:cToolTip := "Read these instruction before brginning the mapping process."

      oBtn6:cToolTip := "Review Up Your Cash Flow opening balance sheet"+CRLF+"after you have mapped the balance sheet accounts."

      oBtn7:cToolTip := "Display Up Your Cash Flow balance sheet accounts."

      oBtn8:cToolTip := "Display all the expense departments available in"+CRLF+"Up Your Cash Flow profit and loss."

      oBtn9:cToolTip := "An explanation of how expense departments "+CRLF+"are utilized in Up Your Cash Flow."

      oBtn10:cToolTip := "Display department 4 for mapping purposes."

      oBtn11:cToolTip := "Search Up Your Cash Flow data base for an expense listing."
   endif   

   * ACTIVATE DIALOG ODLG CENTERED on init(gettotalvalue(2,odlg),;
   * oBrw:refresh(),obrw1:refresh(),perm->(dbgotop()),placeNet(oDlg,nNetInc),;
   * newfilter(2,oBrw,oBrw1,oDbf,oDlg))              

   * ACTIVATE DIALOG ODLG CENTERED on init(;
   * placeNet(oDlg,nNetInc),oBrw:refresh(),obrw1:refresh(),perm->(dbgotop()))              

   ACTIVATE DIALOG ODLG CENTERED

   select gl   

   gl->(dbsetorder(1))   
   set filter to   
   setcalc2()

   return nil                        



static function newfilter(mWhichOne,oBrw,oBrw1,oDbf,oDlg)
   local nFilterType := salestreat()
   local oldarea     := SELECT()
   local nGoTo       := perm->(recno())   

   if nFilterType == 0
      nFilterType   := 3
   endif

   giveitNames()      
   accntorder(1)

    if mWhichOne   == 1   // P&L
         
      cAlias := "gl"   
         select (cAlias)   
          
      whichdbf := .T. // USING GL

      if mFilterSet == 1

         if lYesIam == .t.

            set filter to .NOT.   Account = "3601"                      ;
            .and. .not. account   = "0100" .and. .not. account = "0125" ;
            .and. .not. account   = "0150" .and. .not. account = "0175" ;
            .and. .not. account   = "0900" .and. .not. account = "0950" ;
            .and. .not. (account >= "2055" .and. account <= "2500" )    ;    //1
            .and. .not. (account >= "3360" .and. account <= "3480" )    ;    //2
            .and. .not. (account >= "3491" .and. account <= "3544" )    ;    //3
            .and. .not. (account >= "2520" .and. account <= "2997" )    ;    //3
            .and. .not. account   = "2019"                                            ;
            .and. .not. account   = "2021"                                            ;
            .and. !(gl->account  >= '2022' .and. gl->account <= '2029') ;
            .and. !(gl->account  >= '2031' .and. gl->account <= '2038') ;
            .and. !(gl->account  >= "2010" .and. gl->account <= "2030") ;
            .And. .Not. Account   = "2030"                                              ;
            .And. .Not. Account   = "2021"                                              ;
            .And. .Not. Account   = "2019"                                              ;
            .And. .Not. Account   = "2042"                                              ;
            .And. .Not. Account   = "2044"                                              ;
            .and. .not. account   = "3800"                                            ;
            .and. .not. account  > "5000"

                    else

            if nFilterType == 1  // ONE LINE COST OF GOODS SOLD
               set filter to .NOT.   Account = "3601"                      ;
               .and. .not. account   = "0100" .and. .not. account = "0125" ;
               .and. .not. account   = "0150" .and. .not. account = "0175" ;
               .and. .not. account   = "0900" .and. .not. account = "0950" ;
               .and. .not. (account >= "2055" .and. account <= "2500" )    ;    //1
               .and. .not. (account >= "3360" .and. account <= "3480" )    ;    //2
               .and. .not. (account >= "3491" .and. account <= "3544" )    ;    //3
               .and. .not. (account >= "2520" .and. account <= "2997" )    ;    //3
               .and. !(gl->account  >= "2004" .and. gl->account <= "2008")  ;
               .AND. !(gl->account  >= '2010' .and. gl->account <= '2038')  ;
               .and. .not. account   = "3800"                                             ;
               .And. .Not. Account   = "2030"                                              ;
               .And. .Not. Account   = "2021"                                              ;
               .And. .Not. Account   = "2019"                                              ;
               .And. .Not. Account   = "2042"                                            ;
               .And. .Not. Account   = "2044"                                            ;
               .and. .not. account  >  "5000"
               skip   

            endif

            if nFilterType == 2    // MATERIAL, LABOR, OVERHEAD & FIXED COSTS

               set filter to .NOT.   gl->Account = "3601"                      ;
               .and. .not. gl->account   = "0100" .and. .not. gl->account = "0125" ;
               .and. .not. gl->account   = "0150" .and. .not. gl->account = "0175" ;
               .and. .not. gl->account   = "0900" .and. .not. gl->account = "0950" ;
               .and. .not. (gl->account >= "2055" .and. gl->account <= "2500" )    ;    //1
               .and. .not. (gl->account >= "3360" .and. gl->account <= "3480" )    ;    //2
               .and. .not. (gl->account >= "3491" .and. gl->account <= "3544" )    ;    //3
               .and. .not. (gl->account >= "2520" .and. gl->account <= "2997" )    ;    //3
               .and. .not. (gl->account >= "2004" .and. gl->account <= "2008")     ;
               .and. .not. gl->account   = "3800"                                                ;
               .and. .Not. gl->Account   = "2042"                                                 ;
               .and. .Not. gl->Account   = "2044"                                                 ;
               .and. .not. gl->account   = "2510"                                  ; //lines
               .and. .not. gl->account   = "3482"                                  ; //lines
               .and. .not. gl->account   = "3545"                                  ; //lines
               .and. .not. gl->account  >  "5000"                                                 ;
               .and. !(gl->account  >= '1500' .and. gl->account <= '1538')         ;
               .and. !(gl->account  >= '2022' .and. gl->account <= '2029')         ;
               .and. !(gl->account  >= '2031' .and. gl->account <= '2038')


            endif

            if nFilterType == 3    // DETAIL COST OF GOODS SOLD

                      select gl

                           
               set filter to .NOT.   Account = "3601"                      ;
               .and. .not. account   = "0100" .and. .not. account = "0125" ;
               .and. .not. account   = "0150" .and. .not. account = "0175" ;
               .and. .not. account   = "0900" .and. .not. account = "0950" ;
               .and. .not. (account >= "2055" .and. account <= "2500" )    ;    //1
               .and. .not. (account >= "3360" .and. account <= "3480" )    ;    //2
               .and. .not. (account >= "3491" .and. account <= "3544" )    ;    //3
               .and. .not. (account >= "2520" .and. account <= "2997" )    ;    //3
               .and. !( gl->account >= "2004" .and. gl->account <= "2008") ;
               .and. .not. account   = "3800"                                             ;
               .And. .Not. Account   = "2030"                                              ;
               .And. .Not. Account   = "2021"                                              ;
               .And. .Not. Account   = "2019"                                              ;
               .And. .Not. Account   = "2042"                                            ;
               .And. .Not. Account   = "2019"                                            ;
               .And. .Not. Account   = "2021"                                            ;
               .And. .Not. Account   = "2030"                                            ;
               .And. .Not. Account   = "2044"                                            ;
               .and. .not. account  >  "5000"
                     

               * .and. .not. account   = "2510"  ; //lines
               * .and. .not. account   = "3482"  ; //lines
               * .and. .not. account   = "3545"  ; //lines

            endif
         endif
      else

         if lYesIam == .t.

            set filter to .NOT.  Account = "3601"                      ;
            .And. .Not. Account  = "0100" .And. .Not. Account = "0125" ;
            .And. .Not. Account  = "0150" .And. .Not. Account = "0175" ;
            .and. .not. account  = "0900" .and. .not. account = "0950" ;
            .AND. .not. account  = "2019"                                             ;
            .AND. .not. account  = "2021"                                             ;
            .and. !(gl->account >= '2022' .and. gl->account <= '2029') ;
            .AND. !(gl->account >= '2031' .and. gl->account <= '2038') ;
            .and. !(gl->account >= "2010" .and. gl->account <= "2030") ;
            .and. .not. account  = "2021"                                            ;
            .And. .Not. Account   = "2030"                                              ;
            .And. .Not. Account   = "2021"                                              ;
            .And. .Not. Account   = "2019"                                              ;
            .And. .Not. Account  = "2042"                                              ;
            .And. .Not. Account  = "2044"                                              ;
            .And. .Not. Account >  "5000"

            * .and. .not. account  = "2510"                              ; //lines
            * .and. .not. account  = "3482"                              ; //lines
            * .and. .not. account  = "3545"                              ; //lines

            * .And. .Not. Account  = "2500"                                              ;
            * .And. .Not. Account  = "3480"                                              ;
            * .And. .Not. Account  = "3544"                                              ;
            * .And. .Not. Account  = "3353"                                              ;
            * .and. .not. account  = "2625"                                            ;
            * .and. .not. account  = "2720"                                            ;
            * .and. .not. account  = "2820"                                            ;
            * .and. .not. account  = "2920"                                            ;
            * .and. .not. account  = "2996"                                            ;

            //.and. .not. (account >= "2520" .and. account <= "2997" )    ;    //3


         else



                  if nFilterType == 1  // ONE LINE COST OF GOODS SOLD
                      
               set filter to .NOT.   Account = "3601"                      ;
               .and. .not. account   = "0100" .and. .not. account = "0125" ;
               .and. .not. account   = "0150" .and. .not. account = "0175" ;
               .and. .not. account   = "0900" .and. .not. account = "0950" ;
               .and. !(gl->account  >= "2004" .and. gl->account <= "2008")  ;
               .AND. !(gl->account  >= '2010' .and. gl->account <= '2038')  ;
               .and. .not. account   = "3800"                                             ;
               .And. .Not. Account   = "2030"                                              ;
               .And. .Not. Account   = "2021"                                              ;
               .And. .Not. Account   = "2019"                                              ;
               .And. .Not. Account   = "2042"                                            ;
               .And. .Not. Account   = "2044"                                            ;
               .and. .not. account  >  "5000"

               * .and. .not. account   = "2510"  ; //lines
               * .and. .not. account   = "3482"  ; //lines
               * .and. .not. account   = "3545"  ; //lines

               * .And. .Not. Account  = "2500"                                              ;
               * .And. .Not. Account  = "3480"                                              ;
               * .And. .Not. Account  = "3544"                                              ;
               * .And. .Not. Account  = "3353"                                              ;
               * .and. .not. account  = "2625"                                            ;
               * .and. .not. account  = "2720"                                            ;
               * .and. .not. account  = "2820"                                            ;
               * .and. .not. account  = "2920"                                            ;
               * .and. .not. account  = "2996"                                            ;

            endif

            if nFilterType == 2    // MATERIAL, LABOR, OVERHEAD & FIXED COSTS


               set filter to .NOT.   Account = "3601"                      ;
               .and. .not. account   = "0100" .and. .not. account = "0125" ;
               .and. .not. account   = "0150" .and. .not. account = "0175" ;
               .and. .not. account   = "0900" .and. .not. account = "0950" ;
               .and. !( gl->account >= "2004" .and. gl->account <= "2008") ;
               .and. .not. account   = "3800"                                             ;
               .And. .Not. Account   = "2030"                                              ;
               .And. .Not. Account   = "2021"                                              ;
               .And. .Not. Account   = "2019"                                              ;
               .And. .Not. Account   = "2042"                                            ;
               .And. .Not. Account   = "2044"                                            ;
               .and. .not. account  >  "5000"                                            ;
               .and. !(gl->account  >= '2022' .and. gl->account <= '2029') ;
               .and. !(gl->account  >= '2031' .and. gl->account <= '2038')

               * .and. .not. account   = "2510"                              ; //lines
               * .and. .not. account   = "3482"                              ; //lines
               * .and. .not. account   = "3545"                              ; //lines


               * .And. .Not. Account  = "2500"                                              ;
               * .And. .Not. Account  = "3480"                                              ;
               * .And. .Not. Account  = "3544"                                              ;
               * .And. .Not. Account  = "3353"                                              ;
               * .and. .not. account  = "2625"                                            ;
               * .and. .not. account  = "2720"                                            ;
               * .and. .not. account  = "2820"                                            ;
               * .and. .not. account  = "2920"                                            ;
               * .and. .not. account  = "2996"                                            ;

            endif



                  if nFilterType == 3    // DETAIL COST OF GOODS SOLD

                      select gl
                        
               set filter to .NOT.   Account = "3601"                      ;
               .and. .not. account   = "0100" .and. .not. account = "0125" ;
               .and. .not. account   = "0150" .and. .not. account = "0175" ;
               .and. .not. account   = "0900" .and. .not. account = "0950" ;
               .and. !( gl->account >= "2004" .and.  gl->account <= "2008") ;
               .and. .not. account   = "3800"                                             ;
               .AND. .not. account   = "2019"                                             ;
               .AND. .not. account   = "2021"                                             ;
               .And. .Not. Account   = "2030"                                              ;
               .And. .Not. Account   = "2021"                                              ;
               .And. .Not. Account   = "2019"                                              ;
               .And. .Not. Account   = "2042"                                            ;
               .And. .Not. Account   = "2044"                                            ;
               .and. .not. account  >  "5000"

               * .and. .not. account   = "2510"  ; //lines
               * .and. .not. account   = "3482"  ; //lines
               * .and. .not. account   = "3545"  ; //lines

               * .And. .Not. Account  = "2500"                                              ;
               * .And. .Not. Account  = "3480"                                              ;
               * .And. .Not. Account  = "3544"                                              ;
               * .And. .Not. Account  = "3353"                                              ;
               * .and. .not. account  = "2625"                                            ;
               * .and. .not. account  = "2720"                                            ;
               * .and. .not. account  = "2820"                                            ;
               * .and. .not. account  = "2920"                                            ;
               * .and. .not. account  = "2996"                                            ;

               * .and. .not. (account >= "2055" .and. account <= "2500" )    ;    //1
               * .and. .not. (account >= "3360" .and. account <= "3480" )    ;    //2
               * .and. .not. (account >= "3491" .and. account <= "3544" )    ;    //3
               * .and. .not. (account >= "2520" .and. account <= "2997" )    ;    //3

            endif

         endif

      endif


    *    database oDbf       
    *   oDbf:GoTop()   
    *   oBrw1:SetoDbf(oDbf)        
    *  #xtranslate oDbf:(cAlias): => oDbf:
             
      msgwait(" Set","Notice",.5)   
         
      if mFilterset == 1         
         cDisplay := "Dept. 4 only."
      else       
         cDisplay := "All Depts."
      endif       
      perm->(dbgoto(nGoTo))   

         select gl   
         (cAlias)->(dbgotop())
             
      return nil     

   else


         cAlias := "bal2"
         select (cAlias)

          (cAlias)->(dbgotop())
          
      if isAcorp

         if lYesIam == .T.


            set filter to .NOT.  (cAlias)->Account = "0036";
            .And. .Not. (cAlias)->Account = "0040" .And. .Not. (cAlias)->Account = "0039" ;
            .And. .Not. (cAlias)->Account = "0046" .And. .Not. (cAlias)->Account = "0047" ;
            .And. .Not. (cAlias)->Account = "0048" .And. .Not. (cAlias)->Account = "0049" ;
            .And. .Not. (cAlias)->Account = "0050" .And. .Not. (cAlias)->Account = "0051" ;
            .And. .Not. (cAlias)->Account = "0052" .And. .Not. (cAlias)->Account = "0053" ;
            .And. .Not. (cAlias)->Account = "0054"        
            skip   
            skip   -1

         else

            select (cAlias)

            set filter to .NOT.  (cAlias)->Account = "0036";
            .And. .Not. (cAlias)->Account = "0040" .And. .Not. (cAlias)->Account = "0039" ;
            .And. .Not. (cAlias)->Account = "0046" .And. .Not. (cAlias)->Account = "0047" ;
            .And. .Not. (cAlias)->Account = "0048" .And. .Not. (cAlias)->Account = "0049" ;
            .And. .Not. (cAlias)->Account = "0050" .And. .Not. (cAlias)->Account = "0051" ;
            .And. .Not. (cAlias)->Account = "0052" .And. .Not. (cAlias)->Account = "0053" ;
            .And. .Not. (cAlias)->Account = "0054" ;       
            .And. .Not. (cAlias)->Account = "0055" ;       
            .And. .Not. (cAlias)->Account = "0056" ;       
            .And. .Not. (cAlias)->Account = "0058" ;       
            .And. .Not. (cAlias)->Account = "0059"        
            skip   
            skip-1
         endif


         index on newIndex() to bal3

      else

         if lYesIam == .T.

            select (cAlias)
            (cAlias)->(dbgotop())

            set filter to .NOT. ((cAlias)->Account >= "0033" .And.  (cAlias)->Account <= "0044");
            .and. .NOT. ((cAlias)->Account >= "0048" .And.  (cAlias)->Account <= "0074")


         else
            select (cAlias)
            (cAlias)->(dbgotop())

            set filter to .NOT. ((cAlias)->Account >= "0033" .And.  (cAlias)->Account <= "0044");
            .and. .NOT. ((cAlias)->Account >= "0048" .And.  (cAlias)->Account <= "0074") ;
            .And. .Not. (cAlias)->Account = "0055" ;       
            .And. .Not. (cAlias)->Account = "0056" ;       
            .And. .Not. (cAlias)->Account = "0058" ;       
            .And. .Not. (cAlias)->Account = "0059"        
         endif

      endif


             
         (cAlias)->(dbcloseArea())
          
      use ("Generbal.I"+substr(gld,5,3)) alias (cAlias) new
      index on (cAlias)->account3  to bal3
      index on (cAlias)->account   to bal2

      set index to bal3,bal2   
      set order to 1


          select (cAlias)

          
         (cAlias)->(dbgotop())

                       database oDbf       
               oDbf:GoTop()   
              oBrw1:SetoDbf(oDbf)      
       
          // #xtranslate oDbf:bal2: => oDbf:
             
   endif

    select bal2
    //index on newIndex() to bal3
      
    (cAlias)->(dbgotop())
         
    oDlg:update()
    oBrw1:refresh()
      
   return nil 


function newIndex()
   local cRetVal 


   field title, account

   do case
      case account >= "0001"  .AND. account <= "0002"    
         cRetVal   :=  "A"+ account+title

      case account = "0065"
         cRetVal   :=  "B"+ account+title

      case account >= "0055" .and. account <= "0057"
         cRetVal   :=  "C"+ account+title

      case account >= "0003" .and. account <= "0010"
         cRetVal   :=  "D"+ account+title

      case account =  "0068"
         cRetVal   :=  "E"+ account+title

      case account >= "0011" .and. account <= "0022"
         cRetVal   :=  "F"+ account+title

      case account >= "0058" .and. account <= "0059"
         cRetVal   :=    "G"+ account+title

      case account >= "0023" .and. account <= "0029"
         cRetVal   :=    "H"+ account+title

      case account >= "0071" .and. account <= "0074"
         cRetVal   :=    "I"+ account+title

      case account >= "0030" .and. account <= "0054"
         cRetVal   :=    "J"+ account+title

      otherwise
         cRetVal   :=  "AA"+ account+title

   endcase               

   return cRetVal            



function oBal2(nVar)

Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby hag » Tue Aug 05, 2008 6:04 pm

Antonio

You asked for the shellexecute

Shellexecute('excel.exe',,cFile+"\PLFile.prn",,9)
Ut ran excel with the related file in old 16 bit not 32bit.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Antonio Linares » Tue Aug 05, 2008 10:36 pm

Harvey,

> You asked me to send code regarding this issue.

I asked for a small and self contained example :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby hag » Wed Aug 06, 2008 2:41 am

Antonio
I realize is a lot of code but look at oBrw1. :oops:

Thanks
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Antonio Linares » Wed Aug 06, 2008 5:20 am

Harvey,

Regarding ShellExecute() and Excel, this is the way to do it:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   ShellExecute( 0, "open", "test.xls" )
   MsgInfo( "done!" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby hag » Wed Aug 06, 2008 6:19 am

Antonio:

Thnks for the help on shellexec and winexec.

Will you be getting back to me on the other problem or do you want me to reduce the code?

You asked me to send code regarding this issue.

I'll explain what is happening. The are 2 oBrw's on the screen at the same time..(no problem) ...oBrw and oBrw1
oBrw is working fine. oBrw1 loads the original data base fine but when I go to switch to another data base ( ID 106 ) calls Newfilter() the all goes wrong. It lists in the oBrw1 the first record of the new data base over and over. Its as is there is no filter or index. The code worked perfectly in 16 bit.
Then I hit ID 107 to restore the original data base and nothing happens.
All worked great in 16bits.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Wed Aug 06, 2008 6:42 am

Harvey,

RE: Browse problem

Your code is very hard to read partly because you are using both database objects and alias referencing in the same code.

The xtranslates make it even harder to read. What is the point of these?

Take a look at the setoDBF() methods of both TCBrowse and TXBrowse and you will see some differences. I am not sure that you can just change the oBrw:cAlias to use a different database. Also, I see that you are defining the same oDBF object twice in your code, but it is in the same function and you are using the same object name (oDBF) for both databases.

database oDbf
oDbf:GoTop()
oBrw:SetoDbf(oDbf)
...

database oDbf
oDbf:GoTop()
oBrw1:SetoDbf(oDbf)

I don't see how this can work. You can't use the same name (oDBF) to define two different database objects in the same function. You need to define two different database objects, one for each DBF. I suggest using a more descriptive name such as oGL, or oAccount or whatever.

I am guessing that you don't understand how database objects work. Perhaps if you read my articles on OOP programming it will help. You can find them on my website here:

http://ourworld.compuserve.com/homepage ... rogram.htm

Also, your problems are not due to differences in 16bit and 32bit, but rather due to differences in FW versions. I'm sure your 16bit FW version is older than your 32bit FWH version. In the above case you are also switching to a different browse.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Wed Aug 06, 2008 6:50 am

Harvey,

I don't know if this is what you are looking for, but here it seems to be working fine to switch the alias of a xbrowse:

test.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "XBrowse.ch"

function Main()

   local oDlg, oBrw

   USE Clients

   USE Customer NEW

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE XBROWSE oBrw ID 10 OF oDlg AUTOCOLS ALIAS "Customer"

   REDEFINE BUTTON ID 20 OF oDlg ACTION ChangeAlias( oBrw, "Customer" )

   REDEFINE BUTTON ID 30 OF oDlg ACTION ChangeAlias( oBrw, "Clients" )

   ACTIVATE DIALOG oDlg

return nil

function ChangeAlias( oBrw, cAlias ) 

   oBrw:cAlias = cAlias
   oBrw:aCols = {}
   oBrw:bGoTop := oBrw:bGoBottom := oBrw:bSkip := oBrw:bBoF := oBrw:bEoF := oBrw:bBookMark := nil
   oBrw:SetRdd( .T. )
   oBrw:Adjust()
   oBrw:GoTop()
   
return nil   


Test.rc
Code: Select all  Expand view
test DIALOG 68, 43, 336, 213
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
CONTROL "", 10, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 5, 6, 325, 175
PUSHBUTTON "1st Alias", 20, 103, 191, 50, 14
PUSHBUTTON "2nd Alias", 30, 174, 191, 50, 14
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Aug 06, 2008 7:03 am

Image

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Wed Aug 06, 2008 7:20 am

Harvey,

This code:

Code: Select all  Expand view
#xtranslate oDbf:perm: => oDbf:
...

ADD COLUMN TO xbrowse oBrw;
DATA {|| oBrw:oDbf:perm:Combined };


Preprocesses to this:

Code: Select all  Expand view
ADD COLUMN TO xbrowse oBrw;
DATA {|| oBrw:oDbf:Combined };


But you can make it much easier to read like this:

Code: Select all  Expand view
ADD COLUMN TO xbrowse oBrw;
DATA oDbf:Combined ;


And it would be better with a descriptive database object name, like oPerm:

Code: Select all  Expand view
ADD COLUMN TO xbrowse oBrw;
DATA oPerm:Combined ;


Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 52 guests

cron