FOR NAGES- RESOLVED

Re: FOR NAGES

Postby Otto » Sat Jun 27, 2020 9:09 am

Silvio,
Have you tried my function?
I think here is the problem. I have commanded this line too.
//oBrowse:aArraydata:= aItems
Here all is working - btw this is a handy sample.
That easy one could make a ECR.
Best regards,
Otto


Code: Select all  Expand view



    #include"fivewin.ch"


    Function test()
    Local oDlg,oFolder,oFont
    Local adata:={}

    Local oBrowse
    Local oBtnServices[3]
    local nInvoice:="1234567890123"
    local lSearch:=.t.
    local lShowbutton:=.f.
    local oSelNumber


    // to simulation
      adata := addFirstRecord(nInvoice)








     DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
     DEFINE DIALOG oDlg        ;
           TITLE "test"    ;
           SIZE 1130,650 PIXEL       ;
           FONT oFont

      @  1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL  ;
           PROMPT "Prenotazioni","Pagamenti","Familiari"
           oFolder:aEnable = { .t., .f. ,.t.}

        @ 60, 02 XBROWSE  oBrowse OF oFolder:aDialogs[1] ;
            COLUMNS  1,2,3,4,5,6,7,8,9,10,11;
            HEADERS "Ico","Tipo","Servizio","Q.tà","Costo","Tot p q.tà","Dal","al","Giorni","Sconto","Totale"   ;
             PICTURES nil, nil,"@!","9999","€ 999,999.99","€ 999,999.99", "dd-mmmm-yyyy","dd-mmmm-yyyy","999","€ 999,999.99","€ 999,999.99"  ;
            COLSIZES 55, 25,130,50,90,90,140,140,50,90,120 ;
            ARRAY aData       ;
            SIZE 100,80 PIXEL  NOBORDER
             WITH OBJECT oBrowse
                :nRowHeight    := 30

               :MakeTotals()
                          :lfooter          := .T.
                          :ldrawborder:=.t.
                          :lHscroll         := .F.
                          :l2007            := .F.
                          :l2015            := .T.
                          :nStretchCol  := STRETCHCOL_WIDEST
                          :lAllowRowSizing     := .F.
                          :lAllowColSwapping   := .F.
                          :lAllowColHiding     := .F.
                          :nMarqueeStyle       := 4
                          :CreateFromCode()
                END








        @ 260,80 BUTTONBMP oSelBtn;
         RESOURCE "INVOICE_SELBTN" ;
         PROMPT "   test new" SIZE 85,15  PIXEL OF  oDlg;
         TEXTRIGHT ;
        ACTION (lSearch:=!lsearch, ;
        Search_New( oBrowse,nInvoice,lSearch,@lShowbutton,@oSelNumber, aData),;
         oSelNumber:refresh())



       @ 260,280 BUTTONBMP oSelNumber;
         PROMPT " test  new Select number" SIZE 85,15  PIXEL OF  oDlg;
         TEXTRIGHT UPDATE;
        ACTION (Search_New(oBrowse,nInvoice,.f.,@lShowbutton,@oSelNumber))  WHEN lShowbutton



                   oDlg:bResized  := <||
                         oRect                := oDlg:GetCliRect()
                         oFolder:nWidth       := oRect:nRight-2
                         oFolder:nHeight      := oRect:nBottom-160
                         oBrowse:nTop         := oRect:nBottom-350
                         oBrowse:nWidth       := oRect:nWidth - 15
                           return nil
                     >


                     ACTIVATE DIALOG oDlg  ;
                     ON INIT (SerVices(oFolder,adata,nInvoice,obrowse),;
                              oSelNumber:disable(),;
                              EVAL( oDlg:bResized) )
     RETURN NIL
    //-------------------------------------------------------------//
       //



    Function addFirstRecord(nInvoice)
       Local atmp:= {}

      local cIcoPro  ,;
                 cTipo    ,;
                 cDescPro ,;
                 nQta     ,;
                 nPreUni  ,;
                 nPreTot  ,;
                 nTotQta  ,;
                 dDataIni ,;
                 dDataFin ,;
                 nGiorni  ,;
                 nSconto  ,;
                 nTotaleRiga  ,;
                 lPrintA4 ,;
                 lPrintPos,;
                 cStruttura,;
                 cDescBreve,;
                 serial,ntotale


      // to make a simulation

                 cIcoPro  := ".\bitmaps\ombrellone.png"
                 cTipo    := "E"
                 cDescPro := "OMBRELLONE"
                 nQta     := 1
                 nPreUni  := 6
                 nPreTot  := 6
                 nTotQta  := 1
                 dDataIni := date()
                 dDataFin := date()
                 nGiorni  := 1
                 nSconto  := 0
                 nTotaleRiga := 6
                 lPrintA4 := .f.
                 lPrintPos:= .f.
                 cStruttura:=""
                 cDescBreve:=""
                 serial :=1
                 nTotale:= nPreUni* nQta


        AaDd(aTmp,{  cIcoPro  ,;
                              cTipo    ,;
                              cDescPro ,;
                              nQta     ,;
                              nPreUni  ,;
                              nTotQta  ,;
                              dDataIni ,;
                              dDataFin ,;
                              nGiorni  ,;
                              nSconto  ,;
                              nTotale  ,;
                              nInvoice ,;
                              lPrintA4 ,;
                              lPrintPos,;
                              cStruttura,;
                              cDescBreve,;
                              serial  })

         return aTmp
    //---------------------------------------------------------------//


    Function Search_New(oBrowse,nInvoice,lSearch,lShowbutton,oSelNumber, adata)
       
 
       If lSearch
          adata:= {}  //empty

          oSelNumber:enable()
          lShowbutton:=.t.
          oSelNumber:Refresh()

       ELSE
          adata :=  addNewRecord(nInvoice)

          oSelNumber:Disable()
          lShowbutton:=.F.
          oSelNumber:Refresh()


       ENDIf

      // oBrowse:aArraydata:= adata
       oBrowse:refresh()
       
       



       return nil

     //---------------------------------------------------------------//


     Function addNewRecord(nInvoice)
       Local atmp:= {}

      local cIcoPro  ,;
                 cTipo    ,;
                 cDescPro ,;
                 nQta     ,;
                 nPreUni  ,;
                 nPreTot  ,;
                 nTotQta  ,;
                 dDataIni ,;
                 dDataFin ,;
                 nGiorni  ,;
                 nSconto  ,;
                 nTotaleRiga  ,;
                 lPrintA4 ,;
                 lPrintPos,;
                 cStruttura,;
                 cDescBreve,;
                 serial,ntotale


      // to make a simulation

                 cIcoPro  := ".\bitmaps\ombrellone.png"
                 cTipo    := "E"
                 cDescPro := "OMBRELLONE"
                 nQta     := 1
                 nPreUni  := 6
                 nPreTot  := 6
                 nTotQta  := 1
                 dDataIni := date()+2
                 dDataFin := date()+5
                 nGiorni  := 1
                 nSconto  := 0
                 nTotaleRiga := 6
                 lPrintA4 := .f.
                 lPrintPos:= .f.
                 cStruttura:=""
                 cDescBreve:=""
                 serial :=1
                 nTotale:= nPreUni* nQta


        AaDd(aTmp,{  cIcoPro  ,;
                              cTipo    ,;
                              cDescPro ,;
                              nQta     ,;
                              nPreUni  ,;
                              nTotQta  ,;
                              dDataIni ,;
                              dDataFin ,;
                              nGiorni  ,;
                              nSconto  ,;
                              nTotale  ,;
                              nInvoice ,;
                              lPrintA4 ,;
                              lPrintPos,;
                              cStruttura,;
                              cDescBreve,;
                              serial  })

         return aTmp
    //---------------------------------------------------------------//


    Function SerVices(oFolder,adata,nInvoice,obrowse)
       local aServices:={ {"Bed",8},;
                  {"Chair",6},;
                  {"Seat",12}}
       Local abtnServices[3]
       local nservizio
       local cDesc,nPrice
       local nRow:= 100
       local nCol:= 10

       For nServizio =1  to 3

                   cDesc:=  aServices[nServizio][1]
                   nPrice:= aServices[nServizio][2]



           @ nRow, ncol BTNBMP aBtnservices[nServizio] ;
               SIZE 192,95 PIXEL FLAT  ;
               PROMPT cDesc +CRLF+ ltrim(str(nPrice)) ;
               OF oFolder:aDialogs[1]

                aBtnservices[nServizio]:Cargo   :=  {cDesc,nPrice}
                aBtnservices[nServizio]:bAction := { | oBtnpro | InsertServices(oBtnpro,nInvoice,adata,obrowse) ,obrowse:gobottom(),obrowse:setfocus(), obrowse:refresh()}



               ncol+=200


         Next

      return nil

     //---------------------------------------------------------------//

    Function InsertServices(oBtnpro,nInvoice,adata,obrowse)
       // simulation insertion products
       Local cProdDesc    := oBtnpro:Cargo[1]
       Local nProdPrice   := oBtnpro:Cargo[2]

           local cIcoPro:=""  ,;
                 cTipo  :="S"  ,;
                 cDescPro := cProdDesc,;
                 nQta     := 1,;
                 nPreUni  :=nProdPrice,;
                 nPreTot  :=  nPreUni*nQta,;
                 nTotQta  :=  nPreTot,;
                 dDataIni := date(),;
                 dDataFin := date(),;
                 nGiorni  := 1,;
                 nSconto  := 0,;
                 nTotaleRiga :=nTotQta *nGiorni ,;
                 lPrintA4 := .t.,;
                 lPrintPos:= .t.,;
                 cStruttura:= "",;
                 cDescBreve:= "",;
                 nUni:= 0       ,;
                  nSerial := 0





          AaDd(aData,{  cIcoPro  ,;
                              cTipo    ,;
                              cDescPro ,;
                              nQta     ,;
                              nPreUni  ,;
                              nTotQta  ,;
                              dDataIni   ,;
                              dDataFin    ,;
                              nGiorni  ,;
                              nSconto  ,;
                              nTotaleRiga ,;
                              nInvoice ,;
                              lPrintA4 ,;
                              lPrintPos,;
                              cStruttura,;
                              cDescBreve,;
                              nSerial,;
                              nUni  })
 

            obrowse:refresh()
 
     return nil
     

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6008
Joined: Fri Oct 07, 2005 7:07 pm

