#include "FiveWin.ch"
#include "FileXLS.ch"
#include "Mail.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oXLS
local nFont1,nFont2,nEventual,nPrel,aPreliqs
local nFormat1, nFormat2, nFormatPts, nFormatFecha
PUBLIC nNum1, nNum2, cTexto,nFila,cFile // estas variables tienen que ser declaradas publicas
PUBLIC dFecha, lLogico // para poder ser procesadas en las formulas de Excel
nEventual := 0
aPreliqs := {"PRIMER",;
"SEGUNDO",;
"TERCERO",;
"CUARTO",;
"QUINTO",;
"SEXTO",;
"SEPTIMO",;
"OCTAVO",;
"NOVENO",;
"DECIMO",;
"DECIMO PRIMER",;
"DECIMO SEGUNDO",;
"DECIMO TERCERO",;
"DECIMO CUARTO",;
"DECIMO QUINTO",;
"DECIMO SEXTO",;
"DECIMO SEPTIMO",;
"DECIMO OCTAVO" }
use f:\campo\preliq\dat\config shared new
nPrel := config->numprel
use f:\campo\maestros\maecan shared new via "dbfcdx"
set index to f:\campo\maestros\maecan
ORDSETFOCUS("PRODUCTOR")
use f:\campo\preliq\dat\preliqui shared new
SET RELATION TO PRELIQUI->PRODUCTOR INTO MAECAN
DEFINE XLS FONT nFont1 NAME "Arial" HEIGHT 12 BOLD
DEFINE XLS FONT nFont2 NAME "Arial" ITALIC BOLD
DEFINE XLS FORMAT nFormat1 PICTURE '#,##0.000'
DEFINE XLS FORMAT nFormat2 PICTURE '#,##0.00'
DEFINE XLS FORMAT nFormatPts PICTURE XLSFORMAT_NUMBER_8 // ver XLSForm.ch
DEFINE XLS FORMAT nFormatFecha PICTURE XLSFORMAT_DATE_1 // ver XLSForm.ch
cFile := "c:\buzon\imsspre"+strzero(nPrel,2,0)+".xls"
XLS oXLS FILE &cFile AUTOEXEC
XLS COL 1 WIDTH 08 OF oXLS
XLS COL 2 WIDTH 35 OF oXLS
XLS COL 3 WIDTH 15 OF oXLS
XLS COL 4 WIDTH 15 OF oXLS
XLS COL 5 WIDTH 3 OF oXLS
XLS COL 6 WIDTH 3 OF oXLS
XLS COL 7 WIDTH 15 OF oXLS
XLS COL 8 WIDTH 15 OF oXLS
@ 1, 1 XLS SAY "Fideicomiso Ingenio Zapoapita 80344" font nFont1 OF oXLS
@ 2, 1 XLS SAY "Relacion de pago cuota IMSS en "+;
aPreliqs[nPrel] +;
" pago provisional" FONT nFont1 OF oXLS
@ 4, 1 XLS SAY "Productor" OF oXLS
@ 4, 2 XLS SAY "Nombre" OF oXLS
@ 4, 3 XLS SAY "Tons." OF oXLS
@ 4, 4 XLS SAY "IMSS" OF oXLS
@ 4, 5 XLS SAY "Asoc." OF oXLS
@ 4, 6 XLS SAY "Pensionado" OF oXLS
@ 4, 7 XLS SAY "Eventual" OF oXLS
@ 4, 8 XLS SAY "Productor" OF oXLS
do while !preliqui->(eof())
nFila := recno() + 4
nEventual := IIF( preliqui->imss > round( preliqui->ton * 6.5 ,2 ),;
round(preliqui->ton * 6.5,2 ), preliqui->imss)
@ nFila, 1 XLS SAY preliqui->productor OF oXLS
@ nFila, 2 XLS SAY ALLTRIM(MAECAN->MCPATERNO)+" "+;
ALLTRIM(MAECAN->MCMATERNO)+" "+;
ALLTRIM(MAECAN->MCNOMBRE);
OF oXLS
@ nFila, 3 XLS SAY preliqui->ton OF oXLS ;
FORMAT nFormat1
@ nFila, 4 XLS SAY preliqui->imss OF oXLS ;
FORMAT nFormat2
@ nFila, 5 XLS SAY maecan->mcasoc OF oXLS
@ nFila, 6 XLS SAY IIF(maecan->pensionado,"S"," ") OF oXLS
@ nFila, 7 XLS SAY nEventual;
OF oXLS ;
FORMAT nFormat2
@ nFila, 8 XLS SAY (preliqui->imss - nEventual) OF oXLS ;
FORMAT nFormat2
preliqui->( dbskip() )
enddo
@ nFila+1,2 XLS SAY "Sumas:" font nFont2 OF oXLS
@ nFila+1,3 XLS FORMULA _SUM(5,3, nFila,3) FORMAT nFormat1 OF oXLS
@ nFila+1,4 XLS FORMULA _SUM(5,4, nFila,4) FORMAT nFormat2 OF oXLS
@ nFila+1,7 XLS FORMULA _SUM(5,7, nFila,7) FORMAT nFormat2 OF oXLS
@ nFila+1,8 XLS FORMULA _SUM(5,8, nFila,8) FORMAT nFormat2 OF oXLS
ENDXLS oXLS
// EnviaMail("","")
CLOSE DATABASES
ShellExecute( ,"Open",cFile,,,0 )
return nil
Este lo tengo funcionando perfecto , chequenlo y me dicen...