picture en xbrowse

picture en xbrowse

Postby surGom » Sat Feb 16, 2013 11:36 am

Hola camaradas tengo el siguiente código

Code: Select all  Expand view  RUN
 REDEFINE XBROWSE oBrw id 110 of odlgx update;
                    columns 1,2,3,4,5,6;
                    COLSIZES 80,90,190,100,100,100;
                    HEADERS "Fecha", "Comprobante", "Descripción","Debe" ,"Haber","Total";
                    PICTURES "@d", nil,NIL,"@e 99,999,999.99","@e 99,999,999.99","@e 99,999,999.99" ;
                    OBJECT oCtae lines cell



  WITH OBJECT oBrw
     :nMarqueeStyle := 4
     :nColDividerStyle := LINESTYLE_BLACK
     :nStretchCol := STRETCHCOL_LAST
     :lColDividerComplete := .f.
     :l2007 := .t.
     :lAllowColHiding := .f.
  END WITH

  WITH OBJECT oBrw:aCols[1]
     :bStrData := {|| iif(oCtae:npro = nproa,oCtae:fecha,"")}
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[2]
     :bStrData := {|| iif(oCtae:npro = nproa, oCtae:factura,"") }
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[3]
     :bStrData := {|| iif(oCtae:npro = nproa, oCtae:opera,"") }
     :nDataStrAlign := AL_LEFT
  END WITH

  WITH OBJECT oBrw:aCols[4]
     :bStrData := {||iif(oCtae:npro = nproa, IIF(oCtae:lsumo,oCtae:importe,""),"") }
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[5]
     :bStrData := {|| iif(oCtae:npro = nproa,IIF(!oCtae:lsumo,oCtae:importe,""),"") }
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[6]
     :bStrData := {|| iif(oCtae:npro = nproa,oCtae:saldo,"") }
     :nDataStrAlign := AL_RIGHT
  END WITH


y no me respeta los pictures numéricos me los muestra

12345.00 en vez de 12.345,00

Esto sólo me pasa en los xbrowse en los wbrowse los muestra correctamente.

Viendo en los ejemplos encontre XBrNumFormat( 'E', .t. ) , pero tampoco lo respeta

¿Como hay que definir las columnas?

Luis
surGom
 
Posts: 640
Joined: Wed Oct 19, 2005 12:03 pm

Re: picture en xbrowse

Postby joseluisysturiz » Sat Feb 16, 2013 2:41 pm

Buen dia, con bStrData a mi me funciona asi, saludos... :shock:

WITH OBJECT oBrw:aCols[8]
:cHeader := "MONTO"
:bStrData := {|| IIF( oQryBancos:LastRec() == 0, SPACE(10) ,;
TRANSFORM( oQryBancos:mov_mtomovi, "@E 9,999,999.99" ) ) }

:nWidth := 70
:bEditValue := "@E 9,999,999.99"
:nFootStrAlign := AL_RIGHT
:lTotal := .t.
:nTotal := 0 // sumamtomovi( oQryBancos )
:nFooterType := AGGR_SUM
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | mayorqcero( oGet:value() ) }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey <> VK_ESCAPE ,;
( oCol:value := xVal ,;
totalinea( oBrw, aVar, aGet ) ,;
graba_movbco( lNew, aVar, oDlg, oBrw, oQryBancos ) ,;
addrow( oBrw, oQryBancos, lNew ) ), ) }
:bEditWhen := {|| !EMPTY( aItems[oBrw:nArrayAt, 1] ) }
END WITH
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: picture en xbrowse

Postby surGom » Sat Feb 16, 2013 7:09 pm

Gracias nuevamente José Luis, ahora lo muestra correctamente. Pero no tendría que ser lo lógico que una vez que definís el xbrowse, este tomara los picture correctamente. Con que necesidad los declaro si luego tengo que hacerlo columna por columna???

O hay otra forma de declararlo a como lo hago?


Luis
surGom
 
Posts: 640
Joined: Wed Oct 19, 2005 12:03 pm

Re: picture en xbrowse

Postby joseluisysturiz » Sat Feb 16, 2013 7:55 pm

Nunca lo he manejado definiendolos arriba en el xbrowse porque me pasaba lo mismo que a ti, asi que los defino en sus columnas, nose si es porque es con bstrdata, pruebalo con bEditValue haber si asi si toma la definicion de la mascara en el xbrowse y no por columnas, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: picture en xbrowse

Postby surGom » Sat Feb 16, 2013 10:00 pm

