Разработка программного модуля начисления процентов

Автор работы: Пользователь скрыл имя, 08 Июня 2012 в 20:34, курсовая работа

Краткое описание

В данной курсовой работе был разработан программный модуль, обеспечиваю¬щий эффективное начисление процентов депозитным вкладам.

Содержание работы

Задание 3
Введение 4
1. Начисление процентов по вкладам 6
1.1. Депозитные вклады и их классификация 6
1.2. Формула расчета процентов по вкладам 8
2. Структура базы данных ”Депозитные вклады” 12
3. Руководство пользователя 13
3.1. Организация взаимодействия клиентской программы с БД 13
3.2. Разработка интерфейса пользователя 15
Заключение 23
Список литературы 24
Приложение 25
10. Заключение 23
11. Список литературы 24

Содержимое работы - 1 файл

Пояснительная записка2.doc

— 543.50 Кб (Скачать файл)

           end;

 

          if  periodicity = 'ежегодно' then

          if countM mod 12<>0 then

            begin

                BalanceRef := (Summa*((Rate*(countM mod 12)*(365/12))/(36500)))-(Summa * ((RateRef * (countM mod 12)*(365/12)) / (36500)));

 

              StringGrid.Cells[3,n]:=FloatToStr(round(100*Summa*((Rate*(countM mod 12)*(365/12))/(36500)))/100);

 

               BalanceRef:=round(BalanceRef*100)/100;

 

               if BalanceRef>0 then

               StringGrid.Cells[4,n]:=FloattoStr(BalanceRef)

               else

               StringGrid.Cells[4,n]:='0';

 

             if BalanceRef>0 then

               BalanceRef := BalanceRef*35/100

             else

               BalanceRef :=0;

 

               BalanceRef:=round(BalanceRef*100)/100;

              StringGrid.Cells[5,n]:=FloattoStr(BalanceRef);

               StringGrid.Cells[6,n]:=FloatToStr(StrToFloat(StringGrid.Cells[3,n])-BalanceRef);

 

              Summa := Summa+Summa*((Rate*(countM mod 12)*(365/12))/(36500))- BalanceRef;

            end ;

 

          if  periodicity = 'в конце срока' then

            begin

               BalanceRef := (Summa*((Rate*(countM)*(365/12))/(36500)))-(Summa * ((RateRef * (countM)*(365/12)) / (36500)));

 

               StringGrid.Cells[3,n]:=FloatToStr(round(100*Summa*((Rate*(countM)*(365/12))/(36500)))/100);

 

               BalanceRef:=round(BalanceRef*100)/100;

 

               if BalanceRef>0 then

               StringGrid.Cells[4,n]:=FloattoStr(BalanceRef)

               else

               StringGrid.Cells[4,n]:='0';

 

             if BalanceRef>0 then

               BalanceRef := BalanceRef*35/100

             else

               BalanceRef :=0;

 

                BalanceRef:=round(BalanceRef*100)/100;

                StringGrid.Cells[5,n]:=FloattoStr(BalanceRef);

                StringGrid.Cells[6,n]:=FloatToStr(StrToFloat(StringGrid.Cells[3,n])-BalanceRef);

 

               Summa := Summa+Summa * ((Rate * countM*(365/12)) / (36500))-BalanceRef;

            end

        end ;

 

        Summa := round((Summa+Balance)*100)/100;

 

       StringGrid.Cells[7,n] :=FloatToStr(Summa)+val;;

 

       Balance:=0;

       DecodeDate(time1, Year, Month, Day);

       Month := Month+1;

       If   Month >12 then

        begin

        Year:= Year + Month div 12;

        Month := Month mod 12;

         end;

      time1 := EncodeDate(Year, Month, Day);

 

     timeBegin := DateTimeToStr(time1);

     Delete(timeBegin , 11,10);

      StringGrid.Cells[1,n]:=timeBegin;

 

     end;

 

      StringGrid.Cells[0,countM+1]:='';

      StringGrid.Cells[1,countM+1]:='Итого:';

       StringGrid.Cells[2,countM+1]:='';

      sum:=0;

 

      for n:=1 to countM do

       begin

       sum:=sum+StrToFloat(StringGrid.Cells[3,n]);

       StringGrid.Cells[3,n]:=StringGrid.Cells[3,n]+val;

       end;

      sum:=round(sum*100)/100;

      StringGrid.Cells[3,countM+1] := floatTostr(sum)+val;

 

 

      sum:=0;

      for n:=1 to countM do

       begin

        sum:=sum+StrToFloat(StringGrid.Cells[4,n]);

        StringGrid.Cells[4,n]:=StringGrid.Cells[4,n]+val;

       end;

      sum:=round(sum*100)/100;

      StringGrid.Cells[4,countM+1] := floatTostr(sum)+val;

 

      sum:=0;

      for n:=1 to countM do

       begin

        sum:=sum+StrToFloat(StringGrid.Cells[5,n]);

        StringGrid.Cells[5,n]:=StringGrid.Cells[5,n]+val;

       end;

      sum:=round(sum*100)/100;

      StringGrid.Cells[5,countM+1] := floatTostr(sum)+val;

 

      sum:=0;

      for n:=1 to countM do

       begin

        sum:=sum+StrToFloat(StringGrid.Cells[6,n]);

        StringGrid.Cells[6,n]:=StringGrid.Cells[6,n]+Val;

       end;

      sum:=round(sum*100)/100;

      StringGrid.Cells[6,countM+1] := floatTostr(sum)+val;

 

 

      StringGrid.Cells[7,countM+1] :=StringGrid.Cells[7,countM];

 

  end;

