home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga ACS 1998 #4
/
amigaacscoverdisc1998-041998.iso
/
utilities
/
commercialdemos
/
gestacomptedemo
/
scripts_arexx
/
tab1.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-11-13
|
7KB
|
222 lines
/** $VER: Tab1 1.2 (05.09.97)
** Auteur: Fabrice SABATIER
**
** Commande ARexx sous GestaLivre V2.0.
**
** Création des tableaux en ARexx pour un cabinet médical.
**
**/
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
TotalLignes=30
Somme420=0
Somme761=0
Somme700=0
Somme790=0
Somme590=0
SommeEC=0
SommeEB1=0
SommeEB2=0
LettreMois.01='JANVIER'
LettreMois.02='FEVRIER'
LettreMois.03='MARS'
LettreMois.04='AVRIL'
LettreMois.05='MAI'
LettreMois.06='JUIN'
LettreMois.07='JUILLET'
LettreMois.08='AOUT'
LettreMois.09='SEPTEMBRE'
LettreMois.10='OCTOBRE'
LettreMois.11='NOVEMBRE'
LettreMois.12='DECEMBRE'
x=OPEN('infos','ram:Tableau1','w') /* crée le fichier */
operation 1
PARSE VAR result . '/' mois '/' . /* récupère le mois sélectionné */
/* Entête du fichier */
CALL Tableau1EnTete
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 jour '/' . '/' . '/' Somme '/' Libelle '/' Poste '/' .
IF i=TotalLignes THEN DO /* toutes les 30ème opérations on passe à la page suivante */
NumeroPage=NumeroPage+1
CALL Tableau1Total
res=WRITELN('infos',SautPage)
NumeroLigne=0
CALL Tableau1EnTete
TotalLignes=TotalLignes+29
END
/* Composition d'une ligne */
ligne='|'
IF Poste="420 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme420=Somme420+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="761 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme761=Somme761+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="700 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme700=Somme700+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="790 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme790=Somme790+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="590 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme590=Somme590+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'||'
IF Nature="CashInflow" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
SommeEC=SommeEC+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Nature="Bank2Entry" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
SommeEB2=SommeEB2+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Nature="Bank1Entry" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
SommeEB1=SommeEB1+Somme
END
ELSE ligne= ligne||" "
ligne= ligne||'|'RIGHT(jour,2,' ')
ligne= ligne||'|'LEFT(libelle,20,' ')'|'
ligneImp= RIGHT(i,2,' ')||ligne
res=WRITELN('infos',ligneImp)
END
CALL Tableau1Total
x=CLOSE('infos') /* ferme le fichier */
EXIT
/*---------------- Total du Tableau 1 --------------*/
Tableau1Total:
res=WRITELN('infos',traitH)
ligne="AR|"
CALL ComposeLigne
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||" "
res=WRITELN('infos',ligne || '|')
res=WRITELN('infos',ESC||'[3w')
RETURN
/*---------------- Entête du Tableau 1 --------------*/
Tableau1EnTete:
traitH=" ----------------------------------------------------------------------------------------------------------"
Entete=" | 420 | 761 | 700 | 790 | 590 || Caisse | Banque2 | Banque1 |DA| LIBELLE |"
res=WRITELN('infos',ESC||'[4w')
res=WRITELN('infos',' FEUILLE COMPTABLE (1ère Partie) page 'NumeroPage)
showyear
res=WRITELN('infos',' ANNEE: '||result)
res=WRITELN('infos',' MOIS: 'lettremois.mois)
res=WRITELN('infos',traitH)
res=WRITELN('infos',Entete)
res=WRITELN('infos',traitH)
/* Ecrit les lignes des données dans le fichier */
ligne=" R|"
CALL ComposeLigne
res=WRITELN('infos',ligne||'|| | | | | |')
RETURN
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||" "
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