Gracias José , lo probé pero no funciona. Así que será como me indicaste anteriormente.


Luis
surGom
 
Posts: 640
Joined: Wed Oct 19, 2005 12:03 pm

Re: picture en xbrowse

Postby nageswaragunupudi » Fri Feb 22, 2013 9:06 am

Mr surGom

Please NEVER use bStrData.
Instead assign the codeblock to bEditValue.
Example:
Code: Select all  Expand view  RUN
 WITH OBJECT oBrw:aCols[1]
     :bEditValue := {|| iif(oCtae:npro = nproa,oCtae:fecha, CTOD( "" ) )}
     // :nDataStrAlign := AL_RIGHT // not necessary because Dates are automatically justified right.
  END WITH
 


It is a good practice to declare the formatting with
XbrNumFormat( "E", .t. ).
XBrowse's internally generated format will respect this setting through out the application.
If you change "E" as "A", then the entire application will use American format.

However you should not directly hardcode the picture strings as "@E 999".
Instead use the Function NumPict( 12, 2 ) // 12 is total size and 2 decimal places.

Example:
Code: Select all  Expand view  RUN
 WITH OBJECT oBrw:aCols[4]
     :bEditValue := {||iif(oCtae:npro = nproa, IIF(oCtae:lsumo,oCtae:importe,0),0) }
     :cEditPicture := NumPict( 12, 2 )
     // numbers are automatically justified right. We need not specifically specify AL_RIGHT
  END WITH
 


I would still advise declare all column codeblocks and picture clauses inside the main XBROWSE command.

Please remember that XBrowse is created to achieve more complex work with least code.
Regards

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

Re: picture en xbrowse

Postby nageswaragunupudi » Fri Feb 22, 2013 9:29 am

Mr SurGom

This is a suggested replacement of the code you posted above.

Code: Select all  Expand view  RUN

XBrNumFormat( "E", .t. )   // This may be placed at the beginning of Main() function.

cAmtPict    := NumPict( 11, 2 )

aCols := { ;
{ { || If( oCtae:npro = nproa, oCtae:fecha, BLANK( oCtae:fecha ) ) }, "Fetcha", nil, 80 }, ;
{ { || If( oCtae:npro = nproa, oCtae:factura, BLANK( oCtae:factura ) ) }, "Comprobante", nil, 90 }, ;
{ { || If( oCtae:npro = nproa, oCtae:opera, BLANK( oCtae:opera ) ) }, "Description", nil, 190 ), ;
{ { || If( oCtae:npro = nproa .and.   oCtae:lsumo, oCtae:importe, 0 ) }, "Debe",  cAmtPict, 100 }, ;
{ { || If( oCtae:npro = nproa .and. ! oCtae:lsumo, oCtae:importe, 0 ) },  "Haber", cAmtPict, 100 }, ;
{ { || If( oCtae:npro = nproa, oCtae:saldo, 0 ) }, "Total", cAmtPict, 100 } ;
}

REDEFINE XBROWSE oBrw ID 110 OF oDlgx COLUMNS aCols DATASOURCE oCtae ;
   LINES CELL UPDATE
   
WITH OBJECT oBrw
   :lDisplayZeros := .f.
   :nMarqueeStyle := MARQSTYLE_HIGHLROWRC
   // :nColDividerStyle := LINESTYLE_BLACK  // default
   :nStretchCol := STRETCHCOL_WIDEST
   :lColDividerComplete := .f.
   // :l2007 := .t.   // default
   :lAllowColHiding := .f.
END WITH
 


Another Alternative
Code: Select all  Expand view  RUN
XbrNumFormat( "E", .t. )
cAmtPict    := NumPict( 11, 2 )

REDEFINE XBROWSE oBrw ID 110 OF oDlgx DATASOURCE oCtae ;
   COLUMNS ;
      { { || If( oCtae:npro = nproa, oCtae:fecha, BLANK( oCtae:fecha ) ) },  ;
      { { || If( oCtae:npro = nproa, oCtae:factura, BLANK( oCtae:factura ) ) },  ;
      { { || If( oCtae:npro = nproa, oCtae:opera, BLANK( oCtae:opera ) ) },  ;
      { { || If( oCtae:npro = nproa .and.   oCtae:lsumo, oCtae:importe, 0 ) },  ;
      { { || If( oCtae:npro = nproa .and. ! oCtae:lsumo, oCtae:importe, 0 ) },  ;
      { { || If( oCtae:npro = nproa, oCtae:saldo, 0 ) } ;
   HEADERS "Fecha", "Comprobante", "Descripción","Debe" ,"Haber","Total";
   PICTURES nil, nil,NIL, cAmtPict, cAmtPict, cAmtPict ;
   LINES CELL UPDATE
   
WITH OBJECT oBrw
   :lDisplayZeros := .f.
   :nMarqueeStyle := MARQSTYLE_HIGHLROWRC
   // :nColDividerStyle := LINESTYLE_BLACK  // default
   :nStretchCol := STRETCHCOL_WIDEST
   :lColDividerComplete := .f.
   // :l2007 := .t.   // default
   :lAllowColHiding := .f.
END WITH
 
Regards

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

Re: picture en xbrowse

Postby surGom » Fri Feb 22, 2013 10:36 am

Gracias Nageswaragunupudi lo voy a implementar.


Luis
surGom
 
Posts: 640
Joined: Wed Oct 19, 2005 12:03 pm

Re: picture en xbrowse

Postby nageswaragunupudi » Fri Feb 22, 2013 10:50 am

I forgot this
please add this line
oBrw:lDisplayZeros := .f. // default value is .t.

When this is .f., blank values are shown as complete blanks instead of 0,00 or " / / ", etc

I also edited the code posted above making some small but important corrections.
Regards

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

Re: picture en xbrowse

Postby surGom » Sun Feb 24, 2013 1:50 am

Nageswaragunupudi, when I put your code does the following:
(is equal to datasource that object)
Image

Code: Select all  Expand view  RUN
#include "Fivewin.ch"
#include "xbrowse.ch"
#include "splitter.ch"
#include "report.ch"

static octae

FUNCTION xBrwgen()

local odlgx
local oBrw, oSpli
local nProa := 0
local napea
local aMae := array(0)
local oGet := array(7)
local beval  := {|| aMae := iif(empty(nproa),buspro(),buspro(nproa)), iif(len(aMae) > 0,(nproa := aMae[1],napea := aMae[2],odlgx:update(),filtro(nproa,oBrw,oGet,oDlgx),.t.),odlgx:end())}
local aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
                    { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
local aGradBarSel := {{.5,RGB(255,255,251), RGB( 255, 196, 178 ) },;
                     { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }

local nSaldo := 0
local z := 0
local cAmtPict



 if !pasaje("CTAEXPO");return nil; endif
   DATABASE oCtae
   oCtae:setorder(1)
   oCtae:beof := {|| nil}
   oCtae:bBoF := {|| nil}
   oCtae:setfilter({|| (oCtae:cAlias)->npro = 0 } )
   //oCtae:setfilter( "(oCtae:cAlias)->npro = 0 " )



DEFINE DIALOG oDlgx resource "dia_xbrowse"


  REDEFINE GET oGet[1] VAR nproa id 121 of odlgx update valid eval(beval)
  REDEFINE GET oGet[2] VAR napea id 120 of odlgx update

  REDEFINE BTNBMP oGet[3] id 101 of oDlgx resource "btngastos","btnastos1" ACTION ctaexpo(oCtae,oBrw,nproa,.t.,.t.) update
  REDEFINE BTNBMP oGet[4] id 102 of oDlgx resource "btnpagos","btnpagos1" ACTION ctaexpo(oCtae,oBrw,nproa,.f.,.t.) update
  REDEFINE BTNBMP oGet[5] id 103 of oDlgx resource "btncambiar","btncambiar1" ACTION ctaexpo(oCtae,oBrw,nproa,,.f.) update
  REDEFINE BTNBMP oGet[6] id 104 of oDlgx resource "BTNIMPRI","BTNIMPRI1" ACTION Reporte(nProa,oCtae) update
  //REDEFINE BTNBMP oGet[7] id 105 of oDlgx resource "BTNELIMINA","BTNELIMINA1" ACTION borrar(nProa,oCtae)

  for z = 3 to 6
       oGet[z]:disable()
  next

  REDEFINE SPLITTER oSpli ID 111 COLOR rgb(234,234,234)  of odlgx _3DLOOK
 

XbrNumFormat( "E", .t. )
cAmtPict    := NumPict( 11, 2 )

REDEFINE XBROWSE oBrw ID 110 OF oDlgx OBJECT oCtae;
   COLUMNS ;
      { { || If( oCtae:npro = nproa, oCtae:fecha,  "") }},  ;
      { { || If( oCtae:npro = nproa, oCtae:factura, "") }},  ;
      { { || If( oCtae:npro = nproa, oCtae:opera, "") }},  ;
      { { || If( oCtae:npro = nproa .and.   oCtae:lsumo, oCtae:importe, 0 ) }},  ;
      { { || If( oCtae:npro = nproa .and. ! oCtae:lsumo, oCtae:importe, 0 ) }},  ;
      { { || If( oCtae:npro = nproa, oCtae:saldo, 0 ) }} ;
   HEADERS "Fecha", "Comprobante", "Descripción","Debe" ,"Haber","Total";
   COLSIZES 80,90,190,100,100,100;
   PICTURES nil, nil,NIL, cAmtPict, cAmtPict, cAmtPict ;
   LINES CELL UPDATE

WITH OBJECT oBrw
   :lDisplayZeros := .f.
   :nMarqueeStyle := MARQSTYLE_HIGHLROWRC
   // :nColDividerStyle := LINESTYLE_BLACK  // default
   :nStretchCol := STRETCHCOL_WIDEST
   :lColDividerComplete := .f.
   // :l2007 := .t.   // default
   :lAllowColHiding := .f.
END WITH



 
 activate dialog odlgx

 cierroalias(oCtae:cAlias,oCtae)

 return nil
/***************************************************************************/
 static function borrar(nProa,oCtae)
 return nil
/***************************************************************************/
 static function filtro(nproa,oBrw,oGet,odlgx)
 local z := 0
  oCtae:setfilter()
  oCtae:setfilter({|| (oCtae:cAlias)->npro = nproa})
  for z = 3 to 6
       oGet[z]:enable()
  next
  odlgx:update()
  oBrw:refresh()
  oBrw:gotop()
  oBrw:gobottom()
 return nil
/***************************************************************************/
static function reporte(nproa )
local oinfo
local dFec := dehasta()
local cAlias




if empty(dFec)
   return nil
endif
if !pasaje("ctaexpo");return nil;endif
   cAlias := alias(select())
   set order to 1

   set filter to (cAlias)->npro = nproa
   dbgotop()
   dbseek(dFec[1])


REPORT oInfo title "Movimiento de Cuenta" preview;
FOOTER "Página Nro:"+str(oInfo:nPage,3) RIGHT;
CAPTION "Visualizar movimientos"

COLUMN DATA (cAlias)->fecha title "Fecha" picture "@d"
COLUMN DATA (cAlias)->factura  title "Comprobante"
COLUMN DATA Alltrim((cAlias)->opera)  title "Detalle"
COLUMN DATA iif((cAlias)->lsumo,(cAlias)->importe,"") title "Debe" PICTURE "@E 9,999,999.99" RIGHT
COLUMN DATA iif((cAlias)->lsumo,space(14),(cAlias)->importe) title "Haber" PICTURE iif((cAlias)->lsumo,"","@E 9,999,999.99") RIGHT
COLUMN DATA (cAlias)->saldo title "Saldo" PICTURE "@E 9,999,999.99" RIGHT

ENDREPORT

oInfo:nTitleUpLine := RPT_SINGLELINE
oInfo:nTitleDnLine := RPT_SINGLELINE
oInfo:nTotalLine := RPT_SINGLELINE

ACTIVATE REPORT oInfo WHILE ((cAlias)->fecha) >= dFec[1] .and. ((cAlias)->fecha <=  dFec[2])

dbclosearea()

return nil
/******************************************************************************/

 



with other code, it displayed correctly

Image


Thank you

Luis
surGom
 
Posts: 640
Joined: Wed Oct 19, 2005 12:03 pm

Re: picture en xbrowse

Postby surGom » Sun Feb 24, 2013 9:20 am

I needed to add
Code: Select all  Expand view  RUN
WITH OBJECT oBrw:aCols[1]
     :bStrData := {|| oCtae:fecha}
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[2]
     :bStrData := {|| oCtae:factura }
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[3]
     :bStrData := {|| oCtae:opera }
     :nDataStrAlign := AL_LEFT
  END WITH

  WITH OBJECT oBrw:aCols[4]
    :bStrData := {|| oCtae:importe   }
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[5]
     :bStrData := {|| oCtae:importe }
     :nDataStrAlign := AL_RIGHT
  END WITH

  WITH OBJECT oBrw:aCols[6]
     :bStrData := {|| oCtae:saldo}
     :nDataStrAlign := AL_RIGHT
  END WITH


Thanks you

Luis
surGom
 
Posts: 640
Joined: Wed Oct 19, 2005 12:03 pm


Return to FiveWin para Harbour/xHarbour

Who is online

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