LOCAL cResp, cCmd

cIdS = ''
cCond = ' 1 '
IF !EMPTY(oJs.cParam)
*!*		IF oApp.sqlexec('select idsalesman from user where id='+oJs.cParam,'curS')>0
*!*			cIdS = curS.idsalesman
*!*		ENDIF
	
	cIdS = ALLTRIM(TRANSFORM(oJs.cParam))
	cCond = " v.id = "+cIdS
	
ENDIF


cTabla = 'customer'


TEXT TO cCmd NOSHOW TEXTMERGE
SELECT
c.id+0 as id,		
c.ruc,		
c.name,		
c.comercio,		
c.address,		
c.city,		
c.email,		
c.phone,		
c.pvp,		
c.codigo,		
c.opcionpvp,		
c.idsalesman+0 as idsalesman,		
c.idzona+0 as idzona,		
c.note as notas ,		
c.secuencia ,		
c.openaccount as cupo,		
c.tipo as tipocliente,		
c.diascredito,		
0 as idvisita,		
if(TRIM(c.horavisita)="","12:00:00",c.horavisita) as horavisita,		
c.latitud ,		
c.longitud  	
FROM customer as c 
inner join salesman as v on c.idsalesman=v.id
where <<cCond>>
ENDTEXT


*STRTOFILE(cCmd,'\eddy_cliente.txt')

oApp.sqlexec(cCmd,cTabla)

oJs.android_up(cTabla)
