FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem on xbrowse :bOnChange //RESOLVED
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Problem on xbrowse :bOnChange //RESOLVED
Posted: Wed Nov 13, 2019 09:18 AM



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 (fw): Select all Collapse
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 ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem on xbrowse :bOnChange
Posted: 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 March-April 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
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: Problem on xbrowse :bOnChange
Posted: Fri Nov 15, 2019 05:27 AM

Hi Silvio ,

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

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem on xbrowse :bOnChange
Posted: Fri Nov 15, 2019 09:35 AM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem on xbrowse :bOnChange
Posted: 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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem on xbrowse :bOnChange
Posted: 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 (fw): Select all Collapse
 @ 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 March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem on xbrowse :bOnChange
Posted: 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 March-April 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

Continue the discussion