To Nages xbrowse onpostedit

To Nages xbrowse onpostedit

Postby Silvio.Falconi » Thu Apr 18, 2013 10:37 am

I have an error on
oCol:bOnPostEdit := {|o, v, n| iif( n != VK_ESCAPE, ( PA->(DBRLOCK()), FieldPut( o:nCreationOrder, v ), PA->(DBUNLOCK()) ), ) }
oCol:bOnChange := { || oBrw:MakeTotals(), oBrw:RefreshFooters() }

it cannot save and make error on another field I have on dbf


Image



I made a small test
It create 4 dbf : Parts, Invoice,Catalogo,Ive
I use LookArt function to select an article
I wish change on xbrowse the tax (I create an array) and the measure with Edit_listbox command

Code: Select all  Expand view
#Include "Fivewin.ch"
#Include "dtpicker.ch"
#include "xbrowse.ch"
#include "constant.ch"


#define MARQSTYLE_HIGHLWIN7  7

#define LIGHTCYAN        nRGB( 203, 225, 252 )
  REQUEST DBFCDX
  REQUEST DBFFPT
  EXTERNAL ordkeyno, ordkeycount,ordcreate,ordkeygoto

static aIve
Function Invoice()
Local oFrmInvoice
Local oBrw
Local oFld1,oFld2,oFld3
local oBtn[3]
//-------------------------------//
Local nBottom   := 30
Local nRight    := 84.2
Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
//--------------------------------//

Local oFontGrid:= TFont():New( "Lucida Console", 0, 12,, )