end;

 

procedure DepositCalc();

var

  timeBegin,periodicity : string;

  time1 : TDateTime;

  countM:integer;

  n:integer;

  Balance,Summa,Rate,RateRef,BalanceRef,sum:real;

  Year, Month, Day :Word;

  begin

    with MainForm do

     begin

 

        Val := ' руб.';

 

      if ComboBox1.ItemIndex = 1

       then Val := ' $';

 

     if ComboBox1.ItemIndex = 2

      then Val := ' €';

 

 

      StringGridCalc.Cells[1,0]:=ComboBox1.Text;

      StringGridCalc.Cells[0,0]:='Валюта вклада:';

 

      StringGridCalc.Cells[1,1]:=FloatTOStr(MainForm.SpinEdit1.Value)+val;

      StringGridCalc.Cells[0,1]:=label2.Caption;

 

      StringGridCalc.Cells[1,2]:=FloatTOStr(FloatSpinEdit1.NumberValue);

      StringGridCalc.Cells[0,2]:=label3.Caption;

 

      StringGridCalc.Cells[1,3]:=ComboBox2.Text;;

      StringGridCalc.Cells[0,3]:='Начисление процентов:';

 

      StringGridCalc.Cells[1,4]:=DateToStr(DateTimePicker1.date);

      StringGridCalc.Cells[0,4]:=label5.Caption;

 

      StringGridCalc.Cells[1,5]:=DateToStr(DateTimePicker2.date);

      StringGridCalc.Cells[0,5]:=label9.Caption;

 

 

      StringGridCalc.Cells[1,6]:=IntTOStr(SpinEdit2.Value);

      StringGridCalc.Cells[0,6]:=label8.Caption;

 

 

      StringGridCalc.Cells[1,7]:=FloatTOStr(FloatSpinEdit2.NumberValue);

      StringGridCalc.Cells[0,7]:='Ставка рефинансирования (%)';

 

 

      StringGridCalc.Cells[1,8]:=FloatTOStr(FloatSpinEdit3.NumberValue);

      StringGridCalc.Cells[0,8]:='Ставка налогообложения (%)';

 

 

      Rate := FloatSpinEdit1.NumberValue;

      RateRef := FloatSpinEdit2.NumberValue;

      Summa :=SpinEdit1.Value;

      countM:= SpinEdit2.Value;

      time1:=DateTimePicker1.date;

      periodicity := ComboBox2.Text;

 

 

     StringGridDep.RowCount := countM+2;

 

     StringGridDep.Cells[0,0]:='№';

     StringGridDep.Cells[1,0]:='Дата';

     StringGridDep.Cells[2,0]:='Остаток на'#13'начало месяца';

     StringGridDep.Cells[3,0]:='Начисленно'#13'процентов';

     StringGridDep.Cells[4,0]:='Налогооблага-'#13'емый доход';

     StringGridDep.Cells[5,0]:='Сумма'#13'налога';

     StringGridDep.Cells[6,0]:='Чистая'#13'прибыль';

     StringGridDep.Cells[7,0]:='Сумма'#13'сбережений';

 

 

     For n:=1 to  countM do

      begin

        BalanceRef:=0;

       StringGridDep.Cells[0,n]:=intToStr(n);

       StringGridDep.Cells[2,n]:=FloatToStr(Summa)+val;

 

       if  periodicity = 'ежемесячно' then

        begin

         Balance := (Summa * Rate * (365/12)) / (36500);

         BalanceRef := (Summa * RateRef * (365/12)) / (36500);

        end;

 

       if  periodicity = 'ежеквартально' then

         if n mod 3=0 then

           begin

            Balance := (Summa * Rate * 3*(365/12)) / (36500);

            BalanceRef := (Summa * RateRef * 3*(365/12)) / (36500);

           end;

 

       if  periodicity =  'ежегодно' then

         if n mod 12=0 then

           begin

            Balance := (Summa * Rate) / (100);

            BalanceRef := (Summa * RateRef) / (100);

           end ;

 

       Balance:=round(Balance*100)/100;

       BalanceRef:=round(BalanceRef*100)/100;

       BalanceRef :=Balance-BalanceRef;

       BalanceRef:=round(BalanceRef*100)/100;

 

       If  BalanceRef>0 then

         begin

          StringGridDep.Cells[4,n]:=FloatToStr(BalanceRef);

           BalanceRef := BalanceRef*FloatSpinEdit3.NumberValue/100;

           BalanceRef:=round(BalanceRef*100)/100;

           StringGridDep.Cells[5,n]:=FloatToStr(BalanceRef);

         end

        else

          begin

           StringGridDep.Cells[4,n]:='0';

           StringGridDep.Cells[5,n]:='0';

          end;

 

 

       StringGridDep.Cells[3,n]:=FloatToStr(Balance);

 

       if BalanceRef>0  then

        Balance:=Balance-BalanceRef;

 

       Balance:=round(Balance*100)/100;

       StringGridDep.Cells[6,n]:=FloatToStr(Balance);

 

      if n=countM then

        begin

         if  periodicity = 'ежеквартально' then

          if countM mod 3<>0 then

           begin

             BalanceRef := (Summa*((Rate*(countM mod 3)*(365/12))/(36500)))-(Summa * ((RateRef * (countM mod 3)*(365/12)) / (36500)));

 

              StringGridDep.Cells[3,n]:=FloatToStr(round(100*Summa*((Rate*(countM  mod 3)*(365/12))/(36500)))/100);

 

              BalanceRef:=round(BalanceRef*100)/100;

 

               if BalanceRef>0 then

               StringGridDep.Cells[4,n]:=FloattoStr(BalanceRef)

               else

               StringGridDep.Cells[4,n]:='0';

 

 

             if BalanceRef>0 then

               BalanceRef := BalanceRef*FloatSpinEdit3.NumberValue/100

             else

               BalanceRef :=0;

 

                BalanceRef:=round(BalanceRef*100)/100;

              StringGridDep.Cells[5,n]:=FloattoStr(BalanceRef);

              StringGridDep.Cells[6,n]:=FloatToStr(StrToFloat(StringGridDep.Cells[3,n])-BalanceRef);

 

             Summa := Summa+Summa*((Rate*(countM mod 3)*(365/12))/(36500))- BalanceRef;

           end;

 

          if  periodicity = 'ежегодно' then

           if countM mod 12<>0 then

            begin

                BalanceRef := (Summa*((Rate*(countM mod 12)*(365/12))/(36500)))-(Summa * ((RateRef * (countM mod 12)*(365/12)) / (36500)));

 

              StringGridDep.Cells[3,n]:=FloatToStr(round(100*Summa*((Rate*(countM mod 12)*(365/12))/(36500)))/100);

 

               BalanceRef:=round(BalanceRef*100)/100;

 

               if BalanceRef>0 then

               StringGridDep.Cells[4,n]:=FloattoStr(BalanceRef)

               else

               StringGridDep.Cells[4,n]:='0';

 

             if BalanceRef>0 then

               BalanceRef := BalanceRef*FloatSpinEdit3.NumberValue/100

             else

               BalanceRef :=0;

 

               BalanceRef:=round(BalanceRef*100)/100;

              StringGridDep.Cells[5,n]:=FloattoStr(BalanceRef);

               StringGridDep.Cells[6,n]:=FloatToStr(StrToFloat(StringGridDep.Cells[3,n])-BalanceRef);

 

              Summa := Summa+Summa*((Rate*(countM mod 12)*(365/12))/(36500))- BalanceRef;

            end ;

 

          if  periodicity = 'в конце срока' then

            begin

               BalanceRef := (Summa*((Rate*(countM)*(365/12))/(36500)))-(Summa * ((RateRef * (countM)*(365/12)) / (36500)));

 

               StringGridDep.Cells[3,n]:=FloatToStr(round(100*Summa*((Rate*(countM)*(365/12))/(36500)))/100);

 

               BalanceRef:=round(BalanceRef*100)/100;

 

               if BalanceRef>0 then

               StringGridDep.Cells[4,n]:=FloattoStr(BalanceRef)

               else

               StringGridDep.Cells[4,n]:='0';

 

             if BalanceRef>0 then

               BalanceRef := BalanceRef*FloatSpinEdit3.NumberValue/100

             else

               BalanceRef :=0;

 

                BalanceRef:=round(BalanceRef*100)/100;

                StringGridDep.Cells[5,n]:=FloattoStr(BalanceRef);

                StringGridDep.Cells[6,n]:=FloatToStr(StrToFloat(StringGridDep.Cells[3,n])-BalanceRef);

 

               Summa := Summa+Summa * ((Rate * countM*(365/12)) / (36500))-BalanceRef;

            end

        end ;

 

        Summa := round((Summa+Balance)*100)/100;

 

       StringGridDep.Cells[7,n] :=FloatToStr(Summa)+val;

 

       Balance:=0;

       DecodeDate(time1, Year, Month, Day);

       Month := Month+1;

       If   Month >12 then

        begin

        Year:= Year + Month div 12;

        Month := Month mod 12;

         end;

      time1 := EncodeDate(Year, Month, Day);

 

     timeBegin := DateTimeToStr(time1);

     Delete(timeBegin , 11,10);

      StringGridDep.Cells[1,n]:=timeBegin;

 

     end;

 

      StringGridDep.Cells[0,countM+1]:='';

      StringGridDep.Cells[1,countM+1]:='Итого:';

       StringGridDep.Cells[2,countM+1]:='';

      sum:=0;

      for n:=1 to countM do

       begin

        sum:=sum+StrToFloat(StringGridDep.Cells[3,n]);

        StringGridDep.Cells[3,n]:=StringGridDep.Cells[3,n]+val;

       end;

      sum:=round(sum*100)/100;

      StringGridDep.Cells[3,countM+1] := floatTostr(sum)+val;

 

 

      sum:=0;

      for n:=1 to countM do

       begin

        sum:=sum+StrToFloat(StringGridDep.Cells[4,n]);

        StringGridDep.Cells[4,n]:=StringGridDep.Cells[4,n]+val;

       end;

      sum:=round(sum*100)/100;

      StringGridDep.Cells[4,countM+1] := floatTostr(sum)+val;

 

      sum:=0;

      for n:=1 to countM do

       begin

        sum:=sum+StrToFloat(StringGridDep.Cells[5,n]);

        StringGridDep.Cells[5,n]:=StringGridDep.Cells[5,n]+val

       end;

      sum:=round(sum*100)/100;

      StringGridDep.Cells[5,countM+1] := floatTostr(sum)+val;

 

      sum:=0;

      for n:=1 to countM do

       begin

       sum:=sum+StrToFloat(StringGridDep.Cells[6,n]);

       StringGridDep.Cells[6,n]:=StringGridDep.Cells[6,n]+val;

       end;

      sum:=round(sum*100)/100;

      StringGridDep.Cells[6,countM+1] := floatTostr(sum)+val;

 

 

      StringGridDep.Cells[7,countM+1] :=StringGridDep.Cells[7,countM];

 

 

      StringGridCalc.Cells[1,9]:= StringGridDep.Cells[3,countM+1];

      StringGridCalc.Cells[0,9]:='Начисленно процентов';

 

      StringGridCalc.Cells[1,10]:= StringGridDep.Cells[4,countM+1];

      StringGridCalc.Cells[0,10]:='Налогооблагаемый доход';

 

      StringGridCalc.Cells[1,11]:= StringGridDep.Cells[5,countM+1];

      StringGridCalc.Cells[0,11]:='Сумма налога';

 

      StringGridCalc.Cells[1,12]:= StringGridDep.Cells[6,countM+1];

      StringGridCalc.Cells[0,12]:='Чистая прибыль';

 

      StringGridCalc.Cells[1,13]:= StringGridDep.Cells[7,countM];

      StringGridCalc.Cells[0,13]:='Сумма сбережений';

 

   end;

 

  end;

 

 