Re: FOR NAGES

Postby Silvio.Falconi » Sat Jun 27, 2020 9:47 am

YES I tried your test

please erase the cache or your obj folder

Please follow me
compile the test


1 ) when you open the exe you see a record on xbrowse,now you can press the services and the procedure inserts the services in xbrowse

2) now you have to press the "Test New" button the xbrowse remains as before (wrong)

3) if you press "test new" again, activate the other button, press and xbrowse remains as before (you can see it from the dates and services that remain)


now instead cpy and compile this my test

Code: Select all  Expand view

#include"fivewin.ch"
static adata

Function test()
Local oDlg,oFolder,oFont


Local oBrowse
Local oBtnServices[3]
local nInvoice:="1234567890123"
local lSearch:=.t.
local lShowbutton:=.f.
local oSelNumber


// to simulation
  adata:={}
  adata := addFirstRecord(nInvoice)








 DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
 DEFINE DIALOG oDlg        ;
       TITLE "test"    ;
       SIZE 1130,650 PIXEL       ;
       FONT oFont

  @  1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL  ;
       PROMPT "Prenotazioni","Pagamenti","Familiari"
       oFolder:aEnable = { .t., .f. ,.t.}

    @ 60, 02 XBROWSE  oBrowse OF oFolder:aDialogs[1] ;
        COLUMNS  1,2,3,4,5,6,7,8,9,10,11;
        HEADERS "Ico","Tipo","Servizio","Q.tà","Costo","Tot p q.tà","Dal","al","Giorni","Sconto","Totale"   ;
         PICTURES nil, nil,"@!","9999","€ 999,999.99","€ 999,999.99", "dd-mmmm-yyyy","dd-mmmm-yyyy","999","€ 999,999.99","€ 999,999.99"  ;
        COLSIZES 55, 25,130,50,90,90,140,140,50,90,120 ;
        ARRAY aData       ;
        SIZE 100,80 PIXEL  NOBORDER
         WITH OBJECT oBrowse
            :nRowHeight    := 30

           :MakeTotals()
                      :lfooter          := .T.
                      :ldrawborder:=.t.
                      :lHscroll         := .F.
                      :l2007            := .F.
                      :l2015            := .T.
                      :nStretchCol  := STRETCHCOL_WIDEST
                      :lAllowRowSizing     := .F.
                      :lAllowColSwapping   := .F.
                      :lAllowColHiding     := .F.
                      :nMarqueeStyle       := MARQSTYLE_HIGHLROWMS
                      :CreateFromCode()
            END








    @ 260,80 BUTTONBMP oSelBtn;
     RESOURCE "INVOICE_SELBTN" ;
     PROMPT "   test new" SIZE 85,15  PIXEL OF  oDlg;
     TEXTRIGHT ;
    ACTION (lSearch:=!lsearch, ;
    Search_New(oBrowse,nInvoice,lSearch,@lShowbutton,@oSelNumber),;
     oSelNumber:refresh())



   @ 260,280 BUTTONBMP oSelNumber;
     PROMPT " test  new Select number" SIZE 85,15  PIXEL OF  oDlg;
     TEXTRIGHT UPDATE;
    ACTION (Search_New(oBrowse,nInvoice,.f.,@lShowbutton,@oSelNumber))  WHEN lShowbutton



               oDlg:bResized  := <||
                     oRect                := oDlg:GetCliRect()
                     oFolder:nWidth       := oRect:nRight-2
                     oFolder:nHeight      := oRect:nBottom-160
                     oBrowse:nTop         := oRect:nBottom-350
                     oBrowse:nWidth       := oRect:nWidth - 15
                       return nil
                 >


                 ACTIVATE DIALOG oDlg  ;
                 ON INIT (SerVices(oFolder,adata,nInvoice,obrowse),;
                          oSelNumber:disable(),;
                          EVAL( oDlg:bResized) )
 RETURN NIL