RddSetDefault( "DBFCDX" )
   aIve:={}
 Create_Data()
 Open_data()
 nInvoice :="1"  // set the invoice number


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

 DEFINE DIALOG oFrmInvoice  TITLE "Invoice"     ;
 SIZE nWidth, nHeight   PIXEL



    SELECT PA
   oBrw := TXBrowse():New( oFrmInvoice )
   oBrw:nTop    := 66
   oBrw:nLeft   := 10
   oBrw:nBottom := 160
   oBrw:nRight  := 330
   oBrw:lfooter:=.t.

 aBrowse   := { { { ||PA->PAITEM}, i18n("Codice"), 50, },;
                { { ||PA->PADESC }, i18n("Descrizione"), 200, }  ,;
                { { ||PA->PAMEAS }, i18n("Misura"), 40, }  ,;
                { { ||PA->PAQTY }, i18n("Quantità"), 60,"9999" }  ,;
                { { ||PA->PATAX }, i18n("Iva"), 40,"99" }  ,;
                { { ||PA->PADESCONT}, i18n("Sconto"), 40, }  ,;
                { { ||PA->PAUNIT }, i18n("Unitario"), 80,'@ 99,999.99' }  ,;
                { { ||PA->PATOTAL }, i18n("Totale"), 80,'@ 99,999.99'  }}


     FOR i := 1 TO Len(aBrowse)
      oCol := oBrw:AddCol()
      oCol:bEditValue := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
       if !Empty(aBrowse[ i, 4 ])
            oCol:cEditPicture:=aBrowse[ i, 4 ]
         Endif
      NEXT



               WITH OBJECT oBrw

                             WITH OBJECT  oBrw:aCols[1]
                                    :nEditType := EDIT_BUTTON
                                    :bEditBlock := { | nRow, nCol, oCol, nKey | LookArt( nRow, nCol, oCol, nKey ) }
                               END

                             WITH OBJECT  oBrw:aCols[2]
                                :nEditType := EDIT_GET
                             END

                             WITH OBJECT  oBrw:aCols[3]
                                      :nEditType := EDIT_LISTBOX
                                      :aEditListTxt:={"pz.","gr","kg","mm" }
                                   END

                             WITH OBJECT  oBrw:aCols[4]
                                :nEditType := EDIT_GET
                              END

                              WITH OBJECT  oBrw:aCols[5]
                                 :nEditType := EDIT_LISTBOX
                                 :aEditListTxt:=aIve
                             END

                              WITH OBJECT  oBrw:aCols[6]
                                 :nEditType := EDIT_GET

                             END

                             WITH OBJECT  oBrw:aCols[7]
                                 :nEditType := EDIT_GET

                             END




                              WITH OBJECT oBrw:aCols[8]
                                :bStrData := { || Calc_Total_Line(oBrw) }
                                  :nTotal := 0
                                     :lTotal := .t.
                                     :nFooterType := AGGR_TOTAL
                                     :addbmpfile( ".\bitmaps\cassa16.bmp" )
                                     :nDataStrAlign := AL_RIGHT
                                     :cEditPicture := '@ 99,999.99'
                                     :nFootStrAlign := AL_RIGHT
                                    :nFootBmpNo := 1 // Footer BMP

                                END


            :lFastEdit = .T.
            :nStretchCol  := STRETCHCOL_WIDEST
            :lHscroll:=.f.
            :lRecordSelector     := .f.
            :nRowDividerStyle := LINESTYLE_LIGHTGRAY
            :nColDividerStyle := LINESTYLE_LIGHTGRAY
         end

                                 oBrw:SetRDD()
                                 oBrw:CreateFromCode()
                                 oBrw:lFooter:=.t.
                                 oBrw:MakeTotals()
                                 oBrw:RefreshFooters()



  FOR i := 1 TO LEN( oBrw:aCols)
      oCol := oBrw:aCols[ i ]
     oCol:oDataFont := oFontGrid
     oCol:bOnPostEdit := {|o, v, n| iif( n != VK_ESCAPE, ( PA->(DBRLOCK()), FieldPut( o:nCreationOrder, v ), PA->(DBUNLOCK()) ), ) }
     oCol:bOnChange := { || oBrw:MakeTotals(), oBrw:RefreshFooters() }
   NEXT




       @ oBrw:nbottom+3, 5 BUTTON oBtn[1] PROMPT "&New Item" ;
                             SIZE 40,10 PIXEL OF oFrmInvoice ACTION NewItem(oBrw,nInvoice)

       @ oBrw:nbottom+3, 46 BUTTON oBtn[2] PROMPT "&Edit Item" ;
                             SIZE 40,10 PIXEL OF oFrmInvoice ACTION nil

       @ oBrw:nbottom+3, 87 BUTTON oBtn[3] PROMPT "&Del Item" ;
                             SIZE 40,10 PIXEL OF oFrmInvoice ACTION DelItem( oBrw )



ACTIVATE DIALOG oFrmInvoice CENTER
RETURN NIL





Function LookArt( r, c, oCol, nKey )
local cVal := oCol:Value
local odlg,oBrowse

*if MsgGet( 'enter new value', 'code', @cVal )
*   return cVal
*endif

