#!/bin/bash
SCALE=4
PERIOD_DEFAULT_MONEY=38000
for INDEX in `seq 1 6`;do
if [ 1 -eq $INDEX ];then
RATE=0.950;PERIOD_MONTH=03;PERIOD_MONTH_PLUS=0
PERIOD_DEFAULT_MONEY=38000
elif [ 2 -eq $INDEX ];then
RATE=0.500;PERIOD_MONTH=06;PERIOD_MONTH_PLUS=0
PERIOD_DEFAULT_MONEY=38000
elif [ 3 -eq $INDEX ];then
RATE=0.345;PERIOD_MONTH=09;PERIOD_MONTH_PLUS=0 # PF_DianDai
PERIOD_DEFAULT_MONEY=70000
elif [ 4 -eq $INDEX ];then
RATE=0.440;PERIOD_MONTH=12;PERIOD_MONTH_PLUS=0
PERIOD_DEFAULT_MONEY=38000
elif [ 5 -eq $INDEX ];then
PERIOD_DEFAULT_MONEY=22000
RATE=0.331;PERIOD_MONTH=12;PERIOD_MONTH_PLUS=0
elif [ 6 -eq $INDEX ];then
RATE=1.019;PERIOD_MONTH=03;PERIOD_MONTH_PLUS=0
else
exit
break;
fi
PERIOD_RATE_MONEY=$(echo "scale=${SCALE};$PERIOD_DEFAULT_MONEY * $RATE * 0.01 * $PERIOD_MONTH"|bc)
for i in `seq 1 $PERIOD_MONTH`;do PERIOD_MONTH_PLUS=`expr $PERIOD_MONTH_PLUS \+ $i`;done
PAY_ALL_PER_MONTH1=$(echo "scale=${SCALE};$PERIOD_DEFAULT_MONEY * 0.01 * $RATE"|bc)
PAY_ALL_PER_MONTH2=$(echo "scale=${SCALE};$PERIOD_DEFAULT_MONEY / $PERIOD_MONTH"|bc)
PAY_ALL_PER_MONTH=$(echo "scale=${SCALE};$PAY_ALL_PER_MONTH1 + $PAY_ALL_PER_MONTH2"|bc)
USAGE_PER_MONTH=$(echo "scale=${SCALE};$PERIOD_DEFAULT_MONEY / $PERIOD_MONTH * $PERIOD_MONTH_PLUS / $PERIOD_MONTH"|bc)
RATE_PER_MONTH_1W=$(echo "scale=${SCALE};$PERIOD_DEFAULT_MONEY * 0.01 * $RATE / $USAGE_PER_MONTH * 10000"|bc)
RATE_PER_DAY_1W=$(echo "scale=${SCALE};$RATE_PER_MONTH_1W * 12 / 365"|bc)
LOOP=`expr 12 \/ $PERIOD_MONTH`;LOOP=12
G_MONEY_YEAR=$(echo "scale=${SCALE};$LOOP * $USAGE_PER_MONTH"|bc)
G_RATE_YEAR=$(echo "scale=${SCALE};365 * $RATE_PER_DAY_1W * $PERIOD_DEFAULT_MONEY / 10000"|bc)
RATEs_RATE=$(echo "scale=${SCALE};$G_RATE_YEAR * $LOOP / $G_MONEY_YEAR * 100"|bc) # Should be wrong here
RATEs_RATE2=$(echo "scale=${SCALE};$RATE_PER_DAY_1W * 365 / 100"|bc)
#echo Mon=$PERIOD_MONTH Rate=$RATE ¥/Per=$PERIOD_DEFAULT_MONEY ¥/Per.M=$USAGE_PER_MONTH ¥/Y=$G_MONEY_YEAR R/Per=$PERIOD_RATE_MONEY R/Y=$G_RATE_YEAR R/W.Mon=$RATE_PER_MONTH_1W R/W.Day=$RATE_PER_DAY_1W R/Y%=${RATEs_RATE}%
echo Mon=$PERIOD_MONTH R=$RATE PAY/M=$PAY_ALL_PER_MONTH ¥/P.M=$USAGE_PER_MONTH ¥/Y=$G_MONEY_YEAR R/P=$PERIOD_RATE_MONEY R/Y=$G_RATE_YEAR R/W.Mon=$RATE_PER_MONTH_1W R/W.Day=$RATE_PER_DAY_1W R/Y%=$RATEs_RATE2%
done
[root@localhost .data]# sh rate_GuangFa.sh
Mon=03 R=0.950 PAY/M=13027.6666 ¥/P.M=25333.3332 ¥/Y=303999.9984 R/P=1083.0000 R/Y=6475.0708 R/W.Mon=142.0000 R/W.Day=4.6684 R/Y%=17.0396%
Mon=06 R=0.500 PAY/M=6523.3333 ¥/P.M=22166.6665 ¥/Y=265999.9980 R/P=1140.0000 R/Y=3875.9715 R/W.Mon=85.0000 R/W.Day=2.7945 R/Y%=10.1999%
Mon=09 R=0.345 PAY/M=8019.2777 ¥/P.M=38888.8885 ¥/Y=466666.6620 R/P=2173.5000 R/Y=5207.8565 R/W.Mon=62.0000 R/W.Day=2.0383 R/Y%=7.4397%
Mon=12 R=0.440 PAY/M=3333.8666 ¥/P.M=20583.3329 ¥/Y=246999.9948 R/P=2006.4000 R/Y=3693.5810 R/W.Mon=81.0000 R/W.Day=2.6630 R/Y%=9.7199%
Mon=12 R=0.331 PAY/M=1906.1533 ¥/P.M=11916.6664 ¥/Y=142999.9968 R/P=873.8400 R/Y=1610.3362 R/W.Mon=61.0000 R/W.Day=2.0054 R/Y%=7.3197%
Mon=03 R=1.019 PAY/M=7557.5133 ¥/P.M=14666.6666 ¥/Y=175999.9992 R/P=672.5400 R/Y=4012.7516 R/W.Mon=152.0000 R/W.Day=4.9972 R/Y%=18.2397%
----------------------------------------------------
70000/9=7777.78 8019.39=7777.78+241.61 241.61*9=2174.49 7777.78*(1+2+3+4+5+6+7+8+9)=350000.1 2174.49/35/30=2.071
2.05/W/D 2174.54 9Month 19TH/8019.39 Rate/Year=7.395% 1257.00 SPDB_DD
ALL=38000 RATE=.95 EACH_RATE_MONEY=361.0*03=1083.0 DEFAULT=.75*1.0 JIESHENG=570.00 ALL_RATE_MONEY=13027.67
ALL=38000 RATE=.50 EACH_RATE_MONEY=190.0*06=1140.0 DEFAULT=.75*.67 JIESHENG=0.0000 ALL_RATE_MONEY=6523.33
ALL=38000 RATE=.44 EACH_RATE_MONEY=167.2*12=2006.4 DEFAULT=.75*.59 JIESHENG=1413.6 ALL_RATE_MONEY=3333.87
阅读(630) | 评论(0) | 转发(0) |