//-------------------------------------------------------------//

Function addFirstRecord(nInvoice)
   Local atmp:= {}

  local cIcoPro  ,;
             cTipo    ,;
             cDescPro ,;
             nQta     ,;
             nPreUni  ,;
             nPreTot  ,;
             nTotQta  ,;
             dDataIni ,;
             dDataFin ,;
             nGiorni  ,;
             nSconto  ,;
             nTotaleRiga  ,;
             lPrintA4 ,;
             lPrintPos,;
             cStruttura,;
             cDescBreve,;
             serial,ntotale


  // to make a simulation

             cIcoPro  := ".\bitmaps\ombrellone.png"
             cTipo    := "E"
             cDescPro := "OMBRELLONE"
             nQta     := 1
             nPreUni  := 6
             nPreTot  := 6
             nTotQta  := 1
             dDataIni := date()
             dDataFin := date()
             nGiorni  := 1
             nSconto  := 0
             nTotaleRiga := 6
             lPrintA4 := .f.
             lPrintPos:= .f.
             cStruttura:=""
             cDescBreve:=""
             serial :=1
             nTotale:= nPreUni* nQta


    AaDd(aTmp,{  cIcoPro  ,;
                          cTipo    ,;
                          cDescPro ,;
                          nQta     ,;
                          nPreUni  ,;
                          nTotQta  ,;
                          dDataIni ,;
                          dDataFin ,;
                          nGiorni  ,;
                          nSconto  ,;
                          nTotale  ,;
                          nInvoice ,;
                          lPrintA4 ,;
                          lPrintPos,;
                          cStruttura,;
                          cDescBreve,;
                          serial  })

     return aTmp