//-------------------------------//
  Local nBottom   := 14.2
   Local nRight    := 55
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
    local lOk    := .f.

   local nRecno := PA->( RecNo() )
   local nOrder := PA->( OrdNumber() )
   local nArea  := Select()


   DEFINE DIALOG oDlg        ;
   TITLE i18n("Selezione ARTICOLI")    ;
   SIZE nWidth, nHeight   PIXEL



   //--------------------------------//
 SELECT CA
   @02, 10 XBROWSE   oBrowse OF oDlg ;
      SIZE 140,100 PIXEL


    oBrowse:cAlias := "CA"

   oCol := oBrowse:AddCol()
   oCol:bStrData := { || CA->CAITEM }
   oCol:cHeader  := "Codigo"
   oCol:nWidth   := 80
   oCol:bLDClickData  := {|| ( lOk := .t., oDlg:End() )   }

   oCol := oBrowse:AddCol()
   oCol:bStrData := { || CA->CADESC }
   oCol:cHeader  := "Description"
   oCol:nWidth   := 80
   oCol:bLDClickData  := {|| ( lOk := .t., oDlg:End() )   }


   oBrowse:SetRDD()
   oBrowse:CreateFromCode()



   @ 8, 160 BUTTON oBNew PROMPT "&Nuovo" ;
             SIZE 45, 12 PIXEL OF oDlg   ACTION  NIL
     @ 24, 160 BUTTON  oBMod PROMPT "&Modifica" ;
             SIZE 45, 12 PIXEL OF oDlg   ACTION NIL
     @ 40, 160 BUTTON oBDel PROMPT "&Cancella" ;
             SIZE 45, 12 PIXEL OF oDlg  ACTION NIL
     @ 56, 160 BUTTON oBBus PROMPT "&Ricerca" ;
             SIZE 45, 12 PIXEL OF oDlg ACTION NIL


      @ 80, 160 BUTTON oBtnAceptar PROMPT "&Conferma" ;
            SIZE 45, 12 PIXEL OF oDlg ;
             ACTION (lOk := .t., oDlg:End())

      @ 94, 160 BUTTON oBtnCancel PROMPT "&Annulla" ;
             SIZE 45, 12 PIXEL OF oDlg ;
             ACTION (lOk := .f., oDlg:End())

   ACTIVATE DIALOG oDlg CENTERED

   if lOK
      PA->( DbSetOrder( nOrder ) )
       PA->( DbGoTo( nRecno ) )

      Replace  PA->PAITEM With  CA->CAITEM
      Replace  PA->PADESC With  CA->CADESC
      Replace  PA->PAUNIT With  CA->CAUNIT
      Replace  PA->PATAX  With  CA->CATAX
   endif

   PA->( DbSetOrder( nOrder ) )
   PA->( DbGoTo( nRecno ) )

   Select (nArea)

return nil










 // calcolo total line

 Function  Calc_Total_Line(oBrw)
       local nRecord := PA->(Recno())
       Local  nImporto     := 0
       Local  nImponibile  := 0
       Local  nNetto       := 0
       Local  nNettot      := 0
       Local  nSconto      := 0


       nQuantita       := PA->PAQTY
       nPrezzoUnitario := PA->PAUNIT
       nIva            := val(PA->PATAX)
       nSconto         := PA->PADESCONT



        nImporto:=nQuantita*nPrezzoUnitario
        nImponibile:= ((nImporto/100)*nIva)
        nNetto:=nImponibile+nImporto
        nSconto:=nNetto*(val(nSconto)/100)
        nNettoT := nNetto-nSconto

      REPLACE PA->PATOTAL WITH  nNettoT


 *  oBrw:MakeTotals()
 *  oBrw:refresh()
 *  oBrw:setfocus()
Return NIL




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

 Function NewItem(oBrw,nInvoice)

    PA->(DbAppend())

   Replace  PA->PAINVOICE  With   nInvoice
   Replace  PA->PAQTY      With   1

   PA->(DbCommit())



   oBrw:refresh()
   oBrw:setfocus()



Return NIL


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

 Function DelItem( oBrw )
       local nRecord := PA->(Recno())
       local nNext
     if msgYesNo( i18n("¿ E' sicuro che devo cancellare questa linea ?")    )


          Select PA
                 PA->(DbSkip())
                 nNext := PA->(Recno())
                          PA->(DbGoto(nRecord))
                          PA->(DbDelete())
                          PA->(DbPack())
                          PA->(DbGoto(nNext))
                    if PA->(EOF()) .or. nNext == nRecord
                       PA->(DbGoBottom())
                      endif
   endif

   oBrw:refresh()
   oBrw:setfocus()
Return NIL

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





