home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / commercialdemos / gestacomptedemo / scripts_arexx / tab1.rexx < prev    next >
OS/2 REXX Batch file  |  1997-11-13  |  7KB  |  222 lines

  1. /** $VER: Tab1 1.2 (05.09.97)
  2.  ** Auteur: Fabrice SABATIER
  3.  **
  4.  ** Commande ARexx sous GestaLivre V2.0.
  5.  **
  6.  ** Création des tableaux en ARexx pour un cabinet médical.
  7.  **
  8.  **/
  9.  
  10. OPTIONS RESULTS
  11.  
  12. NL                  = '0a'x
  13. SautPage            = '0C'x   /* caractère de saut de page */
  14. ESC                 = '1B'x
  15.  
  16. /*****************  Définit les variables d'environnement   ***********************/
  17.  
  18. ADDRESS COMMAND "SYS:Rexxc/rx ENV:GestaCompte.ARexxPréfs" /* execute le script de définitions des préférences */
  19. NOM_PORT_LIVRE   =GETCLIP('Port_Livre')
  20. NOM_ECRAN_PUB    =GETCLIP('Ecran_Livre')
  21.  
  22. /************************************************************************/
  23.  
  24. SIGNAL ON SYNTAX        /* détourne les messages d'erreurs */
  25.  
  26. /* ouvre la library rexxreqtools.library pour les messages d'erreurs */
  27. call addlib("rexxreqtools.library",0,-30,0)
  28.  
  29. ADDRESS VALUE NOM_PORT_LIVRE /* adresse du port Arexx */
  30.  
  31. nbre=0
  32. NumeroLigne=0        /* initialisation des variables */
  33. NumeroPage=1
  34. TotalLignes=30
  35. Somme420=0
  36. Somme761=0
  37. Somme700=0
  38. Somme790=0
  39. Somme590=0
  40. SommeEC=0
  41. SommeEB1=0
  42. SommeEB2=0
  43.  
  44. LettreMois.01='JANVIER'
  45. LettreMois.02='FEVRIER'
  46. LettreMois.03='MARS'
  47. LettreMois.04='AVRIL'
  48. LettreMois.05='MAI'
  49. LettreMois.06='JUIN'
  50. LettreMois.07='JUILLET'
  51. LettreMois.08='AOUT'
  52. LettreMois.09='SEPTEMBRE'
  53. LettreMois.10='OCTOBRE'
  54. LettreMois.11='NOVEMBRE'
  55. LettreMois.12='DECEMBRE'
  56.  
  57. x=OPEN('infos','ram:Tableau1','w')  /* crée le fichier */
  58.  
  59. operation 1
  60. PARSE VAR result . '/' mois '/' .  /* récupère le mois sélectionné */
  61.  
  62. /* Entête du fichier */
  63. CALL Tableau1EnTete
  64.  
  65. numboperations             /* cherche le nombre d'opérations dans le mois */
  66. nbre= result
  67.  
  68. DO i=1 TO nbre             /* passe toutes les opérations une à une */
  69.  operation i
  70.  PARSE VAR result jour '/' . '/' . '/' Somme '/' Libelle '/' Poste '/' .
  71.  
  72. IF i=TotalLignes THEN DO   /* toutes les 30ème opérations on passe à la page suivante */
  73.                        NumeroPage=NumeroPage+1
  74.                        CALL Tableau1Total
  75.                        res=WRITELN('infos',SautPage)
  76.                        NumeroLigne=0
  77.                        CALL Tableau1EnTete
  78.                        TotalLignes=TotalLignes+29
  79.                       END
  80.  
  81. /* Composition d'une ligne */
  82.  
  83. ligne='|'
  84.  
  85. IF Poste="420   " THEN DO
  86.                        ligne= ligne||RIGHT(Somme,9,' ')
  87.                        Somme420=Somme420+Somme
  88.                        END
  89. ELSE ligne= ligne||"         "
  90.  
  91. ligne= ligne'|'
  92.  
  93. IF Poste="761   " THEN DO
  94.                        ligne= ligne||RIGHT(Somme,9,' ')
  95.                        Somme761=Somme761+Somme
  96.                        END
  97.  
  98. ELSE ligne= ligne||"         "
  99. ligne= ligne'|'
  100.  
  101. IF Poste="700   " THEN DO
  102.                        ligne= ligne||RIGHT(Somme,9,' ')
  103.                        Somme700=Somme700+Somme
  104.                        END
  105. ELSE ligne= ligne||"         "
  106. ligne= ligne'|'
  107.  
  108. IF Poste="790   " THEN DO
  109.                        ligne= ligne||RIGHT(Somme,9,' ')
  110.                        Somme790=Somme790+Somme
  111.                        END
  112. ELSE ligne= ligne||"         "
  113. ligne= ligne'|'
  114.  
  115. IF Poste="590   " THEN DO
  116.                        ligne= ligne||RIGHT(Somme,9,' ')
  117.                        Somme590=Somme590+Somme
  118.                        END
  119. ELSE ligne= ligne||"         "
  120. ligne= ligne'||'
  121.  
  122. IF Nature="CashInflow" THEN DO
  123.                               ligne= ligne||RIGHT(Somme,9,' ')
  124.                               SommeEC=SommeEC+Somme
  125.                               END
  126. ELSE ligne= ligne||"         "
  127. ligne= ligne'|'
  128.  
  129. IF Nature="Bank2Entry" THEN DO
  130.                                ligne= ligne||RIGHT(Somme,9,' ')
  131.                                SommeEB2=SommeEB2+Somme
  132.                                END
  133. ELSE ligne= ligne||"         "
  134. ligne= ligne'|'
  135.  
  136. IF Nature="Bank1Entry" THEN DO
  137.                                ligne= ligne||RIGHT(Somme,9,' ')
  138.                                SommeEB1=SommeEB1+Somme
  139.                                END
  140. ELSE ligne= ligne||"         "
  141.  
  142. ligne= ligne||'|'RIGHT(jour,2,' ')
  143. ligne= ligne||'|'LEFT(libelle,20,' ')'|'
  144.  
  145. ligneImp= RIGHT(i,2,' ')||ligne
  146. res=WRITELN('infos',ligneImp)
  147. END
  148.  
  149. CALL Tableau1Total
  150. x=CLOSE('infos')       /* ferme le fichier */
  151.  
  152. EXIT
  153.  
  154. /*---------------- Total du Tableau 1 --------------*/
  155. Tableau1Total:
  156. res=WRITELN('infos',traitH)
  157. ligne="AR|"
  158. CALL ComposeLigne
  159. ligne= ligne'||'
  160. IF SommeEC>0 THEN ligne= ligne || RIGHT(SommeEC,9,' ')
  161. ELSE ligne= ligne||"         "
  162. ligne= ligne'|'
  163. IF SommeEB2>0 THEN ligne= ligne || RIGHT(SommeEB2,9,' ')
  164. ELSE ligne= ligne||"         "
  165. ligne= ligne'|'
  166. IF SommeEB1>0 THEN ligne= ligne || RIGHT(SommeEB1,9,' ')
  167. ELSE ligne= ligne||"         "
  168. res=WRITELN('infos',ligne || '|')
  169. res=WRITELN('infos',ESC||'[3w')
  170. RETURN
  171.  
  172. /*---------------- Entête du Tableau 1 --------------*/
  173. Tableau1EnTete:
  174. traitH="  ----------------------------------------------------------------------------------------------------------"
  175. Entete="  |   420   |   761   |   700   |   790   |   590   ||  Caisse | Banque2 | Banque1 |DA|      LIBELLE       |"
  176. res=WRITELN('infos',ESC||'[4w')
  177. res=WRITELN('infos','                                            FEUILLE COMPTABLE (1ère Partie)                        page 'NumeroPage)
  178. showyear
  179. res=WRITELN('infos','     ANNEE: '||result)
  180. res=WRITELN('infos','      MOIS: 'lettremois.mois)
  181. res=WRITELN('infos',traitH)
  182. res=WRITELN('infos',Entete)
  183. res=WRITELN('infos',traitH)
  184. /* Ecrit les lignes des données dans le fichier */
  185. ligne=" R|"
  186. CALL ComposeLigne
  187. res=WRITELN('infos',ligne||'||         |         |         |  |                    |')
  188. RETURN
  189.  
  190. ComposeLigne:
  191. IF Somme420>0 THEN ligne= ligne || RIGHT(Somme420,9,' ')
  192. ELSE ligne= ligne||"         "
  193. ligne= ligne'|'
  194. IF Somme761>0 THEN ligne= ligne || RIGHT(Somme761,9,' ')
  195. ELSE ligne= ligne||"         "
  196. ligne= ligne'|'
  197. IF Somme700>0 THEN ligne= ligne || RIGHT(Somme700,9,' ')
  198. ELSE ligne= ligne||"         "
  199. ligne= ligne'|'
  200. IF Somme790>0 THEN ligne= ligne || RIGHT(Somme790,9,' ')
  201. ELSE ligne= ligne||"         "
  202. ligne= ligne'|'
  203. IF Somme590>0 THEN ligne= ligne || RIGHT(Somme590,9,' ')
  204. ELSE ligne= ligne||"         "
  205. RETURN
  206.  
  207. /* Traite les messages d'erreurs */
  208. SYNTAX:
  209. IF RC=13 THEN call rtezrequest( "      Environnement serveur non trouvé !!!" || NL || NL ||,
  210.                                 "Le nom du port ARexx utilisé dans le script est : "|| NL || NL ||,
  211.                                 "-----------------------------------------------"|| NL ||,
  212.                                 "                  " || NOM_PORT_LIVRE || NL ||,
  213.                                 "-----------------------------------------------"|| NL || NL ||,
  214.                                 "Note : Pour réparer ceci, veuillez fermer le module"|| NL ||,
  215.                 "       'Livre' et modifier le type d'outil 'REXX' de"|| NL ||,
  216.                 "       l'icône, puis le relancer."|| NL || NL ||,
  217.                 "       ATTENTION aux minuscules/majuscules      ",,
  218.                 "OK", "Informations","rt_pubscrname="||NOM_ECRAN_PUB "rt_font=Gestacompte.font/8")
  219. ELSE call rtezrequest(errortext(RC),"Vu",,"rt_pubscrname="||NOM_PORT_LIVRE "rt_font=Gestacompte.font/8")
  220. EXIT
  221.  
  222.