Problem on xbrowse :bOnChange //RESOLVED

Problem on xbrowse :bOnChange //RESOLVED

Postby Silvio.Falconi » Wed Nov 13, 2019 9:18 am

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  Expand view


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.
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: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Postby Silvio.Falconi » Thu Nov 14, 2019 10:24 am

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

If I change a row then it change also some columns of the last row
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: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Postby shri_fwh » Fri Nov 15, 2019 5:27 am

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
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Problem on xbrowse :bOnChange

Postby nageswaragunupudi » Fri Nov 15, 2019 9:35 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem on xbrowse :bOnChange

Postby Silvio.Falconi » Fri Nov 15, 2019 10:53 am

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.
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: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Postby Silvio.Falconi » Fri Nov 15, 2019 11:01 am

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  Expand view
@ 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)     )}
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: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on xbrowse :bOnChange

Postby Silvio.Falconi » Fri Nov 15, 2019 12:19 pm

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
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: 7053
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 98 guests