//-----------------------------------------------------------------------//
Function Create_Data()
         cDir:=cFilePath(GetModuleFileName(GetInstance()))


 //PARTS

         DbCreate(cDir+'PA', { {'PAITEM'    ,'C',010,000},;  // Codigo
                               {'PADESC'    ,'C',030,000},;  // description
                               {'PAMEAS'    ,'C',010,000},;  // measure
                               {'PAQTY'     ,'N',004,000},;  // quantity
                               {'PAUNIT'    ,'N',012,002},;  // Price unit
                               {'PATOTAL'   ,'N',012,002},;  // total
                               {'PAFLAG'    ,'C',001,000},;  // flag internal
                               {'PADESCONT' ,'C',010,000},;  // Descount
                               {'PATAX'     ,'C',002,000},;
                               {'PAINVOICE' ,'C',004,000}}, 'DBFCDX')  // Number of Invoice

      close all
      use &(cDir+'PA') new
      select PA
      if FILE(cDir+'Parts.DBF')
         delete file &(cdir+'Parts.cdx')
         append from &(cdir+'Parts')
         dbcommitall()
         close all
         delete file &(cdir+'Parts.dbf')
      endif
       close all
      rename &(cdir+'PA.dbf') to &(cdir+'Parts.dbf')

//-------------------------------------------------------------------//
 //INVOICE


      DbCreate(cDir+'IN', { {'INVOICENO'  ,'C',004,000},;  //Invoive No
                            {'INDATA'     ,'D',008,000},;  // invoice data
                            {'INTYPE'     ,'C',010,000},;  // invoice type
                            {'INTERMS'    ,'C',010,000},;  // invoice Terms
                            {'INTERMSD'   ,'N',002,000},;  // invoice  Terms_days
                            {'INSALEPERS' ,'N',002,000},;  // invoice sale persons
                            {'INCUSTOMER' ,'C',030,000},;  // Customer
                            {'INBILLTO'   ,'C',030,000},;  // Bill to
                            {'INCUSTPONO' ,'C',004,000},;  // Customer Po No
                            {'INCUSTTAX'  ,'C',004,000},;   // Customer TAx
                            {'INSHIPTO'   ,'C',030,000},;  // SHIP to
                            {'INSAMEASB'  ,'L',001,000},;  // same as billing ( check)
                            {'INSHIPBY'   ,'C',030,000},;  // Ship by
                            {'INTRACKNO'  ,'N',004,000},;  //Tracking ref. no
                            {'INSHIPPING' ,'N',010,002},;  //SHIPPING
                            {'INSUBTOTAL' ,'N',010,002},;  //INVOICE Subtotal
                            {'INTOTAL'    ,'N',010,002},;  // Total
                            {'INCOMMENT'  ,'C',200,000},;  // invoice comment
                            {'INPRIVATE'  ,'C',200,000} }, 'DBFCDX')  //invoice private comment


       close all
      use &(cDir+'IN') new
      select IN
      if FILE(cDir+'Invoice.DBF')
         delete file &(cdir+'Invoice.cdx')
         append from &(cdir+'Invoice')
         dbcommitall()
         close all
         delete file &(cdir+'Invoice.dbf')
      endif
       close all
      rename &(cdir+'IN.dbf') to &(cdir+'Invoice.dbf')






  //-------------------------------------------------------------------//
  // CATALOGO



   DbCreate(cDir+'CA', {       {'CAITEM'    ,'C',010,000},;  // Codigo
                               {'CADESC'    ,'C',030,000},;  // description
                               {'CAMEAS'    ,'C',010,000},;  // measure
                               {'CAUNIT'    ,'N',012,002},;  // Price unit
                               {'CATAX'     ,'C',002,000} }, 'DBFCDX') // tax




      close all
      use &(cDir+'CA') new
      select CA
      if FILE(cDir+'CATALOGO.DBF')
         delete file &(cdir+'CATALOGO.cdx')
         append from &(cdir+'CATALOGO')
         dbcommitall()
         close all
         delete file &(cdir+'CATALOGO.dbf')
      endif
       close all
      rename &(cdir+'Ca.dbf') to &(cdir+'CATALOGO.dbf')


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

   //IVA

  DbCreate(cDir+'IV', {        {'IVITEM'    ,'C',010,000},;  // Codigo
                               {'IVDESC'    ,'C',030,000},;  // description
                               {'IVTAX'     ,'N',002,000} }, 'DBFCDX') // tax




      close all
      use &(cDir+'IV') new
      select IV
      if FILE(cDir+'IVE.DBF')
         delete file &(cdir+'IVE.cdx')
         append from &(cdir+'IVE')
         dbcommitall()
         close all
         delete file &(cdir+'IVE.dbf')
      endif
       close all
      rename &(cdir+'IV.dbf') to &(cdir+'IVE.dbf')

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












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

      RETURN NIL
