home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga ACS 1998 #4
/
amigaacscoverdisc1998-041998.iso
/
utilities
/
commercialdemos
/
gestacomptedemo
/
scripts_arexx
/
tab2.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-11-13
|
8KB
|
247 lines
/** $VER: Tab2 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
Somme590=0
Somme730=0
Somme600=0
Somme610=0
Somme611=0
Somme620=0
Somme620E=0
SommeSC=0
SommeSB1=0
SommeSB2=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'
res=0
x=OPEN('infos','ram:Tableau2','w') /* crée le fichier */
operation 1
PARSE VAR result . '/' mois '/' . /* récupère le mois sélectionné */
/* Entête du fichier */
CALL Tableau2EnTete
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 '/' . '/' Nature '/' Somme '/' Libelle '/' Poste '/' .
IF i=TotalLignes THEN DO /* toutes les 30ème opérations on passe à la page suivante */
NumeroPage=NumeroPage+1
CALL Tableau2Total
res=WRITELN('infos',SautPage)
NumeroLigne=0
CALL Tableau2EnTete
TotalLignes=TotalLignes+29
END
/* Composition d'une ligne */
ligne= '|'LEFT(libelle,20,' ')'|'
IF Nature="Bank1Outflow" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
SommeSB1=SommeSB1+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Nature="Bank2Outflow" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
SommeSB2=SommeSB2+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Nature="CashPayment" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
SommeSC=SommeSC+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 Poste="730 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme730=Somme730+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="600 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme600=Somme600+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="610 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme610=Somme610+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="611 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme611=Somme611+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="620 " THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme620=Somme620+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Poste="620(1)" THEN DO
ligne= ligne||RIGHT(Somme,9,' ')
Somme620E=Somme620E+Somme
END
ELSE ligne= ligne||" "
ligne= ligne'|'
NumeroLigne=NumeroLigne+1
ligneImp= RIGHT(NumeroLigne,2,' ')||ligne
res=WRITELN('infos',ligneImp)
END
CALL Tableau2Total
x=CLOSE('infos') /* ferme le fichier */
EXIT
/*---------------- Total du Tableau 2 --------------*/
Tableau2Total:
res=WRITELN('infos',traitH)
ligne="AR| |"
CALL ComposeLigne
res=WRITELN('infos',ligne || '|')
res=WRITELN('infos',ESC||'[3w')
RETURN
/*---------------- Entête du Tableau 2 --------------*/
Tableau2EnTete:
traitH=" ---------------------------------------------------------------------------------------------------------------------------"
Entete=" | LIBELLE | Banque1 | Banque2 | Caisse || 590 | 730 | 600 | 610 | 611 | 620 | 620(1) |"
res=WRITELN('infos',ESC||'[4w')
res=WRITELN('infos',' FEUILLE COMPTABLE (2ème 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
ligne= ligne'|'
res=WRITELN('infos',ligne)
RETURN
ComposeLigne:
IF SommeSB1>0 THEN ligne= ligne || RIGHT(SommeSB1,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF SommeSB2>0 THEN ligne= ligne || RIGHT(SommeSB2,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF SommeSC>0 THEN ligne= ligne || RIGHT(SommeSC,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'||'
IF Somme590>0 THEN ligne= ligne || RIGHT(Somme590,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme730>0 THEN ligne= ligne || RIGHT(Somme730,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme600>0 THEN ligne= ligne || RIGHT(Somme600,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme610>0 THEN ligne= ligne || RIGHT(Somme610,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme611>0 THEN ligne= ligne || RIGHT(Somme611,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme620>0 THEN ligne= ligne || RIGHT(Somme620,9,' ')
ELSE ligne= ligne||" "
ligne= ligne'|'
IF Somme620E>0 THEN ligne= ligne || RIGHT(Somme620E,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