home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga ACS 1998 #4
/
amigaacscoverdisc1998-041998.iso
/
utilities
/
commercialdemos
/
gestacomptedemo
/
scripts_arexx
/
recap1.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-11-13
|
7KB
|
213 lines
/** $VER: Récap1 1.1 (05.09.97)
** Auteur: Fabrice SABATIER
**
** Commande ARexx sous GestaLivre V2.0.
**
** Composition des pages d'écriture.
**
**/
OPTIONS RESULTS
NL = '0a'x
SautPage = '0C'x /* caractère de saut de page */
ESC = '1B'x
/***************** Définit les variables d'environnement ***********************/
ADDRESS COMMAND "SYS:Rexxc/rx ENV:GestaCompte.ARexxPréfs" /* execute le script de définitions des préférences */
NOM_PORT_LIVRE =GETCLIP('Port_Livre')
NOM_ECRAN_PUB =GETCLIP('Ecran_Livre')
/************************************************************************/
SIGNAL ON SYNTAX /* détourne les messages d'erreurs */
/* ouvre la library rexxreqtools.library pour les messages d'erreurs */
call addlib("rexxreqtools.library",0,-30,0)
ADDRESS VALUE NOM_PORT_LIVRE /* adresse du port Arexx */
nbre=0
NumeroLigne=0 /* initialisation des variables */
NumeroPage=1
Somme420=0
Somme761=0
Somme700=0
Somme790=0
Somme590=0
SommeEC=0
SommeEB1=0
SommeEB2=0
TotalSomme420=0
TotalSomme761=0
TotalSomme700=0
TotalSomme790=0
TotalSomme590=0
TotalSommeEC =0
TotalSommeEB1=0
TotalSommeEB2=0
LettreMois.1='JANVIER'
LettreMois.2='FEVRIER'
LettreMois.3='MARS'
LettreMois.4='AVRIL'
LettreMois.5='MAI'
LettreMois.6='JUIN'
LettreMois.7='JUILLET'
LettreMois.8='AOUT'
LettreMois.9='SEPTEMBRE'
LettreMois.10='OCTOBRE'
LettreMois.11='NOVEMBRE'
LettreMois.12='DECEMBRE'
res=0
x=OPEN('infos','ram:recap1','w') /* crée le fichier en mémoire */
/* Entête du fichier */
CALL EnTete
DO mois=1 TO 12
month mois /* se position sur le mois */
Somme420=0 /* initialisation des variables de calcul à zéro */
Somme761=0
Somme700=0
Somme790=0
Somme590=0
SommeEC=0
SommeEB1=0
SommeEB2=0
numboperations /* cherche le nombre d'opérations dans le mois */
nbre= result
DO i=1 TO nbre /* passe toutes les opérations une à une */
operation i
PARSE VAR result . '/' . '/' Nature '/' Somme '/' . '/' Poste '/' .
IF Poste="420 " THEN Somme420=Somme420+Somme /* calcul le total du mois */
IF Poste="761 " THEN Somme761=Somme761+Somme /* suivant le poste */
IF Poste="700 " THEN Somme700=Somme700+Somme
IF Poste="790 " THEN Somme790=Somme790+Somme
IF Poste="590 " THEN Somme590=Somme590+Somme
IF Nature="CashInflow" THEN SommeEC=SommeEC+Somme
IF Nature="Bank2Entry" THEN SommeEB2=SommeEB2+Somme
IF Nature="Bank1Entry" THEN SommeEB1=SommeEB1+Somme
END
TotalSomme420=TotalSomme420+Somme420 /* somme total en fin d'année pour chaque */
TotalSomme761=TotalSomme761+Somme761 /* poste */
TotalSomme700=TotalSomme700+Somme700
TotalSomme790=TotalSomme790+Somme790
TotalSomme590=TotalSomme590+Somme590
TotalSommeEC =TotalSommeEC +SommeEC
TotalSommeEB1=TotalSommeEB1+SommeEB1
TotalSommeEB2=TotalSommeEB2+SommeEB2
ligne='|'
CALL ComposeLigne
ligne= ligne||'| | 'LEFT(lettremois.mois,16,' ')'|'
NumeroLigne=NumeroLigne+1
ligneImp= RIGHT(NumeroLigne,2,' ')||ligne
res=WRITELN('infos',ligneImp)
END
CALL Total
x=CLOSE('infos') /* ferme le fichier */
EXIT
/*---------------- Entête du Tableau --------------*/
EnTete:
traitH=" ----------------------------------------------------------------------------------------------------------"
Entete=" | 420 | 761 | 700 | 790 | 590 || Caisse | Banque2 | Banque1 |DA| LIBELLE |"
res=WRITELN('infos',ESC||'[4w')
res=WRITELN('infos',' RECAPITULATION (1ère Partie) page 'NumeroPage)
showyear
res=WRITELN('infos',' ANNEE: '||result)
res=WRITELN('infos',' MOIS: ')
res=WRITELN('infos',traitH)
res=WRITELN('infos',Entete)
res=WRITELN('infos',traitH)
/* Ecrit les lignes des données dans le fichier */
ligne=" R| | | | | || | | | | |"
res=WRITELN('infos',ligne)
RETURN
/*---------------- Edition d'une ligne -----------------------*/
ComposeLigne:
IF Somme420>0 THEN ligne= ligne || RIGHT(Somme420,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme761>0 THEN ligne= ligne || RIGHT(Somme761,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme700>0 THEN ligne= ligne || RIGHT(Somme700,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme790>0 THEN ligne= ligne || RIGHT(Somme790,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme590>0 THEN ligne= ligne || RIGHT(Somme590,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'||'
IF SommeEC>0 THEN ligne= ligne || RIGHT(SommeEC,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF SommeEB2>0 THEN ligne= ligne || RIGHT(SommeEB2,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF SommeEB1>0 THEN ligne= ligne || RIGHT(SommeEB1,9,' ')
ELSE ligne= ligne||" "
RETURN
/*---------------- Total du Tableau --------------*/
Total:
res=WRITELN('infos',traitH)
ligne="14|"
IF TotalSomme420>0 THEN ligne= ligne || RIGHT(TotalSomme420,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF TotalSomme761>0 THEN ligne= ligne || RIGHT(TotalSomme761,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF TotalSomme700>0 THEN ligne= ligne || RIGHT(TotalSomme700,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF TotalSomme790>0 THEN ligne= ligne || RIGHT(TotalSomme790,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF TotalSomme590>0 THEN ligne= ligne || RIGHT(TotalSomme590,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'||'
IF TotalSommeEC>0 THEN ligne= ligne || RIGHT(TotalSommeEC,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF TotalSommeEB2>0 THEN ligne= ligne || RIGHT(TotalSommeEB2,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF TotalSommeEB1>0 THEN ligne= ligne || RIGHT(TotalSommeEB1,9,' ')
ELSE ligne= ligne||" "
res=WRITELN('infos',ligne || '| | TOTAL |')
res=WRITELN('infos',ESC||'[3w')
RETURN
/* Traite les messages d'erreurs */
SYNTAX:
IF RC=13 THEN call rtezrequest( " Environnement serveur non trouvé !!!" || NL || NL ||,
"Le nom du port ARexx utilisé dans le script est : "|| NL || NL ||,
"-----------------------------------------------"|| NL ||,
" " || NOM_PORT_LIVRE || NL ||,
"-----------------------------------------------"|| NL || NL ||,
"Note : Pour réparer ceci, veuillez fermer le module"|| NL ||,
" 'Livre' et modifier le type d'outil 'REXX' de"|| NL ||,
" l'icône, puis le relancer."|| NL || NL ||,
" ATTENTION aux minuscules/majuscules ",,
"OK", "Informations","rt_pubscrname="||NOM_ECRAN_PUB "rt_font=Gestacompte.font/8")
ELSE call rtezrequest(errortext(RC),"Vu",,"rt_pubscrname="||NOM_PORT_LIVRE "rt_font=Gestacompte.font/8")
EXIT