//---------------------------------------------------------------//


Function Search_New(oBrowse,nInvoice,lSearch,lShowbutton,oSelNumber)
   Local aItems:= {}
   * adata:={}
   If lSearch
      *aItems:= {}    //empty

      oSelNumber:enable()
      lShowbutton:=.t.
      oSelNumber:Refresh()

   ELSE

        aItems:=  addNewRecord(nInvoice)
       * adata:=  addNewRecord(nInvoice)

      oSelNumber:Disable()
      lShowbutton:=.F.
      oSelNumber:Refresh()


   ENDIf

  oBrowse:aArraydata:= aItems
   oBrowse:refresh()
   oBrowse:goBottom()
   oBrowse:setfocus()

 *  xbrowser  oBrowse:aArraydata

 return nil


 //---------------------------------------------------------------//


 Function addNewRecord(nInvoice)
   Local atmp:= {}

  local cIcoPro  ,;
             cTipo    ,;
             cDescPro ,;
             nQta     ,;
             nPreUni  ,;
             nPreTot  ,;
             nTotQta  ,;
             dDataIni ,;
             dDataFin ,;
             nGiorni  ,;
             nSconto  ,;
             nTotaleRiga  ,;
             lPrintA4 ,;
             lPrintPos,;
             cStruttura,;
             cDescBreve,;
             serial,ntotale


  // to make a simulation

             cIcoPro  := ".\bitmaps\ombrellone.png"
             cTipo    := "E"
             cDescPro := "OMBRELLONE"
             nQta     := 1
             nPreUni  := 6
             nPreTot  := 6
             nTotQta  := 1
             dDataIni := date()+2
             dDataFin := date()+5
             nGiorni  := 1
             nSconto  := 0
             nTotaleRiga := 6
             lPrintA4 := .f.
             lPrintPos:= .f.
             cStruttura:=""
             cDescBreve:=""
             serial :=1
             nTotale:= nPreUni* nQta


    AaDd(aTmp,{  cIcoPro  ,;
                          cTipo    ,;
                          cDescPro ,;
                          nQta     ,;
                          nPreUni  ,;
                          nTotQta  ,;
                          dDataIni ,;
                          dDataFin ,;
                          nGiorni  ,;
                          nSconto  ,;
                          nTotale  ,;
                          nInvoice ,;
                          lPrintA4 ,;
                          lPrintPos,;
                          cStruttura,;
                          cDescBreve,;
                          serial  })

     return aTmp