procedure TMainForm.ComboBox1Select(Sender: TObject);

begin

  case  ComboBox1.ItemIndex of

   0: begin

       label2.Caption := 'Сумма вклада (RUB):';

       FloatSpinEdit2.NumberValue:=13;

      end;

   1: begin

       label2.Caption := 'Сумма вклада (USD):';

        FloatSpinEdit2.NumberValue:=9;

      end;

   2: begin

      label2.Caption := 'Сумма вклада (EUR):';

       FloatSpinEdit2.NumberValue:=9;

     end

   end;

   DepositCalc();

 

end;

 

 

procedure TMainForm.DateTimePicker1Change(Sender: TObject);

begin

  DateTimePicker2.Date := IncMonth(DateTimePicker1.Date,SpinEdit2.Value)+1;

  DepositCalc();

end;

 

procedure TMainForm.SpinEdit2Change(Sender: TObject);

begin

   if SpinEdit2.Value>0 then

    if DateTimePicker1.Date<DateTimePicker2.Date then

   DateTimePicker2.Date := IncMonth(DateTimePicker1.Date,SpinEdit2.Value);

   DepositCalc();

end;

 

procedure TMainForm.DateTimePicker2Change(Sender: TObject);

begin

  if DateTimePicker1.Date<DateTimePicker2.Date

   then

    SpinEdit2.Value :=MonthsBetween(DateTimePicker1.Date,DateTimePicker2.Date)

   else

    begin

     SpinEdit2.Value:=1;

     DateTimePicker2.Date:=DateTimePicker1.Date;

 

    end;

 

  DepositCalc();