//----------------------------------------------------------------------------------------------//







FUNCTION Open_data()
    if ! Db_OpenNoIndex("Invoice","IN")
      return nil
   endif

   if ! Db_OpenNoIndex("Parts","PA")
      return nil
   endif


   if ! Db_OpenNoIndex("IVE","IV")
      return nil
   endif

     SELECT IV
   IF IV->(Eof())
      IV->(DbAppend())
       Replace IV->IVITEM  with "001"
       Replace IV->IVDESC  with "20"
       Replace IV->IVTAX   with  20
       IV->(DbAppend())
       Replace IV->IVITEM  with "002"
       Replace IV->IVDESC  with "12"
       Replace IV->IVTAX   with  12
       IV->(DbAppend())
       Replace IV->IVITEM  with "003"
       Replace IV->IVDESC  with "14"
       Replace IV->IVTAX   with  14
      IV->(DbAppend())
       Replace IV->IVITEM  with "004"
       Replace IV->IVDESC  with "18"
       Replace IV->IVTAX   with  18
    ENDIF







  if ! Db_OpenNoIndex("Catalogo","CA")
      return nil
   endif


   //sample catalogo
   SELECT CA
   IF CA->(Eof())
      CA->(DbAppend())
      Replace CA->CAITEM with "001"
      Replace CA->CADESC with "article 1"
       CA->(DbAppend())
      Replace CA->CAITEM with "002"
      Replace CA->CADESC with "article 2"
   ENDIF




   SELECT IV
     DO WHILE ! IV->(EoF())
     AAdd( aIve,( TRIM(str(IV->IVTAX))))
     IV->(DbSkip())
  ENDDO



RETURN NIL



















function Db_OpenNoIndex(cDbf,cAlias)
   if file( cDbf + ".dbf" )
      USE &(cDbf+".dbf")      ;
         ALIAS &(cAlias) NEW
   else
     MsgStop( i18n( "Non si è trovato l'archivio dei dati." ) + CRLF + ;
               i18N( "Per favore  controlla la configurazone") + CRLF + ;
                i18N( "e indicizza gli archivi dell'applicazione." ) )
      return .f.
      return .f.
   END if
   if NetErr()
     msgStop( i18n( "Errore nell'aprire un archivio" ) + CRLF + ;
              i18n( "Per favore caricare di nuovo l'applicazione." ) )
      DbCloseAll()
      return .f.
   endif
   return .t.




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

Re: To Nages xbrowse onpostedit

Postby nageswaragunupudi » Thu Apr 18, 2013 2:12 pm

I advise you to use COMMAND syntax to produce bug-free code. Its easy to write. easy to understand, easy to maintain and easy for us to support. Leave the job of building bOnPostEdit like codeblocks to XBrowse. XBrowse automatically creates all necessary codeblocks bug-free.

For example, you better create xbrowse from your aBrowse array in this manner:
Code: Select all  Expand view
aBrowse     :=  { { "PAITEM", i18n("Codice"),      nil,           50 }  ,;
                { "PADESC".   i18n("Descrizione"), nil,          200 }  ,;
                { "PAMEAS".   i18n("Misura"),      nil,           40 }  ,;
                { "PAQTY".    i18n("Quantità"),    "9999",        60 }  ,;
                { "PATAX".    i18n("Iva"),         "99",          40 }  ,;
                { "PADESCONT",i18n("Sconto"),      nil,           40 }  ,;
                { "PAUNIT",   i18n("Unitario"),    '@ 99,999.99', 80 }  ,;
                { "PATOTAL",  i18n("Totale"),      '@ 99,999.99', 80 }}


