10 ' *****************
20 ' * UMSP85-2.BAS  *
30 ' ***************** LK 01.03./19./10.02./08.01.85
40 ' NACHUMSPOL 85 /07.01.85 U. 12.12.84
50 A$ = "BERECHNUNGEN ZUR UMSATZPOLICE 1985" : SJ$ = "1985" : VW! = 25
60 GA! = 50 : U$ = "3500" : VS$ = "VS 30 / 50 002" Q
70 BX% = 9 : PRINT "BX% =  ";BX%; : Y% = 10 : Z% = 10
80 X% = 0 : INPUT X% : IF X% <> 0 THEN BX% = X% : IF BX% > 9 THEN GOSUB 340
90 DA$ = "08.01.85" : PRINT "DA$ =   ";DA$;
100 X$ = "" : INPUT X$ : IF X$ <> "" THEN DA$ = X$
110 DEF FNCH1$ (X,Y) = CHR$(27)+CHR$(22)+CHR$(Y)+CHR$(X)
120 CH2$ = CHR$(27)+CHR$(23) : US1$ = "###.###" : US2$ = "####.##"
130 US3$ = "#########,.##" : US4$ = "############,.##" : US5$ = "#######,.##"
140 US6$ = "####"
150 '
160 ' * HAUPTMENUE *
170 '
180 PRINT FNCH1$(0,1); : PRINT CH2$;
190 PRINT "   ";A$
200 PRINT : PRINT "DAT.= ";DA$, "AN = ";AN, "BX% = ";BX% : PRINT
210 PRINT "    EINGABE / LADEN          =  " CHR$(28) "< F1 >" CHR$(18)
220 PRINT "    DRUCKEN / ABSPEICHERN    =  " CHR$(28) "< F2 >" CHR$(18)
230 PRINT "    BILDSCHIRM / KORREKTUR   =  " CHR$(28) "< F3 >" CHR$(18)
240 PRINT "    AUT.ABLAUF / ENDE        =  " CHR$(28) "< F4 >" CHR$(18)
250 '
260 X$ = INPUT$(1) : IF X$ = "" THEN 250   ' EINGABESCHLEIFE
270 X=ASC(X$)-4                            '
280                                        '
290 IF X<1 OR X>4 THEN 250                 ' FEHLEINGABE AB-
300                                        ' FANGEN
310 ON X GOSUB 430, 580, 730, 900
320 IF EN THEN END ELSE 150
330 '
340 ' * DIMENSIONIEREN * SUB V 70
350 DIM D$(Z%), FC#(X%,Y%,Z%), GW!(X%)
360 DIM PKA%(X%,Y%,Z%), PKS%(X%,Y%,Z%)
370 DIM SA%(X%), SDT#(X%,Z%)
380 DIM SP%(X%,Y%), SP!(X%,Y%), SP$(X%,Y%), SU#(X%,Y%,Z%)
390 DIM UPS!(Z%)
400 DIM VA%(X%), V1%(Z%), VK!(X%), VT$(X%)
410 RETURN
420 '
430 ' * EINGABE / LADEN * SUB V 210
440 PRINT FNCH1$(0,1); : PRINT CH2$; : PRINT
450 PRINT "    EINGABE (MANUELL)     =  " CHR$(28) "< F1 >" CHR$(18)
460 PRINT "    LADEN                 =  " CHR$(28) "< F2 >" CHR$(18)
470 PRINT "    ZUR.Z.MENUE           =  " CHR$(28) "< F3 >" CHR$(18)
480 '
490 X$ = INPUT$(1) : IF X$="" THEN 480   ' EINGABESCHLEIFE
500 X1%=ASC(X$)-4                        '
510                                      '
520 IF X1%<1 OR X1%>3 THEN 480           ' FEHLEINGABE AB-
530                                      ' FANGEN
540 ON X1% GOSUB 560, 2500, 550
550 IF X1% <> 3 THEN 420 ELSE RETURN
560 V% = 1 : GOSUB 1050 : RETURN
570 '
580 ' *  DRUCKEN / ABSPEICHERN  * SUB V 210
590 PRINT FNCH1$(0,1); : PRINT CH2$;
600 PRINT "    DRUCKEN             =  " CHR$(28) "< F1 >" CHR$(18)
610 PRINT "    ABSPEICHERN         =  " CHR$(28) "< F2 >" CHR$(18)
620 PRINT "    ZUR.Z.MENUE         =  " CHR$(28) "< F3 >" CHR$(18)
630 '
640 X$ = INPUT$(1) : IF X$="" THEN 630   ' EINGABESCHLEIFE
650 X2%=ASC(X$)-4                        '
660                                      '
670 IF X2%<1 OR X2%>3 THEN 630           ' FEHLEINGABE AB-
680                                      ' FANGEN
690 ON X2% GOSUB 2730, 2280, 710
700 IF X2% <> 3 THEN 570 ELSE RETURN
710 RETURN
720 '
730 ' * BILDSCHIRM / KORREKTUR  * SUB V 210
740 PRINT FNCH1$(0,1); : PRINT CH2$;
750 PRINT "    BILDSCHIRM         =  " CHR$(28) "< F1 >" CHR$(18)
760 PRINT "    KORREKTUR          =  " CHR$(28) "< F2 >" CHR$(18)
770 PRINT "    ZUR.Z.MENUE        =  " CHR$(28) "< F3 >" CHR$(18)
780 '
790 X$ = INPUT$(1) : IF X$="" THEN 780   ' EINGABESCHLEIFE
800 X3%=ASC(X$)-4                        '
810                                      '
820 IF X3%<1 OR X3%>3 THEN 780           ' FEHLEINGABE AB-
830                                      ' FANGEN
840 ON X3% GOSUB 2730, 860, 850
850 IF X3% <> 3 THEN 720 ELSE RETURN
860 V% = 2 : PRINT FNCH1$(0,1); : PRINT CH2$;
870 PRINT CHR$(28) " KORREKTUR ALLGEM. DATEN " CHR$(18) : PRINT
880 GOSUB 1120 : RETURN
890 '
900 ' * AUT.ABLAUF / ENDE * SUB V 210
910 PRINT FNCH1$(0,1); : PRINT CH2$;
920 PRINT "    AUT.ABLAUF          =  " CHR$(28) "< F1 >" CHR$(18)
930 PRINT "    ENDE                =  " CHR$(28) "< F2 >" CHR$(18)
940 PRINT "    ZUR.Z.MENUE         =  " CHR$(28) "< F3 >" CHR$(18)
950 '
960 X$ = INPUT$(1) : IF X$="" THEN 950   ' EINGABESCHLEIFE
970 X4%=ASC(X$)-4                        '
980                                      '
990 IF X4%<1 OR X4%>3 THEN 950           ' FEHLEINGABE AB-
1000                                      ' FANGEN
1010 ON X4% GOSUB 2730, 2730, 1030
1020 IF X4% <> 3 THEN 890 ELSE RETURN
1030 RETURN
1040 '
1050 ' * EINGABE/KORREKTUR : FORECAST/BUDGET
1060 '
1070 PRINT FNCH1$(0,1); : PRINT CH2$;
1080 PRINT CHR$(28) " EINGABE ALLGEM. DATEN " CHR$(18) : PRINT
1100 PRINT "BUDGET   = 0       ; KORR.BUDGET   = 0(1) - 0(N)"
1105 PRINT "ABRECHN. = 1 - 4   ; KORR.ABRECHN. = 1(1) - 4(N)"
1110 PRINT "GEW.ABR. = 5       ; KORR.GEW.ABR. = 5(1) - 5(N)"
1120 PRINT "WELCHE UEBERARBEITUNG ? ";: INPUT X
1125 V1% = INT(X/10) : JJ = X - (V1% * 10)
1130 PRINT "JAHRGANG            =" SPC(11) SJ$;
1140 X$ = "" : INPUT "     "; X$ : IF X$<>"" THEN SJ$ = X$
1150 IF D$(JJ) = "" THEN D$(JJ) = DA$
1160 PRINT "DATUM               =" SPC(7) D$(JJ);
1170 X$ = "" : INPUT "     "; X$ : IF X$<>"" THEN D$(JJ) = X$
1210 PRINT "VERW.-KOSTEN (%)    =" SPC(11); : PRINT USING US2$; VW!;
1220 X!=0 : INPUT "  "; X! : IF X!<>0 THEN VW! = X!
1230 PRINT "GEWINNANTEIL (%)    =" SPC(11); : PRINT USING US2$; GA!;
1240 X!=0 : INPUT "  "; X! : IF X!<>0 THEN GA! = X!
1250 PRINT : PRINT CHR$(28) "PKW-INL.-UMSATZ" CHR$(18) : PRINT
1260 PRINT "FORECAST (MILL. DM) =" SPC(7); : PRINT USING US5$; UF%;
1270 X%=0 : INPUT "  "; X% : IF X%<>0 THEN UF% = X%
1280 IF U# = 0 THEN U# = UF% * 1E+06
1290 PRINT "EFFEKTIV (DM)       =" SPC(2); : PRINT USING US4$; U#;
1300 X#=0 : INPUT "  "; X# : IF X#<>0 THEN U# = X#
1310 PRINT "UMS.PR.-SATZ (%0)   =" SPC(12); : PRINT USING US1$; UPS!;
1320 X!=0 : INPUT " "; X! : IF X!<>0 THEN UPS! = X!
1330 GOSUB 3050 : GOSUB 3080
1370 IF AN <> 0 THEN GOSUB 3330 : GOSUB 3340
1420 '
1430 ' * EINGABE / KORREKTUR VERTRAGSDATEN
1440 '
1450 ON V% GOSUB 4045, 4090
1460 IF I > 0 THEN GOSUB 3160 : GOSUB 3180 : GOSUB 3194
1490 PRINT : PRINT "I =" I "/" SJ$
1500 IF VT$(I) = "" THEN VT$(I) = "PKW-TRANSP."
1510 PRINT : PRINT "VERTRAGSTEIL        =" SPC(10) VT$(I);
1520 X$="" : INPUT " "; X$ : IF X$<>"" THEN VT$(I) = X$
1530 IF VA%(I) = 0 THEN VA%(I) = 1
1540 PRINT "BMW-EIGEN / FREMD "
1550 PRINT "      1   /   2"
1560 PRINT "                    =" SPC(11); : PRINT USING US6$; VA%(I);
1570 X%=0 : INPUT "  "; X% : IF X%<>0 THEN VA%(I) = X%
1580 IF VK!(I) = 0 THEN VK!(I) = VW!
1590 PRINT "VERW.-KOSTEN (%)    =" SPC(11); : PRINT USING US2$; VK!(I);
1600 X!=0 : INPUT "  "; X! : IF X!<>0 THEN VK!(I) = X!
1610 IF GW!(I) = 0 THEN GW!(I) = GA!
1620 PRINT "GEWINNANTEIL (%)    =" SPC(11); : PRINT USING US2$; GW!(I);
1630 X!=0 : INPUT "  "; X! : IF X!<>0 THEN GW!(I) = X!
1650 PRINT "SCHD.BETR.VERTR.TEIL=" SPC(2); : PRINT USING US3$; SDT#(I,JJ);
1655 X#=0 : INPUT "  "; X# : IF X#<>0 THEN SDT#(I,JJ) = X#
1660 X$ = "" : PRINT
1670 PRINT " SUMMEN ERFASSEN      = " CHR$(28) " < F1 > " CHR$(18)
1680 PRINT " NEUER VERTRAGSTEIL   = " CHR$(28) " < F2 > " CHR$(18)
1690 PRINT " ZUR. Z. MENUE/KORR.  = " CHR$(28) " < F3 > " CHR$(18)
1700 '
1710 X$ = INPUT$(1) : IF X$="" THEN 1660     ' EINGABESCHLEIFE
1720 X5%=ASC(X$)-4                           '
1730                                         '
1740 IF X5%<1 OR X5%>3 THEN 1660             ' FEHLEINGABE AB-
1750                                         ' FANGEN
1760 ON X5% GOSUB 1800, 1430, 1780
1770 IF X5% <> 3 THEN 1670 ELSE 1780         ' NEUE ABFRAGE
1780 I = I + 1 : GOSUB 3160 : GOSUB 3180     ' BER.PR.VERTR.TEIL
1785 GOSUB 3194 : GOSUB 3230 : GOSUB 3260    ' VERGL.U-PR./EFFEKT.
1786 GOSUB 3050 : GOSUB 3080 : GOSUB 3084    '
1787 GOSUB 3090 : RETURN                     '
1790 '
1800 ' *  VERSICHERUNGSSUMMEN ERFASSEN *     ' SUB V 1520
1810 '
1812 ON V% GOSUB 4132, 4180                  ' VORBER.EING./KORR.
1850 PRINT : PRINT "UNTERGRUPPE " I;J "       = " SPC(4); SP$(I,J);
1860 X$="" : INPUT "  "; X$ : IF X$<>"" THEN SP$(I,J) = X$
1870 IF SP!(I,J) = 0 THEN SP!(I,J) = .69
1884 PRINT : PRINT "PR.-ABR.ART " SPC(13) "=" SPC(14);
1880 PRINT " UMS.ABH. / VAR. / SU.ABH. / PR.BETR."
1882 PRINT "    1     /   2  /   3     /    4"
1890 PRINT USING US6$; SP%(I,J);
1900 X%=0 : INPUT " "; X% : IF X%<>0 THEN SP%(I,J) = X%
1910 IF PKA%(I,J) = 0 THEN PKA%(I,J) = 4813
1920 PRINT "KOST.ART" SPC(17) "=" SPC(11);
1925 PRINT USING US6$; PKA%(I,J);
1940 X%=0 : INPUT "     "; X% : IF X%<>0 THEN PKA%(I,J) = X%
1950 IF PKS%(I,J) = 0 THEN PKS%(I,J) = 6614
1960 PRINT "KOST.STELLE" SPC(14) "=" SPC(11);
1965 PRINT USING US6$; PKS%(I,J);
1980 X%=0 : INPUT "     "; X% : IF X%<>0 THEN PKS%(I,J) = X%
1990 PRINT "FORECAST / BUDGET  (DM)  =" SPC(2);
2000 PRINT USING US4$; FC#(I,J,JJ);
2010 X#=0 : INPUT "  "; X# : IF X#<>0 THEN FC#(I,J,JJ) = X#
2020 IF SU#(I,J) = 0 THEN SU#(I,J,JJ) = FC#(I,J,JJ)
2030 PRINT "VERS-SUMME  (DM)         =" SPC(2);
2040 PRINT USING US4$; SU#(I,J,JJ);
2050 X#=0 : INPUT "  "; X# : IF X#<>0 THEN SU#(I,J,JJ) = X#
2060 GOSUB 3100                                               ' PR.BER.
2070 PRINT "PRAEMIE  (DM)" SPC(12) "=" SPC(5);
2075 PRINT USING US3$; PRU#/10
2080 GOSUB 3120                                               ' BER.U-PR.ANT.
2090 PRINT "UMS.PR.-ANT.  % " SPC(9) "=" SPC(11);
2095 PRINT USING US2$; PAU!
2100 RETURN
2270 '
2280 ' * ABSPEICHERN * SUB V XXX
2290 '
2300 X$ = MID$ (STR$(JJ),2,4) : PRINT "UMS85-" + X$ + ".DAT"
2310 PRINT JJ; : JJ$ = "" : INPUT JJ$ : IF JJ$ <> "" THEN X$ = JJ$
2320 X$ = "UMS85-" + X$ + ".DAT" : PRINT X$;
2325 JJ$ = "" : INPUT JJ$ : IF JJ$ <> "" THEN X$ = JJ$
2330 OPEN "O", #3, X$
2340 WRITE #3, X$, JJ, SJ$, VW!, GA!, AN%
2350 FOR U = 0 TO JJ
2360 WRITE #3, D$(U), V1%(U), UF%(U), U#(U), UPS!(U)
2370 NEXT U
2380 '
2390 FOR I = 0 TO AN%-1
2400 WRITE #3, VT$(I), VA%(I), VK!(I), GW!(I), SDT#(I), SA%(I)
2410 '
2420 FOR J = 0 TO SA%(I)-1
2430 WRITE #3, SP$(I,J), SP!(I,J), SP%(I,J)
2440 '
2450 FOR U = 0 TO JJ
2460 WRITE #3, FC#(I,J,U), SU#(I,J,U), PKA%(I,J,U), PKS%(I,J,U)
2470 NEXT U : NEXT J : NEXT I
2480 '
2490 CLOSE #3 : RETURN
2500 '
2510 ' * LADEN * SUB V XXX
2520 '
2530 PRINT "UMS85- ? .DAT" : JJ = 0
2540 PRINT "JJ = " JJ; : JJ$ = "" : INPUT JJ$ : X$ = JJ$
2550 X$ = "UMS85-" + X$ + ".DAT" : PRINT X$;
2555 JJ$ = "" :INPUT JJ$ : IF JJ$ <> "" THEN X$ = JJ$
2560 OPEN "I", #2, X$
2570 INPUT #2, X$, JJ, SJ$, VW!, GA!, AN%
2580 FOR U = 0 TO JJ
2590 INPUT #2, D$(U), V1%(U), UF%(U), U#(U), UPS!(U)
2600 NEXT U
2610 '
2620 FOR I = 0 TO AN%-1
2630 INPUT #2, VT$(I), VA%(I), VK!(I), GW!(I), SDT#(I), SA%(I)
2640 '
2650 FOR J = 0 TO SA%(I)-1
2660 INPUT #2, SP$(I,J), SP!(I,J), SP%(I,J), PKA%(I,J), PKS%(I,J)
2670 '
2680 FOR U = 0 TO JJ
2690 INPUT #2, FC#(I,J,U), SU#(I,J,U), PKA%(I,J,U), PKS%(I,J,U)
2700 NEXT U : NEXT J : NEXT I
2710 '
2720 CLOSE #2 : RETURN
2730 '
2740 ' * FEHLENDE PROGRAMMTEILE *
2750 '
2760 PRINT "PROGRAMMTEIL FEHLT NOCH !" : STOP : RETURN
3000 '
3010 ' * DIV. BERECHNUNGEN *
3020 '
3050 PR# = U#/1000 * UPS!                           ' UMSATZ-PRAEMIE
3055 PR# = (INT(PR# * 10 + .5)/10 * 1.05)           ' SUB V 1330, 1786
3060 UPR# = INT(PR# * 10 + .5)/10 : RETURN          '
3070 '
3080 PRINT "UMS.PRAEMIE  (DM)   =" SPC(9);          ' AUSG.BILD
3081 PRINT USING US3$; UPR# : RETURN                ' U-PR.
3082                                                ' SUB V 1330, 1786, 3165
3083 '
3084 DIF# = UPR# - PRT# : DIF% = (DIF# * 100)/ UPR# ' BER.DIF.
3085 RETURN                                         ' SUB V 1786
3086 '
3090 PRINT                                          '
3091 PRINT "DIF. U-PR./ EFFEKT. =" SPC(9);          ' AUSG.BILD
3092 PRINT USING US3$; DIF#                         ' DIFF.BETR.
3093 PRINT "DIF. IN  %          =" SPC(17);          ' IN %
3092 PRINT USING US2$; DIF%                         ' SUB V 1787
3095 '
3100 SPRA# = SU#(I,J,JJ)/1000 * SP!(I,J)            ' PRAEMIE UNTER-
3110 SPRA# = (INT(SPRA# * 10 + .5)/10) * 1.05       ' GRUPPE
3111 PRU# = INT(SPRA# * 10 + .5)                    ' SUB V 2060
3112 RETURN
3114 '
3120 PAU! = (PRU# * 100) / UPR# : RETURN            ' U-PR-ANT.U-GR.
3130                                                ' SUB V 2080
3135 '
3160 I = I-1 : PRT# = 0 : FOR J = 0 TO SA%(I)-1     ' PRAEMIE
3165 GOSUB 3080                                     ' VETR.TEIL
3170 PRT# = PRT# + PRU# : NEXT :I = I+1 : RETURN    ' SUB V 1460, 1780, 3230
3175 '
3180 PRINT "PRAEMIE  VERTR.TEIL (DM)" I-1;          ' AUSG.BILD
3185 IF I-1 < 10 PRINT SPC(9); ELSE PRINT SPC(8);   ' PR.VERTR.TEIL
3186 PRINT "=" SPC(5);                              ' SUB V 1460, 1780
3190 PRINT USING US3$; PRT# : RETURN                '
3191 '
3194 PAT! = (PRT# * 100) / UPR#                     ' U-PR-ANT.VT-T.
3195 PRINT "UMS.PR.-ANT.  % " SPC(19) "=" SPC(11);  ' U.AUSG.BILD
3196 PRINT USING US2$; PAT! : RETURN                ' SUB V 1460, 1785
3200 '
3230 PRG# = 0 : FOR I = 1 TO AN% : GOSUB 3160       ' PR.VERGLEICH
3240 PRG# = PRG# + PRT# : NEXT : RETURN             ' U-PR./EFFEKTIV
3250                                                ' GES.VETR. V 1785
3255 '
3260 PRINT "EFFEKTIVE PRAEMIE   (DM)" I-1;          ' AUSG.BILD
3261 IF I-1 < 10 PRINT SPC(9); ELSE PRINT SPC(8);   ' EFF.PR.
3262 PRINT "=" SPC(5);                              ' GES.VERTR.
3263 PRINT USING US3$; PRG# : RETURN                ' SUB V 1785
3264 '
3300 '
3330 SDG#(JJ) = 0 : FOR U = 0 TO AN-1               ' SCHD.BETR.
3335 SDG#(JJ) = SDG#(JJ) + SDT#(I,JJ) : NEXT        ' U.QUOTE
3336 SQ! = (SDG#(JJ) * 100)/UPR#                    ' GES.VERTR.
3337 SDGQ! = INT(SQ! * 100 + .5)/100                ' SUB V 1370
3338 '
3340 PRINT "SCHD.BETR.GES. (DM)      =" SPC(2);     ' AUSG.BILD
3345 PRINT USING US4$; SDG#(JJ);                    ' SCHD.BETR.
3360 PRINT "SCHD.QUOTE GES. VERTR.   =" SPC(11);    ' QUOTE
3365 PRINT USING US2$; SDGQ!                        ' GES.VERTR.
3370 RETURN                                         ' SUB V 1370
4000 '
4010 ' * DIV. UNTERPROGRAMME *
4020 '
4045 I = AN : AN = AN + 1 : PRINT                      ' SUB V 1450
4050 PRINT CHR$(28) " EINGABE VERTRAGSDATEN " CHR$(18) '
4055 RETURN                                            '
4060 '
4090 PRINT                                             ' SUB V 1470
4095 PRINT CHR$(28) "KORREKTUR VERTRAGSDATEN" CHR$(18) '
4100 INPUT "VERTRAGSTEIL:  I =     "; I : RETURN       '
4110 '
4132 J=SA%(I) : SA%(I)=SA%(I)+1 : PRINT SA%(I)         ' SUB V 1812
4134 IF SP$(I,J) = "" THEN SP$ (I,J) = "ALLG.FAHRGEB." '
4140 PRINT                                             '
4145 PRINT CHR$(28) "VERS.SUMMEN ERFASSEN" CHR$(18)    '
4146 RETURN                                            '
4150 '
4180 PRINT                                             ' SUB V 1812
4185 PRINT CHR$(28) "VERS.SUMMEN KORRIGIEREN" CHR$(18) '
4185 INPUT "UNTERGRUPPE  :  J =     "; J : RETURN      '
4190 '