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