@ 66, 10 XBROWSE oBrw SIZE 330.150 PIXEL OF oFrmInvoice DATASOURCE "PA" ;
   COLUMNS aBrowse ;
   CELL LINES NOBORDER FOOTERS
 

Having created, you please never create your own bOnPostEdit codeblock. XBrowse does this automatically.

Also never use MakeTotals() inside the bChange.
Call oBrw:MakeTotals() once in the beginning.
XBrowse maintains the totals later on.
Regards

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

Re: To Nages xbrowse onpostedit

Postby Silvio.Falconi » Thu Apr 18, 2013 2:40 pm

Sorry Nages,
But your script let me error ... abrowse ...
there were some errors there were "." instead of ","

Code: Select all  Expand view
aBrowse     :=  { { "PAITEM", i18n("Codice"),      nil,     50 }  ,;
                { "PADESC",   i18n("Descrizione"), nil,          200 }  ,;
                { "PAMEAS",   i18n("Misura"),      nil,           40 }  ,;
                { "PAQTY",    i18n("Quantità"),    "9999",        60 }  ,;
                { "PATAX",   i18n("Iva"),         "99",          40  }  ,;
                { "PADESCONT",i18n("Sconto"),      nil,           40 }  ,;
                { "PAUNIT",   i18n("Unitario"),    '@ 99,999.99', 80 }  ,;
                { "PATOTAL",  i18n("Totale"),      '@ 99,999.99', 80 }}


@ 66, 10 XBROWSE oBrw SIZE 330,120 PIXEL OF oFrmInvoice DATASOURCE "PA" ;
   COLUMNS aBrowse ;
   CELL LINES NOBORDER FOOTERS







can you create a small test to show to us how make a little invoice ( with the possibility to edit each column of xbrowse)
thanks
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: 6848
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages xbrowse onpostedit

Postby Silvio.Falconi » Thu Apr 18, 2013 3:06 pm

Dear Nages,

Image

as you can see I cannot see the last column Total ( but It show the right total footer)


then I cannot edit the column for sample the second column "PADESC"



Code: Select all  Expand view



DEFINE DIALOG oFrmInvoice  TITLE "Invoice"     ;
 SIZE nWidth, nHeight   PIXEL



                         SELECT PA
                         PA->(DbSetOrder(1))
                         PA->( OrdScope(0, { || alltrim((nInvoice)) }))
                         PA->( OrdScope(1, { || alltrim((nInvoice)) }) )
                         PA->(DbGoTop())


      aBrowse     :=  { { "PAITEM",   i18n("Codice"),      nil,           50 }  ,;
                        { "PADESC",   i18n("Descrizione"), nil,          200 }  ,;
                        { "PAMEAS",   i18n("Misura"),      nil,           40 }  ,;
                        { "PAQTY",    i18n("Quantità"),    "9999",        60 }  ,;
                        { "PATAX",    i18n("Iva"),         "99",          40 }  ,;
                        { "PADESCONT",i18n("Sconto"),      nil,           40 }  ,;
                        { "PAUNIT",   i18n("Unitario"),    '@ 99,999.99', 80 }  ,;
                        { "PATOTAL",  i18n("Totale"),      '@ 99,999.99', 80 }}


