Jump to content
Fivewin Brasil

Somar coluna xBrowse


SISCO

Recommended Posts

Bom dia a todos

Estou convertendo o meu sistema para Banco de Dados MySQL, já consegui fazer a conexão via ADO, mas estou tendo alguns problemas com xBrowse.

1) Campo tipo Date na coluna 

2) Somatória na Coluna

   DEFINE DIALOG oDlg RESOURCE "BROWSER_PRO" TITLE cSt_MODULO  FONT oFont
            REDEFINE BITMAP ID 5000 RESOURCE "BANNER" OF oDlg ADJUST  
            REDEFINE SAY OSt_MODULO      VAR cSt_MODULO    ID 5001 OF oDlg FONT oFont_Banner01 PICTURE "@X" COLORS CLR_BLACK, RGB(198, 255, 198)  UPDATE 
             REDEFINE XBROWSE oBrw ID 100 OF oDlg DATASOURCE o_produto ;
            COLUMNS "id","descricao","qtdest","unidade","vlunidade","vlmaster", "vlundmast", "vlcusto", "(((vlmmaster/vlCusto)-1)*100)", "qtdmin" ;
            COLSIZES  40, 280, 70, 30, 70, 70, 70, 70, 70, 70, 70 ;
            HEADERS "id", "Descrição", "Estoque", "Und", "Vl.Unit.", "Vl.Master", "Vl.Und.Mast", "Vl.Custo", "Margem", "Est.Minimo" ;
            PICTURES '99999', nil, '@E 999,999.999', nil, '@E 999,999.99', '@E 999,999.99', '@E 999,999.99', '@E 999,999.99', '@E 999.999', '@E 99,999.99' ; 
            CELL LINES NOBORDER
            oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL // Estilo da linha selecionada  MARQSTYLE_HIGHLROW - Linha Azul // MARQSTYLE_HIGHLCELL - grade azul
           oBrw:lVScroll            := .T.     //  Barra rolagem vertical
            oBrw:lColDividerComplete := .f.       // Sem grade no browse
            oBrw:nHeaderLines := 1                     // Altura encabezamiento
            oBrw:nDataLines := 1                     // Altura líneas
            oBrw:lRecordSelector := .t.             // poner o no, COL de la flechita de la izq
            oBrw:bClrStd := { || { CLR_BLACK, ColorFundo(oBrw:aCols[3],oBrw:aCols[10]) } } // Efecto pijama
            oBrw:bKeyDown:={|nKey| ProcKeyProduto(nKey,oBrw,oDlg)}      
            oBrw:SetFocus()

Link to comment
Share on other sites

Bom dia

Obrigado pelaS respostas, só consigo responder pela manhã.

Não funcionou, vou dar mais uma estudada se conseguir resolver coloco no grupo

image.png.adfbff0a6a7d818788b5a2fce7d73f4a.png

Quanto ao banco de dados nativo não sei se tem muito material, e devido a isso acabei optando pelo ODBC 

Link to comment
Share on other sites

Bom dia

Consegui resolver o problema

Select ficou assim

o_produto     := oCon:Execute( "SELECT id, descricao, qtdest, unidade , vlunidade, vlmaster, vlundmast, vlcusto, (((vlmaster/vlCusto)-1)*100) AS 'margem', qtdmin FROM produto ORDER BY descricao" )        
  calculo direto no select e criado uma AS margem

xBrowse  exibo com nome criado

COLUMNS 'id','descricao','qtdest','unidade','vlunidade','vlmaster', 'vlundmast', 'vlcusto', 'margem', 'qtdmin'

Posso usar 'id' ou o_produto:Fields[ "id"]:Value()

image.png.a5aabe54ffcbd0c3787a1a94251757f2.png

 

 

 
   

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...