//---------------------------------------------------------------//


Function SerVices(oFolder,adata,nInvoice,obrowse)
   local aServices:={ {"Bed",8},;
              {"Chair",6},;
              {"Seat",12}}
   Local abtnServices[3]
   local nservizio
   local cDesc,nPrice
   local nRow:= 100
   local nCol:= 10

   For nServizio =1  to 3

               cDesc:=  aServices[nServizio][1]
               nPrice:= aServices[nServizio][2]



       @ nRow, ncol BTNBMP aBtnservices[nServizio] ;
           SIZE 192,95 PIXEL FLAT  ;
           PROMPT cDesc +CRLF+ ltrim(str(nPrice)) ;
           OF oFolder:aDialogs[1]

            aBtnservices[nServizio]:Cargo   :=  {cDesc,nPrice}
            aBtnservices[nServizio]:bAction := { | oBtnpro | InsertServices(oBtnpro,nInvoice,adata,obrowse) }



           ncol+=200


     Next

  return nil

 //---------------------------------------------------------------//

Function InsertServices(oBtnpro,nInvoice,adata,obrowse)
   // simulation insertion products
   Local cProdDesc    := oBtnpro:Cargo[1]
   Local nProdPrice   := oBtnpro:Cargo[2]

       local cIcoPro:=""  ,;
             cTipo  :="S"  ,;
             cDescPro := cProdDesc,;
             nQta     := 1,;
             nPreUni  :=nProdPrice,;
             nPreTot  :=  nPreUni*nQta,;
             nTotQta  :=  nPreTot,;
             dDataIni := date(),;
             dDataFin := date(),;
             nGiorni  := 1,;
             nSconto  := 0,;
             nTotaleRiga :=nTotQta *nGiorni ,;
             lPrintA4 := .t.,;
             lPrintPos:= .t.,;
             cStruttura:= "",;
             cDescBreve:= "",;
             nUni:= 0       ,;
              nSerial := 0





      AaDd(oBrowse:aArraydata,{  cIcoPro  ,;
                          cTipo    ,;
                          cDescPro ,;
                          nQta     ,;
                          nPreUni  ,;
                          nTotQta  ,;
                          dDataIni   ,;
                          dDataFin    ,;
                          nGiorni  ,;
                          nSconto  ,;
                          nTotaleRiga ,;
                          nInvoice ,;
                          lPrintA4 ,;
                          lPrintPos,;
                          cStruttura,;
                          cDescBreve,;
                          nSerial,;
                          nUni  })


   oBrowse:refresh()
   oBrowse:goBottom()
   oBrowse:setfocus()
         xbrowser oBrowse:aArraydata
 return nil
 



now follow all three points above and you will see the differences
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: FOR NAGES

