Problem on xbrowse :bOnChange //RESOLVED

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Problem on xbrowse :bOnChange //RESOLVED

Post by Silvio.Falconi »

Image


if I go to change the penultimate line, then the last row is also changed why ?

on my xbrowse at init I made

I use array on Xbrowse

bCalcRow := { || (MyCalcFun(oBrowse,.t.), CalcoloTotali(oBrowse,aGet) )}



MyCalcFun function

Code: Select all


Function MyCalcFun(oBrowse,lModifica)
   Local  dData_in        := oBrowse:aCols[ 7 ]:Value
   Local  dData_out       := oBrowse:aCols[ 8 ]:Value
   Local  lStagioneIntera
   Local  nTipoServizio   := oBrowse:aCols[ 2]:Value
   Local  nCosto          := 0
   Local  nTotalexQuantita:= 0
   Local  cProdotto       := oBrowse:aCols[ 3 ]:Value
   Local  nQuantita       := oBrowse:aCols[ 4 ]:Value
   Local  nGiorni         := (dData_out  -   dData_in )+1
   Local  nSconto         := oBrowse:aCols[ 10 ]:Value
   local  nTotale         := oBrowse:aCols[ 11 ]:Value

   // controllo stagione Intera
       IF nGiorni > 90  //mettere in configurazione Max_giorni_intera
          lStagioneIntera := .t.
       else
           lStagioneIntera := Is_Stagionale(dData_in,dData_out)
        Endif


  IF lModifica
        // modifica riga
       If  nTipoServizio<>"E"  // se è diverso da elemento

           If  lStagioneIntera
                nCosto          := Prezzo_Servizi(dData_in,dData_out,lStagioneIntera,cProdotto)
                nTotalexQuantita:= nQuantita * nCosto
                nTotale         := nTotalexQuantita  -  nSconto
             else
                nCosto           :=  Prezzo_Servizi(dData_in,dData_out,lStagioneIntera,cProdotto)// oBrowse:aCols[ 5 ]:Value
                nTotalexQuantita:= nQuantita * nCosto
                nTotale          := (nTotalexQuantita -  nSconto)  * nGiorni
             Endif

          else

             Msginfo("Non puoi modificare i prezzi e il totale su questa riga")
          Endif

       ELSE

     // inserimento riga
           If  lStagioneIntera
                nCosto          := Prezzo_Servizi(dData_in,dData_out,lStagioneIntera,cProdotto)
                nTotalexQuantita:= nQuantita * nCosto
                nTotale         := nTotalexQuantita  -  nSconto
             else
                nCosto           := oBrowse:aCols[ 5 ]:Value
                nTotalexQuantita:= nQuantita * nCosto
                nTotale          := (nTotalexQuantita -  nSconto)  * nGiorni
             Endif

         ENDIF


// save on xbrowse 

             oBrowse:aCols[5]:VarPut( nCosto)
             oBrowse:aCols[6]:VarPut(nTotalexQuantita)
             oBrowse:aCols[9]:VarPut (nGiorni)
             oBrowse:aCols[11]:VarPut( nTotale )


  return nil
where i the problem ?
Last edited by Silvio.Falconi on Wed Nov 20, 2019 11:35 am, edited 2 times in total.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Post by Silvio.Falconi »

Nages please see the video https://recordit.co/saKLrKT7T1

If I change a row then it change also some columns of the last row
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
shri_fwh
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Problem on xbrowse :bOnChange

Post by shri_fwh »

Hi Silvio ,

May I request to post this Sample Code ? Thanks in advance...!

Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem on xbrowse :bOnChange

Post by nageswaragunupudi »

Please post a self-contained sample that we can build at our end.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Post by Silvio.Falconi »

nageswaragunupudi wrote:Please post a self-contained sample that we can build at our end.
see at your e-mail
Last edited by Silvio.Falconi on Fri Nov 15, 2019 11:44 am, edited 1 time in total.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Post by Silvio.Falconi »

shri_fwh wrote:Hi Silvio ,

May I request to post this Sample Code ? Thanks in advance...!

Thanks
Shridhar
I don't think it can create a small example because many archives are connected around 10,
for example in the creation of the articles are connected the articles and the prices of the articles.

When I go to modify a line the procedure goes to check the period (periods.dbf, listini.dbf) and if it is an entire season it goes to look for the right price in the item price archive or if the customer is known every customer has a particular price list

my problem is that when I go to edit a line I have to change the price of the product by calculating the total of days.

The procedure recognizes that the interval is not an entire season and therefore must calculate the period and days, so it must enter the unit price, the total price by quantity, the number of days, the total which is the multiplication between the price and the days .

The procedure changes the selected line but the line below also changes to me

this is the xbrowse

Code: Select all

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

       ADD COLUMN TO XBROWSE oBrowse


   bCalcRow := { || (MyCalcFun(oBrowse,.t.), CalcoloTotali(oBrowse,aGet)     )}
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Post by Silvio.Falconi »

perhaps I found the error

on Function CalcoloTotali(oBrowse,aGet)

I insert this command

oBrowse:GoBottom()

this go to the last record and it is modified
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply