home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / psform.zip / REGIST.SPE < prev    next >
Text File  |  1995-04-21  |  1KB  |  59 lines

  1. /**********************************************/
  2. /* Druckspezifikationen für Registration Form */
  3. /**********************************************/
  4. 9,1,Date
  5. 9,2,Qu,r
  6. 9,3,M
  7. 9,4,name
  8. 9,5,userid
  9. 9,6,company
  10. 9,7,address_1
  11. 9,8,address_2
  12. 9,9,city
  13. 9,10,country
  14. 9,11,comments_1
  15. 9,12,comments_2
  16. 9,13,comments_3
  17. 9,14,comments_4
  18. 3,"f_amount( f_index2(3), f_index2(2) )",Amount,r
  19. /*Funktionswert Rechnungsbetrag mit 2 Kommastellen in Stringform*/
  20. /*als Funktion von Anzahl u. Währung                            */
  21. /* Anzahl: String mit 4 Stellen, Währung: String mit 3 Stellen    */
  22. Funktionen=
  23. [
  24. char *f_amount(char *currency, char *quantity)
  25. {
  26.   int q;
  27.   int faktor = 0;
  28.   int us = 20;
  29.   int dm = 25;
  30.   char ergebnis[6];
  31.  
  32.   if ( strlen(currency) < 4 ) {
  33.     if ( strcmp(currency, "DM") == 0 ) {
  34.       faktor = dm;
  35.     } else {
  36.       if ( strcmp(currency, "US$") == 0 ) {
  37.         faktor = us;
  38.       } else {
  39.         printf("Falsche Währungsangabe !  /  Wrong currency ! \n");
  40.         strcpy( ergebnis, NULL);
  41.       } 
  42.     } 
  43.     if ( strlen(quantity) < 3 ) {
  44.       q = atoi(quantity);
  45.       q = q * faktor;
  46.       itoa(q, ergebnis, 10);
  47.     } else {
  48.       printf("Falsche Währungsangabe !  /  Wrong currency !\n");
  49.       strcpy( ergebnis, NULL);
  50.     } 
  51.   } else {
  52.     printf("Falsche Währungsangabe !  /  Wrong currency !\n");
  53.     strcpy( ergebnis, NULL);
  54.   } 
  55.  
  56.   return ergebnis;
  57. }
  58. ]
  59.