XBRWOSE EDIT USING DATAROW & MARIDB ROWSET.

XBRWOSE EDIT USING DATAROW & MARIDB ROWSET.

Postby shrifw » Sun Oct 15, 2023 8:17 am

Dear Sir ,

I am using XBROWSE , DATAROW to edit data of MariaDB Rowset in batch mode. I am not expert on using XBROWSE to edit data. I am seeking help to use XBROWSE more effectively.

I have written below code but I am not sure whether it is correct way. Could you please help on this. Thanks in advance...!


Code: Select all  Expand view


#include "fivewin.ch"


#xtranslate VW_VIBTCBAL_BY_ITEM_BATCH_ID(<y>,<b>)  =>  ;
    "     SELECT   " + ;
    "         bb.ibtc_id       ,    " + ;
    "         bb.fy_id         ,    " + ;
    "         bb.item_batch_id ,    " + ;
    "         bb.sh_id         ,    " + ;
    "         bb.op_qty        ,    " + ;
    "         bb.in_qty        ,    " + ;
    "         bb.out_qty       ,    " + ;
    "         bb.cl_qty        ,    " + ;
    "         sh.sh_name            " + ;
    " FROM vibtcbalm bb             " + ;
    " LEFT JOIN vshm sh ON sh.sh_id = bb.sh_id " + ;
    " WHERE bb.fy_id = "+ Str( <y> ) +" AND bb.item_batch_id = " + Str( <b> ) +" ORDER BY bb.sh_id "
   

FUNCTION main
LOCAL oWnd
LOCAL nPkId := 0
LOCAL aoBtn    := ARRAY(5)
local aoGET    := array(20)
local nGetRow := 25 , nSepRow1 := 0
LOCAL oIBtcBalBrw
LOCAL oItemBtcBalRs , oIBtcRs
LOCAL aBalHdrs , aBalCols , aBalColSizes, aBalColPict
LOCAL cQtyPict := "@Z 99,99,99,999"
LOCAL oDBConn  
LOCAL pFyId := 2023 , pnItemBatchId := 1

cStr := "209.250.245.152,fwh,fwhuser,FiveTech@2022"
oDBConn := maria_Connect( cStr, .t. )

DEFINE DIALOG oWnd FROM 10, 10 TO 540, 1080 PIXEL TRUEPIXEL STYLE nOr( DS_MODALFRAME , WS_POPUP )
   
oItemBtcBalRs :=  oDBConn:RowSet( VW_VIBTCBAL_BY_ITEM_BATCH_ID ( pFyId , pnItemBatchId ) )
   

aBalHdrs     := {  "Store ID","Opening Qty." } //,  "In (+)" , "Out (-)" , " Closing Qty." }
aBalCols     := {  "sh_id", "op_qty" } // ,  "in_qty" , "out_qty" , "cl_qty" }
aBalColSizes := {  310, 140 } //, 120 , 120 , 120 }
aBalColPict  := {  , cQtyPict} //, cQtyPict, cQtyPict, cQtyPict }   


oItemBtcBalRs:SetBatchMode( .t. )

if oItemBtcBalRs:LastRec() == 0
    oItemBtcBalRs:AddNew()
    oItemBtcBalRs:fy_id := pFyId
    oItemBtcBalRs:item_batch_id :=  pnItemBatchId
endif ;    


@ 270, 45 XBROWSE oIBtcBalBrw SIZE 470, 180 PIXEL ;
    OF oWnd ;
    COLUMNS  aBalCols ;
    HEADERS  aBalHdrs;
    PICTURES aBalColPict;
    SIZES    aBalColSizes;
    DATASOURCE  oItemBtcBalRs AUTOSORT   LINES ;
    CELL FASTEDIT FOOTERS NOBORDER STYLE FLAT  ;
    COLOR CLR_BLACK, RGB( 232, 255, 232 )


WITH OBJECT oIBtcBalBrw:aCols[ 1 ]
    :nEditType     = EDIT_GET
END  

WITH OBJECT oIBtcBalBrw:aCols[ 2 ]
    :nEditType     = EDIT_GET
    :bOnPostEdit  := < |o,v,n|
                           oItemBtcBalRs:op_qty := v
                           oItemBtcBalRs:Save()
                      >
END  

WITH OBJECT oIBtcBalBrw



:nRowHeight          := C_XBROW_ROW_H
//:nMarqueeStyle       := MARQSTYLE_HIGHLROW
:lIncrFilter         := .F.
:lSeekWild        := .T.
:nRowDividerStyle := LINESTYLE_BLACK
:nColDividerStyle := LINESTYLE_LIGHTGRAY        
:lRecordSelector := .F.
:lFullGrid        := .T.
:lColDividerComplete := .T.
//:lHeader  := .F.
:lFooter  := .T.
:lHScroll := .F.
:lDrawBorder := .T.

:bClrHeader   := { || { CLR_WHITE, METRO_STEEL } }
:bClrRowFocus := { || { CLR_WHITE, RGB( 108, 0, 0 ) } }
:bClrSel      := { || { CLR_WHITE, RGB( 108, 0, 0 ) } }
:bClrSelFocus := { || { CLR_WHITE, RGB( 108, 0, 0 ) } }




:aCols[  2 ]:nFooterType   := AGGR_SUM

:MakeTotals()

:CreateFromCode()

END


@  460, 690 BTNBMP aoBtn[1] PROMPT "&Save" OF oWnd SIZE 90, 27 PIXEL FLAT NOROUND

aoBtn[1]:bAction := <||
                           oItemBtcBalRs:SaveBatch()
                           oWnd:End()
                    >

@  460, 790 BTNBMP aoBtn[2] PROMPT "&Cancel"  OF oWnd SIZE 100, 27 PIXEL FLAT NOROUND
   
aoBtn[2]:bAction := <||
                           oItemBtcBalRs:CancelBatch()
                           oWnd:End()
                    >   
   
ACTIVATE DIALOG oWnd CENTERED

RETURN

 
shrifw
 
Posts: 69
Joined: Fri Aug 28, 2009 5:25 am

Re: XBRWOSE EDIT USING DATAROW & MARIDB ROWSET.

Postby shrifw » Mon Oct 16, 2023 2:19 pm

Dear Sir ,

May I request to help on this..!

Thanks
Shridhar
shrifw
 
Posts: 69
Joined: Fri Aug 28, 2009 5:25 am

Re: XBRWOSE EDIT USING DATAROW & MARIDB ROWSET.

Postby shrifw » Tue Oct 17, 2023 9:51 am

Dear Sir ,

May I request to help on this..!

Thanks
Shridhar
shrifw
 
Posts: 69
Joined: Fri Aug 28, 2009 5:25 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests