xbrowse Vs listbox: help to structure the body of invoice

xbrowse Vs listbox: help to structure the body of invoice

Postby Silvio.Falconi » Fri Jun 07, 2019 8:44 am

in the old program to display the body of the invoice I used the lbx class now with xbrowse I have many difficulties

with listbox
Code: Select all  Expand view
oDPar:=Open_Dbf("ParxFac")

 REDEFINE LISTBOX oBPar ;
         FIELDS (oDPar)->CvePro, Desp_Fld(),      (oDPar)->Alm   , ;
                Tran((oDPar)->Cantid,oT:cPic3),   (oDPar)->UniMed, ;
                Tran((oDPar)->PreUni,oT:cPic4),    ;
                IF((oDPar)->MC,cCon,""),           ;
                Tran((oDPar)->ImpPar,"9999,999.99");
         HEADER "Codice", "Descrizione", "A", "Quantità", "Misura",;
                "€ Unit", "", "Importo"            ;
         SIZES   75,275, 15, 65, 40, 65, 10, 70    ;
         ALIAS (oDPar)->(Alias()) ID 130 OF oDlg

      oBPar:nColAct:=1
      oBPar:lCellStyle :=.T.
      oBPar:lDrawFooter:=.T.
      oBPar:nClrForeHead:=CLR_BLUE
      oBPar:bChange   :={|| Refr_Con()}
      oBPar:bKeyDown  :={|nKey| Val_nKPar(nKey,oDlg)}
      oBPar:bLDblClick:={|| IF(oT:lNew,Captura(.F.),)}
      oBPar:bGoTop   :={||  GoToTop(oDPar,oT:aDat[1])}
      oBPar:bGoBottom:={||  GoToBot(oDPar,oT:aDat[1])}
      oBPar:bSkip    :={|n| MovePtr(oDPar,oT:aDat[1],n)}



oT:aDat[1] is the number of the invoice

now with xbrowse how do I have to do to show only the lines that are of that invoice?

SELECT TB
TB->(DbSetOrder(1))
TB->( OrdScope(0, { || oT:aDat[1] }))
TB->( OrdScope(1, { || oT:aDat[1] }) )
TB->(DbGoTop())


Code: Select all  Expand view

aBrowse     :=  {{"PAITEM"      ,i18n("Codice")       ,nil                  ,50 },;
                        { "PADESC"      ,i18n("Descrizione")  ,nil                 ,290 },;
                        { "PAQTY"       ,i18n("Quantità")     ,"9999"               ,45 },;
                        { "PAMISURA"    ,i18n("Misura")       ,nil                  ,37 },;
                        { "PAUNITARIO"  ,i18n("Unitario")     ,pict_money_Euro      ,80 },;
                        { "PASCONTO"    ,i18n("%Sconto")       , nil                ,60 },;
                        { "PAPROVV"     ,i18n("%Provv.")      ,'@ 999.99%'          ,50 },;
                        { "PARIT"       ,i18n("Ritenuta")     ,nil                  ,80 },;
                        { "PAIVA"       ,i18n("Iva")          ,"99%"                ,36 },;
                        { "PATOTALE"    ,i18n("Importo")      ,pict_money_Euro      ,80 }}


      @ 0, 0.2 XBROWSE oBrw       ;
      OF oFld:adialogs[1] DATASOURCE "TB" ;
      COLUMNS aBrowse CELL LINES  FOOTERS NOBORDER   FONT oFont
 




I also thought of saving all the records of that invoice number in an array and working with the array but how do I save? and if there is another operator on the net who opens the same invoice what happens?

I do not feel confident that it will work well, risk of blowing up everything and displaying the data of other invoice

can you help me by giving me a small example perhaps with the class Tdatabase please


I made a test with tdatabase and when I insert a new record let me give an error


Image

Code: Select all  Expand view
Error occurred at: 07-06-2019, 12:26:30
   Error description: Error BASE/1005  Message not found: TDATABASE:_NINVOICE

Stack Calls
===========
   Called from: .\source\function\HARBOUR.PRG => _CLSSETERROR( 247 )
   Called from: .\source\classes\DATABASE.PRG => TDATABASE:_NINVOICE( 1392 )
   Called from: test.prg => INSERTRECORD( 861 )


source
Code: Select all  Expand view
aBrowse   := {  { "Image"   , i18n("ico"),,                80, },;
                   { "type"    , i18n("Tipo"),,               80, },;
                   { "Service" , i18n("Servizio"),,           80, },;
                   { "Qta"     , i18n("Q.tà"),,               80, },;
                   { "Price"   , i18n("Costo"),,              80, },;
                   { "TotPrice", i18n("Tot p q.tà"),,         80, },;
                   { "From"    , i18n("Dal"),,                80, },;
                   { "To"      , i18n("al"),,                 80, },;
                   { "Days"    , i18n("Attivo"),,             80, },;
                   { "Descount", i18n("sconto"),,             80, },;
                   { "Totale"  , i18n("totale"),,             80, } }


oPartxRes:SetOrder(1)
oPartxRes:OrdScope(0, { ||nInvoice })
oPartxRes:OrdScope(1, { ||nInvoice })
oPartxRes:GoTop()

@ 120, 10 XBROWSE oBrowse OF oDlgPre ;
SIZE 100,150 PIXEL NOBORDER;
DATASOURCE oPartxRes COLUMNS aBrowse[/code]

when I press on product I call the function InsertRecord(oBrowse,nInvoice,oBtn,n,aGet)

Code: Select all  Expand view
Function InsertRecord(oBrowse,nInvoice,oBtn,n,aGet)

   Local ImgProduct  := oBtn:Cargo[1]
   Local cProdDesc   := oBtn:Cargo[2]
   Local nProdPrice  := oBtn:Cargo[3]
   Local lPrintA4    := oBtn:Cargo[4]
   Local lPrintPos   := oBtn:Cargo[5]
   Local lMultiple   := oBtn:Cargo[6]
   Local cDescBreve  := oBtn:Cargo[7]
   Local cStruttura  := oBtn:Cargo[8]
   Local cStringaServizi:=""
   Local nPrezzoUnitario:=0

   Local nQuant := 1
   Local nTotale:= 0

 nTotale:= nProdPrice*nQuant

      oPartxRes:Append()
    oPartxRes:nInvoice  := nInvoice
    oPartxRes:Type      :="S"
    oPartxRes:image     := ImgProduct
    oPartxRes:Desc      := cProdDesc
    oPartxRes:Qta       := nQuant
    oPartxRes:price     := nProdPrice
    oPartxRes:totprice  := nTotale


    oPartxRes:save()
    nSubTotale+= nProdPrice
    oBrowse:MakeTotals()
   oBrowse:refresh()

 
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: 7061
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 68 guests