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, 920
320 IF EN THEN END ELSE 150
330 '
340 ' * DIMENSIONIEREN *                     ' SUB V 80
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 310
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, 2320, 550
550 IF X1% <> 3 THEN 420 ELSE RETURN
560 V% = 1 : GOSUB 1070 : RETURN
570 '
580 ' *  DRUCKEN / ABSPEICHERN  *            ' SUB V 310
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 2550, 2080, 710
700 IF X2% <> 3 THEN 570 ELSE RETURN
710 RETURN
720 '
730 ' * BILDSCHIRM / KORREKTUR  *            ' SUB V 310
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 2550, 870, 850
850 IF X3% <> 3 THEN 720 ELSE RETURN
860 '
870 ' * KORREKTUR *                          ' SUB V 840
880 V% = 2 : PRINT FNCH1$(0,1); : PRINT CH2$;
890 PRINT CHR$(28) " KORREKTUR ALLGEM. DATEN " CHR$(18) : PRINT
900 GOSUB 1140 : RETURN
910 '
920 ' * AUT.ABLAUF / ENDE *                  ' SUB V 310
930 PRINT FNCH1$(0,1); : PRINT CH2$;
940 PRINT "    AUT.ABLAUF          =  " CHR$(28) "< F1 >" CHR$(18)
950 PRINT "    ENDE                =  " CHR$(28) "< F2 >" CHR$(18)
960 PRINT "    ZUR.Z.MENUE         =  " CHR$(28) "< F3 >" CHR$(18)
970 '
980 X$ = INPUT$(1) : IF X$="" THEN 970       ' EINGABESCHLEIFE
990 X4%=ASC(X$)-4                            '
1000                                         '
1010 IF X4%<1 OR X4%>3 THEN 970              ' FEHLEINGABE AB-
1020                                         ' FANGEN
1030 ON X4% GOSUB 2550, 2550, 1050
1040 IF X4% <> 3 THEN 910 ELSE RETURN
1050 RETURN
1060 '
1070 ' * EINGABE/KORREKTUR : GRUNDDATEN      ' SUB V 560
1080 '
1090 PRINT FNCH1$(0,1); : PRINT CH2$;
1100 PRINT CHR$(28) " EINGABE ALLGEM. DATEN " CHR$(18) : PRINT
1110 PRINT "BUDGET   = 0       ; KORR.BUDGET   = 0(1) - 0(N)"
1120 PRINT "ABRECHN. = 1 - 4   ; KORR.ABRECHN. = 1(1) - 4(N)"
1130 PRINT "GEW.ABR. = 5       ; KORR.GEW.ABR. = 5(1) - 5(N)"
1140 PRINT "WELCHE UEBERARBEITUNG ? ";: INPUT X                 ' SUB V 900
1150 V1% = INT(X/10) : JJ = X - (V1% * 10)
1160 PRINT "JAHRGANG            =" SPC(11) SJ$;
1170 X$ = "" : INPUT "     "; X$ : IF X$<>"" THEN SJ$ = X$
1180 IF D$(JJ) = "" THEN D$(JJ) = DA$
1190 PRINT "DATUM               =" SPC(7) D$(JJ);
1200 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 2620 : GOSUB 2660
1340 IF AN <> 0 THEN GOSUB 3090 : GOSUB 3140
1350 '
1360 ' * EINGABE / KORREKTUR VERTR.DATEN     ' SUB V 1670
1370 '
1380 ON V% GOSUB 3220, 3260
1390 IF I > 0 THEN GOSUB 2860 : GOSUB 2900 : GOSUB 2950
1400 PRINT : PRINT "I =" I "/" SJ$
1410 IF VT$(I) = "" THEN VT$(I) = "PKW-TRANSP."
1420 PRINT : PRINT "VERTRAGSTEIL        =" SPC(10) VT$(I);
1430 X$="" : INPUT " "; X$ : IF X$<>"" THEN VT$(I) = X$
1440 IF VA%(I) = 0 THEN VA%(I) = 1
1450 PRINT "BMW-EIGEN / FREMD "
1460 PRINT "      1   /   2"
1470 PRINT "                    =" SPC(11); : PRINT USING US6$; VA%(I);
1480 X%=0 : INPUT "  "; X% : IF X%<>0 THEN VA%(I) = X%
1490 IF VK!(I) = 0 THEN VK!(I) = VW!
1500 PRINT "VERW.-KOSTEN (%)    =" SPC(11); : PRINT USING US2$; VK!(I);
1510 X!=0 : INPUT "  "; X! : IF X!<>0 THEN VK!(I) = X!
1520 IF GW!(I) = 0 THEN GW!(I) = GA!
1530 PRINT "GEWINNANTEIL (%)    =" SPC(11); : PRINT USING US2$; GW!(I);
1540 X!=0 : INPUT "  "; X! : IF X!<>0 THEN GW!(I) = X!
1550 PRINT "SCHD.BETR.VERTR.TEIL=" SPC(2); : PRINT USING US3$; SDT#(I,JJ);
1560 X#=0 : INPUT "  "; X# : IF X#<>0 THEN SDT#(I,JJ) = X#
1570 X$ = "" : PRINT
1580 PRINT " SUMMEN ERFASSEN      = " CHR$(28) " < F1 > " CHR$(18)
1590 PRINT " NEUER VERTRAGSTEIL   = " CHR$(28) " < F2 > " CHR$(18)
1600 PRINT " ZUR. Z. MENUE/KORR.  = " CHR$(28) " < F3 > " CHR$(18)
1610 '
1620 X$ = INPUT$(1) : IF X$="" THEN 1570     ' EINGABESCHLEIFE
1630 X5%=ASC(X$)-4                           '
1640                                         '
1650 IF X5%<1 OR X5%>3 THEN 1570             ' FEHLEINGABE AB-
1660                                         ' FANGEN
1670 ON X5% GOSUB 1740, 1360, 1690
1680 IF X5% <> 3 THEN 1580 ELSE 1690         ' NEUE ABFRAGE
1690 I = I + 1 : GOSUB 2860 : GOSUB 2900     ' BER.PR.VERTR.TEIL
1700 GOSUB 2950 : GOSUB 2990 : GOSUB 3030    ' VERGL.U-PR./EFFEKT.
1710 GOSUB 2620 : GOSUB 2660 : GOSUB 2700    '
1720 GOSUB 2730 : RETURN                     '
1730 '
1740 ' *  VERSICHERUNGSSUMMEN ERFASSEN *     ' SUB V 1670
1750 '
1760 ON V% GOSUB 3300, 3360                  ' VORBER.EING./KORR.
1770 PRINT : PRINT "UNTERGRUPPE " I;J "       = " SPC(4); SP$(I,J);
1780 X$="" : INPUT "  "; X$ : IF X$<>"" THEN SP$(I,J) = X$
1790 IF SP!(I,J) = 0 THEN SP!(I,J) = .69
1800 PRINT " UMS.ABH. / VAR. / SU.ABH. / PR.BETR."
1810 PRINT "    1     /   2  /   3     /    4"
1820 PRINT : PRINT "PR.-ABR.ART " SPC(13) "=" SPC(14);
1830 PRINT USING US6$; SP%(I,J);
1840 X%=0 : INPUT " "; X% : IF X%<>0 THEN SP%(I,J) = X%
1850 IF PKA%(I,J) = 0 THEN PKA%(I,J) = 4813
1860 PRINT "KOST.ART" SPC(17) "=" SPC(11);
1870 PRINT USING US6$; PKA%(I,J);
1880 X%=0 : INPUT "     "; X% : IF X%<>0 THEN PKA%(I,J) = X%
1890 IF PKS%(I,J) = 0 THEN PKS%(I,J) = 6614
1900 PRINT "KOST.STELLE" SPC(14) "=" SPC(11);
1910 PRINT USING US6$; PKS%(I,J);
1920 X%=0 : INPUT "     "; X% : IF X%<>0 THEN PKS%(I,J) = X%
1930 PRINT "FORECAST / BUDGET  (DM)  =" SPC(2);
1940 PRINT USING US4$; FC#(I,J,JJ);
1950 X#=0 : INPUT "  "; X# : IF X#<>0 THEN FC#(I,J,JJ) = X#
1960 IF SU#(I,J) = 0 THEN SU#(I,J,JJ) = FC#(I,J,JJ)
1970 PRINT "VERS-SUMME  (DM)         =" SPC(2);
1980 PRINT USING US4$; SU#(I,J,JJ);
1990 X#=0 : INPUT "  "; X# : IF X#<>0 THEN SU#(I,J,JJ) = X#
2000 GOSUB 2780                                               ' PR.BER.
2010 PRINT "PRAEMIE  (DM)" SPC(12) "=" SPC(5);
2020 PRINT USING US3$; PRU#/10
2030 GOSUB 2830                                               ' BER.U-PR.ANT.
2040 PRINT "UMS.PR.-ANT.  % " SPC(9) "=" SPC(11);
2050 PRINT USING US2$; PAU!
2060 RETURN
2070 '
2080 ' * ABSPEICHERN *                       ' SUB V 690
2090 '
2100 X$ = MID$ (STR$(JJ),2,4) : PRINT "UMS85-" + X$ + ".DAT"
2110 PRINT JJ; : JJ$ = "" : INPUT JJ$ : IF JJ$ <> "" THEN X$ = JJ$
2120 X$ = "UMS85-" + X$ + ".DAT" : PRINT X$;
2130 JJ$ = "" : INPUT JJ$ : IF JJ$ <> "" THEN X$ = JJ$
2140 OPEN "O", #3, X$
2150 WRITE #3, X$, JJ, SJ$, VW!, GA!, AN%
2160 FOR U = 0 TO JJ
2170 WRITE #3, D$(U), V1%(U), UF%(U), U#(U), UPS!(U)
2180 NEXT U
2190 '
2200 FOR I = 0 TO AN%-1
2210 WRITE #3, VT$(I), VA%(I), VK!(I), GW!(I), SDT#(I), SA%(I)
2220 '
2230 FOR J = 0 TO SA%(I)-1
2240 WRITE #3, SP$(I,J), SP!(I,J), SP%(I,J)
2250 '
2260 FOR U = 0 TO JJ
2270 WRITE #3, FC#(I,J,U), SU#(I,J,U), PKA%(I,J,U), PKS%(I,J,U)
2280 NEXT U : NEXT J : NEXT I
2290 '
2300 CLOSE #3 : RETURN
2310 '
2320 ' * LADEN *                             ' SUB V 540
2330 '
2340 PRINT "UMS85- ? .DAT" : JJ = 0
2350 PRINT "JJ = " JJ; : JJ$ = "" : INPUT JJ$ : X$ = JJ$
2360 X$ = "UMS85-" + X$ + ".DAT" : PRINT X$;
2370 JJ$ = "" :INPUT JJ$ : IF JJ$ <> "" THEN X$ = JJ$
2380 OPEN "I", #2, X$
2390 INPUT #2, X$, JJ, SJ$, VW!, GA!, AN%
2400 FOR U = 0 TO JJ
2410 INPUT #2, D$(U), V1%(U), UF%(U), U#(U), UPS!(U)
2420 NEXT U
2430 '
2440 FOR I = 0 TO AN%-1
2450 INPUT #2, VT$(I), VA%(I), VK!(I), GW!(I), SDT#(I), SA%(I)
2460 '
2470 FOR J = 0 TO SA%(I)-1
2480 INPUT #2, SP$(I,J), SP!(I,J), SP%(I,J), PKA%(I,J), PKS%(I,J)
2490 '
2500 FOR U = 0 TO JJ
2510 INPUT #2, FC#(I,J,U), SU#(I,J,U), PKA%(I,J,U), PKS%(I,J,U)
2520 NEXT U : NEXT J : NEXT I
2530 '
2540 CLOSE #2 : RETURN
2550 '
2560 ' * FEHLENDE PROGRAMMTEILE *            ' SUB V 690, 840, 1030
2570 '
2580 PRINT "PROGRAMMTEIL FEHLT NOCH !" : STOP : RETURN
2590 '
2600 ' * DIV. BERECHNUNGEN *
2610 '
2620 PR# = U#/1000 * UPS!                           ' UMSATZ-PRAEMIE
2630 PR# = (INT(PR# * 10 + .5)/10 * 1.05)           ' SUB V 1330, 1710
2640 UPR# = INT(PR# * 10 + .5)/10 : RETURN          '
2650 '
2660 PRINT "UMS.PRAEMIE  (DM)   =" SPC(9);          ' AUSG.BILD
2670 PRINT USING US3$; UPR# : RETURN                ' U-PR.
2680                                                ' SUB V 1330, 1710, 2870
2690 '
2700 DIF# = UPR# - PRT# : DIF% = (DIF# * 100)/ UPR# ' BER.DIF.
2710 RETURN                                         ' SUB V 1710
2720 '
2730 PRINT                                          '
2740 PRINT "DIF. U-PR./ EFFEKT. =" SPC(9);          ' AUSG.BILD
2750 PRINT USING US2$; DIF%                         ' SUB V 1720
2760 PRINT "DIF. IN  %          =" SPC(17);          ' IN %
2770 '
2780 SPRA# = SU#(I,J,JJ)/1000 * SP!(I,J)            ' PRAEMIE UNTER-
2790 SPRA# = (INT(SPRA# * 10 + .5)/10) * 1.05       ' GRUPPE
2800 PRU# = INT(SPRA# * 10 + .5)                    ' SUB V 2000
2810 RETURN
2820 '
2830 PAU! = (PRU# * 100) / UPR# : RETURN            ' U-PR-ANT.U-GR.
2840                                                ' SUB V 2030
2850 '
2860 I = I-1 : PRT# = 0 : FOR J = 0 TO SA%(I)-1     ' PRAEMIE
2870 GOSUB 2660                                     ' VETR.TEIL
2880 PRT# = PRT# + PRU# : NEXT :I = I+1 : RETURN    ' SUB V 1390, 1690, 2990
2890 '
2900 PRINT "PRAEMIE  VERTR.TEIL (DM)" I-1;          ' AUSG.BILD
2910 IF I-1 < 10 PRINT SPC(9); ELSE PRINT SPC(8);   ' PR.VERTR.TEIL
2920 PRINT "=" SPC(5);                              ' SUB V 1390, 1690
2930 PRINT USING US3$; PRT# : RETURN                '
2940 '
2950 PAT! = (PRT# * 100) / UPR#                     ' U-PR-ANT.VT-T.
2960 PRINT "UMS.PR.-ANT.  % " SPC(19) "=" SPC(11);  ' U.AUSG.BILD
2970 PRINT USING US2$; PAT! : RETURN                ' SUB V 1390, 1700
2980 '
2990 PRG# = 0 : FOR I = 1 TO AN% : GOSUB 2860       ' PR.VERGLEICH
3000 PRG# = PRG# + PRT# : NEXT : RETURN             ' U-PR./EFFEKTIV
3010                                                ' GES.VETR. V 1700
3020 '
3030 PRINT "EFFEKTIVE PRAEMIE   (DM)" I-1;          ' AUSG.BILD
3040 IF I-1 < 10 PRINT SPC(9); ELSE PRINT SPC(8);   ' EFF.PR.
3050 PRINT "=" SPC(5);                              ' GES.VERTR.
3060 PRINT USING US3$; PRG# : RETURN                ' SUB V 1700
3070 '
3080 '
3090 SDG#(JJ) = 0 : FOR U = 0 TO AN-1               ' SCHD.BETR.
3100 SDG#(JJ) = SDG#(JJ) + SDT#(I,JJ) : NEXT        ' U.QUOTE
3110 SQ! = (SDG#(JJ) * 100)/UPR#                    ' GES.VERTR.
3120 SDGQ! = INT(SQ! * 100 + .5)/100                ' SUB V 1340
3130 '
3140 PRINT "SCHD.BETR.GES. (DM)      =" SPC(2);     ' AUSG.BILD
3150 PRINT USING US4$; SDG#(JJ);                    ' SCHD.BETR.
3160 PRINT "SCHD.QUOTE GES. VERTR.   =" SPC(11);    ' QUOTE
3170 PRINT USING US2$; SDGQ!                        ' GES.VERTR.
3180 RETURN                                         ' SUB V 1340
3190 '
3200 ' * DIV. UNTERPROGRAMME *
3210 '
3220 I = AN : AN = AN + 1 : PRINT                      ' SUB V 1380
3230 PRINT CHR$(28) " EINGABE VERTRAGSDATEN " CHR$(18) '
3240 RETURN                                            '
3250 '
3260 PRINT                                             ' SUB V 1380
3270 PRINT CHR$(28) "KORREKTUR VERTRAGSDATEN" CHR$(18) '
3280 INPUT "VERTRAGSTEIL:  I =     "; I : RETURN       '
3290 '
3300 J=SA%(I) : SA%(I)=SA%(I)+1 : PRINT SA%(I)         ' SUB V 1760
3310 IF SP$(I,J) = "" THEN SP$ (I,J) = "ALLG.FAHRGEB." '
3320 PRINT                                             '
3330 PRINT CHR$(28) "VERS.SUMMEN ERFASSEN" CHR$(18)    '
3340 RETURN                                            '
3350 '
3360 PRINT                                             ' SUB V 1760
3370 INPUT "UNTERGRUPPE  :  J =     "; J : RETURN      '
3380 '