end;

 

 

procedure TMainForm.GroupBox1MouseDown(Sender: TObject;

  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

begin

    if DateTimePicker1.Date<DateTimePicker2.Date

   then

    SpinEdit2.Value :=MonthsBetween(DateTimePicker1.Date,DateTimePicker2.Date)

   else

    begin

     SpinEdit2.Value:=1;

     DateTimePicker2.Date:=IncMonth(DateTimePicker1.Date);

 

    end;

    DepositCalc();

end;

 

procedure TMainForm.GroupBox1MouseMove(Sender: TObject; Shift: TShiftState;

  X, Y: Integer);

begin

{  if DateTimePicker1.Date<DateTimePicker2.Date

   then

     begin

    if  SpinEdit2.Value mod 12 <>0 then

    SpinEdit2.Value :=MonthsBetween(DateTimePicker1.Date,DateTimePicker2.Date)

    end

   else

    begin

     SpinEdit2.Value:=1;

     DateTimePicker2.Date:=incMonth(DateTimePicker1.Date);

    end;

 

    DepositCalc(); }

end;

 

procedure TMainForm.SpinEdit1Change(Sender: TObject);

begin

DepositCalc();

end;

 

procedure TMainForm.FloatSpinEdit1EdtChange(Sender: TObject);

begin

DepositCalc();

end;

 

procedure TMainForm.ComboBox2Change(Sender: TObject);

begin

DepositCalc();

end;

 

procedure TMainForm.FloatSpinEdit2EdtChange(Sender: TObject);

begin

DepositCalc();

end;

 

procedure TMainForm.FloatSpinEdit3EdtChange(Sender: TObject);

begin

DepositCalc();

end;

 

 

procedure TMainForm.FormCreate(Sender: TObject);

var

f:textfile;

begin

 

Assignfile (f, 'Config.txt');

Reset (f);

Readln (f,CONECT_STR);

closefile (f);

   try

  ADOConnection.ConnectionString := CONECT_STR;

  except

  application.MessageBox( 'База не найдена', 'Ошибка',MB_OK);

Информация о работе Разработка программного модуля начисления процентов