RPV Reports / Usage Examples
 
Search in RpvSoftware.com
Go!                                         English    Español

What Rpv is

Rpv Reports 2024

Downloads

Training/Consultancy

Support

Purchase

Contact

 
Home > Usage Examples
Visual Fox Pro
El siguiente ejemplo muestra como generar un reporte RPV con Visual Fox Pro 7.
Code
&& AUTHOR: MIGUEL CARDENAS. Lima PerĂº.

#define money_ "$###,##0.00" && variable to define the mask to show currency
#define CRTLF CHR(13)+ CHR(10)
#define vbMaximizedFocus 3

Declare INTEGER ShellExecute ;
IN SHELL32.dll ;
INTEGER nWinHandle, STRING cOperation, STRING cFileName, ;
STRING cParameters, STRING cDirectory, INTEGER nShowWindow
*
create cursor cData (emp_id c(4), emp_name c(50), emp_address c(50), emp_phone c(20), ;
   emp_zipcode c(4), emp_e_mail c(50), emp_birth_date d, emp_salary n(15,2), ;
   emp_area c(20), emp_schedule c(20), emp_start_date d)

insert into cData (emp_id, emp_name, emp_address, emp_phone, emp_zipcode, ;
   emp_e_mail, emp_birth_date, emp_salary, emp_area, emp_schedule, emp_start_date) ;
   values ;
   ("0001", "MIGUEL C.", "LIMA", "457844", "45", "MIMAIL@MISERVER", DATE(), ;
   150.45, "SISTEMAS", "SCHELUDE", DATE())

insert into cData (emp_id, emp_name, emp_address, emp_phone, emp_zipcode, ;
   emp_e_mail, emp_birth_date, emp_salary, emp_area, emp_schedule, emp_start_date) ;
   values ;
   ("0002", "JOSE D.", "LIMA", "457844", "45", "MIMAIL@MISERVER", DATE(), ;
   150.45, "SISTEMAS", "SCHELUDE", DATE())

*!* emp_id
*!* emp_name
*!* emp_address
*!* emp_phone
*!* emp_zipcode
*!* emp_e_mail
*!* emp_birth_date
*!* emp_salary
*!* emp_area
*!* emp_schedule
*!* emp_start_date

*
local lnConFile, lcFile, lcTexto, lcTexto
*
lcFile= "c:employees.rpv"
lcRutaRpv= "C:Archivos de programaRpv"
*
STORE "" TO lcTexto
*
lnConFile= Fcreate(lcFile)
       if lnConFile> 0
          lcTexto= lcTexto+ "report_title=Employees report."+ CRTLF
          lcTexto= lcTexto+ "Papersize=letter"+ CRTLF && defines paper size
          lcTexto= lcTexto+ "orientation=2"+ CRTLF && defines landscape orientation
          lcTexto= lcTexto+ "spacing=250"+ CRTLF && defines space between lines default is 200
          && the programmer defines the columns
          lcTexto= lcTexto+ "$c0=400"+ CRTLF
          lcTexto= lcTexto+ "$c1=1000"+ CRTLF
          lcTexto= lcTexto+ "$c2=3400"+ CRTLF
          lcTexto= lcTexto+ "$c3=6800"+ CRTLF
          lcTexto= lcTexto+ "$c4=8400"+ CRTLF
          lcTexto= lcTexto+ "$c5=11000"+ CRTLF
          lcTexto= lcTexto+ "$c6=13000"+ CRTLF
          lcTexto= lcTexto+ "$c7=13200"+ CRTLF
          && header section begins
          && remember that "HEADER" means all the data that will be common for all  the pages
          lcTexto= lcTexto+ "[header]"+ CRTLF
          lcTexto= lcTexto+ "{f=arial;s=8}"+ CRTLF
          lcTexto= lcTexto+ "{pic=rpvlogo.bmp,400,400,1400,900}"+ CRTLF
          lcTexto= lcTexto+ "{n;$c7} Page {12800;pag}"+ CRTLF
          lcTexto= lcTexto+ "{s=16;n;1800;c=2;b=y} Sample Application Report {spacing=350;n}"+ CRTLF
          lcTexto= lcTexto+ "{c=1;1800} Employees Report (one line per record). {c=0;b=n;n;n;n}"+ CRTLF
          lcTexto= lcTexto+ "{LINE=400,14000;n}"+ CRTLF
          lcTexto= lcTexto+ "{s=8;b=y;$c0} ID {$c1} Name {$c2} Address {$c3} Phone {$c4} E-mail {$c5} Birth date {a=r;$c6} Mon Salary {a=l;$c7} Schedule {b=n;spacing=375;n}"+ CRTLF
          lcTexto= lcTexto+ "{LINE=400,14000;n}"+ CRTLF
          && data section begins
          lcTexto= lcTexto+ "[data]"+ CRTLF
*       
          select cData
          go top
          scan
                 && reads from person.dat
                 If cData.emp_salary < 1500
                           string_color = "c=12"
                 Else
                           string_color = "c=0"
                 EndIf
                 lcTexto= lcTexto+ ;
                        "{$c0} "+ cData.emp_id+ ;
                        "{$c1}"+ cData.emp_name+ ;
                        "{$c2}"+ cData.emp_address+ ;
                        "{$c3}"+ cData.emp_phone+ ;
                        "{$c4}"+ cData.emp_e_mail+ ;
                        "{$c5}"+ alltrim(dtoc(cData.emp_birth_date))+ ;
                        "{a=r;"+ string_color+ ;
                        ";$c6}"+ alltrim(str(cData.emp_salary, 15, 2))+ ;
                        "{c=0;a=l;$c7}"+ cData.emp_schedule+ ;
                        "{n}"+ CRTLF
          endscan

          fwrite(lnConFile, lcTexto)
          Fclose(lnConFile)
*
          && lcTexto must contain some text
          *!*        lcPathRpv= lcRutaRpv+ "rpv"+ lcFile+ " /e"
          *!*        lctempo= "run "+ lcRutaRpv+ "rpv "+ lcFile
          *!*        &lctempo

          lnexito= ShellExecute(0, "Open", "Rpv", lcFile, lcRutaRpv, 1)
       endif

  ShellExecute(0, "Open", "Rpv", lcFile, lcRutaRpv, 1)

Home
What Rpv is
Rpv Reports 2024

Products
Rpv Reports 2024
Personalized edition

More...
Downloads
Support
Rpv Reports Online help
Rpv Visual Editor online help
Examples
/temp section
Videos




Copyright (c) 2001-2024 - Rpv Software. All rights reserved.