Postby Otto » Sat Jun 27, 2020 12:48 pm

Silvio,
but this are now other problems.

2) now you have to press the "Test New" button the xbrowse remains as before (wrong)


@ 260,80 BUTTONBMP oSelBtn;
RESOURCE "INVOICE_SELBTN" ;
PROMPT " test new" SIZE 85,15 PIXEL OF oDlg;
TEXTRIGHT ;
ACTION ( msginfo(lSearch) , lSearch := !lsearch, msginfo(lSearch) ,;
Search_New( oBrowse,nInvoice,lSearch,@lShowbutton,@oSelNumber, aData),;
oSelNumber:refresh()))
With the first action you change lSearch to .f. and then you addNewRecord()


If lSearch

adata:= {} //empty
xbrowse( adata )
oSelNumber:enable()
lShowbutton := .t.
oSelNumber:Refresh()
oBrowse:refresh()
oBrowse:gotop()

ELSE
adata := addNewRecord(nInvoice)

oSelNumber:Disable()
lShowbutton:=.F.
oSelNumber:Refresh()


ENDIf


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6008
Joined: Fri Oct 07, 2005 7:07 pm

Re: FOR NAGES

Postby Otto » Sat Jun 27, 2020 1:08 pm

Silvio,
then change


Function Search_New(oBrowse,nInvoice,lSearch,lShowbutton,oSelNumber, adata)
If lSearch
//adata:= {} //empty
aSize( aData, 0 )
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6008
Joined: Fri Oct 07, 2005 7:07 pm

Re: FOR NAGES

Postby Otto » Sat Jun 27, 2020 1:11 pm

Code: Select all  Expand view


#include"fivewin.ch"

Function test()
   Local oDlg,oFolder,oFont
   Local adata:={}
   Local oBrowse
   Local oBtnServices[3]
   local nInvoice:="1234567890123"
   local lSearch:=.t.
   local lShowbutton:=.f.
   local oSelNumber

   // to simulation
   adata := addFirstRecord(nInvoice)

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg        ;
      TITLE "test"    ;
      SIZE 1130,650 PIXEL       ;
      FONT oFont

   @  1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL  ;
      PROMPT "Prenotazioni","Pagamenti","Familiari"
   oFolder:aEnable = { .t., .f. ,.t.}

   @ 60, 02 XBROWSE  oBrowse OF oFolder:aDialogs[1] ;
      COLUMNS  1,2,3,4,5,6,7,8,9,10,11;
      HEADERS "Ico","Tipo","Servizio","Q.tà","Costo","Tot p q.tà","Dal","al","Giorni","Sconto","Totale"   ;
      PICTURES nil, nil,"@!","9999","€ 999,999.99","€ 999,999.99", "dd-mmmm-yyyy","dd-mmmm-yyyy","999","€ 999,999.99","€ 999,999.99"  ;
      COLSIZES 55, 25,130,50,90,90,140,140,50,90,120 ;
      ARRAY aData       ;
      SIZE 100,80 PIXEL  NOBORDER
   WITH OBJECT oBrowse
   :nRowHeight    := 30

   :MakeTotals()
   :lfooter          := .T.
   :ldrawborder:=.t.
   :lHscroll         := .F.
   :l2007            := .F.
   :l2015            := .T.
   :nStretchCol  := STRETCHCOL_WIDEST
   :lAllowRowSizing     := .F.
   :lAllowColSwapping   := .F.
   :lAllowColHiding     := .F.
   :nMarqueeStyle       := 4
   :CreateFromCode()
END

@ 260,80 BUTTONBMP oSelBtn;
   RESOURCE "INVOICE_SELBTN" ;
   PROMPT "   test new" SIZE 85,15  PIXEL OF  oDlg;
   TEXTRIGHT ;
   ACTION (  Search_New( oBrowse,nInvoice,lSearch,@lShowbutton,@oSelNumber, aData),;
   oSelNumber:refresh())

@ 260,280 BUTTONBMP oSelNumber;
   PROMPT " test  new Select number" SIZE 85,15  PIXEL OF  oDlg;
   TEXTRIGHT UPDATE;
   ACTION (Search_New(oBrowse,nInvoice,.f.,@lShowbutton,@oSelNumber, aData))  WHEN lShowbutton