@ 66, 10 XBROWSE oBrw SIZE 330,120 PIXEL OF oFrmInvoice DATASOURCE "PA" ;
   COLUMNS aBrowse CELL LINES NOBORDER FOOTERS
 

                          WITH OBJECT oBrw
                                WITH OBJECT  oBrw:aCols[1]
                                    :nEditType := EDIT_BUTTON
                                    :bEditBlock := { | nRow, nCol, oCol, nKey | LookArt( nRow, nCol, oCol, nKey ) }
                                 END

                             WITH OBJECT  oBrw:aCols[2]
                                :nEditType := EDIT_GET
                             END

                               WITH OBJECT  oBrw:aCols[3]
                                      :nEditType := EDIT_LISTBOX
                                      :aEditListTxt:={"pz.","gr","kg","mm" }
                                   END


                               WITH OBJECT  oBrw:aCols[5]
                                 :nEditType := EDIT_LISTBOX
                                 :aEditListTxt:=aIve
                             END


                              WITH OBJECT  oBrw:aCols[6]
                                 :nEditType := EDIT_GET

                             END


                             WITH OBJECT  oBrw:aCols[7]
                                 :nEditType := EDIT_GET

                             END



                                //TOTAL

                               WITH OBJECT oBrw:aCols[8]
                                     :bStrData := { || Calc_Total_Line(oBrw) }
                                     :nTotal := 0
                                     :lTotal := .t.
                                     :nFooterType := AGGR_TOTAL
                                     :addbmpfile( ".\bitmaps\cassa16.bmp" )
                                     :nDataStrAlign := AL_RIGHT
                                     :cEditPicture := '@ 99,999.99'
                                     :nFootStrAlign := AL_RIGHT
                                    :nFootBmpNo := 1 // Footer BMP

                                END






            :lFastEdit = .T.
            :nStretchCol  := STRETCHCOL_WIDEST
            :lHscroll:=.f.
            :lRecordSelector     := .f.
            :nRowDividerStyle := LINESTYLE_LIGHTGRAY
            :nColDividerStyle := LINESTYLE_LIGHTGRAY
         end

                                 oBrw:SetRDD()
                                 oBrw:CreateFromCode()
                                 oBrw:lFooter:=.t.
                                 oBrw:MakeTotals()
                                 oBrw:RefreshFooters()



  FOR i := 1 TO LEN( oBrw:aCols)
      oCol := oBrw:aCols[ i ]
     oCol:oDataFont := oFontGrid
 *    oCol:bOnPostEdit := {|o, v, n| iif( n != VK_ESCAPE, ( PA->(DBRLOCK()), FieldPut( o:nCreationOrder, v ), PA->(DBUNLOCK()) ), ) }
     oCol:bOnChange := { || oBrw:MakeTotals(), oBrw:RefreshFooters() }
   NEXT




       @ oBrw:nbottom+3, 5 BUTTON oBtn[1] PROMPT "&New Item" ;
                             SIZE 40,10 PIXEL OF oFrmInvoice ACTION NewItem(oBrw,nInvoice)

       @ oBrw:nbottom+3, 46 BUTTON oBtn[2] PROMPT "&Edit Item" ;
                             SIZE 40,10 PIXEL OF oFrmInvoice ACTION nil

       @ oBrw:nbottom+3, 87 BUTTON oBtn[3] PROMPT "&Del Item" ;
                             SIZE 40,10 PIXEL OF oFrmInvoice ACTION DelItem( oBrw )



ACTIVATE DIALOG oFrmInvoice CENTER
RETURN NIL
 
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: 6848
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages xbrowse onpostedit

Postby nageswaragunupudi » Thu Apr 18, 2013 5:02 pm

there were some errors there were "." instead of ","

I think you can correct these small things. I am suggesting a method. You should take care of these small things at your end.

as you can see I cannot see the last column Total ( but It show the right total footer)

It is a very simple matter for you to specify the widths suitably so that all columns are fully visible.

can you create a small test to show to us how make a little invoice ( with the possibility to edit each column of xbrowse)

ok.
Soon.
Regards

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

Re: To Nages xbrowse onpostedit

Postby Silvio.Falconi » Thu Apr 18, 2013 8:36 pm

Sorry,
I make an mistake

If I seek the number of invoide with


SELECT PA
PA->(DbSetOrder(1))
PA->( OrdScope(0, { || alltrim((nInvoice)) }))
PA->( OrdScope(1, { || alltrim((nInvoice)) }) )
PA->(DbGoTop())



then I cannot edit each column I don't Know why ...

I must seek it because I have two dbf : one with the Orders and one with orderlines
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: 6848
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 71 guests