oDlg:bResized  := <||
oRect                := oDlg:GetCliRect()
oFolder:nWidth       := oRect:nRight-2
oFolder:nHeight      := oRect:nBottom-160
oBrowse:nTop         := oRect:nBottom-350
oBrowse:nWidth       := oRect:nWidth - 15
                           return nil
>

ACTIVATE DIALOG oDlg  ;
   ON INIT (SerVices(oFolder,adata,nInvoice,obrowse),;
   oSelNumber:disable(),;
   EVAL( oDlg:bResized) )
     RETURN NIL
//-------------------------------------------------------------//

Function addFirstRecord(nInvoice)
   Local atmp:= {}

   local cIcoPro  ,;
      cTipo    ,;
      cDescPro ,;
      nQta     ,;
      nPreUni  ,;
      nPreTot  ,;
      nTotQta  ,;
      dDataIni ,;
      dDataFin ,;
      nGiorni  ,;
      nSconto  ,;
      nTotaleRiga  ,;
      lPrintA4 ,;
      lPrintPos,;
      cStruttura,;
      cDescBreve,;
      serial,ntotale


   // to make a simulation

   cIcoPro  := ".\bitmaps\ombrellone.png"
   cTipo    := "E"
   cDescPro := "OMBRELLONE"
   nQta     := 1
   nPreUni  := 6
   nPreTot  := 6
   nTotQta  := 1
   dDataIni := date()
   dDataFin := date()
   nGiorni  := 1
   nSconto  := 0
   nTotaleRiga := 6
   lPrintA4 := .f.
   lPrintPos:= .f.
   cStruttura:=""
   cDescBreve:=""
   serial :=1
   nTotale:= nPreUni* nQta


   AaDd(aTmp,{  cIcoPro  ,;
      cTipo    ,;
      cDescPro ,;
      nQta     ,;
      nPreUni  ,;
      nTotQta  ,;
      dDataIni ,;
      dDataFin ,;
      nGiorni  ,;
      nSconto  ,;
      nTotale  ,;
      nInvoice ,;
      lPrintA4 ,;
      lPrintPos,;
      cStruttura,;
      cDescBreve,;
      serial  })

return aTmp
//---------------------------------------------------------------//


Function Search_New(oBrowse,nInvoice,lSearch,lShowbutton,oSelNumber, adata)

   If lSearch
      aSize( aData, 0 )
      oSelNumber:enable()
      lShowbutton := .t.
      oSelNumber:Refresh()
   ELSE
      adata :=  addNewRecord(nInvoice)
      oSelNumber:Disable()
      lShowbutton:=.F.
      oSelNumber:Refresh()


   ENDIf

   oBrowse:refresh()

return nil

//---------------------------------------------------------------//

Function addNewRecord(nInvoice)
   Local atmp:= {}

   local cIcoPro  ,;
      cTipo    ,;
      cDescPro ,;
      nQta     ,;
      nPreUni  ,;
      nPreTot  ,;
      nTotQta  ,;
      dDataIni ,;
      dDataFin ,;
      nGiorni  ,;
      nSconto  ,;
      nTotaleRiga  ,;
      lPrintA4 ,;
      lPrintPos,;
      cStruttura,;
      cDescBreve,;
      serial,ntotale


   // to make a simulation

   cIcoPro  := ".\bitmaps\ombrellone.png"
   cTipo    := "E"
   cDescPro := "OMBRELLONE"
   nQta     := 1
   nPreUni  := 6
   nPreTot  := 6
   nTotQta  := 1
   dDataIni := date()+2
   dDataFin := date()+5
   nGiorni  := 1
   nSconto  := 0
   nTotaleRiga := 6
   lPrintA4 := .f.
   lPrintPos:= .f.
   cStruttura:=""
   cDescBreve:=""
   serial :=1
   nTotale:= nPreUni* nQta


   AaDd(aTmp,{  cIcoPro  ,;
      cTipo    ,;
      cDescPro ,;
      nQta     ,;
      nPreUni  ,;
      nTotQta  ,;
      dDataIni ,;
      dDataFin ,;
      nGiorni  ,;
      nSconto  ,;
      nTotale  ,;
      nInvoice ,;
      lPrintA4 ,;
      lPrintPos,;
      cStruttura,;
      cDescBreve,;
      serial  })

return aTmp
//---------------------------------------------------------------//

Function SerVices(oFolder,adata,nInvoice,obrowse)
   local aServices:={ {"Bed",8},;
      {"Chair",6},;
      {"Seat",12}}
   Local abtnServices[3]
   local nservizio
   local cDesc,nPrice
   local nRow:= 100
   local nCol:= 10

   For nServizio =1  to 3

      cDesc:=  aServices[nServizio][1]
      nPrice:= aServices[nServizio][2]

      @ nRow, ncol BTNBMP aBtnservices[nServizio] ;
         SIZE 192,95 PIXEL FLAT  ;
         PROMPT cDesc +CRLF+ ltrim(str(nPrice)) ;
         OF oFolder:aDialogs[1]

      aBtnservices[nServizio]:Cargo   :=  {cDesc,nPrice}
      aBtnservices[nServizio]:bAction := { | oBtnpro | InsertServices(oBtnpro,nInvoice,adata,obrowse) ,obrowse:gobottom(),obrowse:setfocus(), obrowse:refresh()}


      ncol+=200


   Next

return nil

//---------------------------------------------------------------//

Function InsertServices(oBtnpro,nInvoice,adata,obrowse)
   // simulation insertion products
   Local cProdDesc    := oBtnpro:Cargo[1]
   Local nProdPrice   := oBtnpro:Cargo[2]

   local cIcoPro:=""  ,;
      cTipo  :="S"  ,;
      cDescPro := cProdDesc,;
      nQta     := 1,;
      nPreUni  :=nProdPrice,;
      nPreTot  :=  nPreUni*nQta,;
      nTotQta  :=  nPreTot,;
      dDataIni := date(),;
      dDataFin := date(),;
      nGiorni  := 1,;
      nSconto  := 0,;
      nTotaleRiga :=nTotQta *nGiorni ,;
      lPrintA4 := .t.,;
      lPrintPos:= .t.,;
      cStruttura:= "",;
      cDescBreve:= "",;
      nUni:= 0       ,;
      nSerial := 0

   AaDd(aData,{  cIcoPro  ,;
      cTipo    ,;
      cDescPro ,;
      nQta     ,;
      nPreUni  ,;
      nTotQta  ,;
      dDataIni   ,;
      dDataFin    ,;
      nGiorni  ,;
      nSconto  ,;
      nTotaleRiga ,;
      nInvoice ,;
      lPrintA4 ,;
      lPrintPos,;
      cStruttura,;
      cDescBreve,;
      nSerial,;
      nUni  })

   obrowse:refresh()

return nil

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6008
Joined: Fri Oct 07, 2005 7:07 pm

Re: FOR NAGES

Postby Silvio.Falconi » Sat Jun 27, 2020 6:52 pm

I allready tested with aSize(aData,0)
then there is another problem
keep in mind that in xbrowse the first line is the umbrella and the others are the services
at the moment that the procedure deletes every line from xbrowse because it waits for the user to select a new number, the user could mistakenly press a service and the procedure makes him insert it

sample
Image

I have to do in ways that if the user presses to insert a service the procedure must not insert the service because the first line must be the umbrella

should I disable the service buttons? and how ?

for now I corrected with this
Code: Select all  Expand view
IF  len(oBrowse:aArrayData)>0
              AaDd(oBrowse:aArrayData,{  cIcoPro  ,;
                          cTipo    ,;
                          cDescPro ,;
                          nQta     ,;
                          nPreUni  ,;
                          nTotQta  ,;
                          dDataIni   ,;
                          dDataFin    ,;
                          nGiorni  ,;
                          nSconto  ,;
                          nTotaleRiga ,;
                          nInvoice ,;
                          lPrintA4 ,;
                          lPrintPos,;
                          cStruttura,;
                          cDescBreve,;
                          nSerial,;
                          nPrezzoBase  })

                Endif
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: FOR NAGES

Postby Silvio.Falconi » Sat Jun 27, 2020 6:54 pm

now I close because my leg is hurting and I have to lie down
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: FOR NAGES

Postby Otto » Sat Jun 27, 2020 7:06 pm

Silvio, what is wrong with your leg?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6008
Joined: Fri Oct 07, 2005 7:07 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: karinha, Silvio.Falconi and 93 guests